Page MenuHomePhabricator

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

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

Details

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

Before:

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

After:

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

There should be:

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

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

Diff Detail

Repository
rL LLVM

Event Timeline

avl created this revision.Thu, Sep 19, 10:29 AM
vsk added inline comments.Thu, Sep 19, 11:05 AM
llvm/lib/Transforms/Utils/Local.cpp
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.
llvm/lib/Transforms/Utils/Local.cpp
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.