[llvm] [llvm][ARM] Add a cortex-m4f alignment hazard recognizer (PR #126991)

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 11:32:07 PST 2025


================
@@ -1445,6 +1446,9 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
     InConstantPool = false;
   }
 
+  if (MI->getAsmPrinterFlag(MachineInstr::CommentFlag(ARM::ALIGNMENT_HAZARD)))
+    OutStreamer->AddComment("alignment hazard");
----------------
jroelofs wrote:

I wrote the MIR tests, it was useful for spotting when the transformation kicked in. I also figured it would help avoid questions as to where the nops are coming from and why they're there from some of our perf-sensitive internal users who might not know about this cortex-m4f quirk.

I can keep this as a downstream change if that doesn't feel compelling to you.

https://github.com/llvm/llvm-project/pull/126991


More information about the llvm-commits mailing list