Multiple blocks in the callee can be mapped to a single cloned block since we prune the callee as we clone it. The existing code iterates over the value map and clones the block frequency (and eventually scales the frequencies of the cloned blocks). Value map's iteration is not deterministic and so the cloned block might get the frequency of any of the original blocks. The fix is to set the max of the original frequencies to the cloned block. The first block in the sequence must have this max frequency and, in the call context, subsequent blocks must have its frequency.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Nice catch and nice test case!
lib/Transforms/Utils/InlineFunction.cpp | ||
---|---|---|
1415 ↗ | (On Diff #87571) | Instead of testing and then inserting, you always want to try to insert and check whether the insert failed. |