brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · e5030e8 Raw
58 lines · plain
1; Check that we can use full LTO with gold plugin when inputs2; are compiled using unified LTO pipeline3; RUN: llvm-as %s -o %t.bc4; RUN: llvm-as %p/Inputs/unified-lto-foo.ll -o %t-foo.bc5; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \6; RUN:    -m elf_x86_64 \7; RUN:    -plugin-opt=unifiedlto \8; RUN:    -plugin-opt=save-temps \9; RUN:    -u main \10; RUN:    %t.bc %t-foo.bc \11; RUN:    -o %t-out12; RUN: llvm-dis %t-out.0.5.precodegen.bc -o - | FileCheck %s13 14; Check thin LTO as well15; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \16; RUN:    -m elf_x86_64 \17; RUN:    -plugin-opt=unifiedlto \18; RUN:    -plugin-opt=thinlto \19; RUN:    -plugin-opt=save-temps \20; RUN:    -u main \21; RUN:    %t.bc %t-foo.bc \22; RUN:    -o %t-out23; RUN: llvm-dis %t.bc.5.precodegen.bc -o - | FileCheck %s --check-prefix=THIN24 25; Constant propagation is not supported by thin LTO.26; With full LTO we fold argument into constant 4327; CHECK:       define dso_local noundef i32 @main()28; CHECK-NEXT:    tail call fastcc void @foo()29; CHECK-NEXT:    ret i32 4330 31; CHECK:       define internal fastcc void @foo()32; CHECK-NEXT:    store i32 43, ptr @_g, align 433 34; ThinLTO doesn't import foo, because the latter has noinline attribute35; THIN:      define dso_local i32 @main()36; THIN-NEXT:   %1 = tail call i32 @foo(i32 noundef 1)37 38target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"39target triple = "x86_64-pc-linux-gnu"40 41define dso_local i32 @main() {42  %1 = tail call i32 @foo(i32 noundef 1)43  ret i32 %144}45 46declare i32 @foo(i32 noundef)47 48!llvm.module.flags = !{!0, !1}49 50!0 = !{i32 1, !"EnableSplitLTOUnit", i32 1}51!1 = !{i32 1, !"UnifiedLTO", i32 1}52 53^0 = module: (path: "unified-lto.o", hash: (2850108895, 1189778381, 479678006, 1191715608, 4095117687))54^1 = gv: (name: "foo") ; guid = 669931808106274756455^2 = gv: (name: "main", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 1, canAutoHide: 0), insts: 2, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0, mustBeUnreachable: 0), calls: ((callee: ^1, tail: 1))))) ; guid = 1582266305281194956256^3 = flags: 52057^4 = blockcount: 058