[PATCH] D42541: [DeadArgumentElimination] Preserve llvm.dbg.values's first argument

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 04:04:57 PST 2018


JDevlieghere added inline comments.


================
Comment at: include/llvm/IR/Value.h:257
   void destroyValueName();
-  void doRAUW(Value *New, bool NoMetadata);
+  void doRAUW(Value *New, bool NoMetadata, bool PreserveDbg);
   void setNameImpl(const Twine &Name);
----------------
Maybe have this default to `false` so we don't have to change unaffected calls?


================
Comment at: lib/IR/Metadata.cpp:442
 
+void ValueAsMetadata::handleRAUW(Value *From, Value *To){
+	doHandleRAUW(From, To, false /* preserveDbg */);
----------------
Previous comment would probably render these unnecessary?


================
Comment at: lib/IR/Value.cpp:420
+    if (PreserveDbg)
+	  ValueAsMetadata::handleRAUWPreserveDbg(this, New);
+	else
----------------
mattd wrote:
> Just a suggestion, can we keep the name as handleRAWU, and call this  directly with the bool PreserveDbg here? I think that would allow us to get rid of the  handlers on line 442 in Metadata.cpp.
> 
Aha, exactly what I was thinking too! :-) 

+1 


https://reviews.llvm.org/D42541





More information about the llvm-commits mailing list