This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by avl on Sep 19 2019, 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.Sep 19 2019, 10:29 AM
vsk added inline comments.Sep 19 2019, 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.Sep 20 2019, 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.Sep 20 2019, 11:08 PM

addressed comments.

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

Thanks, lgtm!

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