llvm-project/llvm/test/Transforms/GlobalOpt/global-constructor-opaque-ptr.ll
Arthur Eubanks 4e65291837 [OpaquePtr][GlobalOpt] Don't attempt to evaluate global constructors with arguments
Previously all entries in global_ctors had to have the void()* type and
we'd skip evaluating bitcasted functions. With opaque pointers we may
see the function directly.

Fixes #55147.

Reviewed By: #opaque-pointers, nikic

Differential Revision: https://reviews.llvm.org/D124553
2022-04-27 19:00:44 -07:00

15 lines
333 B
LLVM

; RUN: opt -passes=globalopt -S < %s | FileCheck %s
; CHECK: @f1
; CHECK: @f2
@llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @f1, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @f2, ptr null }]
define void @f1(i32 %args) {
ret void
}
define i32 @f2(i32 %args) {
ret i32 0
}