This is an archive of the discontinued LLVM Phabricator instance.

[MC] Add Subtarget for MAsmParser call to emitCodeAlignment
ClosedPublic

Authored by peter.smith on Sep 8 2021, 2:44 AM.

Details

Summary

The call to emitCodeAlignment was missing a STI which is required after D45962.

Should fix the problem reported in D45962 https://reviews.llvm.org/D45962#2988712

emitCodeAlignment has a default parameter of 0 for MaxBytesToEmit. Explicitly passing 0 here was interpreted as as nullptr for the STI. This could possibly be avoided by taking STI as a const reference in emitCodeAlignment. This could be done as a follow up patch to get the fix for the problem resolved.

Diff Detail

Event Timeline

peter.smith created this revision.Sep 8 2021, 2:44 AM
peter.smith requested review of this revision.Sep 8 2021, 2:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2021, 2:44 AM
mstorsjo accepted this revision.Sep 8 2021, 4:25 AM

LGTM, thanks!

I'll leave it as a separate change for @epastor or myself to add a testcase for llvm-ml that covers that codepath.

This revision is now accepted and ready to land.Sep 8 2021, 4:25 AM
This revision was landed with ongoing or failed builds.Sep 8 2021, 5:29 AM
This revision was automatically updated to reflect the committed changes.

Thanks for getting to it so quickly!

This code is similar to code in AsmParser.cpp (https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCParser/AsmParser.cpp#L3344-L3351) - looks like that will probably need an update as well, to keep MaxBytesToFill from being interpreted as a pointer?

This code is similar to code in AsmParser.cpp (https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCParser/AsmParser.cpp#L3344-L3351) - looks like that will probably need an update as well, to keep MaxBytesToFill from being interpreted as a pointer?

Yes, I managed to catch that one in D45961 that reference from llvm-mirror might be a little bit out of date. I think https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MCParser/AsmParser.cpp#L3457 is where the code is now. Hope I've not missed something.

This code is similar to code in AsmParser.cpp (https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCParser/AsmParser.cpp#L3344-L3351) - looks like that will probably need an update as well, to keep MaxBytesToFill from being interpreted as a pointer?

Yes, I managed to catch that one in D45961 that reference from llvm-mirror might be a little bit out of date. I think https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MCParser/AsmParser.cpp#L3457 is where the code is now. Hope I've not missed something.

Great, looks good!