This is an archive of the discontinued LLVM Phabricator instance.

[ARM][NFC] Avoid recreating MCSubtargetInfo in ARMAsmBackend
ClosedPublic

Authored by asb on Jan 3 2018, 2:20 AM.

Details

Summary

After D41349, we can now directly access MCSubtargetInfo from createARM*AsmBackend. This patch makes use of this, avoiding the need to create a fresh MCSubtargetInfo (which was previously always done with a blank CPU and feature string). Given the total size of the change remains pretty tiny and we're removing the old explicit destructor, I changed the STI field to a reference rather than a pointer.

Diff Detail

Repository
rL LLVM

Event Timeline

asb created this revision.Jan 3 2018, 2:20 AM
fhahn accepted this revision.Jan 3 2018, 2:30 AM

Great, thank you very much for cleaning that up Alex! It would be great if you could replace the string search for "thumb" with isThumb() before committing

lib/Target/ARM/MCTargetDesc/ARMAsmBackend.h
28 ↗(On Diff #128500)

Could you use STI.getTargetTriple().isThumb() here?

This revision is now accepted and ready to land.Jan 3 2018, 2:30 AM
This revision was automatically updated to reflect the committed changes.
echristo added inline comments.
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.h
26

The Target also appears to be unnecessary.

chh added a subscriber: chh.Feb 27 2018, 12:17 PM

This change produced a new error with LTO and AOSP ARM thumb code.
Please see a reduced test case at https://bugs.llvm.org/show_bug.cgi?id=36542