[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp

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



Changes in directory llvm/lib/CodeGen:

IntrinsicLowering.cpp updated: 1.51 -> 1.52
---
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:  (+13 -5)

 IntrinsicLowering.cpp |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)


Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.51 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.52
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.51	Mon Dec 11 23:19:46 2006
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp	Mon Dec 18 02:47:13 2006
@@ -66,9 +66,13 @@
       if (castOpcodes[ArgNo])
         Arg = CastInst::create(Instruction::CastOps(castOpcodes[ArgNo]),
           Arg, FT->getParamType(ArgNo), Arg->getName(), CI);
-      else
-        Arg = CastInst::createInferredCast(Arg, FT->getParamType(ArgNo), 
-                                           Arg->getName(), CI);
+      else {
+        Instruction::CastOps opcode = CastInst::getCastOpcode(Arg, 
+            Arg->getType()->isSigned(), FT->getParamType(ArgNo), 
+            FT->getParamType(ArgNo)->isSigned());
+        Arg = CastInst::create(opcode, Arg, FT->getParamType(ArgNo),
+                               Arg->getName(), CI);
+      }
     Operands.push_back(Arg);
   }
   // Pass nulls into any additional arguments...
@@ -80,8 +84,12 @@
   CallInst *NewCI = new CallInst(FCache, Operands, Name, CI);
   if (!CI->use_empty()) {
     Value *V = NewCI;
-    if (CI->getType() != NewCI->getType())
-      V = CastInst::createInferredCast(NewCI, CI->getType(), Name, CI);
+    if (CI->getType() != NewCI->getType()) {
+      Instruction::CastOps opcode = CastInst::getCastOpcode(NewCI, 
+          NewCI->getType()->isSigned(), CI->getType(), 
+          CI->getType()->isSigned());
+      V = CastInst::create(opcode, NewCI, CI->getType(), Name, CI);
+    }
     CI->replaceAllUsesWith(V);
   }
   return NewCI;






More information about the llvm-commits mailing list