1 ; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=atomic-ordering --test FileCheck --test-arg --check-prefixes=INTERESTING,CHECK --test-arg %s --test-arg --input-file %s -o %t
2 ; RUN: FileCheck -check-prefixes=RESULT,CHECK %s < %t
4 ; CHECK-LABEL: @load_atomic_keep(
6 ; RESULT: %op = load atomic i32, ptr %ptr syncscope("agent") seq_cst, align 4
7 define i32 @load_atomic_keep(ptr %ptr) {
8 %op = load atomic i32, ptr %ptr syncscope("agent") seq_cst, align 4
12 ; CHECK-LABEL: @load_atomic_drop(
14 ; RESULT: %op = load i32, ptr %ptr, align 4
15 define i32 @load_atomic_drop(ptr %ptr) {
16 %op = load atomic i32, ptr %ptr syncscope("agent") seq_cst, align 4
20 ; CHECK-LABEL: @store_atomic_keep(
21 ; INTERESTING: syncscope("agent")
22 ; RESULT: store atomic i32 0, ptr %ptr syncscope("agent") seq_cst, align 4
23 define void @store_atomic_keep(ptr %ptr) {
24 store atomic i32 0, ptr %ptr syncscope("agent") seq_cst, align 4
28 ; CHECK-LABEL: @store_atomic_drop(
30 ; RESULT: store i32 0, ptr %ptr, align 4
31 define void @store_atomic_drop(ptr %ptr) {
32 store atomic i32 0, ptr %ptr syncscope("agent") seq_cst, align 4
36 ; CHECK-LABEL: @atomicrmw_atomic_seq_cst_keep(
37 ; INTERESTING: seq_cst
38 ; RESULT: %val = atomicrmw add ptr %ptr, i32 3 syncscope("agent") seq_cst, align 4
39 define i32 @atomicrmw_atomic_seq_cst_keep(ptr %ptr) {
40 %val = atomicrmw add ptr %ptr, i32 3 syncscope("agent") seq_cst, align 4
44 ; CHECK-LABEL: @atomicrmw_atomic_seq_cst_drop(
45 ; INTERESTING: atomicrmw
46 ; RESULT: %val = atomicrmw add ptr %ptr, i32 3 monotonic, align 4
47 define i32 @atomicrmw_atomic_seq_cst_drop(ptr %ptr) {
48 %val = atomicrmw add ptr %ptr, i32 3 seq_cst
52 ; CHECK-LABEL: @cmpxchg_atomic_seq_cst_seq_cst_keep(
53 ; INTERESTING: seq_cst seq_cst
54 ; RESULT: %val = cmpxchg ptr %ptr, i32 %old, i32 %in syncscope("agent") seq_cst seq_cst, align 4
55 define { i32, i1 } @cmpxchg_atomic_seq_cst_seq_cst_keep(ptr %ptr, i32 %old, i32 %in) {
56 %val = cmpxchg ptr %ptr, i32 %old, i32 %in syncscope("agent") seq_cst seq_cst
60 ; CHECK-LABEL: @cmpxchg_seq_cst_seq_cst_keep_left(
61 ; INTERESTING: syncscope("agent") seq_cst
62 ; RESULT: %val = cmpxchg ptr %ptr, i32 %old, i32 %in syncscope("agent") seq_cst monotonic, align 4
63 define { i32, i1 } @cmpxchg_seq_cst_seq_cst_keep_left(ptr %ptr, i32 %old, i32 %in) {
64 %val = cmpxchg ptr %ptr, i32 %old, i32 %in syncscope("agent") seq_cst seq_cst
68 ; CHECK-LABEL: @cmpxchg_seq_cst_seq_cst_keep_right(
69 ; INTERESTING: seq_cst, align 4
70 ; RESULT: %val = cmpxchg ptr %ptr, i32 %old, i32 %in syncscope("agent") monotonic seq_cst, align 4
71 define { i32, i1 } @cmpxchg_seq_cst_seq_cst_keep_right(ptr %ptr, i32 %old, i32 %in) {
72 %val = cmpxchg ptr %ptr, i32 %old, i32 %in syncscope("agent") seq_cst seq_cst, align 4
76 ; CHECK-LABEL: @cmpxchg_seq_cst_seq_cst_drop(
77 ; INTERESTING: = cmpxchg ptr
78 ; RESULT: %val = cmpxchg ptr %ptr, i32 %old, i32 %in syncscope("agent") monotonic monotonic, align 4
79 define { i32, i1 } @cmpxchg_seq_cst_seq_cst_drop(ptr %ptr, i32 %old, i32 %in) {
80 %val = cmpxchg ptr %ptr, i32 %old, i32 %in syncscope("agent") seq_cst seq_cst