Skip to content

Commit 7118430

Browse files
committed
[DA] Simplify runtime predicate collection
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 ad9bc6a commit 7118430

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,
@@ -3510,10 +3505,6 @@ bool DependenceInfo::invalidate(Function &F, const PreservedAnalyses &PA,
35103505
Inv.invalidate<LoopAnalysis>(F, PA);
35113506
}
35123507

3513-
SCEVUnionPredicate DependenceInfo::getRuntimeAssumptions() const {
3514-
return SCEVUnionPredicate(Assumptions, *SE);
3515-
}
3516-
35173508
// depends -
35183509
// Returns NULL if there is no dependence.
35193510
// Otherwise, return a Dependence with as many details as possible.
@@ -3614,20 +3605,10 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
36143605
SCEVUnionPredicate(Assume, *SE));
36153606
}
36163607

3617-
if (!Assume.empty()) {
3618-
if (!UnderRuntimeAssumptions)
3619-
return std::make_unique<Dependence>(Src, Dst,
3620-
SCEVUnionPredicate(Assume, *SE));
3621-
// Add non-redundant assumptions.
3622-
unsigned N = Assumptions.size();
3623-
for (const SCEVPredicate *P : Assume) {
3624-
bool Implied = false;
3625-
for (unsigned I = 0; I != N && !Implied; I++)
3626-
if (Assumptions[I]->implies(P, *SE))
3627-
Implied = true;
3628-
if (!Implied)
3629-
Assumptions.push_back(P);
3630-
}
3608+
if (!Assume.empty() && !UnderRuntimeAssumptions) {
3609+
// Runtime assumptions needed but not allowed.
3610+
return std::make_unique<Dependence>(Src, Dst,
3611+
SCEVUnionPredicate(Assume, *SE));
36313612
}
36323613

36333614
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)