xref: /llvm-project/llvm/test/Transforms/GlobalOpt/const-return-status-atomic.ll (revision d586bd5ca231a6022f439d4c6e43cfeeb53eb1d6)
1; RUN: opt -passes=globalopt < %s -S -o - | FileCheck %s
2
3; When simplifying users of a global variable, the pass could incorrectly
4; return false if there were still some uses left, and no further optimizations
5; was done. This was caught by the pass return status check that is hidden
6; under EXPENSIVE_CHECKS.
7
8@GV1 = internal unnamed_addr global i64 1, align 8
9
10; CHECK-NOT: @GV1 =
11
12define void @test1() local_unnamed_addr {
13; CHECK-LABEL: @test1
14; CHECK-NEXT: ret void
15
16  %val = load atomic i8, ptr @GV1 acquire, align 8
17  ret void
18}
19
20define i64 @test2() local_unnamed_addr {
21; CHECK-LABEL: @test2
22; CHECK-NEXT: ret i64 1
23
24  %val = load atomic i64, ptr @GV1 acquire, align 8
25  ret i64 %val
26}
27