[PATCH] D40042: Make salvageDebugInfo of casts work for dbg.declare and dbg.addr

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 13:44:24 PST 2017


rnk added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:1296
 
+static void findDbgUsers(SmallVectorImpl<DbgInfoIntrinsic *> &DbgUsers,
+                         Value *V) {
----------------
aprantl wrote:
> Is there a point in keeping findDbgValues or should we just rename it?
> It seems like every case where currently use it  would also apply to dbg.addr.
I felt there were too many callers for this patch. There are some users like loop passes that probably only want dbg.values for updating induction variable expressions that wouldn't apply to local variable addresses. Similarly, the GEP case in salvageDebugInfo applies DW_OP_stack_value which didn't feel right to add to the expression of a dbg.declare.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:1387
 
   if (isa<BitCastInst>(&I) || isa<IntToPtrInst>(&I)) {
+    // Bitcasts are entirely irrelevant for debug info. Rewrite dbg.value,
----------------
aprantl wrote:
> By the way, can you find a way to turn this into a switch? I don't like this massive if-cascade, but it wasn't immediately obvious to me how to convert it.
I'll take a look in a follow-up.


https://reviews.llvm.org/D40042





More information about the llvm-commits mailing list