[llvm] [ConstraintElim] Add NUW flag to sub if x >=u y. (PR #218685)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 07:33:05 PDT 2026
github-actions[bot] wrote:
<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results
* 140352 tests passed
* 3711 tests skipped
* 3 tests failed
## Failed Tests
(click on a test name to see its output)
### Clang
<details>
<summary>Clang.CodeGen/attr-counted-by-for-pointers.c</summary>
```
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\24\include -nostdsysteminc -triple x86_64-unknown-linux-gnu -O2 -DWITH_ATTRS -Wall -fsanitize=array-bounds,object-size,local-bounds -fstrict-flex-arrays=3 -fexperimental-late-parse-attributes -emit-llvm -o - C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-for-pointers.c | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe --check-prefix=SANITIZE-WITH-ATTR C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-for-pointers.c
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\24\include' -nostdsysteminc -triple x86_64-unknown-linux-gnu -O2 -DWITH_ATTRS -Wall -fsanitize=array-bounds,object-size,local-bounds -fstrict-flex-arrays=3 -fexperimental-late-parse-attributes -emit-llvm -o - 'C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-for-pointers.c'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' --check-prefix=SANITIZE-WITH-ATTR 'C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-for-pointers.c'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-for-pointers.c:265:30: error: SANITIZE-WITH-ATTR-LABEL: expected string not found in input
# | // SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 -17179869168, 34359738361) i64 @test_bdos_of_element_address(
# | ^
# | <stdin>:106:94: note: scanning from here
# | define dso_local range(i64 -17179869184, 17179869177) i64 @test_bdos_of_pointer_through_cast(ptr noundef %p, i32 noundef %index) local_unnamed_addr #0 {
# | ^
# | <stdin>:118:1: note: possible intended match here
# | define dso_local range(i64 0, 17179869177) i64 @test_bdos_of_element_address(ptr noundef %p, i32 noundef %index) local_unnamed_addr #0 {
# | ^
# |
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-for-pointers.c
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# | .
# | .
# | .
# | 101: %1 = select i1 %0, i64 %array_size, i64 0
# | 102: ret i64 %1
# | 103: }
# | 104:
# | 105: ; Function Attrs: nounwind
# | 106: define dso_local range(i64 -17179869184, 17179869177) i64 @test_bdos_of_pointer_through_cast(ptr noundef %p, i32 noundef %index) local_unnamed_addr #0 {
# | label:265'0 { search range start (exclusive)
# | label:265'1 error: no match found in search range
# | 107: entry:
# | 108: %counted_by.gep = getelementptr inbounds nuw i8, ptr %p, i64 16
# | 109: %counted_by.load = load i32, ptr %counted_by.gep, align 4
# | 110: %count = sext i32 %counted_by.load to i64
# | 111: %array_size = shl nsw i64 %count, 3
# | 112: %0 = icmp sgt i32 %counted_by.load, -1
# | 113: %1 = select i1 %0, i64 %array_size, i64 0
# | 114: ret i64 %1
# | 115: }
# | 116:
# | 117: ; Function Attrs: nounwind
# | 118: define dso_local range(i64 0, 17179869177) i64 @test_bdos_of_element_address(ptr noundef %p, i32 noundef %index) local_unnamed_addr #0 {
# | label:265'2 ? possible intended match
# | 119: entry:
# | 120: %.counted_by.gep = getelementptr inbounds nuw i8, ptr %p, i64 16
# | 121: %.counted_by.load = load i32, ptr %.counted_by.gep, align 4
# | 122: %0 = icmp ule i32 %index, %.counted_by.load, !nosanitize !6
# | 123: %1 = icmp sgt i32 %.counted_by.load, 0, !nosanitize !6
# | .
# | .
# | .
# | 254: !13 = !{!"any pointer", !4, i64 0}
# | 255: !14 = !{!15, !15, i64 0}
# | 256: !15 = !{!"p1 _ZTS3foo", !13, i64 0}
# | 257: !16 = !{!17, !18, i64 0}
# | 258: !17 = !{!"annotated_volatile_ptr", !18, i64 0, !3, i64 8}
# | 259: !18 = !{!"p1 int", !13, i64 0}
# | label:265'3 } search range end (exclusive)
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
--
```
</details>
<details>
<summary>Clang.CodeGen/attr-counted-by-with-sanitizers.c</summary>
```
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\24\include -nostdsysteminc -triple x86_64-unknown-linux-gnu -DCOUNTED_BY -O2 -Wall -fsanitize=array-bounds,object-size,local-bounds -fstrict-flex-arrays=3 -emit-llvm -o - C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe --check-prefix=SANITIZE-WITH-ATTR C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\24\include' -nostdsysteminc -triple x86_64-unknown-linux-gnu -DCOUNTED_BY -O2 -Wall -fsanitize=array-bounds,object-size,local-bounds -fstrict-flex-arrays=3 -emit-llvm -o - 'C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c:1591:41: warning: left operand of comma operator has no effect [-Wunused-value]
# | 1591 | return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# | | ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c:1591:48: warning: left operand of comma operator has no effect [-Wunused-value]
# | 1591 | return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# | | ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c:1591:55: warning: left operand of comma operator has no effect [-Wunused-value]
# | 1591 | return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# | | ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c:1591:58: warning: left operand of comma operator has no effect [-Wunused-value]
# | 1591 | return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# | | ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c:1591:65: warning: left operand of comma operator has no effect [-Wunused-value]
# | 1591 | return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# | | ^~
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c:1591:61: warning: left operand of comma operator has no effect [-Wunused-value]
# | 1591 | return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# | | ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c:1591:51: warning: left operand of comma operator has no effect [-Wunused-value]
# | 1591 | return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# | | ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c:1591:44: warning: left operand of comma operator has no effect [-Wunused-value]
# | 1591 | return __builtin_dynamic_object_size((1, 2, (4, 5, (7, 8, 9, (10, ptr->array)))), 1);
# | | ^
# | 8 warnings generated.
# `-----------------------------
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' --check-prefix=SANITIZE-WITH-ATTR 'C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c:306:30: error: SANITIZE-WITH-ATTR-LABEL: expected string not found in input
# | // SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 -8589934584, 17179869181) i64 @test_return_bdos_of_pointer_into_fam(
# | ^
# | <stdin>:194:61: note: scanning from here
# | define dso_local void @test_assign_size_of_pointer_into_fam(ptr noundef %p, i32 noundef %index, i32 noundef %fam_idx) local_unnamed_addr #0 {
# | ^
# | <stdin>:271:1: note: possible intended match here
# | define dso_local range(i64 0, 8589934589) i64 @test_return_bdos_of_pointer_into_fam(ptr noundef %p, i32 noundef %index) local_unnamed_addr #0 {
# | ^
# |
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-counted-by-with-sanitizers.c
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# | .
# | .
# | .
# | 189: entry:
# | 190: ret i64 -1
# | 191: }
# | 192:
# | 193: ; Function Attrs: nounwind
# | 194: define dso_local void @test_assign_size_of_pointer_into_fam(ptr noundef %p, i32 noundef %index, i32 noundef %fam_idx) local_unnamed_addr #0 {
# | label:306'0 { search range start (exclusive)
# | label:306'1 error: no match found in search range
# | 195: entry:
# | 196: %array = getelementptr inbounds nuw i8, ptr %p, i64 12
# | 197: %.counted_by.gep = getelementptr inbounds nuw i8, ptr %p, i64 8
# | 198: %.counted_by.load = load i32, ptr %.counted_by.gep, align 4
# | 199: %0 = icmp sgt i32 %.counted_by.load, 2
# | .
# | .
# | .
# | 266: store i32 %8, ptr %arrayidx65, align 4, !tbaa !8
# | 267: ret void
# | 268: }
# | 269:
# | 270: ; Function Attrs: nounwind
# | 271: define dso_local range(i64 0, 8589934589) i64 @test_return_bdos_of_pointer_into_fam(ptr noundef %p, i32 noundef %index) local_unnamed_addr #0 {
# | label:306'2 ? possible intended match
# | 272: entry:
# | 273: %.counted_by.gep = getelementptr inbounds nuw i8, ptr %p, i64 8
# | 274: %.counted_by.load = load i32, ptr %.counted_by.gep, align 4
# | 275: %0 = icmp ule i32 %index, %.counted_by.load, !nosanitize !6
# | 276: %1 = icmp sgt i32 %.counted_by.load, 0, !nosanitize !6
# | .
# | .
# | .
# | 1070: !24 = !{!25, !25, i64 0}
# | 1071: !25 = !{!"p1 _ZTS9annotated", !15, i64 0}
# | 1072: !26 = !{!27, !27, i64 0}
# | 1073: !27 = !{!"long", !4, i64 0}
# | 1074: !28 = !{!29, !29, i64 0}
# | 1075: !29 = !{!"p1 _ZTS3baz", !15, i64 0}
# | label:306'3 } search range end (exclusive)
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
--
```
</details>
<details>
<summary>Clang.CodeGen/attr-sized-by-for-pointers.c</summary>
```
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\24\include -nostdsysteminc -triple x86_64-unknown-linux-gnu -O2 -DWITH_ATTRS -Wall -fsanitize=array-bounds,object-size,local-bounds -fstrict-flex-arrays=3 -fexperimental-late-parse-attributes -emit-llvm -o - C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-sized-by-for-pointers.c | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe --check-prefix=SANITIZE-WITH-ATTR C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-sized-by-for-pointers.c
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\24\include' -nostdsysteminc -triple x86_64-unknown-linux-gnu -O2 -DWITH_ATTRS -Wall -fsanitize=array-bounds,object-size,local-bounds -fstrict-flex-arrays=3 -fexperimental-late-parse-attributes -emit-llvm -o - 'C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-sized-by-for-pointers.c'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' --check-prefix=SANITIZE-WITH-ATTR 'C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-sized-by-for-pointers.c'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-sized-by-for-pointers.c:61:30: error: SANITIZE-WITH-ATTR-LABEL: expected string not found in input
# | // SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 -2147483646, 4294967296) i64 @test_bdos_of_element_address(
# | ^
# | <stdin>:21:69: note: scanning from here
# | define dso_local range(i64 0, 2147483648) i64 @test_bdos_of_pointer(ptr noundef %p) local_unnamed_addr #0 {
# | ^
# | <stdin>:31:1: note: possible intended match here
# | define dso_local range(i64 0, 2147483648) i64 @test_bdos_of_element_address(ptr noundef %p, i32 noundef %index) local_unnamed_addr #0 {
# | ^
# |
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\clang\test\CodeGen\attr-sized-by-for-pointers.c
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# | .
# | .
# | .
# | 16: @9 = private unnamed_addr global { { ptr, i32, i32 }, ptr, ptr } { { ptr, i32, i32 } { ptr @.src, i32 469, i32 32 }, ptr @7, ptr @1 }
# | 17: @10 = private unnamed_addr constant { i16, i16, [17 x i8] } { i16 -1, i16 0, [17 x i8] c"'unsigned int *'\00" }
# | 18: @11 = private unnamed_addr global { { ptr, i32, i32 }, ptr, ptr } { { ptr, i32, i32 } { ptr @.src, i32 521, i32 10 }, ptr @10, ptr @1 }
# | 19:
# | 20: ; Function Attrs: nounwind
# | 21: define dso_local range(i64 0, 2147483648) i64 @test_bdos_of_pointer(ptr noundef %p) local_unnamed_addr #0 {
# | label:61'0 { search range start (exclusive)
# | label:61'1 error: no match found in search range
# | 22: entry:
# | 23: %counted_by.gep = getelementptr inbounds nuw i8, ptr %p, i64 16
# | 24: %counted_by.load = load i32, ptr %counted_by.gep, align 4
# | 25: %narrow = tail call i32 @llvm.smax.i32(i32 %counted_by.load, i32 0)
# | 26: %0 = zext nneg i32 %narrow to i64
# | 27: ret i64 %0
# | 28: }
# | 29:
# | 30: ; Function Attrs: nounwind
# | 31: define dso_local range(i64 0, 2147483648) i64 @test_bdos_of_element_address(ptr noundef %p, i32 noundef %index) local_unnamed_addr #0 {
# | label:61'2 ? possible intended match
# | 32: entry:
# | 33: %.counted_by.gep = getelementptr inbounds nuw i8, ptr %p, i64 16
# | 34: %.counted_by.load = load i32, ptr %.counted_by.gep, align 4
# | 35: %0 = icmp ule i32 %index, %.counted_by.load, !nosanitize !6
# | 36: %1 = icmp sgt i32 %.counted_by.load, 0, !nosanitize !6
# | .
# | .
# | .
# | 232: !6 = !{}
# | 233: !7 = !{!"branch_weights", i32 1048575, i32 1}
# | 234: !8 = !{!9, !10, i64 0}
# | 235: !9 = !{!"annotated_volatile_ptr", !10, i64 0, !3, i64 8}
# | 236: !10 = !{!"p1 int", !11, i64 0}
# | 237: !11 = !{!"any pointer", !4, i64 0}
# | label:61'3 } search range end (exclusive)
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
--
```
</details>
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.
https://github.com/llvm/llvm-project/pull/218685
More information about the llvm-commits
mailing list