[llvm-commits] CVS: llvm/lib/VMCore/IntrinsicLowering.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jun 10 22:00:01 PDT 2004
Changes in directory llvm/lib/VMCore:
IntrinsicLowering.cpp updated: 1.15 -> 1.16
---
Log message:
Fix lowering to work correctly
---
Diffs of the changes: (+12 -3)
Index: llvm/lib/VMCore/IntrinsicLowering.cpp
diff -u llvm/lib/VMCore/IntrinsicLowering.cpp:1.15 llvm/lib/VMCore/IntrinsicLowering.cpp:1.16
--- llvm/lib/VMCore/IntrinsicLowering.cpp:1.15 Thu Jun 10 21:29:43 2004
+++ llvm/lib/VMCore/IntrinsicLowering.cpp Thu Jun 10 21:54:02 2004
@@ -69,7 +69,14 @@
std::string Name = CI->getName(); CI->setName("");
if (FT->getReturnType() == Type::VoidTy) Name.clear();
- return new CallInst(FCache, Operands, Name, CI);
+ CallInst *NewCI = new CallInst(FCache, Operands, Name, CI);
+ if (!CI->use_empty()) {
+ Value *V = NewCI;
+ if (CI->getType() != NewCI->getType())
+ V = new CastInst(NewCI, CI->getType(), Name, CI);
+ CI->replaceAllUsesWith(V);
+ }
+ return NewCI;
}
void DefaultIntrinsicLowering::AddPrototypes(Module &M) {
@@ -98,7 +105,9 @@
EnsureFunctionExists(M, "memset", I->abegin(), --I->aend(),
I->abegin()->getType());
break;
-
+ case Intrinsic::isnan:
+ EnsureFunctionExists(M, "isnan", I->abegin(), I->aend(), Type::BoolTy);
+ break;
}
}
@@ -196,7 +205,7 @@
// multiple isnans for different FP arguments.
static Function *isnanFCache = 0;
ReplaceCallWith("isnan", CI, CI->op_begin()+1, CI->op_end(),
- (*(CI->op_begin()+1))->getType(), isnanFCache);
+ Type::BoolTy, isnanFCache);
break;
}
}
More information about the llvm-commits
mailing list