Skip to content

Commit 53ece54

Browse files
authored
[DA] Simplify runtime predicate collection (#157523)
Removes DependenceInfo::getRuntimeAssumptions(), DependenceInfo::Assumptions, and the print of "Runtime Assumptions:". The runtime assumptions are still properly attached to each Dependence result and printed as part of the per-dependence output.
1 parent 2f56977 commit 53ece54

File tree

4 files changed

+4
-38
lines changed

4 files changed

+4
-38
lines changed

llvm/include/llvm/Analysis/DependenceAnalysis.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,11 @@ class DependenceInfo {
355355

356356
Function *getFunction() const { return F; }
357357

358-
/// getRuntimeAssumptions - Returns all the runtime assumptions under which
359-
/// the dependence test is valid.
360-
LLVM_ABI SCEVUnionPredicate getRuntimeAssumptions() const;
361-
362358
private:
363359
AAResults *AA;
364360
ScalarEvolution *SE;
365361
LoopInfo *LI;
366362
Function *F;
367-
SmallVector<const SCEVPredicate *, 4> Assumptions;
368363

369364
/// Subscript - This private struct represents a pair of subscripts from
370365
/// a pair of potentially multi-dimensional array references. We use a

llvm/lib/Analysis/DependenceAnalysis.cpp

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,6 @@ static void dumpExampleDependence(raw_ostream &OS, DependenceInfo *DA,
441441
}
442442
}
443443
}
444-
SCEVUnionPredicate Assumptions = DA->getRuntimeAssumptions();
445-
if (!Assumptions.isAlwaysTrue()) {
446-
OS << "Runtime Assumptions:\n";
447-
Assumptions.print(OS, 0);
448-
}
449444
}
450445

451446
void DependenceAnalysisWrapperPass::print(raw_ostream &OS,
@@ -3384,10 +3379,6 @@ bool DependenceInfo::invalidate(Function &F, const PreservedAnalyses &PA,
33843379
Inv.invalidate<LoopAnalysis>(F, PA);
33853380
}
33863381

3387-
SCEVUnionPredicate DependenceInfo::getRuntimeAssumptions() const {
3388-
return SCEVUnionPredicate(Assumptions, *SE);
3389-
}
3390-
33913382
// depends -
33923383
// Returns NULL if there is no dependence.
33933384
// Otherwise, return a Dependence with as many details as possible.
@@ -3488,20 +3479,10 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
34883479
SCEVUnionPredicate(Assume, *SE));
34893480
}
34903481

3491-
if (!Assume.empty()) {
3492-
if (!UnderRuntimeAssumptions)
3493-
return std::make_unique<Dependence>(Src, Dst,
3494-
SCEVUnionPredicate(Assume, *SE));
3495-
// Add non-redundant assumptions.
3496-
unsigned N = Assumptions.size();
3497-
for (const SCEVPredicate *P : Assume) {
3498-
bool Implied = false;
3499-
for (unsigned I = 0; I != N && !Implied; I++)
3500-
if (Assumptions[I]->implies(P, *SE))
3501-
Implied = true;
3502-
if (!Implied)
3503-
Assumptions.push_back(P);
3504-
}
3482+
if (!Assume.empty() && !UnderRuntimeAssumptions) {
3483+
// Runtime assumptions needed but not allowed.
3484+
return std::make_unique<Dependence>(Src, Dst,
3485+
SCEVUnionPredicate(Assume, *SE));
35053486
}
35063487

35073488
unsigned Pairs = 1;

llvm/test/Analysis/DependenceAnalysis/DifferentOffsets.ll

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ define i32 @alias_with_parametric_offset(ptr nocapture %A, i64 %n) {
3434
; CHECK-NEXT: Equal predicate: (zext i2 (trunc i64 %n to i2) to i64) == 0
3535
; CHECK-NEXT: Src: %0 = load i32, ptr %A, align 1 --> Dst: %0 = load i32, ptr %A, align 1
3636
; CHECK-NEXT: da analyze - none!
37-
; CHECK-NEXT: Runtime Assumptions:
38-
; CHECK-NEXT: Equal predicate: (zext i2 (trunc i64 %n to i2) to i64) == 0
3937
;
4038
entry:
4139
%arrayidx = getelementptr inbounds i8, ptr %A, i64 %n
@@ -55,9 +53,6 @@ define i32 @alias_with_parametric_expr(ptr nocapture %A, i64 %n, i64 %m) {
5553
; CHECK-NEXT: Equal predicate: (zext i2 (-2 + (trunc i64 %m to i2)) to i64) == 0
5654
; CHECK-NEXT: Src: %0 = load i32, ptr %arrayidx1, align 1 --> Dst: %0 = load i32, ptr %arrayidx1, align 1
5755
; CHECK-NEXT: da analyze - none!
58-
; CHECK-NEXT: Runtime Assumptions:
59-
; CHECK-NEXT: Equal predicate: (zext i2 ((trunc i64 %m to i2) + (-2 * (trunc i64 %n to i2))) to i64) == 0
60-
; CHECK-NEXT: Equal predicate: (zext i2 (-2 + (trunc i64 %m to i2)) to i64) == 0
6156
;
6257
entry:
6358
%mul = mul nsw i64 %n, 10
@@ -81,8 +76,6 @@ define i32 @gep_i8_vs_i32(ptr nocapture %A, i64 %n, i64 %m) {
8176
; CHECK-NEXT: Equal predicate: (zext i2 (trunc i64 %n to i2) to i64) == 0
8277
; CHECK-NEXT: Src: store i32 42, ptr %arrayidx1, align 4 --> Dst: store i32 42, ptr %arrayidx1, align 4
8378
; CHECK-NEXT: da analyze - none!
84-
; CHECK-NEXT: Runtime Assumptions:
85-
; CHECK-NEXT: Equal predicate: (zext i2 (trunc i64 %n to i2) to i64) == 0
8679
;
8780
entry:
8881
%arrayidx0 = getelementptr inbounds i8, ptr %A, i64 %n

llvm/test/Analysis/DependenceAnalysis/MIVCheckConst.ll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ define void @test(ptr %A, ptr %B, i1 %arg, i32 %n, i32 %m) align 2 {
5050
; CHECK-NEXT: Equal predicate: (8 * (zext i4 (trunc i32 %v1 to i4) to i32))<nuw><nsw> == 0
5151
; CHECK-NEXT: Src: %v32 = load <32 x i32>, ptr %v30, align 128 --> Dst: %v32 = load <32 x i32>, ptr %v30, align 128
5252
; CHECK-NEXT: da analyze - consistent input [0 S S]!
53-
; CHECK-NEXT: Runtime Assumptions:
54-
; CHECK-NEXT: Equal predicate: (zext i7 (4 * (trunc i32 %v1 to i7) * (1 + (trunc i32 %n to i7))) to i32) == 0
55-
; CHECK-NEXT: Equal predicate: (8 * (zext i4 (trunc i32 %v1 to i4) to i32))<nuw><nsw> == 0
5653
;
5754
entry:
5855
%v1 = load i32, ptr %B, align 4

0 commit comments

Comments
 (0)