| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals |
| ; RUN: opt -S -passes=globalopt < %s | FileCheck %s |
| |
| %type = type { { ptr } } |
| |
| @g = internal global %type zeroinitializer |
| @g2 = external global ptr |
| |
| @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @ctor, ptr null }] |
| |
| ;. |
| ; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal global [[TYPE:%.*]] { { ptr } { ptr @g2 } } |
| ; CHECK: @[[G2:[a-zA-Z0-9_$"\\.-]+]] = external global ptr |
| ; CHECK: @[[LLVM_GLOBAL_CTORS:[a-zA-Z0-9_$"\\.-]+]] = appending global [0 x { i32, ptr, ptr }] zeroinitializer |
| ;. |
| define internal void @ctor() { |
| store i64 0, ptr @g, align 8 |
| store ptr @g2, ptr @g, align 8 |
| ret void |
| } |
| |
| define ptr @test() { |
| ; CHECK-LABEL: @test( |
| ; CHECK-NEXT: ret ptr @g |
| ; |
| ret ptr @g |
| } |