diff options
author | Juergen Ributzka <juergen@apple.com> | 2014-01-24 20:18:00 +0000 |
---|---|---|
committer | Juergen Ributzka <juergen@apple.com> | 2014-01-24 20:18:00 +0000 |
commit | 96172cb4a44d890263c9054df35739a60569d4a5 (patch) | |
tree | 70ad93330d578a0eb2ea4be59c6d552ddcffd7da /lib/Analysis/TargetTransformInfo.cpp | |
parent | 86720f7c65c4481c8d8518d71e2bdce59a85969e (diff) | |
download | llvm-96172cb4a44d890263c9054df35739a60569d4a5.tar.gz llvm-96172cb4a44d890263c9054df35739a60569d4a5.tar.bz2 llvm-96172cb4a44d890263c9054df35739a60569d4a5.tar.xz |
Add Constant Hoisting Pass
Retry commit r200022 with a fix for the build bot errors. Constant expressions
have (unlike instructions) module scope use lists and therefore may have users
in different functions. The fix is to simply ignore these out-of-function uses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200034 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/TargetTransformInfo.cpp')
-rw-r--r-- | lib/Analysis/TargetTransformInfo.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/Analysis/TargetTransformInfo.cpp b/lib/Analysis/TargetTransformInfo.cpp index 360c4f5f1b..decb9aec4d 100644 --- a/lib/Analysis/TargetTransformInfo.cpp +++ b/lib/Analysis/TargetTransformInfo.cpp @@ -158,6 +158,16 @@ unsigned TargetTransformInfo::getIntImmCost(const APInt &Imm, Type *Ty) const { return PrevTTI->getIntImmCost(Imm, Ty); } +unsigned TargetTransformInfo::getIntImmCost(unsigned Opcode, const APInt &Imm, + Type *Ty) const { + return PrevTTI->getIntImmCost(Opcode, Imm, Ty); +} + +unsigned TargetTransformInfo::getIntImmCost(Intrinsic::ID IID, const APInt &Imm, + Type *Ty) const { + return PrevTTI->getIntImmCost(IID, Imm, Ty); +} + unsigned TargetTransformInfo::getNumberOfRegisters(bool Vector) const { return PrevTTI->getNumberOfRegisters(Vector); } @@ -541,7 +551,17 @@ struct NoTTI LLVM_FINAL : ImmutablePass, TargetTransformInfo { } unsigned getIntImmCost(const APInt &Imm, Type *Ty) const LLVM_OVERRIDE { - return 1; + return TCC_Basic; + } + + unsigned getIntImmCost(unsigned Opcode, const APInt &Imm, + Type *Ty) const LLVM_OVERRIDE { + return TCC_Free; + } + + unsigned getIntImmCost(Intrinsic::ID IID, const APInt &Imm, + Type *Ty) const LLVM_OVERRIDE { + return TCC_Free; } unsigned getNumberOfRegisters(bool Vector) const LLVM_OVERRIDE { |