[SimplifyCFG] Don't speculatively execute BB if it's predictably not taken
authorRoman Lebedev <lebedev.ri@gmail.com>
Sun, 25 Jul 2021 23:30:31 +0000 (02:30 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sun, 25 Jul 2021 23:55:14 +0000 (02:55 +0300)
commite58ce35f7b672b87baf8402de286b13df6082a00
tree90548965aeb0e79fb0d226c93bc449f47907c7f8
parent48379f27d044780396a36f90972da43e2d5aceda
[SimplifyCFG] Don't speculatively execute BB if it's predictably not taken

If the branch isn't `unpredictable`, and it is predicted to *not* branch
to the block we are considering speculatively executing,
then it seems counter-productive to execute the code that is predicted not to be executed.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D106650
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/speculatively-execute-block-profmd.ll