https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113907
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> --- There are significant differences in the ranges starting with evrp. Even optimized has: --- pr113907.ii.261t.optimized_ 2024-02-13 09:52:13.090609512 -0500 +++ pr113907.ii.261t.optimized 2024-02-13 09:53:35.691479080 -0500 @@ -576,7 +576,7 @@ int32_t uprv_copyArray16 (const struct U goto <bb 10>; [67.00%] <bb 9> [local count: 43795362]: - # RANGE [irange] unsigned int [2, 2147483647] MASK 0x7ffffff8 VALUE 0x0 + # RANGE [irange] unsigned int [8, 2147483647] MASK 0x7ffffff8 VALUE 0x0 length.37_21 = (unsigned int) length_14(D); memcpy (outData_15(D), inData_13(D), length.37_21); @@ -676,14 +676,14 @@ int32_t uprv_copyArray64 (const struct U goto <bb 10>; [67.00%] <bb 9> [local count: 43795362]: - # RANGE [irange] unsigned int [1, 2147483647] MASK 0x7ffffff8 VALUE 0x0 + # RANGE [irange] unsigned int [8, 2147483647] MASK 0x7ffffff8 VALUE 0x0 length.37_21 = (unsigned int) length_14(D); memcpy (outData_15(D), inData_13(D), length.37_21); <bb 10> [local count: 88917857]: <bb 11> [local count: 1073741824]: - # RANGE [irange] int32_t [0, +INF] MASK 0x7fffffff VALUE 0x0 + # RANGE [irange] int32_t [0, 0][8, +INF] MASK 0x7fffffff VALUE 0x0 # _6 = PHI <0(7), length_14(D)(10)> return _6; @@ -776,14 +776,14 @@ int32_t uprv_copyArray32 (const struct U goto <bb 10>; [67.00%] <bb 9> [local count: 43795362]: - # RANGE [irange] unsigned int [1, 2147483647] MASK 0x7ffffff8 VALUE 0x0 + # RANGE [irange] unsigned int [8, 2147483647] MASK 0x7ffffff8 VALUE 0x0 length.37_21 = (unsigned int) length_14(D); memcpy (outData_15(D), inData_13(D), length.37_21); <bb 10> [local count: 88917857]: <bb 11> [local count: 1073741824]: - # RANGE [irange] int32_t [0, +INF] MASK 0x7fffffff VALUE 0x0 + # RANGE [irange] int32_t [0, 0][4, +INF] MASK 0x7fffffff VALUE 0x0 # _6 = PHI <0(7), length_14(D)(10)> return _6; So it certainly doesn't surprise me some length < 8 check is optimized away given the above range info. The question is if it is correct and what values the length actually get at runtime if you e.g. compile with -O0.