This is an archive of the discontinued LLVM Phabricator instance.

[globalisel] Stop requiring -debug/-debug-only=registerbankinfo for assertions.
ClosedPublic

Authored by dsanders on Jan 5 2017, 8:39 AM.

Details

Summary

I've noticed that these assertions don't trigger when the condition is false.
The problem is that the DEBUG(x) macro only executes x when the pass is
emitting debug output via the -debug and -debug-only=registerbankinfo command
line arguments.

Debug builds should always execute the assertions so use '#ifndef NDEBUG' instead.

Also removed an assertion that is only true the first time it's tested. <Target>RegisterBankInfo's constructor will re-use register banks causing them to be valid on subsequent tests. That
assertion will fail on the first test too in the near future.

Event Timeline

dsanders updated this revision to Diff 83250.Jan 5 2017, 8:39 AM
dsanders retitled this revision from to [globalisel] Stop requiring -debug/-debug-only=registerbankinfo for assertions..
dsanders updated this object.
dsanders added reviewers: qcolombet, t.p.northover, ab, rovka.
dsanders added a subscriber: llvm-commits.
qcolombet accepted this revision.Jan 5 2017, 9:48 AM
qcolombet edited edge metadata.

Hi Daniel,

Good catch!

LGTM. Nitpicks below.

Cheers,
-Quentin

lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
58

#ifndef NDEBUG, right?

75

Ditto.

This revision is now accepted and ready to land.Jan 5 2017, 9:48 AM
dsanders added inline comments.Jan 5 2017, 2:45 PM
lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
58

Yes, you're right. It looks like I accidentally inverted it when I separated it from my WIP.

dsanders added inline comments.Jan 6 2017, 4:40 AM
lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
61–62

Fixing the typo revealed that this assertion triggers on trunk because of the AlreadyInit mechanism. I've removed this assert because it's only true the first time <Target>RegisterBankInfo is constructed and because will never be true once D27809 lands.

dsanders updated this object.Jan 6 2017, 4:45 AM
dsanders edited edge metadata.
dsanders closed this revision.Jan 6 2017, 6:40 AM