[SimplifyCFG] Don't do if-conversion if there is a long dependence chain
authorGuozhi Wei <carrot@google.com>
Fri, 22 Dec 2017 18:54:04 +0000 (18:54 +0000)
committerGuozhi Wei <carrot@google.com>
Fri, 22 Dec 2017 18:54:04 +0000 (18:54 +0000)
commit33250340f4dc4446ddacc74dc0c89cb629820901
treec732ef7085c311a785a797d9d20af302601db715
parentbb534b15a9959cdb6dc03a64151f68f1293f7a28
[SimplifyCFG] Don't do if-conversion if there is a long dependence chain

If after if-conversion, most of the instructions in this new BB construct a long and slow dependence chain, it may be slower than cmp/branch, even if the branch has a high miss rate, because the control dependence is transformed into data dependence, and control dependence can be speculated, and thus, the second part can execute in parallel with the first part on modern OOO processor.

This patch checks for the long dependence chain, and give up if-conversion if find one.

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

llvm-svn: 321377
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/X86/if-conversion.ll [new file with mode: 0644]