[PATCH] D20547: [safestack] Sink unsafe address computation to each use.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 13 16:46:55 PDT 2016


pcc added inline comments.

================
Comment at: lib/CodeGen/SafeStack.cpp:613
@@ +612,3 @@
+    // Replace uses of the alloca with the new location.
+    // Insert address calculation close to each use.
+    std::string Name = std::string(AI->getName()) + ".unsafe";
----------------
Explain why in the comment.

================
Comment at: lib/CodeGen/SafeStack.cpp:631
@@ +630,3 @@
+      if (auto *PHI = dyn_cast<PHINode>(User)) {
+        // PHI nodes may have multiple incoming edges from the same BB (why??),
+        // all must be updated at once with the same incoming value.
----------------
I believe this can happen when a function has multiple identical control flow edges, e.g.
```
define void @main() {
entry:
  br i1 undef, label %x, label %x

x:
  %p = phi i32 [ 0, %entry ], [ 0, %entry ]
  ret void
}
```
Can you please add tests that cover phi nodes, including this case?


Repository:
  rL LLVM

http://reviews.llvm.org/D20547





More information about the llvm-commits mailing list