Page MenuHomePhabricator

[Debuginfo] dbg.value points to undef value after Induction Variable Simplification.

Authored by avl on Thu, Sep 19, 10:29 AM.


Induction Variable Simplification pass does not update dbg.value intrinsic.


%add = add nuw nsw i32 %ArgIndex.06, 1
call void @llvm.dbg.value(metadata i32 %add, metadata !17, metadata !DIExpression())

After: = add nuw nsw i64 %indvars.iv, 1
call void @llvm.dbg.value(metadata i32 undef, metadata !17, metadata !DIExpression())

There should be: = add nuw nsw i64 %indvars.iv, 1
call void @llvm.dbg.value(metadata i64, metadata !17, metadata !DIExpression())

The fix is to reattach dbg.value to the clone instruction created in widenIVUse()

Diff Detail


Event Timeline

avl created this revision.Thu, Sep 19, 10:29 AM
vsk added inline comments.Thu, Sep 19, 11:05 AM
1514 ↗(On Diff #220883)

I think llvm::replaceAllDbgUsesWith already implements this functionality. Would that work here?

avl marked an inline comment as done.Fri, Sep 20, 11:06 PM
avl added inline comments.
1514 ↗(On Diff #220883)

Indeed. Thanks!

avl updated this revision to Diff 221153.Fri, Sep 20, 11:08 PM

addressed comments.

vsk accepted this revision.Mon, Sep 23, 8:56 AM

Thanks, lgtm!

This revision is now accepted and ready to land.Mon, Sep 23, 8:56 AM
This revision was automatically updated to reflect the committed changes.