LiveInterval and Loop Info

Hello to all LLVM Developers.

Given a object from a LiveInterval class, is there any way to know if this Live Interval is part or is inside a loop?


There is no direct support for this, but you can use LiveIntervalAnalysis::getMBBStartIndex()/getMBBEndIndex()/getMBBFromIndex() to relate the SlotIndexes used in the LiveIntervals to MachineBasicBlocks which in turn you can relate to your MachineLoopInfo.

  • Matthias

Thanks Matthias

I can also use the method intervalIsInOneMBB() from LiveIntervals class to relate a LiveInterval to a MachineBasicBlock, right?

As the name implies this function will only give you a basic block if the LiveInterval/LiveRange is completely contained within a single basic block, for the more general cases you will need the other functions.

  • Matthias

Ok. Thanks