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

Reid Spencer reid at x10sys.com
Mon Dec 4 19:30:24 PST 2006



Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.107 -> 1.108
---
Log message:

Remove the last inferred casts from VMCore.


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

 ConstantFolding.cpp |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.107 llvm/lib/VMCore/ConstantFolding.cpp:1.108
--- llvm/lib/VMCore/ConstantFolding.cpp:1.107	Sun Dec  3 23:19:34 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp	Mon Dec  4 21:30:09 2006
@@ -777,8 +777,7 @@
         uint64_t V =
           DoubleToBits(cast<ConstantFP>(CP->getOperand(i))->getValue());
         Constant *C = ConstantInt::get(Type::ULongTy, V);
-        Result.push_back(
-            ConstantExpr::getInferredCast(C, false, DstEltTy, false));
+        Result.push_back(ConstantExpr::getTruncOrBitCast(C, DstEltTy ));
       }
       return ConstantPacked::get(Result);
     }
@@ -787,8 +786,7 @@
     for (unsigned i = 0; i != SrcNumElts; ++i) {
       uint32_t V = FloatToBits(cast<ConstantFP>(CP->getOperand(i))->getValue());
       Constant *C = ConstantInt::get(Type::UIntTy, V);
-      Result.push_back(
-        ConstantExpr::getInferredCast(C, false, DstEltTy, false));
+      Result.push_back(ConstantExpr::getTruncOrBitCast(C, DstEltTy));
     }
     return ConstantPacked::get(Result);
   }
@@ -855,7 +853,7 @@
         }
       if (isAllNull)
         // This is casting one pointer type to another, always BitCast
-        return ConstantExpr::getCast(CE->getOperand(0), DestTy);
+        return ConstantExpr::getPointerCast(CE->getOperand(0), DestTy);
     }
   }
 
@@ -1644,7 +1642,7 @@
         // We know R is unsigned, Idx0 is signed because it must be an index
         // through a sequential type (gep pointer operand) which is always
         // signed.
-        R = ConstantExpr::getInferredCast(R, false, Idx0->getType(), true);
+        R = ConstantExpr::getSExtOrBitCast(R, Idx0->getType());
         R = ConstantExpr::getMul(R, Idx0); // signed multiply
         // R is a signed integer, C is the GEP pointer so -> IntToPtr
         return ConstantExpr::getCast(Instruction::IntToPtr, R, C->getType());
@@ -1676,10 +1674,9 @@
         if (!Idx0->isNullValue()) {
           const Type *IdxTy = Combined->getType();
           if (IdxTy != Idx0->getType()) {
-            Constant *C1 = ConstantExpr::getInferredCast(
-                Idx0, true, Type::LongTy, true);
-            Constant *C2 = ConstantExpr::getInferredCast(
-                Combined, true, Type::LongTy, true);
+            Constant *C1 = ConstantExpr::getSExtOrBitCast(Idx0, Type::LongTy);
+            Constant *C2 = ConstantExpr::getSExtOrBitCast(Combined, 
+                                                          Type::LongTy);
             Combined = ConstantExpr::get(Instruction::Add, C1, C2);
           } else {
             Combined =






More information about the llvm-commits mailing list