[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-24 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From 524ddb1cf70fde8104341e8e46f6bd6d29b45bc3 Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 6e8189c06d989..b51e70d94212a 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1825,19 +1825,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-24 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj edited 
https://github.com/llvm/llvm-project/pull/185580
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-24 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From 4c5b5ca1be6b30a39f307aaa23dc3480c7ffdae1 Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 5d800527137b5..3cb6e22ad3a14 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1828,19 +1828,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-24 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From 4c5b5ca1be6b30a39f307aaa23dc3480c7ffdae1 Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 5d800527137b5..3cb6e22ad3a14 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1828,19 +1828,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-23 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From cae07104cc6b510133b8a7d1c8be9923229dff0e Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index b1d0f1bf950e9..0f358b2743575 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1825,19 +1825,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-23 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From cae07104cc6b510133b8a7d1c8be9923229dff0e Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index b1d0f1bf950e9..0f358b2743575 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1825,19 +1825,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-18 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From f9576bc9b5812449b65aed5b4e856a289b168003 Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 35c0af00670a5..4674d9e0c0185 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1821,19 +1821,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-10 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From 8d85cc0926ef8a29da1d9539ae6ba767e4125d4f Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index d9f924f87414e..19f81f58b8da9 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1817,19 +1817,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-10 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From 8d85cc0926ef8a29da1d9539ae6ba767e4125d4f Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index d9f924f87414e..19f81f58b8da9 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1817,19 +1817,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-10 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From 59e6f31d21306f8398b80e4bc0193a5deabb8e53 Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 5918e6576754f..a7e489c10fe97 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1817,19 +1817,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-10 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From 59e6f31d21306f8398b80e4bc0193a5deabb8e53 Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 5918e6576754f..a7e489c10fe97 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1817,19 +1817,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-10 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From 937b00bf26e25220add80d2d382db34dc8c8834d Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 392cb4d19c1a8..daedb6f3256e0 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1817,19 +1817,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-10 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From 937b00bf26e25220add80d2d382db34dc8c8834d Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 392cb4d19c1a8..daedb6f3256e0 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1817,19 +1817,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-09 Thread via llvm-branch-commits

github-actions[bot] wrote:


# :penguin: Linux x64 Test Results

The build failed before running any tests. Click on a failure below to see the 
details.


lib/Analysis/CMakeFiles/LLVMAnalysis.dir/DependenceAnalysis.cpp.o

```
FAILED: lib/Analysis/CMakeFiles/LLVMAnalysis.dir/DependenceAnalysis.cpp.o
sccache /opt/llvm/bin/clang++ -D_DEBUG -D_GLIBCXX_ASSERTIONS 
-D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE 
-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/Analysis 
-I/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Analysis 
-I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/include 
-I/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include -gmlt 
-fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror 
-Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers 
-pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported 
-fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17 
-UNDEBUG -fno-exceptions -funwind-tables -fno-rtti -MD -MT 
lib/Analysis/CMakeFiles/LLVMAnalysis.dir/DependenceAnalysis.cpp.o -MF 
lib/Analysis/CMakeFiles/LLVMAnalysis.dir/DependenceAnalysis.cpp.o.d -o 
lib/Analysis/CMakeFiles/LLVMAnalysis.dir/DependenceAnalysis.cpp.o -c 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Analysis/DependenceAnalysis.cpp
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Analysis/DependenceAnalysis.cpp:1912:10:
 error: no member named 'reverse' in 'llvm::FullDependence'
1912 |   Result.reverse(*SE);
|   ~~ ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Analysis/DependenceAnalysis.cpp:1914:10:
 error: no member named 'reverse' in 'llvm::FullDependence'
1914 |   Result.reverse(*SE);
|   ~~ ^
2 errors generated.
```


If these failures are unrelated to your changes (for example tests are broken 
or flaky at HEAD), please open an issue at 
https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/185580
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-09 Thread via llvm-branch-commits

github-actions[bot] wrote:


# :window: Windows x64 Test Results

The build failed before running any tests. Click on a failure below to see the 
details.


[code=1] 
lib/Analysis/CMakeFiles/LLVMAnalysis.dir/DependenceAnalysis.cpp.obj

```
FAILED: [code=1] 
lib/Analysis/CMakeFiles/LLVMAnalysis.dir/DependenceAnalysis.cpp.obj
sccache C:\clang\clang-msvc\bin\clang-cl.exe  /nologo -TP -DUNICODE 
-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS 
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GLIBCXX_ASSERTIONS 
-D_HAS_EXCEPTIONS=0 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE 
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-IC:\_work\llvm-project\llvm-project\build\lib\Analysis 
-IC:\_work\llvm-project\llvm-project\llvm\lib\Analysis 
-IC:\_work\llvm-project\llvm-project\build\include 
-IC:\_work\llvm-project\llvm-project\llvm\include /DWIN32 /D_WINDOWS   
/Zc:inline /Zc:__cplusplus /Oi /Brepro /bigobj /permissive- 
-Werror=unguarded-availability-new /W4  -Wextra -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported /Gw /O2 /Ob2 
 -std:c++17 -MD -UNDEBUG /EHs-c- /GR- /showIncludes 
/Folib\Analysis\CMakeFiles\LLVMAnalysis.dir\DependenceAnalysis.cpp.obj 
/Fdlib\Analysis\CMakeFiles\LLVMAnalysis.dir\LLVMAnalysis.pdb -c -- 
C:\_work\llvm-project\llvm-project\llvm\lib\Analysis\DependenceAnalysis.cpp
C:\_work\llvm-project\llvm-project\llvm\lib\Analysis\DependenceAnalysis.cpp(1912,10):
 error: no member named 'reverse' in 'llvm::FullDependence'
1912 |   Result.reverse(*SE);
|   ~~ ^
C:\_work\llvm-project\llvm-project\llvm\lib\Analysis\DependenceAnalysis.cpp(1914,10):
 error: no member named 'reverse' in 'llvm::FullDependence'
1914 |   Result.reverse(*SE);
|   ~~ ^
2 errors generated.
```


If these failures are unrelated to your changes (for example tests are broken 
or flaky at HEAD), please open an issue at 
https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/185580
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-09 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From a2a37088be3cf2ef9e91b46d5daff1b7a282f078 Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 9326534e954bd..797945b68f797 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1817,19 +1817,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-09 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj updated 
https://github.com/llvm/llvm-project/pull/185580

>From a2a37088be3cf2ef9e91b46d5daff1b7a282f078 Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 9326534e954bd..797945b68f797 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1817,19 +1817,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-09 Thread Ryotaro Kasuga via llvm-branch-commits

kasuga-fj wrote:

> [!WARNING]
> This pull request is not mergeable via GitHub because a downstack PR is 
> open. Once all requirements are satisfied, merge this PR as a stack  href="https://app.graphite.com/github/pr/llvm/llvm-project/185580?utm_source=stack-comment-downstack-mergeability-warning";
>  >on Graphite.
> https://graphite.dev/docs/merge-pull-requests";>Learn more

* **#185580** https://app.graphite.com/github/pr/llvm/llvm-project/185580?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/> 👈 https://app.graphite.com/github/pr/llvm/llvm-project/185580?utm_source=stack-comment-view-in-graphite";
 target="_blank">(View in Graphite)
* **#185579** https://app.graphite.com/github/pr/llvm/llvm-project/185579?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/>
* **#185578** https://app.graphite.com/github/pr/llvm/llvm-project/185578?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/>
* **#185577** https://app.graphite.com/github/pr/llvm/llvm-project/185577?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/>
* **#185576** https://app.graphite.com/github/pr/llvm/llvm-project/185576?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/>
* **#183738** https://app.graphite.com/github/pr/llvm/llvm-project/183738?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/>
* **#183737** https://app.graphite.com/github/pr/llvm/llvm-project/183737?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/>
* **#183736** https://app.graphite.com/github/pr/llvm/llvm-project/183736?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/>
* **#183735** https://app.graphite.com/github/pr/llvm/llvm-project/183735?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/>
* `main`




This stack of pull requests is managed by https://graphite.dev?utm-source=stack-comment";>Graphite. Learn 
more about https://stacking.dev/?utm_source=stack-comment";>stacking.


https://github.com/llvm/llvm-project/pull/185580
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [DA] Remove absolute value calculations in the Weak Zero SIV tests (PR #185580)

2026-03-09 Thread Ryotaro Kasuga via llvm-branch-commits

https://github.com/kasuga-fj created 
https://github.com/llvm/llvm-project/pull/185580

None

>From fe09551db7615c795d64db0ad3daeb75d54ad3c3 Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga 
Date: Mon, 9 Mar 2026 10:12:39 +
Subject: [PATCH] [DA] Remove absolute value calculations in the Weak Zero SIV
 tests

---
 llvm/lib/Analysis/DependenceAnalysis.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp 
b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 76e1ee324c370..b1bde7a2e4db0 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1817,19 +1817,19 @@ bool DependenceInfo::weakZeroSIVtestImpl(const 
SCEVAddRecExpr *AR,
   if (!ConstCoeff)
 return false;
 
-  // Since ConstCoeff is constant, !isKnownNegative means it's non-negative.
-  // TODO: Bail out if it's a signed minimum value.
-  const SCEV *AbsCoeff = SE->isKnownNegative(ConstCoeff)
- ? SE->getNegativeSCEV(ConstCoeff)
- : ConstCoeff;
   const SCEV *NewDelta =
   SE->isKnownNegative(ConstCoeff) ? SE->getNegativeSCEV(Delta) : Delta;
 
   if (const SCEV *UpperBound =
   collectUpperBound(AR->getLoop(), Delta->getType())) {
 LLVM_DEBUG(dbgs() << "\tUpperBound = " << *UpperBound << "\n");
-const SCEV *Product = SE->getMulExpr(AbsCoeff, UpperBound);
-if (SE->isKnownPredicate(CmpInst::ICMP_EQ, NewDelta, Product)) {
+bool OverlapAtLast = [&] {
+  if (!SE->isKnownNonZero(ConstCoeff))
+return false;
+  const SCEV *Last = AR->evaluateAtIteration(UpperBound, *SE);
+  return Last == Const;
+}();
+if (OverlapAtLast) {
   // dependences caused by last iteration
   if (Level < CommonLevels) {
 Result.DV[Level].Direction &= Dependence::DVEntry::GE;

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits