Skip to content

[SCEV] Remove existing predicates implied by newly added ones. #118185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

fhahn
Copy link
Contributor

@fhahn fhahn commented Nov 30, 2024

When adding a new predicate to a union predicate, some of the existing
predicates may be implied by the new predicate. Remove any existing
predicates that are already implied by the new predicate.

Depends on #118184 to show the main benefit (changes included in this PR).

@llvmbot
Copy link
Member

llvmbot commented Nov 30, 2024

@llvm/pr-subscribers-llvm-analysis

@llvm/pr-subscribers-llvm-transforms

Author: Florian Hahn (fhahn)

Changes

When adding a new predicate to a union predicate, some of the existing
predicates may be implied by the new predicate. Remove any existing
predicates that are already implied by the new predicate.

Depends on #118184 to show the main benefit (changes included in this PR).


Patch is 68.23 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/118185.diff

14 Files Affected:

  • (modified) llvm/include/llvm/Analysis/ScalarEvolution.h (+7-6)
  • (modified) llvm/lib/Analysis/ScalarEvolution.cpp (+82-23)
  • (modified) llvm/test/Analysis/LoopAccessAnalysis/memcheck-wrapping-pointers.ll (+5-7)
  • (modified) llvm/test/Analysis/LoopAccessAnalysis/nssw-predicate-implied.ll (+3-6)
  • (modified) llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/induction-costs-sve.ll (-2)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll (-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/cost-model.ll (+1-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/interleave-cost.ll (+2-586)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/pr72969.ll (-1)
  • (modified) llvm/test/Transforms/LoopVectorize/no-fold-tail-by-masking-iv-external-uses.ll (+1-7)
  • (modified) llvm/test/Transforms/LoopVectorize/scev-exit-phi-invalidation.ll (+18-23)
  • (modified) llvm/test/Transforms/LoopVectorize/scev-predicate-reasoning.ll (+14-20)
  • (modified) llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll (+1-3)
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 885c5985f9d23a..27df25cbf2b7d2 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -241,7 +241,7 @@ class SCEVPredicate : public FoldingSetNode {
   virtual bool isAlwaysTrue() const = 0;
 
   /// Returns true if this predicate implies \p N.
-  virtual bool implies(const SCEVPredicate *N) const = 0;
+  virtual bool implies(const SCEVPredicate *N, ScalarEvolution &SE) const = 0;
 
   /// Prints a textual representation of this predicate with an indentation of
   /// \p Depth.
@@ -286,7 +286,7 @@ class SCEVComparePredicate final : public SCEVPredicate {
                        const SCEV *LHS, const SCEV *RHS);
 
   /// Implementation of the SCEVPredicate interface
-  bool implies(const SCEVPredicate *N) const override;
+  bool implies(const SCEVPredicate *N, ScalarEvolution &SE) const override;
   void print(raw_ostream &OS, unsigned Depth = 0) const override;
   bool isAlwaysTrue() const override;
 
@@ -393,7 +393,7 @@ class SCEVWrapPredicate final : public SCEVPredicate {
 
   /// Implementation of the SCEVPredicate interface
   const SCEVAddRecExpr *getExpr() const;
-  bool implies(const SCEVPredicate *N) const override;
+  bool implies(const SCEVPredicate *N, ScalarEvolution &SE) const override;
   void print(raw_ostream &OS, unsigned Depth = 0) const override;
   bool isAlwaysTrue() const override;
 
@@ -418,16 +418,17 @@ class SCEVUnionPredicate final : public SCEVPredicate {
   SmallVector<const SCEVPredicate *, 16> Preds;
 
   /// Adds a predicate to this union.
-  void add(const SCEVPredicate *N);
+  void add(const SCEVPredicate *N, ScalarEvolution &SE);
 
 public:
-  SCEVUnionPredicate(ArrayRef<const SCEVPredicate *> Preds);
+  SCEVUnionPredicate(ArrayRef<const SCEVPredicate *> Preds,
+                     ScalarEvolution &SE);
 
   ArrayRef<const SCEVPredicate *> getPredicates() const { return Preds; }
 
   /// Implementation of the SCEVPredicate interface
   bool isAlwaysTrue() const override;
-  bool implies(const SCEVPredicate *N) const override;
+  bool implies(const SCEVPredicate *N, ScalarEvolution &SE) const override;
   void print(raw_ostream &OS, unsigned Depth) const override;
 
   /// We estimate the complexity of a union predicate as the size number of
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index c3f296b9ff3347..5fe9a814a28fb5 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -5725,8 +5725,9 @@ bool PredicatedScalarEvolution::areAddRecsEqualWithPreds(
     return true;
 
   auto areExprsEqual = [&](const SCEV *Expr1, const SCEV *Expr2) -> bool {
-    if (Expr1 != Expr2 && !Preds->implies(SE.getEqualPredicate(Expr1, Expr2)) &&
-        !Preds->implies(SE.getEqualPredicate(Expr2, Expr1)))
+    if (Expr1 != Expr2 &&
+        !Preds->implies(SE.getEqualPredicate(Expr1, Expr2), SE) &&
+        !Preds->implies(SE.getEqualPredicate(Expr2, Expr1), SE))
       return false;
     return true;
   };
@@ -14823,7 +14824,7 @@ class SCEVPredicateRewriter : public SCEVRewriteVisitor<SCEVPredicateRewriter> {
   bool addOverflowAssumption(const SCEVPredicate *P) {
     if (!NewPreds) {
       // Check if we've already made this assumption.
-      return Pred && Pred->implies(P);
+      return Pred && Pred->implies(P, SE);
     }
     NewPreds->push_back(P);
     return true;
@@ -14904,7 +14905,8 @@ SCEVComparePredicate::SCEVComparePredicate(const FoldingSetNodeIDRef ID,
   assert(LHS != RHS && "LHS and RHS are the same SCEV");
 }
 
-bool SCEVComparePredicate::implies(const SCEVPredicate *N) const {
+bool SCEVComparePredicate::implies(const SCEVPredicate *N,
+                                   ScalarEvolution &SE) const {
   const auto *Op = dyn_cast<SCEVComparePredicate>(N);
 
   if (!Op)
@@ -14934,10 +14936,52 @@ SCEVWrapPredicate::SCEVWrapPredicate(const FoldingSetNodeIDRef ID,
 
 const SCEVAddRecExpr *SCEVWrapPredicate::getExpr() const { return AR; }
 
-bool SCEVWrapPredicate::implies(const SCEVPredicate *N) const {
+bool SCEVWrapPredicate::implies(const SCEVPredicate *N,
+                                ScalarEvolution &SE) const {
   const auto *Op = dyn_cast<SCEVWrapPredicate>(N);
+  if (!Op)
+    return false;
+
+  if (setFlags(Flags, Op->Flags) != Flags)
+    return false;
+
+  if (Op->AR == AR)
+    return true;
+
+  if (Flags != SCEVWrapPredicate::IncrementNSSW &&
+      Flags != SCEVWrapPredicate::IncrementNUSW)
+    return false;
+
+  bool IsNUW = Flags == SCEVWrapPredicate::IncrementNUSW;
+  const SCEV *Step = AR->getStepRecurrence(SE);
+  const SCEV *OpStep = Op->AR->getStepRecurrence(SE);
+
+  // If both steps are positive, this implies N, if N's start and step are
+  // ULE/SLE (for NSUW/NSSW) than this'.
+  if (SE.isKnownPositive(Step) && SE.isKnownPositive(OpStep)) {
+    const SCEV *OpStart = Op->AR->getStart();
+    const SCEV *Start = AR->getStart();
+    if (SE.getTypeSizeInBits(Step->getType()) >
+        SE.getTypeSizeInBits(OpStep->getType())) {
+      OpStep = SE.getZeroExtendExpr(OpStep, Step->getType());
+    } else {
+      Step = IsNUW ? SE.getNoopOrZeroExtend(Step, OpStep->getType())
+                   : SE.getNoopOrSignExtend(Step, OpStep->getType());
+    }
+    if (SE.getTypeSizeInBits(Start->getType()) >
+        SE.getTypeSizeInBits(OpStart->getType())) {
+      OpStart = IsNUW ? SE.getZeroExtendExpr(OpStart, Start->getType())
+                      : SE.getSignExtendExpr(OpStart, Start->getType());
+    } else {
+      Start = IsNUW ? SE.getNoopOrZeroExtend(Start, OpStart->getType())
+                    : SE.getNoopOrSignExtend(Start, OpStart->getType());
+    }
 
-  return Op && Op->AR == AR && setFlags(Flags, Op->Flags) == Flags;
+    CmpInst::Predicate Pred = IsNUW ? CmpInst::ICMP_ULE : CmpInst::ICMP_SLE;
+    return SE.isKnownPredicate(Pred, OpStep, Step) &&
+           SE.isKnownPredicate(Pred, OpStart, Start);
+  }
+  return false;
 }
 
 bool SCEVWrapPredicate::isAlwaysTrue() const {
@@ -14981,10 +15025,11 @@ SCEVWrapPredicate::getImpliedFlags(const SCEVAddRecExpr *AR,
 }
 
 /// Union predicates don't get cached so create a dummy set ID for it.
-SCEVUnionPredicate::SCEVUnionPredicate(ArrayRef<const SCEVPredicate *> Preds)
-  : SCEVPredicate(FoldingSetNodeIDRef(nullptr, 0), P_Union) {
+SCEVUnionPredicate::SCEVUnionPredicate(ArrayRef<const SCEVPredicate *> Preds,
+                                       ScalarEvolution &SE)
+    : SCEVPredicate(FoldingSetNodeIDRef(nullptr, 0), P_Union) {
   for (const auto *P : Preds)
-    add(P);
+    add(P, SE);
 }
 
 bool SCEVUnionPredicate::isAlwaysTrue() const {
@@ -14992,13 +15037,15 @@ bool SCEVUnionPredicate::isAlwaysTrue() const {
                 [](const SCEVPredicate *I) { return I->isAlwaysTrue(); });
 }
 
-bool SCEVUnionPredicate::implies(const SCEVPredicate *N) const {
+bool SCEVUnionPredicate::implies(const SCEVPredicate *N,
+                                 ScalarEvolution &SE) const {
   if (const auto *Set = dyn_cast<SCEVUnionPredicate>(N))
-    return all_of(Set->Preds,
-                  [this](const SCEVPredicate *I) { return this->implies(I); });
+    return all_of(Set->Preds, [this, &SE](const SCEVPredicate *I) {
+      return this->implies(I, SE);
+    });
 
   return any_of(Preds,
-                [N](const SCEVPredicate *I) { return I->implies(N); });
+                [N, &SE](const SCEVPredicate *I) { return I->implies(N, SE); });
 }
 
 void SCEVUnionPredicate::print(raw_ostream &OS, unsigned Depth) const {
@@ -15006,23 +15053,34 @@ void SCEVUnionPredicate::print(raw_ostream &OS, unsigned Depth) const {
     Pred->print(OS, Depth);
 }
 
-void SCEVUnionPredicate::add(const SCEVPredicate *N) {
+void SCEVUnionPredicate::add(const SCEVPredicate *N, ScalarEvolution &SE) {
   if (const auto *Set = dyn_cast<SCEVUnionPredicate>(N)) {
     for (const auto *Pred : Set->Preds)
-      add(Pred);
+      add(Pred, SE);
     return;
   }
 
   // Only add predicate if it is not already implied by this union predicate.
-  if (!implies(N))
-    Preds.push_back(N);
+  if (implies(N, SE))
+    return;
+
+  // Build a new vector containing the current predicates, except the ones that
+  // are implied by the new predicate N.
+  SmallVector<const SCEVPredicate *> PrunedPreds;
+  for (auto *P : Preds) {
+    if (N->implies(P, SE))
+      continue;
+    PrunedPreds.push_back(P);
+  }
+  Preds = std::move(PrunedPreds);
+  Preds.push_back(N);
 }
 
 PredicatedScalarEvolution::PredicatedScalarEvolution(ScalarEvolution &SE,
                                                      Loop &L)
     : SE(SE), L(L) {
   SmallVector<const SCEVPredicate*, 4> Empty;
-  Preds = std::make_unique<SCEVUnionPredicate>(Empty);
+  Preds = std::make_unique<SCEVUnionPredicate>(Empty, SE);
 }
 
 void ScalarEvolution::registerUser(const SCEV *User,
@@ -15086,12 +15144,12 @@ unsigned PredicatedScalarEvolution::getSmallConstantMaxTripCount() {
 }
 
 void PredicatedScalarEvolution::addPredicate(const SCEVPredicate &Pred) {
-  if (Preds->implies(&Pred))
+  if (Preds->implies(&Pred, SE))
     return;
 
   SmallVector<const SCEVPredicate *, 4> NewPreds(Preds->getPredicates());
   NewPreds.push_back(&Pred);
-  Preds = std::make_unique<SCEVUnionPredicate>(NewPreds);
+  Preds = std::make_unique<SCEVUnionPredicate>(NewPreds, SE);
   updateGeneration();
 }
 
@@ -15158,9 +15216,10 @@ const SCEVAddRecExpr *PredicatedScalarEvolution::getAsAddRec(Value *V) {
 
 PredicatedScalarEvolution::PredicatedScalarEvolution(
     const PredicatedScalarEvolution &Init)
-  : RewriteMap(Init.RewriteMap), SE(Init.SE), L(Init.L),
-    Preds(std::make_unique<SCEVUnionPredicate>(Init.Preds->getPredicates())),
-    Generation(Init.Generation), BackedgeCount(Init.BackedgeCount) {
+    : RewriteMap(Init.RewriteMap), SE(Init.SE), L(Init.L),
+      Preds(std::make_unique<SCEVUnionPredicate>(Init.Preds->getPredicates(),
+                                                 SE)),
+      Generation(Init.Generation), BackedgeCount(Init.BackedgeCount) {
   for (auto I : Init.FlagsMap)
     FlagsMap.insert(I);
 }
diff --git a/llvm/test/Analysis/LoopAccessAnalysis/memcheck-wrapping-pointers.ll b/llvm/test/Analysis/LoopAccessAnalysis/memcheck-wrapping-pointers.ll
index 6dbb4a0c0129a6..ae10ab841420fd 100644
--- a/llvm/test/Analysis/LoopAccessAnalysis/memcheck-wrapping-pointers.ll
+++ b/llvm/test/Analysis/LoopAccessAnalysis/memcheck-wrapping-pointers.ll
@@ -29,20 +29,19 @@ target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
 ; CHECK-NEXT:    Run-time memory checks:
 ; CHECK-NEXT:    Check 0:
 ; CHECK-NEXT:      Comparing group
-; CHECK-NEXT:        %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
-; CHECK-NEXT:      Against group
 ; CHECK-NEXT:        %arrayidx4 = getelementptr inbounds i32, ptr %b, i64 %conv11
+; CHECK-NEXT:      Against group
+; CHECK-NEXT:        %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
 ; CHECK-NEXT:    Grouped accesses:
 ; CHECK-NEXT:      Group
-; CHECK-NEXT:        (Low: (4 + %a) High: (4 + (4 * (1 umax %x)) + %a))
-; CHECK-NEXT:          Member: {(4 + %a),+,4}<%for.body>
-; CHECK-NEXT:      Group
 ; CHECK-NEXT:        (Low: %b High: ((4 * (1 umax %x)) + %b))
 ; CHECK-NEXT:          Member: {%b,+,4}<%for.body>
+; CHECK-NEXT:      Group
+; CHECK-NEXT:        (Low: (4 + %a) High: (4 + (4 * (1 umax %x)) + %a))
+; CHECK-NEXT:          Member: {(4 + %a),+,4}<%for.body>
 ; CHECK:         Non vectorizable stores to invariant address were not found in loop.
 ; CHECK-NEXT:    SCEV assumptions:
 ; CHECK-NEXT:    {1,+,1}<%for.body> Added Flags: <nusw>
-; CHECK-NEXT:    {0,+,1}<%for.body> Added Flags: <nusw>
 ; CHECK:         Expressions re-written:
 ; CHECK-NEXT:    [PSE]  %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom:
 ; CHECK-NEXT:      ((4 * (zext i32 {1,+,1}<%for.body> to i64))<nuw><nsw> + %a)<nuw>
@@ -85,7 +84,6 @@ exit:
 ; CHECK: Memory dependences are safe
 ; CHECK: SCEV assumptions:
 ; CHECK-NEXT:   {1,+,1}<%for.body> Added Flags: <nusw>
-; CHECK-NEXT:   {0,+,1}<%for.body> Added Flags: <nusw>
  define void @test2(i64 %x, ptr %a) {
 entry:
   br label %for.body
diff --git a/llvm/test/Analysis/LoopAccessAnalysis/nssw-predicate-implied.ll b/llvm/test/Analysis/LoopAccessAnalysis/nssw-predicate-implied.ll
index 1a07805c2614f8..c502c7c1176c0d 100644
--- a/llvm/test/Analysis/LoopAccessAnalysis/nssw-predicate-implied.ll
+++ b/llvm/test/Analysis/LoopAccessAnalysis/nssw-predicate-implied.ll
@@ -3,7 +3,7 @@
 
 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
 
-; FIXME: {0,+,3} implies {0,+,2}.
+; {0,+,3} [nssw] implies {0,+,2} [nssw]
 define void @wrap_check_iv.3_implies_iv.2(i32 noundef %N, ptr %dst, ptr %src) {
 ; CHECK-LABEL: 'wrap_check_iv.3_implies_iv.2'
 ; CHECK-NEXT:    loop:
@@ -26,7 +26,6 @@ define void @wrap_check_iv.3_implies_iv.2(i32 noundef %N, ptr %dst, ptr %src) {
 ; CHECK-NEXT:      Non vectorizable stores to invariant address were not found in loop.
 ; CHECK-NEXT:      SCEV assumptions:
 ; CHECK-NEXT:      {0,+,3}<%loop> Added Flags: <nssw>
-; CHECK-NEXT:      {0,+,2}<%loop> Added Flags: <nssw>
 ; CHECK-EMPTY:
 ; CHECK-NEXT:      Expressions re-written:
 ; CHECK-NEXT:      [PSE] %gep.iv.2 = getelementptr inbounds i32, ptr %src, i64 %ext.iv.2:
@@ -59,7 +58,7 @@ exit:
   ret void
 }
 
-; FIXME: {2,+,2} implies {0,+,2}.
+; {2,+,2} [nssw]  implies {0,+,2} [nssw].
 define void @wrap_check_iv.3_implies_iv.2_different_start(i32 noundef %N, ptr %dst, ptr %src) {
 ; CHECK-LABEL: 'wrap_check_iv.3_implies_iv.2_different_start'
 ; CHECK-NEXT:    loop:
@@ -82,7 +81,6 @@ define void @wrap_check_iv.3_implies_iv.2_different_start(i32 noundef %N, ptr %d
 ; CHECK-NEXT:      Non vectorizable stores to invariant address were not found in loop.
 ; CHECK-NEXT:      SCEV assumptions:
 ; CHECK-NEXT:      {2,+,2}<%loop> Added Flags: <nssw>
-; CHECK-NEXT:      {0,+,2}<%loop> Added Flags: <nssw>
 ; CHECK-EMPTY:
 ; CHECK-NEXT:      Expressions re-written:
 ; CHECK-NEXT:      [PSE] %gep.iv.2 = getelementptr inbounds i32, ptr %src, i64 %ext.iv.2:
@@ -115,7 +113,7 @@ exit:
   ret void
 }
 
-; FIXME: {0,+,3} implies {0,+,2}.
+; {0,+,3} [nssw] implies {0,+,2} [nssw].
 define void @wrap_check_iv.3_implies_iv.2_predicates_added_in_different_order(i32 noundef %N, ptr %dst, ptr %src) {
 ; CHECK-LABEL: 'wrap_check_iv.3_implies_iv.2_predicates_added_in_different_order'
 ; CHECK-NEXT:    loop:
@@ -137,7 +135,6 @@ define void @wrap_check_iv.3_implies_iv.2_predicates_added_in_different_order(i3
 ; CHECK-EMPTY:
 ; CHECK-NEXT:      Non vectorizable stores to invariant address were not found in loop.
 ; CHECK-NEXT:      SCEV assumptions:
-; CHECK-NEXT:      {0,+,2}<%loop> Added Flags: <nssw>
 ; CHECK-NEXT:      {0,+,3}<%loop> Added Flags: <nssw>
 ; CHECK-EMPTY:
 ; CHECK-NEXT:      Expressions re-written:
diff --git a/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll b/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll
index 9da3d8f3d28021..52ef2d7fb76216 100644
--- a/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll
+++ b/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll
@@ -22,7 +22,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 ; LAA-LABEL: f1
 ; LAA: Memory dependences are safe{{$}}
 ; LAA: SCEV assumptions:
-; LAA-NEXT: {0,+,2}<%for.body> Added Flags: <nusw>
+; LAA-NOT: {0,+,2}<%for.body> Added Flags: <nusw>
 ; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
 
 ; The expression for %mul_ext as analyzed by SCEV is
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs-sve.ll b/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs-sve.ll
index e4c23999919456..5d8330eb199a70 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs-sve.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs-sve.ll
@@ -758,7 +758,6 @@ define void @exit_cond_zext_iv(ptr %dst, i64 %N) {
 ; DEFAULT:       vector.scevcheck:
 ; DEFAULT-NEXT:    [[UMAX:%.*]] = call i64 @llvm.umax.i64(i64 [[N]], i64 1)
 ; DEFAULT-NEXT:    [[TMP0:%.*]] = add i64 [[UMAX]], -1
-; DEFAULT-NEXT:    [[TMP1:%.*]] = icmp ugt i64 [[TMP0]], 4294967295
 ; DEFAULT-NEXT:    [[TMP2:%.*]] = trunc i64 [[TMP0]] to i32
 ; DEFAULT-NEXT:    [[TMP3:%.*]] = add i32 1, [[TMP2]]
 ; DEFAULT-NEXT:    [[TMP4:%.*]] = icmp ult i32 [[TMP3]], 1
@@ -808,7 +807,6 @@ define void @exit_cond_zext_iv(ptr %dst, i64 %N) {
 ; PRED:       vector.scevcheck:
 ; PRED-NEXT:    [[UMAX:%.*]] = call i64 @llvm.umax.i64(i64 [[N]], i64 1)
 ; PRED-NEXT:    [[TMP0:%.*]] = add i64 [[UMAX]], -1
-; PRED-NEXT:    [[TMP1:%.*]] = icmp ugt i64 [[TMP0]], 4294967295
 ; PRED-NEXT:    [[TMP2:%.*]] = trunc i64 [[TMP0]] to i32
 ; PRED-NEXT:    [[TMP3:%.*]] = add i32 1, [[TMP2]]
 ; PRED-NEXT:    [[TMP4:%.*]] = icmp ult i32 [[TMP3]], 1
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll b/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll
index f7f36d011535f4..46998615388440 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll
@@ -391,7 +391,6 @@ define void @zext_iv_increment(ptr %dst, i64 %N) {
 ; CHECK:       vector.scevcheck:
 ; CHECK-NEXT:    [[UMAX:%.*]] = call i64 @llvm.umax.i64(i64 [[N]], i64 1)
 ; CHECK-NEXT:    [[TMP0:%.*]] = add i64 [[UMAX]], -1
-; CHECK-NEXT:    [[TMP1:%.*]] = icmp ugt i64 [[TMP0]], 4294967295
 ; CHECK-NEXT:    [[TMP2:%.*]] = trunc i64 [[TMP0]] to i32
 ; CHECK-NEXT:    [[TMP3:%.*]] = add i32 1, [[TMP2]]
 ; CHECK-NEXT:    [[TMP4:%.*]] = icmp ult i32 [[TMP3]], 1
diff --git a/llvm/test/Transforms/LoopVectorize/X86/cost-model.ll b/llvm/test/Transforms/LoopVectorize/X86/cost-model.ll
index f8de81f43afc58..42d14bd04a8f2d 100644
--- a/llvm/test/Transforms/LoopVectorize/X86/cost-model.ll
+++ b/llvm/test/Transforms/LoopVectorize/X86/cost-model.ll
@@ -335,14 +335,13 @@ define void @multi_exit(ptr %dst, ptr %src.1, ptr %src.2, i64 %A, i64 %B) #0 {
 ; CHECK-NEXT:    [[TMP1:%.*]] = freeze i64 [[TMP0]]
 ; CHECK-NEXT:    [[UMIN7:%.*]] = call i64 @llvm.umin.i64(i64 [[TMP1]], i64 [[A:%.*]])
 ; CHECK-NEXT:    [[TMP2:%.*]] = add nuw i64 [[UMIN7]], 1
-; CHECK-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ule i64 [[TMP2]], 30
+; CHECK-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ule i64 [[TMP2]], 28
 ; CHECK-NEXT:    br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_SCEVCHECK:%.*]]
 ; CHECK:       vector.scevcheck:
 ; CHECK-NEXT:    [[UMAX:%.*]] = call i64 @llvm.umax.i64(i64 [[B]], i64 1)
 ; CHECK-NEXT:    [[TMP3:%.*]] = add i64 [[UMAX]], -1
 ; CHECK-NEXT:    [[TMP4:%.*]] = freeze i64 [[TMP3]]
 ; CHECK-NEXT:    [[UMIN:%.*]] = call i64 @llvm.umin.i64(i64 [[TMP4]], i64 [[A]])
-; CHECK-NEXT:    [[TMP5:%.*]] = icmp ugt i64 [[UMIN]], 4294967295
 ; CHECK-NEXT:    [[TMP6:%.*]] = trunc i64 [[UMIN]] to i32
 ; CHECK-NEXT:    [[TMP7:%.*]] = add i32 1, [[TMP6]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = icmp ult i32 [[TMP7]], 1
diff --git a/llvm/test/Transforms/LoopVectorize/X86/interleave-cost.ll b/llvm/test/Transforms/LoopVectorize/X86/interleave-cost.ll
index fd89c8b0193415..cda0774ecc3d4d 100644
--- a/llvm/test/Transforms/LoopVectorize/X86/interleave-cost.ll
+++ b/llvm/test/Transforms/LoopVectorize/X86/interleave-cost.ll
@@ -4,182 +4,6 @@
 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.15.0"
 
-define void @test_free_instructions_feeding_geps_for_interleave_groups(ptr noalias %p.invar, ptr noalias %dst.1, ptr noalias %dst.2) {
-; CHECK-LABEL: define void @test_free_instructions_feeding_geps_for_interleave_groups(
-; CHECK-SAME: ptr noalias [[P_INVAR:%.*]], ptr noalias [[DST_1:%.*]], ptr noalias [[DST_2:%.*]]) {
-; CHECK-NEXT:  [[ENTRY:.*]]:
-; CHECK-NEXT:    br i1 true, label %[[SCALAR_PH:.*]], label %[[VECTOR_SCEVCHECK:.*]]
-; CHECK:       [[VECTOR_SCEVCHECK]]:
-; CHECK-NEXT:    [[SCEVGEP:%.*]] = getelementptr i8, ptr [[DST_1]], i64 8
-; CHECK-NEXT:    [[MUL:%.*]] = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 16, i64 -1)
-; CHECK-NEXT:    [[MUL_RESULT:%.*]] = extractvalue { i64, i1 } [[MUL]], 0
-; CHECK-NEXT:    [[MUL_OVERFLOW:%.*]] = extractvalue { i64, i1 } [[MUL]], 1
-; CHECK-NEXT:    [[TMP0:%.*]] = sub i64 0, [[MUL_RESULT]]
-; CHECK-NEXT:    [[TMP1:%.*]] = getelem...
[truncated]

Copy link
Collaborator

@preames preames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fhahn fhahn force-pushed the scev-union-pred-prune-implied-by-new-pred branch from 9697e3c to b6c29fd Compare December 17, 2024 11:30
When adding a new predicate to a union predicate, some of the existing
predicates may be implied by the new predicate. Remove any existing
predicates that are already implied by the new predicate.

Depends on llvm#118184.
@fhahn fhahn force-pushed the scev-union-pred-prune-implied-by-new-pred branch from b6c29fd to 86aac93 Compare December 18, 2024 11:05
@fhahn fhahn merged commit df8efbd into llvm:main Dec 20, 2024
8 checks passed
@fhahn fhahn deleted the scev-union-pred-prune-implied-by-new-pred branch December 20, 2024 20:49
@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 20, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/10475

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll  2>&1 | /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/opt '-passes=print<access-info>' -aa-pipeline=basic-aa -disable-output
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll:26:13: error: LAA-NEXT: is not on the line after the previous match
; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
            ^
<stdin>:15:2: note: 'next' match was here
 {%a,+,4}<%for.body> Added Flags: <nusw>
 ^
<stdin>:13:19: note: previous match ended here
 SCEV assumptions:
                  ^
<stdin>:14:1: note: non-matching line after previous match is here
 {0,+,2}<%for.body> Added Flags: <nusw>
^

Input file: <stdin>
Check file: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        10:  Grouped accesses: 
        11:  
        12:  Non vectorizable stores to invariant address were not found in loop. 
        13:  SCEV assumptions: 
        14:  {0,+,2}<%for.body> Added Flags: <nusw> 
        15:  {%a,+,4}<%for.body> Added Flags: <nusw> 
next:26      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        16:  
        17:  Expressions re-written: 
        18:  [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext: 
        19:  ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a) 
        20:  --> {%a,+,4}<%for.body> 
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 20, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/10477

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll  2>&1 | /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/opt '-passes=print<access-info>' -aa-pipeline=basic-aa -disable-output
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll:26:13: error: LAA-NEXT: is not on the line after the previous match
; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
            ^
<stdin>:15:2: note: 'next' match was here
 {%a,+,4}<%for.body> Added Flags: <nusw>
 ^
<stdin>:13:19: note: previous match ended here
 SCEV assumptions:
                  ^
<stdin>:14:1: note: non-matching line after previous match is here
 {0,+,2}<%for.body> Added Flags: <nusw>
^

Input file: <stdin>
Check file: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        10:  Grouped accesses: 
        11:  
        12:  Non vectorizable stores to invariant address were not found in loop. 
        13:  SCEV assumptions: 
        14:  {0,+,2}<%for.body> Added Flags: <nusw> 
        15:  {%a,+,4}<%for.body> Added Flags: <nusw> 
next:26      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        16:  
        17:  Expressions re-written: 
        18:  [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext: 
        19:  ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a) 
        20:  --> {%a,+,4}<%for.body> 
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 20, 2024

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-ubuntu-fast running on sie-linux-worker while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/14496

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/LoopVersioning/wrapping-pointer-versioning.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/opt -passes=loop-versioning -S < /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll | /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll -check-prefix=LV
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/opt -passes=loop-versioning -S
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll -check-prefix=LV
�[1m/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll:32:12: �[0m�[0;1;31merror: �[0m�[1mLV-NEXT: is not on the line after the previous match
�[0m; LV-NEXT: [[MUL1:%.*]] = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 4, i64 [[TMP0]])
�[0;1;32m           ^
�[0m�[1m<stdin>:9:2: �[0m�[0;1;30mnote: �[0m�[1m'next' match was here
�[0m %mul1 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 4, i64 %0)
�[0;1;32m ^
�[0m�[1m<stdin>:7:21: �[0m�[0;1;30mnote: �[0m�[1mprevious match ended here
�[0m %0 = add i64 %N, -1
�[0;1;32m                    ^
�[0m�[1m<stdin>:8:1: �[0m�[0;1;30mnote: �[0m�[1mnon-matching line after previous match is here
�[0m %1 = icmp ugt i64 %0, 4294967295
�[0;1;32m^
�[0m
Input file: <stdin>
Check file: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
�[1m�[0m�[0;1;30m             1: �[0m�[1m�[0;1;46m; ModuleID = '<stdin>' �[0m
�[0;1;30m             2: �[0m�[1m�[0;1;46msource_filename = "<stdin>" �[0m
�[0;1;30m             3: �[0m�[1m�[0;1;46mtarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" �[0m
�[0;1;30m             4: �[0m�[1m�[0;1;46m �[0m
�[0;1;30m             5: �[0m�[1m�[0;1;46mdefine void �[0m@f1(�[0;1;46mptr noalias %a, ptr noalias %b, i64 %N) { �[0m
�[0;1;32mlabel:29'0                  ^~~~
�[0m�[0;1;32mlabel:29'1                  ^~~~
�[0m�[0;1;30m             6: �[0m�[1m�[0;1;46m�[0mfor.body.lver.check:�[0;1;46m �[0m
�[0;1;32mnext:30         ^~~~~~~~~~~~~~~~~~~~
�[0m�[0;1;30m             7: �[0m�[1m�[0;1;46m �[0m%0 = add i64 %N, -1�[0;1;46m �[0m
�[0;1;32mnext:31'0        ^~~~~~~~~~~~~~~~~~~
�[0m�[0;1;32mnext:31'1        ^~                   captured var "TMP0"
�[0m�[0;1;32mnext:31'2                     ^~      captured var "N"
�[0m�[0;1;30m             8: �[0m�[1m�[0;1;46m %1 = icmp ugt i64 %0, 4294967295 �[0m
�[0;1;30m             9: �[0m�[1m�[0;1;46m %mul1 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 4, i64 %0) �[0m
�[0;1;31mnext:32'0        !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
�[0m�[0;1;31mnext:32'1                                                                              with "TMP0" equal to "%0"
�[0m�[0;1;31mnext:32'2        !~~~~                                                                 captured var "MUL1"
�[0m�[0;1;30m            10: �[0m�[1m�[0;1;46m %mul.result = extractvalue { i64, i1 } %mul1, 0 �[0m
�[0;1;30m            11: �[0m�[1m�[0;1;46m %mul.overflow = extractvalue { i64, i1 } %mul1, 1 �[0m
�[0;1;30m            12: �[0m�[1m�[0;1;46m %2 = sub i64 0, %mul.result �[0m
�[0;1;30m            13: �[0m�[1m�[0;1;46m %3 = getelementptr i8, ptr %a, i64 %mul.result �[0m
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 20, 2024

LLVM Buildbot has detected a new failure on builder ml-opt-devrel-x86-64 running on ml-opt-devrel-x86-64-b1 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/175/builds/10607

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /b/ml-opt-devrel-x86-64-b1/build/bin/opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll  2>&1 | /b/ml-opt-devrel-x86-64-b1/build/bin/FileCheck /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /b/ml-opt-devrel-x86-64-b1/build/bin/FileCheck /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /b/ml-opt-devrel-x86-64-b1/build/bin/opt '-passes=print<access-info>' -aa-pipeline=basic-aa -disable-output
/b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll:26:13: error: LAA-NEXT: is not on the line after the previous match
; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
            ^
<stdin>:15:2: note: 'next' match was here
 {%a,+,4}<%for.body> Added Flags: <nusw>
 ^
<stdin>:13:19: note: previous match ended here
 SCEV assumptions:
                  ^
<stdin>:14:1: note: non-matching line after previous match is here
 {0,+,2}<%for.body> Added Flags: <nusw>
^

Input file: <stdin>
Check file: /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        10:  Grouped accesses: 
        11:  
        12:  Non vectorizable stores to invariant address were not found in loop. 
        13:  SCEV assumptions: 
        14:  {0,+,2}<%for.body> Added Flags: <nusw> 
        15:  {%a,+,4}<%for.body> Added Flags: <nusw> 
next:26      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        16:  
        17:  Expressions re-written: 
        18:  [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext: 
        19:  ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a) 
        20:  --> {%a,+,4}<%for.body> 
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 20, 2024

LLVM Buildbot has detected a new failure on builder ml-opt-rel-x86-64 running on ml-opt-rel-x86-64-b2 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/185/builds/10607

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /b/ml-opt-rel-x86-64-b1/build/bin/opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll  2>&1 | /b/ml-opt-rel-x86-64-b1/build/bin/FileCheck /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /b/ml-opt-rel-x86-64-b1/build/bin/opt '-passes=print<access-info>' -aa-pipeline=basic-aa -disable-output
+ /b/ml-opt-rel-x86-64-b1/build/bin/FileCheck /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll:26:13: error: LAA-NEXT: is not on the line after the previous match
; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
            ^
<stdin>:15:2: note: 'next' match was here
 {%a,+,4}<%for.body> Added Flags: <nusw>
 ^
<stdin>:13:19: note: previous match ended here
 SCEV assumptions:
                  ^
<stdin>:14:1: note: non-matching line after previous match is here
 {0,+,2}<%for.body> Added Flags: <nusw>
^

Input file: <stdin>
Check file: /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        10:  Grouped accesses: 
        11:  
        12:  Non vectorizable stores to invariant address were not found in loop. 
        13:  SCEV assumptions: 
        14:  {0,+,2}<%for.body> Added Flags: <nusw> 
        15:  {%a,+,4}<%for.body> Added Flags: <nusw> 
next:26      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        16:  
        17:  Expressions re-written: 
        18:  [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext: 
        19:  ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a) 
        20:  --> {%a,+,4}<%for.body> 
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 20, 2024

LLVM Buildbot has detected a new failure on builder ml-opt-dev-x86-64 running on ml-opt-dev-x86-64-b1 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/137/builds/10741

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /b/ml-opt-dev-x86-64-b1/build/bin/opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll  2>&1 | /b/ml-opt-dev-x86-64-b1/build/bin/FileCheck /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /b/ml-opt-dev-x86-64-b1/build/bin/FileCheck /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /b/ml-opt-dev-x86-64-b1/build/bin/opt '-passes=print<access-info>' -aa-pipeline=basic-aa -disable-output
/b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll:26:13: error: LAA-NEXT: is not on the line after the previous match
; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
            ^
<stdin>:15:2: note: 'next' match was here
 {%a,+,4}<%for.body> Added Flags: <nusw>
 ^
<stdin>:13:19: note: previous match ended here
 SCEV assumptions:
                  ^
<stdin>:14:1: note: non-matching line after previous match is here
 {0,+,2}<%for.body> Added Flags: <nusw>
^

Input file: <stdin>
Check file: /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        10:  Grouped accesses: 
        11:  
        12:  Non vectorizable stores to invariant address were not found in loop. 
        13:  SCEV assumptions: 
        14:  {0,+,2}<%for.body> Added Flags: <nusw> 
        15:  {%a,+,4}<%for.body> Added Flags: <nusw> 
next:26      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        16:  
        17:  Expressions re-written: 
        18:  [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext: 
        19:  ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a) 
        20:  --> {%a,+,4}<%for.body> 
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 20, 2024

LLVM Buildbot has detected a new failure on builder llvm-x86_64-debian-dylib running on gribozavr4 while building llvm at step 7 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/60/builds/15782

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /b/1/llvm-x86_64-debian-dylib/build/bin/opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll  2>&1 | /b/1/llvm-x86_64-debian-dylib/build/bin/FileCheck /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /b/1/llvm-x86_64-debian-dylib/build/bin/opt '-passes=print<access-info>' -aa-pipeline=basic-aa -disable-output
+ /b/1/llvm-x86_64-debian-dylib/build/bin/FileCheck /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll:26:13: error: LAA-NEXT: is not on the line after the previous match
; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
            ^
<stdin>:15:2: note: 'next' match was here
 {%a,+,4}<%for.body> Added Flags: <nusw>
 ^
<stdin>:13:19: note: previous match ended here
 SCEV assumptions:
                  ^
<stdin>:14:1: note: non-matching line after previous match is here
 {0,+,2}<%for.body> Added Flags: <nusw>
^

Input file: <stdin>
Check file: /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        10:  Grouped accesses: 
        11:  
        12:  Non vectorizable stores to invariant address were not found in loop. 
        13:  SCEV assumptions: 
        14:  {0,+,2}<%for.body> Added Flags: <nusw> 
        15:  {%a,+,4}<%for.body> Added Flags: <nusw> 
next:26      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        16:  
        17:  Expressions re-written: 
        18:  [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext: 
        19:  ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a) 
        20:  --> {%a,+,4}<%for.body> 
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 20, 2024

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-expensive-checks-debian running on gribozavr4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/16/builds/11121

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll  2>&1 | /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/opt '-passes=print<access-info>' -aa-pipeline=basic-aa -disable-output
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
/b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll:26:13: error: LAA-NEXT: is not on the line after the previous match
; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
            ^
<stdin>:15:2: note: 'next' match was here
 {%a,+,4}<%for.body> Added Flags: <nusw>
 ^
<stdin>:13:19: note: previous match ended here
 SCEV assumptions:
                  ^
<stdin>:14:1: note: non-matching line after previous match is here
 {0,+,2}<%for.body> Added Flags: <nusw>
^

Input file: <stdin>
Check file: /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        10:  Grouped accesses: 
        11:  
        12:  Non vectorizable stores to invariant address were not found in loop. 
        13:  SCEV assumptions: 
        14:  {0,+,2}<%for.body> Added Flags: <nusw> 
        15:  {%a,+,4}<%for.body> Added Flags: <nusw> 
next:26      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        16:  
        17:  Expressions re-written: 
        18:  [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext: 
        19:  ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a) 
        20:  --> {%a,+,4}<%for.body> 
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 20, 2024

LLVM Buildbot has detected a new failure on builder clang-x86_64-debian-fast running on gribozavr4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/56/builds/15066

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /b/1/clang-x86_64-debian-fast/llvm.obj/bin/opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll  2>&1 | /b/1/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/opt '-passes=print<access-info>' -aa-pipeline=basic-aa -disable-output
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
/b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll:26:13: error: LAA-NEXT: is not on the line after the previous match
; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
            ^
<stdin>:15:2: note: 'next' match was here
 {%a,+,4}<%for.body> Added Flags: <nusw>
 ^
<stdin>:13:19: note: previous match ended here
 SCEV assumptions:
                  ^
<stdin>:14:1: note: non-matching line after previous match is here
 {0,+,2}<%for.body> Added Flags: <nusw>
^

Input file: <stdin>
Check file: /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        10:  Grouped accesses: 
        11:  
        12:  Non vectorizable stores to invariant address were not found in loop. 
        13:  SCEV assumptions: 
        14:  {0,+,2}<%for.body> Added Flags: <nusw> 
        15:  {%a,+,4}<%for.body> Added Flags: <nusw> 
next:26      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        16:  
        17:  Expressions re-written: 
        18:  [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext: 
        19:  ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a) 
        20:  --> {%a,+,4}<%for.body> 
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 20, 2024

LLVM Buildbot has detected a new failure on builder lld-x86_64-ubuntu-fast running on as-builder-4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/33/builds/8709

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll  2>&1 | /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/opt '-passes=print<access-info>' -aa-pipeline=basic-aa -disable-output
+ /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll:26:13: error: LAA-NEXT: is not on the line after the previous match
; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
            ^
<stdin>:15:2: note: 'next' match was here
 {%a,+,4}<%for.body> Added Flags: <nusw>
 ^
<stdin>:13:19: note: previous match ended here
 SCEV assumptions:
                  ^
<stdin>:14:1: note: non-matching line after previous match is here
 {0,+,2}<%for.body> Added Flags: <nusw>
^

Input file: <stdin>
Check file: /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        10:  Grouped accesses: 
        11:  
        12:  Non vectorizable stores to invariant address were not found in loop. 
        13:  SCEV assumptions: 
        14:  {0,+,2}<%for.body> Added Flags: <nusw> 
        15:  {%a,+,4}<%for.body> Added Flags: <nusw> 
next:26      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        16:  
        17:  Expressions re-written: 
        18:  [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext: 
        19:  ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a) 
        20:  --> {%a,+,4}<%for.body> 
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 21, 2024

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/18245

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /build/buildbot/premerge-monolithic-linux/build/bin/opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll  2>&1 | /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
+ /build/buildbot/premerge-monolithic-linux/build/bin/opt '-passes=print<access-info>' -aa-pipeline=basic-aa -disable-output
+ /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll --check-prefix=LAA
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll:26:13: error: LAA-NEXT: is not on the line after the previous match
; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
            ^
<stdin>:15:2: note: 'next' match was here
 {%a,+,4}<%for.body> Added Flags: <nusw>
 ^
<stdin>:13:19: note: previous match ended here
 SCEV assumptions:
                  ^
<stdin>:14:1: note: non-matching line after previous match is here
 {0,+,2}<%for.body> Added Flags: <nusw>
^

Input file: <stdin>
Check file: /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        10:  Grouped accesses: 
        11:  
        12:  Non vectorizable stores to invariant address were not found in loop. 
        13:  SCEV assumptions: 
        14:  {0,+,2}<%for.body> Added Flags: <nusw> 
        15:  {%a,+,4}<%for.body> Added Flags: <nusw> 
next:26      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        16:  
        17:  Expressions re-written: 
        18:  [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext: 
        19:  ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a) 
        20:  --> {%a,+,4}<%for.body> 
         .
         .
         .
>>>>>>

--

...

github-actions bot pushed a commit to arm/arm-toolchain that referenced this pull request Jan 10, 2025
…nes. (#118185)

When adding a new predicate to a union predicate, some of the existing
predicates may be implied by the new predicate. Remove any existing
predicates that are already implied by the new predicate.

Depends on llvm/llvm-project#118184 to show the
main benefit.

PR: llvm/llvm-project#118185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants