} 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!");
}
// 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);
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)) {
// 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;