mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-03 00:33:09 +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);
|
SI->removeCase(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (HasWeight)
|
if (HasWeight && Weights.size() >= 2)
|
||||||
SI->setMetadata(LLVMContext::MD_prof,
|
SI->setMetadata(LLVMContext::MD_prof,
|
||||||
MDBuilder(SI->getParent()->getContext()).
|
MDBuilder(SI->getParent()->getContext()).
|
||||||
createBranchWeights(Weights));
|
createBranchWeights(Weights));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user