[PATCH] D84849: GlobalISel: Handle llvm.localescape

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 09:37:09 PDT 2020


paquette added a comment.





================
Comment at: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp:1687
+          MF->getMMI().getContext().getOrCreateFrameAllocSymbol(
+              GlobalValue::dropLLVMManglingEscape(MF->getName()), Idx);
+
----------------
Maybe pull the `GlobalValue::dropLLVMManglingEscape(MF->getName())` out of the loop?


================
Comment at: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp:1695
+
+      MachineBasicBlock &EntryMBB = MF->front();
+      EntryMBB.insert(EntryMBB.begin(), LocalEscape);
----------------
Move this out of the loop?


================
Comment at: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp:1696
+      MachineBasicBlock &EntryMBB = MF->front();
+      EntryMBB.insert(EntryMBB.begin(), LocalEscape);
+    }
----------------
Apparently MachineBasicBlock lets you insert ranges of instructions at once:

```
  /// Insert a range of instructions into the instruction list before I.
  template<typename IT>
  void insert(iterator I, IT S, IT E) {
    assert((I == end() || I->getParent() == this) &&
           "iterator points outside of basic block");
    Insts.insert(I.getInstrIterator(), S, E);
  }
```

If this accepts a vector, then you could probably use it to reproduce SDAG's ordering.

(Or I guess you could iterate over the arguments starting at `CI.getNumArgOperands()` instead of 0)


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

https://reviews.llvm.org/D84849



More information about the llvm-commits mailing list