This is an archive of the discontinued LLVM Phabricator instance.

Bail out of a SimplifyCFG switch table opt at undef values.
ClosedPublic

Authored by JesperAntonsson on Nov 30 2017, 1:08 AM.

Details

Summary

A true or false result is expected from a comparison, but it seems the possibility of undef was overlooked, which could lead to a failed assert. This is fixed by this patch by bailing out if we encounter undef.

The bug is old and the assert has been there since the end of 2014, so it seems this is unusual enough to forego optimization.

Diff Detail

Event Timeline

davide added a reviewer: hans.Nov 30 2017, 8:34 AM
hans accepted this revision.Nov 30 2017, 8:51 AM

Looks good to me.

This revision is now accepted and ready to land.Nov 30 2017, 8:51 AM
This revision was automatically updated to reflect the committed changes.
uabelho reopened this revision.Dec 1 2017, 5:46 AM
uabelho added a subscriber: uabelho.

I submitted this for Jesper in r319537 but then reverted it in r319539 since it broke some build bots.

Probably the test case needs to be updated or moved.

This revision is now accepted and ready to land.Dec 1 2017, 5:46 AM

The testcase could fail on other targets, since the label names could become different. Therefore, the checks were relaxed, since the test really only needs to verify that it doesn't crash and emits some code.

This revision was automatically updated to reflect the committed changes.