mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-23 02:32:11 +00:00
Tweak per Chris' comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108736 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
46dcb57e18
commit
5f23a938b0
@ -1106,19 +1106,20 @@ Instruction *InstCombiner::visitFPTrunc(FPTruncInst &CI) {
|
|||||||
Call->getNumArgOperands() == 1) {
|
Call->getNumArgOperands() == 1) {
|
||||||
CastInst *Arg = dyn_cast<CastInst>(Call->getArgOperand(0));
|
CastInst *Arg = dyn_cast<CastInst>(Call->getArgOperand(0));
|
||||||
if (Arg && Arg->getOpcode() == Instruction::FPExt &&
|
if (Arg && Arg->getOpcode() == Instruction::FPExt &&
|
||||||
CI.getType() == Builder->getFloatTy() &&
|
CI.getType()->isFloatTy() &&
|
||||||
Call->getType() == Builder->getDoubleTy() &&
|
Call->getType()->isDoubleTy() &&
|
||||||
Arg->getType() == Builder->getDoubleTy() &&
|
Arg->getType()->isDoubleTy() &&
|
||||||
Arg->getOperand(0)->getType() == Builder->getFloatTy()) {
|
Arg->getOperand(0)->getType()->isFloatTy()) {
|
||||||
Module* M = CI.getParent()->getParent()->getParent();
|
Function *Callee = Call->getCalledFunction();
|
||||||
|
Module *M = CI.getParent()->getParent()->getParent();
|
||||||
Constant* SqrtfFunc = M->getOrInsertFunction("sqrtf",
|
Constant* SqrtfFunc = M->getOrInsertFunction("sqrtf",
|
||||||
Call->getAttributes(),
|
Callee->getAttributes(),
|
||||||
Builder->getFloatTy(),
|
Builder->getFloatTy(),
|
||||||
Builder->getFloatTy(),
|
Builder->getFloatTy(),
|
||||||
NULL);
|
NULL);
|
||||||
CallInst *ret = CallInst::Create(SqrtfFunc, Arg->getOperand(0),
|
CallInst *ret = CallInst::Create(SqrtfFunc, Arg->getOperand(0),
|
||||||
"sqrtfcall");
|
"sqrtfcall");
|
||||||
ret->setAttributes(Call->getAttributes());
|
ret->setAttributes(Callee->getAttributes());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user