brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 9b0ca22 Raw
71 lines · plain
1REQUIRES: x86-registered-target, ld.lld2 3# This test verifies that a cache populated by an in-process ThinLTO codegen is4# not reused by an out-of-process (DTLTO) codegen and vice versa.5 6RUN: rm -rf %t && split-file %s %t && cd %t7 8# Compile source files into bitcode files.9RUN: %clang -O2 --target=x86_64-linux-gnu -flto=thin -c foo.c main.c10 11# Execute the linker and check that in-process ThinLTO cache is populated.12RUN: %clang -O2 --target=x86_64-linux-gnu -Werror -flto=thin -fuse-ld=lld -nostdlib -e main \13RUN:   main.o foo.o -o main.elf \14RUN:   -Wl,--thinlto-cache-dir=cache.dir \15RUN:   -Wl,--save-temps16 17RUN: ls cache.dir/llvmcache.timestamp18RUN: ls cache.dir | count 319 20# Execute the linker and check that out-of-process codegen (DTLTO) adds21# additional entries to the cache, implying that in-process and22# out-of-process codegens do not share cache entries.23RUN: %clang -O2 --target=x86_64-linux-gnu -Werror -flto=thin -fuse-ld=lld -nostdlib -e main \24RUN:   main.o foo.o -o populate1.elf \25RUN:   -Wl,--thinlto-distributor=%python \26RUN:   -Wl,--thinlto-distributor-arg=%llvm_src_root/utils/dtlto/local.py \27RUN:   -Wl,--thinlto-remote-compiler=%clang \28RUN:   -Wl,--thinlto-cache-dir=cache.dir \29RUN:   -Wl,--save-temps30 31# Check that there are two backend compilation jobs occurred.32RUN: grep -wo args populate1.*.dist-file.json | wc -l | grep -qx "\s*3"33RUN: ls cache.dir | count 534 35# Clean up cache directory.36RUN: rm -rf cache.dir37 38# Execute the linker and check that out-of-process (DTLTO) cache is populated.39RUN: %clang -O2 --target=x86_64-linux-gnu -Werror -flto=thin -fuse-ld=lld -nostdlib -e main \40RUN:   main.o foo.o -o populate2.elf \41RUN:   -Wl,--thinlto-distributor=%python \42RUN:   -Wl,--thinlto-distributor-arg=%llvm_src_root/utils/dtlto/local.py \43RUN:   -Wl,--thinlto-remote-compiler=%clang \44RUN:   -Wl,--thinlto-cache-dir=cache.dir \45RUN:   -Wl,--save-temps46 47# Check that there are two backend compilation jobs occurred.48RUN: grep -wo args populate2.*.dist-file.json | wc -l | grep -qx "\s*3"49RUN: ls cache.dir/llvmcache.timestamp50RUN: ls cache.dir | count 351 52# Execute the linker and check that in-process codegen adds additional entries53# to the cache, implying that in-process and out-of-process codegens do54# not share cache entries.55RUN: %clang -O2 --target=x86_64-linux-gnu -Werror -flto=thin -fuse-ld=lld -nostdlib -e main \56RUN:   main.o foo.o -o main.elf \57RUN:   -Wl,--thinlto-cache-dir=cache.dir \58RUN:   -Wl,--save-temps59 60RUN: ls cache.dir | count 561 62#--- foo.c63volatile int foo_int;64__attribute__((retain)) int foo(int x) { return x + foo_int; }65 66#--- main.c67extern int foo(int x);68__attribute__((retain)) int main(int argc, char** argv) {69  return foo(argc);70}71