llvm-project
4c0d3e84 - [libc][regex] Make ExprPool alt spines iterative (#245590)

Commit
7 hours ago
[libc][regex] Make ExprPool alt spines iterative (#245590) Wide alternations in ExprPool previously recursed once per branch. Failed coalescing scans also re-scanned remaining branches, causing cubic compile times. Convert make_alt and spine coalescing to iterative loops backed by ReverseOrderBlockStore<ExprId, 16>: * insert_sorted_no_coalesce: direct O(K) insertion after failed scans * coalesce_into_spine: iterative tail/kept coalescing without recursion * splice_into_sorted_spine: direct sorted rebuild with zero throwaway Alt nodes Two-spine merges stay symmetric, and optimised x86-64 frames stay under 256 bytes. derivative still recurses; a later patch converts it. Compliance: Henry Spencer spencer_tests.txt 268/456 Bool/Err (+0) and 84/456 Full Pos (+0); AT&T testregex 399/400 ERE Bool/Err (+0), 401/473 All Bool/Err (+0), and 18/465 Full Pos (+0); zero regressions. Assisted-by: Automated tooling, human reviewed.
Author
Parents
Loading