Skip to content

Commit

Permalink
Revert r134893 and r134888 (and related patches in other trees). It w…
Browse files Browse the repository at this point in the history
…as causing

an assert on Darwin llvm-gcc builds.

Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, li\
ne 2067.
etc.

http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354

--- Reverse-merging r134893 into '.':
U    include/llvm/Target/TargetData.h
U    include/llvm/DerivedTypes.h
U    tools/bugpoint/ExtractFunction.cpp
U    unittests/Support/TypeBuilderTest.cpp
U    lib/Target/ARM/ARMGlobalMerge.cpp
U    lib/Target/TargetData.cpp
U    lib/VMCore/Constants.cpp
U    lib/VMCore/Type.cpp
U    lib/VMCore/Core.cpp
U    lib/Transforms/Utils/CodeExtractor.cpp
U    lib/Transforms/Instrumentation/ProfilingUtils.cpp
U    lib/Transforms/IPO/DeadArgumentElimination.cpp
U    lib/CodeGen/SjLjEHPrepare.cpp
--- Reverse-merging r134888 into '.':
G    include/llvm/DerivedTypes.h
U    include/llvm/Support/TypeBuilder.h
U    include/llvm/Intrinsics.h
U    unittests/Analysis/ScalarEvolutionTest.cpp
U    unittests/ExecutionEngine/JIT/JITTest.cpp
U    unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
U    unittests/VMCore/PassManagerTest.cpp
G    unittests/Support/TypeBuilderTest.cpp
U    lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
U    lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
U    lib/VMCore/IRBuilder.cpp
G    lib/VMCore/Type.cpp
U    lib/VMCore/Function.cpp
G    lib/VMCore/Core.cpp
U    lib/VMCore/Module.cpp
U    lib/AsmParser/LLParser.cpp
U    lib/Transforms/Utils/CloneFunction.cpp
G    lib/Transforms/Utils/CodeExtractor.cpp
U    lib/Transforms/Utils/InlineFunction.cpp
U    lib/Transforms/Instrumentation/GCOVProfiling.cpp
U    lib/Transforms/Scalar/ObjCARC.cpp
U    lib/Transforms/Scalar/SimplifyLibCalls.cpp
U    lib/Transforms/Scalar/MemCpyOptimizer.cpp
G    lib/Transforms/IPO/DeadArgumentElimination.cpp
U    lib/Transforms/IPO/ArgumentPromotion.cpp
U    lib/Transforms/InstCombine/InstCombineCompares.cpp
U    lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
U    lib/Transforms/InstCombine/InstCombineCalls.cpp
U    lib/CodeGen/DwarfEHPrepare.cpp
U    lib/CodeGen/IntrinsicLowering.cpp
U    lib/Bitcode/Reader/BitcodeReader.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134949 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
isanbard committed Jul 12, 2011
1 parent 1852e21 commit 2280ebd
Show file tree
Hide file tree
Showing 38 changed files with 156 additions and 131 deletions.
9 changes: 8 additions & 1 deletion include/llvm/DerivedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ class FunctionType : public Type {
/// FunctionType::get - This static method is the primary way of constructing
/// a FunctionType.
///
static FunctionType *get(const Type *Result,
ArrayRef<const Type*> Params, bool isVarArg);
static FunctionType *get(const Type *Result,
ArrayRef<Type*> Params, bool isVarArg);

Expand Down Expand Up @@ -204,6 +206,11 @@ class StructType : public CompositeType {

/// StructType::get - This static method is the primary way to create a
/// StructType.
///
/// FIXME: Remove the 'const Type*' version of this when types are pervasively
/// de-constified.
static StructType *get(LLVMContext &Context, ArrayRef<const Type*> Elements,
bool isPacked = false);
static StructType *get(LLVMContext &Context, ArrayRef<Type*> Elements,
bool isPacked = false);

Expand All @@ -215,7 +222,7 @@ class StructType : public CompositeType {
/// structure types by specifying the elements as arguments. Note that this
/// method always returns a non-packed struct, and requires at least one
/// element type.
static StructType *get(Type *elt1, ...) END_WITH_NULL;
static StructType *get(const Type *elt1, ...) END_WITH_NULL;

bool isPacked() const { return (getSubclassData() & SCDB_Packed) != 0; }

Expand Down
6 changes: 3 additions & 3 deletions include/llvm/Intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ namespace Intrinsic {

/// Intrinsic::getName(ID) - Return the LLVM name for an intrinsic, such as
/// "llvm.ppc.altivec.lvx".
std::string getName(ID id, Type **Tys = 0, unsigned numTys = 0);
std::string getName(ID id, const Type **Tys = 0, unsigned numTys = 0);

/// Intrinsic::getType(ID) - Return the function type for an intrinsic.
///
const FunctionType *getType(LLVMContext &Context, ID id,
Type **Tys = 0, unsigned numTys = 0);
const Type **Tys = 0, unsigned numTys = 0);

/// Intrinsic::isOverloaded(ID) - Returns true if the intrinsic can be
/// overloaded.
Expand All @@ -67,7 +67,7 @@ namespace Intrinsic {
/// overloaded intrinsic, Tys should point to an array of numTys pointers to
/// Type, and must provide exactly one type for each overloaded type in the
/// intrinsic.
Function *getDeclaration(Module *M, ID id, Type **Tys = 0,
Function *getDeclaration(Module *M, ID id, const Type **Tys = 0,
unsigned numTys = 0);

/// Map a GCC builtin name to an intrinsic ID.
Expand Down
74 changes: 37 additions & 37 deletions include/llvm/Support/TypeBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace llvm {
/// namespace llvm {
/// template<bool xcompile> class TypeBuilder<MyType, xcompile> {
/// public:
/// static StructType *get(LLVMContext &Context) {
/// static const StructType *get(LLVMContext &Context) {
/// // If you cache this result, be sure to cache it separately
/// // for each LLVMContext.
/// return StructType::get(
Expand Down Expand Up @@ -104,7 +104,7 @@ template<typename T, bool cross> class TypeBuilder<const volatile T, cross>
// Pointers
template<typename T, bool cross> class TypeBuilder<T*, cross> {
public:
static PointerType *get(LLVMContext &Context) {
static const PointerType *get(LLVMContext &Context) {
return PointerType::getUnqual(TypeBuilder<T,cross>::get(Context));
}
};
Expand All @@ -115,14 +115,14 @@ template<typename T, bool cross> class TypeBuilder<T&, cross> {};
// Arrays
template<typename T, size_t N, bool cross> class TypeBuilder<T[N], cross> {
public:
static ArrayType *get(LLVMContext &Context) {
static const ArrayType *get(LLVMContext &Context) {
return ArrayType::get(TypeBuilder<T, cross>::get(Context), N);
}
};
/// LLVM uses an array of length 0 to represent an unknown-length array.
template<typename T, bool cross> class TypeBuilder<T[], cross> {
public:
static ArrayType *get(LLVMContext &Context) {
static const ArrayType *get(LLVMContext &Context) {
return ArrayType::get(TypeBuilder<T, cross>::get(Context), 0);
}
};
Expand Down Expand Up @@ -152,7 +152,7 @@ template<typename T, bool cross> class TypeBuilder<T[], cross> {
#define DEFINE_INTEGRAL_TYPEBUILDER(T) \
template<> class TypeBuilder<T, false> { \
public: \
static IntegerType *get(LLVMContext &Context) { \
static const IntegerType *get(LLVMContext &Context) { \
return IntegerType::get(Context, sizeof(T) * CHAR_BIT); \
} \
}; \
Expand Down Expand Up @@ -181,55 +181,55 @@ DEFINE_INTEGRAL_TYPEBUILDER(unsigned long long);
template<uint32_t num_bits, bool cross>
class TypeBuilder<types::i<num_bits>, cross> {
public:
static IntegerType *get(LLVMContext &C) {
static const IntegerType *get(LLVMContext &C) {
return IntegerType::get(C, num_bits);
}
};

template<> class TypeBuilder<float, false> {
public:
static Type *get(LLVMContext& C) {
static const Type *get(LLVMContext& C) {
return Type::getFloatTy(C);
}
};
template<> class TypeBuilder<float, true> {};

template<> class TypeBuilder<double, false> {
public:
static Type *get(LLVMContext& C) {
static const Type *get(LLVMContext& C) {
return Type::getDoubleTy(C);
}
};
template<> class TypeBuilder<double, true> {};

template<bool cross> class TypeBuilder<types::ieee_float, cross> {
public:
static Type *get(LLVMContext& C) { return Type::getFloatTy(C); }
static const Type *get(LLVMContext& C) { return Type::getFloatTy(C); }
};
template<bool cross> class TypeBuilder<types::ieee_double, cross> {
public:
static Type *get(LLVMContext& C) { return Type::getDoubleTy(C); }
static const Type *get(LLVMContext& C) { return Type::getDoubleTy(C); }
};
template<bool cross> class TypeBuilder<types::x86_fp80, cross> {
public:
static Type *get(LLVMContext& C) { return Type::getX86_FP80Ty(C); }
static const Type *get(LLVMContext& C) { return Type::getX86_FP80Ty(C); }
};
template<bool cross> class TypeBuilder<types::fp128, cross> {
public:
static Type *get(LLVMContext& C) { return Type::getFP128Ty(C); }
static const Type *get(LLVMContext& C) { return Type::getFP128Ty(C); }
};
template<bool cross> class TypeBuilder<types::ppc_fp128, cross> {
public:
static Type *get(LLVMContext& C) { return Type::getPPC_FP128Ty(C); }
static const Type *get(LLVMContext& C) { return Type::getPPC_FP128Ty(C); }
};
template<bool cross> class TypeBuilder<types::x86_mmx, cross> {
public:
static Type *get(LLVMContext& C) { return Type::getX86_MMXTy(C); }
static const Type *get(LLVMContext& C) { return Type::getX86_MMXTy(C); }
};

template<bool cross> class TypeBuilder<void, cross> {
public:
static Type *get(LLVMContext &C) {
static const Type *get(LLVMContext &C) {
return Type::getVoidTy(C);
}
};
Expand All @@ -247,14 +247,14 @@ template<> class TypeBuilder<const volatile void*, false>

template<typename R, bool cross> class TypeBuilder<R(), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
static const FunctionType *get(LLVMContext &Context) {
return FunctionType::get(TypeBuilder<R, cross>::get(Context), false);
}
};
template<typename R, typename A1, bool cross> class TypeBuilder<R(A1), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
std::vector<Type*> params;
static const FunctionType *get(LLVMContext &Context) {
std::vector<const Type*> params;
params.reserve(1);
params.push_back(TypeBuilder<A1, cross>::get(Context));
return FunctionType::get(TypeBuilder<R, cross>::get(Context),
Expand All @@ -264,8 +264,8 @@ template<typename R, typename A1, bool cross> class TypeBuilder<R(A1), cross> {
template<typename R, typename A1, typename A2, bool cross>
class TypeBuilder<R(A1, A2), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
std::vector<Type*> params;
static const FunctionType *get(LLVMContext &Context) {
std::vector<const Type*> params;
params.reserve(2);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
Expand All @@ -276,8 +276,8 @@ class TypeBuilder<R(A1, A2), cross> {
template<typename R, typename A1, typename A2, typename A3, bool cross>
class TypeBuilder<R(A1, A2, A3), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
std::vector<Type*> params;
static const FunctionType *get(LLVMContext &Context) {
std::vector<const Type*> params;
params.reserve(3);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
Expand All @@ -291,8 +291,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
bool cross>
class TypeBuilder<R(A1, A2, A3, A4), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
std::vector<Type*> params;
static const FunctionType *get(LLVMContext &Context) {
std::vector<const Type*> params;
params.reserve(4);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
Expand All @@ -307,8 +307,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
typename A5, bool cross>
class TypeBuilder<R(A1, A2, A3, A4, A5), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
std::vector<Type*> params;
static const FunctionType *get(LLVMContext &Context) {
std::vector<const Type*> params;
params.reserve(5);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
Expand All @@ -322,15 +322,15 @@ class TypeBuilder<R(A1, A2, A3, A4, A5), cross> {

template<typename R, bool cross> class TypeBuilder<R(...), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
static const FunctionType *get(LLVMContext &Context) {
return FunctionType::get(TypeBuilder<R, cross>::get(Context), true);
}
};
template<typename R, typename A1, bool cross>
class TypeBuilder<R(A1, ...), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
std::vector<Type*> params;
static const FunctionType *get(LLVMContext &Context) {
std::vector<const Type*> params;
params.reserve(1);
params.push_back(TypeBuilder<A1, cross>::get(Context));
return FunctionType::get(TypeBuilder<R, cross>::get(Context), params, true);
Expand All @@ -339,8 +339,8 @@ class TypeBuilder<R(A1, ...), cross> {
template<typename R, typename A1, typename A2, bool cross>
class TypeBuilder<R(A1, A2, ...), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
std::vector<Type*> params;
static const FunctionType *get(LLVMContext &Context) {
std::vector<const Type*> params;
params.reserve(2);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
Expand All @@ -351,8 +351,8 @@ class TypeBuilder<R(A1, A2, ...), cross> {
template<typename R, typename A1, typename A2, typename A3, bool cross>
class TypeBuilder<R(A1, A2, A3, ...), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
std::vector<Type*> params;
static const FunctionType *get(LLVMContext &Context) {
std::vector<const Type*> params;
params.reserve(3);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
Expand All @@ -366,8 +366,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
bool cross>
class TypeBuilder<R(A1, A2, A3, A4, ...), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
std::vector<Type*> params;
static const FunctionType *get(LLVMContext &Context) {
std::vector<const Type*> params;
params.reserve(4);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
Expand All @@ -382,8 +382,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
typename A5, bool cross>
class TypeBuilder<R(A1, A2, A3, A4, A5, ...), cross> {
public:
static FunctionType *get(LLVMContext &Context) {
std::vector<Type*> params;
static const FunctionType *get(LLVMContext &Context) {
std::vector<const Type*> params;
params.reserve(5);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/Target/TargetData.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class TargetData : public ImmutablePass {
/// getIntPtrType - Return an unsigned integer type that is the same size or
/// greater to the host pointer size.
///
IntegerType *getIntPtrType(LLVMContext &C) const;
const IntegerType *getIntPtrType(LLVMContext &C) const;

/// getIndexedOffset - return the offset from the beginning of the type for
/// the specified indices. This is used to implement getelementptr.
Expand Down
8 changes: 4 additions & 4 deletions lib/AsmParser/LLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ bool LLParser::ParseFunctionType(Type *&Result) {
"argument attributes invalid in function type");
}

SmallVector<Type*, 16> ArgListTy;
SmallVector<const Type*, 16> ArgListTy;
for (unsigned i = 0, e = ArgList.size(); i != e; ++i)
ArgListTy.push_back(ArgList[i].Ty);

Expand Down Expand Up @@ -2655,7 +2655,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {

// Okay, if we got here, the function is syntactically valid. Convert types
// and do semantic checks.
std::vector<Type*> ParamTypeList;
std::vector<const Type*> ParamTypeList;
SmallVector<AttributeWithIndex, 8> Attrs;

if (RetAttrs != Attribute::None)
Expand Down Expand Up @@ -3171,7 +3171,7 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
if (!(PFTy = dyn_cast<PointerType>(RetType)) ||
!(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
// Pull out the types of all of the arguments...
std::vector<Type*> ParamTypes;
std::vector<const Type*> ParamTypes;
for (unsigned i = 0, e = ArgList.size(); i != e; ++i)
ParamTypes.push_back(ArgList[i].V->getType());

Expand Down Expand Up @@ -3508,7 +3508,7 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
if (!(PFTy = dyn_cast<PointerType>(RetType)) ||
!(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
// Pull out the types of all of the arguments...
std::vector<Type*> ParamTypes;
std::vector<const Type*> ParamTypes;
for (unsigned i = 0, e = ArgList.size(); i != e; ++i)
ParamTypes.push_back(ArgList[i].V->getType());

Expand Down
4 changes: 2 additions & 2 deletions lib/Bitcode/Reader/BitcodeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ bool BitcodeReader::ParseTypeTableBody() {
// FUNCTION: [vararg, attrid, retty, paramty x N]
if (Record.size() < 3)
return Error("Invalid FUNCTION type record");
std::vector<Type*> ArgTys;
std::vector<const Type*> ArgTys;
for (unsigned i = 3, e = Record.size(); i != e; ++i) {
if (Type *T = getTypeByID(Record[i]))
ArgTys.push_back(T);
Expand Down Expand Up @@ -838,7 +838,7 @@ bool BitcodeReader::ParseOldTypeTable() {
// FUNCTION: [vararg, attrid, retty, paramty x N]
if (Record.size() < 3)
return Error("Invalid FUNCTION type record");
std::vector<Type*> ArgTys;
std::vector<const Type*> ArgTys;
for (unsigned i = 3, e = Record.size(); i != e; ++i) {
if (Type *Elt = getTypeByIDOrNull(Record[i]))
ArgTys.push_back(Elt);
Expand Down
4 changes: 3 additions & 1 deletion lib/CodeGen/DwarfEHPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,10 @@ bool DwarfEHPrepare::LowerUnwindsAndResumes() {
// Find the rewind function if we didn't already.
if (!RewindFunction) {
LLVMContext &Ctx = ResumeInsts[0]->getContext();
std::vector<const Type*>
Params(1, Type::getInt8PtrTy(Ctx));
FunctionType *FTy = FunctionType::get(Type::getVoidTy(Ctx),
Type::getInt8PtrTy(Ctx), false);
Params, false);
const char *RewindName = TLI->getLibcallName(RTLIB::UNWIND_RESUME);
RewindFunction = F->getParent()->getOrInsertFunction(RewindName, FTy);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/CodeGen/IntrinsicLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static void EnsureFunctionExists(Module &M, const char *Name,
ArgIt ArgBegin, ArgIt ArgEnd,
const Type *RetTy) {
// Insert a correctly-typed definition now.
std::vector<Type *> ParamTys;
std::vector<const Type *> ParamTys;
for (ArgIt I = ArgBegin; I != ArgEnd; ++I)
ParamTys.push_back(I->getType());
M.getOrInsertFunction(Name, FunctionType::get(RetTy, ParamTys, false));
Expand Down Expand Up @@ -69,7 +69,7 @@ static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI,
// program already contains a function with this name.
Module *M = CI->getParent()->getParent()->getParent();
// Get or insert the definition now.
std::vector<Type *> ParamTys;
std::vector<const Type *> ParamTys;
for (ArgIt I = ArgBegin; I != ArgEnd; ++I)
ParamTys.push_back((*I)->getType());
Constant* FCache = M->getOrInsertFunction(NewFn,
Expand Down Expand Up @@ -553,12 +553,12 @@ bool IntrinsicLowering::LowerToByteSwap(CallInst *CI) {
!CI->getType()->isIntegerTy())
return false;

IntegerType *Ty = dyn_cast<IntegerType>(CI->getType());
const IntegerType *Ty = dyn_cast<IntegerType>(CI->getType());
if (!Ty)
return false;

// Okay, we can do this xform, do so now.
Type *Tys[] = { Ty };
const Type *Tys[] = { Ty };
Module *M = CI->getParent()->getParent()->getParent();
Constant *Int = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 1);

Expand Down
Loading

0 comments on commit 2280ebd

Please sign in to comment.