OSDN Git Service

Bail out of a SimplifyCFG switch table opt at undef values.
authorMikael Holmen <mikael.holmen@ericsson.com>
Fri, 1 Dec 2017 12:30:49 +0000 (12:30 +0000)
committerMikael Holmen <mikael.holmen@ericsson.com>
Fri, 1 Dec 2017 12:30:49 +0000 (12:30 +0000)
commit8c4503a35074fd4da13c834ab01ecb65e1d1bb63
treeafe6dc83584e8bc53f32479238794934069fff36
parenta2040d55d7886236077ca43f540586199826167a
Bail out of a SimplifyCFG switch table opt at undef values.

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.

Patch by: JesperAntonsson

Reviewers: spatel, eeckstein, hans

Reviewed By: hans

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D40639

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319537 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/switch_undef.ll [new file with mode: 0644]