aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp32
-rw-r--r--lib/Analysis/ConstantFolding.cpp1
-rw-r--r--lib/Analysis/ScalarEvolution.cpp56
-rw-r--r--lib/Transforms/ExprTypeConvert.cpp19
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp6
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp4
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp17
-rw-r--r--lib/Transforms/IPO/IndMemRemoval.cpp4
-rw-r--r--lib/Transforms/IPO/LowerSetJmp.cpp24
-rw-r--r--lib/Transforms/IPO/RaiseAllocations.cpp22
-rw-r--r--lib/Transforms/IPO/SimplifyLibCalls.cpp191
-rw-r--r--lib/Transforms/Instrumentation/BlockProfiling.cpp4
-rw-r--r--lib/Transforms/Instrumentation/EdgeProfiling.cpp2
-rw-r--r--lib/Transforms/Instrumentation/EmitFunctions.cpp8
-rw-r--r--lib/Transforms/Instrumentation/ProfilingUtils.cpp26
-rw-r--r--lib/Transforms/Instrumentation/RSProfiling.cpp16
-rw-r--r--lib/Transforms/Instrumentation/TraceBasicBlocks.cpp4
-rw-r--r--lib/Transforms/Instrumentation/TraceValues.cpp14
-rw-r--r--lib/Transforms/LevelRaise.cpp4
-rw-r--r--lib/Transforms/Scalar/CorrelatedExprs.cpp2
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp5
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp291
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp12
-rw-r--r--lib/Transforms/Scalar/LowerGC.cpp18
-rw-r--r--lib/Transforms/Scalar/LowerPacked.cpp14
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp43
-rw-r--r--lib/Transforms/TransformInternals.cpp8
-rw-r--r--lib/Transforms/Utils/CodeExtractor.cpp24
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp2
-rw-r--r--lib/Transforms/Utils/LowerAllocations.cpp6
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp38
-rw-r--r--lib/Transforms/Utils/LowerSwitch.cpp4
32 files changed, 400 insertions, 521 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index d37a4b176f..caabc86f3f 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -269,7 +269,7 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
if (V1 == V2) return MustAlias;
if ((!isa<PointerType>(V1->getType()) || !isa<PointerType>(V2->getType())) &&
- V1->getType() != Type::LongTy && V2->getType() != Type::LongTy)
+ V1->getType() != Type::Int64Ty && V2->getType() != Type::Int64Ty)
return NoAlias; // Scalars cannot alias each other
// Strip off cast instructions...
@@ -458,14 +458,10 @@ static bool IndexOperandsEqual(Value *V1, Value *V2) {
if (Constant *C1 = dyn_cast<Constant>(V1))
if (Constant *C2 = dyn_cast<Constant>(V2)) {
// Sign extend the constants to long types, if necessary
- if (C1->getType()->getPrimitiveSizeInBits() < 64)
- C1 = ConstantExpr::getSExt(C1, Type::LongTy);
- else if (C1->getType() == Type::ULongTy)
- C1 = ConstantExpr::getBitCast(C1, Type::LongTy);
- if (C2->getType()->getPrimitiveSizeInBits() < 64)
- C2 = ConstantExpr::getSExt(C2, Type::LongTy);
- else if (C2->getType() == Type::ULongTy)
- C2 = ConstantExpr::getBitCast(C2, Type::LongTy);
+ if (C1->getType() != Type::Int64Ty)
+ C1 = ConstantExpr::getSExt(C1, Type::Int64Ty);
+ if (C2->getType() != Type::Int64Ty)
+ C2 = ConstantExpr::getSExt(C2, Type::Int64Ty);
return C1 == C2;
}
return false;
@@ -554,14 +550,10 @@ BasicAliasAnalysis::CheckGEPInstructions(
if (Constant *G2OC = dyn_cast<ConstantInt>(const_cast<Value*>(G2Oper))){
if (G1OC->getType() != G2OC->getType()) {
// Sign extend both operands to long.
- if (G1OC->getType()->getPrimitiveSizeInBits() < 64)
- G1OC = ConstantExpr::getSExt(G1OC, Type::LongTy);
- else if (G1OC->getType() == Type::ULongTy)
- G1OC = ConstantExpr::getBitCast(G1OC, Type::LongTy);
- if (G2OC->getType()->getPrimitiveSizeInBits() < 64)
- G2OC = ConstantExpr::getSExt(G2OC, Type::LongTy);
- else if (G2OC->getType() == Type::ULongTy)
- G2OC = ConstantExpr::getBitCast(G2OC, Type::LongTy);
+ if (G1OC->getType() != Type::Int64Ty)
+ G1OC = ConstantExpr::getSExt(G1OC, Type::Int64Ty);
+ if (G2OC->getType() != Type::Int64Ty)
+ G2OC = ConstantExpr::getSExt(G2OC, Type::Int64Ty);
GEP1Ops[FirstConstantOper] = G1OC;
GEP2Ops[FirstConstantOper] = G2OC;
}
@@ -661,7 +653,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
const Type *ZeroIdxTy = GEPPointerTy;
for (unsigned i = 0; i != FirstConstantOper; ++i) {
if (!isa<StructType>(ZeroIdxTy))
- GEP1Ops[i] = GEP2Ops[i] = Constant::getNullValue(Type::UIntTy);
+ GEP1Ops[i] = GEP2Ops[i] = Constant::getNullValue(Type::Int32Ty);
if (const CompositeType *CT = dyn_cast<CompositeType>(ZeroIdxTy))
ZeroIdxTy = CT->getTypeAtIndex(GEP1Ops[i]);
@@ -702,9 +694,9 @@ BasicAliasAnalysis::CheckGEPInstructions(
// value possible.
//
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty))
- GEP1Ops[i] = ConstantInt::get(Type::LongTy, AT->getNumElements()-1);
+ GEP1Ops[i] = ConstantInt::get(Type::Int64Ty, AT->getNumElements()-1);
else if (const PackedType *PT = dyn_cast<PackedType>(BasePtr1Ty))
- GEP1Ops[i] = ConstantInt::get(Type::LongTy, PT->getNumElements()-1);
+ GEP1Ops[i] = ConstantInt::get(Type::Int64Ty, PT->getNumElements()-1);
}
}
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 359766d444..9f2be3e973 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -164,7 +164,6 @@ llvm::ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands) {
break;
}
} else if (ConstantInt *Op = dyn_cast<ConstantInt>(Operands[0])) {
- assert(Op->getType()->isUnsigned() && "bswap args must be unsigned");
uint64_t V = Op->getZExtValue();
if (Name == "llvm.bswap.i16")
return ConstantInt::get(Ty, ByteSwap_16(V));
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index fcfab9e1c9..a43b585d9a 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -123,7 +123,6 @@ void SCEV::dump() const {
ConstantRange SCEV::getValueRange() const {
const Type *Ty = getType();
assert(Ty->isInteger() && "Can't get range for a non-integer SCEV!");
- Ty = Ty->getUnsignedVersion();
// Default to a full range if no better information is available.
return ConstantRange(getType());
}
@@ -172,14 +171,6 @@ SCEVConstant::~SCEVConstant() {
}
SCEVHandle SCEVConstant::get(ConstantInt *V) {
- // Make sure that SCEVConstant instances are all unsigned.
- // FIXME:Signless. This entire if statement can be removed when integer types
- // are signless. There won't be a need to bitcast then.
- if (V->getType()->isSigned()) {
- const Type *NewTy = V->getType()->getUnsignedVersion();
- V = cast<ConstantInt>(ConstantExpr::getBitCast(V, NewTy));
- }
-
SCEVConstant *&R = (*SCEVConstants)[V];
if (R == 0) R = new SCEVConstant(V);
return R;
@@ -310,9 +301,7 @@ void SCEVSDivExpr::print(std::ostream &OS) const {
}
const Type *SCEVSDivExpr::getType() const {
- const Type *Ty = LHS->getType();
- if (Ty->isUnsigned()) Ty = Ty->getSignedVersion();
- return Ty;
+ return LHS->getType();
}
// SCEVAddRecExprs - Only allow the creation of one SCEVAddRecExpr for any
@@ -505,7 +494,7 @@ static SCEVHandle PartialFact(SCEVHandle V, unsigned NumSteps) {
uint64_t Result = 1;
for (; NumSteps; --NumSteps)
Result *= Val-(NumSteps-1);
- Constant *Res = ConstantInt::get(Type::ULongTy, Result);
+ Constant *Res = ConstantInt::get(Type::Int64Ty, Result);
return SCEVUnknown::get(ConstantExpr::getTruncOrBitCast(Res, V->getType()));
}
@@ -1427,15 +1416,13 @@ SCEVHandle ScalarEvolutionsImpl::createSCEV(Value *V) {
case Instruction::Trunc:
// We don't handle trunc to bool yet.
if (I->getType()->isInteger())
- return SCEVTruncateExpr::get(getSCEV(I->getOperand(0)),
- I->getType()->getUnsignedVersion());
+ return SCEVTruncateExpr::get(getSCEV(I->getOperand(0)), I->getType());
break;
case Instruction::ZExt:
// We don't handle zext from bool yet.
if (I->getOperand(0)->getType()->isInteger())
- return SCEVZeroExtendExpr::get(getSCEV(I->getOperand(0)),
- I->getType()->getUnsignedVersion());
+ return SCEVZeroExtendExpr::get(getSCEV(I->getOperand(0)), I->getType());
break;
case Instruction::BitCast:
@@ -1572,21 +1559,8 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) {
// Form the constant range.
ConstantRange CompRange(Cond, CompVal);
- // Now that we have it, if it's signed, convert it to an unsigned
- // range.
- // FIXME:Signless. This entire if statement can go away when
- // integers are signless. ConstantRange is already signless.
- if (CompRange.getLower()->getType()->isSigned()) {
- const Type *NewTy = RHSC->getValue()->getType();
- Constant *NewL = ConstantExpr::getBitCast(CompRange.getLower(),
- NewTy);
- Constant *NewU = ConstantExpr::getBitCast(CompRange.getUpper(),
- NewTy);
- CompRange = ConstantRange(NewL, NewU);
- }
-
SCEVHandle Ret = AddRec->getNumIterationsInRange(CompRange,
- ICmpInst::isSignedPredicate(Cond));
+ false /*Always treat as unsigned range*/);
if (!isa<SCEVCouldNotCompute>(Ret)) return Ret;
}
}
@@ -1723,7 +1697,7 @@ ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS,
unsigned MaxSteps = MaxBruteForceIterations;
for (unsigned IterationNum = 0; IterationNum != MaxSteps; ++IterationNum) {
ConstantInt *ItCst =
- ConstantInt::get(IdxExpr->getType()->getUnsignedVersion(), IterationNum);
+ ConstantInt::get(IdxExpr->getType(), IterationNum);
ConstantInt *Val = EvaluateConstantChrecAtConstant(IdxExpr, ItCst);
// Form the GEP offset.
@@ -1946,7 +1920,7 @@ ComputeIterationCountExhaustively(const Loop *L, Value *Cond, bool ExitWhen) {
if (CondVal->getValue() == ExitWhen) {
ConstantEvolutionLoopExitValue[PN] = PHIVal;
++NumBruteForceTripCountsComputed;
- return SCEVConstant::get(ConstantInt::get(Type::UIntTy, IterationNum));
+ return SCEVConstant::get(ConstantInt::get(Type::Int32Ty, IterationNum));
}
// Compute the value of the PHI node for the next iteration.
@@ -2129,10 +2103,7 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) {
SqrtTerm = ConstantExpr::getSub(ConstantExpr::getMul(B, B), SqrtTerm);
// Compute floor(sqrt(B^2-4ac))
- ConstantInt *SqrtVal =
- cast<ConstantInt>(ConstantExpr::getBitCast(SqrtTerm,
- SqrtTerm->getType()->getUnsignedVersion()));
- uint64_t SqrtValV = SqrtVal->getZExtValue();
+ uint64_t SqrtValV = cast<ConstantInt>(SqrtTerm)->getZExtValue();
uint64_t SqrtValV2 = (uint64_t)sqrt((double)SqrtValV);
// The square root might not be precise for arbitrary 64-bit integer
// values. Do some sanity checks to ensure it's correct.
@@ -2142,20 +2113,13 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) {
return std::make_pair(CNC, CNC);
}
- SqrtVal = ConstantInt::get(Type::ULongTy, SqrtValV2);
+ ConstantInt *SqrtVal = ConstantInt::get(Type::Int64Ty, SqrtValV2);
SqrtTerm = ConstantExpr::getTruncOrBitCast(SqrtVal, SqrtTerm->getType());
Constant *NegB = ConstantExpr::getNeg(B);
Constant *TwoA = ConstantExpr::getMul(A, Two);
// The divisions must be performed as signed divisions.
- // FIXME:Signedness. These casts can all go away once integer types are
- // signless.
- const Type *SignedTy = NegB->getType()->getSignedVersion();
- NegB = ConstantExpr::getBitCast(NegB, SignedTy);
- TwoA = ConstantExpr::getBitCast(TwoA, SignedTy);
- SqrtTerm = ConstantExpr::getBitCast(SqrtTerm, SignedTy);
-
Constant *Solution1 =
ConstantExpr::getSDiv(ConstantExpr::getAdd(NegB, SqrtTerm), TwoA);
Constant *Solution2 =
@@ -2222,7 +2186,6 @@ SCEVHandle ScalarEvolutionsImpl::HowFarToZero(SCEV *V, const Loop *L) {
<< " sol#2: " << *R2 << "\n";
#endif
// Pick the smallest positive root value.
- assert(R1->getType()->isUnsigned()&&"Didn't canonicalize to unsigned?");
if (ConstantBool *CB =
dyn_cast<ConstantBool>(ConstantExpr::getICmp(ICmpInst::ICMP_ULT,
R1->getValue(), R2->getValue()))) {
@@ -2448,7 +2411,6 @@ SCEVHandle SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range,
SCEVConstant *R2 = dyn_cast<SCEVConstant>(Roots.second);
if (R1) {
// Pick the smallest positive root value.
- assert(R1->getType()->isUnsigned() && "Didn't canonicalize to unsigned?");
if (ConstantBool *CB =
dyn_cast<ConstantBool>(ConstantExpr::getICmp(ICmpInst::ICMP_ULT,
R1->getValue(), R2->getValue()))) {
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index 5f6b6aebf9..9f99f95642 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -210,8 +210,9 @@ Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty,
Constant *CPV = cast<Constant>(V);
// Constants are converted by constant folding the cast that is required.
// We assume here that all casts are implemented for constant prop.
- Instruction::CastOps opcode = CastInst::getCastOpcode(CPV,
- CPV->getType()->isSigned(), Ty, Ty->isSigned());
+ // FIXME: This seems to work, but it is unclear why ZEXT is always the
+ // right choice here.
+ Instruction::CastOps opcode = CastInst::getCastOpcode(CPV, false, Ty,false);
Value *Result = ConstantExpr::getCast(opcode, CPV, Ty);
// Add the instruction to the expression map
//VMC.ExprMap[V] = Result;
@@ -231,7 +232,7 @@ Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty,
case Instruction::BitCast: {
assert(VMC.NewCasts.count(ValueHandle(VMC, I)) == 0);
Instruction::CastOps opcode = CastInst::getCastOpcode(I->getOperand(0),
- I->getOperand(0)->getType()->isSigned(), Ty, Ty->isSigned());
+ false, Ty, false);
Res = CastInst::create(opcode, I->getOperand(0), Ty, Name);
VMC.NewCasts.insert(ValueHandle(VMC, Res));
break;
@@ -473,8 +474,6 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
}
case Instruction::LShr:
case Instruction::AShr:
- if (Ty->isSigned() != V->getType()->isSigned()) return false;
- // FALL THROUGH
case Instruction::Shl:
if (I->getOperand(1) == V) return false; // Cannot change shift amount type
if (!Ty->isInteger()) return false;
@@ -713,8 +712,8 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
switch (I->getOpcode()) {
case Instruction::BitCast: {
- Instruction::CastOps opcode = CastInst::getCastOpcode(NewVal,
- NewVal->getType()->isSigned(), I->getType(), I->getType()->isSigned());
+ Instruction::CastOps opcode = CastInst::getCastOpcode(NewVal, false,
+ I->getType(), false);
Res = CastInst::create(opcode, NewVal, I->getType(), Name);
break;
}
@@ -768,7 +767,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
if (const CompositeType *CT = dyn_cast<CompositeType>(LoadedTy)) {
std::vector<Value*> Indices;
- Indices.push_back(Constant::getNullValue(Type::UIntTy));
+ Indices.push_back(Constant::getNullValue(Type::Int32Ty));
unsigned Offset = 0; // No offset, get first leaf.
LoadedTy = getStructOffsetType(CT, Offset, Indices, TD, false);
@@ -801,7 +800,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
if (ElTy != NewTy) {
std::vector<Value*> Indices;
- Indices.push_back(Constant::getNullValue(Type::UIntTy));
+ Indices.push_back(Constant::getNullValue(Type::Int32Ty));
unsigned Offset = 0;
const Type *Ty = getStructOffsetType(ElTy, Offset, Indices, TD,false);
@@ -830,7 +829,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
if (isa<StructType>(ValTy)) {
std::vector<Value*> Indices;
- Indices.push_back(Constant::getNullValue(Type::UIntTy));
+ Indices.push_back(Constant::getNullValue(Type::Int32Ty));
unsigned Offset = 0;
ValTy = getStructOffsetType(ValTy, Offset, Indices, TD, false);
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index ab52baf850..467214dce6 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -384,7 +384,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
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 @@ Function *ArgPromotion::DoPromotion(Function *F,
}
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 @@ Function *ArgPromotion::DoPromotion(Function *F,
// 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.
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 9d88a8879f..840533f968 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -500,7 +500,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
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 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
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)
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 808a7f805d..e17ded82d9 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -384,7 +384,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) {
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 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) {
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 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) {
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 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
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 @@ static void RewriteUsesOfLoadForHeapSRoA(LoadInst *Ptr,
// 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 @@ GlobalVariable *GlobalOpt::FindGlobalCtors(Module &M) {
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 @@ static GlobalVariable *InstallGlobalCtors(GlobalVariable *GCL,
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 @@ static GlobalVariable *InstallGlobalCtors(GlobalVariable *GCL,
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));
}
diff --git a/lib/Transforms/IPO/IndMemRemoval.cpp b/lib/Transforms/IPO/IndMemRemoval.cpp
index 82aa992a09..c68a4d3b24 100644
--- a/lib/Transforms/IPO/IndMemRemoval.cpp
+++ b/lib/Transforms/IPO/IndMemRemoval.cpp
@@ -66,8 +66,8 @@ bool IndMemRemPass::runOnModule(Module &M) {
"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();
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp
index d7f22fb9cb..44b0ab5d5c 100644
--- a/lib/Transforms/IPO/LowerSetJmp.cpp
+++ b/lib/Transforms/IPO/LowerSetJmp.cpp
@@ -193,7 +193,7 @@ bool LowerSetJmp::runOnModule(Module& M) {
// 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 @@ bool LowerSetJmp::doInitialization(Module& M)
// 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 @@ bool LowerSetJmp::doInitialization(Module& M)
// 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 @@ bool LowerSetJmp::IsTransformableFunction(const std::string& Name) {
// 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 @@ AllocaInst* LowerSetJmp::GetSetJmpMap(Function* Func)
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 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst)
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 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst)
// 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.
diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp
index 58f0d1b0a3..e7e57aa952 100644
--- a/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -66,12 +66,12 @@ ModulePass *llvm::createRaiseAllocationsPass() {
//
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 @@ void RaiseAllocations::doInitialization(Module &M) {
// 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 @@ void RaiseAllocations::doInitialization(Module &M) {
// One last try, check to see if we can find free as 'int (...)* free'. This
// handles the case where NOTHING was declared.
if (FreeFu