diff options
author | Owen Anderson <resistor@mac.com> | 2010-07-19 19:23:32 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-07-19 19:23:32 +0000 |
commit | 5f23a938b0fb7c2e3626c59b93d2fc2530cc4dc4 (patch) | |
tree | e687c25aea82a9b9378980085c2c953b1764f966 /lib/Transforms/InstCombine/InstCombineCasts.cpp | |
parent | 46dcb57e18884099ca6ad2aebb81fd7e1513c1f6 (diff) |
Tweak per Chris' comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108736 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineCasts.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineCasts.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp index 042bf1a982..dbe5200d00 100644 --- a/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -1106,19 +1106,20 @@ Instruction *InstCombiner::visitFPTrunc(FPTruncInst &CI) { Call->getNumArgOperands() == 1) { CastInst *Arg = dyn_cast<CastInst>(Call->getArgOperand(0)); if (Arg && Arg->getOpcode() == Instruction::FPExt && - CI.getType() == Builder->getFloatTy() && - Call->getType() == Builder->getDoubleTy() && - Arg->getType() == Builder->getDoubleTy() && - Arg->getOperand(0)->getType() == Builder->getFloatTy()) { - Module* M = CI.getParent()->getParent()->getParent(); + CI.getType()->isFloatTy() && + Call->getType()->isDoubleTy() && + Arg->getType()->isDoubleTy() && + Arg->getOperand(0)->getType()->isFloatTy()) { + Function *Callee = Call->getCalledFunction(); + Module *M = CI.getParent()->getParent()->getParent(); Constant* SqrtfFunc = M->getOrInsertFunction("sqrtf", - Call->getAttributes(), + Callee->getAttributes(), Builder->getFloatTy(), Builder->getFloatTy(), NULL); CallInst *ret = CallInst::Create(SqrtfFunc, Arg->getOperand(0), "sqrtfcall"); - ret->setAttributes(Call->getAttributes()); + ret->setAttributes(Callee->getAttributes()); return ret; } } |