[PATCH] D58059: [AArch64] Print instruction before atomic semantic annotations

David Spickett via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 11 09:00:02 PST 2019

DavidSpickett created this revision.
DavidSpickett added a reviewer: t.p.northover.
Herald added subscribers: llvm-commits, kristof.beyls, javed.absar.
Herald added a project: LLVM.

Commit r353303 added annotations when acquire semantics
were dropped from an instruction.

As printAnnotation was called before printInstruction,
if you didn't set a separate comment output stream
you got <comment><instr> instead of <instr><comment>
as expected.

This change updates the usage to match other printAnnotation.
Print the instruction, then the annotation, then return.




Index: lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
--- lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
+++ lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
@@ -71,8 +71,12 @@
   if (atomicBarrierDroppedOnZero(Opcode) &&
       (MI->getOperand(0).getReg() == AArch64::XZR ||
-       MI->getOperand(0).getReg() == AArch64::WZR))
+       MI->getOperand(0).getReg() == AArch64::WZR)) {
+    if (!printAliasInstr(MI, STI, O))
+          printInstruction(MI, STI, O);
     printAnnotation(O, "acquire semantics dropped since destination is zero");
+    return;
+  }
   // SBFM/UBFM should print to a nicer aliased form if possible.
   if (Opcode == AArch64::SBFMXri || Opcode == AArch64::SBFMWri ||

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58059.186270.patch
Type: text/x-patch
Size: 786 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190211/1f43437e/attachment.bin>

More information about the llvm-commits mailing list