From 96172cb4a44d890263c9054df35739a60569d4a5 Mon Sep 17 00:00:00 2001 From: Juergen Ributzka Date: Fri, 24 Jan 2014 20:18:00 +0000 Subject: 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 --- lib/Analysis/TargetTransformInfo.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'lib/Analysis/TargetTransformInfo.cpp') 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 { -- cgit v1.2.3