[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)
commitf033db57e966c1b0bbc73e0cb8482f5076f5ed31
treef6e025e9d4a1c7c7ab6369044a28890bcbd49f19
parent1777ae7a056181c306de420c0dc13622703ba002
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228829 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/BasicTTIImpl.h
test/Transforms/SimplifyCFG/SpeculativeExec.ll
test/Transforms/SimplifyCFG/X86/speculate-cttz-ctlz.ll [new file with mode: 0644]