[mlir][mem2reg][NFCI] Only scan blocks that interact with the promoted slot (#244298)
`promoteInBlock` walks every operation of every block in the slot's
region, once per promoted slot, so promotion cost grows with slots times
operations even when each slot is used in a few blocks.
Only blocks holding a blocking use or a region to promote can read or
redefine the slot. `promoteSlot` now collects those blocks, and
`promoteInBlock` forwards the reaching definition through any other
block without visiting its operations. The interface docs now state two
properties every in-tree implementation already has and this relies on:
`storesTo` implies a blocking use, and `setupPromotion` does not move
operations across blocks.
`mlir-opt --mem2reg`, one function with 6,000 allocas over 3,000
diamonds (9,001 blocks), median of 5 runs, byte-identical output:
| Input | Before | After |
|--------------|---------|--------|
| LLVM dialect | 12.77 s | 4.81 s |
| memref + cf | 12.79 s | 4.84 s |
On a large ClangIR module (25,697 allocas), Mem2Reg goes from 17.8 s to
3.6 s and the whole compile from 63 s to 48 s, same object output.