[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp

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



Changes in directory llvm/lib/Transforms/Instrumentation:

ProfilingUtils.cpp updated: 1.10 -> 1.11
---
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 -4)

 ProfilingUtils.cpp |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.10 llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.11
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.10	Tue Dec 12 18:50:17 2006
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp	Mon Dec 18 02:47:13 2006
@@ -62,8 +62,10 @@
   case 2:
     AI = MainFn->arg_begin(); ++AI;
     if (AI->getType() != ArgVTy) {
+      Instruction::CastOps opcode = CastInst::getCastOpcode(AI,
+          AI->getType()->isSigned(), ArgVTy, ArgVTy->isSigned());
       InitCall->setOperand(2, 
-          CastInst::createInferredCast(AI, ArgVTy, "argv.cast", InitCall));
+          CastInst::create(opcode, AI, ArgVTy, "argv.cast", InitCall));
     } else {
       InitCall->setOperand(2, AI);
     }
@@ -74,11 +76,18 @@
     // If the program looked at argc, have it look at the return value of the
     // init call instead.
     if (AI->getType() != Type::IntTy) {
-      if (!AI->use_empty())
+      Instruction::CastOps opcode;
+      if (!AI->use_empty()) {
+        opcode = CastInst::getCastOpcode(InitCall, 
+            InitCall->getType()->isSigned(), AI->getType(), 
+            AI->getType()->isSigned());
         AI->replaceAllUsesWith(
-          CastInst::createInferredCast(InitCall, AI->getType(), "", InsertPos));
+          CastInst::create(opcode, InitCall, AI->getType(), "", InsertPos));
+      }
+      opcode = CastInst::getCastOpcode(AI, AI->getType()->isSigned(),
+          Type::IntTy, true);
       InitCall->setOperand(1, 
-          CastInst::createInferredCast(AI, Type::IntTy, "argc.cast", InitCall));
+          CastInst::create(opcode, AI, Type::IntTy, "argc.cast", InitCall));
     } else {
       AI->replaceAllUsesWith(InitCall);
       InitCall->setOperand(1, AI);






More information about the llvm-commits mailing list