[llvm] [SCEV] Discard samesign when analyzing loop invariant exits (PR #181171)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 13 01:37:10 PST 2026


================
@@ -11496,6 +11496,11 @@ ScalarEvolution::getLoopInvariantExitCondDuringFirstIterationsImpl(
   if (!AR || AR->getLoop() != L)
     return std::nullopt;
 
+  // Even if both are valid, we need to consistently chose the unsigned or the
+  // signed predicate below, not mixtures of both. For now, prefer the unsigned
+  // predicate.
+  Pred = Pred.dropSameSign();
----------------
artagnon wrote:

So the issue is the call to isLoopEdgeGuardedByCondition, right? In that case, can we just .dropSameSign() on its Pred argument?

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


More information about the llvm-commits mailing list