[llvm-commits] [llvm] r92771 - in /llvm/trunk/lib: Analysis/ValueTracking.cpp AsmParser/LLParser.cpp CodeGen/StackProtector.cpp ExecutionEngine/ExecutionEngine.cpp ExecutionEngine/JIT/JIT.cpp Target/X86/X86ISelLowering.cpp Transforms/IPO/GlobalOpt.cpp Transforms/InstCombine/InstCombineCalls.cpp Transforms/InstCombine/InstructionCombining.cpp Transforms/Instrumentation/ProfilingUtils.cpp Transforms/Scalar/SimplifyLibCalls.cpp VMCore/ConstantFold.cpp VMCore/Constants.cpp VMCore/Instructions.cpp
Benjamin Kramer
benny.kra at googlemail.com
Tue Jan 5 13:05:55 PST 2010
Author: d0k
Date: Tue Jan 5 15:05:54 2010
New Revision: 92771
URL: http://llvm.org/viewvc/llvm-project?rev=92771&view=rev
Log:
Move remaining stuff to the isInteger predicate.
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/CodeGen/StackProtector.cpp
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp
llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp
llvm/trunk/lib/VMCore/ConstantFold.cpp
llvm/trunk/lib/VMCore/Constants.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Tue Jan 5 15:05:54 2010
@@ -1348,7 +1348,7 @@
// Make sure the index-ee is a pointer to array of i8.
const PointerType *PT = cast<PointerType>(GEP->getOperand(0)->getType());
const ArrayType *AT = dyn_cast<ArrayType>(PT->getElementType());
- if (AT == 0 || AT->getElementType() != Type::getInt8Ty(V->getContext()))
+ if (AT == 0 || !AT->getElementType()->isInteger(8))
return false;
// Check to make sure that the first operand of the GEP is an integer and
@@ -1387,8 +1387,7 @@
// Must be a Constant Array
ConstantArray *Array = dyn_cast<ConstantArray>(GlobalInit);
- if (Array == 0 ||
- Array->getType()->getElementType() != Type::getInt8Ty(V->getContext()))
+ if (Array == 0 || !Array->getType()->getElementType()->isInteger(8))
return false;
// Get the number of elements in the array
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Jan 5 15:05:54 2010
@@ -3656,7 +3656,7 @@
}
}
- if (Size && Size->getType() != Type::getInt32Ty(Context))
+ if (Size && !Size->getType()->isInteger(32))
return Error(SizeLoc, "element count must be i32");
if (isAlloca) {
Modified: llvm/trunk/lib/CodeGen/StackProtector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackProtector.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StackProtector.cpp (original)
+++ llvm/trunk/lib/CodeGen/StackProtector.cpp Tue Jan 5 15:05:54 2010
@@ -113,7 +113,7 @@
if (const ArrayType *AT = dyn_cast<ArrayType>(AI->getAllocatedType())) {
// We apparently only care about character arrays.
- if (AT->getElementType() != Type::getInt8Ty(AT->getContext()))
+ if (!AT->getElementType()->isInteger(8))
continue;
// If an array has more than SSPBufferSize bytes of allocated space,
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Tue Jan 5 15:05:54 2010
@@ -356,7 +356,7 @@
}
// FALLS THROUGH
case 1:
- if (FTy->getParamType(0) != Type::getInt32Ty(Fn->getContext())) {
+ if (!FTy->getParamType(0)->isInteger(32)) {
llvm_report_error("Invalid type for first argument of main() supplied");
}
// FALLS THROUGH
@@ -618,13 +618,11 @@
GV.DoubleVal = GV.IntVal.bitsToDouble();
break;
case Type::FloatTyID:
- assert(DestTy == Type::getInt32Ty(DestTy->getContext()) &&
- "Invalid bitcast");
+ assert(DestTy->isInteger(32) && "Invalid bitcast");
GV.IntVal.floatToBits(GV.FloatVal);
break;
case Type::DoubleTyID:
- assert(DestTy == Type::getInt64Ty(DestTy->getContext()) &&
- "Invalid bitcast");
+ assert(DestTy->isInteger(64) && "Invalid bitcast");
GV.IntVal.doubleToBits(GV.DoubleVal);
break;
case Type::PointerTyID:
Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Tue Jan 5 15:05:54 2010
@@ -411,7 +411,7 @@
// Handle some common cases first. These cases correspond to common `main'
// prototypes.
- if (RetTy == Type::getInt32Ty(F->getContext()) || RetTy->isVoidTy()) {
+ if (RetTy->isInteger(32) || RetTy->isVoidTy()) {
switch (ArgValues.size()) {
case 3:
if (FTy->getParamType(0)->isInteger(32) &&
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jan 5 15:05:54 2010
@@ -7535,8 +7535,7 @@
bool X86TargetLowering::isZExtFree(const Type *Ty1, const Type *Ty2) const {
// x86-64 implicitly zero-extends 32-bit results in 64-bit registers.
- return Ty1 == Type::getInt32Ty(Ty1->getContext()) &&
- Ty2 == Type::getInt64Ty(Ty1->getContext()) && Subtarget->is64Bit();
+ return Ty1->isInteger(64) && Ty2->isInteger(64) && Subtarget->is64Bit();
}
bool X86TargetLowering::isZExtFree(EVT VT1, EVT VT2) const {
Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Tue Jan 5 15:05:54 2010
@@ -1925,7 +1925,7 @@
if (!ATy) return 0;
const StructType *STy = dyn_cast<StructType>(ATy->getElementType());
if (!STy || STy->getNumElements() != 2 ||
- STy->getElementType(0) != Type::getInt32Ty(M.getContext())) return 0;
+ !STy->getElementType(0)->isInteger(32)) return 0;
const PointerType *PFTy = dyn_cast<PointerType>(STy->getElementType(1));
if (!PFTy) return 0;
const FunctionType *FTy = dyn_cast<FunctionType>(PFTy->getElementType());
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Tue Jan 5 15:05:54 2010
@@ -199,7 +199,7 @@
// Extract the length and alignment and fill if they are constant.
ConstantInt *LenC = dyn_cast<ConstantInt>(MI->getLength());
ConstantInt *FillC = dyn_cast<ConstantInt>(MI->getValue());
- if (!LenC || !FillC || FillC->getType() != Type::getInt8Ty(MI->getContext()))
+ if (!LenC || !FillC || !FillC->getType()->isInteger(8))
return 0;
uint64_t Len = LenC->getZExtValue();
Alignment = MI->getAlignment();
Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Tue Jan 5 15:05:54 2010
@@ -596,8 +596,7 @@
// (where tmp = 8*tmp2) into:
// getelementptr [100 x double]* %arr, i32 0, i32 %tmp2; bitcast
- if (TD && isa<ArrayType>(SrcElTy) &&
- ResElTy == Type::getInt8Ty(GEP.getContext())) {
+ if (TD && isa<ArrayType>(SrcElTy) && ResElTy->isInteger(8)) {
uint64_t ArrayEltSize =
TD->getTypeAllocSize(cast<ArrayType>(SrcElTy)->getElementType());
Modified: llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp Tue Jan 5 15:05:54 2010
@@ -84,7 +84,7 @@
AI = MainFn->arg_begin();
// If the program looked at argc, have it look at the return value of the
// init call instead.
- if (AI->getType() != Type::getInt32Ty(Context)) {
+ if (!AI->getType()->isInteger(32)) {
Instruction::CastOps opcode;
if (!AI->use_empty()) {
opcode = CastInst::getCastOpcode(InitCall, true, AI->getType(), true);
Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Tue Jan 5 15:05:54 2010
@@ -505,8 +505,7 @@
// Must be a Constant Array
ConstantArray *Array = dyn_cast<ConstantArray>(GlobalInit);
- if (!Array ||
- Array->getType()->getElementType() != Type::getInt8Ty(V->getContext()))
+ if (!Array || !Array->getType()->getElementType()->isInteger(8))
return false;
// Get the number of elements in the array
@@ -678,9 +677,7 @@
if (!TD) return 0;
uint64_t Len = GetStringLength(SrcStr);
- if (Len == 0 ||
- FT->getParamType(1) != Type::getInt32Ty(*Context)) // memchr needs
- // i32.
+ if (Len == 0 || !FT->getParamType(1)->isInteger(32)) // memchr needs i32.
return 0;
return EmitMemChr(SrcStr, CI->getOperand(2), // include nul.
@@ -722,7 +719,7 @@
// Verify the "strcmp" function prototype.
const FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 ||
- FT->getReturnType() != Type::getInt32Ty(*Context) ||
+ !FT->getReturnType()->isInteger(32) ||
FT->getParamType(0) != FT->getParamType(1) ||
FT->getParamType(0) != Type::getInt8PtrTy(*Context))
return 0;
@@ -770,7 +767,7 @@
// Verify the "strncmp" function prototype.
const FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 3 ||
- FT->getReturnType() != Type::getInt32Ty(*Context) ||
+ !FT->getReturnType()->isInteger(32) ||
FT->getParamType(0) != FT->getParamType(1) ||
FT->getParamType(0) != Type::getInt8PtrTy(*Context) ||
!isa<IntegerType>(FT->getParamType(2)))
@@ -991,7 +988,7 @@
const FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 3 || !isa<PointerType>(FT->getParamType(0)) ||
!isa<PointerType>(FT->getParamType(1)) ||
- FT->getReturnType() != Type::getInt32Ty(*Context))
+ !FT->getReturnType()->isInteger(32))
return 0;
Value *LHS = CI->getOperand(1), *RHS = CI->getOperand(2);
@@ -1353,7 +1350,7 @@
// Just make sure this has 2 arguments of the same FP type, which match the
// result type.
if (FT->getNumParams() != 1 ||
- FT->getReturnType() != Type::getInt32Ty(*Context) ||
+ !FT->getReturnType()->isInteger(32) ||
!isa<IntegerType>(FT->getParamType(0)))
return 0;
@@ -1389,7 +1386,7 @@
const FunctionType *FT = Callee->getFunctionType();
// We require integer(i32)
if (FT->getNumParams() != 1 || !isa<IntegerType>(FT->getReturnType()) ||
- FT->getParamType(0) != Type::getInt32Ty(*Context))
+ !FT->getParamType(0)->isInteger(32))
return 0;
// isdigit(c) -> (c-'0') <u 10
@@ -1410,7 +1407,7 @@
const FunctionType *FT = Callee->getFunctionType();
// We require integer(i32)
if (FT->getNumParams() != 1 || !isa<IntegerType>(FT->getReturnType()) ||
- FT->getParamType(0) != Type::getInt32Ty(*Context))
+ !FT->getParamType(0)->isInteger(32))
return 0;
// isascii(c) -> c <u 128
@@ -1451,7 +1448,7 @@
const FunctionType *FT = Callee->getFunctionType();
// We require i32(i32)
if (FT->getNumParams() != 1 || FT->getReturnType() != FT->getParamType(0) ||
- FT->getParamType(0) != Type::getInt32Ty(*Context))
+ !FT->getParamType(0)->isInteger(32))
return 0;
// isascii(c) -> c & 0x7f
Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
+++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Jan 5 15:05:54 2010
@@ -1229,10 +1229,10 @@
// Ok, we have two differing integer indices. Sign extend them to be the same
// type. Long is always big enough, so we use it.
- if (C1->getType() != Type::getInt64Ty(Context))
+ if (!C1->getType()->isInteger(64))
C1 = ConstantExpr::getSExt(C1, Type::getInt64Ty(Context));
- if (C2->getType() != Type::getInt64Ty(Context))
+ if (!C2->getType()->isInteger(64))
C2 = ConstantExpr::getSExt(C2, Type::getInt64Ty(Context));
if (C1 == C2) return 0; // They are equal
@@ -2042,10 +2042,10 @@
// Before adding, extend both operands to i64 to avoid
// overflow trouble.
- if (PrevIdx->getType() != Type::getInt64Ty(Context))
+ if (!PrevIdx->getType()->isInteger(64))
PrevIdx = ConstantExpr::getSExt(PrevIdx,
Type::getInt64Ty(Context));
- if (Div->getType() != Type::getInt64Ty(Context))
+ if (!Div->getType()->isInteger(64))
Div = ConstantExpr::getSExt(Div,
Type::getInt64Ty(Context));
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jan 5 15:05:54 2010
@@ -928,7 +928,7 @@
/// if the elements of the array are all ConstantInt's.
bool ConstantArray::isString() const {
// Check the element type for i8...
- if (getType()->getElementType() != Type::getInt8Ty(getContext()))
+ if (!getType()->getElementType()->isInteger(8))
return false;
// Check the elements to make sure they are all integers, not constant
// expressions.
@@ -943,7 +943,7 @@
/// null bytes except its terminator.
bool ConstantArray::isCString() const {
// Check the element type for i8...
- if (getType()->getElementType() != Type::getInt8Ty(getContext()))
+ if (!getType()->getElementType()->isInteger(8))
return false;
// Last element must be a null.
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=92771&r1=92770&r2=92771&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Tue Jan 5 15:05:54 2010
@@ -1391,8 +1391,7 @@
bool ExtractElementInst::isValidOperands(const Value *Val, const Value *Index) {
- if (!isa<VectorType>(Val->getType()) ||
- Index->getType() != Type::getInt32Ty(Val->getContext()))
+ if (!isa<VectorType>(Val->getType()) || !Index->getType()->isInteger(32))
return false;
return true;
}
@@ -1439,7 +1438,7 @@
if (Elt->getType() != cast<VectorType>(Vec->getType())->getElementType())
return false;// Second operand of insertelement must be vector element type.
- if (Index->getType() != Type::getInt32Ty(Vec->getContext()))
+ if (!Index->getType()->isInteger(32))
return false; // Third operand of insertelement must be i32.
return true;
}
@@ -1491,7 +1490,7 @@
const VectorType *MaskTy = dyn_cast<VectorType>(Mask->getType());
if (!isa<Constant>(Mask) || MaskTy == 0 ||
- MaskTy->getElementType() != Type::getInt32Ty(V1->getContext()))
+ !MaskTy->getElementType()->isInteger(32))
return false;
return true;
}
More information about the llvm-commits
mailing list