This is an archive of the discontinued LLVM Phabricator instance.

[AsmPrinter] Fix emission of non-standard integer constants for BE targets
ClosedPublic

Authored by LemonBoy on Apr 13 2020, 3:15 AM.

Details

Summary

The code assumed that zero-extending the integer constant to the designated alloc size would be fine even for BE targets, but that's not the case as that pulls in zeros from the MSB side while we actually expect the padding zeros to go after the LSB.

I've changed the codepath handling the constant integers to use the store size for both small(er than u64) and big constants and then add zero padding right after that.

Diff Detail

Event Timeline

LemonBoy created this revision.Apr 13 2020, 3:15 AM
LemonBoy set the repository for this revision to rG LLVM Github Monorepo.Apr 13 2020, 3:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2020, 3:40 AM
qcolombet accepted this revision.Apr 15 2020, 12:02 PM

Nice catch!

The new assembly makes sense to me. Thanks for fixing it!

This revision is now accepted and ready to land.Apr 15 2020, 12:02 PM

Can you (or anyone) commit this on my behalf? I don't have commit access.

How do you want to be credited in the "author" line of the git commit (name+email)?

Yeah, that's fine

This revision was automatically updated to reflect the committed changes.