[llvm] [SCEV] Make operand complexity order total. (PR #230252)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 01:55:43 PDT 2026


================
@@ -672,9 +674,10 @@ CompareSCEVComplexity(const LoopInfo *const LI, const SCEV *LHS,
     const SCEVUnknown *LU = cast<SCEVUnknown>(LHS);
     const SCEVUnknown *RU = cast<SCEVUnknown>(RHS);
 
-    int X =
-        CompareValueComplexity(LI, LU->getValue(), RU->getValue(), Depth + 1);
-    return X;
+    if (int X = CompareValueComplexity(LI, LU->getValue(), RU->getValue(),
----------------
fhahn wrote:

Thinking a bit more about it I think the cutoff should be fine. If (A, B) hits the cutoff, then all fields up to the cut-off are equal. If (A, C) and (B, C)  do not hit the cut-off, and decide only on the fields that are the same in A and B, so we get the consistent decisions for both.

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


More information about the llvm-commits mailing list