summaryrefslogtreecommitdiffstats
path: root/polly/test/Isl/CodeGen/phi_condition_modeling_1.ll
diff options
context:
space:
mode:
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-05-22 23:43:58 +0000
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-05-22 23:43:58 +0000
commitecff11dcfb495f257b72bab2a53c83da9f9d4afe (patch)
treea320a03176b7bdbe746e1b658c6c8c84b4e94bca /polly/test/Isl/CodeGen/phi_condition_modeling_1.ll
parent755d58a463e0f11897470b21e9071661f590c867 (diff)
downloadbcm5719-llvm-ecff11dcfb495f257b72bab2a53c83da9f9d4afe.tar.gz
bcm5719-llvm-ecff11dcfb495f257b72bab2a53c83da9f9d4afe.zip
Add scalar and phi code generation
To reduce compile time and to allow more and better quality SCoPs in the long run we introduced scalar dependences and PHI-modeling. This patch will now allow us to generate code if one or both of those options are set. While the principle of demoting scalars as well as PHIs to memory in order to communicate their value stays the same, this allows to delay the demotion till the very end (the actual code generation). Consequently: - We __almost__ do not modify the code if we do not generate code for an optimized SCoP in the end. Thus, the early exit as well as the unprofitable option will now actually preven us from introducing regressions in case we will probably not get better code. - Polly can be used as a "pure" analyzer tool as long as the code generator is set to none. - The original SCoP is almost not touched when the optimized version is placed next to it. Runtime regressions if the runtime checks chooses the original are not to be expected and later optimizations do not need to revert the demotion for that part. - We will generate direct accesses to the demoted values, thus there are no "trivial GEPs" that select the first element of a scalar we demoted and treated as an array. Differential Revision: http://reviews.llvm.org/D7513 llvm-svn: 238070
Diffstat (limited to 'polly/test/Isl/CodeGen/phi_condition_modeling_1.ll')
-rw-r--r--polly/test/Isl/CodeGen/phi_condition_modeling_1.ll59
1 files changed, 59 insertions, 0 deletions
diff --git a/polly/test/Isl/CodeGen/phi_condition_modeling_1.ll b/polly/test/Isl/CodeGen/phi_condition_modeling_1.ll
new file mode 100644
index 00000000000..841b48e34d4
--- /dev/null
+++ b/polly/test/Isl/CodeGen/phi_condition_modeling_1.ll
@@ -0,0 +1,59 @@
+; RUN: opt %loadPolly -S -polly-no-early-exit -polly-detect-unprofitable -polly-model-phi-nodes -polly-codegen < %s | FileCheck %s
+;
+; void f(int *A, int c, int N) {
+; int tmp;
+; for (int i = 0; i < N; i++) {
+; if (i > c)
+; tmp = 3;
+; else
+; tmp = 5;
+; A[i] = tmp;
+; }
+; }
+;
+; CHECK-LABEL: bb:
+; CHECK: %tmp.0.phiops = alloca i32
+; CHECK-LABEL: polly.stmt.bb8:
+; CHECK: %tmp.0.phiops.reload = load i32, i32* %tmp.0.phiops
+; CHECK: store i32 %tmp.0.phiops.reload, i32*
+; CHECK-LABEL: polly.stmt.bb6:
+; CHECK: store i32 3, i32* %tmp.0.phiops
+; CHECK-LABEL: polly.stmt.bb7:
+; CHECK: store i32 5, i32* %tmp.0.phiops
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @f(i32* %A, i32 %c, i32 %N) {
+bb:
+ %tmp = sext i32 %N to i64
+ %tmp1 = sext i32 %c to i64
+ br label %bb2
+
+bb2: ; preds = %bb10, %bb
+ %indvars.iv = phi i64 [ %indvars.iv.next, %bb10 ], [ 0, %bb ]
+ %tmp3 = icmp slt i64 %indvars.iv, %tmp
+ br i1 %tmp3, label %bb4, label %bb11
+
+bb4: ; preds = %bb2
+ %tmp5 = icmp sgt i64 %indvars.iv, %tmp1
+ br i1 %tmp5, label %bb6, label %bb7
+
+bb6: ; preds = %bb4
+ br label %bb8
+
+bb7: ; preds = %bb4
+ br label %bb8
+
+bb8: ; preds = %bb7, %bb6
+ %tmp.0 = phi i32 [ 3, %bb6 ], [ 5, %bb7 ]
+ %tmp9 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
+ store i32 %tmp.0, i32* %tmp9, align 4
+ br label %bb10
+
+bb10: ; preds = %bb8
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+ br label %bb2
+
+bb11: ; preds = %bb2
+ ret void
+}
OpenPOWER on IntegriCloud