brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 2db166b Raw
45 lines · plain
1; Test -lto-freestanding option for libLTO.2; RUN: llvm-as < %s > %t.bc3 4; Regular run: expects fprintf to be turned into fwrite5; RUN: llvm-lto %t.bc -exported-symbol=_foo -o %t.o6; RUN: llvm-nm %t.o | FileCheck %s --check-prefix=LTO7; LTO: fwrite8 9; Freestanding run: expects fprintf to NOT be turned into fwrite10; RUN: llvm-lto %t.bc -lto-freestanding -exported-symbol=_foo -o %t.o11; RUN: llvm-nm %t.o | FileCheck %s --check-prefix=LTO-FREESTANDING12; LTO-FREESTANDING: fprintf13 14; Same with ThinLTO now.15; RUN: opt -module-hash -module-summary %s -o %t.bc16 17; Regular run: expects fprintf to be turned into fwrite18; RUN: llvm-lto -exported-symbol=_foo -thinlto-action=run %t.bc19; RUN: llvm-nm %t.bc.thinlto.o | FileCheck %s --check-prefix=ThinLTO20; ThinLTO: fwrite21 22; Freestanding run: expects fprintf to NOT be turned into fwrite23; RUN: llvm-lto -lto-freestanding -exported-symbol=_foo -thinlto-action=run %t.bc24; RUN: llvm-nm %t.bc.thinlto.o | FileCheck %s --check-prefix=ThinLTO-FREESTANDING25; ThinLTO-FREESTANDING: fprintf26 27 28target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"29target triple = "x86_64-apple-macosx10.11.0"30 31declare i32 @fprintf(ptr, ptr, ...)32 33%FILE = type { }34 35@hello_world = constant [13 x i8] c"hello world\0A\00"36@percent_s = constant [3 x i8] c"%s\00"37 38; Check fprintf(fp, "%s", str) -> fwrite(str, fp) only when builtins are enabled39 40define void @foo(ptr %fp) {41  call i32 (ptr, ptr, ...) @fprintf(ptr %fp, ptr @percent_s, ptr @hello_world)42  ret void43}44 45