Skip to content

Commit 5b524da

Browse files
committed
[InstCombine] Add test for unused atomic load from non-constant global (NFC)
1 parent 027c728 commit 5b524da

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

llvm/test/Transforms/InstCombine/atomic.ll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ define void @no_atomic_vector_store(<2 x float> %p, i8* %p2) {
422422
}
423423

424424
@c = constant i32 42
425+
@g = global i32 42
425426

426427
define i32 @atomic_load_from_constant_global() {
427428
; CHECK-LABEL: @atomic_load_from_constant_global(
@@ -441,6 +442,15 @@ define i8 @atomic_load_from_constant_global_bitcast() {
441442
ret i8 %v
442443
}
443444

445+
define void @atomic_load_from_non_constant_global() {
446+
; CHECK-LABEL: @atomic_load_from_non_constant_global(
447+
; CHECK-NEXT: [[TMP1:%.*]] = load atomic i32, i32* @g seq_cst, align 4
448+
; CHECK-NEXT: ret void
449+
;
450+
load atomic i32, i32* @g seq_cst, align 4
451+
ret void
452+
}
453+
444454
define void @volatile_load_from_constant_global() {
445455
; CHECK-LABEL: @volatile_load_from_constant_global(
446456
; CHECK-NEXT: [[TMP1:%.*]] = load volatile i32, i32* @c, align 4

0 commit comments

Comments
 (0)