Skip to content

Commit 7779882

Browse files
authored
[DA] Add option to run only SIV routines (#157084)
This patch introduces a new option, `da-run-siv-routines-only`, which runs only the SIV family routines in the DA. This is useful for testing (regression tests, not dependence tests) as it helps detect behavioral changes in the SIV routines. Actually, regarding the test cases added in #157085, fixing the incorrect result requires changes across multiple functions (at a minimum, `exactSIVtest`, `gcdMIVtest` and `symbolicRDIVtest`). It is difficult to address all of them at once. This patch also generates the CHECK directives using the new option for `ExactSIV.ll` as it is necessary for subsequent patches. However, I believe it will also be useful for other `xxSIV.ll` tests. Notably, the SIV family routines tend to be affected by other routines, as they are typically invoked at the beginning of the overall analysis.
1 parent f74583f commit 7779882

File tree

2 files changed

+212
-0
lines changed

2 files changed

+212
-0
lines changed

llvm/lib/Analysis/DependenceAnalysis.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ static cl::opt<unsigned> MIVMaxLevelThreshold(
121121
cl::desc("Maximum depth allowed for the recursive algorithm used to "
122122
"explore MIV direction vectors."));
123123

124+
static cl::opt<bool> RunSIVRoutinesOnly(
125+
"da-run-siv-routines-only", cl::init(false), cl::ReallyHidden,
126+
cl::desc("Run only SIV routines and disable others (ZIV, RDIV, and MIV). "
127+
"The purpose is mainly to exclude the influence of those routines "
128+
"in regression tests for SIV routines."));
129+
124130
//===----------------------------------------------------------------------===//
125131
// basics
126132

@@ -1980,6 +1986,8 @@ bool DependenceInfo::exactRDIVtest(const SCEV *SrcCoeff, const SCEV *DstCoeff,
19801986
const SCEV *SrcConst, const SCEV *DstConst,
19811987
const Loop *SrcLoop, const Loop *DstLoop,
19821988
FullDependence &Result) const {
1989+
if (RunSIVRoutinesOnly)
1990+
return false;
19831991
LLVM_DEBUG(dbgs() << "\tExact RDIV test\n");
19841992
LLVM_DEBUG(dbgs() << "\t SrcCoeff = " << *SrcCoeff << " = AM\n");
19851993
LLVM_DEBUG(dbgs() << "\t DstCoeff = " << *DstCoeff << " = BM\n");
@@ -2124,6 +2132,8 @@ bool DependenceInfo::symbolicRDIVtest(const SCEV *A1, const SCEV *A2,
21242132
const SCEV *C1, const SCEV *C2,
21252133
const Loop *Loop1,
21262134
const Loop *Loop2) const {
2135+
if (RunSIVRoutinesOnly)
2136+
return false;
21272137
++SymbolicRDIVapplications;
21282138
LLVM_DEBUG(dbgs() << "\ttry symbolic RDIV test\n");
21292139
LLVM_DEBUG(dbgs() << "\t A1 = " << *A1);
@@ -2433,6 +2443,8 @@ bool DependenceInfo::accumulateCoefficientsGCD(const SCEV *Expr,
24332443
// to "a common divisor".
24342444
bool DependenceInfo::gcdMIVtest(const SCEV *Src, const SCEV *Dst,
24352445
FullDependence &Result) const {
2446+
if (RunSIVRoutinesOnly)
2447+
return false;
24362448
LLVM_DEBUG(dbgs() << "starting gcd\n");
24372449
++GCDapplications;
24382450
unsigned BitWidth = SE->getTypeSizeInBits(Src->getType());
@@ -2599,6 +2611,8 @@ bool DependenceInfo::gcdMIVtest(const SCEV *Src, const SCEV *Dst,
25992611
bool DependenceInfo::banerjeeMIVtest(const SCEV *Src, const SCEV *Dst,
26002612
const SmallBitVector &Loops,
26012613
FullDependence &Result) const {
2614+
if (RunSIVRoutinesOnly)
2615+
return false;
26022616
LLVM_DEBUG(dbgs() << "starting Banerjee\n");
26032617
++BanerjeeApplications;
26042618
LLVM_DEBUG(dbgs() << " Src = " << *Src << '\n');

0 commit comments

Comments
 (0)