[llvm-commits] [llvm] r108736 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
Owen Anderson
resistor at mac.com
Mon Jul 19 12:23:33 PDT 2010
Author: resistor
Date: Mon Jul 19 14:23:32 2010
New Revision: 108736
URL: http://llvm.org/viewvc/llvm-project?rev=108736&view=rev
Log:
Tweak per Chris' comments.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=108736&r1=108735&r2=108736&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Mon Jul 19 14:23:32 2010
@@ -1106,19 +1106,20 @@
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;
}
}
More information about the llvm-commits
mailing list