aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/AutoUpgrade.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-01-19 07:00:29 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-01-19 07:00:29 +0000
commite559184d7025523d3ac520ada1726a7d19dd29f1 (patch)
treee128a3be3d07bc1cbf4f4d85195986019134c7cf /lib/VMCore/AutoUpgrade.cpp
parent0fc0ab7148daaf64c8b86b8b44d6d12eb4faee5c (diff)
Don't forget about casting the result of an upgraded call to an intrinsic
in the case where it needs to cast back to a signed type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25447 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AutoUpgrade.cpp')
-rw-r--r--lib/VMCore/AutoUpgrade.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp
index 8107d8a724..26a9947d30 100644
--- a/lib/VMCore/AutoUpgrade.cpp
+++ b/lib/VMCore/AutoUpgrade.cpp
@@ -141,7 +141,7 @@ Function* llvm::UpgradeIntrinsicFunction(Function* F) {
return 0;
}
-CallInst* llvm::UpgradeIntrinsicCall(CallInst *CI) {
+Instruction* llvm::UpgradeIntrinsicCall(CallInst *CI) {
Function *F = CI->getCalledFunction();
if (const Type* Ty = get_type(F)) {
Function* newF = UpgradeIntrinsicFunction(F);
@@ -154,6 +154,9 @@ CallInst* llvm::UpgradeIntrinsicCall(CallInst *CI) {
const Type* newTy = Ty->getUnsignedVersion();
newCI->setOperand(1,new CastInst(newCI->getOperand(1), newTy,
"autoupgrade_cast", newCI));
+ CastInst* final = new CastInst(newCI, Ty, "autoupgrade_uncast",newCI);
+ newCI->moveBefore(final);
+ return final;
}
return newCI;
}