Transforms: Don't create bad weights when eliminating dead cases
authorJustin Bogner <mail@justinbogner.com>
Fri, 20 Dec 2013 08:21:30 +0000 (08:21 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 20 Dec 2013 08:21:30 +0000 (08:21 +0000)
commitbcb726dc8addb8155a722a43898af872532b317a
tree7570f2c60efb598e7facf42218bb0c1d397b4c23
parent35c913b5b1916e747c86a24997f63e7d5dedf5d3
Transforms: Don't create bad weights when eliminating dead cases

If we happen to eliminate every case in a switch that has branch
weights, we currently try to create metadata for the one remaining
branch, triggering an assert. Instead, we need to check that the
metadata we're trying to create is sensible.

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