[llvm] r175601 - Add SlotIndexes::repairIndexesInRange(), which repairs SlotIndexes after adding

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Feb 20 09:16:28 PST 2013


On Feb 19, 2013, at 10:46 PM, Cameron Zwarich <zwarich at apple.com> wrote:

> +// Repair indexes after adding and removing instructions.
> +void SlotIndexes::repairIndexesInRange(MachineBasicBlock *MBB,
> +                                       MachineBasicBlock::iterator Begin,
> +                                       MachineBasicBlock::iterator End) {
> +  bool includeStart = (Begin == MBB->begin());
> +  SlotIndex startIdx;
> +  if (includeStart)
> +    startIdx = getMBBStartIdx(MBB);
> +  else
> +    startIdx = getInstructionIndex(Begin);

Same as before, it seems odd that you have to pass in a Begin that points to an instruction *before* the new ones.

Take a look at the getIndexBefore() and getIndexAfter() functions. I think they almost do what you need.

Also note that DBG_VALUE instructions mustn't get SlotIndexes. Just to complicate things a bit more.

/jakob




More information about the llvm-commits mailing list