[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
Fri Mar 1 03:06:25 PST 2019


andreadb added inline comments.


================
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);
----------------
andreadb wrote:
> 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.
On a second thought. It may not be easy to do what I suggested in that comment. So, I am okay if you iterate instructions again.
You can probably move this loop before the splice at line 28817. The advantage is that you can perform a potentially more readable forward iteration. It would allow you to can replace calls to `insert` with calls to `SinkMBB->push_back(CurInst)`.


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