Commit e54168f4c2 for perl
commit e54168f4c25c8315d4c971a2376731966e3ad12b
Author: Yves Orton <demerphq@gmail.com>
Date: Sun Oct 18 19:36:53 2026 +0200
regex: tighten the repeated-word scan loop
Advance and check the bounds after each successful word comparison.
This gives GCC a smaller loop with shorter branches when scanning long
runs of identical words.
diff --git a/regexec.c b/regexec.c
index 3c9fa3574d..b7ef06cb32 100644
--- a/regexec.c
+++ b/regexec.c
@@ -2445,13 +2445,12 @@ S_scan_repeated_uv_blocks(const U8 *p, const U8 *end, const U8 *last_start,
if (pattern != value)
return p;
- p += block_size;
- while (p < start_limit && (STRLEN)(end - p) >= block_size) {
- memcpy(&value, p, block_size);
- if (value != pattern)
- return p;
+ do {
p += block_size;
- }
+ if (p >= start_limit || (STRLEN)(end - p) < block_size)
+ return p;
+ Copy(p, &value, block_size, U8);
+ } while (value == pattern);
return p;
}