Skip to content

Commit a3a6878

Browse files
committed
!fixup re-add unrelated code removed by accident
1 parent 340a77e commit a3a6878

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

llvm/lib/Analysis/Loads.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,14 @@ bool llvm::isDereferenceableAndAlignedInLoop(
333333
if (isa<SCEVCouldNotCompute>(MaxBECount))
334334
return false;
335335

336+
if (isa<SCEVCouldNotCompute>(BECount)) {
337+
// TODO: Support symbolic max backedge taken counts for loops without
338+
// computable backedge taken counts.
339+
MaxBECount =
340+
Predicates
341+
? SE.getPredicatedConstantMaxBackedgeTakenCount(L, *Predicates)
342+
: SE.getConstantMaxBackedgeTakenCount(L);
343+
}
336344
const auto &[AccessStart, AccessEnd] = getStartAndEndForAccess(
337345
L, PtrScev, LI->getType(), BECount, MaxBECount, &SE, nullptr, &DT, AC);
338346
if (isa<SCEVCouldNotCompute>(AccessStart) ||

llvm/test/Transforms/LoopVectorize/single-early-exit-deref-assumptions.ll

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ define i64 @early_exit_alignment_and_deref_known_via_assumption_with_constant_si
1313
; CHECK: vector.body:
1414
; CHECK-NEXT: [[INDEX1:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT3:%.*]], [[LOOP]] ]
1515
; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[P1]], i64 [[INDEX1]]
16-
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[TMP0]], i32 0
17-
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i8>, ptr [[TMP1]], align 1
16+
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i8>, ptr [[TMP0]], align 1
1817
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[P2]], i64 [[INDEX1]]
19-
; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[TMP2]], i32 0
20-
; CHECK-NEXT: [[WIDE_LOAD2:%.*]] = load <4 x i8>, ptr [[TMP3]], align 1
18+
; CHECK-NEXT: [[WIDE_LOAD2:%.*]] = load <4 x i8>, ptr [[TMP2]], align 1
2119
; CHECK-NEXT: [[TMP4:%.*]] = icmp ne <4 x i8> [[WIDE_LOAD]], [[WIDE_LOAD2]]
2220
; CHECK-NEXT: [[INDEX_NEXT3]] = add nuw i64 [[INDEX1]], 4
2321
; CHECK-NEXT: [[TMP5:%.*]] = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> [[TMP4]])
@@ -27,13 +25,13 @@ define i64 @early_exit_alignment_and_deref_known_via_assumption_with_constant_si
2725
; CHECK: middle.split:
2826
; CHECK-NEXT: br i1 [[TMP5]], label [[VECTOR_EARLY_EXIT:%.*]], label [[MIDDLE_BLOCK:%.*]]
2927
; CHECK: middle.block:
30-
; CHECK-NEXT: br i1 true, label [[LOOP_END:%.*]], label [[SCALAR_PH]]
28+
; CHECK-NEXT: br label [[LOOP_END:%.*]]
3129
; CHECK: vector.early.exit:
3230
; CHECK-NEXT: [[TMP8:%.*]] = call i64 @llvm.experimental.cttz.elts.i64.v4i1(<4 x i1> [[TMP4]], i1 true)
3331
; CHECK-NEXT: [[TMP9:%.*]] = add i64 [[INDEX1]], [[TMP8]]
3432
; CHECK-NEXT: br label [[LOOP_END]]
3533
; CHECK: scalar.ph:
36-
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1024, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
34+
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ]
3735
; CHECK-NEXT: br label [[LOOP1:%.*]]
3836
; CHECK: loop:
3937
; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ [[INDEX_NEXT:%.*]], [[LOOP_INC:%.*]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ]

0 commit comments

Comments
 (0)