[LLVMdev] Possible bug in LiveIntervalAnalysis?

Evan Cheng evan.cheng at apple.com
Fri Apr 18 00:38:16 PDT 2008


Can you file a bug so I don't forget? I'm a little occupied right now.  
But I'll take care of this soon.

Evan

On Apr 16, 2008, at 10:52 AM, Scott Graham wrote:

> Hi
>
> I'm seeing something probably related to this. I'm getting an assert
> from the lower_bound in LiveIntervals::findLiveinMBBs (from a checking
> std:: VS2005 implementation). Idx2MBBMap has two elements in it, both
> of which have a .first of 0. (I believe because of an empty MBB in the
> function below, so StartIndex doesn't advance).
>
> scott
>
> On Wed, Apr 16, 2008 at 2:52 AM, Roman Levenstein  
> <romixlev at yahoo.com> 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
>>
> _______________________________________________
> 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