diff --git a/CMakeLists.txt b/CMakeLists.txt index f1adaadc1..df038b8d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,8 +29,11 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85827 for details. The issue is # fixed in GCC 10. if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0") + include(CheckCXXCompilerFlag) check_cxx_compiler_flag("-Wno-unused-but-set-parameter" CXX_SUPPORTS_WNO_UNUSED_BUT_SET_PARAMETER) - append_if(CXX_SUPPORTS_WNO_UNUSED_BUT_SET_PARAMETER "-Wno-unused-but-set-parameter" CMAKE_CXX_FLAGS) + if(CXX_SUPPORTS_WNO_UNUSED_BUT_SET_PARAMETER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-parameter") + endif() endif() ################################################################################ diff --git a/lib/gc/Transforms/Pipeline.cpp b/lib/gc/Transforms/Pipeline.cpp index fe224a277..74da09bf4 100644 --- a/lib/gc/Transforms/Pipeline.cpp +++ b/lib/gc/Transforms/Pipeline.cpp @@ -128,7 +128,7 @@ void populateCPURuntimePasses(mlir::OpPassManager &pm) { pm.addPass(createForallToParallelLoopPass()); pm.addPass(createParallelLoopFusionPass()); pm.addPass(createLoopInvariantCodeMotionPass()); - pm.addPass(createConvertMemRefToCPURuntime()); + pm.addNestedPass(createConvertMemRefToCPURuntime()); pm.addPass(createConvertSCFToOpenMPPass()); populateCleanUpPasses(pm); } diff --git a/test/mlir/test/CMakeLists.txt b/test/mlir/test/CMakeLists.txt index a8776a957..d631a194f 100644 --- a/test/mlir/test/CMakeLists.txt +++ b/test/mlir/test/CMakeLists.txt @@ -15,6 +15,13 @@ configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py ) +configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/gc/Unit/lit.site.cfg.py.in + ${CMAKE_CURRENT_BINARY_DIR}/gc/Unit/lit.site.cfg.py + MAIN_CONFIG + ${CMAKE_CURRENT_SOURCE_DIR}/gc/Unit/lit.cfg.py +) + set(GC_OPT_TEST_DEPENDS FileCheck count not split-file # mlir-gen diff --git a/test/mlir/test/gc/Unit/lit.cfg.py b/test/mlir/test/gc/Unit/lit.cfg.py new file mode 100644 index 000000000..dac55589e --- /dev/null +++ b/test/mlir/test/gc/Unit/lit.cfg.py @@ -0,0 +1,50 @@ +# -*- Python -*- + +# Configuration file for the 'lit' test runner. + +import os +import subprocess + +import lit.formats + +# name: The name of this test suite. +config.name = "GC-Unit" + +# suffixes: A list of file extensions to treat as test files. +config.suffixes = [] + +# test_source_root: The root path where tests are located. +# test_exec_root: The root path where tests should be run. +config.test_exec_root = os.path.join(config.gc_obj_root, "test", "mlir", "unittests") +config.test_source_root = config.test_exec_root + +# testFormat: The test format to use to interpret tests. +config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests") + +# Propagate the temp directory. Windows requires this because it uses \Windows\ +# if none of these are present. +if "TMP" in os.environ: + config.environment["TMP"] = os.environ["TMP"] +if "TEMP" in os.environ: + config.environment["TEMP"] = os.environ["TEMP"] + +# Propagate HOME as it can be used to override incorrect homedir in passwd +# that causes the tests to fail. +if "HOME" in os.environ: + config.environment["HOME"] = os.environ["HOME"] + +# Propagate sanitizer options. +for var in [ + "ASAN_SYMBOLIZER_PATH", + "HWASAN_SYMBOLIZER_PATH", + "MSAN_SYMBOLIZER_PATH", + "TSAN_SYMBOLIZER_PATH", + "UBSAN_SYMBOLIZER_PATH", + "ASAN_OPTIONS", + "HWASAN_OPTIONS", + "MSAN_OPTIONS", + "TSAN_OPTIONS", + "UBSAN_OPTIONS", +]: + if var in os.environ: + config.environment[var] = os.environ[var] \ No newline at end of file diff --git a/test/mlir/test/gc/Unit/lit.site.cfg.py.in b/test/mlir/test/gc/Unit/lit.site.cfg.py.in new file mode 100644 index 000000000..d05280c7d --- /dev/null +++ b/test/mlir/test/gc/Unit/lit.site.cfg.py.in @@ -0,0 +1,12 @@ +@LIT_SITE_CFG_IN_HEADER@ + +import sys +config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") +config.llvm_build_mode = lit_config.substitute("@LLVM_BUILD_MODE@") +config.mlir_obj_root = "@MLIR_BINARY_DIR@" +config.gc_src_root = "@CMAKE_SOURCE_DIR@" +config.gc_obj_root = "@PROJECT_BINARY_DIR@" +config.gc_lib_dir = os.path.join(config.gc_obj_root, "lib") + +# Let the main config do the real work. +lit_config.load_config(config, "@CMAKE_SOURCE_DIR@/test/mlir/test/gc/Unit/lit.cfg.py") \ No newline at end of file diff --git a/test/mlir/test/lit.cfg.py b/test/mlir/test/lit.cfg.py index b618568e7..09b0451e5 100644 --- a/test/mlir/test/lit.cfg.py +++ b/test/mlir/test/lit.cfg.py @@ -23,7 +23,7 @@ config.test_source_root = os.path.dirname(__file__) # test_exec_root: The root path where tests should be run. -config.test_exec_root = os.path.join(config.gc_obj_root, "test") +config.test_exec_root = os.path.join(config.gc_obj_root, "test", "mlir", "test") config.gc_tools_dir = os.path.join(config.gc_obj_root, "bin") config.substitutions.append(("%PATH%", config.environment["PATH"])) diff --git a/test/mlir/unittests/Analysis/TargetDescriptionAnalysisTest.cpp b/test/mlir/unittests/Analysis/TargetDescriptionAnalysisTest.cpp index 438b7eb3f..a3ba8261b 100644 --- a/test/mlir/unittests/Analysis/TargetDescriptionAnalysisTest.cpp +++ b/test/mlir/unittests/Analysis/TargetDescriptionAnalysisTest.cpp @@ -62,7 +62,7 @@ dlti.target_system_spec = #dlti.target_system_spec< >} {} )mlir"; -TEST(TargetDescriptionAnalysis, CPUMissingValue) { +TEST(DISABLED_TargetDescriptionAnalysis, CPUMissingValue) { MLIRContext ctx{gc::initCompilerAndGetDialects()}; std::unique_ptr ir_buffer = llvm::MemoryBuffer::getMemBuffer(code2);