llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-llvm-analysis Author: Ryotaro Kasuga (kasuga-fj) <details> <summary>Changes</summary> Add overflow check when computing `Delta` in `gcdMIVtest`. Fix one of the tests added by #<!-- -->169926. --- Full diff: https://github.com/llvm/llvm-project/pull/169928.diff 2 Files Affected: - (modified) llvm/lib/Analysis/DependenceAnalysis.cpp (+3-1) - (modified) llvm/test/Analysis/DependenceAnalysis/gcd-miv-overflow.ll (+1-1) ``````````diff diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp index 77b09fb15316e..73a7b59c81f27 100644 --- a/llvm/lib/Analysis/DependenceAnalysis.cpp +++ b/llvm/lib/Analysis/DependenceAnalysis.cpp @@ -2587,7 +2587,9 @@ bool DependenceInfo::gcdMIVtest(const SCEV *Src, const SCEV *Dst, const SCEV *DstConst = Coefficients; APInt ExtraGCD = APInt::getZero(BitWidth); - const SCEV *Delta = SE->getMinusSCEV(DstConst, SrcConst); + const SCEV *Delta = minusSCEVNoSignedOverflow(DstConst, SrcConst, *SE); + if (!Delta) + return false; LLVM_DEBUG(dbgs() << " Delta = " << *Delta << "\n"); const SCEVConstant *Constant = dyn_cast<SCEVConstant>(Delta); if (const SCEVAddExpr *Sum = dyn_cast<SCEVAddExpr>(Delta)) { diff --git a/llvm/test/Analysis/DependenceAnalysis/gcd-miv-overflow.ll b/llvm/test/Analysis/DependenceAnalysis/gcd-miv-overflow.ll index 618d14c75faad..76bab98207c79 100644 --- a/llvm/test/Analysis/DependenceAnalysis/gcd-miv-overflow.ll +++ b/llvm/test/Analysis/DependenceAnalysis/gcd-miv-overflow.ll @@ -89,7 +89,7 @@ define void @gcdmiv_delta_ovfl(ptr %A) { ; CHECK-GCD-MIV-NEXT: Src: store i8 0, ptr %idx.0, align 1 --> Dst: store i8 0, ptr %idx.0, align 1 ; CHECK-GCD-MIV-NEXT: da analyze - consistent output [*]! ; CHECK-GCD-MIV-NEXT: Src: store i8 0, ptr %idx.0, align 1 --> Dst: store i8 1, ptr %idx.1, align 1 -; CHECK-GCD-MIV-NEXT: da analyze - none! +; CHECK-GCD-MIV-NEXT: da analyze - consistent output [*|<]! ; CHECK-GCD-MIV-NEXT: Src: store i8 1, ptr %idx.1, align 1 --> Dst: store i8 1, ptr %idx.1, align 1 ; CHECK-GCD-MIV-NEXT: da analyze - consistent output [*]! ; `````````` </details> https://github.com/llvm/llvm-project/pull/169928 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
