| 1 |
; RUN: opt -passes=lower-global-dtors -S < %s | FileCheck %s --implicit-check-not=llvm.global_dtors |
| 2 |
|
| 3 |
; Test that @llvm.global_dtors is completely removed if __cxa_atexit |
| 4 |
; is a no-op (i.e. doesn't use its first argument). |
| 5 |
|
| 6 |
declare void @orig_dtor() |
| 7 |
|
| 8 |
define i32 @__cxa_atexit(ptr, ptr, ptr) { |
| 9 |
ret i32 0 |
| 10 |
} |
| 11 |
|
| 12 |
@llvm.global_dtors = appending global [1 x { i32, ptr, ptr }] [ |
| 13 |
{ i32, ptr, ptr } { i32 0, ptr @orig_dtor, ptr null } |
| 14 |
] |
| 15 |
|
| 16 |
; CHECK-NOT: @llvm.global_dtors |
| 17 |
; CHECK-NOT: call void @orig_dtor() |