[llvm] r232785 - test: Make a start on a test suite for libLTO.

Nick Lewycky nlewycky at google.com
Thu Mar 19 19:51:54 PDT 2015


On 19 March 2015 at 16:55, Peter Collingbourne <peter at pcc.me.uk> wrote:

> Author: pcc
> Date: Thu Mar 19 18:55:38 2015
> New Revision: 232785
>
> URL: http://llvm.org/viewvc/llvm-project?rev=232785&view=rev
> Log:
> test: Make a start on a test suite for libLTO.
>
> This works in a similar way to the gold plugin tests. We search for a
> compatible
> linker on $PATH and use it to run tests against our just-built libLTO. To
> start
> with, test the just added opt level functionality.
>
> Differential Revision: http://reviews.llvm.org/D8472
>
> Added:
>     llvm/trunk/test/tools/lto/
>     llvm/trunk/test/tools/lto/lit.local.cfg
>     llvm/trunk/test/tools/lto/opt-level.ll
> Modified:
>     llvm/trunk/cmake/config-ix.cmake
>     llvm/trunk/test/CMakeLists.txt
>     llvm/trunk/test/Makefile
>     llvm/trunk/test/lit.cfg
>     llvm/trunk/test/lit.site.cfg.in
>
> Modified: llvm/trunk/cmake/config-ix.cmake
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=232785&r1=232784&r2=232785&view=diff
>
> ==============================================================================
> --- llvm/trunk/cmake/config-ix.cmake (original)
> +++ llvm/trunk/cmake/config-ix.cmake Thu Mar 19 18:55:38 2015
> @@ -532,6 +532,10 @@ if(GOLD_EXECUTABLE)
>                 "PATH to binutils/include containing plugin-api.h for gold
> plugin.")
>  endif()
>
> +if(APPLE)
> +  find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
> +endif()
> +
>  include(FindOCaml)
>  include(AddOCaml)
>  if(WIN32)
>
> Modified: llvm/trunk/test/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CMakeLists.txt?rev=232785&r1=232784&r2=232785&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/CMakeLists.txt (original)
> +++ llvm/trunk/test/CMakeLists.txt Thu Mar 19 18:55:38 2015
> @@ -70,6 +70,10 @@ if(TARGET llvm-go)
>    set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-go)
>  endif()
>
> +if(APPLE)
> +  set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO)
> +endif()
> +
>  if(TARGET ocaml_llvm)
>    set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS}
>            ocaml_llvm
>
> Modified: llvm/trunk/test/Makefile
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=232785&r1=232784&r2=232785&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/Makefile (original)
> +++ llvm/trunk/test/Makefile Thu Mar 19 18:55:38 2015
> @@ -129,6 +129,7 @@ lit.site.cfg: FORCE
>         @$(ECHOPATH) s=@EXEEXT@=$(EXEEXT)=g >> lit.tmp
>         @$(ECHOPATH) s=@PYTHON_EXECUTABLE@=$(PYTHON)=g >> lit.tmp
>         @$(ECHOPATH) s=@GOLD_EXECUTABLE@=ld=g >> lit.tmp
> +       @$(ECHOPATH) s=@LD64_EXECUTABLE@=ld=g >> lit.tmp
>         @$(ECHOPATH) s=@OCAMLFIND@=$(OCAMLFIND)=g >> lit.tmp
>         @$(ECHOPATH) s!@OCAMLFLAGS@!$(addprefix -cclib ,$(LDFLAGS))!g >>
> lit.tmp
>         @$(ECHOPATH) s=@HAVE_OCAMLOPT@=$(HAVE_OCAMLOPT)=g >> lit.tmp
>
> Modified: llvm/trunk/test/lit.cfg
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.cfg?rev=232785&r1=232784&r2=232785&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/lit.cfg (original)
> +++ llvm/trunk/test/lit.cfg Thu Mar 19 18:55:38 2015
> @@ -188,6 +188,7 @@ config.substitutions.append( ('%llc_dwar
>
>  # Add site-specific substitutions.
>  config.substitutions.append( ('%gold', config.gold_executable) )
> +config.substitutions.append( ('%ld64', config.ld64_executable) )
>  config.substitutions.append( ('%go', config.go_executable) )
>  config.substitutions.append( ('%llvmshlibdir', config.llvm_shlib_dir) )
>  config.substitutions.append( ('%shlibext', config.llvm_shlib_ext) )
> @@ -369,6 +370,22 @@ def have_ld_plugin_support():
>  if have_ld_plugin_support():
>      config.available_features.add('ld_plugin')
>
> +def have_ld64_plugin_support():
> +    if config.ld64_executable == '':
> +        return False
> +
> +    ld_cmd = subprocess.Popen([config.ld64_executable, '-v'], stderr =
> subprocess.PIPE)
> +    ld_out = ld_cmd.stderr.read().decode()
> +    ld_cmd.wait()
> +
> +    if 'ld64' not in ld_out or 'LTO' not in ld_out:
> +        return False
> +
> +    return True
> +
> +if have_ld64_plugin_support():
> +    config.available_features.add('ld64_plugin')
> +
>  # Ask llvm-config about assertion mode.
>  try:
>      llvm_config_cmd = subprocess.Popen(
>
> Modified: llvm/trunk/test/lit.site.cfg.in
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.site.cfg.in?rev=232785&r1=232784&r2=232785&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/lit.site.cfg.in (original)
> +++ llvm/trunk/test/lit.site.cfg.in Thu Mar 19 18:55:38 2015
> @@ -14,6 +14,7 @@ config.llvm_exe_ext = "@EXEEXT@"
>  config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
>  config.python_executable = "@PYTHON_EXECUTABLE@"
>  config.gold_executable = "@GOLD_EXECUTABLE@"
> +config.ld64_executable = "@LD64_EXECUTABLE@"
>  config.ocamlfind_executable = "@OCAMLFIND@"
>  config.have_ocamlopt = "@HAVE_OCAMLOPT@"
>  config.have_ocaml_ounit = "@HAVE_OCAML_OUNIT@"
>
> Added: llvm/trunk/test/tools/lto/lit.local.cfg
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/lto/lit.local.cfg?rev=232785&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/tools/lto/lit.local.cfg (added)
> +++ llvm/trunk/test/tools/lto/lit.local.cfg Thu Mar 19 18:55:38 2015
> @@ -0,0 +1,2 @@
> +if not 'ld64_plugin' in config.available_features:
> +   config.unsupported = True
>

This disables the whole directory. There's only one test in the directory,
but it seems like it would make sense for there to be tests for different
LTO customers in here. Could you make this a "REQUIRES:" thing instead, so
that we can mark the tests individually?

Nick


>
> Added: llvm/trunk/test/tools/lto/opt-level.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/lto/opt-level.ll?rev=232785&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/tools/lto/opt-level.ll (added)
> +++ llvm/trunk/test/tools/lto/opt-level.ll Thu Mar 19 18:55:38 2015
> @@ -0,0 +1,20 @@
> +; RUN: llvm-as %s -o %t.o
> +; RUN: env DYLD_LIBRARY_PATH=%llvmshlibdir %ld64 -arch x86_64 -dylib
> -mllvm -O0 -o %t.dylib %t.o
> +; RUN: llvm-nm -no-llvm-bc %t.dylib | FileCheck --check-prefix=CHECK-O0 %s
> +; RUN: env DYLD_LIBRARY_PATH=%llvmshlibdir %ld64 -arch x86_64 -dylib
> -mllvm -O2 -o %t.dylib %t.o
> +; RUN: llvm-nm -no-llvm-bc %t.dylib | FileCheck --check-prefix=CHECK-O2 %s
> +
> +target triple = "x86_64-apple-macosx10.8.0"
> +
> +; CHECK-O0: t _f1
> +; CHECK-O2-NOT: _f1
> +define internal void @f1() {
> +  ret void
> +}
> +
> +; CHECK-O0: T _f2
> +; CHECK-O2: T _f2
> +define void @f2() {
> +  call void @f1()
> +  ret void
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150319/21e9733f/attachment.html>


More information about the llvm-commits mailing list