This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Use TargetMachine MCSubtargetInfo in RISCVAsmPrinter::EmitHwasanMemaccessSymbols.
ClosedPublic

Authored by craig.topper on Jan 18 2023, 10:25 AM.

Details

Summary

The STI object in the class is updated each time runOnMachineFunction
is called. That means STI will be based on the last function processed.
If that function has different attributes than the rest of the module
that could theoretically result in odd behavior.

Use the copy in TargetMachine instead. That will use the global
CPU and mattrs.

Diff Detail

Event Timeline

craig.topper created this revision.Jan 18 2023, 10:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2023, 10:25 AM
craig.topper requested review of this revision.Jan 18 2023, 10:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2023, 10:25 AM
reames accepted this revision.Jan 18 2023, 10:39 AM

LGTM w/comment addressed.

llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
267

Add a comment which highlights why we want the TM version here please.

This revision is now accepted and ready to land.Jan 18 2023, 10:39 AM