mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
f431f04c96
This reduces code size for constructs like vtables or interrupt tables that refer to functions in global initializers. Differential Revision: https://reviews.llvm.org/D34805 llvm-svn: 315852
31 lines
707 B
LLVM
31 lines
707 B
LLVM
; RUN: opt -S -mergefunc < %s | FileCheck %s
|
|
|
|
%A = type { i32 }
|
|
%B = type { i32 }
|
|
|
|
; CHECK-NOT: @b
|
|
|
|
@x = constant { i32 (i32)*, i32 (i32)* }
|
|
{ i32 (i32)* bitcast (i32 (%A)* @a to i32 (i32)*),
|
|
i32 (i32)* bitcast (i32 (%B)* @b to i32 (i32)*) }
|
|
; CHECK: { i32 (i32)* bitcast (i32 (%A)* @a to i32 (i32)*), i32 (i32)* bitcast (i32 (%A)* @a to i32 (i32)*) }
|
|
|
|
define internal i32 @a(%A) unnamed_addr {
|
|
extractvalue %A %0, 0
|
|
xor i32 %2, 0
|
|
ret i32 %3
|
|
}
|
|
|
|
define internal i32 @b(%B) unnamed_addr {
|
|
extractvalue %B %0, 0
|
|
xor i32 %2, 0
|
|
ret i32 %3
|
|
}
|
|
|
|
define i32 @c(i32) {
|
|
insertvalue %B undef, i32 %0, 0
|
|
call i32 @b(%B %2)
|
|
; CHECK: call i32 bitcast (i32 (%A)* @a to i32 (%B)*)(%B %2)
|
|
ret i32 %3
|
|
}
|