[llvm] 54b6457 - [TargetPassConfig] Add CanonicalizeFreezeInLoops before LSR
Juneyoung Lee via llvm-commits
llvm-commits at lists.llvm.org
Wed May 27 13:21:20 PDT 2020
Author: Juneyoung Lee
Date: 2020-05-28T05:21:12+09:00
New Revision: 54b64572407c8305c7bb8cc20c46a5e0c66b2979
URL: https://github.com/llvm/llvm-project/commit/54b64572407c8305c7bb8cc20c46a5e0c66b2979
DIFF: https://github.com/llvm/llvm-project/commit/54b64572407c8305c7bb8cc20c46a5e0c66b2979.diff
LOG: [TargetPassConfig] Add CanonicalizeFreezeInLoops before LSR
Summary:
This patch adds CanonicalizeFreezeInLoops before LSR.
Relevant patch: https://reviews.llvm.org/D77523
Reviewers: spatel, efriedma, jdoerfert, fhahn, nikic, reames, xbolva00
Reviewed By: nikic
Subscribers: xbolva00, nikic, lebedev.ri, hiraditya, llvm-commits, sanwou01, nlopes
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77524
Added:
Modified:
llvm/lib/CodeGen/TargetPassConfig.cpp
llvm/test/CodeGen/AArch64/O3-pipeline.ll
llvm/test/CodeGen/ARM/O3-pipeline.ll
llvm/test/CodeGen/X86/O3-pipeline.ll
llvm/test/Transforms/CanonicalizeFreezeInLoops/aarch64.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index d8da6431bff1..241357be5394 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -669,6 +669,7 @@ void TargetPassConfig::addIRPasses() {
// Run loop strength reduction before anything else.
if (!DisableLSR) {
+ addPass(createCanonicalizeFreezeInLoopsPass());
addPass(createLoopStrengthReducePass());
if (PrintLSR)
addPass(createPrintFunctionPass(dbgs(),
diff --git a/llvm/test/CodeGen/AArch64/O3-pipeline.ll b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
index eeee6d0f6049..401a0ac8df66 100644
--- a/llvm/test/CodeGen/AArch64/O3-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
@@ -35,6 +35,7 @@
; CHECK-NEXT: Basic Alias Analysis (stateless AA impl)
; CHECK-NEXT: Canonicalize natural loops
; CHECK-NEXT: Loop Pass Manager
+; CHECK-NEXT: Canonicalize Freeze Instructions in Loops
; CHECK-NEXT: Induction Variable Users
; CHECK-NEXT: Loop Strength Reduction
; CHECK-NEXT: Basic Alias Analysis (stateless AA impl)
diff --git a/llvm/test/CodeGen/ARM/O3-pipeline.ll b/llvm/test/CodeGen/ARM/O3-pipeline.ll
index c31c6694cb24..f137f715ee42 100644
--- a/llvm/test/CodeGen/ARM/O3-pipeline.ll
+++ b/llvm/test/CodeGen/ARM/O3-pipeline.ll
@@ -15,6 +15,7 @@
; CHECK-NEXT: Canonicalize natural loops
; CHECK-NEXT: Scalar Evolution Analysis
; CHECK-NEXT: Loop Pass Manager
+; CHECK-NEXT: Canonicalize Freeze Instructions in Loops
; CHECK-NEXT: Induction Variable Users
; CHECK-NEXT: Loop Strength Reduction
; CHECK-NEXT: Basic Alias Analysis (stateless AA impl)
diff --git a/llvm/test/CodeGen/X86/O3-pipeline.ll b/llvm/test/CodeGen/X86/O3-pipeline.ll
index 9087c69fac96..c91b8143e09c 100644
--- a/llvm/test/CodeGen/X86/O3-pipeline.ll
+++ b/llvm/test/CodeGen/X86/O3-pipeline.ll
@@ -27,6 +27,7 @@
; CHECK-NEXT: Canonicalize natural loops
; CHECK-NEXT: Scalar Evolution Analysis
; CHECK-NEXT: Loop Pass Manager
+; CHECK-NEXT: Canonicalize Freeze Instructions in Loops
; CHECK-NEXT: Induction Variable Users
; CHECK-NEXT: Loop Strength Reduction
; CHECK-NEXT: Basic Alias Analysis (stateless AA impl)
diff --git a/llvm/test/Transforms/CanonicalizeFreezeInLoops/aarch64.ll b/llvm/test/Transforms/CanonicalizeFreezeInLoops/aarch64.ll
index c41d044c26bf..3b2f98335652 100644
--- a/llvm/test/Transforms/CanonicalizeFreezeInLoops/aarch64.ll
+++ b/llvm/test/Transforms/CanonicalizeFreezeInLoops/aarch64.ll
@@ -7,13 +7,12 @@
define void @f(i8* %p, i32 %n, i32 %m) {
; CHECK-LABEL: f:
; CHECK: // %bb.0: // %entry
-; CHECK-NEXT: mov w8, #1
+; CHECK-NEXT: add w8, w2, #1 // =1
; CHECK-NEXT: .LBB0_1: // %loop
; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
-; CHECK-NEXT: add w9, w2, w8
-; CHECK-NEXT: cmp w8, w1
+; CHECK-NEXT: strb wzr, [x0, w8, sxtw]
+; CHECK-NEXT: subs w1, w1, #1 // =1
; CHECK-NEXT: add w8, w8, #1 // =1
-; CHECK-NEXT: strb wzr, [x0, w9, sxtw]
; CHECK-NEXT: b.ne .LBB0_1
; CHECK-NEXT: // %bb.2: // %exit
; CHECK-NEXT: ret
More information about the llvm-commits
mailing list