This is an archive of the discontinued LLVM Phabricator instance.

[MC] Avoid inlining constant symbols with variants.
ClosedPublic

Authored by niravd on Sep 17 2018, 1:07 PM.

Details

Summary

Defer unnecessary early inlining of constants to symbol
variants. Fixes PR38945.

Diff Detail

Event Timeline

niravd created this revision.Sep 17 2018, 1:07 PM
rnk accepted this revision.Sep 17 2018, 1:10 PM

lgtm

This revision is now accepted and ready to land.Sep 17 2018, 1:10 PM
llvm/lib/MC/MCParser/AsmParser.cpp
1128

I'm not super enthused about relying on the enum's value being zero as opposed to checking that Variant == MCSymbolRefExpr::VK_None, but it looks like it's done so anyways on L1132, so I guess it's fine.

llvm/test/MC/PowerPC/pr38945.s
9

Can you add a test for the - prefix for negating the number, too (assuming it works and doesn't need additional code changed)?

ie

cmpwi 8,(-NUMBER)@l
cmpwi 8,-NUMBER@l
This revision was automatically updated to reflect the committed changes.