[DA] Refactor signature of weakCrossingSIVtest and check inputs (NFCI) (#187117)
Passing SCEVAddRecExpr objects directly to weakCrossingSIVtest and checking the validity of the input operands
This commit is contained in:
parent
ead9ac8331
commit
00aebbff71
@ -535,10 +535,8 @@ private:
|
||||
/// Returns true if any possible dependence is disproved.
|
||||
/// If there might be a dependence, returns false.
|
||||
/// Sets appropriate direction entry.
|
||||
bool weakCrossingSIVtest(const SCEV *SrcCoeff, const SCEV *SrcConst,
|
||||
const SCEV *DstConst, const Loop *CurrentSrcLoop,
|
||||
const Loop *CurrentDstLoop, unsigned Level,
|
||||
FullDependence &Result) const;
|
||||
bool weakCrossingSIVtest(const SCEVAddRecExpr *Src, const SCEVAddRecExpr *Dst,
|
||||
unsigned Level, FullDependence &Result) const;
|
||||
|
||||
/// ExactSIVtest - Tests the SIV subscript pair
|
||||
/// (Src and Dst) for dependence.
|
||||
|
||||
@ -1363,15 +1363,20 @@ bool DependenceInfo::strongSIVtest(const SCEVAddRecExpr *Src,
|
||||
// Can determine iteration for splitting.
|
||||
//
|
||||
// Return true if dependence disproved.
|
||||
bool DependenceInfo::weakCrossingSIVtest(const SCEV *Coeff,
|
||||
const SCEV *SrcConst,
|
||||
const SCEV *DstConst,
|
||||
const Loop *CurSrcLoop,
|
||||
const Loop *CurDstLoop, unsigned Level,
|
||||
bool DependenceInfo::weakCrossingSIVtest(const SCEVAddRecExpr *Src,
|
||||
const SCEVAddRecExpr *Dst,
|
||||
unsigned Level,
|
||||
FullDependence &Result) const {
|
||||
if (!isDependenceTestEnabled(DependenceTestType::WeakCrossingSIV))
|
||||
return false;
|
||||
|
||||
const SCEV *Coeff = Src->getStepRecurrence(*SE);
|
||||
const SCEV *SrcConst = Src->getStart();
|
||||
const SCEV *DstConst = Dst->getStart();
|
||||
|
||||
assert(Coeff == SE->getNegativeSCEV(Dst->getStepRecurrence(*SE)) &&
|
||||
"Unexpected input for weakCrossingSIVtest");
|
||||
|
||||
LLVM_DEBUG(dbgs() << "\tWeak-Crossing SIV test\n");
|
||||
LLVM_DEBUG(dbgs() << "\t Coeff = " << *Coeff << "\n");
|
||||
LLVM_DEBUG(dbgs() << "\t SrcConst = " << *SrcConst << "\n");
|
||||
@ -1421,6 +1426,7 @@ bool DependenceInfo::weakCrossingSIVtest(const SCEV *Coeff,
|
||||
|
||||
// We're certain that Delta > 0 and ConstCoeff > 0.
|
||||
// Check Delta/(2*ConstCoeff) against upper loop bound
|
||||
const Loop *CurSrcLoop = Src->getLoop();
|
||||
if (const SCEV *UpperBound =
|
||||
collectUpperBound(CurSrcLoop, Delta->getType())) {
|
||||
LLVM_DEBUG(dbgs() << "\t UpperBound = " << *UpperBound << "\n");
|
||||
@ -2074,8 +2080,6 @@ bool DependenceInfo::testSIV(const SCEV *Src, const SCEV *Dst, unsigned &Level,
|
||||
const SCEVAddRecExpr *SrcAddRec = dyn_cast<SCEVAddRecExpr>(Src);
|
||||
const SCEVAddRecExpr *DstAddRec = dyn_cast<SCEVAddRecExpr>(Dst);
|
||||
if (SrcAddRec && DstAddRec) {
|
||||
const SCEV *SrcConst = SrcAddRec->getStart();
|
||||
const SCEV *DstConst = DstAddRec->getStart();
|
||||
const SCEV *SrcCoeff = SrcAddRec->getStepRecurrence(*SE);
|
||||
const SCEV *DstCoeff = DstAddRec->getStepRecurrence(*SE);
|
||||
const Loop *CurSrcLoop = SrcAddRec->getLoop();
|
||||
@ -2089,8 +2093,7 @@ bool DependenceInfo::testSIV(const SCEV *Src, const SCEV *Dst, unsigned &Level,
|
||||
disproven = strongSIVtest(SrcAddRec, DstAddRec, Level, Result,
|
||||
UnderRuntimeAssumptions);
|
||||
else if (SrcCoeff == SE->getNegativeSCEV(DstCoeff))
|
||||
disproven = weakCrossingSIVtest(SrcCoeff, SrcConst, DstConst, CurSrcLoop,
|
||||
CurDstLoop, Level, Result);
|
||||
disproven = weakCrossingSIVtest(SrcAddRec, DstAddRec, Level, Result);
|
||||
else
|
||||
disproven = exactSIVtest(SrcAddRec, DstAddRec, Level, Result);
|
||||
return disproven || gcdMIVtest(Src, Dst, Result);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user