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

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 13:21:07 PDT 2016


pcc added inline comments.

================
Comment at: lib/CodeGen/SafeStack.cpp:614
@@ +613,3 @@
+    std::string Name = std::string(AI->getName()) + ".unsafe";
+    AI->setName("");
+    Value *Replacement = nullptr;
----------------
Why bother setting the name if we're about to remove the instruction?

================
Comment at: lib/CodeGen/SafeStack.cpp:637
@@ +636,3 @@
+    // isUsedByMetadata().
+    if ((AI->hasValueHandle() || AI->isUsedByMetadata()) && Replacement) {
+      AI->replaceAllUsesWith(Replacement);
----------------
This seems a little weird to me. I wouldn't expect anything to be holding a value handle here (and if it did, it probably wouldn't want the replacement for whichever instruction happened to be at the end of the use list) and the only important metadata is debug info, which is handled by `replaceDbgDeclareForAlloca`, I believe. Can we just remove this part?


Repository:
  rL LLVM

http://reviews.llvm.org/D20547





More information about the llvm-commits mailing list