This is an archive of the discontinued LLVM Phabricator instance.

Clang-trunk Generates Wrong Debug values with -O1
ClosedPublic

Authored by kamleshbhalui on Nov 8 2019, 9:42 PM.

Details

Summary

Bit-Tracking Dead Code Elimination (bdce) do not mark dbg.value as undef after deleting instruction.
which shows invalid state of variable in debugger.
This patches fixes this by marking the dbg.value as undef which depends on dead instruction.

This fixes
https://bugs.llvm.org/show_bug.cgi?id=41925

Diff Detail

Repository
rL LLVM

Event Timeline

kamleshbhalui created this revision.Nov 8 2019, 9:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2019, 9:42 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
jmorse added a subscriber: jmorse.Nov 11 2019, 3:35 AM

Looks good, with a couple of nits inline. Thanks for tracking this down!

llvm/test/Transforms/BDCE/pr41925.ll
3

As the reproducer in PR41925 is small, could you include the source code here? (I'm assuming the IR comes from that). It'll make it easier for someone reading this test to understand what it's doing.

73–75

It's best to drop un-necessary attributes, as they can become a maintenance burden.

kamleshbhalui added a reviewer: jmorse.

Addressed @jmorse's comments.

jmorse accepted this revision.Nov 11 2019, 6:21 AM

LGTM, best to leave this 24h in case other debug-info people spot something.

This revision is now accepted and ready to land.Nov 11 2019, 6:21 AM
vsk accepted this revision.Nov 11 2019, 9:54 AM

+ 1

@vsk Can you please commit this for me?

This revision was automatically updated to reflect the committed changes.