[polly] r248683 - BlockGenerator: Simplify code generated for region statements
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 04:35:00 PDT 2015
Author: grosser
Date: Sun Sep 27 06:35:00 2015
New Revision: 248683
URL: http://llvm.org/viewvc/llvm-project?rev=248683&view=rev
Log:
BlockGenerator: Simplify code generated for region statements
After having generated a new user statement a couple of inefficient or
trivially dead instructions may remain. This commit runs instruction
simplification over the newly generated blocks to ensure unneeded
instructions are removed right away.
This commit does adds simplification for non-affine subregions which was not
yet part of 248681.
Modified:
polly/trunk/lib/CodeGen/BlockGenerators.cpp
polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-2.ll
polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-3.ll
polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion.ll
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=248683&r1=248682&r2=248683&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Sun Sep 27 06:35:00 2015
@@ -1090,6 +1090,9 @@ void RegionGenerator::copyStmt(ScopStmt
LTS[L] = SE.getUnknown(LoopPHI);
}
+ for (auto *BB : SeenBlocks)
+ SimplifyInstructionsInBlock(BlockMap[BB], nullptr);
+
// Reset the old insert point for the build.
Builder.SetInsertPoint(ExitBBCopy->begin());
}
Modified: polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-2.ll?rev=248683&r1=248682&r2=248683&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-2.ll (original)
+++ polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-2.ll Sun Sep 27 06:35:00 2015
@@ -4,12 +4,9 @@ target datalayout = "e-m:e-i64:64-f80:12
; CHECK: polly.stmt.bb3: ; preds = %polly.stmt.bb3.entry
-; CHECK: %polly.subregion.iv = phi i32 [ 0, %polly.stmt.bb3.entry ]
-; CHECK: %polly.tmp = phi i64 [ %tmp.phiops.reload, %polly.stmt.bb3.entry ]
; CHECK: %tmp6_p_scalar_ = load double, double* %arg11, !alias.scope !0, !noalias !2
; CHECK: %p_tmp7 = fadd double 1.000000e+00, %tmp6_p_scalar_
; CHECK: %p_tmp8 = fcmp olt double 1.400000e+01, %p_tmp7
-; CHECK: %polly.subregion.iv.inc = add i32 %polly.subregion.iv, 1
; CHECK: br i1 %p_tmp8, label %polly.stmt.bb9, label %polly.stmt.bb10
; CHECK: polly.stmt.bb9: ; preds = %polly.stmt.bb3
Modified: polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-3.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-3.ll?rev=248683&r1=248682&r2=248683&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-3.ll (original)
+++ polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-3.ll Sun Sep 27 06:35:00 2015
@@ -13,13 +13,9 @@ loop:
br i1 %cond0, label %branch1, label %backedge
; CHECK-LABEL: polly.stmt.loop:
-; CHECK-NEXT: %polly.subregion.iv = phi i32 [ 0, %polly.stmt.loop.entry ]
-; CHECK-NEXT: %p_val0 = fadd float 1.000000e+00, 2.000000e+00
-; CHECK-NEXT: %p_val1 = fadd float 1.000000e+00, 2.000000e+00
-; CHECK-NEXT: %p_val2 = fadd float 1.000000e+00, 2.000000e+00
-; CHECK-NEXT: store float %p_val0, float* %merge.phiops
-; CHECK-NEXT: store float %p_val1, float* %val1.s2a
-; CHECK-NEXT: store float %p_val2, float* %val2.s2a
+; CHECK-NEXT: store float 3.000000e+00, float* %merge.phiops
+; CHECK-NEXT: store float 3.000000e+00, float* %val1.s2a
+; CHECK-NEXT: store float 3.000000e+00, float* %val2.s2a
; FIXME -> The last two writes are not really needed and can be dropped if the
; incoming block of the PHI and the value that is used share the same
@@ -29,13 +25,13 @@ branch1:
br i1 %cond1, label %branch2, label %backedge
; CHECK-LABEL: polly.stmt.branch1:
-; CHECK-NEXT: store float %p_val1, float* %merge.phiops
+; CHECK-NEXT: store float 3.000000e+00, float* %merge.phiops
branch2:
br label %backedge
; CHECK-LABEL: polly.stmt.branch2:
-; CHECK-NEXT: store float %p_val2, float* %merge.phiops
+; CHECK-NEXT: store float 3.000000e+00, float* %merge.phiops
backedge:
%merge = phi float [%val0, %loop], [%val1, %branch1], [%val2, %branch2]
Modified: polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion.ll?rev=248683&r1=248682&r2=248683&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion.ll (original)
+++ polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion.ll Sun Sep 27 06:35:00 2015
@@ -8,8 +8,6 @@ target datalayout = "e-m:e-i64:64-f80:12
; CHECK: br label %polly.stmt.bb3
; CHECK: polly.stmt.bb3: ; preds = %polly.stmt.bb3.entry
-; CHECK: %polly.subregion.iv = phi i32 [ 0, %polly.stmt.bb3.entry ]
-; CHECK: %polly.subregion.iv.inc = add i32 %polly.subregion.iv, 1
; CHECK: br i1 true, label %polly.stmt.bb4, label %polly.stmt.bb5
; CHECK: polly.stmt.bb4: ; preds = %polly.stmt.bb3
More information about the llvm-commits
mailing list