]> granicus.if.org Git - llvm/commit
Fix a bug in caller's BFI update code after inlining.
authorEaswaran Raman <eraman@google.com>
Tue, 14 Feb 2017 22:49:28 +0000 (22:49 +0000)
committerEaswaran Raman <eraman@google.com>
Tue, 14 Feb 2017 22:49:28 +0000 (22:49 +0000)
commite9b25f27d91c2fc45b38ce9df2dac6bc65cdda0c
tree064a1612b6fa2b12a73c95783349a59199ad99d5
parent36924d4080358ee8db32aeb524770380680f9bb8
Fix a bug in caller's BFI update code after inlining.

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.

Differential Revision: https://reviews.llvm.org/D29696

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295115 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/InlineFunction.cpp
test/Transforms/Inline/bfi-update.ll [new file with mode: 0644]