diff options
-rw-r--r-- | lib/Analysis/DataStructure/Local.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 4 | ||||
-rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 4 |
3 files changed, 8 insertions, 3 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index b497c3849c..473fb630dc 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -246,6 +246,9 @@ DSNodeHandle GraphBuilder::getValueDest(Value &Val) { } else if (ConstantIntegral *CI = dyn_cast<ConstantIntegral>(C)) { // Random constants are unknown mem return NH = createNode()->setUnknownNodeMarker(); + } else if (isa<UndefValue>(C)) { + ScalarMap.erase(V); + return 0; } else { assert(0 && "Unknown constant type!"); } diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 11565dff0b..eb57cced13 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -55,7 +55,7 @@ void AsmPrinter::emitZeros(unsigned NumZeros) const { // Print out the specified constant, without a storage class. Only the // constants valid in constant expressions can occur here. void AsmPrinter::emitConstantValueOnly(const Constant *CV) { - if (CV->isNullValue()) + if (CV->isNullValue() || isa<UndefValue>(CV)) O << "0"; else if (const ConstantBool *CB = dyn_cast<ConstantBool>(CV)) { assert(CB == ConstantBool::True); @@ -171,7 +171,7 @@ static void printAsCString(std::ostream &O, const ConstantArray *CVA) { void AsmPrinter::emitGlobalConstant(const Constant *CV) { const TargetData &TD = TM.getTargetData(); - if (CV->isNullValue()) { + if (CV->isNullValue() || isa<UndefValue>(CV)) { emitZeros(TD.getTypeSize(CV->getType())); return; } else if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) { diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index b239cc2a53..208f8e2e83 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -440,7 +440,9 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr, // specified memory location... // void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { - if (Init->getType()->isFirstClassType()) { + if (isa<UndefValue>(Init)) { + return; + } else if (Init->getType()->isFirstClassType()) { GenericValue Val = getConstantValue(Init); StoreValueToMemory(Val, (GenericValue*)Addr, Init->getType()); return; |