[IPT] Restructure cache to allow lazy update following invalidation [NFC]
authorPhilip Reames <listmail@philipreames.com>
Thu, 21 Oct 2021 16:15:08 +0000 (09:15 -0700)
committerPhilip Reames <listmail@philipreames.com>
Thu, 21 Oct 2021 16:16:21 +0000 (09:16 -0700)
commitbaea663a6e9bc52f80995d02bb8149934c825612
treeee0179ca604c9a86b24244e7cd800e6b9d36e15c
parentacfe7d895d2f0897fe8f79151a491e75a7a99a25
[IPT] Restructure cache to allow lazy update following invalidation [NFC]

This change restructures the cache used in IPT to point not to the first special instruction, but to the first instruction which *could* be special. That is, the cached reference is always equal to the first special, or comes before it in the block.

This avoids expensive block scans when we are removing special instructions from the beginning of the block. At the moment, this case is not heavily used, though it does trigger in GVN when doing CSE of calls. The main motivation was a change I'm no longer planning to move forward with, but the cache optimization seemed worthwhile as a minor perf win at low cost.

Differential Revision: https://reviews.llvm.org/D111768
llvm/include/llvm/Analysis/InstructionPrecedenceTracking.h
llvm/lib/Analysis/InstructionPrecedenceTracking.cpp