[PATCH] D32720: [LICM] Introduce a finer granularity option to compute early exits.

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 17:43:37 PDT 2017


trentxintong added a comment.

In https://reviews.llvm.org/D32720#794481, @efriedma wrote:

> Thinking about it a bit more, instead of storing a list of instructions which can exit the loop early, you could store a list of basic blocks which are guaranteed to execute, and a mapping from those basic blocks to the first instruction in each basic block which could exit early.  That would allow "constant-time" lookups, at the expense of a bit more computation upfront.
>
> I agree it doesn't make sense to try to recompute if an early exit is erased; that should be very rare.  (Granted, it might be a little bit more common than it should be: it looks like isGuaranteedToTransferExecutionToSuccessor is missing a few important cases which isInstructionTriviallyDead catches.)


I think thats a good idea. We need to walk the DT and keep pushing the blocks that are guaranteed to execute into a list. When we hit an early exit instruction, we do not need to process its children on the DT, and we keep a pointer to the instruction.

This way, we only need to lookup this DenseSet of basic blocks and possibly do some fiddling with basic blocks that are partially guaranteed to execute.


https://reviews.llvm.org/D32720





More information about the llvm-commits mailing list