[llvm-dev] Determining the order of instructions in BB
Reid Kleckner via llvm-dev
llvm-dev at lists.llvm.org
Thu Feb 7 09:50:48 PST 2019
There are a few ways to do this, but in general there is not an O(1) way to
do this if your transform is doing arbitrary instruction insertion and
The basic approach is to iterate the list, so this is O(bb length).
`DominatorTree::dominates(Instruction*,Instruction*)` will do this for you.
The next is to use OrderedBasicBlock (or OrderedInstructions for a whole
function) to cache the instruction ordering.
Finally, I have this patch that I haven't found time to work on which
caches the numbering in Instruction itself: https://reviews.llvm.org/D51664
Just needs a few days of work to make it happen.
On Thu, Feb 7, 2019 at 9:46 AM Paweł Bylica via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> Having two instructions in the same basic block is there a way to
> determine in what order they are in the basic block?
> // Paweł
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev