[llvm] [ConstraintElim] Generalize IV logic to chain of exiting blocks. (PR #108031)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 01:44:58 PDT 2024


================
@@ -1048,6 +1053,28 @@ void State::addInfoForInductions(BasicBlock &BB) {
   }
 }
 
+void State::addInfoForInductions(BasicBlock &BB) {
+  auto *L = LI.getLoopFor(&BB);
+  if (!L)
+    return;
+  if (L->getHeader() != &BB)
+    return;
+
+  BasicBlock *Curr = &BB;
+  while (L->isLoopExiting(Curr)) {
----------------
nikic wrote:

This looks pretty weird to me -- how is the fact that it's an exit chain from the header relevant?  I'd expect us to either inspect all exits or all latch-dominating exits (I'd have to look closer to check which one is correct).

https://github.com/llvm/llvm-project/pull/108031


More information about the llvm-commits mailing list