69 lines · plain
1; TODO: This test checks if the how similar functions are handled during global outlining2; by repeating the codegen via -codegen-data-thinlto-two-rounds=true.3 4; RUN: rm -rf %t; split-file %s %t5 6; RUN: opt -module-summary -module-hash %t/foo.ll -o %t-foo.bc7; RUN: opt -module-summary -module-hash %t/goo.ll -o %t-goo.bc8 9; RUN: llvm-lto2 run -enable-global-merge-func=true -codegen-data-thinlto-two-rounds=true %t-foo.bc %t-goo.bc -o %tout \10; RUN: -r %t-foo.bc,_f1,px \11; RUN: -r %t-goo.bc,_f2,px \12; RUN: -r %t-foo.bc,_g,l -r %t-foo.bc,_g1,l -r %t-foo.bc,_g2,l \13; RUN: -r %t-goo.bc,_g,l -r %t-goo.bc,_g1,l -r %t-goo.bc,_g2,l14; RUN: llvm-nm %tout.1 | FileCheck %s --check-prefix=OUT115; RUN: llvm-nm %tout.2 | FileCheck %s --check-prefix=OUT216; RUN: llvm-objdump -d %tout.1 | FileCheck %s --check-prefix=THUNK117; RUN: llvm-objdump -d %tout.2 | FileCheck %s --check-prefix=THUNK218 19; OUT1: _f1.Tgm20; OUT2: _f2.Tgm21 22; THUNK1: <_f1>:23; THUNK1-NEXT: adrp x1,24; THUNK1-NEXT: ldr x1, [x1]25; THUNK1-NEXT: b26 27; THUNK2: <_f2>:28; THUNK2-NEXT: adrp x1,29; THUNK2-NEXT: ldr x1, [x1]30; THUNK2-NEXT: b31 32;--- foo.ll33target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"34target triple = "arm64-unknown-ios12.0.0"35 36@g = external local_unnamed_addr global [0 x i32], align 437@g1 = external global i32, align 438@g2 = external global i32, align 439 40define i32 @f1(i32 %a) {41entry:42 %idxprom = sext i32 %a to i6443 %arrayidx = getelementptr inbounds [0 x i32], [0 x i32]* @g, i64 0, i64 %idxprom44 %0 = load i32, i32* %arrayidx, align 445 %1 = load volatile i32, i32* @g1, align 446 %mul = mul nsw i32 %1, %047 %add = add nsw i32 %mul, 148 ret i32 %add49}50 51;--- goo.ll52target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"53target triple = "arm64-unknown-ios12.0.0"54 55@g = external local_unnamed_addr global [0 x i32], align 456@g1 = external global i32, align 457@g2 = external global i32, align 458 59define i32 @f2(i32 %a) {60entry:61 %idxprom = sext i32 %a to i6462 %arrayidx = getelementptr inbounds [0 x i32], [0 x i32]* @g, i64 0, i64 %idxprom63 %0 = load i32, i32* %arrayidx, align 464 %1 = load volatile i32, i32* @g2, align 465 %mul = mul nsw i32 %1, %066 %add = add nsw i32 %mul, 167 ret i32 %add68}69