[llvm] [Instcombine] Write Instcombine pass to strength reduce lock xadd to lock sub (PR #184715)

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 08:11:07 PST 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 170758 tests passed
* 3012 tests skipped
* 6 tests failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.Transforms/InstCombine/atomicrmw.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=instcombine -S -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/atomicrmw.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/atomicrmw.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=instcombine -S -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/atomicrmw.ll
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/atomicrmw.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/atomicrmw.ll:163:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[RES:%.*]] = atomicrmw add ptr [[ADDR:%.*]], i16 2 monotonic, align 2
# |               ^
# | <stdin>:79:33: note: scanning from here
# | define i16 @atomic_add_non_zero(ptr %addr) {
# |                                 ^
# | <stdin>:80:2: note: possible intended match here
# |  %res = atomicrmw sub ptr %addr, i16 -2 monotonic, align 2
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/atomicrmw.ll:590:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[RES:%.*]] = atomicrmw add ptr [[ADDR:%.*]], i16 2 syncscope("agent") monotonic, align 2, !mmra [[META0]], !amdgpu.no.fine.grained.host.memory [[META1]], !amdgpu.no.remote.memory.access [[META1]]
# |               ^
# | <stdin>:304:45: note: scanning from here
# | define i16 @atomic_add_non_zero_preserve_md(ptr %addr) {
# |                                             ^
# | <stdin>:304:45: note: with "META0" equal to "!0"
# | define i16 @atomic_add_non_zero_preserve_md(ptr %addr) {
# |                                             ^
# | <stdin>:304:45: note: with "META1" equal to "!1"
# | define i16 @atomic_add_non_zero_preserve_md(ptr %addr) {
# |                                             ^
# | <stdin>:304:45: note: with "META1" equal to "!1"
# | define i16 @atomic_add_non_zero_preserve_md(ptr %addr) {
# |                                             ^
# | <stdin>:305:2: note: possible intended match here
# |  %res = atomicrmw sub ptr %addr, i16 -2 syncscope("agent") monotonic, align 2, !mmra !0, !amdgpu.no.fine.grained.host.memory !1, !amdgpu.no.remote.memory.access !1
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/atomicrmw.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            74: define i16 @atomic_seq_cst(ptr %addr) { 
# |            75:  %res = atomicrmw or ptr %addr, i16 0 seq_cst, align 2 
# |            76:  ret i16 %res 
# |            77: } 
# |            78:  
# |            79: define i16 @atomic_add_non_zero(ptr %addr) { 
# | next:163'0                                     X~~~~~~~~~~~~ error: no match found
# |            80:  %res = atomicrmw sub ptr %addr, i16 -2 monotonic, align 2 
# | next:163'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:163'1      ?                                                          possible intended match
# |            81:  ret i16 %res 
# | next:163'0     ~~~~~~~~~~~~~~
# |            82: } 
# | next:163'0     ~~
# |            83:  
# | next:163'0     ~
# |            84: define i16 @atomic_xor_zero(ptr %addr) { 
# | next:163'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            85:  %res = atomicrmw or ptr %addr, i16 0 monotonic, align 2 
# |             .
# |             .
# |             .
# |           299: define i16 @atomic_seq_cst_preserve_md(ptr %addr) { 
# |           300:  %res = atomicrmw or ptr %addr, i16 0 seq_cst, align 2, !mmra !0, !amdgpu.no.fine.grained.host.memory !1, !amdgpu.no.remote.memory.access !1 
# |           301:  ret i16 %res 
# |           302: } 
# |           303:  
# |           304: define i16 @atomic_add_non_zero_preserve_md(ptr %addr) { 
# | next:590'0                                                 X~~~~~~~~~~~~ error: no match found
# | next:590'1                                                               with "META0" equal to "!0"
# | next:590'2                                                               with "META1" equal to "!1"
# | next:590'3                                                               with "META1" equal to "!1"
# |           305:  %res = atomicrmw sub ptr %addr, i16 -2 syncscope("agent") monotonic, align 2, !mmra !0, !amdgpu.no.fine.grained.host.memory !1, !amdgpu.no.remote.memory.access !1 
# | next:590'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:590'4      ?                                                                                                                                                                   possible intended match
# |           306:  ret i16 %res 
# | next:590'0     ~~~~~~~~~~~~~~
# |           307: } 
# | next:590'0     ~~
# |           308:  
# | next:590'0     ~
# |           309: define i16 @atomic_xor_zero_preserve_md(ptr %addr) { 
# | next:590'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           310:  %res = atomicrmw or ptr %addr, i16 0 syncscope("agent") monotonic, align 2, !mmra !0, !amdgpu.no.fine.grained.host.memory !1, !amdgpu.no.remote.memory.access !1 
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.Transforms/InstCombine/sink_sideeffecting_instruction.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=instcombine -S < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=instcombine -S
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll:467:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[VAR3:%.*]] = atomicrmw add ptr [[VAR]], i32 1 seq_cst, align 4
# |               ^
# | <stdin>:248:32: note: scanning from here
# |  store i32 0, ptr %var, align 4
# |                                ^
# | <stdin>:248:32: note: with "VAR" equal to "%var"
# |  store i32 0, ptr %var, align 4
# |                                ^
# | <stdin>:249:6: note: possible intended match here
# |  %var3 = atomicrmw sub ptr %var, i32 -1 seq_cst, align 4
# |      ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           243: } 
# |           244:  
# |           245: define i32 @sink_atomicrmw_to_use(i1 %c) { 
# |           246: entry: 
# |           247:  %var = alloca i32, align 4 
# |           248:  store i32 0, ptr %var, align 4 
# | next:467'0                                    X error: no match found
# | next:467'1                                      with "VAR" equal to "%var"
# |           249:  %var3 = atomicrmw sub ptr %var, i32 -1 seq_cst, align 4 
# | next:467'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:467'2          ?                                                    possible intended match
# |           250:  br i1 %c, label %early_return, label %use_block 
# | next:467'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           251:  
# | next:467'0     ~
# |           252: early_return: ; preds = %entry 
# | next:467'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           253:  ret i32 0 
# | next:467'0     ~~~~~~~~~~~
# |           254:  
# | next:467'0     ~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

### Clang
<details>
<summary>Clang.CodeGen/ms-intrinsics-other.c</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -ffreestanding -fms-extensions -Wno-implicit-function-declaration          -triple x86_64--darwin -Oz -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics-other.c -o -          | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics-other.c
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -ffreestanding -fms-extensions -Wno-implicit-function-declaration -triple x86_64--darwin -Oz -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics-other.c -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics-other.c
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics-other.c:172:11: error: CHECK: expected string not found in input
# | // CHECK: [[TMP:%[0-9]+]] = atomicrmw add ptr %Addend, i32 1 seq_cst, align 4
# |           ^
# | <stdin>:137:98: note: scanning from here
# | define i32 @test_InterlockedIncrement(ptr noundef captures(none) %Addend) local_unnamed_addr #2 {
# |                                                                                                  ^
# | <stdin>:147:2: note: possible intended match here
# |  %0 = atomicrmw sub ptr %Addend, i32 1 seq_cst, align 4
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics-other.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |            132:  %1 = extractvalue { i32, i1 } %0, 0 
# |            133:  ret i32 %1 
# |            134: } 
# |            135:  
# |            136: ; Function Attrs: minsize mustprogress nofree norecurse nounwind optsize willreturn memory(argmem: readwrite) 
# |            137: define i32 @test_InterlockedIncrement(ptr noundef captures(none) %Addend) local_unnamed_addr #2 { 
# | check:172'0                                                                                                      X error: no match found
# |            138: entry: 
# | check:172'0     ~~~~~~~
# |            139:  %0 = atomicrmw sub ptr %Addend, i32 -1 seq_cst, align 4 
# | check:172'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            140:  %1 = add i32 %0, 1 
# | check:172'0     ~~~~~~~~~~~~~~~~~~~~
# |            141:  ret i32 %1 
# | check:172'0     ~~~~~~~~~~~~
# |            142: } 
# | check:172'0     ~~
# |            143:  
# | check:172'0     ~
# |            144: ; Function Attrs: minsize mustprogress nofree norecurse nounwind optsize willreturn memory(argmem: readwrite) 
# | check:172'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            145: define i32 @test_InterlockedDecrement(ptr noundef captures(none) %Addend) local_unnamed_addr #2 { 
# | check:172'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            146: entry: 
# | check:172'0     ~~~~~~~
# |            147:  %0 = atomicrmw sub ptr %Addend, i32 1 seq_cst, align 4 
# | check:172'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:172'1      ?                                                       possible intended match
# |            148:  %1 = add i32 %0, -1 
# | check:172'0     ~~~~~~~~~~~~~~~~~~~~~
# |            149:  ret i32 %1 
# | check:172'0     ~~~~~~~~~~~~
# |            150: } 
# | check:172'0     ~~
# |            151:  
# | check:172'0     ~
# |            152: ; Function Attrs: minsize mustprogress nofree norecurse nosync nounwind optsize willreturn memory(none) 
# | check:172'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |              .
# |              .
# |              .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>Clang.CodeGen/ms-intrinsics.c</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00          -triple i686--windows -Oz -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics.c -o -          | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics.c -check-prefixes CHECK,CHECK-I386,CHECK-INTEL
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 -triple i686--windows -Oz -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics.c -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics.c -check-prefixes CHECK,CHECK-I386,CHECK-INTEL
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics.c:556:11: error: CHECK: expected string not found in input
# | // CHECK: [[TMP:%[0-9]+]] = atomicrmw add ptr %incdec.ptr, i16 1 seq_cst, align 2
# |           ^
# | <stdin>:321:65: note: scanning from here
# |  %incdec.ptr = getelementptr inbounds nuw i8, ptr %Addend, i32 2
# |                                                                 ^
# | <stdin>:322:2: note: possible intended match here
# |  %0 = atomicrmw sub ptr %incdec.ptr, i16 -1 seq_cst, align 2
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/ms-intrinsics.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |            316: } 
# |            317:  
# |            318: ; Function Attrs: minsize mustprogress nofree norecurse nounwind optsize willreturn memory(argmem: readwrite) 
# |            319: define dso_local signext i16 @test_InterlockedIncrement16(ptr noundef captures(none) %Addend) local_unnamed_addr #10 { 
# |            320: entry: 
# |            321:  %incdec.ptr = getelementptr inbounds nuw i8, ptr %Addend, i32 2 
# | check:556'0                                                                     X error: no match found
# |            322:  %0 = atomicrmw sub ptr %incdec.ptr, i16 -1 seq_cst, align 2 
# | check:556'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:556'1      ?                                                            possible intended match
# |            323:  %1 = add i16 %0, 1 
# | check:556'0     ~~~~~~~~~~~~~~~~~~~~
# |            324:  ret i16 %1 
# | check:556'0     ~~~~~~~~~~~~
# |            325: } 
# | check:556'0     ~~
# |            326:  
# | check:556'0     ~
# |            327: ; Function Attrs: minsize mustprogress nofree norecurse nounwind optsize willreturn memory(argmem: readwrite) 
# | check:556'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |              .
# |              .
# |              .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>Clang.CodeGen/sanitize-metadata-ignorelist.c</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -O -fexperimental-sanitize-metadata=atomics -triple x86_64-gnu-linux -x c -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata-ignorelist.c -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata-ignorelist.c --check-prefixes=ALLOW
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -O -fexperimental-sanitize-metadata=atomics -triple x86_64-gnu-linux -x c -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata-ignorelist.c -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata-ignorelist.c --check-prefixes=ALLOW
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata-ignorelist.c:12:16: error: ALLOW-NEXT: expected string not found in input
# | // ALLOW-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 1 monotonic, align 4, !pcsections !7
# |                ^
# | <stdin>:25:7: note: scanning from here
# | entry:
# |       ^
# | <stdin>:26:2: note: possible intended match here
# |  %0 = atomicrmw sub ptr @y, i32 -1 monotonic, align 4, !pcsections !7
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata-ignorelist.c:34:16: error: ALLOW-NEXT: expected string not found in input
# | // ALLOW-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 2 monotonic, align 4, !pcsections !7
# |                ^
# | <stdin>:32:7: note: scanning from here
# | entry:
# |       ^
# | <stdin>:33:2: note: possible intended match here
# |  %0 = atomicrmw sub ptr @y, i32 -2 monotonic, align 4, !pcsections !7
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata-ignorelist.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           20: @llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 2, ptr @__sanitizer_metadata_atomics2.module_ctor, ptr @__sanitizer_metadata_atomics2.module_ctor }, { i32, ptr, ptr } { i32 2, ptr @__sanitizer_metadata_covered2.module_ctor, ptr @__sanitizer_metadata_covered2.module_ctor }] 
# |           21: @llvm.global_dtors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 2, ptr @__sanitizer_metadata_atomics2.module_dtor, ptr @__sanitizer_metadata_atomics2.module_dtor }, { i32, ptr, ptr } { i32 2, ptr @__sanitizer_metadata_covered2.module_dtor, ptr @__sanitizer_metadata_covered2.module_dtor }] 
# |           22:  
# |           23: ; Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none, target_mem0: none, target_mem1: none) 
# |           24: define dso_local void @foo() local_unnamed_addr #0 !pcsections !5 { 
# |           25: entry: 
# | next:12'0           X error: no match found
# |           26:  %0 = atomicrmw sub ptr @y, i32 -1 monotonic, align 4, !pcsections !7 
# | next:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:12'1      ?                                                                     possible intended match
# |           27:  ret void 
# | next:12'0     ~~~~~~~~~~
# |           28: } 
# | next:12'0     ~~
# |           29:  
# | next:12'0     ~
# |           30: ; Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none, target_mem0: none, target_mem1: none) 
# | next:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           31: define dso_local void @bar() local_unnamed_addr #0 !pcsections !5 { 
# | next:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           32: entry: 
# | next:34'0           X error: no match found
# |           33:  %0 = atomicrmw sub ptr @y, i32 -2 monotonic, align 4, !pcsections !7 
# | next:34'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:34'1      ?                                                                     possible intended match
# |           34:  ret void 
# | next:34'0     ~~~~~~~~~~
# |           35: } 
# | next:34'0     ~~
# |           36:  
# | next:34'0     ~
# |           37: declare extern_weak void @__sanitizer_metadata_atomics_add(i32, ptr, ptr) 
# | next:34'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           38:  
# | next:34'0     ~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>Clang.CodeGen/sanitize-metadata.c</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -O -fexperimental-sanitize-metadata=atomics -triple x86_64-gnu-linux -x c -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata.c -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata.c --check-prefixes=CHECK,ATOMICS
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -O -fexperimental-sanitize-metadata=atomics -triple x86_64-gnu-linux -x c -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata.c -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata.c --check-prefixes=CHECK,ATOMICS
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata.c:19:18: error: ATOMICS-NEXT: expected string not found in input
# | // ATOMICS-NEXT: atomicrmw add {{.*}} !pcsections ![[ATOMIC_OP:[0-9]+]]
# |                  ^
# | <stdin>:32:7: note: scanning from here
# | entry:
# |       ^
# | <stdin>:33:39: note: possible intended match here
# |  %0 = atomicrmw sub ptr @x, i32 -1 monotonic, align 4, !pcsections !7
# |                                       ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata.c:36:16: error: undefined variable: ATOMIC_OP
# | // ATOMICS: ![[ATOMIC_OP]] = !{!"sanmd_atomics2!C"}
# |                ^
# | <stdin>:116:1: note: possible intended match here
# | !7 = !{!"sanmd_atomics2!C"}
# | ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/sanitize-metadata.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            27:  ret void 
# |            28: } 
# |            29:  
# |            30: ; Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none, target_mem0: none, target_mem1: none) 
# |            31: define dso_local i32 @atomics() local_unnamed_addr #1 !pcsections !5 { 
# |            32: entry: 
# | next:19'0            X error: no match found
# |            33:  %0 = atomicrmw sub ptr @x, i32 -1 monotonic, align 4, !pcsections !7 
# | next:19'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:19'1                                            ?                                possible intended match
# |            34:  %1 = load i32, ptr @y, align 4, !tbaa !1 
# | next:19'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            35:  ret i32 %1 
# | next:19'0      ~~~~~~~~~~~~
# |            36: } 
# | next:19'0      ~~
# |            37:  
# | next:19'0      ~
# |            38: declare extern_weak void @__sanitizer_metadata_atomics_add(i32, ptr, ptr) 
# | next:19'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# |           110: !1 = !{!2, !2, i64 0} 
# |           111: !2 = !{!"int", !3, i64 0} 
# |           112: !3 = !{!"omnipotent char", !4, i64 0} 
# |           113: !4 = !{!"Simple C/C++ TBAA"} 
# |           114: !5 = !{!"sanmd_covered2!C", !6} 
# |           115: !6 = !{i64 1} 
# | check:36'0                  X error: match failed for invalid pattern
# | check:36'1                    undefined variable: ATOMIC_OP
# |           116: !7 = !{!"sanmd_atomics2!C"} 
# | check:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:36'2     ?                            possible intended match
# | >>>>>>
# `-----------------------------
# 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/184715


More information about the llvm-commits mailing list