This is an archive of the discontinued LLVM Phabricator instance.

[llc] Remove exit-on-error flag from MIR tests (PR27770)
ClosedPublic

Authored by rovka on May 18 2016, 8:25 AM.

Details

Summary

This is made possible by removing an assert in llc that assumed MIRParser::parseLLVMModule would exit on error. MIRParser's documentation states that it returns null if a parsing error occurs, so there's no reason to assert. We can instead just fall through to where the check for a module is performed and exit if it is null.

This commit is part of the clean-up after r269655.

Fixes PR27770

Diff Detail

Repository
rL LLVM

Event Timeline

rovka updated this revision to Diff 57629.May 18 2016, 8:25 AM
rovka retitled this revision from to [llc] Remove exit-on-error flag from MIR tests (PR27770).
rovka updated this object.
rovka added a reviewer: arphaman.
rovka added subscribers: llvm-commits, rengolin.
rovka added a comment.Jun 7 2016, 5:07 AM

Ping again?

rengolin added inline comments.Jun 8 2016, 5:01 AM
tools/llc/llc.cpp
264 ↗(On Diff #57629)

Can you guarantee parseLLVMModule won't return a null pointer?

I mean, it's pretty unlikely, but I'm surprised that this was asserting and being the only reason the *whole* test was "passing".

rovka added inline comments.Jun 8 2016, 5:06 AM
tools/llc/llc.cpp
264 ↗(On Diff #57629)

No, in fact parseLLVMModule is supposed to return null if it finds any errors. But when it does, we don't need to assert, we can just fall through to lines 267-270, where we print those errors and return.

rengolin accepted this revision.Jun 8 2016, 5:20 AM
rengolin added a reviewer: rengolin.

Right, not only this is a no-brainer, but the current behaviour of the tests ("passing" on an unrelated assert) is dangerous.

LGTM, thanks!

tools/llc/llc.cpp
264 ↗(On Diff #57629)

D'oh! Of course!

This revision is now accepted and ready to land.Jun 8 2016, 5:20 AM
qcolombet accepted this revision.Jun 8 2016, 3:08 PM
qcolombet added a reviewer: qcolombet.

LGTM as well.

This revision was automatically updated to reflect the committed changes.