llvm-project
d159e4f0 - [libc][regex] Make ExprPool concat and star iterative (#244953)

Commit
8 days ago
[libc][regex] Make ExprPool concat and star iterative (#244953) Remove self-recursion from three ExprPool operations so their stack use no longer grows with spine length: * make_star: unwrap nested min <= 1 repeats in a loop * make_concat: flatten and rebuild left spines via ReverseOrderBlockStore<ExprId, 16> * coalesce_repeat_pair: scan shared left prefixes before allocating and re-wrap only when suffixes coalesce Spines of 16 entries or fewer stay in the inline stack buffer. make_alt and derivative still recurse; later patches convert them. 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