summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2012-10-18 20:43:11 +0000
committerDaniel Dunbar <daniel@zuster.org>2012-10-18 20:43:11 +0000
commitb288ad8e3627c25747ba68d81a70bfe111efaa16 (patch)
tree493b387eefaba4d2814c7a1ce0fbf148b59b7b2b
parent44a83f092029fa76bce05ff0c0598afc55215767 (diff)
downloadllvm-b288ad8e3627c25747ba68d81a70bfe111efaa16.tar.gz
llvm-b288ad8e3627c25747ba68d81a70bfe111efaa16.tar.bz2
llvm-b288ad8e3627c25747ba68d81a70bfe111efaa16.tar.xz
test: Add a lit config variable to check if LTO is enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166225 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Makefile11
-rw-r--r--test/lit.cfg4
-rw-r--r--test/lit.site.cfg.in1
3 files changed, 16 insertions, 0 deletions
diff --git a/test/Makefile b/test/Makefile
index 3c6b5b68a4..810fdded46 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -117,6 +117,16 @@ else
ENABLE_ASSERTIONS=1
endif
+# Derive whether or not LTO is enabled by checking the extra options.
+LTO_IS_ENABLED := 0
+ifneq ($(findstring -flto,$(CompileCommonOpts)),)
+LTO_IS_ENABLED := 1
+else
+ifneq ($(findstring -O4,$(CompileCommonOpts)),)
+LTO_IS_ENABLED := 1
+endif
+endif
+
lit.site.cfg: FORCE
@echo "Making LLVM 'lit.site.cfg' file..."
@$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g > lit.tmp
@@ -129,6 +139,7 @@ lit.site.cfg: FORCE
@$(ECHOPATH) s=@OCAMLOPT@=$(OCAMLOPT) -cc $(subst *,'\\\"',*$(subst =,"\\=",$(CXX_FOR_OCAMLOPT))*) -I $(LibDir)/ocaml=g >> lit.tmp
@$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> lit.tmp
@$(ECHOPATH) s=@ENABLE_ASSERTIONS@=$(ENABLE_ASSERTIONS)=g >> lit.tmp
+ @$(ECHOPATH) s=@LTO_IS_ENABLED@=$(LTO_IS_ENABLED)=g >> lit.tmp
@$(ECHOPATH) s=@TARGETS_TO_BUILD@=$(TARGETS_TO_BUILD)=g >> lit.tmp
@$(ECHOPATH) s=@LLVM_BINDINGS@=$(BINDINGS_TO_BUILD)=g >> lit.tmp
@$(ECHOPATH) s=@HOST_OS@=$(HOST_OS)=g >> lit.tmp
diff --git a/test/lit.cfg b/test/lit.cfg
index f24a854dc7..9273cd7b93 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -245,6 +245,10 @@ else:
if loadable_module:
config.available_features.add('loadable_module')
+# LTO
+if config.lto_is_enabled == "1":
+ config.available_features.add('lto')
+
# llc knows whether he is compiled with -DNDEBUG.
import subprocess
try:
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 178b22f10f..2bbe63e634 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -11,6 +11,7 @@ config.python_executable = "@PYTHON_EXECUTABLE@"
config.ocamlopt_executable = "@OCAMLOPT@"
config.enable_shared = @ENABLE_SHARED@
config.enable_assertions = @ENABLE_ASSERTIONS@
+config.lto_is_enabled = "@LTO_IS_ENABLED@"
config.targets_to_build = "@TARGETS_TO_BUILD@"
config.llvm_bindings = "@LLVM_BINDINGS@"
config.host_os = "@HOST_OS@"