[PATCH] D22959: MachineLoopInfo: add methods findLoopPreheader and getExitingBlock

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 06:39:23 PDT 2016


kparzysz added inline comments.

================
Comment at: lib/CodeGen/MachineLoopInfo.cpp:84
@@ +83,3 @@
+
+  MachineBasicBlock *HB = L->getHeader(), *LB = L->getLoopLatch();
+  if (HB->pred_size() != 2 || HB->hasAddressTaken())
----------------
This part is finding a block that can enter the loop header, but may also go somewhere else.  On Hexagon we can use it to put the hardware loop setup here, since it can be safely speculated.  Code that cannot be speculated cannot be placed here.
Maybe you could add a parameter to let the caller decide whether they want just the regular preheader, or a speculative one.

On a different note, have you checked how many potential users for this are there?  Is there a demand for this?

================
Comment at: lib/Target/Hexagon/HexagonHardwareLoops.cpp:1810
@@ -1822,5 +1809,3 @@
 MachineBasicBlock *HexagonHardwareLoops::findLoopPreheader(MachineLoop *L)
       const {
   if (!SpecPreheader)
----------------
The lines 1824-1825 must be present here.  This function needs to return a regular preheader, and if the SpecPreheader is specified, the speculative one, if it can find it.


https://reviews.llvm.org/D22959





More information about the llvm-commits mailing list