[PATCH] D15722: [WIP][Polly] SSA Codegen

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 24 16:55:25 PST 2016


jdoerfert added a comment.

The idea behind this code generation is that we have only 3 distinct points were we need to insert PHI nodes in order to merge (possibly) different definitions of a scalar value.

1. After a conditional.
2. After a loop when it was guarded by a conditional.
3. In the loop header.

To be able to place these PHI nodes we keep scalar mappings that might be needed after a statement. Hence, we copy the mappings from the BBMap to the current ScalarMap. These ScalarMaps are stacked according to the nesting of the AST. Whenever we hit a merge point we will check if the two incoming ScalarMaps (e.g., from the different conditional branches, or the mappings prior and after the loop) to see if a scalar was mapped and if so mapped to different values. In such a case we place a PHI. Howerver, in loops we need the PHI even before we finish building the loop. To this end, scalars that are used but not defined in a loop, or originally loop carried scalars are mapped to a new loop carried scalar in the optimized code. To make the scalars usable in a statement we use the current ScalarMap to initialize the BBMap and reuse the existing lookup logic to find a suitable mapping for a needed scalar.


================
Comment at: lib/CodeGen/BlockGenerators.cpp:151
@@ -134,1 +150,3 @@
+  Builder.GetInsertBlock()->dump();
+  Old->dump();
   // The scalar dependence is neither available nor SCEVCodegenable.
----------------
Debug left-over


http://reviews.llvm.org/D15722





More information about the llvm-commits mailing list