70 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2;; Check the cases involving dso_local_equivalent where we do not expect functions to be merged.3; RUN: opt -S -passes=mergefunc < %s | FileCheck %s4 5@x = constant { ptr, ptr } { ptr @a, ptr @b }6; CHECK: { ptr @a, ptr @b }7 8@x2 = constant { ptr, ptr } { ptr @c, ptr @d }9; CHECK: { ptr @c, ptr @d }10 11;; func1 and func2 are different functions.12declare i32 @func1()13define i32 @func2() {14; CHECK-LABEL: @func2(15; CHECK-NEXT: ret i32 016;17 ret i32 018}19 20define internal i32 @a() unnamed_addr {21; CHECK-LABEL: @a(22; CHECK-NEXT: [[TMP1:%.*]] = call i32 dso_local_equivalent @func1()23; CHECK-NEXT: ret i32 [[TMP1]]24;25 %1 = call i32 dso_local_equivalent @func1()26 ret i32 %127}28 29define internal i32 @b() unnamed_addr {30; CHECK-LABEL: @b(31; CHECK-NEXT: [[TMP1:%.*]] = call i32 dso_local_equivalent @func2()32; CHECK-NEXT: ret i32 [[TMP1]]33;34 %1 = call i32 dso_local_equivalent @func2()35 ret i32 %136}37 38;; func3 and func4 have the same body and signature but do not have merged39;; callers because they are different functions.40define i32 @func3() {41; CHECK-LABEL: @func3(42; CHECK-NEXT: ret i32 043;44 ret i32 045}46define i32 @func4() {47; CHECK-LABEL: @func4(48; CHECK-NEXT: ret i32 049;50 ret i32 051}52 53define internal i32 @c() unnamed_addr {54; CHECK-LABEL: @c(55; CHECK-NEXT: [[TMP1:%.*]] = call i32 dso_local_equivalent @func3()56; CHECK-NEXT: ret i32 [[TMP1]]57;58 %1 = call i32 dso_local_equivalent @func3()59 ret i32 %160}61 62define internal i32 @d() unnamed_addr {63; CHECK-LABEL: @d(64; CHECK-NEXT: [[TMP1:%.*]] = call i32 dso_local_equivalent @func4()65; CHECK-NEXT: ret i32 [[TMP1]]66;67 %1 = call i32 dso_local_equivalent @func4()68 ret i32 %169}70