This is an archive of the discontinued LLVM Phabricator instance.

[globalisel][irtranslator] Verify that DILocations aren't lost in translation
ClosedPublic

Authored by dsanders on Oct 25 2018, 4:30 PM.

Details

Summary

Also fix a couple bugs where DILocations are lost. EntryBuilder wasn't passing
on debug locations for PHI's, constants, GLOBAL_VALUE, etc.

Diff Detail

Repository
rL LLVM

Event Timeline

dsanders created this revision.Oct 25 2018, 4:30 PM
vsk added a comment.Oct 25 2018, 4:48 PM

The verifier bits look great, I'll let someone else comment on the functionality changes. Thanks!

test/CodeGen/AArch64/GlobalISel/irtranslator-dilocation.ll
33 ↗(On Diff #171219)

It's probably safe to prune all of these out.

aemerson added inline comments.
lib/CodeGen/GlobalISel/IRTranslator.cpp
124 ↗(On Diff #171219)

I think this debug print is probably unnecessary given it'll print for every instruction translated (and without ASSERTIONS it won't actually do anything).

1742 ↗(On Diff #171219)

This is unnecessary as Verifier goes out of scope immediately after?

dsanders added inline comments.Oct 29 2018, 8:29 AM
lib/CodeGen/GlobalISel/IRTranslator.cpp
124 ↗(On Diff #171219)

I'm not sure I understand this comment. It sounds like you're suggesting its removal but the follow on implies the right thing to do is to wrap it in '#ifndef NDEBUG'.

1742 ↗(On Diff #171219)

Good point

aemerson added inline comments.Oct 29 2018, 9:32 AM
lib/CodeGen/GlobalISel/IRTranslator.cpp
124 ↗(On Diff #171219)

Yes I was suggesting removing it.

AFAIK NDEBUG and assertions are independent of each other, so without assertions enabled this will print a message that doesn't actually check anything. Could be wrong about that.

dsanders added inline comments.Oct 29 2018, 9:46 AM
lib/CodeGen/GlobalISel/IRTranslator.cpp
124 ↗(On Diff #171219)

I'd prefer not to remove it as it was quite useful to see what DILocations were expected to go where when I was debugging the missing DILocations that are fixed in this patch. I do agree it should only print "Checking ..." when the checks are actually happening though.

AFAIK NDEBUG and assertions are independent of each other, so without assertions enabled this will
print a message that doesn't actually check anything. Could be wrong about that.

The effects of LLVM_ENABLE_ASSERTIONS are achieved by adding -UNDEBUG and removing any -DNDEBUG from the standard build flags. The code for that is in HandleLLVMOptions.cmake

aemerson accepted this revision.Oct 30 2018, 9:47 AM

LGTM with the nits addressed.

This revision is now accepted and ready to land.Oct 30 2018, 9:47 AM
This revision was automatically updated to reflect the committed changes.
dsanders marked 2 inline comments as done.