[PATCH] D58672: [X86] Avoid codegen changes when DBG_VALUE appears between lowered selects

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 28 11:05:55 PST 2019


andreadb added inline comments.


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:28780-28782
+      do {
+        ++NextMIIt;
+      } while (NextMIIt != ThisMBB->end() && NextMIIt->isDebugInstr());
----------------
I think you can use function `skipDebugInstructionsForward()` to update that iterator. It would also make this code a bit more readable.


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:28821-28829
+  // Transfer any debug instructions inside the CMOV sequence to the sunk block.
+  for (auto DbgIt = MachineBasicBlock::iterator(LastCMOV); &*DbgIt != &MI;) {
+    MachineInstr *CurInst = &*DbgIt;
+    --DbgIt;
+    if (CurInst->isDebugInstr()) {
+      CurInst->removeFromParent();
+      SinkMBB->insert(SinkMBB->begin(), CurInst);
----------------
Here you iterate from LastCMOV to MI to search for any debug instructions to sink.
Why don't you collect those directly from the loop starting at line 28778.
Basically - if I understand this code correctly - you are scanning the code sequence twice.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D58672





More information about the llvm-commits mailing list