[llvm-commits] [llvm] r93509 - /llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
Jay Foad
jay.foad at gmail.com
Fri Jan 15 00:32:59 PST 2010
Author: foad
Date: Fri Jan 15 02:32:58 2010
New Revision: 93509
URL: http://llvm.org/viewvc/llvm-project?rev=93509&view=rev
Log:
Fix http://llvm.org/PR6028, an assertion failure when an UndefValue of
integer type is used.
Modified:
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=93509&r1=93508&r2=93509&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Fri Jan 15 02:32:58 2010
@@ -491,8 +491,22 @@
/// @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)) {
More information about the llvm-commits
mailing list