Skip to content
Merged
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
17 changes: 13 additions & 4 deletions llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1784,14 +1784,23 @@ bool LoopVectorizationLegality::canVectorize(bool UseVPlanNativePath) {

HasUncountableEarlyExit = false;
if (isa<SCEVCouldNotCompute>(PSE.getBackedgeTakenCount())) {
HasUncountableEarlyExit = true;
if (!isVectorizableEarlyExitLoop()) {
UncountableExitingBlocks.clear();
HasUncountableEarlyExit = false;
if (TheLoop->getExitingBlock()) {
reportVectorizationFailure("Cannot vectorize uncountable loop",
"UnsupportedUncountableLoop", ORE, TheLoop);
if (DoExtraAnalysis)
Result = false;
else
return false;
} else {
HasUncountableEarlyExit = true;
if (!isVectorizableEarlyExitLoop()) {
UncountableExitingBlocks.clear();
HasUncountableEarlyExit = false;
if (DoExtraAnalysis)
Result = false;
else
return false;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
; }
; }
; File, line, and column should match those specified in the metadata
; CHECK: remark: source.cpp:5:9: loop not vectorized: Cannot vectorize early exit loop
; CHECK: remark: source.cpp:5:9: loop not vectorized: Cannot vectorize uncountable loop
; CHECK: remark: source.cpp:5:9: loop not vectorized

; void test_disabled(int *A, int Length) {
Expand Down Expand Up @@ -46,12 +46,12 @@

; YAML: --- !Analysis
; YAML-NEXT: Pass: loop-vectorize
; YAML-NEXT: Name: EarlyExitNotLatchPredecessor
; YAML-NEXT: Name: UnsupportedUncountableLoop
; YAML-NEXT: DebugLoc: { File: source.cpp, Line: 5, Column: 9 }
; YAML-NEXT: Function: _Z4testPii
; YAML-NEXT: Args:
; YAML-NEXT: - String: 'loop not vectorized: '
; YAML-NEXT: - String: Cannot vectorize early exit loop
; YAML-NEXT: - String: Cannot vectorize uncountable loop
; YAML-NEXT: ...
; YAML-NEXT: --- !Missed
; YAML-NEXT: Pass: loop-vectorize
Expand Down Expand Up @@ -117,12 +117,12 @@
; YAML-NEXT: ...
; YAML-NEXT: --- !Analysis
; YAML-NEXT: Pass: loop-vectorize
; YAML-NEXT: Name: EarlyExitNotLatchPredecessor
; YAML-NEXT: Name: UnsupportedUncountableLoop
; YAML-NEXT: DebugLoc: { File: source.cpp, Line: 27, Column: 3 }
; YAML-NEXT: Function: test_multiple_failures
; YAML-NEXT: Args:
; YAML-NEXT: - String: 'loop not vectorized: '
; YAML-NEXT: - String: Cannot vectorize early exit loop
; YAML-NEXT: - String: Cannot vectorize uncountable loop
; YAML-NEXT: ...
; YAML: --- !Missed
; YAML-NEXT: Pass: loop-vectorize
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopVectorize/early_exit_legality.ll
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ loop.end:

define i64 @uncountable_exit_infinite_loop() {
; CHECK-LABEL: LV: Checking a loop in 'uncountable_exit_infinite_loop'
; CHECK: LV: Not vectorizing: Cannot determine exact exit count for latch block.
; CHECK: LV: Not vectorizing: Cannot vectorize uncountable loop.
entry:
%p1 = alloca [1024 x i8]
%p2 = alloca [1024 x i8]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
; REQUIRES: asserts
; RUN: opt -p loop-vectorize -debug %s 2>&1 | FileCheck %s
; RUN: opt -p loop-vectorize -debug-only=loop-vectorize -S %s 2>&1 | FileCheck %s


; CHECK-LABEL: LV: Checking a loop in 'latch_exit_cannot_compute_btc_due_to_step'
; CHECK: LV: Did not find one integer induction var.
; CHECK-NEXT: LV: Not vectorizing: Early exit is not the latch predecessor.
; CHECK-NEXT: LV: Not vectorizing: Cannot vectorize uncountable loop.
; CHECK-NEXT: LV: Interleaving disabled by the pass manager
; CHECK-NEXT: LV: Not vectorizing: Cannot prove legality.

; CHECK-LABEL: LV: Checking a loop in 'header_exit_cannot_compute_btc_due_to_step'
; CHECK: LV: Found an induction variable.
; CHECK-NEXT: LV: Did not find one integer induction var.
; CHECK-NEXT: LV: Not vectorizing: Cannot determine exact exit count for latch block.
; CHECK-NEXT: LV: Not vectorizing: Cannot vectorize uncountable loop.
; CHECK-NEXT: LV: Interleaving disabled by the pass manager
; CHECK-NEXT: LV: Not vectorizing: Cannot prove legality.

Expand Down
Loading