[llvm-branch-commits] [clang] [clang] fix template argument conversion (PR #124386)
https://github.com/erichkeane commented: LGTM pending @cor3ntin 's leak concerns. https://github.com/llvm/llvm-project/pull/124386 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] fix nondeduced mismatch with nullptr template arguments (PR #124498)
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/124498 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PeepholeOpt: Avoid double map lookup (PR #124531)
https://github.com/arsenm ready_for_review https://github.com/llvm/llvm-project/pull/124531 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PeepholeOpt: Avoid double map lookup (PR #124531)
arsenm wrote: > [!WARNING] > This pull request is not mergeable via GitHub because a downstack PR is > open. Once all requirements are satisfied, merge this PR as a stack href="https://app.graphite.dev/github/pr/llvm/llvm-project/124531?utm_source=stack-comment-downstack-mergeability-warning"; > >on Graphite. > https://graphite.dev/docs/merge-pull-requests";>Learn more * **#124531** https://app.graphite.dev/github/pr/llvm/llvm-project/124531?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> 👈 https://app.graphite.dev/github/pr/llvm/llvm-project/124531?utm_source=stack-comment-view-in-graphite"; target="_blank">(View in Graphite) * **#124512** https://app.graphite.dev/github/pr/llvm/llvm-project/124512?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * **#124224** https://app.graphite.dev/github/pr/llvm/llvm-project/124224?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * **#124111** https://app.graphite.dev/github/pr/llvm/llvm-project/124111?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * `main` This stack of pull requests is managed by https://graphite.dev?utm-source=stack-comment";>Graphite. Learn more about https://stacking.dev/?utm_source=stack-comment";>stacking. https://github.com/llvm/llvm-project/pull/124531 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PeepholeOpt: Avoid double map lookup (PR #124531)
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/124531 >From e3277459d5d9db21c5ab5af7ff885c035edbfa49 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 27 Jan 2025 18:18:39 +0700 Subject: [PATCH 1/2] PeepholeOpt: Avoid double map lookup --- llvm/lib/CodeGen/PeepholeOptimizer.cpp | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/PeepholeOptimizer.cpp b/llvm/lib/CodeGen/PeepholeOptimizer.cpp index bf450e3af0deee..89753a06d12b28 100644 --- a/llvm/lib/CodeGen/PeepholeOptimizer.cpp +++ b/llvm/lib/CodeGen/PeepholeOptimizer.cpp @@ -1035,8 +1035,10 @@ bool PeepholeOptimizer::findNextSource(RegSubRegPair RegSubReg, return false; // Insert the Def -> Use entry for the recently found source. - ValueTrackerResult CurSrcRes = RewriteMap.lookup(CurSrcPair); - if (CurSrcRes.isValid()) { + auto [InsertPt, WasInserted] = RewriteMap.try_emplace(CurSrcPair, Res); + + ValueTrackerResult CurSrcRes = InsertPt->second; + if (!WasInserted) { assert(CurSrcRes == Res && "ValueTrackerResult found must match"); // An existent entry with multiple sources is a PHI cycle we must avoid. // Otherwise it's an entry with a valid next source we already found. @@ -1047,7 +1049,6 @@ bool PeepholeOptimizer::findNextSource(RegSubRegPair RegSubReg, } break; } - RewriteMap.insert(std::make_pair(CurSrcPair, Res)); // ValueTrackerResult usually have one source unless it's the result from // a PHI instruction. Add the found PHI edges to be looked up further. >From 2540e06cc37cf9f05052b063a7f543b170ecadf1 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 27 Jan 2025 20:22:36 +0700 Subject: [PATCH 2/2] Sink --- llvm/lib/CodeGen/PeepholeOptimizer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/CodeGen/PeepholeOptimizer.cpp b/llvm/lib/CodeGen/PeepholeOptimizer.cpp index 89753a06d12b28..ce475765e50692 100644 --- a/llvm/lib/CodeGen/PeepholeOptimizer.cpp +++ b/llvm/lib/CodeGen/PeepholeOptimizer.cpp @@ -1037,8 +1037,9 @@ bool PeepholeOptimizer::findNextSource(RegSubRegPair RegSubReg, // Insert the Def -> Use entry for the recently found source. auto [InsertPt, WasInserted] = RewriteMap.try_emplace(CurSrcPair, Res); - ValueTrackerResult CurSrcRes = InsertPt->second; if (!WasInserted) { +ValueTrackerResult CurSrcRes = InsertPt->second; + assert(CurSrcRes == Res && "ValueTrackerResult found must match"); // An existent entry with multiple sources is a PHI cycle we must avoid. // Otherwise it's an entry with a valid next source we already found. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Promote FortranEvaluateTesting library (PR #124417)
https://github.com/jhuber6 approved this pull request. https://github.com/llvm/llvm-project/pull/124417 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PeepholeOpt: Avoid double map lookup (PR #124531)
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/124531 None >From e3277459d5d9db21c5ab5af7ff885c035edbfa49 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 27 Jan 2025 18:18:39 +0700 Subject: [PATCH] PeepholeOpt: Avoid double map lookup --- llvm/lib/CodeGen/PeepholeOptimizer.cpp | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/PeepholeOptimizer.cpp b/llvm/lib/CodeGen/PeepholeOptimizer.cpp index bf450e3af0deee..89753a06d12b28 100644 --- a/llvm/lib/CodeGen/PeepholeOptimizer.cpp +++ b/llvm/lib/CodeGen/PeepholeOptimizer.cpp @@ -1035,8 +1035,10 @@ bool PeepholeOptimizer::findNextSource(RegSubRegPair RegSubReg, return false; // Insert the Def -> Use entry for the recently found source. - ValueTrackerResult CurSrcRes = RewriteMap.lookup(CurSrcPair); - if (CurSrcRes.isValid()) { + auto [InsertPt, WasInserted] = RewriteMap.try_emplace(CurSrcPair, Res); + + ValueTrackerResult CurSrcRes = InsertPt->second; + if (!WasInserted) { assert(CurSrcRes == Res && "ValueTrackerResult found must match"); // An existent entry with multiple sources is a PHI cycle we must avoid. // Otherwise it's an entry with a valid next source we already found. @@ -1047,7 +1049,6 @@ bool PeepholeOptimizer::findNextSource(RegSubRegPair RegSubReg, } break; } - RewriteMap.insert(std::make_pair(CurSrcPair, Res)); // ValueTrackerResult usually have one source unless it's the result from // a PHI instruction. Add the found PHI edges to be looked up further. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PeepholeOpt: Avoid double map lookup (PR #124531)
@@ -1035,8 +1035,10 @@ bool PeepholeOptimizer::findNextSource(RegSubRegPair RegSubReg, return false; // Insert the Def -> Use entry for the recently found source. - ValueTrackerResult CurSrcRes = RewriteMap.lookup(CurSrcPair); - if (CurSrcRes.isValid()) { + auto [InsertPt, WasInserted] = RewriteMap.try_emplace(CurSrcPair, Res); + + ValueTrackerResult CurSrcRes = InsertPt->second; jayfoad wrote: Sink this inside the "if" https://github.com/llvm/llvm-project/pull/124531 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [flang] [lld] [Flang] Don't use FortranDecimal for runtime (PR #121997)
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/121997 >From 2e50a1f563dcfec3dae1a5770ed4c90189cf7ba8 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 24 Jan 2025 16:28:55 +0100 Subject: [PATCH] [Flang] Don't use FortranDecimal for runtime --- clang/lib/Driver/ToolChains/CommonArgs.cpp| 3 +- clang/lib/Driver/ToolChains/Flang.cpp | 4 - flang/docs/FlangDriver.md | 7 +- flang/lib/Decimal/CMakeLists.txt | 92 ++- flang/runtime/CMakeLists.txt | 14 +-- flang/test/Driver/linker-flags.f90| 6 +- .../test/Driver/msvc-dependent-lib-flags.f90 | 4 - flang/test/Driver/nostdlib.f90| 1 - flang/test/Runtime/no-cpp-dep.c | 2 +- flang/test/lit.cfg.py | 3 - lld/COFF/MinGW.cpp| 1 - 11 files changed, 18 insertions(+), 119 deletions(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index f8967890f722cf..b5273dd8cf1e3a 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -1321,7 +1321,7 @@ void tools::addOpenMPHostOffloadingArgs(const Compilation &C, /// Add Fortran runtime libs void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args, llvm::opt::ArgStringList &CmdArgs) { - // Link FortranRuntime and FortranDecimal + // Link FortranRuntime // These are handled earlier on Windows by telling the frontend driver to // add the correct libraries to link against as dependents in the object // file. @@ -1338,7 +1338,6 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args, addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false); } CmdArgs.push_back("-lFortranRuntime"); -CmdArgs.push_back("-lFortranDecimal"); addArchSpecificRPath(TC, Args, CmdArgs); } diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp index 86ed25badfa2b7..f1bf32b3238270 100644 --- a/clang/lib/Driver/ToolChains/Flang.cpp +++ b/clang/lib/Driver/ToolChains/Flang.cpp @@ -361,21 +361,18 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args, CmdArgs.push_back("-D_MT"); CmdArgs.push_back("--dependent-lib=libcmt"); CmdArgs.push_back("--dependent-lib=FortranRuntime.static.lib"); -CmdArgs.push_back("--dependent-lib=FortranDecimal.static.lib"); break; case options::OPT__SLASH_MTd: CmdArgs.push_back("-D_MT"); CmdArgs.push_back("-D_DEBUG"); CmdArgs.push_back("--dependent-lib=libcmtd"); CmdArgs.push_back("--dependent-lib=FortranRuntime.static_dbg.lib"); -CmdArgs.push_back("--dependent-lib=FortranDecimal.static_dbg.lib"); break; case options::OPT__SLASH_MD: CmdArgs.push_back("-D_MT"); CmdArgs.push_back("-D_DLL"); CmdArgs.push_back("--dependent-lib=msvcrt"); CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic.lib"); -CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic.lib"); break; case options::OPT__SLASH_MDd: CmdArgs.push_back("-D_MT"); @@ -383,7 +380,6 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args, CmdArgs.push_back("-D_DLL"); CmdArgs.push_back("--dependent-lib=msvcrtd"); CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic_dbg.lib"); -CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic_dbg.lib"); break; } } diff --git a/flang/docs/FlangDriver.md b/flang/docs/FlangDriver.md index 23cbab30ee903e..be5633529f50cd 100644 --- a/flang/docs/FlangDriver.md +++ b/flang/docs/FlangDriver.md @@ -175,19 +175,18 @@ like this: ``` $ flang -v -o example example.o -"/usr/bin/ld" [...] example.o [...] "-lFortranRuntime" "-lFortranDecimal" [...] +"/usr/bin/ld" [...] example.o [...] "-lFortranRuntime" [...] ``` The automatically added libraries are: * `FortranRuntime`: Provides most of the Flang runtime library. -* `FortranDecimal`: Provides operations for decimal numbers. If the code is C/C++ based and invokes Fortran routines, one can either use Clang or Flang as the linker driver. If Clang is used, it will automatically all required runtime libraries needed by C++ (e.g., for STL) to the linker invocation. -In this case, one has to explicitly provide the Fortran runtime libraries -`FortranRuntime` and/or `FortranDecimal`. An alternative is to use Flang to link. +In this case, one has to explicitly provide the Fortran runtime library +`FortranRuntime`. An alternative is to use Flang to link. In this case, it may be required to explicitly supply C++ runtime libraries. On Darwin, the logical root where the system libraries are located (sysroot) diff --git a/flang/lib/Decimal/CMakeLists.txt b/flang/lib/Decimal/CMakeLists.txt index 880b190f1c5815..477d44e0565ebe 100644
[llvm-branch-commits] [flang] [Flang] Optionally do not compile the runtime in-tree (PR #122336)
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/122336 >From 4c676f468ba344ac0c388583a4ed28035d05ae89 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 24 Jan 2025 15:00:16 +0100 Subject: [PATCH] users/meinersbur/flang_runtime_FLANG_INCLUDE_RUNTIME --- flang/CMakeLists.txt| 6 +- flang/test/CMakeLists.txt | 6 +- flang/test/Driver/ctofortran.f90| 1 + flang/test/Driver/exec.f90 | 1 + flang/test/Runtime/no-cpp-dep.c | 2 +- flang/test/lit.cfg.py | 5 - flang/test/lit.site.cfg.py.in | 2 ++ flang/tools/f18/CMakeLists.txt | 2 +- flang/unittests/CMakeLists.txt | 11 +- flang/unittests/Evaluate/CMakeLists.txt | 27 + 10 files changed, 44 insertions(+), 19 deletions(-) diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index b619553ef83021..7d6dcb5c184a52 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -247,6 +247,8 @@ else() include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR}) endif() +option(FLANG_INCLUDE_RUNTIME "Build the runtime in-tree (deprecated; to be replaced with LLVM_ENABLE_RUNTIMES=flang-rt)" ON) + set(FLANG_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH "Path for binary subdirectory (defaults to '${CMAKE_INSTALL_BINDIR}')") mark_as_advanced(FLANG_TOOLS_INSTALL_DIR) @@ -487,7 +489,9 @@ if (FLANG_CUF_RUNTIME) find_package(CUDAToolkit REQUIRED) endif() -add_subdirectory(runtime) +if (FLANG_INCLUDE_RUNTIME) + add_subdirectory(runtime) +endif () if (LLVM_INCLUDE_EXAMPLES) add_subdirectory(examples) diff --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt index cab214c2ef4c8c..e398e0786147aa 100644 --- a/flang/test/CMakeLists.txt +++ b/flang/test/CMakeLists.txt @@ -71,9 +71,13 @@ set(FLANG_TEST_DEPENDS llvm-objdump llvm-readobj split-file - FortranRuntime FortranDecimal ) + +if (FLANG_INCLUDE_RUNTIME) + list(APPEND FLANG_TEST_DEPENDS FortranRuntime) +endif () + if (LLVM_ENABLE_PLUGINS AND NOT WIN32) list(APPEND FLANG_TEST_DEPENDS Bye) endif() diff --git a/flang/test/Driver/ctofortran.f90 b/flang/test/Driver/ctofortran.f90 index 78eac32133b18e..10c7adaccc9588 100644 --- a/flang/test/Driver/ctofortran.f90 +++ b/flang/test/Driver/ctofortran.f90 @@ -1,4 +1,5 @@ ! UNSUPPORTED: system-windows +! REQUIRES: flang-rt ! RUN: split-file %s %t ! RUN: chmod +x %t/runtest.sh ! RUN: %t/runtest.sh %t %t/ffile.f90 %t/cfile.c %flang | FileCheck %s diff --git a/flang/test/Driver/exec.f90 b/flang/test/Driver/exec.f90 index fd174005ddf62a..9ca91ee24011c9 100644 --- a/flang/test/Driver/exec.f90 +++ b/flang/test/Driver/exec.f90 @@ -1,4 +1,5 @@ ! UNSUPPORTED: system-windows +! REQUIRES: flang-rt ! Verify that flang can correctly build executables. ! RUN: %flang %s -o %t diff --git a/flang/test/Runtime/no-cpp-dep.c b/flang/test/Runtime/no-cpp-dep.c index b1a5fa004014cc..7303ce63fdec41 100644 --- a/flang/test/Runtime/no-cpp-dep.c +++ b/flang/test/Runtime/no-cpp-dep.c @@ -3,7 +3,7 @@ This test makes sure that flang's runtime does not depend on the C++ runtime library. It tries to link this simple file against libFortranRuntime.a with a C compiler. -REQUIRES: c-compiler +REQUIRES: c-compiler, flang-rt RUN: %if system-aix %{ export OBJECT_MODE=64 %} RUN: %cc -std=c99 %s -I%include %libruntime -lm \ diff --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py index c452b6d231c89f..f4580afc8c47b1 100644 --- a/flang/test/lit.cfg.py +++ b/flang/test/lit.cfg.py @@ -163,10 +163,13 @@ ToolSubst("%not_todo_abort_cmd", command=FindTool("not"), unresolved="fatal") ) +if config.flang_include_runtime: +config.available_features.add("flang-rt") + # Define some variables to help us test that the flang runtime doesn't depend on # the C++ runtime libraries. For this we need a C compiler. If for some reason # we don't have one, we can just disable the test. -if config.cc: +if config.flang_include_runtime and config.cc: libruntime = os.path.join(config.flang_lib_dir, "libFortranRuntime.a") include = os.path.join(config.flang_src_dir, "include") diff --git a/flang/test/lit.site.cfg.py.in b/flang/test/lit.site.cfg.py.in index d1a0ac763cf8a0..697ba3fa797633 100644 --- a/flang/test/lit.site.cfg.py.in +++ b/flang/test/lit.site.cfg.py.in @@ -1,6 +1,7 @@ @LIT_SITE_CFG_IN_HEADER@ import sys +import lit.util config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") config.llvm_shlib_dir = lit_config.substitute(path(r"@SHLIBDIR@")) @@ -32,6 +33,7 @@ else: config.openmp_module_dir = None config.flang_runtime_f128_math_lib = "@FLANG_RUNTIME_F128_MATH_LIB@" config.have_ldbl_mant_dig_113 = "@HAVE_LDBL_MANT_DIG_113@" +config.flang_include_runtime = lit.util.pythonize_bool("@FLANG_INCLUDE_RUNTIME@") import lit.llvm lit.llvm.initialize(lit_config, config) diff --git a/flang/tools/f18/CMakeLists
[llvm-branch-commits] [flang] [Flang] Promote FortranEvaluateTesting library (PR #124417)
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/124417 >From 71015c8f9ab17431d052472aec99dc67929a166e Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 24 Jan 2025 16:30:47 +0100 Subject: [PATCH] [Flang] Promote FortranEvaluateTesting library --- .../flang/Testing}/fp-testing.h | 14 ++-- .../flang/Testing}/testing.h | 14 ++-- flang/lib/CMakeLists.txt | 4 +++ flang/lib/Testing/CMakeLists.txt | 20 +++ .../Evaluate => lib/Testing}/fp-testing.cpp | 10 +- .../Evaluate => lib/Testing}/testing.cpp | 10 +- flang/unittests/Evaluate/CMakeLists.txt | 35 ++- .../Evaluate/ISO-Fortran-binding.cpp | 2 +- .../Evaluate/bit-population-count.cpp | 2 +- flang/unittests/Evaluate/expression.cpp | 2 +- flang/unittests/Evaluate/folding.cpp | 2 +- flang/unittests/Evaluate/integer.cpp | 2 +- flang/unittests/Evaluate/intrinsics.cpp | 2 +- .../Evaluate/leading-zero-bit-count.cpp | 2 +- flang/unittests/Evaluate/logical.cpp | 2 +- flang/unittests/Evaluate/real.cpp | 4 +-- flang/unittests/Evaluate/reshape.cpp | 2 +- flang/unittests/Evaluate/uint128.cpp | 2 +- 18 files changed, 87 insertions(+), 44 deletions(-) rename flang/{unittests/Evaluate => include/flang/Testing}/fp-testing.h (54%) rename flang/{unittests/Evaluate => include/flang/Testing}/testing.h (74%) create mode 100644 flang/lib/Testing/CMakeLists.txt rename flang/{unittests/Evaluate => lib/Testing}/fp-testing.cpp (87%) rename flang/{unittests/Evaluate => lib/Testing}/testing.cpp (88%) diff --git a/flang/unittests/Evaluate/fp-testing.h b/flang/include/flang/Testing/fp-testing.h similarity index 54% rename from flang/unittests/Evaluate/fp-testing.h rename to flang/include/flang/Testing/fp-testing.h index 9091963a99b32d..e223d2ef7d1b8b 100644 --- a/flang/unittests/Evaluate/fp-testing.h +++ b/flang/include/flang/Testing/fp-testing.h @@ -1,5 +1,13 @@ -#ifndef FORTRAN_TEST_EVALUATE_FP_TESTING_H_ -#define FORTRAN_TEST_EVALUATE_FP_TESTING_H_ +//===-- include/flang/Testing/fp-testing.h --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef FORTRAN_TESTING_FP_TESTING_H_ +#define FORTRAN_TESTING_FP_TESTING_H_ #include "flang/Common/target-rounding.h" #include @@ -24,4 +32,4 @@ class ScopedHostFloatingPointEnvironment { #endif }; -#endif // FORTRAN_TEST_EVALUATE_FP_TESTING_H_ +#endif /* FORTRAN_TESTING_FP_TESTING_H_ */ diff --git a/flang/unittests/Evaluate/testing.h b/flang/include/flang/Testing/testing.h similarity index 74% rename from flang/unittests/Evaluate/testing.h rename to flang/include/flang/Testing/testing.h index 422e2853c05bc6..404650c9a89f2c 100644 --- a/flang/unittests/Evaluate/testing.h +++ b/flang/include/flang/Testing/testing.h @@ -1,5 +1,13 @@ -#ifndef FORTRAN_EVALUATE_TESTING_H_ -#define FORTRAN_EVALUATE_TESTING_H_ +//===-- include/flang/Testing/testing.h -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef FORTRAN_TESTING_TESTING_H_ +#define FORTRAN_TESTING_TESTING_H_ #include #include @@ -33,4 +41,4 @@ FailureDetailPrinter Match(const char *file, int line, const std::string &want, FailureDetailPrinter Compare(const char *file, int line, const char *xs, const char *rel, const char *ys, std::uint64_t x, std::uint64_t y); } // namespace testing -#endif // FORTRAN_EVALUATE_TESTING_H_ +#endif /* FORTRAN_TESTING_TESTING_H_ */ diff --git a/flang/lib/CMakeLists.txt b/flang/lib/CMakeLists.txt index 05c3535b09b3d3..8b201d9a758a80 100644 --- a/flang/lib/CMakeLists.txt +++ b/flang/lib/CMakeLists.txt @@ -8,3 +8,7 @@ add_subdirectory(Frontend) add_subdirectory(FrontendTool) add_subdirectory(Optimizer) + +if (FLANG_INCLUDE_TESTS) + add_subdirectory(Testing) +endif () diff --git a/flang/lib/Testing/CMakeLists.txt b/flang/lib/Testing/CMakeLists.txt new file mode 100644 index 00..8051bc09736d16 --- /dev/null +++ b/flang/lib/Testing/CMakeLists.txt @@ -0,0 +1,20 @@ +#===-- lib/Testing/CMakeLists.txt --===# +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#===
[llvm-branch-commits] [flang] d605fc5 - Revert "[flang][NFC] Restrict -funroll-loops tests to known working targets (…"
Author: David Truby Date: 2025-01-27T12:37:23Z New Revision: d605fc5e9d1ca9e3d2b38f55ccdcdf538e7d501d URL: https://github.com/llvm/llvm-project/commit/d605fc5e9d1ca9e3d2b38f55ccdcdf538e7d501d DIFF: https://github.com/llvm/llvm-project/commit/d605fc5e9d1ca9e3d2b38f55ccdcdf538e7d501d.diff LOG: Revert "[flang][NFC] Restrict -funroll-loops tests to known working targets (…" This reverts commit b8d921003d1f20819b897b066e02d22787f11550. Added: Modified: flang/test/HLFIR/unroll-loops.fir flang/test/Integration/unroll-loops.f90 Removed: diff --git a/flang/test/HLFIR/unroll-loops.fir b/flang/test/HLFIR/unroll-loops.fir index 1c214f76f56492..4494cfa570dd7b 100644 --- a/flang/test/HLFIR/unroll-loops.fir +++ b/flang/test/HLFIR/unroll-loops.fir @@ -1,11 +1,7 @@ -// RUN: %flang_fc1 -emit-llvm -O1 -funroll-loops -mllvm -force-vector-width=2 -triple aarch64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -// RUN: %flang_fc1 -emit-llvm -O2 -mllvm -force-vector-width=2 -triple aarch64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -// RUN: %flang_fc1 -emit-llvm -O1 -fno-unroll-loops -mllvm -force-vector-width=2 -triple aarch64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL -// RUN: %flang_fc1 -emit-llvm -O1 -mllvm -force-vector-width=2 -triple aarch64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL -// RUN: %flang_fc1 -emit-llvm -O1 -funroll-loops -mllvm -force-vector-width=2 -triple x86_64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -// RUN: %flang_fc1 -emit-llvm -O2 -mllvm -force-vector-width=2 -triple x86_64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -// RUN: %flang_fc1 -emit-llvm -O1 -fno-unroll-loops -mllvm -force-vector-width=2 -triple x86_64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL -// RUN: %flang_fc1 -emit-llvm -O1 -mllvm -force-vector-width=2 -triple x86_64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL +// RUN: %flang_fc1 -emit-llvm -O1 -funroll-loops -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL +// RUN: %flang_fc1 -emit-llvm -O2 -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL +// RUN: %flang_fc1 -emit-llvm -O1 -fno-unroll-loops -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL +// RUN: %flang_fc1 -emit-llvm -O1 -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL // FIXME: https://github.com/llvm/llvm-project/issues/123668 // XFAIL: target=powerpc64{{.*}} diff --git a/flang/test/Integration/unroll-loops.f90 b/flang/test/Integration/unroll-loops.f90 index 86c57dd2fd0ea7..4b4a3945028814 100644 --- a/flang/test/Integration/unroll-loops.f90 +++ b/flang/test/Integration/unroll-loops.f90 @@ -1,11 +1,10 @@ -! RUN: %flang_fc1 -emit-llvm -O1 -funroll-loops -mllvm -force-vector-width=2 -triple aarch64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -! RUN: %flang_fc1 -emit-llvm -O2 -mllvm -force-vector-width=2 -triple aarch64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -! RUN: %flang_fc1 -emit-llvm -O1 -fno-unroll-loops -mllvm -force-vector-width=2 -triple aarch64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL -! RUN: %flang_fc1 -emit-llvm -O1 -mllvm -force-vector-width=2 -triple aarch64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL -! RUN: %flang_fc1 -emit-llvm -O1 -funroll-loops -mllvm -force-vector-width=2 -triple x86_64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -! RUN: %flang_fc1 -emit-llvm -O2 -mllvm -force-vector-width=2 -triple x86_64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -! RUN: %flang_fc1 -emit-llvm -O1 -fno-unroll-loops -mllvm -force-vector-width=2 -triple x86_64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL -! RUN: %flang_fc1 -emit-llvm -O1 -mllvm -force-vector-width=2 -triple x86_64-unknown-linux-gnu -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL +! RUN: %flang_fc1 -emit-llvm -O1 -funroll-loops -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL +! RUN: %flang_fc1 -emit-llvm -O2 -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL +! RUN: %flang_fc1 -emit-llvm -O1 -fno-unroll-loops -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL +! RUN: %flang_fc1 -emit-llvm -O1 -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL + +! FIXME: https://github.com/llvm/llvm-project/issues/123668 +! XFAIL: target=powerpc64{{.*}} ! CHECK-LABEL: @unroll ! CHECK-SAME: (ptr nocapture writeonly %[[ARG0:.*]]) _
[llvm-branch-commits] [llvm] PeepholeOpt: Avoid double map lookup (PR #124531)
https://github.com/jayfoad approved this pull request. https://github.com/llvm/llvm-project/pull/124531 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [llvm] Fix __builtin_object_size interaction between Negative Offset … (#111827) (PR #114786)
https://github.com/tru closed https://github.com/llvm/llvm-project/pull/114786 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [llvm] Fix __builtin_object_size interaction between Negative Offset … (#111827) (PR #114786)
tru wrote: I will close this since we haven't gotten any real feedback on the right fix and we are closing out 19.x releases. If you still think it should be fixed for 19 - please reopen this. https://github.com/llvm/llvm-project/pull/114786 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [llvm] Fix __builtin_object_size interaction between Negative Offset … (#111827) (PR #114786)
tru wrote: I think the right way forward is to make sure it's fixed in main for LLVM 20. https://github.com/llvm/llvm-project/pull/114786 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [workflows] Rework pre-commit CI for the release branch (PR #91550)
tru wrote: I think this can be closed right @tstellar? https://github.com/llvm/llvm-project/pull/91550 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Promote FortranEvaluateTesting library (PR #124417)
https://github.com/Meinersbur ready_for_review https://github.com/llvm/llvm-project/pull/124417 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Promote FortranEvaluateTesting library (PR #124417)
llvmbot wrote: @llvm/pr-subscribers-flang-semantics Author: Michael Kruse (Meinersbur) Changes The non-GTest library will be shared by unittests of Flang and Flang-RT. Promote it as a regular library for use by both projects. Extracted out of #110217 In the long term, we may want to convert these to regular GTest checks to avoid having multiple testing frameworks. --- Full diff: https://github.com/llvm/llvm-project/pull/124417.diff 18 Files Affected: - (renamed) flang/include/flang/Testing/fp-testing.h (+11-3) - (renamed) flang/include/flang/Testing/testing.h (+11-3) - (modified) flang/lib/CMakeLists.txt (+4) - (added) flang/lib/Testing/CMakeLists.txt (+20) - (renamed) flang/lib/Testing/fp-testing.cpp (+9-1) - (renamed) flang/lib/Testing/testing.cpp (+9-1) - (modified) flang/unittests/Evaluate/CMakeLists.txt (+11-24) - (modified) flang/unittests/Evaluate/ISO-Fortran-binding.cpp (+1-1) - (modified) flang/unittests/Evaluate/bit-population-count.cpp (+1-1) - (modified) flang/unittests/Evaluate/expression.cpp (+1-1) - (modified) flang/unittests/Evaluate/folding.cpp (+1-1) - (modified) flang/unittests/Evaluate/integer.cpp (+1-1) - (modified) flang/unittests/Evaluate/intrinsics.cpp (+1-1) - (modified) flang/unittests/Evaluate/leading-zero-bit-count.cpp (+1-1) - (modified) flang/unittests/Evaluate/logical.cpp (+1-1) - (modified) flang/unittests/Evaluate/real.cpp (+2-2) - (modified) flang/unittests/Evaluate/reshape.cpp (+1-1) - (modified) flang/unittests/Evaluate/uint128.cpp (+1-1) ``diff diff --git a/flang/unittests/Evaluate/fp-testing.h b/flang/include/flang/Testing/fp-testing.h similarity index 54% rename from flang/unittests/Evaluate/fp-testing.h rename to flang/include/flang/Testing/fp-testing.h index 9091963a99b32d..e223d2ef7d1b8b 100644 --- a/flang/unittests/Evaluate/fp-testing.h +++ b/flang/include/flang/Testing/fp-testing.h @@ -1,5 +1,13 @@ -#ifndef FORTRAN_TEST_EVALUATE_FP_TESTING_H_ -#define FORTRAN_TEST_EVALUATE_FP_TESTING_H_ +//===-- include/flang/Testing/fp-testing.h --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef FORTRAN_TESTING_FP_TESTING_H_ +#define FORTRAN_TESTING_FP_TESTING_H_ #include "flang/Common/target-rounding.h" #include @@ -24,4 +32,4 @@ class ScopedHostFloatingPointEnvironment { #endif }; -#endif // FORTRAN_TEST_EVALUATE_FP_TESTING_H_ +#endif /* FORTRAN_TESTING_FP_TESTING_H_ */ diff --git a/flang/unittests/Evaluate/testing.h b/flang/include/flang/Testing/testing.h similarity index 74% rename from flang/unittests/Evaluate/testing.h rename to flang/include/flang/Testing/testing.h index 422e2853c05bc6..404650c9a89f2c 100644 --- a/flang/unittests/Evaluate/testing.h +++ b/flang/include/flang/Testing/testing.h @@ -1,5 +1,13 @@ -#ifndef FORTRAN_EVALUATE_TESTING_H_ -#define FORTRAN_EVALUATE_TESTING_H_ +//===-- include/flang/Testing/testing.h -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef FORTRAN_TESTING_TESTING_H_ +#define FORTRAN_TESTING_TESTING_H_ #include #include @@ -33,4 +41,4 @@ FailureDetailPrinter Match(const char *file, int line, const std::string &want, FailureDetailPrinter Compare(const char *file, int line, const char *xs, const char *rel, const char *ys, std::uint64_t x, std::uint64_t y); } // namespace testing -#endif // FORTRAN_EVALUATE_TESTING_H_ +#endif /* FORTRAN_TESTING_TESTING_H_ */ diff --git a/flang/lib/CMakeLists.txt b/flang/lib/CMakeLists.txt index 05c3535b09b3d3..8b201d9a758a80 100644 --- a/flang/lib/CMakeLists.txt +++ b/flang/lib/CMakeLists.txt @@ -8,3 +8,7 @@ add_subdirectory(Frontend) add_subdirectory(FrontendTool) add_subdirectory(Optimizer) + +if (FLANG_INCLUDE_TESTS) + add_subdirectory(Testing) +endif () diff --git a/flang/lib/Testing/CMakeLists.txt b/flang/lib/Testing/CMakeLists.txt new file mode 100644 index 00..8051bc09736d16 --- /dev/null +++ b/flang/lib/Testing/CMakeLists.txt @@ -0,0 +1,20 @@ +#===-- lib/Testing/CMakeLists.txt --===# +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#======# + +add_library(NonGTestTesting EXCLUDE_FROM_ALL +testing.cpp +fp-testing.cpp +) +set_target_properties(NonGTestTesting PROPER
[llvm-branch-commits] [llvm] PeepholeOpt: Simplify tracking of current op for copy and reg_sequence (PR #124224)
https://github.com/qcolombet approved this pull request. https://github.com/llvm/llvm-project/pull/124224 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [llvm] Fix __builtin_object_size interaction between Negative Offset … (#111827) (PR #114786)
hvdijk wrote: I do still think it should be fixed but if any fix needs to be reviewed by @serge-sans-paille and he is not going to review it, there is very little I can do, so might as well leave it closed. https://github.com/llvm/llvm-project/pull/114786 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [llvm] Fix __builtin_object_size interaction between Negative Offset … (#111827) (PR #114786)
hvdijk wrote: The reason for the backport of the minimal fix was that LLVM 19 was throwing false `-fsanitize` errors breaking our code. I guess we now have confirmation we will not be able to use LLVM 19. https://github.com/llvm/llvm-project/pull/114786 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/19.x: [clang-format] Correctly annotate braces in macro definitions (#123279) (PR #123439)
tru wrote: So far this is the only slated fix for 19.1.8 - I don't think it's important enough to do a release. Let me know if you disagree. https://github.com/llvm/llvm-project/pull/123439 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/19.x: [clang-format] Correctly annotate braces in macro definitions (#123279) (PR #123439)
owenca wrote: > So far this is the only slated fix for 19.1.8 - I don't think it's important > enough to do a release. Let me know if you disagree. +1. https://github.com/llvm/llvm-project/pull/123439 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PeepholeOpt: Remove check for reg_sequence def of subregister (PR #124512)
https://github.com/shiltian approved this pull request. https://github.com/llvm/llvm-project/pull/124512 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Remove FLANG_INCLUDE_RUNTIME (PR #124126)
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/124126 >From c515d13f0ad684763e6d76a87a610801482c15f4 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 24 Jan 2025 16:52:46 +0100 Subject: [PATCH] [Flang] Remove FLANG_INCLUDE_RUNTIME --- flang/CMakeLists.txt | 25 +- .../modules/AddFlangOffloadRuntime.cmake | 146 flang/runtime/CMakeLists.txt | 350 -- flang/runtime/CUDA/CMakeLists.txt | 41 -- flang/runtime/Float128Math/CMakeLists.txt | 133 --- flang/test/CMakeLists.txt | 10 - flang/test/lit.cfg.py | 3 - flang/test/lit.site.cfg.py.in | 1 - flang/tools/f18/CMakeLists.txt| 17 +- flang/unittests/CMakeLists.txt| 43 +-- flang/unittests/Evaluate/CMakeLists.txt | 16 - 11 files changed, 5 insertions(+), 780 deletions(-) delete mode 100644 flang/cmake/modules/AddFlangOffloadRuntime.cmake delete mode 100644 flang/runtime/CMakeLists.txt delete mode 100644 flang/runtime/CUDA/CMakeLists.txt delete mode 100644 flang/runtime/Float128Math/CMakeLists.txt diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index 38004c149b7835..aceb2d09c54388 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -23,7 +23,6 @@ if (LLVM_ENABLE_EH) endif() set(FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(FLANG_RT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../flang-rt") if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE) message(FATAL_ERROR "In-source builds are not allowed. \ @@ -237,24 +236,8 @@ else() include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR}) endif() -set(FLANG_INCLUDE_RUNTIME_default ON) -if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES) - set(FLANG_INCLUDE_RUNTIME_default OFF) -endif () -option(FLANG_INCLUDE_RUNTIME "Build the runtime in-tree (deprecated; to be replaced with LLVM_ENABLE_RUNTIMES=flang-rt)" FLANG_INCLUDE_RUNTIME_default) -if (FLANG_INCLUDE_RUNTIME) - if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES) -message(WARNING "Building Flang-RT using LLVM_ENABLE_RUNTIMES. FLANG_INCLUDE_RUNTIME=${FLANG_INCLUDE_RUNTIME} ignored.") -set(FLANG_INCLUDE_RUNTIME OFF) - else () - message(STATUS "Building flang_rt in-tree") - endif () -else () - if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES) -message(STATUS "Building Flang-RT using LLVM_ENABLE_RUNTIMES.") - else () -message(STATUS "Not building Flang-RT. For a usable Fortran toolchain, compile a standalone Flang-RT") - endif () +if (NOT "flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES) + message(STATUS "Not building Flang-RT. For a usable Fortran toolchain, compile a standalone Flang-RT") endif () set(FLANG_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH @@ -484,10 +467,6 @@ if (FLANG_CUF_RUNTIME) find_package(CUDAToolkit REQUIRED) endif() -if (FLANG_INCLUDE_RUNTIME) - add_subdirectory(runtime) -endif () - if (LLVM_INCLUDE_EXAMPLES) add_subdirectory(examples) endif() diff --git a/flang/cmake/modules/AddFlangOffloadRuntime.cmake b/flang/cmake/modules/AddFlangOffloadRuntime.cmake deleted file mode 100644 index 8e4f47d18535dc..00 --- a/flang/cmake/modules/AddFlangOffloadRuntime.cmake +++ /dev/null @@ -1,146 +0,0 @@ -option(FLANG_EXPERIMENTAL_CUDA_RUNTIME - "Compile Fortran runtime as CUDA sources (experimental)" OFF - ) - -option(FLANG_CUDA_RUNTIME_PTX_WITHOUT_GLOBAL_VARS - "Do not compile global variables' definitions when producing PTX library" OFF - ) - -set(FLANG_LIBCUDACXX_PATH "" CACHE PATH "Path to libcu++ package installation") - -set(FLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD "off" CACHE STRING - "Compile Fortran runtime as OpenMP target offload sources (experimental). Valid options are 'off', 'host_device', 'nohost'") - -set(FLANG_OMP_DEVICE_ARCHITECTURES "all" CACHE STRING - "List of OpenMP device architectures to be used to compile the Fortran runtime (e.g. 'gfx1103;sm_90')") - -macro(enable_cuda_compilation name files) - if (FLANG_EXPERIMENTAL_CUDA_RUNTIME) -if (BUILD_SHARED_LIBS) - message(FATAL_ERROR -"BUILD_SHARED_LIBS is not supported for CUDA build of Fortran runtime" -) -endif() - -enable_language(CUDA) - -# TODO: figure out how to make target property CUDA_SEPARABLE_COMPILATION -# work, and avoid setting CMAKE_CUDA_SEPARABLE_COMPILATION. -set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) - -# Treat all supported sources as CUDA files. -set_source_files_properties(${files} PROPERTIES LANGUAGE CUDA) -set(CUDA_COMPILE_OPTIONS) -if ("${CMAKE_CUDA_COMPILER_ID}" MATCHES "Clang") - # Allow varargs. - set(CUDA_COMPILE_OPTIONS --Xclang -fcuda-allow-variadic-functions -) -endif() -if ("${CMAKE_CUDA_COMPILER_ID}" MATCHES "NVIDIA") - set(CUDA_COMPILE_OPTIONS ---expt-relaxed-constexpr -# Disable these warnings: -#
[llvm-branch-commits] [llvm] [Flang-RT] Build libflang_rt.so (PR #121782)
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/121782 >From b05c9a033158aea459d51ff34b8ec47e72f85740 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 24 Jan 2025 16:51:27 +0100 Subject: [PATCH] [Flang-RT] Build libflang_rt.so --- flang-rt/CMakeLists.txt | 30 ++ flang-rt/cmake/modules/AddFlangRT.cmake | 324 -- .../cmake/modules/AddFlangRTOffload.cmake | 18 +- flang-rt/lib/flang_rt/CMakeLists.txt | 9 +- flang-rt/lib/flang_rt/CUDA/CMakeLists.txt | 26 +- flang-rt/test/CMakeLists.txt | 2 +- flang-rt/test/lit.cfg.py | 2 +- 7 files changed, 283 insertions(+), 128 deletions(-) diff --git a/flang-rt/CMakeLists.txt b/flang-rt/CMakeLists.txt index 655d0a55b40044..0b91b6ae7eea78 100644 --- a/flang-rt/CMakeLists.txt +++ b/flang-rt/CMakeLists.txt @@ -115,6 +115,15 @@ endif () extend_path(FLANG_RT_INSTALL_RESOURCE_LIB_PATH "${FLANG_RT_INSTALL_RESOURCE_PATH}" "${toolchain_lib_subdir}") cmake_path(NORMAL_PATH FLANG_RT_OUTPUT_RESOURCE_DIR) cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_PATH) +# FIXME: For the libflang_rt.so, the toolchain resource lib dir is not a good +#destination because it is not a ld.so default search path. +#The machine where the executable is eventually executed may not be the +#machine where the Flang compiler and its resource dir is installed, so +#setting RPath by the driver is not an solution. It should belong into +#/usr/lib//libflang_rt.so, like e.g. libgcc_s.so. +#But the linker as invoked by the Flang driver also requires +#libflang_rt.so to be found when linking and the resource lib dir is +#the only reliable location. cmake_path(NORMAL_PATH FLANG_RT_OUTPUT_RESOURCE_LIB_DIR) cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_LIB_PATH) @@ -129,6 +138,27 @@ cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_LIB_PATH) option(FLANG_RT_INCLUDE_TESTS "Generate build targets for the flang-rt unit and regression-tests." "${LLVM_INCLUDE_TESTS}") +option(FLANG_RT_ENABLE_STATIC "Build Flang-RT as a static library." ON) +if (WIN32) + # Windows DLL currently not implemented. + set(FLANG_RT_ENABLE_SHARED OFF) +else () + # TODO: Enable by default to increase test coverage, and which version of the + # library should be the user's choice anyway. + # Currently, the Flang driver adds `-L"libdir" -lflang_rt` as linker + # argument, which leaves the choice which library to use to the linker. + # Since most linkers prefer the shared library, this would constitute a + # breaking change unless the driver is changed. + option(FLANG_RT_ENABLE_SHARED "Build Flang-RT as a shared library." OFF) +endif () +if (NOT FLANG_RT_ENABLE_STATIC AND NOT FLANG_RT_ENABLE_SHARED) + message(FATAL_ERROR " + Must build at least one type of library + (FLANG_RT_ENABLE_STATIC=ON, FLANG_RT_ENABLE_SHARED=ON, or both) +") +endif () + + set(FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT "" CACHE STRING "Compile Flang-RT with GPU support (CUDA or OpenMP)") set_property(CACHE FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT PROPERTY STRINGS "" diff --git a/flang-rt/cmake/modules/AddFlangRT.cmake b/flang-rt/cmake/modules/AddFlangRT.cmake index aa8adedf61752a..87ec58b2e854eb 100644 --- a/flang-rt/cmake/modules/AddFlangRT.cmake +++ b/flang-rt/cmake/modules/AddFlangRT.cmake @@ -16,7 +16,8 @@ # STATIC # Build a static (.a/.lib) library # OBJECT -# Create only object files without static/dynamic library +# Always create an object library. +# Without SHARED/STATIC, build only the object library. # INSTALL_WITH_TOOLCHAIN # Install library into Clang's resource directory so it can be found by the # Flang driver during compilation, including tests @@ -48,17 +49,73 @@ function (add_flangrt_library name) ") endif () - # Forward libtype to add_library - set(extra_args "") - if (ARG_SHARED) -list(APPEND extra_args SHARED) + # Internal names of libraries. If called with just single type option, use + # the default name for it. Name of targets must only depend on function + # arguments to be predictable for callers. + set(name_static "${name}.static") + set(name_shared "${name}.shared") + set(name_object "obj.${name}") + if (ARG_STATIC AND NOT ARG_SHARED) +set(name_static "${name}") + elseif (NOT ARG_STATIC AND ARG_SHARED) +set(name_shared "${name}") + elseif (NOT ARG_STATIC AND NOT ARG_SHARED AND ARG_OBJECT) +set(name_object "${name}") + elseif (NOT ARG_STATIC AND NOT ARG_SHARED AND NOT ARG_OBJECT) +# Only one of them will actually be built. +set(name_static "${name}") +set(name_shared "${name}") endif () - if (ARG_STATIC) -list(APPEND extra_args STATIC) + + # Determine what to build. If not explicitly specified, honor + # BUILD_SHARED_LIBS (e.g. for unittest libraries). If can build s
[llvm-branch-commits] [clang] [clang] fix template argument conversion (PR #124386)
@@ -5252,63 +5253,73 @@ bool Sema::CheckTemplateArgument( return true; } -switch (Arg.getArgument().getKind()) { -case TemplateArgument::Null: - llvm_unreachable("Should never see a NULL template argument here"); - -case TemplateArgument::Expression: { - Expr *E = Arg.getArgument().getAsExpr(); +auto checkExpr = [&](Expr *E) -> Expr * { TemplateArgument SugaredResult, CanonicalResult; unsigned CurSFINAEErrors = NumSFINAEErrors; ExprResult Res = CheckTemplateArgument(NTTP, NTTPType, E, SugaredResult, CanonicalResult, PartialOrderingTTP, CTAK); - if (Res.isInvalid()) -return true; // If the current template argument causes an error, give up now. - if (CurSFINAEErrors < NumSFINAEErrors) -return true; + if (Res.isInvalid() || CurSFINAEErrors < NumSFINAEErrors) +return nullptr; + SugaredConverted.push_back(SugaredResult); + CanonicalConverted.push_back(CanonicalResult); + return Res.get(); +}; + +switch (Arg.getKind()) { +case TemplateArgument::Null: + llvm_unreachable("Should never see a NULL template argument here"); +case TemplateArgument::Expression: { + Expr *E = Arg.getAsExpr(); + Expr *R = checkExpr(E); + if (!R) +return true; // If the resulting expression is new, then use it in place of the // old expression in the template argument. - if (Res.get() != E) { -TemplateArgument TA(Res.get()); -Arg = TemplateArgumentLoc(TA, Res.get()); + if (R != E) { +TemplateArgument TA(R); +ArgLoc = TemplateArgumentLoc(TA, R); } - - SugaredConverted.push_back(SugaredResult); - CanonicalConverted.push_back(CanonicalResult); break; } -case TemplateArgument::Declaration: +// As for the converted NTTP kinds, they still might need another +// conversion, as the new corresponding parameter might be different. +// Ideally, we would always perform substitution starting with sugared types +// and never need these, as we would still have expressions. Since these are +// needed so rarely, it's probably a better tradeoff to just convert them +// back to expressions. case TemplateArgument::Integral: -case TemplateArgument::StructuralValue: +case TemplateArgument::Declaration: case TemplateArgument::NullPtr: - // We've already checked this template argument, so just copy - // it to the list of converted arguments. - SugaredConverted.push_back(Arg.getArgument()); - CanonicalConverted.push_back( - Context.getCanonicalTemplateArgument(Arg.getArgument())); +case TemplateArgument::StructuralValue: { + // FIXME: StructuralValue is untested here. + ExprResult R = + BuildExpressionFromNonTypeTemplateArgument(Arg, SourceLocation()); mizvekov wrote: This is used elsewhere to similar effect, and yes it may produce ASTContext nodes which are unreachable, which is something we are in general not very good at avoiding. We may rework that function in the future so it can produce a temporary expression. The previous solution in the patch was better in that effect, but would end up duplicating `BuildExpressionFromNonTypeTemplateArgument` in part. https://github.com/llvm/llvm-project/pull/124386 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] fix template argument conversion (PR #124386)
@@ -5252,63 +5253,73 @@ bool Sema::CheckTemplateArgument( return true; } -switch (Arg.getArgument().getKind()) { -case TemplateArgument::Null: - llvm_unreachable("Should never see a NULL template argument here"); - -case TemplateArgument::Expression: { - Expr *E = Arg.getArgument().getAsExpr(); +auto checkExpr = [&](Expr *E) -> Expr * { TemplateArgument SugaredResult, CanonicalResult; unsigned CurSFINAEErrors = NumSFINAEErrors; ExprResult Res = CheckTemplateArgument(NTTP, NTTPType, E, SugaredResult, CanonicalResult, PartialOrderingTTP, CTAK); - if (Res.isInvalid()) -return true; // If the current template argument causes an error, give up now. - if (CurSFINAEErrors < NumSFINAEErrors) -return true; + if (Res.isInvalid() || CurSFINAEErrors < NumSFINAEErrors) +return nullptr; + SugaredConverted.push_back(SugaredResult); + CanonicalConverted.push_back(CanonicalResult); + return Res.get(); +}; + +switch (Arg.getKind()) { +case TemplateArgument::Null: + llvm_unreachable("Should never see a NULL template argument here"); +case TemplateArgument::Expression: { + Expr *E = Arg.getAsExpr(); + Expr *R = checkExpr(E); + if (!R) +return true; // If the resulting expression is new, then use it in place of the // old expression in the template argument. - if (Res.get() != E) { -TemplateArgument TA(Res.get()); -Arg = TemplateArgumentLoc(TA, Res.get()); + if (R != E) { +TemplateArgument TA(R); +ArgLoc = TemplateArgumentLoc(TA, R); } - - SugaredConverted.push_back(SugaredResult); - CanonicalConverted.push_back(CanonicalResult); break; } -case TemplateArgument::Declaration: +// As for the converted NTTP kinds, they still might need another +// conversion, as the new corresponding parameter might be different. +// Ideally, we would always perform substitution starting with sugared types +// and never need these, as we would still have expressions. Since these are +// needed so rarely, it's probably a better tradeoff to just convert them +// back to expressions. case TemplateArgument::Integral: -case TemplateArgument::StructuralValue: +case TemplateArgument::Declaration: case TemplateArgument::NullPtr: - // We've already checked this template argument, so just copy - // it to the list of converted arguments. - SugaredConverted.push_back(Arg.getArgument()); - CanonicalConverted.push_back( - Context.getCanonicalTemplateArgument(Arg.getArgument())); +case TemplateArgument::StructuralValue: { + // FIXME: StructuralValue is untested here. + ExprResult R = + BuildExpressionFromNonTypeTemplateArgument(Arg, SourceLocation()); cor3ntin wrote: Yes, I think just adding a comment for now would be good enough https://github.com/llvm/llvm-project/pull/124386 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] 2b08a1b - Revert "[flang] arm build fix (#124562)"
Author: vdonaldson Date: 2025-01-27T10:38:05-05:00 New Revision: 2b08a1bf7ef2a061d2ac056447ab54533993bb44 URL: https://github.com/llvm/llvm-project/commit/2b08a1bf7ef2a061d2ac056447ab54533993bb44 DIFF: https://github.com/llvm/llvm-project/commit/2b08a1bf7ef2a061d2ac056447ab54533993bb44.diff LOG: Revert "[flang] arm build fix (#124562)" This reverts commit 1eb4e9f88b827f9adbcdd5f385f75406aa604812. Added: Modified: flang/runtime/exceptions.cpp Removed: diff --git a/flang/runtime/exceptions.cpp b/flang/runtime/exceptions.cpp index 4ea11aa6ee8fc0..7fca0c431f8cd0 100644 --- a/flang/runtime/exceptions.cpp +++ b/flang/runtime/exceptions.cpp @@ -108,7 +108,7 @@ bool RTNAME(GetUnderflowMode)(void) { return _MM_GET_FLUSH_ZERO_MODE() == _MM_FLUSH_ZERO_OFF; #elif defined(_FPU_GETCW) uint32_t fpcr; - __asm__ __volatile__("mrs%w0, fpcr" : "=r"(fpcr)); + _FPU_GETCW(fpcr); return (fpcr & _FPU_FPCR_FZ_MASK_) != _FPU_FPCR_FZ_MASK_; #else return false; @@ -119,13 +119,13 @@ void RTNAME(SetUnderflowMode)(bool flag) { _MM_SET_FLUSH_ZERO_MODE(flag ? _MM_FLUSH_ZERO_OFF : _MM_FLUSH_ZERO_ON); #elif defined(_FPU_GETCW) uint32_t fpcr; - __asm__ __volatile__("mrs%w0, fpcr" : "=r"(fpcr)); + _FPU_GETCW(fpcr); if (flag) { fpcr &= ~_FPU_FPCR_FZ_MASK_; } else { fpcr |= _FPU_FPCR_FZ_MASK_; } - __asm__ __volatile__("msrfpcr, %w0" : : "r"(fpcr)); + _FPU_SETCW(fpcr); #endif } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [flang] [lld] [Flang] Rename libFortranRuntime.a to libflang_rt.a (PR #122341)
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/122341 >From 875607fdecfada90a80ec732637ea9595fe72ba3 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 24 Jan 2025 16:42:24 +0100 Subject: [PATCH] [Flang] Rename libFortranRuntime.a to libflang_rt.a --- clang/lib/Driver/ToolChains/CommonArgs.cpp| 4 +- clang/lib/Driver/ToolChains/Flang.cpp | 8 ++-- flang/CMakeLists.txt | 2 +- flang/docs/FlangDriver.md | 6 +-- flang/docs/GettingStarted.md | 6 +-- flang/docs/OpenACC-descriptor-management.md | 2 +- flang/docs/ReleaseNotes.md| 2 + .../ExternalHelloWorld/CMakeLists.txt | 2 +- flang/lib/Optimizer/Builder/IntrinsicCall.cpp | 2 +- flang/runtime/CMakeLists.txt | 40 +++ flang/runtime/CUDA/CMakeLists.txt | 2 +- flang/runtime/Float128Math/CMakeLists.txt | 2 +- flang/runtime/time-intrinsic.cpp | 2 +- flang/test/CMakeLists.txt | 8 +++- .../test/Driver/gcc-toolchain-install-dir.f90 | 2 +- flang/test/Driver/linker-flags.f90| 8 ++-- .../test/Driver/msvc-dependent-lib-flags.f90 | 8 ++-- flang/test/Driver/nostdlib.f90| 2 +- flang/test/Runtime/no-cpp-dep.c | 2 +- flang/test/lit.cfg.py | 2 +- flang/tools/f18/CMakeLists.txt| 8 ++-- flang/unittests/CMakeLists.txt| 2 +- flang/unittests/Evaluate/CMakeLists.txt | 4 +- flang/unittests/Runtime/CMakeLists.txt| 2 +- flang/unittests/Runtime/CUDA/CMakeLists.txt | 2 +- lld/COFF/MinGW.cpp| 2 +- 26 files changed, 73 insertions(+), 59 deletions(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index b5273dd8cf1e3a..c7b0a660ee021f 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -1321,7 +1321,7 @@ void tools::addOpenMPHostOffloadingArgs(const Compilation &C, /// Add Fortran runtime libs void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args, llvm::opt::ArgStringList &CmdArgs) { - // Link FortranRuntime + // Link flang_rt // These are handled earlier on Windows by telling the frontend driver to // add the correct libraries to link against as dependents in the object // file. @@ -1337,7 +1337,7 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args, if (AsNeeded) addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false); } -CmdArgs.push_back("-lFortranRuntime"); +CmdArgs.push_back("-lflang_rt"); addArchSpecificRPath(TC, Args, CmdArgs); } diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp index f1bf32b3238270..68a17edf8ca341 100644 --- a/clang/lib/Driver/ToolChains/Flang.cpp +++ b/clang/lib/Driver/ToolChains/Flang.cpp @@ -360,26 +360,26 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args, case options::OPT__SLASH_MT: CmdArgs.push_back("-D_MT"); CmdArgs.push_back("--dependent-lib=libcmt"); -CmdArgs.push_back("--dependent-lib=FortranRuntime.static.lib"); +CmdArgs.push_back("--dependent-lib=flang_rt.static.lib"); break; case options::OPT__SLASH_MTd: CmdArgs.push_back("-D_MT"); CmdArgs.push_back("-D_DEBUG"); CmdArgs.push_back("--dependent-lib=libcmtd"); -CmdArgs.push_back("--dependent-lib=FortranRuntime.static_dbg.lib"); +CmdArgs.push_back("--dependent-lib=flang_rt.static_dbg.lib"); break; case options::OPT__SLASH_MD: CmdArgs.push_back("-D_MT"); CmdArgs.push_back("-D_DLL"); CmdArgs.push_back("--dependent-lib=msvcrt"); -CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic.lib"); +CmdArgs.push_back("--dependent-lib=flang_rt.dynamic.lib"); break; case options::OPT__SLASH_MDd: CmdArgs.push_back("-D_MT"); CmdArgs.push_back("-D_DEBUG"); CmdArgs.push_back("-D_DLL"); CmdArgs.push_back("--dependent-lib=msvcrtd"); -CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic_dbg.lib"); +CmdArgs.push_back("--dependent-lib=flang_rt.dynamic_dbg.lib"); break; } } diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index 7d6dcb5c184a52..8a8b8bfa73b007 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -301,7 +301,7 @@ set(FLANG_DEFAULT_LINKER "" CACHE STRING "Default linker to use (linker name or absolute path, empty for platform default)") set(FLANG_DEFAULT_RTLIB "" CACHE STRING - "Default Fortran runtime library to use (\"libFortranRuntime\"), leave empty for platform default.") + "Default Fortran runtime library to use (\"libflang_rt\"), leave empty for platform default.") if (NOT(FLANG_DEFAULT_RTLIB STREQUAL "")) message(W
[llvm-branch-commits] [llvm] PeepholeOpt: Remove check for reg_sequence def of subregister (PR #124512)
https://github.com/shiltian edited https://github.com/llvm/llvm-project/pull/124512 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [HLSL] Define the HLSLRootSignature Attr (PR #123985)
https://github.com/inbelic edited https://github.com/llvm/llvm-project/pull/123985 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [HLSL] Define the HLSLRootSignature Attr (PR #123985)
https://github.com/inbelic edited https://github.com/llvm/llvm-project/pull/123985 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] d7019b9 - Revert "[flang] IEEE underflow control for Arm (#124170)"
Author: vdonaldson Date: 2025-01-27T10:39:39-05:00 New Revision: d7019b9950ad6dccf6f71a75cd73c4f320c623fa URL: https://github.com/llvm/llvm-project/commit/d7019b9950ad6dccf6f71a75cd73c4f320c623fa DIFF: https://github.com/llvm/llvm-project/commit/d7019b9950ad6dccf6f71a75cd73c4f320c623fa.diff LOG: Revert "[flang] IEEE underflow control for Arm (#124170)" This reverts commit 3684ec425904424fc4dc80c8661f82bc676d7197. Added: Modified: flang/include/flang/Tools/TargetSetup.h flang/runtime/exceptions.cpp Removed: diff --git a/flang/include/flang/Tools/TargetSetup.h b/flang/include/flang/Tools/TargetSetup.h index 5d23df6823a948..d1b0da3a42c897 100644 --- a/flang/include/flang/Tools/TargetSetup.h +++ b/flang/include/flang/Tools/TargetSetup.h @@ -24,35 +24,34 @@ namespace Fortran::tools { const std::string &compilerVersion, const std::string &compilerOptions) { const llvm::Triple &targetTriple{targetMachine.getTargetTriple()}; - - targetCharacteristics.set_ieeeFeature(evaluate::IeeeFeature::Halting, true); - + // FIXME: Handle real(3) ? + if (targetTriple.getArch() != llvm::Triple::ArchType::x86_64) { +targetCharacteristics.DisableType( +Fortran::common::TypeCategory::Real, /*kind=*/10); + } if (targetTriple.getArch() == llvm::Triple::ArchType::x86_64) { targetCharacteristics.set_hasSubnormalFlushingControl(/*kind=*/3); targetCharacteristics.set_hasSubnormalFlushingControl(/*kind=*/4); targetCharacteristics.set_hasSubnormalFlushingControl(/*kind=*/8); } - if (targetTriple.isARM() || targetTriple.isAArch64()) { targetCharacteristics.set_haltingSupportIsUnknownAtCompileTime(); targetCharacteristics.set_ieeeFeature( evaluate::IeeeFeature::Halting, false); -targetCharacteristics.set_hasSubnormalFlushingControl(/*kind=*/3); -targetCharacteristics.set_hasSubnormalFlushingControl(/*kind=*/4); -targetCharacteristics.set_hasSubnormalFlushingControl(/*kind=*/8); - } - - if (targetTriple.getArch() != llvm::Triple::ArchType::x86_64) { -targetCharacteristics.DisableType( -Fortran::common::TypeCategory::Real, /*kind=*/10); + } else { +targetCharacteristics.set_ieeeFeature(evaluate::IeeeFeature::Halting); } - // Check for kind=16 support. See flang/runtime/Float128Math/math-entries.h. - // TODO: Take this from TargetInfo::getLongDoubleFormat for cross compilation. + // Figure out if we can support F128: see + // flang/runtime/Float128Math/math-entries.h + // TODO: this should be taken from TargetInfo::getLongDoubleFormat to support + // cross-compilation #ifdef FLANG_RUNTIME_F128_MATH_LIB - constexpr bool f128Support = true; // use libquadmath wrappers + // we can use libquadmath wrappers + constexpr bool f128Support = true; #elif HAS_LDBL128 - constexpr bool f128Support = true; // use libm wrappers + // we can use libm wrappers + constexpr bool f128Support = true; #else constexpr bool f128Support = false; #endif diff --git a/flang/runtime/exceptions.cpp b/flang/runtime/exceptions.cpp index 7fca0c431f8cd0..f541b8e844aded 100644 --- a/flang/runtime/exceptions.cpp +++ b/flang/runtime/exceptions.cpp @@ -11,9 +11,7 @@ #include "flang/Runtime/exceptions.h" #include "terminator.h" #include -#if __aarch64__ -#include -#elif __x86_64__ +#if __x86_64__ #include #endif @@ -92,40 +90,20 @@ bool RTNAME(SupportHalting)([[maybe_unused]] uint32_t except) { #endif } -// A hardware FZ (flush to zero) bit is the negation of the -// ieee_[get|set]_underflow_mode GRADUAL argument. -#if defined(_MM_FLUSH_ZERO_MASK) -// The MXCSR FZ bit affects computations of real kinds 3, 4, and 8. -#elif defined(_FPU_GETCW) -// The FPCR FZ bit affects computations of real kinds 3, 4, and 8. -// bit 24: FZ -- single, double precision flush to zero bit -// bit 19: FZ16 -- half precision flush to zero bit [not currently relevant] -#define _FPU_FPCR_FZ_MASK_ 0x0108 -#endif - bool RTNAME(GetUnderflowMode)(void) { -#if defined(_MM_FLUSH_ZERO_MASK) +#if _MM_FLUSH_ZERO_MASK + // The MXCSR Flush to Zero flag is the negation of the ieee_get_underflow_mode + // GRADUAL argument. It affects real computations of kinds 3, 4, and 8. return _MM_GET_FLUSH_ZERO_MODE() == _MM_FLUSH_ZERO_OFF; -#elif defined(_FPU_GETCW) - uint32_t fpcr; - _FPU_GETCW(fpcr); - return (fpcr & _FPU_FPCR_FZ_MASK_) != _FPU_FPCR_FZ_MASK_; #else return false; #endif } void RTNAME(SetUnderflowMode)(bool flag) { -#if defined(_MM_FLUSH_ZERO_MASK) +#if _MM_FLUSH_ZERO_MASK + // The MXCSR Flush to Zero flag is the negation of the ieee_set_underflow_mode + // GRADUAL argument. It affects real computations of kinds 3, 4, and 8. _MM_SET_FLUSH_ZERO_MODE(flag ? _MM_FLUSH_ZERO_OFF : _MM_FLUSH_ZERO_ON); -#elif defined(_FPU_GETCW) - uint32_t fpcr; - _FPU_GETCW(fpcr); - if (flag) { -fpcr &= ~_FPU_FPCR_FZ_MASK_; - } else { -fpcr |= _F
[llvm-branch-commits] [clang] 6660401 - Revert "[Clang] call HandleImmediateInvocation before checking for immediate …"
Author: cor3ntin Date: 2025-01-27T23:50:09+01:00 New Revision: 6660401456710db91998bbfe60f070a8f05edabe URL: https://github.com/llvm/llvm-project/commit/6660401456710db91998bbfe60f070a8f05edabe DIFF: https://github.com/llvm/llvm-project/commit/6660401456710db91998bbfe60f070a8f05edabe.diff LOG: Revert "[Clang] call HandleImmediateInvocation before checking for immediate …" This reverts commit 5815a311050ae218ebcda53adeee24ed96851943. Added: Modified: clang/docs/ReleaseNotes.rst clang/include/clang/Sema/Sema.h clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaExpr.cpp clang/test/SemaCXX/cxx2b-consteval-propagate.cpp Removed: clang/test/CodeGenCXX/gh119046.cpp diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 8b04f172946df1..af3632322b8453 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -1003,7 +1003,6 @@ Bug Fixes to C++ Support - Fixed assertions or false compiler diagnostics in the case of C++ modules for lambda functions or inline friend functions defined inside templates (#GH122493). - Clang now rejects declaring an alias template with the same name as its template parameter. (#GH123423) -- Fix that some dependent immediate expressions did not cause immediate escalation (#GH119046) - Fixed the rejection of valid code when referencing an enumerator of an unscoped enum member with a prior declaration. (#GH124405) - Fixed immediate escalation of non-dependent expressions. (#GH123405) - Fix type of expression when calling a template which returns an ``__array_rank`` querying a type depending on a diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index f1d1e2e567193f..528304409b8092 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -13139,10 +13139,10 @@ class Sema final : public SemaBase { ~SynthesizedFunctionScope() { if (PushedCodeSynthesisContext) S.popCodeSynthesisContext(); - - if (auto *FD = dyn_cast(S.CurContext)) + if (auto *FD = dyn_cast(S.CurContext)) { FD->setWillHaveBody(false); - +S.CheckImmediateEscalatingFunctionDefinition(FD, S.getCurFunction()); + } S.PopExpressionEvaluationContext(); S.PopFunctionScopeInfo(); } diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index accef4c5d5d916..fe68eadc951b5f 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -16019,6 +16019,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, if (!FD->isDeletedAsWritten()) FD->setBody(Body); FD->setWillHaveBody(false); + CheckImmediateEscalatingFunctionDefinition(FD, FSI); if (getLangOpts().CPlusPlus14) { if (!FD->isInvalidDecl() && Body && !FD->isDependentContext() && diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index e098b21045f01d..176627c3df37c6 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -17881,9 +17881,6 @@ void Sema::PopExpressionEvaluationContext() { WarnOnPendingNoDerefs(Rec); HandleImmediateInvocations(*this, Rec); - if (auto *FD = dyn_cast(CurContext); FD && getCurFunction()) -CheckImmediateEscalatingFunctionDefinition(FD, getCurFunction()); - // Warn on any volatile-qualified simple-assignments that are not discarded- // value expressions nor unevaluated operands (those cases get removed from // this list by CheckUnusedVolatileAssignment). diff --git a/clang/test/CodeGenCXX/gh119046.cpp b/clang/test/CodeGenCXX/gh119046.cpp deleted file mode 100644 index cad76879f08624..00 --- a/clang/test/CodeGenCXX/gh119046.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// RUN: %clang_cc1 -std=c++2a -triple x86_64-elf-gnu %s -emit-llvm -o - | FileCheck %s - -struct S { -consteval void operator()() {} -}; - -template -constexpr void dispatch(Fn fn) { -fn(); -} - -template -struct value_visitor { -constexpr void operator()() { visitor(); } -Visitor&& visitor; -}; - -template -constexpr auto make_dispatch() { -return dispatch>; -} - -template -constexpr void visit(Visitor&&) { -make_dispatch(); -} - -void f() { visit(S{}); } - -// CHECK: define {{.*}} @_Z1fv -// CHECK-NOT: define {{.*}} @_Z5visitI1SEvOT_ -// CHECK-NOT: define {{.*}} @_Z13make_dispatchI1SEDav diff --git a/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp b/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp index e83e03da54f788..05904d9ade067f 100644 --- a/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp +++ b/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp @@ -529,23 +529,6 @@ D d(0); // expected-note {{in implicit initialization for inherited constructor } -namespace GH119046 { - -template constexpr auto tfn(int) { - return (unsigned long long)(&Cls::sfn); - //expected-note@-1 {{'tfn' is an immediate fu
[llvm-branch-commits] [llvm] [DXIL] Add support for root signature flag element in DXContainer (PR #123147)
https://github.com/joaosaffran updated https://github.com/llvm/llvm-project/pull/123147 >From 6043ffc97b263c6df78008bbe011a6ebe3dd1fd2 Mon Sep 17 00:00:00 2001 From: joaosaffran Date: Wed, 15 Jan 2025 17:30:00 + Subject: [PATCH 1/9] adding metadata extraction --- .../llvm/Analysis/DXILMetadataAnalysis.h | 3 + llvm/lib/Analysis/DXILMetadataAnalysis.cpp| 89 +++ .../lib/Target/DirectX/DXContainerGlobals.cpp | 24 + 3 files changed, 116 insertions(+) diff --git a/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h b/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h index cb535ac14f1c61..f420244ba111a4 100644 --- a/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h +++ b/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h @@ -11,9 +11,11 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/IR/PassManager.h" +#include "llvm/MC/DXContainerRootSignature.h" #include "llvm/Pass.h" #include "llvm/Support/VersionTuple.h" #include "llvm/TargetParser/Triple.h" +#include namespace llvm { @@ -37,6 +39,7 @@ struct ModuleMetadataInfo { Triple::EnvironmentType ShaderProfile{Triple::UnknownEnvironment}; VersionTuple ValidatorVersion{}; SmallVector EntryPropertyVec{}; + std::optional RootSignatureDesc; void print(raw_ostream &OS) const; }; diff --git a/llvm/lib/Analysis/DXILMetadataAnalysis.cpp b/llvm/lib/Analysis/DXILMetadataAnalysis.cpp index a7f666a3f8b48f..388e3853008eae 100644 --- a/llvm/lib/Analysis/DXILMetadataAnalysis.cpp +++ b/llvm/lib/Analysis/DXILMetadataAnalysis.cpp @@ -15,12 +15,91 @@ #include "llvm/IR/Metadata.h" #include "llvm/IR/Module.h" #include "llvm/InitializePasses.h" +#include "llvm/MC/DXContainerRootSignature.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" +#include #define DEBUG_TYPE "dxil-metadata-analysis" using namespace llvm; using namespace dxil; +using namespace llvm::mcdxbc; + +static bool parseRootFlags(MDNode *RootFlagNode, RootSignatureDesc *Desc) { + + assert(RootFlagNode->getNumOperands() == 2 && + "Invalid format for RootFlag Element"); + auto *Flag = mdconst::extract(RootFlagNode->getOperand(1)); + auto Value = (RootSignatureFlags)Flag->getZExtValue(); + + if ((Value & ~RootSignatureFlags::ValidFlags) != RootSignatureFlags::None) +return true; + + Desc->Flags = Value; + return false; +} + +static bool parseRootSignatureElement(MDNode *Element, + RootSignatureDesc *Desc) { + MDString *ElementText = cast(Element->getOperand(0)); + + assert(ElementText != nullptr && "First preoperty of element is not "); + + RootSignatureElementKind ElementKind = + StringSwitch(ElementText->getString()) + .Case("RootFlags", RootSignatureElementKind::RootFlags) + .Case("RootConstants", RootSignatureElementKind::RootConstants) + .Case("RootCBV", RootSignatureElementKind::RootDescriptor) + .Case("RootSRV", RootSignatureElementKind::RootDescriptor) + .Case("RootUAV", RootSignatureElementKind::RootDescriptor) + .Case("Sampler", RootSignatureElementKind::RootDescriptor) + .Case("DescriptorTable", RootSignatureElementKind::DescriptorTable) + .Case("StaticSampler", RootSignatureElementKind::StaticSampler) + .Default(RootSignatureElementKind::None); + + switch (ElementKind) { + + case RootSignatureElementKind::RootFlags: { +return parseRootFlags(Element, Desc); +break; + } + + case RootSignatureElementKind::RootConstants: + case RootSignatureElementKind::RootDescriptor: + case RootSignatureElementKind::DescriptorTable: + case RootSignatureElementKind::StaticSampler: + case RootSignatureElementKind::None: +llvm_unreachable("Not Implemented yet"); +break; + } + + return true; +} + +bool parseRootSignature(RootSignatureDesc *Desc, int32_t Version, +NamedMDNode *Root) { + Desc->Version = Version; + bool HasError = false; + + for (unsigned int Sid = 0; Sid < Root->getNumOperands(); Sid++) { +// This should be an if, for error handling +MDNode *Node = cast(Root->getOperand(Sid)); + +// Not sure what use this for... +Metadata *Func = Node->getOperand(0).get(); + +// This should be an if, for error handling +MDNode *Elements = cast(Node->getOperand(1).get()); + +for (unsigned int Eid = 0; Eid < Elements->getNumOperands(); Eid++) { + MDNode *Element = cast(Elements->getOperand(Eid)); + + HasError = HasError || parseRootSignatureElement(Element, Desc); +} + } + return HasError; +} static ModuleMetadataInfo collectMetadataInfo(Module &M) { ModuleMetadataInfo MMDAI; @@ -28,6 +107,7 @@ static ModuleMetadataInfo collectMetadataInfo(Module &M) { MMDAI.DXILVersion = TT.getDXILVersion(); MMDAI.ShaderModelVersion = TT.getOSVersion(); MMDAI.ShaderProfile = TT.getEnvironment(); + NamedMDNode *ValidatorVerNode = M.getNamedMetadata("dx.valver"); if (ValidatorVerNode) {
[llvm-branch-commits] [SHT_LLVM_FUNC_MAP][CodeGen]Introduce function address map section and emit dynamic instruction count(CodeGen part) (PR #124334)
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/124334 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [SHT_LLVM_FUNC_MAP][llvm-readobj]Introduce function address map section and emit dynamic instruction count(readobj part) (PR #124333)
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/124333 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [SHT_LLVM_FUNC_MAP][llvm-readobj]Introduce function address map section and emit dynamic instruction count(readobj part) (PR #124333)
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/124333 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] NFC: cleanup check template argument (PR #124668)
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/124668 None >From 4387c95a4bd6ccfc74e95683da0829fde41560c1 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Mon, 27 Jan 2025 19:18:27 -0300 Subject: [PATCH] [clang] NFC: cleanup check template argument --- clang/include/clang/Sema/Sema.h | 70 +++-- clang/lib/Sema/SemaLookup.cpp | 6 +- clang/lib/Sema/SemaTemplate.cpp | 277 +- clang/lib/Sema/SemaTemplateDeduction.cpp | 208 +++-- .../lib/Sema/SemaTemplateInstantiateDecl.cpp | 47 +-- 5 files changed, 307 insertions(+), 301 deletions(-) diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 1ea7c62cb36f05..ef097f24fb3f52 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -11650,6 +11650,33 @@ class Sema final : public SemaBase { CTAK_DeducedFromArrayBound }; + struct CheckTemplateArgumentInfo { +explicit CheckTemplateArgumentInfo(bool PartialOrdering = false, + bool MatchingTTP = false) +: PartialOrdering(PartialOrdering), MatchingTTP(MatchingTTP) {} +CheckTemplateArgumentInfo(const CheckTemplateArgumentInfo &) = delete; +CheckTemplateArgumentInfo & +operator=(const CheckTemplateArgumentInfo &) = delete; + +/// The checked, converted argument will be added to the +/// end of these vectors. +SmallVector SugaredConverted, CanonicalConverted; + +/// The check is being performed in the context of partial ordering. +bool PartialOrdering; + +/// If true, assume these template arguments are +/// the injected template arguments for a template template parameter. +/// This will relax the requirement that all its possible uses are valid: +/// TTP checking is loose, and assumes that invalid uses will be diagnosed +/// during instantiation. +bool MatchingTTP; + +/// Is set to true when, in the context of TTP matching, a pack parameter +/// matches non-pack arguments. +bool MatchedPackOnParmToNonPackOnArg; + }; + /// Check that the given template argument corresponds to the given /// template parameter. /// @@ -11669,22 +11696,16 @@ class Sema final : public SemaBase { /// \param ArgumentPackIndex The index into the argument pack where this /// argument will be placed. Only valid if the parameter is a parameter pack. /// - /// \param Converted The checked, converted argument will be added to the - /// end of this small vector. - /// /// \param CTAK Describes how we arrived at this particular template argument: /// explicitly written, deduced, etc. /// /// \returns true on error, false otherwise. - bool - CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, -NamedDecl *Template, SourceLocation TemplateLoc, -SourceLocation RAngleLoc, unsigned ArgumentPackIndex, -SmallVectorImpl &SugaredConverted, -SmallVectorImpl &CanonicalConverted, -CheckTemplateArgumentKind CTAK, bool PartialOrdering, -bool PartialOrderingTTP, -bool *MatchedPackOnParmToNonPackOnArg); + bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, + NamedDecl *Template, SourceLocation TemplateLoc, + SourceLocation RAngleLoc, + unsigned ArgumentPackIndex, + CheckTemplateArgumentInfo &CTAI, + CheckTemplateArgumentKind CTAK); /// Check that the given template arguments can be provided to /// the given template, converting the arguments along the way. @@ -11717,22 +11738,15 @@ class Sema final : public SemaBase { /// \param DefaultArgs any default arguments from template specialization /// deduction. /// - /// \param PartialOrderingTTP If true, assume these template arguments are - /// the injected template arguments for a template template parameter. - /// This will relax the requirement that all its possible uses are valid: - /// TTP checking is loose, and assumes that invalid uses will be diagnosed - /// during instantiation. - /// /// \returns true if an error occurred, false otherwise. - bool CheckTemplateArgumentList( - TemplateDecl *Template, SourceLocation TemplateLoc, - TemplateArgumentListInfo &TemplateArgs, - const DefaultArguments &DefaultArgs, bool PartialTemplateArgs, - SmallVectorImpl &SugaredConverted, - SmallVectorImpl &CanonicalConverted, - bool UpdateArgsWithConversions = true, - bool *ConstraintsNotSatisfied = nullptr, bool PartialOrderingTTP = false, - bool *MatchedPackOnParmToNonPackOnArg = nullptr); + bool CheckTemplateArgumentList(TemplateDecl *Template, + SourceLocati
[llvm-branch-commits] [clang] [clang] NFC: cleanup check template argument (PR #124668)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Matheus Izvekov (mizvekov) Changes --- Patch is 77.45 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/124668.diff 5 Files Affected: - (modified) clang/include/clang/Sema/Sema.h (+42-28) - (modified) clang/lib/Sema/SemaLookup.cpp (+2-4) - (modified) clang/lib/Sema/SemaTemplate.cpp (+137-140) - (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+102-106) - (modified) clang/lib/Sema/SemaTemplateInstantiateDecl.cpp (+24-23) ``diff diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 1ea7c62cb36f05..ef097f24fb3f52 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -11650,6 +11650,33 @@ class Sema final : public SemaBase { CTAK_DeducedFromArrayBound }; + struct CheckTemplateArgumentInfo { +explicit CheckTemplateArgumentInfo(bool PartialOrdering = false, + bool MatchingTTP = false) +: PartialOrdering(PartialOrdering), MatchingTTP(MatchingTTP) {} +CheckTemplateArgumentInfo(const CheckTemplateArgumentInfo &) = delete; +CheckTemplateArgumentInfo & +operator=(const CheckTemplateArgumentInfo &) = delete; + +/// The checked, converted argument will be added to the +/// end of these vectors. +SmallVector SugaredConverted, CanonicalConverted; + +/// The check is being performed in the context of partial ordering. +bool PartialOrdering; + +/// If true, assume these template arguments are +/// the injected template arguments for a template template parameter. +/// This will relax the requirement that all its possible uses are valid: +/// TTP checking is loose, and assumes that invalid uses will be diagnosed +/// during instantiation. +bool MatchingTTP; + +/// Is set to true when, in the context of TTP matching, a pack parameter +/// matches non-pack arguments. +bool MatchedPackOnParmToNonPackOnArg; + }; + /// Check that the given template argument corresponds to the given /// template parameter. /// @@ -11669,22 +11696,16 @@ class Sema final : public SemaBase { /// \param ArgumentPackIndex The index into the argument pack where this /// argument will be placed. Only valid if the parameter is a parameter pack. /// - /// \param Converted The checked, converted argument will be added to the - /// end of this small vector. - /// /// \param CTAK Describes how we arrived at this particular template argument: /// explicitly written, deduced, etc. /// /// \returns true on error, false otherwise. - bool - CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, -NamedDecl *Template, SourceLocation TemplateLoc, -SourceLocation RAngleLoc, unsigned ArgumentPackIndex, -SmallVectorImpl &SugaredConverted, -SmallVectorImpl &CanonicalConverted, -CheckTemplateArgumentKind CTAK, bool PartialOrdering, -bool PartialOrderingTTP, -bool *MatchedPackOnParmToNonPackOnArg); + bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, + NamedDecl *Template, SourceLocation TemplateLoc, + SourceLocation RAngleLoc, + unsigned ArgumentPackIndex, + CheckTemplateArgumentInfo &CTAI, + CheckTemplateArgumentKind CTAK); /// Check that the given template arguments can be provided to /// the given template, converting the arguments along the way. @@ -11717,22 +11738,15 @@ class Sema final : public SemaBase { /// \param DefaultArgs any default arguments from template specialization /// deduction. /// - /// \param PartialOrderingTTP If true, assume these template arguments are - /// the injected template arguments for a template template parameter. - /// This will relax the requirement that all its possible uses are valid: - /// TTP checking is loose, and assumes that invalid uses will be diagnosed - /// during instantiation. - /// /// \returns true if an error occurred, false otherwise. - bool CheckTemplateArgumentList( - TemplateDecl *Template, SourceLocation TemplateLoc, - TemplateArgumentListInfo &TemplateArgs, - const DefaultArguments &DefaultArgs, bool PartialTemplateArgs, - SmallVectorImpl &SugaredConverted, - SmallVectorImpl &CanonicalConverted, - bool UpdateArgsWithConversions = true, - bool *ConstraintsNotSatisfied = nullptr, bool PartialOrderingTTP = false, - bool *MatchedPackOnParmToNonPackOnArg = nullptr); + bool CheckTemplateArgumentList(TemplateDecl *Template, + SourceLocation TemplateLoc, + TemplateArgumentListInfo &TemplateArgs, +
[llvm-branch-commits] [SHT_LLVM_FUNC_MAP][CodeGen]Introduce function address map section and emit dynamic instruction count(CodeGen part) (PR #124334)
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/124334 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [SHT_LLVM_FUNC_MAP][llvm-readobj]Introduce function address map section and emit dynamic instruction count(readobj part) (PR #124333)
https://github.com/wlei-llvm edited https://github.com/llvm/llvm-project/pull/124333 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PeepholeOpt: Avoid double map lookup (PR #124531)
https://github.com/kazutakahirata approved this pull request. LGTM. See a comment above about `const &`. https://github.com/llvm/llvm-project/pull/124531 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PeepholeOpt: Avoid double map lookup (PR #124531)
https://github.com/kazutakahirata edited https://github.com/llvm/llvm-project/pull/124531 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port RegisterCoalescer to NPM (PR #124698)
arsenm wrote: > Removes the unused AliasAnalysis dependency. Do this separately https://github.com/llvm/llvm-project/pull/124698 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PeepholeOpt: Avoid double map lookup (PR #124531)
@@ -1035,8 +1035,11 @@ bool PeepholeOptimizer::findNextSource(RegSubRegPair RegSubReg, return false; // Insert the Def -> Use entry for the recently found source. - ValueTrackerResult CurSrcRes = RewriteMap.lookup(CurSrcPair); - if (CurSrcRes.isValid()) { + auto [InsertPt, WasInserted] = RewriteMap.try_emplace(CurSrcPair, Res); + + if (!WasInserted) { +ValueTrackerResult CurSrcRes = InsertPt->second; kazutakahirata wrote: You might want to make this const reference because you are not modifying `ValueTrackerResult` within this `if` block. Note that `ValueTrackerResult` contains a `SmallVector`, so it's not completely cheap to copy. ```suggestion const ValueTrackerResult &CurSrcRes = InsertPt->second; ``` https://github.com/llvm/llvm-project/pull/124531 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [SHT_LLVM_FUNC_MAP][CodeGen]Introduce function address map section and emit dynamic instruction count(CodeGen part) (PR #124334)
https://github.com/wlei-llvm updated https://github.com/llvm/llvm-project/pull/124334 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port RegisterCoalescer to NPM (PR #124698)
https://github.com/optimisan edited https://github.com/llvm/llvm-project/pull/124698 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] NFC: cleanup check template argument (PR #124668)
https://github.com/cor3ntin approved this pull request. This is great, thanks! https://github.com/llvm/llvm-project/pull/124668 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port RegisterCoalescer to NPM (PR #124698)
@@ -4241,7 +4259,33 @@ void RegisterCoalescer::releaseMemory() { LargeLIVisitCounter.clear(); } -bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) { +PreservedAnalyses +RegisterCoalescerPass::run(MachineFunction &MF, + MachineFunctionAnalysisManager &MFAM) { + auto &LIS = MFAM.getResult(MF); + auto &Loops = MFAM.getResult(MF); + auto *SI = MFAM.getCachedResult(MF); + RegisterCoalescer Impl(&LIS, SI, &Loops); + if (!Impl.run(MF)) +return PreservedAnalyses::all(); + auto PA = getMachineFunctionPassPreservedAnalyses(); + PA.preserve(); + PA.preserve(); + PA.preserve(); + PA.preserve(); + return PA; +} + +bool RegisterCoalescerLegacy::runOnMachineFunction(MachineFunction &MF) { + auto *LIS = &getAnalysis().getLIS(); + auto *Loops = &getAnalysis().getLI(); + auto *SIWrapper = getAnalysisIfAvailable(); + SlotIndexes *SI = SIWrapper ? &SIWrapper->getSI() : nullptr; + Impl.reset(new RegisterCoalescer(LIS, SI, Loops)); arsenm wrote: Don't see why this needs heap allocation https://github.com/llvm/llvm-project/pull/124698 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits