This is an archive of the discontinued LLVM Phabricator instance.

Fix DebugLoc propagation for unreachable LoadInst
ClosedPublic

Authored by weimingz on Jun 26 2017, 12:41 PM.

Details

Summary

Currently, when GVN creates a load and when InstCombine creates a new store for unreachable Load, the DebugLoc info gets lost.

Diff Detail

Repository
rL LLVM

Event Timeline

weimingz created this revision.Jun 26 2017, 12:41 PM
weimingz added a subscriber: llvm-commits.
davide requested changes to this revision.Jun 26 2017, 12:44 PM
davide added a subscriber: davide.

testcase?

This revision now requires changes to proceed.Jun 26 2017, 12:44 PM
davide added inline comments.
lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
988–990 ↗(On Diff #104008)

Also, I'm a little confused why you need to preserve the debug location of a block you're going to wipe out shortly after? (i.e. after SimplifyCFG will run again).

weimingz updated this revision to Diff 104098.Jun 26 2017, 11:45 PM
weimingz edited edge metadata.

testcase?

updated with testcase.

lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
988–990 ↗(On Diff #104008)

we have an internal pass that will report potentially invalid memory accesses.

davide added inline comments.Jul 9 2017, 5:32 PM
test/Transforms/GVN/PRE/2017-06-28-pre-load-dbgloc.ll
68–75 ↗(On Diff #104098)

Do you need all this? probably the testcase can be simplified a bit.

weimingz updated this revision to Diff 105948.Jul 10 2017, 5:34 PM

simplify test case

aprantl accepted this revision.Jul 18 2017, 2:23 PM

I think this looks good now.

This revision was automatically updated to reflect the committed changes.