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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 13 01:43:28 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();
----------------
nikic wrote:

Pred is also used in the return value of the function.

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


More information about the llvm-commits mailing list