Skip to content

Commit b413d67

Browse files
sebpopkcloudy0717
authored andcommitted
[DA] Fix zero coeff bug in Strong SIV test with runtime assumptions (llvm#149991) (llvm#155037)
Fix GitHub issue llvm#149991 where Strong SIV test incorrectly concludes 'none!' for symbolic coefficients that could be zero, leading to 0/0 undef behavior. The Strong SIV test was incorrectly concluding "no dependence" when the coefficient is symbolic and the delta (difference between source and destination) is zero. When delta=0, the Strong SIV test divides delta/coeff to get the distance. The bug occurs when coeff is an unknown symbolic value: if coeff=0 at runtime, then 0/0 is undefined and all iterations access the same memory location, creating a true dependence that was being missed.
1 parent 43b6f7b commit b413d67

16 files changed

+153
-35
lines changed

llvm/include/llvm/Analysis/DependenceAnalysis.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ class DependenceInfo {
543543
/// If the dependence isn't proven to exist,
544544
/// marks the Result as inconsistent.
545545
bool testSIV(const SCEV *Src, const SCEV *Dst, unsigned &Level,
546-
FullDependence &Result) const;
546+
FullDependence &Result, bool UnderRuntimeAssumptions);
547547

548548
/// testRDIV - Tests the RDIV subscript pair (Src and Dst) for dependence.
549549
/// Things of the form [c1 + a1*i] and [c2 + a2*j]
@@ -573,7 +573,7 @@ class DependenceInfo {
573573
bool strongSIVtest(const SCEV *Coeff, const SCEV *SrcConst,
574574
const SCEV *DstConst, const Loop *CurrentSrcLoop,
575575
const Loop *CurrentDstLoop, unsigned Level,
576-
FullDependence &Result) const;
576+
FullDependence &Result, bool UnderRuntimeAssumptions);
577577

578578
/// weakCrossingSIVtest - Tests the weak-crossing SIV subscript pair
579579
/// (Src and Dst) for dependence.

llvm/include/llvm/Analysis/ScalarEvolution.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,15 @@ class LLVM_ABI SCEVUnionPredicate final : public SCEVPredicate {
427427

428428
ArrayRef<const SCEVPredicate *> getPredicates() const { return Preds; }
429429

430+
/// Returns a new SCEVUnionPredicate that is the union of this predicate
431+
/// and the given predicate \p N.
432+
SCEVUnionPredicate getUnionWith(const SCEVPredicate *N,
433+
ScalarEvolution &SE) const {
434+
SCEVUnionPredicate Result(Preds, SE);
435+
Result.add(N, SE);
436+
return Result;
437+
}
438+
430439
/// Implementation of the SCEVPredicate interface
431440
bool isAlwaysTrue() const override;
432441
bool implies(const SCEVPredicate *N, ScalarEvolution &SE) const override;

llvm/lib/Analysis/DependenceAnalysis.cpp

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,8 @@ bool DependenceInfo::testZIV(const SCEV *Src, const SCEV *Dst,
12961296
bool DependenceInfo::strongSIVtest(const SCEV *Coeff, const SCEV *SrcConst,
12971297
const SCEV *DstConst, const Loop *CurSrcLoop,
12981298
const Loop *CurDstLoop, unsigned Level,
1299-
FullDependence &Result) const {
1299+
FullDependence &Result,
1300+
bool UnderRuntimeAssumptions) {
13001301
if (!isDependenceTestEnabled(DependenceTestType::StrongSIV))
13011302
return false;
13021303

@@ -1368,7 +1369,29 @@ bool DependenceInfo::strongSIVtest(const SCEV *Coeff, const SCEV *SrcConst,
13681369
Result.DV[Level].Direction &= Dependence::DVEntry::EQ;
13691370
++StrongSIVsuccesses;
13701371
} else if (Delta->isZero()) {
1371-
// since 0/X == 0
1372+
// Check if coefficient could be zero. If so, 0/0 is undefined and we
1373+
// cannot conclude that only same-iteration dependencies exist.
1374+
// When coeff=0, all iterations access the same location.
1375+
if (SE->isKnownNonZero(Coeff)) {
1376+
LLVM_DEBUG(
1377+
dbgs() << "\t Coefficient proven non-zero by SCEV analysis\n");
1378+
} else {
1379+
// Cannot prove at compile time, would need runtime assumption.
1380+
if (UnderRuntimeAssumptions) {
1381+
const SCEVPredicate *Pred = SE->getComparePredicate(
1382+
ICmpInst::ICMP_NE, Coeff, SE->getZero(Coeff->getType()));
1383+
Result.Assumptions = Result.Assumptions.getUnionWith(Pred, *SE);
1384+
LLVM_DEBUG(dbgs() << "\t Added runtime assumption: " << *Coeff
1385+
<< " != 0\n");
1386+
} else {
1387+
// Cannot add runtime assumptions, this test cannot handle this case.
1388+
// Let more complex tests try.
1389+
LLVM_DEBUG(dbgs() << "\t Would need runtime assumption " << *Coeff
1390+
<< " != 0, but not allowed. Failing this test.\n");
1391+
return false;
1392+
}
1393+
}
1394+
// Since 0/X == 0 (where X is known non-zero or assumed non-zero).
13721395
Result.DV[Level].Distance = Delta;
13731396
Result.DV[Level].Direction &= Dependence::DVEntry::EQ;
13741397
++StrongSIVsuccesses;
@@ -2331,7 +2354,8 @@ bool DependenceInfo::symbolicRDIVtest(const SCEV *A1, const SCEV *A2,
23312354
//
23322355
// Return true if dependence disproved.
23332356
bool DependenceInfo::testSIV(const SCEV *Src, const SCEV *Dst, unsigned &Level,
2334-
FullDependence &Result) const {
2357+
FullDependence &Result,
2358+
bool UnderRuntimeAssumptions) {
23352359
LLVM_DEBUG(dbgs() << " src = " << *Src << "\n");
23362360
LLVM_DEBUG(dbgs() << " dst = " << *Dst << "\n");
23372361
const SCEVAddRecExpr *SrcAddRec = dyn_cast<SCEVAddRecExpr>(Src);
@@ -2349,8 +2373,9 @@ bool DependenceInfo::testSIV(const SCEV *Src, const SCEV *Dst, unsigned &Level,
23492373
Level = mapSrcLoop(CurSrcLoop);
23502374
bool disproven;
23512375
if (SrcCoeff == DstCoeff)
2352-
disproven = strongSIVtest(SrcCoeff, SrcConst, DstConst, CurSrcLoop,
2353-
CurDstLoop, Level, Result);
2376+
disproven =
2377+
strongSIVtest(SrcCoeff, SrcConst, DstConst, CurSrcLoop, CurDstLoop,
2378+
Level, Result, UnderRuntimeAssumptions);
23542379
else if (SrcCoeff == SE->getNegativeSCEV(DstCoeff))
23552380
disproven = weakCrossingSIVtest(SrcCoeff, SrcConst, DstConst, CurSrcLoop,
23562381
CurDstLoop, Level, Result);
@@ -3463,11 +3488,10 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
34633488
SCEVUnionPredicate(Assume, *SE));
34643489
}
34653490

3466-
if (!Assume.empty() && !UnderRuntimeAssumptions) {
3467-
// Runtime assumptions needed but not allowed.
3491+
// Runtime assumptions needed but not allowed.
3492+
if (!Assume.empty() && !UnderRuntimeAssumptions)
34683493
return std::make_unique<Dependence>(Src, Dst,
34693494
SCEVUnionPredicate(Assume, *SE));
3470-
}
34713495

34723496
unsigned Pairs = 1;
34733497
SmallVector<Subscript, 2> Pair(Pairs);
@@ -3567,7 +3591,8 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
35673591
case Subscript::SIV: {
35683592
LLVM_DEBUG(dbgs() << ", SIV\n");
35693593
unsigned Level;
3570-
if (testSIV(Pair[SI].Src, Pair[SI].Dst, Level, Result))
3594+
if (testSIV(Pair[SI].Src, Pair[SI].Dst, Level, Result,
3595+
UnderRuntimeAssumptions))
35713596
return nullptr;
35723597
break;
35733598
}
@@ -3648,14 +3673,15 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
36483673
} else {
36493674
// On the other hand, if all directions are equal and there's no
36503675
// loop-independent dependence possible, then no dependence exists.
3676+
// However, if there are runtime assumptions, we must return the result.
36513677
bool AllEqual = true;
36523678
for (unsigned II = 1; II <= CommonLevels; ++II) {
36533679
if (Result.getDirection(II) != Dependence::DVEntry::EQ) {
36543680
AllEqual = false;
36553681
break;
36563682
}
36573683
}
3658-
if (AllEqual)
3684+
if (AllEqual && Result.Assumptions.getPredicates().empty())
36593685
return nullptr;
36603686
}
36613687

llvm/test/Analysis/DependenceAnalysis/DADelin.ll

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -646,11 +646,15 @@ exit:
646646
define void @coeff_may_negative(ptr %a, i32 %k) {
647647
; CHECK-LABEL: 'coeff_may_negative'
648648
; CHECK-NEXT: Src: store i8 42, ptr %idx.0, align 1 --> Dst: store i8 42, ptr %idx.0, align 1
649-
; CHECK-NEXT: da analyze - none!
649+
; CHECK-NEXT: da analyze - consistent output [0]!
650+
; CHECK-NEXT: Runtime Assumptions:
651+
; CHECK-NEXT: Compare predicate: %k ne) 0
650652
; CHECK-NEXT: Src: store i8 42, ptr %idx.0, align 1 --> Dst: store i8 42, ptr %idx.1, align 1
651653
; CHECK-NEXT: da analyze - output [*|<]!
652654
; CHECK-NEXT: Src: store i8 42, ptr %idx.1, align 1 --> Dst: store i8 42, ptr %idx.1, align 1
653-
; CHECK-NEXT: da analyze - none!
655+
; CHECK-NEXT: da analyze - consistent output [0]!
656+
; CHECK-NEXT: Runtime Assumptions:
657+
; CHECK-NEXT: Compare predicate: %k ne) 0
654658
;
655659
entry:
656660
br label %loop
@@ -685,11 +689,15 @@ exit:
685689
define void @coeff_positive(ptr %a, i32 %k) {
686690
; CHECK-LABEL: 'coeff_positive'
687691
; CHECK-NEXT: Src: store i8 42, ptr %idx.0, align 1 --> Dst: store i8 42, ptr %idx.0, align 1
688-
; CHECK-NEXT: da analyze - none!
692+
; CHECK-NEXT: da analyze - consistent output [0]!
693+
; CHECK-NEXT: Runtime Assumptions:
694+
; CHECK-NEXT: Compare predicate: %k ne) 0
689695
; CHECK-NEXT: Src: store i8 42, ptr %idx.0, align 1 --> Dst: store i8 42, ptr %idx.1, align 1
690696
; CHECK-NEXT: da analyze - output [*|<]!
691697
; CHECK-NEXT: Src: store i8 42, ptr %idx.1, align 1 --> Dst: store i8 42, ptr %idx.1, align 1
692-
; CHECK-NEXT: da analyze - none!
698+
; CHECK-NEXT: da analyze - consistent output [0]!
699+
; CHECK-NEXT: Runtime Assumptions:
700+
; CHECK-NEXT: Compare predicate: %k ne) 0
693701
;
694702
entry:
695703
br label %loop

llvm/test/Analysis/DependenceAnalysis/DifferentOffsets.ll

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ entry:
2727
define i32 @alias_with_parametric_offset(ptr nocapture %A, i64 %n) {
2828
; CHECK-LABEL: 'alias_with_parametric_offset'
2929
; CHECK-NEXT: Src: store i32 2, ptr %arrayidx, align 1 --> Dst: store i32 2, ptr %arrayidx, align 1
30-
; CHECK-NEXT: da analyze - none!
30+
; CHECK-NEXT: da analyze - consistent output []!
31+
; CHECK-NEXT: Runtime Assumptions:
32+
; CHECK-NEXT: Equal predicate: (zext i2 (trunc i64 %n to i2) to i64) == 0
3133
; CHECK-NEXT: Src: store i32 2, ptr %arrayidx, align 1 --> Dst: %0 = load i32, ptr %A, align 1
3234
; CHECK-NEXT: da analyze - flow [|<]!
3335
; CHECK-NEXT: Runtime Assumptions:
@@ -45,14 +47,18 @@ entry:
4547
define i32 @alias_with_parametric_expr(ptr nocapture %A, i64 %n, i64 %m) {
4648
; CHECK-LABEL: 'alias_with_parametric_expr'
4749
; CHECK-NEXT: Src: store i32 2, ptr %arrayidx, align 1 --> Dst: store i32 2, ptr %arrayidx, align 1
48-
; CHECK-NEXT: da analyze - none!
50+
; CHECK-NEXT: da analyze - consistent output []!
51+
; CHECK-NEXT: Runtime Assumptions:
52+
; CHECK-NEXT: Equal predicate: (zext i2 ((trunc i64 %m to i2) + (-2 * (trunc i64 %n to i2))) to i64) == 0
4953
; CHECK-NEXT: Src: store i32 2, ptr %arrayidx, align 1 --> Dst: %0 = load i32, ptr %arrayidx1, align 1
5054
; CHECK-NEXT: da analyze - flow [|<]!
5155
; CHECK-NEXT: Runtime Assumptions:
5256
; CHECK-NEXT: Equal predicate: (zext i2 ((trunc i64 %m to i2) + (-2 * (trunc i64 %n to i2))) to i64) == 0
5357
; CHECK-NEXT: Equal predicate: (zext i2 (-2 + (trunc i64 %m to i2)) to i64) == 0
5458
; CHECK-NEXT: Src: %0 = load i32, ptr %arrayidx1, align 1 --> Dst: %0 = load i32, ptr %arrayidx1, align 1
55-
; CHECK-NEXT: da analyze - none!
59+
; CHECK-NEXT: da analyze - consistent input []!
60+
; CHECK-NEXT: Runtime Assumptions:
61+
; CHECK-NEXT: Equal predicate: (zext i2 (-2 + (trunc i64 %m to i2)) to i64) == 0
5662
;
5763
entry:
5864
%mul = mul nsw i64 %n, 10
@@ -69,7 +75,9 @@ entry:
6975
define i32 @gep_i8_vs_i32(ptr nocapture %A, i64 %n, i64 %m) {
7076
; CHECK-LABEL: 'gep_i8_vs_i32'
7177
; CHECK-NEXT: Src: store i32 42, ptr %arrayidx0, align 1 --> Dst: store i32 42, ptr %arrayidx0, align 1
72-
; CHECK-NEXT: da analyze - none!
78+
; CHECK-NEXT: da analyze - consistent output []!
79+
; CHECK-NEXT: Runtime Assumptions:
80+
; CHECK-NEXT: Equal predicate: (zext i2 (trunc i64 %n to i2) to i64) == 0
7381
; CHECK-NEXT: Src: store i32 42, ptr %arrayidx0, align 1 --> Dst: store i32 42, ptr %arrayidx1, align 4
7482
; CHECK-NEXT: da analyze - output [|<]!
7583
; CHECK-NEXT: Runtime Assumptions:

llvm/test/Analysis/DependenceAnalysis/MIVCheckConst.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ define void @test(ptr %A, ptr %B, i1 %arg, i32 %n, i32 %m) align 2 {
4343
; CHECK-NEXT: Runtime Assumptions:
4444
; CHECK-NEXT: Equal predicate: (zext i7 (4 * (trunc i32 %v1 to i7) * (1 + (trunc i32 %n to i7))) to i32) == 0
4545
; CHECK-NEXT: Equal predicate: (8 * (zext i4 (trunc i32 %v1 to i4) to i32))<nuw><nsw> == 0
46+
; CHECK-NEXT: Compare predicate: (8 * %v1) ne) 0
4647
; CHECK-NEXT: Src: %v27 = load <32 x i32>, ptr %v25, align 256 --> Dst: %v32 = load <32 x i32>, ptr %v30, align 128
4748
; CHECK-NEXT: da analyze - input [* S S|<]!
4849
; CHECK-NEXT: Runtime Assumptions:

llvm/test/Analysis/DependenceAnalysis/StrongSIV.ll

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,19 @@ for.end: ; preds = %for.end.loopexit, %
492492
define void @strong10(ptr %A, ptr %B, i64 %n) nounwind uwtable ssp {
493493
; CHECK-LABEL: 'strong10'
494494
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: store i32 %conv, ptr %arrayidx, align 4
495-
; CHECK-NEXT: da analyze - none!
495+
; CHECK-NEXT: da analyze - consistent output [0]!
496+
; CHECK-NEXT: Runtime Assumptions:
497+
; CHECK-NEXT: Compare predicate: (4 * %n) ne) 0
496498
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: %0 = load i32, ptr %arrayidx3, align 4
497499
; CHECK-NEXT: da analyze - consistent flow [0|<]!
500+
; CHECK-NEXT: Runtime Assumptions:
501+
; CHECK-NEXT: Compare predicate: (4 * %n) ne) 0
498502
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: store i32 %0, ptr %B.addr.01, align 4
499503
; CHECK-NEXT: da analyze - confused!
500504
; CHECK-NEXT: Src: %0 = load i32, ptr %arrayidx3, align 4 --> Dst: %0 = load i32, ptr %arrayidx3, align 4
501-
; CHECK-NEXT: da analyze - none!
505+
; CHECK-NEXT: da analyze - consistent input [0]!
506+
; CHECK-NEXT: Runtime Assumptions:
507+
; CHECK-NEXT: Compare predicate: (4 * %n) ne) 0
502508
; CHECK-NEXT: Src: %0 = load i32, ptr %arrayidx3, align 4 --> Dst: store i32 %0, ptr %B.addr.01, align 4
503509
; CHECK-NEXT: da analyze - confused!
504510
; CHECK-NEXT: Src: store i32 %0, ptr %B.addr.01, align 4 --> Dst: store i32 %0, ptr %B.addr.01, align 4

llvm/test/Analysis/DependenceAnalysis/SymbolicSIV.ll

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,17 @@ for.end: ; preds = %for.end.loopexit, %
381381
define void @symbolicsiv6(ptr %A, ptr %B, i64 %n, i64 %N, i64 %M) nounwind uwtable ssp {
382382
; CHECK-LABEL: 'symbolicsiv6'
383383
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: store i32 %conv, ptr %arrayidx, align 4
384-
; CHECK-NEXT: da analyze - none!
384+
; CHECK-NEXT: da analyze - consistent output [0]!
385+
; CHECK-NEXT: Runtime Assumptions:
386+
; CHECK-NEXT: Compare predicate: (16 * %N) ne) 0
385387
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: %0 = load i32, ptr %arrayidx7, align 4
386388
; CHECK-NEXT: da analyze - flow [*|<]!
387389
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: store i32 %0, ptr %B.addr.02, align 4
388390
; CHECK-NEXT: da analyze - confused!
389391
; CHECK-NEXT: Src: %0 = load i32, ptr %arrayidx7, align 4 --> Dst: %0 = load i32, ptr %arrayidx7, align 4
390-
; CHECK-NEXT: da analyze - none!
392+
; CHECK-NEXT: da analyze - consistent input [0]!
393+
; CHECK-NEXT: Runtime Assumptions:
394+
; CHECK-NEXT: Compare predicate: (16 * %N) ne) 0
391395
; CHECK-NEXT: Src: %0 = load i32, ptr %arrayidx7, align 4 --> Dst: store i32 %0, ptr %B.addr.02, align 4
392396
; CHECK-NEXT: da analyze - confused!
393397
; CHECK-NEXT: Src: store i32 %0, ptr %B.addr.02, align 4 --> Dst: store i32 %0, ptr %B.addr.02, align 4
@@ -437,13 +441,17 @@ for.end: ; preds = %for.end.loopexit, %
437441
define void @symbolicsiv7(ptr %A, ptr %B, i64 %n, i64 %N, i64 %M) nounwind uwtable ssp {
438442
; CHECK-LABEL: 'symbolicsiv7'
439443
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: store i32 %conv, ptr %arrayidx, align 4
440-
; CHECK-NEXT: da analyze - none!
444+
; CHECK-NEXT: da analyze - consistent output [0]!
445+
; CHECK-NEXT: Runtime Assumptions:
446+
; CHECK-NEXT: Compare predicate: (8 * %N) ne) 0
441447
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: %1 = load i32, ptr %arrayidx6, align 4
442448
; CHECK-NEXT: da analyze - flow [*|<]!
443449
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: store i32 %1, ptr %B.addr.02, align 4
444450
; CHECK-NEXT: da analyze - confused!
445451
; CHECK-NEXT: Src: %1 = load i32, ptr %arrayidx6, align 4 --> Dst: %1 = load i32, ptr %arrayidx6, align 4
446-
; CHECK-NEXT: da analyze - none!
452+
; CHECK-NEXT: da analyze - consistent input [0]!
453+
; CHECK-NEXT: Runtime Assumptions:
454+
; CHECK-NEXT: Compare predicate: (8 * %N) ne) 0
447455
; CHECK-NEXT: Src: %1 = load i32, ptr %arrayidx6, align 4 --> Dst: store i32 %1, ptr %B.addr.02, align 4
448456
; CHECK-NEXT: da analyze - confused!
449457
; CHECK-NEXT: Src: store i32 %1, ptr %B.addr.02, align 4 --> Dst: store i32 %1, ptr %B.addr.02, align 4

llvm/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ target triple = "x86_64-apple-macosx10.6.0"
1414
define void @weakcrossing0(ptr %A, ptr %B, i64 %n) nounwind uwtable ssp {
1515
; CHECK-LABEL: 'weakcrossing0'
1616
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: store i32 %conv, ptr %arrayidx, align 4
17-
; CHECK-NEXT: da analyze - none!
17+
; CHECK-NEXT: da analyze - consistent output [0]!
18+
; CHECK-NEXT: Runtime Assumptions:
19+
; CHECK-NEXT: Compare predicate: (4 * %n) ne) 0
1820
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: %0 = load i32, ptr %arrayidx2, align 4
1921
; CHECK-NEXT: da analyze - flow [0|<]!
2022
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: store i32 %0, ptr %B.addr.02, align 4
2123
; CHECK-NEXT: da analyze - confused!
2224
; CHECK-NEXT: Src: %0 = load i32, ptr %arrayidx2, align 4 --> Dst: %0 = load i32, ptr %arrayidx2, align 4
23-
; CHECK-NEXT: da analyze - none!
25+
; CHECK-NEXT: da analyze - consistent input [0]!
26+
; CHECK-NEXT: Runtime Assumptions:
27+
; CHECK-NEXT: Compare predicate: (-4 * %n) ne) 0
2428
; CHECK-NEXT: Src: %0 = load i32, ptr %arrayidx2, align 4 --> Dst: store i32 %0, ptr %B.addr.02, align 4
2529
; CHECK-NEXT: da analyze - confused!
2630
; CHECK-NEXT: Src: store i32 %0, ptr %B.addr.02, align 4 --> Dst: store i32 %0, ptr %B.addr.02, align 4

llvm/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ for.end: ; preds = %for.body
9090
define void @weakzerodst1(ptr %A, ptr %B, i64 %n) nounwind uwtable ssp {
9191
; CHECK-LABEL: 'weakzerodst1'
9292
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: store i32 %conv, ptr %arrayidx, align 4
93-
; CHECK-NEXT: da analyze - none!
93+
; CHECK-NEXT: da analyze - consistent output [0]!
94+
; CHECK-NEXT: Runtime Assumptions:
95+
; CHECK-NEXT: Compare predicate: (4 * %n) ne) 0
9496
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: %0 = load i32, ptr %arrayidx1, align 4
9597
; CHECK-NEXT: da analyze - flow [p<=|<]!
9698
; CHECK-NEXT: Src: store i32 %conv, ptr %arrayidx, align 4 --> Dst: store i32 %0, ptr %B.addr.02, align 4

0 commit comments

Comments
 (0)