Skip to content

Commit a7f0b09

Browse files
committed
!fixup address comments, thanks
1 parent e9a52ac commit a7f0b09

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,8 @@ static bool isNoWrap(PredicatedScalarEvolution &PSE, const SCEVAddRecExpr *AR,
10371037
// For the above reasoning to apply, the pointer must be dereferenced in
10381038
// every iteration.
10391039
if (L->getHeader() == L->getLoopLatch() ||
1040-
any_of(GEP->users(), [L, DT](User *U) {
1041-
if (!isa<LoadInst, StoreInst>(U))
1040+
any_of(GEP->users(), [L, DT,GEP](User *U) {
1041+
if (getLoadStorePointerOperand(U) != GEP)
10421042
return false;
10431043
BasicBlock *UserBB = cast<Instruction>(U)->getParent();
10441044
if (DT && !LoopAccessInfo::blockNeedsPredication(UserBB, L, DT))
@@ -1311,7 +1311,7 @@ bool AccessAnalysis::createCheckForAccess(
13111311
}
13121312

13131313
if (!isNoWrap(PSE, AR, RTCheckPtrs.size() == 1 ? Ptr : nullptr, AccessTy,
1314-
TheLoop, Assume, std::nullopt, &DT))
1314+
TheLoop, Assume, {}, &DT))
13151315
return false;
13161316
}
13171317

llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
; s0 += (1ULL << 62) + 1;
1111
; s1 += (1ULL << 62) + 2;
1212
; }
13-
; FIXME: We cannot use inbounds on idx.0, idx.1 to infer no-wrap (and determine
13+
; We cannot use inbounds on idx.0, idx.1 to infer no-wrap (and determine
1414
; there are no dependences), as the pointers are not dereferenced in all loop iterations.
1515
define void @test_inbounds_gep_used_in_predicated_block(ptr %A, i64 %n) {
1616
; CHECK-LABEL: 'test_inbounds_gep_used_in_predicated_block'
@@ -68,9 +68,14 @@ define void @test_inbounds_gep_used_in_predicated_block_stored_value_operand(ptr
6868
; CHECK-NEXT: Dependences:
6969
; CHECK-NEXT: Run-time memory checks:
7070
; CHECK-NEXT: Grouped accesses:
71+
; CHECK-NEXT: Group GRP0:
72+
; CHECK-NEXT: (Low: %A High: (-4611686018427387705 + %A))
73+
; CHECK-NEXT: Member: {%A,+,4611686018427387906}<%loop.header>
74+
; CHECK-NEXT: Member: {%A,+,4611686018427387905}<%loop.header>
7175
; CHECK-EMPTY:
7276
; CHECK-NEXT: Non vectorizable stores to invariant address were found in loop.
7377
; CHECK-NEXT: SCEV assumptions:
78+
; CHECK-NEXT: {%A,+,4611686018427387906}<%loop.header> Added Flags: <nusw>
7479
; CHECK-EMPTY:
7580
; CHECK-NEXT: Expressions re-written:
7681
;
@@ -114,9 +119,14 @@ define void @test_inbounds_gep_used_in_predicated_block_non_memop_user(ptr %A, i
114119
; CHECK-NEXT: Dependences:
115120
; CHECK-NEXT: Run-time memory checks:
116121
; CHECK-NEXT: Grouped accesses:
122+
; CHECK-NEXT: Group GRP0:
123+
; CHECK-NEXT: (Low: %A High: (-4611686018427387705 + %A))
124+
; CHECK-NEXT: Member: {%A,+,4611686018427387906}<%loop.header>
125+
; CHECK-NEXT: Member: {%A,+,4611686018427387905}<%loop.header>
117126
; CHECK-EMPTY:
118127
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
119128
; CHECK-NEXT: SCEV assumptions:
129+
; CHECK-NEXT: {%A,+,4611686018427387906}<%loop.header> Added Flags: <nusw>
120130
; CHECK-EMPTY:
121131
; CHECK-NEXT: Expressions re-written:
122132
;

0 commit comments

Comments
 (0)