[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Reid Spencer reid at x10sys.com
Mon Dec 18 00:47:36 PST 2006



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.570 -> 1.571
---
Log message:

Convert the last uses of CastInst::createInferredCast to a normal cast
creation. These changes are still temporary but at least this pushes 
knowledge of signedness out closer to where it can be determined properly
and allows signedness to be removed from VMCore.


---
Diffs of the changes:  (+10 -3)

 InstructionCombining.cpp |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.570 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.571
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.570	Wed Dec 13 12:21:21 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Dec 18 02:47:13 2006
@@ -7009,7 +7009,9 @@
     if ((*AI)->getType() == ParamTy) {
       Args.push_back(*AI);
     } else {
-      CastInst *NewCast = CastInst::createInferredCast(*AI, ParamTy, "tmp");
+      Instruction::CastOps opcode = CastInst::getCastOpcode(*AI,
+          (*AI)->getType()->isSigned(), ParamTy, ParamTy->isSigned());
+      CastInst *NewCast = CastInst::create(opcode, *AI, ParamTy, "tmp");
       Args.push_back(InsertNewInstBefore(NewCast, *Caller));
     }
   }
@@ -7030,7 +7032,9 @@
         const Type *PTy = getPromotedType((*AI)->getType());
         if (PTy != (*AI)->getType()) {
           // Must promote to pass through va_arg area!
-          Instruction *Cast = CastInst::createInferredCast(*AI, PTy, "tmp");
+          Instruction::CastOps opcode = CastInst::getCastOpcode(
+              *AI, (*AI)->getType()->isSigned(), PTy, PTy->isSigned());
+          Instruction *Cast = CastInst::create(opcode, *AI, PTy, "tmp");
           InsertNewInstBefore(Cast, *Caller);
           Args.push_back(Cast);
         } else {
@@ -7058,7 +7062,10 @@
   Value *NV = NC;
   if (Caller->getType() != NV->getType() && !Caller->use_empty()) {
     if (NV->getType() != Type::VoidTy) {
-      NV = NC = CastInst::createInferredCast(NC, Caller->getType(), "tmp");
+      const Type *CallerTy = Caller->getType();
+      Instruction::CastOps opcode = CastInst::getCastOpcode(
+          NC, NC->getType()->isSigned(), CallerTy, CallerTy->isSigned());
+      NV = NC = CastInst::create(opcode, NC, CallerTy, "tmp");
 
       // If this is an invoke instruction, we should insert it after the first
       // non-phi, instruction in the normal successor block.






More information about the llvm-commits mailing list