[llvm] f54c6b4 - [IndVarSimplify] Bail out if not a branch in `maybeFloatingPointRecurrence`

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 28 02:12:17 PST 2025


Author: Antonio Frighetto
Date: 2025-11-28T11:07:38+01:00
New Revision: f54c6b4306a3f92c08aeb8a9fa222b88985cb9ef

URL: https://github.com/llvm/llvm-project/commit/f54c6b4306a3f92c08aeb8a9fa222b88985cb9ef
DIFF: https://github.com/llvm/llvm-project/commit/f54c6b4306a3f92c08aeb8a9fa222b88985cb9ef.diff

LOG: [IndVarSimplify] Bail out if not a branch in `maybeFloatingPointRecurrence`

clang-riscv-gauntlet buildbot was previously failing. Conservatively
bail out if not handling a branch when looking for floating-point
recurrences, we may wish to support select and branch in the future.

Fixes: https://lab.llvm.org/buildbot/#/builders/210/builds/5908.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 9900a130fa520..400cb1ecb5e03 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -306,6 +306,9 @@ maybeFloatingPointRecurrence(Loop *L, PHINode *PN) {
   // The branch block must be in the loop and one of the successors must be out
   // of the loop.
   auto *BI = dyn_cast<BranchInst>(Compare->user_back());
+  if (!BI)
+    return std::nullopt;
+
   assert(BI->isConditional() && "Can't use fcmp if not conditional");
   if (!L->contains(BI->getParent()) ||
       (L->contains(BI->getSuccessor(0)) && L->contains(BI->getSuccessor(1))))


        


More information about the llvm-commits mailing list