[llvm-commits] CVS: llvm/lib/VMCore/AutoUpgrade.cpp

Reid Spencer reid at x10sys.com
Wed Jan 18 23:00:41 PST 2006



Changes in directory llvm/lib/VMCore:

AutoUpgrade.cpp updated: 1.3 -> 1.4
---
Log message:

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.


---
Diffs of the changes:  (+4 -1)

 AutoUpgrade.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/AutoUpgrade.cpp
diff -u llvm/lib/VMCore/AutoUpgrade.cpp:1.3 llvm/lib/VMCore/AutoUpgrade.cpp:1.4
--- llvm/lib/VMCore/AutoUpgrade.cpp:1.3	Wed Jan 18 23:37:27 2006
+++ llvm/lib/VMCore/AutoUpgrade.cpp	Thu Jan 19 01:00:29 2006
@@ -141,7 +141,7 @@
   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 @@
       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;
   }






More information about the llvm-commits mailing list