[PATCH] D48676: [Local] replaceAllDbgUsesWith: Update debug values before RAUW

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 5 10:37:32 PDT 2018


vsk added inline comments.


================
Comment at: include/llvm/IR/DebugInfoMetadata.h:2332
+    void appendToVector(SmallVectorImpl<uint64_t> &V) const {
+      V.append(getSize(), *get());
+    }
----------------
aprantl wrote:
> This looks very dangerous. DIExpressions are not distinct so they may be shared by many users. Shouldn't we create a new DIExpression instead of modifying the old one?
Why does this modify an existing expression? I think I'm only using it to create a new expression (in DIExpression::appendToStack, `appendToVector(NewOps)`).


================
Comment at: lib/Transforms/Utils/Local.cpp:1844
+    // access the low `FromBits` bits when inspecting the source variable.
+    if (FromBits < ToBits)
+      return rewriteDebugUsers(From, To, DomPoint, DT, Identity);
----------------
gramanas wrote:
> Could FromBits be equal to ToBits? In that case neither zext nor sext is needed. Could this be `if (FromBits <= ToBits)`?
No, that case should be handled earlier, in isBitCastSemanticsPreserving().


https://reviews.llvm.org/D48676





More information about the llvm-commits mailing list