[llvm] 3c7e7d4 - [BasicAA] Enable -basic-aa-recphi by default
David Green via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 4 02:43:56 PDT 2020
Author: David Green
Date: 2020-08-04T10:43:42+01:00
New Revision: 3c7e7d40a996f998dfe3c36abb70accdf4f20d79
URL: https://github.com/llvm/llvm-project/commit/3c7e7d40a996f998dfe3c36abb70accdf4f20d79
DIFF: https://github.com/llvm/llvm-project/commit/3c7e7d40a996f998dfe3c36abb70accdf4f20d79.diff
LOG: [BasicAA] Enable -basic-aa-recphi by default
This option was added a while back, to help improve AA around pointer
phi loops. It looks for phi(gep(phi, const), x) loops, checking if x can
then prove more precise aliasing info.
Differential Revision: https://reviews.llvm.org/D82998
Added:
Modified:
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Analysis/BasicAA/phi-loop.ll
llvm/test/Analysis/BasicAA/recphi.ll
llvm/test/Transforms/LoopIdiom/reuse-cast.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index b1578f4b88e0..2ede4baaf683 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -66,7 +66,7 @@ using namespace llvm;
/// Enable analysis of recursive PHI nodes.
static cl::opt<bool> EnableRecPhiAnalysis("basic-aa-recphi", cl::Hidden,
- cl::init(false));
+ cl::init(true));
/// By default, even on 32-bit architectures we use 64-bit integers for
/// calculations. This will allow us to more-aggressively decompose indexing
diff --git a/llvm/test/Analysis/BasicAA/phi-loop.ll b/llvm/test/Analysis/BasicAA/phi-loop.ll
index db3023c6560d..e54752a9223f 100644
--- a/llvm/test/Analysis/BasicAA/phi-loop.ll
+++ b/llvm/test/Analysis/BasicAA/phi-loop.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -basic-aa -basic-aa-recphi=1 -gvn -S | FileCheck %s
+; RUN: opt < %s -basic-aa -gvn -S | FileCheck %s
;
; Check that section->word_ofs doesn't get reloaded in every iteration of the
; for loop.
diff --git a/llvm/test/Analysis/BasicAA/recphi.ll b/llvm/test/Analysis/BasicAA/recphi.ll
index dfc88937bf69..a6157f22a4f9 100644
--- a/llvm/test/Analysis/BasicAA/recphi.ll
+++ b/llvm/test/Analysis/BasicAA/recphi.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -basic-aa -aa-eval -print-all-alias-modref-info -basic-aa-recphi -disable-output 2>&1 | FileCheck %s
+; RUN: opt < %s -basic-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
; CHECK-LABEL: Function: simple: 5 pointers, 0 call sites
; CHECK: NoAlias: float* %src1, float* %src2
diff --git a/llvm/test/Transforms/LoopIdiom/reuse-cast.ll b/llvm/test/Transforms/LoopIdiom/reuse-cast.ll
index 0b1bfeaa2730..0dda35151564 100644
--- a/llvm/test/Transforms/LoopIdiom/reuse-cast.ll
+++ b/llvm/test/Transforms/LoopIdiom/reuse-cast.ll
@@ -83,21 +83,22 @@ declare void @use.i1(i1)
define void @reuse_cast_2(i32 %x, i32* %ptr.1.start) {
; CHECK-LABEL: @reuse_cast_2(
; CHECK-NEXT: entry:
+; CHECK-NEXT: [[PTR_1_START1:%.*]] = bitcast i32* [[PTR_1_START:%.*]] to i8*
; CHECK-NEXT: [[STACK:%.*]] = alloca [2 x i32], align 4
; CHECK-NEXT: [[CAST_TO_REUSE:%.*]] = bitcast [2 x i32]* [[STACK]] to i8*
; CHECK-NEXT: [[C_0:%.*]] = icmp sgt i32 [[X:%.*]], 0
; CHECK-NEXT: [[TMP0:%.*]] = bitcast [2 x i32]* [[STACK]] to i8*
; CHECK-NEXT: [[PTR_2_START:%.*]] = getelementptr inbounds [2 x i32], [2 x i32]* [[STACK]], i64 0, i64 0
; CHECK-NEXT: call void @use.i8(i8* [[CAST_TO_REUSE]])
+; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[CAST_TO_REUSE]], i8* align 4 [[PTR_1_START1]], i64 8, i1 false)
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ]
-; CHECK-NEXT: [[PTR_1:%.*]] = phi i32* [ [[PTR_1_START:%.*]], [[ENTRY]] ], [ [[PTR_1_NEXT:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[PTR_1:%.*]] = phi i32* [ [[PTR_1_START]], [[ENTRY]] ], [ [[PTR_1_NEXT:%.*]], [[LOOP]] ]
; CHECK-NEXT: [[PTR_2:%.*]] = phi i32* [ [[PTR_2_START]], [[ENTRY]] ], [ [[PTR_2_NEXT:%.*]], [[LOOP]] ]
; CHECK-NEXT: [[PTR_1_NEXT]] = getelementptr inbounds i32, i32* [[PTR_1]], i64 1
; CHECK-NEXT: [[LV:%.*]] = load i32, i32* [[PTR_1]], align 4
; CHECK-NEXT: [[PTR_2_NEXT]] = getelementptr inbounds i32, i32* [[PTR_2]], i64 1
-; CHECK-NEXT: store i32 [[LV]], i32* [[PTR_2]], align 4
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1
; CHECK-NEXT: [[C_1:%.*]] = icmp eq i32 [[IV]], 0
; CHECK-NEXT: br i1 [[C_1]], label [[LOOP]], label [[EXIT:%.*]]
More information about the llvm-commits
mailing list