The first hunk corrects a bug when printing undef null values. We would print
0->field, which is illegal. Now we print ((foo*)0)->field. The second hunk is an optimization to not print undefined phi values. llvm-svn: 17094
This commit is contained in:
parent
068555314b
commit
621c413a1b
|
@ -523,7 +523,9 @@ void CWriter::printConstant(Constant *CPV) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
} else if (isa<UndefValue>(CPV) && CPV->getType()->isFirstClassType()) {
|
} else if (isa<UndefValue>(CPV) && CPV->getType()->isFirstClassType()) {
|
||||||
Out << "0";
|
Out << "((";
|
||||||
|
printType(Out, CPV->getType());
|
||||||
|
Out << ")/*UNDEF*/0)";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1234,13 +1236,16 @@ void CWriter::printPHICopiesForSuccessors(BasicBlock *CurBlock,
|
||||||
SI != E; ++SI)
|
SI != E; ++SI)
|
||||||
for (BasicBlock::iterator I = SI->begin(); isa<PHINode>(I); ++I) {
|
for (BasicBlock::iterator I = SI->begin(); isa<PHINode>(I); ++I) {
|
||||||
PHINode *PN = cast<PHINode>(I);
|
PHINode *PN = cast<PHINode>(I);
|
||||||
// now we have to do the printing
|
// Now we have to do the printing.
|
||||||
|
Value *IV = PN->getIncomingValueForBlock(CurBlock);
|
||||||
|
if (!isa<UndefValue>(IV)) {
|
||||||
Out << std::string(Indent, ' ');
|
Out << std::string(Indent, ' ');
|
||||||
Out << " " << Mang->getValueName(I) << "__PHI_TEMPORARY = ";
|
Out << " " << Mang->getValueName(I) << "__PHI_TEMPORARY = ";
|
||||||
writeOperand(PN->getIncomingValue(PN->getBasicBlockIndex(CurBlock)));
|
writeOperand(IV);
|
||||||
Out << "; /* for PHI node */\n";
|
Out << "; /* for PHI node */\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CWriter::printBranchToBlock(BasicBlock *CurBB, BasicBlock *Succ,
|
void CWriter::printBranchToBlock(BasicBlock *CurBB, BasicBlock *Succ,
|
||||||
|
|
Loading…
Reference in New Issue