mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 11:02:04 +08:00
[DA] Add overflow check when calculating Delta in GCD MIV (#169928)
Add overflow check when computing `Delta` in `gcdMIVtest`. Fix one of the tests added by #169926.
This commit is contained in:
@@ -2582,7 +2582,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)) {
|
||||
|
||||
@@ -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 [*]!
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user