Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions llvm/lib/Analysis/LoopAccessAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,12 @@ static bool evaluatePtrAddRecAtMaxBTCWillNotWrap(
const Loop *L = AR->getLoop();
bool CheckForNonNull, CheckForFreed;
Value *StartPtrV = StartPtr->getValue();
// We can ignore frees, as the fact that an object of a certain size existed
// at the location *at some point* is sufficient to derive the nowrap fact.
uint64_t DerefBytes = StartPtrV->getPointerDereferenceableBytes(
DL, CheckForNonNull, CheckForFreed);

if (DerefBytes && (CheckForNonNull || CheckForFreed))
if (DerefBytes && CheckForNonNull)
return false;

const SCEV *Step = AR->getStepRecurrence(SE);
Expand All @@ -243,9 +245,6 @@ static bool evaluatePtrAddRecAtMaxBTCWillNotWrap(
[&](RetainedKnowledge RK, Instruction *Assume, auto) {
if (!isValidAssumeForContext(Assume, CtxI, DT))
return false;
if (StartPtrV->canBeFreed() &&
!willNotFreeBetween(Assume, CtxI))
return false;
DerefRK = std::max(DerefRK, RK);
return true;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
; RUN: opt -passes='print<access-info>' -disable-output %s 2>&1 | FileCheck %s
; RUN: opt -passes='print<access-info>' -use-dereferenceable-at-point-semantics -disable-output %s 2>&1 | FileCheck %s

define void @all_exits_dominate_latch_countable_exits_at_most_500_iterations_known_deref(ptr dereferenceable(2000) %A, ptr dereferenceable(2000) %B) {
; CHECK-LABEL: 'all_exits_dominate_latch_countable_exits_at_most_500_iterations_known_deref'
Expand Down Expand Up @@ -830,10 +831,10 @@ define void @all_exits_dominate_latch_countable_exits_at_most_500_iterations_kno
; CHECK-NEXT: %gep.A = getelementptr inbounds i32, ptr %A, i64 %iv
; CHECK-NEXT: Grouped accesses:
; CHECK-NEXT: Group GRP0:
; CHECK-NEXT: (Low: %B High: inttoptr (i64 -1 to ptr))
; CHECK-NEXT: (Low: %B High: (2000 + %B))
; CHECK-NEXT: Member: {%B,+,4}<nuw><%loop.header>
; CHECK-NEXT: Group GRP1:
; CHECK-NEXT: (Low: %A High: inttoptr (i64 -1 to ptr))
; CHECK-NEXT: (Low: %A High: (2000 + %A))
; CHECK-NEXT: Member: {%A,+,4}<nuw><%loop.header>
; CHECK-EMPTY:
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
Expand Down
1 change: 1 addition & 0 deletions llvm/test/Transforms/LoopVectorize/early-exit-calls.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals none --version 6
; RUN: opt -passes=loop-vectorize -force-vector-width=4 -S %s | FileCheck %s
; RUN: opt -passes=loop-vectorize -force-vector-width=4 -use-dereferenceable-at-point-semantics -S %s | FileCheck %s

define i32 @early_exit_with_extractvalue(ptr dereferenceable(1024) align 8 %src, i32 noundef %x) {
; CHECK-LABEL: define i32 @early_exit_with_extractvalue(
Expand Down
Loading