summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-07-19 19:23:32 +0000
committerOwen Anderson <resistor@mac.com>2010-07-19 19:23:32 +0000
commit84774eda4be8ae0cede19585231ada68542284fc (patch)
tree57cfef4a27b0a1de510d7b53de954b6b4dcc72a2 /llvm/lib/Transforms
parent7a135510e36f34d8ee6b447a2c10db0f683bac60 (diff)
downloadbcm5719-llvm-84774eda4be8ae0cede19585231ada68542284fc.tar.gz
bcm5719-llvm-84774eda4be8ae0cede19585231ada68542284fc.zip
Tweak per Chris' comments.
llvm-svn: 108736
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 042bf1a9829..dbe5200d000 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/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;
}
}
OpenPOWER on IntegriCloud