[PATCH] D55987: [CodeGen] Skip over dbg-instr in twoaddr pass

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 21 20:34:50 PST 2018


vsk added a comment.

Thanks for the patch!



================
Comment at: lib/CodeGen/TwoAddressInstructionPass.cpp:932
   MachineBasicBlock::iterator End = AfterMI;
-  while (End->isCopy() &&
-         regOverlapsSet(Defs, End->getOperand(1).getReg(), TRI)) {
-    Defs.push_back(End->getOperand(0).getReg());
+  while (End->isDebugInstr() ||
+         (End->isCopy() &&
----------------
aprantl wrote:
> For IR we have an iterator that skips over debug intrinsics automatically. Does the same thing exist for MIR, too?
Yes, I believe we have skipDebugInstructionsForward / skipDebugInstructionsBackward. It might be neat to use that here.


================
Comment at: test/CodeGen/X86/twoaddr-dbg-value.mir:12
+    %4:gr32 = XOR32ri8 %1, 1, implicit-def dead $eflags
+    DBG_VALUE %4
+    %5:gr32 = COPY %4
----------------
This is mostly an academic question, but: is this a valid DBG_VALUE? I'm a little surprised this parses (I'd expect the instruction to have more operands), but I like the simplicity of it.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55987/new/

https://reviews.llvm.org/D55987





More information about the llvm-commits mailing list