summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/PhaseOrdering
diff options
context:
space:
mode:
authorKristof Beyls <kristof.beyls@arm.com>2016-05-03 08:33:26 +0000
committerKristof Beyls <kristof.beyls@arm.com>2016-05-03 08:33:26 +0000
commitc08f70588dfb9041ab8153bdef9c907b132757a3 (patch)
treebae1996a91d0a5f49cf3a48c41164c4c9dc4402c /llvm/test/Transforms/PhaseOrdering
parentb5cac80c77197be363ec8ffb465cca9a0a38ba61 (diff)
downloadbcm5719-llvm-c08f70588dfb9041ab8153bdef9c907b132757a3.tar.gz
bcm5719-llvm-c08f70588dfb9041ab8153bdef9c907b132757a3.zip
Mark that SpeculativeExecution preserves Globals Alias Analysis.
A few benchmarks with lots of accesses to global variables in the hot loops regressed a lot since r266399, which added the SpeculativeExecution pass to the default pipeline. The problem is that this pass doesn't mark Globals Alias Analysis as preserved. Globals Alias Analysis is computed in a module pass, whereas SpeculativeExecution is a function pass, and a lot of passes dependent on the Globals Alias Analysis to optimize these benchmarks are also function passes. As such, the Globals Alias Analysis information cannot be recomputed between SpeculativeExecution and the following function passes needing that information. SpeculativeExecution doesn't invalidate Globals Alias Analysis, so mark it as such to fix those performance regressions. Differential Revision: http://reviews.llvm.org/D19806 llvm-svn: 268370
Diffstat (limited to 'llvm/test/Transforms/PhaseOrdering')
-rw-r--r--llvm/test/Transforms/PhaseOrdering/globalaa-retained.ll26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/test/Transforms/PhaseOrdering/globalaa-retained.ll b/llvm/test/Transforms/PhaseOrdering/globalaa-retained.ll
new file mode 100644
index 00000000000..bce193b5e85
--- /dev/null
+++ b/llvm/test/Transforms/PhaseOrdering/globalaa-retained.ll
@@ -0,0 +1,26 @@
+; RUN: opt -O3 -S < %s | FileCheck %s
+target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64"
+
+@v = internal unnamed_addr global i32 0, align 4
+@p = common global i32* null, align 8
+
+; Function Attrs: norecurse nounwind
+define void @f(i32 %n) {
+entry:
+ %0 = load i32, i32* @v, align 4
+ %inc = add nsw i32 %0, 1
+ store i32 %inc, i32* @v, align 4
+ %1 = load i32*, i32** @p, align 8
+ store i32 %n, i32* %1, align 4
+ %2 = load i32, i32* @v, align 4
+ %inc1 = add nsw i32 %2, 1
+ store i32 %inc1, i32* @v, align 4
+ ret void
+}
+
+; check variable v is loaded only once after optimization, which should be
+; prove that globalsAA survives until the optimization that can use it to
+; optimize away the duplicate load/stores on variable v.
+; CHECK: load i32, i32* @v, align 4
+; CHECK-NOT: load i32, i32* @v, align 4
OpenPOWER on IntegriCloud