CodeGen: Find PHI sources while rewriting PHIs in SplitCriticalEdge (#230500)
SplitCriticalEdge scanned every operand of every PHI in Succ twice per
split: once in replacePhiUsesWith to retarget the incoming block, then
again with LiveIntervals to find the registers now coming from the new
block. Collect the source registers while retargeting the operands, so
each split scans Succ's PHIs only once.
Instructions retired in phi-node-elimination, x86_64 -O3, on a generated
chain of N compare blocks branching to a shared PHI block:
N before after after/before
1k 89,072,376 69,208,524 0.78
2k 330,305,622 251,128,551 0.76
4k 1,140,509,526 818,125,849 0.72
8k 4,134,353,260 2,851,571,872 0.69
16k 15,538,463,961 10,437,522,736 0.67
gcc-c-torture compile/20001226-1.c (liveintervals,phi-node-elimination
on the pre-PHIElimination MIR): 1,131,964,337 -> 813,420,169.
Whole llc on the 16k input: 78,266,594,024 -> 73,171,746,875.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>