SimplifyCFG: check uses of constant-foldable instrs in switch destinations (PR20210)
authorHans Wennborg <hans@hanshq.net>
Fri, 9 Jan 2015 22:13:31 +0000 (22:13 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 9 Jan 2015 22:13:31 +0000 (22:13 +0000)
commitca71be6415f7e0a3d02b28980665c26d166460f0
tree4f5ba9f3aa4f9f7977335726b66481614acf58fa
parent34630b6ea9744c95a6feef73814728e60853d27e
SimplifyCFG: check uses of constant-foldable instrs in switch destinations (PR20210)

The previous code assumed that such instructions could not have any uses
outside CaseDest, with the motivation that the instruction could not
dominate CommonDest because CommonDest has phi nodes in it. That simply
isn't true; e.g., CommonDest could have an edge back to itself.

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