[PATCH] D29578: Propagate debug info for Phi node in SSAUpdater

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 09:45:26 PST 2017


dberlin added a comment.

Staring at this, so far i don't believe this is the correct way to fix this.

If you look at your before test case, there is a debug value for the phi.
for.cond:                                         ; preds = %for.body, %entry

  %i.0 = phi i32 [ 1, %entry ], [ %inc, %for.body ]
  tail call void @llvm.dbg.value(metadata i32 %i.0, i64 0, metadata !13, metadata !11), !dbg !15

After, the dbg.value is destroyed as the phi is recreated in for.body:
for.body:
 %i.01 = phi i32 [ 1, %entry ], [ %inc, %for.body ]

I agree that seems bad.

However, you are adding debug info based on operands of the phi, etc.
I don't see why the answer isn't "stash away debug value in loop rotate", "reattach to new phi name"?

Doing this in ssa updater seems .. strange, and the way you are doing it seems even stranger.
At worst, if you ere doing it in ssa updater, it should be something like "if the old phi result  (*not* operand) had a use in debug info, the new one should".
But even then, this is something i would expect callers to deal with as they rewrite uses.


https://reviews.llvm.org/D29578





More information about the llvm-commits mailing list