Skip to content

Commit dafaf13

Browse files
committed
[LV] Enable auto-vectorisation of loops with uncountable exits
Until now the feature to enable vectorisation of some early exit loops with uncountable exits was controlled under a flag, off by default. Now that we have efficient code generation for vectorising such loops (see PR #130766) and we are still far enough away from the next LLVM release it seems like a good time to enable the feature by default. If any issues arise post-commit it can be easily reverted. Using this patch I built and ran the LLVM test suite successfully, which on neoverse-v1 led to the vectorisation of 114 additional early exit loops. I then performed a bootstrap build of clang, which built cleanly with 64 extra early exit loops vectorising. I also built and ran SPEC2017 successfully with no change in performance for both neoverse-v1 and neoverse-v2.
1 parent cf9546b commit dafaf13

15 files changed

+17
-17
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static cl::opt<bool> UseWiderVFIfCallVariantsPresent(
395395
cl::desc("Try wider VFs if they enable the use of vector variants"));
396396

397397
static cl::opt<bool> EnableEarlyExitVectorization(
398-
"enable-early-exit-vectorization", cl::init(false), cl::Hidden,
398+
"enable-early-exit-vectorization", cl::init(true), cl::Hidden,
399399
cl::desc(
400400
"Enable vectorization of early exit loops with uncountable exits."));
401401

llvm/test/Transforms/LoopVectorize/AArch64/early_exit_costs.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; REQUIRES: asserts
2-
; RUN: opt -S < %s -p loop-vectorize -enable-early-exit-vectorization -disable-output \
2+
; RUN: opt -S < %s -p loop-vectorize -disable-output \
33
; RUN: -debug-only=loop-vectorize 2>&1 | FileCheck %s --check-prefixes=CHECK
44

55
target triple = "aarch64-unknown-linux-gnu"

llvm/test/Transforms/LoopVectorize/AArch64/simple_early_exit.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2-
; RUN: opt -S < %s -p loop-vectorize -enable-early-exit-vectorization | FileCheck %s --check-prefixes=CHECK
2+
; RUN: opt -S < %s -p loop-vectorize | FileCheck %s --check-prefixes=CHECK
33

44
target triple = "aarch64-unknown-linux-gnu"
55

llvm/test/Transforms/LoopVectorize/AArch64/single-early-exit-interleave.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals none --version 4
2-
; RUN: opt -p loop-vectorize -enable-early-exit-vectorization -force-vector-interleave=4 -S %s | FileCheck %s
2+
; RUN: opt -p loop-vectorize -force-vector-interleave=4 -S %s | FileCheck %s
33

44
target triple = "aarch64-unknown-linux-gnu"
55

llvm/test/Transforms/LoopVectorize/early_exit_legality.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
22
; REQUIRES: asserts
3-
; RUN: opt -S < %s -p loop-vectorize -debug-only=loop-vectorize -enable-early-exit-vectorization -force-vector-width=4 -disable-output 2>&1 | FileCheck %s
3+
; RUN: opt -S < %s -p loop-vectorize -debug-only=loop-vectorize -force-vector-width=4 -disable-output 2>&1 | FileCheck %s
44

55
declare void @init_mem(ptr, i64);
66

llvm/test/Transforms/LoopVectorize/early_exit_store_legality.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; REQUIRES: asserts
2-
; RUN: opt -S < %s -p loop-vectorize -debug-only=loop-vectorize -enable-early-exit-vectorization -force-vector-width=4 -disable-output 2>&1 | FileCheck %s
2+
; RUN: opt -S < %s -p loop-vectorize -debug-only=loop-vectorize -force-vector-width=4 -disable-output 2>&1 | FileCheck %s
33

44
define i64 @loop_contains_store(ptr %dest) {
55
; CHECK-LABEL: LV: Checking a loop in 'loop_contains_store'

llvm/test/Transforms/LoopVectorize/multi_early_exit.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2-
; RUN: opt -S < %s -p loop-vectorize -enable-early-exit-vectorization | FileCheck %s
2+
; RUN: opt -S < %s -p loop-vectorize | FileCheck %s
33

44
declare void @init_mem(ptr, i64);
55

llvm/test/Transforms/LoopVectorize/multi_early_exit_live_outs.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2-
; RUN: opt -S < %s -p loop-vectorize -enable-early-exit-vectorization | FileCheck %s
2+
; RUN: opt -S < %s -p loop-vectorize | FileCheck %s
33

44
declare void @init_mem(ptr, i64);
55

llvm/test/Transforms/LoopVectorize/single-early-exit-interleave.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals none --version 4
2-
; RUN: opt -p loop-vectorize -enable-early-exit-vectorization -force-vector-width=4 -force-vector-interleave=4 -S %s | FileCheck --check-prefix=VF4IC4 %s
2+
; RUN: opt -p loop-vectorize -force-vector-width=4 -force-vector-interleave=4 -S %s | FileCheck --check-prefix=VF4IC4 %s
33

44
declare void @init_mem(ptr, i64);
55

llvm/test/Transforms/LoopVectorize/single_early_exit.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2-
; RUN: opt -S < %s -p loop-vectorize -enable-early-exit-vectorization -force-vector-width=4 | FileCheck %s
2+
; RUN: opt -S < %s -p loop-vectorize -force-vector-width=4 | FileCheck %s
33

44
declare void @init_mem(ptr, i64);
55

0 commit comments

Comments
 (0)