diff options
author | Manman Ren <mren@apple.com> | 2012-10-11 22:28:34 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2012-10-11 22:28:34 +0000 |
commit | 97c1876256570b45cc2c789755132d6e384173aa (patch) | |
tree | 4c4278e7a7390bfd7f9797f7c0464e666e8466ca /llvm/lib | |
parent | 959c71a6854b5776b350d256885b2a81d6da52db (diff) | |
download | bcm5719-llvm-97c1876256570b45cc2c789755132d6e384173aa.tar.gz bcm5719-llvm-97c1876256570b45cc2c789755132d6e384173aa.zip |
PGO: create metadata for switch only if it has more than one targets.
When all cases of a switch statement are dead, the weights vector only has one
element, and we will get an ssertion failure when calling createBranchWeights.
llvm-svn: 165759
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index af8d1128523..5f8953abc07 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -695,7 +695,7 @@ SimplifyEqualityComparisonWithOnlyPredecessor(TerminatorInst *TI, SI->removeCase(i); } } - if (HasWeight) + if (HasWeight && Weights.size() >= 2) SI->setMetadata(LLVMContext::MD_prof, MDBuilder(SI->getParent()->getContext()). createBranchWeights(Weights)); |