[TTI] Improved cost heuristic for cttz/ctlz calls.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Wed, 11 Feb 2015 14:22:18 +0000 (14:22 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Wed, 11 Feb 2015 14:22:18 +0000 (14:22 +0000)
commit2a0e435db10496db2d63126d871575a0e94cf2c3
treee4f3aaa35a310f319000114a966eabc31fffa1cc
parentcb527a7fcdaf53ba4e9ef4e698debf4ed2c3b1f7
[TTI] Improved cost heuristic for cttz/ctlz calls.

This patch is a follow-up of r228826 (see code-review: D7506).

Now that SimplifyCFG uses TargetTransformInfo for cost analysis, we
have to fix the cost heuristic for intrinsic calls to cttz/ctlz.

This patch defines method 'getIntrinsicCost' in BasicTTIImpl: now, BasicTTIImpl
queries TLI to check if a call to cttz/ctlz is cheap for the target.

Added test cases in Transforms/SimplifyCFG/X86 to verify that on x86,
SimplifyCFG only speculates a call to cttz/ctlz if it is cheap.

Differential Revision: http://reviews.llvm.org/D7554

llvm-svn: 228829
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/test/Transforms/SimplifyCFG/SpeculativeExec.ll
llvm/test/Transforms/SimplifyCFG/X86/speculate-cttz-ctlz.ll [new file with mode: 0644]