[LLVMdev] Possible bug in LiveIntervalAnalysis?

Evan Cheng evan.cheng at apple.com
Wed Apr 16 10:31:13 PDT 2008


That's a bug. I'll fix it.

Thanks.

Evan
On Apr 16, 2008, at 2:52 AM, Roman Levenstein wrote:

> 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
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list