Skip to content

Commit 3c74430

Browse files
authored
[DependenceAnalysis][NFC] Removing PossiblyLoopIndependent parameter (llvm#124615)
Parameter PossiblyLoopIndependent has lost its intended purpose. This flag is always set to true in all cases when depends() is called, hence we want to reconsider the utility of this variable and remove it from the function signature entirely. This is an NFC patch.
1 parent 5c7071e commit 3c74430

File tree

9 files changed

+16
-20
lines changed

9 files changed

+16
-20
lines changed

llvm/include/llvm/Analysis/DDG.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ bool DependenceGraphInfo<NodeType>::getDependencies(
453453
for (auto *SrcI : SrcIList)
454454
for (auto *DstI : DstIList)
455455
if (auto Dep =
456-
const_cast<DependenceInfo *>(&DI)->depends(SrcI, DstI, true))
456+
const_cast<DependenceInfo *>(&DI)->depends(SrcI, DstI))
457457
Deps.push_back(std::move(Dep));
458458

459459
return !Deps.empty();

llvm/include/llvm/Analysis/DependenceAnalysis.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,8 @@ namespace llvm {
303303
/// depends - Tests for a dependence between the Src and Dst instructions.
304304
/// Returns NULL if no dependence; otherwise, returns a Dependence (or a
305305
/// FullDependence) with as much information as can be gleaned.
306-
/// The flag PossiblyLoopIndependent should be set by the caller
307-
/// if it appears that control flow can reach from Src to Dst
308-
/// without traversing a loop back edge.
309306
std::unique_ptr<Dependence> depends(Instruction *Src,
310-
Instruction *Dst,
311-
bool PossiblyLoopIndependent);
307+
Instruction *Dst);
312308

313309
/// getSplitIteration - Give a dependence that's splittable at some
314310
/// particular level, return the iteration that should be used to split

llvm/lib/Analysis/DependenceAnalysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void dumpExampleDependence(raw_ostream &OS, DependenceInfo *DA,
187187
if (DstI->mayReadOrWriteMemory()) {
188188
OS << "Src:" << *SrcI << " --> Dst:" << *DstI << "\n";
189189
OS << " da analyze - ";
190-
if (auto D = DA->depends(&*SrcI, &*DstI, true)) {
190+
if (auto D = DA->depends(&*SrcI, &*DstI)) {
191191
// Normalize negative direction vectors if required by clients.
192192
if (NormalizeResults && D->normalize(&SE))
193193
OS << "normalized - ";
@@ -3589,8 +3589,8 @@ bool DependenceInfo::invalidate(Function &F, const PreservedAnalyses &PA,
35893589
// Care is required to keep the routine below, getSplitIteration(),
35903590
// up to date with respect to this routine.
35913591
std::unique_ptr<Dependence>
3592-
DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3593-
bool PossiblyLoopIndependent) {
3592+
DependenceInfo::depends(Instruction *Src, Instruction *Dst) {
3593+
bool PossiblyLoopIndependent = true;
35943594
if (Src == Dst)
35953595
PossiblyLoopIndependent = false;
35963596

llvm/lib/Analysis/DependenceGraphBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void AbstractDependenceGraphBuilder<G>::createMemoryDependencyEdges() {
295295
bool BackwardEdgeCreated = false;
296296
for (Instruction *ISrc : SrcIList) {
297297
for (Instruction *IDst : DstIList) {
298-
auto D = DI.depends(ISrc, IDst, true);
298+
auto D = DI.depends(ISrc, IDst);
299299
if (!D)
300300
continue;
301301

llvm/lib/Analysis/LoopCacheAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ IndexedReference::hasTemporalReuse(const IndexedReference &Other,
224224
}
225225

226226
std::unique_ptr<Dependence> D =
227-
DI.depends(&StoreOrLoadInst, &Other.StoreOrLoadInst, true);
227+
DI.depends(&StoreOrLoadInst, &Other.StoreOrLoadInst);
228228

229229
if (D == nullptr) {
230230
LLVM_DEBUG(dbgs().indent(2) << "No temporal reuse: no dependence\n");

llvm/lib/Transforms/Scalar/LoopFuse.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ struct LoopFuser {
10991099

11001100
LLVM_DEBUG(dbgs() << "Checking if this mem inst can be hoisted.\n");
11011101
for (Instruction *NotHoistedInst : NotHoisting) {
1102-
if (auto D = DI.depends(&I, NotHoistedInst, true)) {
1102+
if (auto D = DI.depends(&I, NotHoistedInst)) {
11031103
// Dependency is not read-before-write, write-before-read or
11041104
// write-before-write
11051105
if (D->isFlow() || D->isAnti() || D->isOutput()) {
@@ -1111,7 +1111,7 @@ struct LoopFuser {
11111111
}
11121112

11131113
for (Instruction *ReadInst : FC0.MemReads) {
1114-
if (auto D = DI.depends(ReadInst, &I, true)) {
1114+
if (auto D = DI.depends(ReadInst, &I)) {
11151115
// Dependency is not read-before-write
11161116
if (D->isAnti()) {
11171117
LLVM_DEBUG(dbgs() << "Inst depends on a read instruction in FC0.\n");
@@ -1121,7 +1121,7 @@ struct LoopFuser {
11211121
}
11221122

11231123
for (Instruction *WriteInst : FC0.MemWrites) {
1124-
if (auto D = DI.depends(WriteInst, &I, true)) {
1124+
if (auto D = DI.depends(WriteInst, &I)) {
11251125
// Dependency is not write-before-read or write-before-write
11261126
if (D->isFlow() || D->isOutput()) {
11271127
LLVM_DEBUG(dbgs() << "Inst depends on a write instruction in FC0.\n");
@@ -1153,7 +1153,7 @@ struct LoopFuser {
11531153
return true;
11541154

11551155
for (Instruction *ReadInst : FC1.MemReads) {
1156-
if (auto D = DI.depends(&I, ReadInst, true)) {
1156+
if (auto D = DI.depends(&I, ReadInst)) {
11571157
// Dependency is not write-before-read
11581158
if (D->isFlow()) {
11591159
LLVM_DEBUG(dbgs() << "Inst depends on a read instruction in FC1.\n");
@@ -1163,7 +1163,7 @@ struct LoopFuser {
11631163
}
11641164

11651165
for (Instruction *WriteInst : FC1.MemWrites) {
1166-
if (auto D = DI.depends(&I, WriteInst, true)) {
1166+
if (auto D = DI.depends(&I, WriteInst)) {
11671167
// Dependency is not write-before-write or read-before-write
11681168
if (D->isOutput() || D->isAnti()) {
11691169
LLVM_DEBUG(dbgs() << "Inst depends on a write instruction in FC1.\n");
@@ -1335,7 +1335,7 @@ struct LoopFuser {
13351335
case FUSION_DEPENDENCE_ANALYSIS_SCEV:
13361336
return accessDiffIsPositive(*FC0.L, *FC1.L, I0, I1, AnyDep);
13371337
case FUSION_DEPENDENCE_ANALYSIS_DA: {
1338-
auto DepResult = DI.depends(&I0, &I1, true);
1338+
auto DepResult = DI.depends(&I0, &I1);
13391339
if (!DepResult)
13401340
return true;
13411341
#ifndef NDEBUG

llvm/lib/Transforms/Scalar/LoopInterchange.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level,
146146
if (isa<LoadInst>(Src) && isa<LoadInst>(Dst))
147147
continue;
148148
// Track Output, Flow, and Anti dependencies.
149-
if (auto D = DI->depends(Src, Dst, true)) {
149+
if (auto D = DI->depends(Src, Dst)) {
150150
assert(D->isOrdered() && "Expected an output, flow or anti dep.");
151151
// If the direction vector is negative, normalize it to
152152
// make it non-negative.

llvm/lib/Transforms/Utils/CodeMoverUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ bool llvm::isSafeToMoveBefore(Instruction &I, Instruction &InsertPoint,
398398
// Check if I has any output/flow/anti dependences with instructions from \p
399399
// StartInst to \p EndInst.
400400
if (llvm::any_of(InstsToCheck, [&DI, &I](Instruction *CurInst) {
401-
auto DepResult = DI->depends(&I, CurInst, true);
401+
auto DepResult = DI->depends(&I, CurInst);
402402
if (DepResult && (DepResult->isOutput() || DepResult->isFlow() ||
403403
DepResult->isAnti()))
404404
return true;

llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ static bool checkDependency(Instruction *Src, Instruction *Dst,
709709
// (0,0,>=,*,*)
710710
// Now, the dependency is not necessarily non-negative anymore, i.e.
711711
// unroll-and-jam may violate correctness.
712-
std::unique_ptr<Dependence> D = DI.depends(Src, Dst, true);
712+
std::unique_ptr<Dependence> D = DI.depends(Src, Dst);
713713
if (!D)
714714
return true;
715715
assert(D->isOrdered() && "Expected an output, flow or anti dep.");

0 commit comments

Comments
 (0)