[LLVMdev] Possible bug in LiveIntervalAnalysis?
Roman Levenstein
romixlev at yahoo.com
Wed Apr 16 02:52:15 PDT 2008
Hi,
In the LiveIntervalAnalysis::runOnMachineFunction, there is a code to
compute the MBB2IdxMap, by remembering for each MBB its start and end
instruction numbers:
unsigned MIIndex = 0;
for (MachineFunction::iterator MBB = mf_->begin(), E = mf_->end();
MBB != E; ++MBB) {
unsigned StartIdx = MIIndex;
for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end();
I != E; ++I) {
bool inserted = mi2iMap_.insert(std::make_pair(I,
MIIndex)).second;
assert(inserted && "multiple MachineInstr -> index mappings");
i2miMap_.push_back(I);
MIIndex += InstrSlots::NUM;
}
// Set the MBB2IdxMap entry for this MBB.
MBB2IdxMap[MBB->getNumber()] = std::make_pair(StartIdx, MIIndex -
1);
For empty MBBs, the last line would create a pair, where the end
element is smaller than the start element, which is a bit
counter-intuitive. This may lead to some assertion failures in other
parts of the code generator, if they use MBB2IdxMap for checking is an
instruction belongs to a given MBB.
Question: Is this way of handling empty MBBs in the
LiveIntervalAnalysis a bug or a feature? Any special reason, why the
pair for an empty block does not look e.g. like (start, start)?
-Roman
__________________________________________________________
Gesendet von Yahoo! Mail.
Der Mailbox mit unbegrenztem Speicher.
http://de.overview.mail.yahoo.com
More information about the llvm-dev
mailing list