[llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp DeadArgumentElimination.cpp GlobalOpt.cpp IndMemRemoval.cpp LowerSetJmp.cpp RaiseAllocations.cpp SimplifyLibCalls.cpp

Reid Spencer reid at x10sys.com
Sat Dec 30 21:49:04 PST 2006



Changes in directory llvm/lib/Transforms/IPO:

ArgumentPromotion.cpp updated: 1.32 -> 1.33
DeadArgumentElimination.cpp updated: 1.33 -> 1.34
GlobalOpt.cpp updated: 1.81 -> 1.82
IndMemRemoval.cpp updated: 1.9 -> 1.10
LowerSetJmp.cpp updated: 1.34 -> 1.35
RaiseAllocations.cpp updated: 1.34 -> 1.35
SimplifyLibCalls.cpp updated: 1.80 -> 1.81
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch replaces signed integer types with signless ones:
1. [US]Byte -> Int8
2. [U]Short -> Int16
3. [U]Int   -> Int32
4. [U]Long  -> Int64.
5. Removal of isSigned, isUnsigned, getSignedVersion, getUnsignedVersion
   and other methods related to signedness. In a few places this warranted
   identifying the signedness information from other sources.



---
Diffs of the changes:  (+133 -135)

 ArgumentPromotion.cpp       |    6 -
 DeadArgumentElimination.cpp |    4 
 GlobalOpt.cpp               |   17 +--
 IndMemRemoval.cpp           |    4 
 LowerSetJmp.cpp             |   24 ++---
 RaiseAllocations.cpp        |   22 ++---
 SimplifyLibCalls.cpp        |  191 +++++++++++++++++++++-----------------------
 7 files changed, 133 insertions(+), 135 deletions(-)


Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.32 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.33
--- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.32	Tue Dec 19 16:09:18 2006
+++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp	Sat Dec 30 23:48:39 2006
@@ -384,7 +384,7 @@
   bool ExtraArgHack = false;
   if (Params.empty() && FTy->isVarArg()) {
     ExtraArgHack = true;
-    Params.push_back(Type::IntTy);
+    Params.push_back(Type::Int32Ty);
   }
   FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg());
 
@@ -429,7 +429,7 @@
       }
 
     if (ExtraArgHack)
-      Args.push_back(Constant::getNullValue(Type::IntTy));
+      Args.push_back(Constant::getNullValue(Type::Int32Ty));
 
     // Push any varargs arguments on the list
     for (; AI != CS.arg_end(); ++AI)
@@ -540,7 +540,7 @@
 
   // Notify the alias analysis implementation that we inserted a new argument.
   if (ExtraArgHack)
-    AA.copyValue(Constant::getNullValue(Type::IntTy), NF->arg_begin());
+    AA.copyValue(Constant::getNullValue(Type::Int32Ty), NF->arg_begin());
 
 
   // Tell the alias analysis that the old function is about to disappear.


Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.33 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.34
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.33	Tue Dec 19 16:09:18 2006
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp	Sat Dec 30 23:48:39 2006
@@ -500,7 +500,7 @@
   bool ExtraArgHack = false;
   if (Params.empty() && FTy->isVarArg()) {
     ExtraArgHack = true;
-    Params.push_back(Type::IntTy);
+    Params.push_back(Type::Int32Ty);
   }
 
   FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg());
@@ -526,7 +526,7 @@
         Args.push_back(*AI);
 
     if (ExtraArgHack)
-      Args.push_back(UndefValue::get(Type::IntTy));
+      Args.push_back(UndefValue::get(Type::Int32Ty));
 
     // Push any varargs arguments on the list
     for (; AI != CS.arg_end(); ++AI)


Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.81 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.82
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.81	Sat Dec 23 00:05:41 2006
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp	Sat Dec 30 23:48:39 2006
@@ -384,7 +384,7 @@
     NewGlobals.reserve(STy->getNumElements());
     for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
       Constant *In = getAggregateConstantElement(Init,
-                                            ConstantInt::get(Type::UIntTy, i));
+                                            ConstantInt::get(Type::Int32Ty, i));
       assert(In && "Couldn't get element of initializer?");
       GlobalVariable *NGV = new GlobalVariable(STy->getElementType(i), false,
                                                GlobalVariable::InternalLinkage,
@@ -406,7 +406,7 @@
     NewGlobals.reserve(NumElements);
     for (unsigned i = 0, e = NumElements; i != e; ++i) {
       Constant *In = getAggregateConstantElement(Init,
-                                            ConstantInt::get(Type::UIntTy, i));
+                                            ConstantInt::get(Type::Int32Ty, i));
       assert(In && "Couldn't get element of initializer?");
 
       GlobalVariable *NGV = new GlobalVariable(STy->getElementType(), false,
@@ -422,7 +422,7 @@
 
   DOUT << "PERFORMING GLOBAL SRA ON: " << *GV;
 
-  Constant *NullInt = Constant::getNullValue(Type::IntTy);
+  Constant *NullInt = Constant::getNullValue(Type::Int32Ty);
 
   // Loop over all of the uses of the global, replacing the constantexpr geps,
   // with smaller constantexpr geps or direct references.
@@ -679,10 +679,10 @@
     Type *NewTy = ArrayType::get(MI->getAllocatedType(),
                                  NElements->getZExtValue());
     MallocInst *NewMI =
-      new MallocInst(NewTy, Constant::getNullValue(Type::UIntTy),
+      new MallocInst(NewTy, Constant::getNullValue(Type::Int32Ty),
                      MI->getAlignment(), MI->getName(), MI);
     std::vector<Value*> Indices;
-    Indices.push_back(Constant::getNullValue(Type::IntTy));
+    Indices.push_back(Constant::getNullValue(Type::Int32Ty));
     Indices.push_back(Indices[0]);
     Value *NewGEP = new GetElementPtrInst(NewMI, Indices,
                                           NewMI->getName()+".el0", MI);
@@ -892,7 +892,6 @@
     // Otherwise, this should be: 'getelementptr Ptr, Idx, uint FieldNo ...'
     GetElementPtrInst *GEPI = cast<GetElementPtrInst>(User);
     assert(GEPI->getNumOperands() >= 3 && isa<ConstantInt>(GEPI->getOperand(2))
-           && GEPI->getOperand(2)->getType()->isUnsigned()
            && "Unexpected GEPI!");
     
     // Load the pointer for this field.
@@ -1415,7 +1414,7 @@
       if (!ATy) return 0;
       const StructType *STy = dyn_cast<StructType>(ATy->getElementType());
       if (!STy || STy->getNumElements() != 2 ||
-          STy->getElementType(0) != Type::IntTy) return 0;
+          STy->getElementType(0) != Type::Int32Ty) return 0;
       const PointerType *PFTy = dyn_cast<PointerType>(STy->getElementType(1));
       if (!PFTy) return 0;
       const FunctionType *FTy = dyn_cast<FunctionType>(PFTy->getElementType());
@@ -1468,7 +1467,7 @@
                                           const std::vector<Function*> &Ctors) {
   // If we made a change, reassemble the initializer list.
   std::vector<Constant*> CSVals;
-  CSVals.push_back(ConstantInt::get(Type::IntTy, 65535));
+  CSVals.push_back(ConstantInt::get(Type::Int32Ty, 65535));
   CSVals.push_back(0);
   
   // Create the new init list.
@@ -1481,7 +1480,7 @@
                                           std::vector<const Type*>(), false);
       const PointerType *PFTy = PointerType::get(FTy);
       CSVals[1] = Constant::getNullValue(PFTy);
-      CSVals[0] = ConstantInt::get(Type::IntTy, 2147483647);
+      CSVals[0] = ConstantInt::get(Type::Int32Ty, 2147483647);
     }
     CAList.push_back(ConstantStruct::get(CSVals));
   }


Index: llvm/lib/Transforms/IPO/IndMemRemoval.cpp
diff -u llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.9 llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.10
--- llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.9	Tue Dec 19 16:09:18 2006
+++ llvm/lib/Transforms/IPO/IndMemRemoval.cpp	Sat Dec 30 23:48:39 2006
@@ -66,8 +66,8 @@
 				  "malloc_llvm_bounce", &M);
       BasicBlock* bb = new BasicBlock("entry",FN);
       Instruction* c = CastInst::createIntegerCast(
-          FN->arg_begin(), Type::UIntTy, false, "c", bb);
-      Instruction* a = new MallocInst(Type::SByteTy, c, "m", bb);
+          FN->arg_begin(), Type::Int32Ty, false, "c", bb);
+      Instruction* a = new MallocInst(Type::Int8Ty, c, "m", bb);
       new ReturnInst(a, bb);
       ++NumBounce;
       NumBounceSites += F->getNumUses();


Index: llvm/lib/Transforms/IPO/LowerSetJmp.cpp
diff -u llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.34 llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.35
--- llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.34	Tue Dec 19 16:09:18 2006
+++ llvm/lib/Transforms/IPO/LowerSetJmp.cpp	Sat Dec 30 23:48:39 2006
@@ -193,7 +193,7 @@
 // This function is always successful, unless it isn't.
 bool LowerSetJmp::doInitialization(Module& M)
 {
-  const Type *SBPTy = PointerType::get(Type::SByteTy);
+  const Type *SBPTy = PointerType::get(Type::Int8Ty);
   const Type *SBPPTy = PointerType::get(SBPTy);
 
   // N.B. See llvm/runtime/GCCLibraries/libexception/SJLJ-Exception.h for
@@ -209,17 +209,17 @@
   // void __llvm_sjljeh_add_setjmp_to_map(void**, void*, unsigned)
   AddSJToMap = M.getOrInsertFunction("__llvm_sjljeh_add_setjmp_to_map",
                                      Type::VoidTy, SBPPTy, SBPTy,
-                                     Type::UIntTy, (Type *)0);
+                                     Type::Int32Ty, (Type *)0);
 
   // void __llvm_sjljeh_throw_longjmp(int*, int)
   ThrowLongJmp = M.getOrInsertFunction("__llvm_sjljeh_throw_longjmp",
-                                       Type::VoidTy, SBPTy, Type::IntTy,
+                                       Type::VoidTy, SBPTy, Type::Int32Ty,
                                        (Type *)0);
 
   // unsigned __llvm_sjljeh_try_catching_longjmp_exception(void **)
   TryCatchLJ =
     M.getOrInsertFunction("__llvm_sjljeh_try_catching_longjmp_exception",
-                          Type::UIntTy, SBPPTy, (Type *)0);
+                          Type::Int32Ty, SBPPTy, (Type *)0);
 
   // bool __llvm_sjljeh_is_longjmp_exception()
   IsLJException = M.getOrInsertFunction("__llvm_sjljeh_is_longjmp_exception",
@@ -227,7 +227,7 @@
 
   // int __llvm_sjljeh_get_longjmp_value()
   GetLJValue = M.getOrInsertFunction("__llvm_sjljeh_get_longjmp_value",
-                                     Type::IntTy, (Type *)0);
+                                     Type::Int32Ty, (Type *)0);
   return true;
 }
 
@@ -250,7 +250,7 @@
 // throwing the exception for us.
 void LowerSetJmp::TransformLongJmpCall(CallInst* Inst)
 {
-  const Type* SBPTy = PointerType::get(Type::SByteTy);
+  const Type* SBPTy = PointerType::get(Type::Int8Ty);
 
   // Create the call to "__llvm_sjljeh_throw_longjmp". This takes the
   // same parameters as "longjmp", except that the buffer is cast to a
@@ -300,7 +300,7 @@
   assert(Inst && "Couldn't find even ONE instruction in entry block!");
 
   // Fill in the alloca and call to initialize the SJ map.
-  const Type *SBPTy = PointerType::get(Type::SByteTy);
+  const Type *SBPTy = PointerType::get(Type::Int8Ty);
   AllocaInst* Map = new AllocaInst(SBPTy, 0, "SJMap", Inst);
   new CallInst(InitSJMap, make_vector<Value*>(Map, 0), "", Inst);
   return SJMap[Func] = Map;
@@ -372,12 +372,12 @@
   Function* Func = ABlock->getParent();
 
   // Add this setjmp to the setjmp map.
-  const Type* SBPTy = PointerType::get(Type::SByteTy);
+  const Type* SBPTy = PointerType::get(Type::Int8Ty);
   CastInst* BufPtr = 
     new BitCastInst(Inst->getOperand(1), SBPTy, "SBJmpBuf", Inst);
   new CallInst(AddSJToMap,
                make_vector<Value*>(GetSetJmpMap(Func), BufPtr,
-                                   ConstantInt::get(Type::UIntTy,
+                                   ConstantInt::get(Type::Int32Ty,
                                                      SetJmpIDMap[Func]++), 0),
                "", Inst);
 
@@ -421,14 +421,14 @@
 
   // This PHI node will be in the new block created from the
   // splitBasicBlock call.
-  PHINode* PHI = new PHINode(Type::IntTy, "SetJmpReturn", Inst);
+  PHINode* PHI = new PHINode(Type::Int32Ty, "SetJmpReturn", Inst);
 
   // Coming from a call to setjmp, the return is 0.
-  PHI->addIncoming(ConstantInt::getNullValue(Type::IntTy), ABlock);
+  PHI->addIncoming(ConstantInt::getNullValue(Type::Int32Ty), ABlock);
 
   // Add the case for this setjmp's number...
   SwitchValuePair SVP = GetSJSwitch(Func, GetRethrowBB(Func));
-  SVP.first->addCase(ConstantInt::get(Type::UIntTy, SetJmpIDMap[Func] - 1),
+  SVP.first->addCase(ConstantInt::get(Type::Int32Ty, SetJmpIDMap[Func] - 1),
                      SetJmpContBlock);
 
   // Value coming from the handling of the exception.


Index: llvm/lib/Transforms/IPO/RaiseAllocations.cpp
diff -u llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.34 llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.35
--- llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.34	Tue Dec 19 16:09:18 2006
+++ llvm/lib/Transforms/IPO/RaiseAllocations.cpp	Sat Dec 30 23:48:39 2006
@@ -66,12 +66,12 @@
 //
 void RaiseAllocations::doInitialization(Module &M) {
   const FunctionType *MallocType =   // Get the type for malloc
-    FunctionType::get(PointerType::get(Type::SByteTy),
-                    std::vector<const Type*>(1, Type::ULongTy), false);
+    FunctionType::get(PointerType::get(Type::Int8Ty),
+                    std::vector<const Type*>(1, Type::Int64Ty), false);
 
   const FunctionType *FreeType =     // Get the type for free
     FunctionType::get(Type::VoidTy,
-                   std::vector<const Type*>(1, PointerType::get(Type::SByteTy)),
+                   std::vector<const Type*>(1, PointerType::get(Type::Int8Ty)),
                       false);
 
   // Get Malloc and free prototypes if they exist!
@@ -81,15 +81,15 @@
   // Check to see if the prototype is wrong, giving us sbyte*(uint) * malloc
   // This handles the common declaration of: 'void *malloc(unsigned);'
   if (MallocFunc == 0) {
-    MallocType = FunctionType::get(PointerType::get(Type::SByteTy),
-                            std::vector<const Type*>(1, Type::UIntTy), false);
+    MallocType = FunctionType::get(PointerType::get(Type::Int8Ty),
+                            std::vector<const Type*>(1, Type::Int32Ty), false);
     MallocFunc = M.getFunction("malloc", MallocType);
   }
 
   // Check to see if the prototype is missing, giving us sbyte*(...) * malloc
   // This handles the common declaration of: 'void *malloc();'
   if (MallocFunc == 0) {
-    MallocType = FunctionType::get(PointerType::get(Type::SByteTy),
+    MallocType = FunctionType::get(PointerType::get(Type::Int8Ty),
                                    std::vector<const Type*>(), true);
     MallocFunc = M.getFunction("malloc", MallocType);
   }
@@ -104,7 +104,7 @@
   // One last try, check to see if we can find free as 'int (...)* free'.  This
   // handles the case where NOTHING was declared.
   if (FreeFunc == 0) {
-    FreeType = FunctionType::get(Type::IntTy, std::vector<const Type*>(),true);
+    FreeType = FunctionType::get(Type::Int32Ty, std::vector<const Type*>(),true);
     FreeFunc = M.getFunction("free", FreeType);
   }
 
@@ -140,13 +140,13 @@
 
           // If no prototype was provided for malloc, we may need to cast the
           // source size.
-          if (Source->getType() != Type::UIntTy)
+          if (Source->getType() != Type::Int32Ty)
             Source = 
-              CastInst::createIntegerCast(Source, Type::UIntTy, false/*ZExt*/,
+              CastInst::createIntegerCast(Source, Type::Int32Ty, false/*ZExt*/,
                                           "MallocAmtCast", I);
 
           std::string Name(I->getName()); I->setName("");
-          MallocInst *MI = new MallocInst(Type::SByteTy, Source, Name, I);
+          MallocInst *MI = new MallocInst(Type::Int8Ty, Source, Name, I);
           I->replaceAllUsesWith(MI);
 
           // If the old instruction was an invoke, add an unconditional branch
@@ -194,7 +194,7 @@
           //
           Value *Source = *CS.arg_begin();
           if (!isa<PointerType>(Source->getType()))
-            Source = new IntToPtrInst(Source, PointerType::get(Type::SByteTy), 
+            Source = new IntToPtrInst(Source, PointerType::get(Type::Int8Ty), 
                                       "FreePtrCast", I);
           new FreeInst(Source, I);
 


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.80 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.81
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.80	Sat Dec 23 00:05:41 2006
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp	Sat Dec 30 23:48:39 2006
@@ -224,16 +224,16 @@
   /// @brief Return a Function* for the putchar libcall
   Function* get_putchar() {
     if (!putchar_func)
-      putchar_func = M->getOrInsertFunction("putchar", Type::IntTy, Type::IntTy,
-                                            NULL);
+      putchar_func = 
+        M->getOrInsertFunction("putchar", Type::Int32Ty, Type::Int32Ty, NULL);
     return putchar_func;
   }
 
   /// @brief Return a Function* for the puts libcall
   Function* get_puts() {
     if (!puts_func)
-      puts_func = M->getOrInsertFunction("puts", Type::IntTy,
-                                         PointerType::get(Type::SByteTy),
+      puts_func = M->getOrInsertFunction("puts", Type::Int32Ty,
+                                         PointerType::get(Type::Int8Ty),
                                          NULL);
     return puts_func;
   }
@@ -241,7 +241,7 @@
   /// @brief Return a Function* for the fputc libcall
   Function* get_fputc(const Type* FILEptr_type) {
     if (!fputc_func)
-      fputc_func = M->getOrInsertFunction("fputc", Type::IntTy, Type::IntTy,
+      fputc_func = M->getOrInsertFunction("fputc", Type::Int32Ty, Type::Int32Ty,
                                           FILEptr_type, NULL);
     return fputc_func;
   }
@@ -249,8 +249,8 @@
   /// @brief Return a Function* for the fputs libcall
   Function* get_fputs(const Type* FILEptr_type) {
     if (!fputs_func)
-      fputs_func = M->getOrInsertFunction("fputs", Type::IntTy,
-                                          PointerType::get(Type::SByteTy),
+      fputs_func = M->getOrInsertFunction("fputs", Type::Int32Ty,
+                                          PointerType::get(Type::Int8Ty),
                                           FILEptr_type, NULL);
     return fputs_func;
   }
@@ -259,7 +259,7 @@
   Function* get_fwrite(const Type* FILEptr_type) {
     if (!fwrite_func)
       fwrite_func = M->getOrInsertFunction("fwrite", TD->getIntPtrType(),
-                                           PointerType::get(Type::SByteTy),
+                                           PointerType::get(Type::Int8Ty),
                                            TD->getIntPtrType(),
                                            TD->getIntPtrType(),
                                            FILEptr_type, NULL);
@@ -278,9 +278,9 @@
   Function* get_strcpy() {
     if (!strcpy_func)
       strcpy_func = M->getOrInsertFunction("strcpy",
-                                           PointerType::get(Type::SByteTy),
-                                           PointerType::get(Type::SByteTy),
-                                           PointerType::get(Type::SByteTy),
+                                           PointerType::get(Type::Int8Ty),
+                                           PointerType::get(Type::Int8Ty),
+                                           PointerType::get(Type::Int8Ty),
                                            NULL);
     return strcpy_func;
   }
@@ -289,7 +289,7 @@
   Function* get_strlen() {
     if (!strlen_func)
       strlen_func = M->getOrInsertFunction("strlen", TD->getIntPtrType(),
-                                           PointerType::get(Type::SByteTy),
+                                           PointerType::get(Type::Int8Ty),
                                            NULL);
     return strlen_func;
   }
@@ -298,9 +298,9 @@
   Function* get_memchr() {
     if (!memchr_func)
       memchr_func = M->getOrInsertFunction("memchr",
-                                           PointerType::get(Type::SByteTy),
-                                           PointerType::get(Type::SByteTy),
-                                           Type::IntTy, TD->getIntPtrType(),
+                                           PointerType::get(Type::Int8Ty),
+                                           PointerType::get(Type::Int8Ty),
+                                           Type::Int32Ty, TD->getIntPtrType(),
                                            NULL);
     return memchr_func;
   }
@@ -308,11 +308,11 @@
   /// @brief Return a Function* for the memcpy libcall
   Function* get_memcpy() {
     if (!memcpy_func) {
-      const Type *SBP = PointerType::get(Type::SByteTy);
-      const char *N = TD->getIntPtrType() == Type::UIntTy ?
+      const Type *SBP = PointerType::get(Type::Int8Ty);
+      const char *N = TD->getIntPtrType() == Type::Int32Ty ?
                             "llvm.memcpy.i32" : "llvm.memcpy.i64";
       memcpy_func = M->getOrInsertFunction(N, Type::VoidTy, SBP, SBP,
-                                           TD->getIntPtrType(), Type::UIntTy,
+                                           TD->getIntPtrType(), Type::Int32Ty,
                                            NULL);
     }
     return memcpy_func;
@@ -457,12 +457,12 @@
 
   /// @brief Make sure that the "strcat" function has the right prototype
   virtual bool ValidateCalledFunction(const Function* f, SimplifyLibCalls& SLC){
-    if (f->getReturnType() == PointerType::get(Type::SByteTy))
+    if (f->getReturnType() == PointerType::get(Type::Int8Ty))
       if (f->arg_size() == 2)
       {
         Function::const_arg_iterator AI = f->arg_begin();
-        if (AI++->getType() == PointerType::get(Type::SByteTy))
-          if (AI->getType() == PointerType::get(Type::SByteTy))
+        if (AI++->getType() == PointerType::get(Type::Int8Ty))
+          if (AI->getType() == PointerType::get(Type::Int8Ty))
           {
             // Indicate this is a suitable call type.
             return true;
@@ -516,7 +516,7 @@
     vals.push_back(gep); // destination
     vals.push_back(ci->getOperand(2)); // source
     vals.push_back(ConstantInt::get(SLC.getIntPtrType(),len)); // length
-    vals.push_back(ConstantInt::get(Type::UIntTy,1)); // alignment
+    vals.push_back(ConstantInt::get(Type::Int32Ty,1)); // alignment
     new CallInst(SLC.get_memcpy(), vals, "", ci);
 
     // Finally, substitute the first operand of the strcat call for the
@@ -539,7 +539,7 @@
 
   /// @brief Make sure that the "strchr" function has the right prototype
   virtual bool ValidateCalledFunction(const Function* f, SimplifyLibCalls& SLC){
-    if (f->getReturnType() == PointerType::get(Type::SByteTy) &&
+    if (f->getReturnType() == PointerType::get(Type::Int8Ty) &&
         f->arg_size() == 2)
       return true;
     return false;
@@ -555,21 +555,21 @@
     // If it is, get the length and data, otherwise return false.
     uint64_t len = 0;
     ConstantArray* CA = 0;
-    if (!getConstantStringLength(ci->getOperand(1),len,&CA))
+    if (!getConstantStringLength(ci->getOperand(1), len, &CA))
       return false;
 
     // Check that the second argument to strchr is a constant int. If it isn't
     // a constant signed integer, we can try an alternate optimization
     ConstantInt* CSI = dyn_cast<ConstantInt>(ci->getOperand(2));
-    if (!CSI || CSI->getType()->isUnsigned() ) {
+    if (!CSI) {
       // The second operand is not constant, or not signed. Just lower this to 
       // memchr since we know the length of the string since it is constant.
       Function* f = SLC.get_memchr();
       std::vector<Value*> args;
       args.push_back(ci->getOperand(1));
       args.push_back(ci->getOperand(2));
-      args.push_back(ConstantInt::get(SLC.getIntPtrType(),len));
-      ci->replaceAllUsesWith( new CallInst(f,args,ci->getName(),ci));
+      args.push_back(ConstantInt::get(SLC.getIntPtrType(), len));
+      ci->replaceAllUsesWith( new CallInst(f, args, ci->getName(), ci));
       ci->eraseFromParent();
       return true;
     }
@@ -597,13 +597,13 @@
     //    (if c is a constant integer and s is a constant string)
     if (char_found) {
       std::vector<Value*> indices;
-      indices.push_back(ConstantInt::get(Type::ULongTy,offset));
+      indices.push_back(ConstantInt::get(Type::Int64Ty,offset));
       GetElementPtrInst* GEP = new GetElementPtrInst(ci->getOperand(1),indices,
           ci->getOperand(1)->getName()+".strchr",ci);
       ci->replaceAllUsesWith(GEP);
     } else {
       ci->replaceAllUsesWith(
-          ConstantPointerNull::get(PointerType::get(Type::SByteTy)));
+          ConstantPointerNull::get(PointerType::get(Type::Int8Ty)));
     }
     ci->eraseFromParent();
     return true;
@@ -621,7 +621,7 @@
 
   /// @brief Make sure that the "strcmp" function has the right prototype
   virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls &SLC){
-    return F->getReturnType() == Type::IntTy && F->arg_size() == 2;
+    return F->getReturnType() == Type::Int32Ty && F->arg_size() == 2;
   }
 
   /// @brief Perform the strcmp optimization
@@ -633,7 +633,7 @@
     Value* s2 = ci->getOperand(2);
     if (s1 == s2) {
       // strcmp(x,x)  -> 0
-      ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,0));
+      ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,0));
       ci->eraseFromParent();
       return true;
     }
@@ -648,7 +648,7 @@
         LoadInst* load =
           new LoadInst(CastToCStr(s2,*ci), ci->getName()+".load",ci);
         CastInst* cast =
-          CastInst::create(Instruction::SExt, load, Type::IntTy, 
+          CastInst::create(Instruction::SExt, load, Type::Int32Ty, 
                            ci->getName()+".int", ci);
         ci->replaceAllUsesWith(cast);
         ci->eraseFromParent();
@@ -666,7 +666,7 @@
         LoadInst* load =
           new LoadInst(CastToCStr(s1,*ci),ci->getName()+".val",ci);
         CastInst* cast =
-          CastInst::create(Instruction::SExt, load, Type::IntTy, 
+          CastInst::create(Instruction::SExt, load, Type::Int32Ty, 
                            ci->getName()+".int", ci);
         ci->replaceAllUsesWith(cast);
         ci->eraseFromParent();
@@ -679,7 +679,7 @@
       std::string str1 = A1->getAsString();
       std::string str2 = A2->getAsString();
       int result = strcmp(str1.c_str(), str2.c_str());
-      ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,result));
+      ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,result));
       ci->eraseFromParent();
       return true;
     }
@@ -698,7 +698,7 @@
 
   /// @brief Make sure that the "strncmp" function has the right prototype
   virtual bool ValidateCalledFunction(const Function* f, SimplifyLibCalls& SLC){
-    if (f->getReturnType() == Type::IntTy && f->arg_size() == 3)
+    if (f->getReturnType() == Type::Int32Ty && f->arg_size() == 3)
       return true;
     return false;
   }
@@ -712,7 +712,7 @@
     Value* s2 = ci->getOperand(2);
     if (s1 == s2) {
       // strncmp(x,x,l)  -> 0
-      ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,0));
+      ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,0));
       ci->eraseFromParent();
       return true;
     }
@@ -726,7 +726,7 @@
       len_arg = len_CI->getZExtValue();
       if (len_arg == 0) {
         // strncmp(x,y,0)   -> 0
-        ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,0));
+        ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,0));
         ci->eraseFromParent();
         return true;
       }
@@ -741,7 +741,7 @@
         // strncmp("",x) -> *x
         LoadInst* load = new LoadInst(s1,ci->getName()+".load",ci);
         CastInst* cast =
-          CastInst::create(Instruction::SExt, load, Type::IntTy, 
+          CastInst::create(Instruction::SExt, load, Type::Int32Ty, 
                            ci->getName()+".int", ci);
         ci->replaceAllUsesWith(cast);
         ci->eraseFromParent();
@@ -758,7 +758,7 @@
         // strncmp(x,"") -> *x
         LoadInst* load = new LoadInst(s2,ci->getName()+".val",ci);
         CastInst* cast =
-          CastInst::create(Instruction::SExt, load, Type::IntTy, 
+          CastInst::create(Instruction::SExt, load, Type::Int32Ty, 
                            ci->getName()+".int", ci);
         ci->replaceAllUsesWith(cast);
         ci->eraseFromParent();
@@ -771,7 +771,7 @@
       std::string str1 = A1->getAsString();
       std::string str2 = A2->getAsString();
       int result = strncmp(str1.c_str(), str2.c_str(), len_arg);
-      ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,result));
+      ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,result));
       ci->eraseFromParent();
       return true;
     }
@@ -791,11 +791,11 @@
 
   /// @brief Make sure that the "strcpy" function has the right prototype
   virtual bool ValidateCalledFunction(const Function* f, SimplifyLibCalls& SLC){
-    if (f->getReturnType() == PointerType::get(Type::SByteTy))
+    if (f->getReturnType() == PointerType::get(Type::Int8Ty))
       if (f->arg_size() == 2) {
         Function::const_arg_iterator AI = f->arg_begin();
-        if (AI++->getType() == PointerType::get(Type::SByteTy))
-          if (AI->getType() == PointerType::get(Type::SByteTy)) {
+        if (AI++->getType() == PointerType::get(Type::Int8Ty))
+          if (AI->getType() == PointerType::get(Type::Int8Ty)) {
             // Indicate this is a suitable call type.
             return true;
           }
@@ -830,7 +830,7 @@
     // If the constant string's length is zero we can optimize this by just
     // doing a store of 0 at the first byte of the destination
     if (len == 0) {
-      new StoreInst(ConstantInt::get(Type::SByteTy,0),ci->getOperand(1),ci);
+      new StoreInst(ConstantInt::get(Type::Int8Ty,0),ci->getOperand(1),ci);
       ci->replaceAllUsesWith(dest);
       ci->eraseFromParent();
       return true;
@@ -846,7 +846,7 @@
     vals.push_back(dest); // destination
     vals.push_back(src); // source
     vals.push_back(ConstantInt::get(SLC.getIntPtrType(),len)); // length
-    vals.push_back(ConstantInt::get(Type::UIntTy,1)); // alignment
+    vals.push_back(ConstantInt::get(Type::Int32Ty,1)); // alignment
     new CallInst(SLC.get_memcpy(), vals, "", ci);
 
     // Finally, substitute the first operand of the strcat call for the
@@ -872,7 +872,7 @@
     if (f->getReturnType() == SLC.getTargetData()->getIntPtrType())
       if (f->arg_size() == 1)
         if (Function::const_arg_iterator AI = f->arg_begin())
-          if (AI->getType() == PointerType::get(Type::SByteTy))
+          if (AI->getType() == PointerType::get(Type::Int8Ty))
             return true;
     return false;
   }
@@ -882,7 +882,7 @@
   {
     // Make sure we're dealing with an sbyte* here.
     Value* str = ci->getOperand(1);
-    if (str->getType() != PointerType::get(Type::SByteTy))
+    if (str->getType() != PointerType::get(Type::Int8Ty))
       return false;
 
     // Does the call to strlen have exactly one use?
@@ -904,7 +904,7 @@
             // strlen(x) == 0 -> *x == 0
             LoadInst* load = new LoadInst(str,str->getName()+".first",ci);
             ICmpInst* rbop = new ICmpInst(bop->getPredicate(), load, 
-                                          ConstantInt::get(Type::SByteTy,0),
+                                          ConstantInt::get(Type::Int8Ty,0),
                                           bop->getName()+".strlen", ci);
             bop->replaceAllUsesWith(rbop);
             bop->eraseFromParent();
@@ -996,7 +996,7 @@
       return true;
     case 1: {
       // memcmp(S1,S2,1) -> *(ubyte*)S1 - *(ubyte*)S2
-      const Type *UCharPtr = PointerType::get(Type::UByteTy);
+      const Type *UCharPtr = PointerType::get(Type::Int8Ty);
       CastInst *Op1Cast = CastInst::create(
           Instruction::BitCast, LHS, UCharPtr, LHS->getName(), CI);
       CastInst *Op2Cast = CastInst::create(
@@ -1016,7 +1016,7 @@
         // TODO: IF both are aligned, use a short load/compare.
       
         // memcmp(S1,S2,2) -> S1[0]-S2[0] | S1[1]-S2[1] iff only ==/!= 0 matters
-        const Type *UCharPtr = PointerType::get(Type::UByteTy);
+        const Type *UCharPtr = PointerType::get(Type::Int8Ty);
         CastInst *Op1Cast = CastInst::create(
             Instruction::BitCast, LHS, UCharPtr, LHS->getName(), CI);
         CastInst *Op2Cast = CastInst::create(
@@ -1025,7 +1025,7 @@
         Value *S2V1 = new LoadInst(Op2Cast, RHS->getName()+".val1", CI);
         Value *D1 = BinaryOperator::createSub(S1V1, S2V1,
                                               CI->getName()+".d1", CI);
-        Constant *One = ConstantInt::get(Type::IntTy, 1);
+        Constant *One = ConstantInt::get(Type::Int32Ty, 1);
         Value *G1 = new GetElementPtrInst(Op1Cast, One, "next1v", CI);
         Value *G2 = new GetElementPtrInst(Op2Cast, One, "next2v", CI);
         Value *S1V2 = new LoadInst(G1, LHS->getName()+".val2", CI);
@@ -1098,10 +1098,10 @@
         // memcpy(d,s,0,a) -> noop
         ci->eraseFromParent();
         return true;
-      case 1: castType = Type::SByteTy; break;
-      case 2: castType = Type::ShortTy; break;
-      case 4: castType = Type::IntTy; break;
-      case 8: castType = Type::LongTy; break;
+      case 1: castType = Type::Int8Ty; break;
+      case 2: castType = Type::Int16Ty; break;
+      case 4: castType = Type::Int32Ty; break;
+      case 8: castType = Type::Int64Ty; break;
       default:
         return false;
     }
@@ -1183,7 +1183,7 @@
     ConstantInt* FILL = dyn_cast<ConstantInt>(ci->getOperand(2));
     if (!FILL)
       return false;
-    if (FILL->getType() != Type::UByteTy)
+    if (FILL->getType() != Type::Int8Ty)
       return false;
 
     // memset(s,c,n) -> store s, c (for n=1,2,4,8)
@@ -1198,18 +1198,18 @@
     Type* castType = 0;
     switch (len) {
       case 1:
-        castType = Type::UByteTy;
+        castType = Type::Int8Ty;
         break;
       case 2:
-        castType = Type::UShortTy;
+        castType = Type::Int16Ty;
         fill_value |= fill_char << 8;
         break;
       case 4:
-        castType = Type::UIntTy;
+        castType = Type::Int32Ty;
         fill_value |= fill_char << 8 | fill_char << 16 | fill_char << 24;
         break;
       case 8:
-        castType = Type::ULongTy;
+        castType = Type::Int64Ty;
         fill_value |= fill_char << 8 | fill_char << 16 | fill_char << 24;
         fill_value |= fill_char << 32 | fill_char << 40 | fill_char << 48;
         fill_value |= fill_char << 56;
@@ -1350,7 +1350,7 @@
         std::vector<Value*> args;
         args.push_back(CastToCStr(ci->getOperand(2), *ci));
         new CallInst(puts_func,args,ci->getName(),ci);
-        ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,len));
+        ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,len));
         break;
       }
       case 'c':
@@ -1363,9 +1363,9 @@
         if (!putchar_func)
           return false;
         CastInst* cast = CastInst::createSExtOrBitCast(
-            ci->getOperand(2), Type::IntTy, CI->getName()+".int", ci);
+            ci->getOperand(2), Type::Int32Ty, CI->getName()+".int", ci);
         new CallInst(putchar_func, cast, "", ci);
-        ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy, 1));
+        ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty, 1));
         break;
       }
       default:
@@ -1440,7 +1440,7 @@
       args.push_back(ConstantInt::get(SLC.getIntPtrType(),1));
       args.push_back(ci->getOperand(1));
       new CallInst(fwrite_func,args,ci->getName(),ci);
-      ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,len));
+      ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,len));
       ci->eraseFromParent();
       return true;
     }
@@ -1474,7 +1474,7 @@
           args.push_back(ConstantInt::get(SLC.getIntPtrType(),1));
           args.push_back(ci->getOperand(1));
           new CallInst(fwrite_func,args,ci->getName(),ci);
-          ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,len));
+          ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,len));
         } else {
           // fprintf(file,"%s",str) -> fputs(str,file)
           const Type* FILEptr_type = ci->getOperand(1)->getType();
@@ -1485,7 +1485,7 @@
           args.push_back(CastToCStr(ci->getOperand(3), *ci));
           args.push_back(ci->getOperand(1));
           new CallInst(fputs_func,args,ci->getName(),ci);
-          ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,len));
+          ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,len));
         }
         break;
       }
@@ -1497,9 +1497,9 @@
         if (!fputc_func)
           return false;
         CastInst* cast = CastInst::createSExtOrBitCast(
-            ci->getOperand(3), Type::IntTy, CI->getName()+".int", ci);
+            ci->getOperand(3), Type::Int32Ty, CI->getName()+".int", ci);
         new CallInst(fputc_func,cast,ci->getOperand(1),"",ci);
-        ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,1));
+        ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,1));
         break;
       }
       default:
@@ -1523,7 +1523,7 @@
   /// @brief Make sure that the "fprintf" function has the right prototype
   virtual bool ValidateCalledFunction(const Function *f, SimplifyLibCalls &SLC){
     // Just make sure this has at least 2 arguments
-    return (f->getReturnType() == Type::IntTy && f->arg_size() >= 2);
+    return (f->getReturnType() == Type::Int32Ty && f->arg_size() >= 2);
   }
 
   /// @brief Perform the sprintf optimization.
@@ -1542,8 +1542,8 @@
     if (ci->getNumOperands() == 3) {
       if (len == 0) {
         // If the length is 0, we just need to store a null byte
-        new StoreInst(ConstantInt::get(Type::SByteTy,0),ci->getOperand(1),ci);
-        ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,0));
+        new StoreInst(ConstantInt::get(Type::Int8Ty,0),ci->getOperand(1),ci);
+        ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,0));
         ci->eraseFromParent();
         return true;
       }
@@ -1570,9 +1570,9 @@
       args.push_back(ci->getOperand(1));
       args.push_back(ci->getOperand(2));
       args.push_back(ConstantInt::get(SLC.getIntPtrType(),len));
-      args.push_back(ConstantInt::get(Type::UIntTy,1));
+      args.push_back(ConstantInt::get(Type::Int32Ty,1));
       new CallInst(memcpy_func,args,"",ci);
-      ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,len));
+      ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,len));
       ci->eraseFromParent();
       return true;
     }
@@ -1609,7 +1609,7 @@
       args.push_back(CastToCStr(ci->getOperand(1), *ci));
       args.push_back(CastToCStr(ci->getOperand(3), *ci));
       args.push_back(Len1);
-      args.push_back(ConstantInt::get(Type::UIntTy,1));
+      args.push_back(ConstantInt::get(Type::Int32Ty,1));
       new CallInst(memcpy_func, args, "", ci);
       
       // The strlen result is the unincremented number of bytes in the string.
@@ -1625,13 +1625,13 @@
     case 'c': {
       // sprintf(dest,"%c",chr) -> store chr, dest
       CastInst* cast = CastInst::createTruncOrBitCast(
-          ci->getOperand(3), Type::SByteTy, "char", ci);
+          ci->getOperand(3), Type::Int8Ty, "char", ci);
       new StoreInst(cast, ci->getOperand(1), ci);
       GetElementPtrInst* gep = new GetElementPtrInst(ci->getOperand(1),
-        ConstantInt::get(Type::UIntTy,1),ci->getOperand(1)->getName()+".end",
+        ConstantInt::get(Type::Int32Ty,1),ci->getOperand(1)->getName()+".end",
         ci);
-      new StoreInst(ConstantInt::get(Type::SByteTy,0),gep,ci);
-      ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,1));
+      new StoreInst(ConstantInt::get(Type::Int8Ty,0),gep,ci);
+      ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,1));
       ci->eraseFromParent();
       return true;
     }
@@ -1681,7 +1681,7 @@
           return false;
         LoadInst* loadi = new LoadInst(ci->getOperand(1),
           ci->getOperand(1)->getName()+".byte",ci);
-        CastInst* casti = new SExtInst(loadi, Type::IntTy, 
+        CastInst* casti = new SExtInst(loadi, Type::Int32Ty, 
                                        loadi->getName()+".int", ci);
         new CallInst(fputc_func,casti,ci->getOperand(2),"",ci);
         break;
@@ -1727,23 +1727,23 @@
       // isdigit(c)   -> 0 or 1, if 'c' is constant
       uint64_t val = CI->getZExtValue();
       if (val >= '0' && val <='9')
-        ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,1));
+        ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,1));
       else
-        ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,0));
+        ci->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,0));
       ci->eraseFromParent();
       return true;
     }
 
     // isdigit(c)   -> (unsigned)c - '0' <= 9
     CastInst* cast = CastInst::createIntegerCast(ci->getOperand(1),
-        Type::UIntTy, false/*ZExt*/, ci->getOperand(1)->getName()+".uint", ci);
+        Type::Int32Ty, false/*ZExt*/, ci->getOperand(1)->getName()+".uint", ci);
     BinaryOperator* sub_inst = BinaryOperator::createSub(cast,
-        ConstantInt::get(Type::UIntTy,0x30),
+        ConstantInt::get(Type::Int32Ty,0x30),
         ci->getOperand(1)->getName()+".sub",ci);
     ICmpInst* setcond_inst = new ICmpInst(ICmpInst::ICMP_ULE,sub_inst,
-        ConstantInt::get(Type::UIntTy,9),
+        ConstantInt::get(Type::Int32Ty,9),
         ci->getOperand(1)->getName()+".cmp",ci);
-    CastInst* c2 = new ZExtInst(setcond_inst, Type::IntTy, 
+    CastInst* c2 = new ZExtInst(setcond_inst, Type::Int32Ty, 
         ci->getOperand(1)->getName()+".isdigit", ci);
     ci->replaceAllUsesWith(c2);
     ci->eraseFromParent();
@@ -1824,7 +1824,7 @@
   /// @brief Make sure that the "ffs" function has the right prototype
   virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls &SLC){
     // Just make sure this has 2 arguments
-    return F->arg_size() == 1 && F->getReturnType() == Type::IntTy;
+    return F->arg_size() == 1 && F->getReturnType() == Type::Int32Ty;
   }
 
   /// @brief Perform the ffs optimization.
@@ -1842,7 +1842,7 @@
           val >>= 1;
         }
       }
-      TheCall->replaceAllUsesWith(ConstantInt::get(Type::IntTy, result));
+      TheCall->replaceAllUsesWith(ConstantInt::get(Type::Int32Ty, result));
       TheCall->eraseFromParent();
       return true;
     }
@@ -1851,14 +1851,13 @@
     // ffsl(x)  -> x == 0 ? 0 : llvm.cttz(x)+1
     // ffsll(x) -> x == 0 ? 0 : llvm.cttz(x)+1
     const Type *ArgType = TheCall->getOperand(1)->getType();
-    ArgType = ArgType->getUnsignedVersion();
     const char *CTTZName;
     switch (ArgType->getTypeID()) {
     default: assert(0 && "Unknown unsigned type!");
-    case Type::UByteTyID : CTTZName = "llvm.cttz.i8" ; break;
-    case Type::UShortTyID: CTTZName = "llvm.cttz.i16"; break;
-    case Type::UIntTyID  : CTTZName = "llvm.cttz.i32"; break;
-    case Type::ULongTyID : CTTZName = "llvm.cttz.i64"; break;
+    case Type::Int8TyID : CTTZName = "llvm.cttz.i8" ; break;
+    case Type::Int16TyID: CTTZName = "llvm.cttz.i16"; break;
+    case Type::Int32TyID  : CTTZName = "llvm.cttz.i32"; break;
+    case Type::Int64TyID : CTTZName = "llvm.cttz.i64"; break;
     }
     
     Function *F = SLC.getModule()->getOrInsertFunction(CTTZName, ArgType,
@@ -1866,14 +1865,14 @@
     Value *V = CastInst::createIntegerCast(TheCall->getOperand(1), ArgType, 
                                            false/*ZExt*/, "tmp", TheCall);
     Value *V2 = new CallInst(F, V, "tmp", TheCall);
-    V2 = CastInst::createIntegerCast(V2, Type::IntTy, false/*ZExt*/, 
+    V2 = CastInst::createIntegerCast(V2, Type::Int32Ty, false/*ZExt*/, 
                                      "tmp", TheCall);
-    V2 = BinaryOperator::createAdd(V2, ConstantInt::get(Type::IntTy, 1),
+    V2 = BinaryOperator::createAdd(V2, ConstantInt::get(Type::Int32Ty, 1),
                                    "tmp", TheCall);
     Value *Cond = new ICmpInst(ICmpInst::ICMP_EQ, V, 
                                Constant::getNullValue(V->getType()), "tmp", 
                                TheCall);
-    V2 = new SelectInst(Cond, ConstantInt::get(Type::IntTy, 0), V2,
+    V2 = new SelectInst(Cond, ConstantInt::get(Type::Int32Ty, 0), V2,
                         TheCall->getName(), TheCall);
     TheCall->replaceAllUsesWith(V2);
     TheCall->eraseFromParent();
@@ -2112,7 +2111,7 @@
 Value *CastToCStr(Value *V, Instruction &IP) {
   assert(isa<PointerType>(V->getType()) && 
          "Can't cast non-pointer type to C string type");
-  const Type *SBPTy = PointerType::get(Type::SByteTy);
+  const Type *SBPTy = PointerType::get(Type::Int8Ty);
   if (V->getType() != SBPTy)
     return new BitCastInst(V, SBPTy, V->getName(), &IP);
   return V;






More information about the llvm-commits mailing list