[PATCH] D12051: Allow PHI nodes in the exit block of regions

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 15 15:36:20 PDT 2015


Meinersbur added a comment.

It's basically like my solution: Ensure that TempScopInfo generates write accesses and that  BlockGenerators adds the PHIs to EscapeMap.


================
Comment at: lib/Analysis/TempScopInfo.cpp:114
@@ -112,1 +113,3 @@
+  // In this case we model the operands but not the PHI itself.
+  if (PHI->getParent() != R.getExit() && canSynthesize(PHI, LI, SE, &R))
     return;
----------------
What happens otherwise?

================
Comment at: lib/Analysis/TempScopInfo.cpp:470
@@ +469,3 @@
+    NumInRegion += R.contains(PredBB);
+  if (NumInRegion > 1)
+    buildAccessFunctions(R, *ExitBB);
----------------
if (!R.getExitingBlock())

================
Comment at: lib/CodeGen/BlockGenerators.cpp:495
@@ +494,3 @@
+        continue;
+    assert(OperandPHI == nullptr);
+    OperandPHI = cast<PHINode>(PHI->getIncomingValue(u));
----------------
assert(!OperandPHI)

================
Comment at: lib/CodeGen/BlockGenerators.cpp:499
@@ +498,3 @@
+
+  assert(OperandPHI != nullptr);
+  return OperandPHI;
----------------
assert(OperandPHI);

================
Comment at: lib/CodeGen/BlockGenerators.cpp:532
@@ +531,3 @@
+        BasePHI = ExitBlockPHI;
+      }
+
----------------
Is this necessary? Can't one just use the original PHI to represent the virtual memory location? It's not directly used anyway.

================
Comment at: lib/CodeGen/BlockGenerators.cpp:543
@@ +542,3 @@
+
+    // Multi-entry exit node PHIs do not escae (as they are not in the region in
+    // the first place) but their operands do. However, when we use the alloca
----------------
escape

================
Comment at: lib/CodeGen/BlockGenerators.cpp:1202
@@ -1151,1 +1201,3 @@
+    if (ExitBlockPHI)
+      handleOutsideUsers(R, ExitBlockPHI, nullptr, PHIOpMap);
   }
----------------
The last 30 lines are repetative. Refactor?


http://reviews.llvm.org/D12051





More information about the llvm-commits mailing list