[SCEV] Don't consider umin_seq scev expr to be more complex that ptrtoint scev expr
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 13 Jan 2022 20:55:00 +0000 (23:55 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 13 Jan 2022 20:59:47 +0000 (23:59 +0300)
Let's consider sequential min/max expression family
to be more complex than their non-sequential counterparts,
preserving internal ordering within them.

llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll

index 4416fdb..27542bc 100644 (file)
@@ -50,8 +50,8 @@ enum SCEVTypes : unsigned short {
   scSMaxExpr,
   scUMinExpr,
   scSMinExpr,
-  scPtrToInt,
   scSequentialUMinExpr,
+  scPtrToInt,
   scUnknown,
   scCouldNotCompute
 };
index 629b292..1de3014 100644 (file)
@@ -429,7 +429,7 @@ define i64 @uminseq_vs_ptrtoint_complexity(i64 %n, i64 %m, i64* %ptr) {
 ; CHECK-NEXT:    %ptr.int = ptrtoint i64* %ptr to i64
 ; CHECK-NEXT:    --> (ptrtoint i64* %ptr to i64) U: full-set S: full-set
 ; CHECK-NEXT:    %r = add i64 %i, %ptr.int
-; CHECK-NEXT:    --> {(ptrtoint i64* %ptr to i64),+,1}<%loop> U: full-set S: full-set --> ((ptrtoint i64* %ptr to i64) + (%n umin_seq %m)) U: full-set S: full-set
+; CHECK-NEXT:    --> {(ptrtoint i64* %ptr to i64),+,1}<%loop> U: full-set S: full-set --> ((%n umin_seq %m) + (ptrtoint i64* %ptr to i64)) U: full-set S: full-set
 ; CHECK-NEXT:  Determining loop execution counts for: @uminseq_vs_ptrtoint_complexity
 ; CHECK-NEXT:  Loop %loop: backedge-taken count is (%n umin_seq %m)
 ; CHECK-NEXT:  Loop %loop: max backedge-taken count is -1