xref: /llvm-project/llvm/test/Transforms/GlobalDCE/externally_available.ll (revision 8570893cfde8a82c723eaa4608c1e2ebe764a285)
1; RUN: opt < %s -passes=globaldce -S | FileCheck %s
2
3; test_global should not be emitted to the .s file.
4; CHECK-NOT: @test_global =
5@test_global = available_externally global i32 4
6
7; test_global2 is a normal global using an available externally function.
8; CHECK: @test_global2 =
9@test_global2 = global ptr @test_function2
10
11; test_function should not be emitted to the .s file.
12; CHECK-NOT: define {{.*}} @test_function()
13define available_externally i32 @test_function() {
14  ret i32 4
15}
16
17; test_function2 isn't actually dead even though it's available externally.
18; CHECK: define available_externally i32 @test_function2()
19define available_externally i32 @test_function2() {
20  ret i32 4
21}
22