[polly] r278124 - [BlockGenerator] Insert initializations at beginning of start block

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 08:34:59 PDT 2016


Author: grosser
Date: Tue Aug  9 10:34:59 2016
New Revision: 278124

URL: http://llvm.org/viewvc/llvm-project?rev=278124&view=rev
Log:
[BlockGenerator] Insert initializations at beginning of start block

In case some code -- not guarded by control flow -- would be emitted directly in
the start block, it may happen that this code would use uninitalized scalar
values if the scalar initialization is only emitted at the end of the start
block. This is not a problem today in normal Polly, as all statements are
emitted in their own basic blocks, but Polly-ACC emits host-to-device copy
statements into the start block.

Additional Polly-ACC test coverage will be added in subsequent changes that
improve the handling of PHI nodes in Polly-ACC.

Modified:
    polly/trunk/lib/CodeGen/BlockGenerators.cpp
    polly/trunk/test/Isl/CodeGen/phi_loop_carried_float.ll
    polly/trunk/test/Isl/CodeGen/phi_loop_carried_float_escape.ll
    polly/trunk/test/Isl/CodeGen/phi_scalar_simple_2.ll

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=278124&r1=278123&r2=278124&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Tue Aug  9 10:34:59 2016
@@ -484,7 +484,7 @@ void BlockGenerator::createScalarInitial
   if (StartBB == S.getEntry())
     StartBB = SplitBBTerm->getSuccessor(1);
 
-  Builder.SetInsertPoint(StartBB->getTerminator());
+  Builder.SetInsertPoint(&*StartBB->begin());
 
   for (auto &Array : S.arrays()) {
     if (Array->getNumberOfDimensions() != 0)

Modified: polly/trunk/test/Isl/CodeGen/phi_loop_carried_float.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/phi_loop_carried_float.ll?rev=278124&r1=278123&r2=278124&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/phi_loop_carried_float.ll (original)
+++ polly/trunk/test/Isl/CodeGen/phi_loop_carried_float.ll Tue Aug  9 10:34:59 2016
@@ -17,8 +17,8 @@
 ; CHECK-NEXT:    ret
 
 ; CHECK-LABEL: polly.start:
-; CHECK-NEXT:    sext
 ; CHECK-NEXT:    store float 0.000000e+00, float* %tmp.0.phiops
+; CHECK-NEXT:    sext
 
 ; CHECK-LABEL: polly.exiting:
 ; CHECK-NEXT:    br label %polly.merge_new_and_old

Modified: polly/trunk/test/Isl/CodeGen/phi_loop_carried_float_escape.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/phi_loop_carried_float_escape.ll?rev=278124&r1=278123&r2=278124&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/phi_loop_carried_float_escape.ll (original)
+++ polly/trunk/test/Isl/CodeGen/phi_loop_carried_float_escape.ll Tue Aug  9 10:34:59 2016
@@ -16,8 +16,8 @@
 ; CHECK-NEXT:    br label %exit
 
 ; CHECK-LABEL: polly.start:
-; CHECK-NEXT:    sext
 ; CHECK-NEXT:    store float 0.000000e+00, float* %tmp.0.phiops
+; CHECK-NEXT:    sext
 
 ; CHECK-LABEL: polly.exiting:
 ; CHECK-NEXT:    %tmp.0.final_reload = load float, float* %tmp.0.s2a

Modified: polly/trunk/test/Isl/CodeGen/phi_scalar_simple_2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/phi_scalar_simple_2.ll?rev=278124&r1=278123&r2=278124&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/phi_scalar_simple_2.ll (original)
+++ polly/trunk/test/Isl/CodeGen/phi_scalar_simple_2.ll Tue Aug  9 10:34:59 2016
@@ -28,8 +28,8 @@ entry:
 ; CHECK:         ret i32 %x.addr.0.merge
 
 ; CHECK-LABEL: polly.start:
-; CHECK-NEXT:    sext
 ; CHECK-NEXT:    store i32 %x, i32* %x.addr.0.phiops
+; CHECK-NEXT:    sext
 
 ; CHECK-LABEL: polly.merge21:
 ; CHECK:         %x.addr.0.final_reload = load i32, i32* %x.addr.0.s2a




More information about the llvm-commits mailing list