[PATCH] D20986: [safestack] Fixup llvm.dbg.value when rewriting unsafe allocas.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 15:06:43 PDT 2016


eugenis added a comment.

In http://reviews.llvm.org/D20986#457042, @pcc wrote:

> Can you also add a test case for dynamic alloca?


Done. I've noticed that this call with Offset=0 does not do anything so I removed it.
I also could not make clang emit a dbg.value for a dynamic alloca because dbg.declare-to-dbg.value optimization is done only for scalar allocas, so I hacked the IR a bit for the test.


================
Comment at: lib/Transforms/Utils/Local.cpp:1276
@@ +1275,3 @@
+    if (auto *MDV = MetadataAsValue::getIfExists(AI->getContext(), L))
+      while (!MDV->use_empty()) {
+        Use &U = *MDV->use_begin();
----------------
pcc wrote:
> This won't terminate if there are any non-`llvm.dbg.value` uses of the value (or if `replaceOneDbgValueForAlloca` gives up).
fixed


Repository:
  rL LLVM

http://reviews.llvm.org/D20986





More information about the llvm-commits mailing list