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