mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Fix http://llvm.org/PR6028, an assertion failure when an UndefValue of
integer type is used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93509 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bfdcf3bd49
commit
5b3701256c
@ -491,8 +491,22 @@ void *ExecutionEngine::getPointerToGlobal(const GlobalValue *GV) {
|
||||
/// @brief Get a GenericValue for a Constant*
|
||||
GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
|
||||
// If its undefined, return the garbage.
|
||||
if (isa<UndefValue>(C))
|
||||
return GenericValue();
|
||||
if (isa<UndefValue>(C)) {
|
||||
GenericValue Result;
|
||||
switch (C->getType()->getTypeID()) {
|
||||
case Type::IntegerTyID:
|
||||
case Type::X86_FP80TyID:
|
||||
case Type::FP128TyID:
|
||||
case Type::PPC_FP128TyID:
|
||||
// Although the value is undefined, we still have to construct an APInt
|
||||
// with the correct bit width.
|
||||
Result.IntVal = APInt(C->getType()->getPrimitiveSizeInBits(), 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// If the value is a ConstantExpr
|
||||
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
|
||||
|
Loading…
Reference in New Issue
Block a user