mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-26 14:15:53 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165759 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
aa79721fce
commit
d61d1eb165
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user