SimplifyCFG: Don't generate invalid code for switch used to initialize
authorHans Wennborg <hans@hanshq.net>
Wed, 19 Sep 2012 14:24:21 +0000 (14:24 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 19 Sep 2012 14:24:21 +0000 (14:24 +0000)
commit57933e3481cd5bb042415452d39d0d7f4e62d644
treec4b8561ed8052e190180b92fc6640d297ccc492c
parentadb4a40cb6ef2dba298e9dac5a905fcd2bee6e35
SimplifyCFG: Don't generate invalid code for switch used to initialize
two variables where the first variable is returned and the second
ignored.

I don't think this occurs in practice (other passes should have cleaned
up the unused phi node), but it should still be handled correctly.

Also make the logic for determining if we should return early less
sketchy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164225 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/switch_to_lookup_table.ll