[clang] Support BasedOnStyle referencing an arbitrary file (PR #110634)
owenca wrote: Please see https://github.com/llvm/llvm-project/issues/107808#issuecomment-2431139406. https://github.com/llvm/llvm-project/pull/110634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [LoongArch] [CodeGen] Support LoongArch-specific amswap[_db].{b/h} and amadd[_db].{b/h} instructions. (PR #113255)
https://github.com/SixWeining edited https://github.com/llvm/llvm-project/pull/113255 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][RISCV] Support -fcf-protection=return for RISC-V (PR #112477)
mylai-mtk wrote: LGTM, but please wait for others. I'm too junior to this community that I'm not sure if my words are enough 😂 https://github.com/llvm/llvm-project/pull/112477 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [LoongArch] Support LoongArch-specific amswap[_db].{b/h} and amadd[_db].{b/h} instructions (PR #113255)
https://github.com/SixWeining edited https://github.com/llvm/llvm-project/pull/113255 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][bytecode] Diagnose non-const initialiers in diagnoseUnknownDecl (PR #113276)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `sanitizer-aarch64-linux-bootstrap-hwasan` running on `sanitizer-buildbot12` while building `clang` at step 2 "annotate". Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/3007 Here is the relevant piece of the build log for the reference ``` Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure) ... llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds. -- Testing: 82982 tests, 48 workers -- Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90. FAIL: lld :: COFF/link-dll-stdcall.s (80231 of 82982) TEST 'lld :: COFF/link-dll-stdcall.s' FAILED Exit Code: 1 Command Output (stderr): -- RUN: at line 13: split-file /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/lld/test/COFF/link-dll-stdcall.s /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/COFF/Output/link-dll-stdcall.s.tmp.dir + split-file /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/lld/test/COFF/link-dll-stdcall.s /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/COFF/Output/link-dll-stdcall.s.tmp.dir RUN: at line 15: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/llvm-mc -filetype=obj -triple=i386-windows-gnu /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/COFF/Output/link-dll-stdcall.s.tmp.dir/lib.s -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/COFF/Output/link-dll-stdcall.s.tmp.lib.o + /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/llvm-mc -filetype=obj -triple=i386-windows-gnu /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/COFF/Output/link-dll-stdcall.s.tmp.dir/lib.s -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/COFF/Output/link-dll-stdcall.s.tmp.lib.o RUN: at line 16: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link -safeseh:no -noentry -dll -def:/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/COFF/Output/link-dll-stdcall.s.tmp.dir/lib.def /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/COFF/Output/link-dll-stdcall.s.tmp.lib.o -out:/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/COFF/Output/link-dll-stdcall.s.tmp.lib.dll -implib:/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/COFF/Output/link-dll-stdcall.s.tmp.implib.lib + /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link -safeseh:no -noentry -dll -def:/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/COFF/Output/link-dll-stdcall.s.tmp.dir/lib.def /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/lld/test/
[clang] [llvm] [LoongArch] Support LoongArch-specific amswap[_db].{b/h} and amadd[_db].{b/h} instructions (PR #113255)
https://github.com/SixWeining approved this pull request. https://github.com/llvm/llvm-project/pull/113255 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [LoongArch] Support LoongArch-specific amswap[_db].{b/h} and amadd[_db].{b/h} instructions (PR #113255)
https://github.com/SixWeining closed https://github.com/llvm/llvm-project/pull/113255 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [FlowSensitive] Allow to dump nested RecordStorageLocation (PR #112457)
martinboehme wrote: I think this is the right change. What I don't understand, though, is why you were getting an assert failure before. (Which line is the assertion on that failed?) I would have thought if you don't dump the nested record, you just get less information. Apparently not so? > > I would suggest a brief comment explaining the choice not to filter. > > I'm not sure I understand. There wasn't a choice to filter before, there was > just the (incorrect) assumption that we don't have nested > `RecordStorageLocation`, leading to a crash. @ymand I think maybe what you're missing is that the code is calling a different overload of `dump()` now? Previously, it called the `Value` overload, now it's calling the `StorageLocation` overload. And of course the `StorageLocation` doesn't care whether there's a value at the location (or rather, it will figure that out itself and dump the value if so). @fmayer Just as an explanation of why this check is there: I think this isn't because the code assumed that nested `RecordStorageLocation`s don't exist; rather, we used to have a concept of a `RecordValue`, and when that existed, it made more sense to do this check here. When I eliminated the `RecordValue` concept, I updated some of the code in `ModelDumper` but didn't notice that this check now no longer made sense. https://github.com/llvm/llvm-project/pull/112457 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [ci] Write test results to unique file names (PR #113160)
@@ -15,3 +15,5 @@ documentation setup. If you are writing a package for LLVM, see docs/Packaging.rst for our suggestions. + +Test line. DavidSpickett wrote: I should have mentioned this in a comment, https://github.com/llvm/llvm-project/pull/113160/commits/e3746737934e12fb70a37f852d99d8c96a8608cd is just to make the job actually build something so there are artifacts to show. I will remove it when review concludes. https://github.com/llvm/llvm-project/pull/113160 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5b9c76b - [LoongArch] Support LoongArch-specific amswap[_db].{b/h} and amadd[_db].{b/h} instructions (#113255)
Author: tangaac Date: 2024-10-23T16:03:15+08:00 New Revision: 5b9c76b6e70c4195609bb939e067b82cdbe02adf URL: https://github.com/llvm/llvm-project/commit/5b9c76b6e70c4195609bb939e067b82cdbe02adf DIFF: https://github.com/llvm/llvm-project/commit/5b9c76b6e70c4195609bb939e067b82cdbe02adf.diff LOG: [LoongArch] Support LoongArch-specific amswap[_db].{b/h} and amadd[_db].{b/h} instructions (#113255) Two options for clang: -mlam-bh & -mno-lam-bh. Enable or disable amswap[__db].{b/h} and amadd[__db].{b/h} instructions. The default is -mno-lam-bh. Only works on LoongArch64. Added: clang/test/Driver/loongarch-mlam-bh.c llvm/test/CodeGen/LoongArch/ir-instruction/atomicrmw-lam-bh.ll Modified: clang/include/clang/Driver/Options.td clang/lib/Basic/Targets/LoongArch.cpp clang/lib/Basic/Targets/LoongArch.h clang/lib/Driver/ToolChains/Arch/LoongArch.cpp clang/test/Driver/loongarch-march.c clang/test/Preprocessor/init-loongarch.c llvm/include/llvm/TargetParser/LoongArchTargetParser.def llvm/include/llvm/TargetParser/LoongArchTargetParser.h llvm/lib/Target/LoongArch/LoongArch.td llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp llvm/lib/Target/LoongArch/LoongArchInstrInfo.td llvm/lib/TargetParser/LoongArchTargetParser.cpp Removed: diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index bec53cf93254ca..70f2fb6bdc4db9 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5394,6 +5394,10 @@ def mfrecipe : Flag<["-"], "mfrecipe">, Group, HelpText<"Enable frecipe.{s/d} and frsqrte.{s/d}">; def mno_frecipe : Flag<["-"], "mno-frecipe">, Group, HelpText<"Disable frecipe.{s/d} and frsqrte.{s/d}">; +def mlam_bh : Flag<["-"], "mlam-bh">, Group, + HelpText<"Enable amswap_[db].{b/h} and amadd_[db].{b/h}">; +def mno_lam_bh : Flag<["-"], "mno-lam-bh">, Group, + HelpText<"Disable amswap_[db].{b/h} and amadd_[db].{b/h}">; def mannotate_tablejump : Flag<["-"], "mannotate-tablejump">, Group, HelpText<"Enable annotate table jump instruction to correlate it with the jump table.">; def mno_annotate_tablejump : Flag<["-"], "mno-annotate-tablejump">, Group, diff --git a/clang/lib/Basic/Targets/LoongArch.cpp b/clang/lib/Basic/Targets/LoongArch.cpp index cb3fd12c48ddb6..07b22b35f603ce 100644 --- a/clang/lib/Basic/Targets/LoongArch.cpp +++ b/clang/lib/Basic/Targets/LoongArch.cpp @@ -205,7 +205,7 @@ void LoongArchTargetInfo::getTargetDefines(const LangOptions &Opts, // TODO: As more features of the V1.1 ISA are supported, a unified "v1.1" // arch feature set will be used to include all sub-features belonging to // the V1.1 ISA version. - if (HasFeatureFrecipe) + if (HasFeatureFrecipe && HasFeatureLAM_BH) Builder.defineMacro("__loongarch_arch", Twine('"') + "la64v1.1" + Twine('"')); else @@ -236,6 +236,9 @@ void LoongArchTargetInfo::getTargetDefines(const LangOptions &Opts, if (HasFeatureFrecipe) Builder.defineMacro("__loongarch_frecipe", Twine(1)); + if (HasFeatureLAM_BH) +Builder.defineMacro("__loongarch_lam_bh", Twine(1)); + StringRef ABI = getABI(); if (ABI == "lp64d" || ABI == "lp64f" || ABI == "lp64s") Builder.defineMacro("__loongarch_lp64"); @@ -312,6 +315,8 @@ bool LoongArchTargetInfo::handleTargetFeatures( HasUnalignedAccess = false; else if (Feature == "+frecipe") HasFeatureFrecipe = true; +else if (Feature == "+lam-bh") + HasFeatureLAM_BH = true; } return true; } diff --git a/clang/lib/Basic/Targets/LoongArch.h b/clang/lib/Basic/Targets/LoongArch.h index c668ca7eca047a..3585e9f7968b4b 100644 --- a/clang/lib/Basic/Targets/LoongArch.h +++ b/clang/lib/Basic/Targets/LoongArch.h @@ -30,6 +30,7 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo { bool HasFeatureLSX; bool HasFeatureLASX; bool HasFeatureFrecipe; + bool HasFeatureLAM_BH; public: LoongArchTargetInfo(const llvm::Triple &Triple, const TargetOptions &) @@ -39,6 +40,7 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo { HasFeatureLSX = false; HasFeatureLASX = false; HasFeatureFrecipe = false; +HasFeatureLAM_BH = false; LongDoubleWidth = 128; LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::IEEEquad(); diff --git a/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp b/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp index 355253e4b3b07c..e69a5562137ccd 100644 --- a/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp +++ b/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp @@ -260,6 +260,15 @@ void loongarch::getLoongArchTargetFeatures(const Driver &D, else Features.push_back("-frecipe"); } + + // Select lam-bh feature determined by -m[no-]lam-bh. + if (const Arg *A = + Args
[clang] [llvm] Ci plugin (PR #113290)
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/113290 >From df728276026481b7397d2008541bfaed572774a7 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Mon, 21 Oct 2024 12:34:17 + Subject: [PATCH 01/12] [ci] Write test results to unique file names In this patch I'm using a new lit option so that the pipeline writes many results files, one for each time lit is run: ``` --use-unique-output-file-name When enabled, lit will add a unique element to the output file name, before the extension. For example "results.xml" will become "results..xml". The "" is not ordered in any way and is chosen so that existing files are not overwritten. [Default: Off] ``` (I added this to lit recently) Now if I run the Linux build: $ bash ./.ci/monolithic-linux.sh "clang;lldb;lld" "check-lldb-shell check-lld" "libcxx;libcxxabi" "check-libcxx check-libcxxabi" I get multiple test result files. In my case some tests fail so runtimes aren't checked, but all projects are so there is 1 file for lldb and one for lld: $ ls build/*.xml build/test-results.klc82utf.xml build/test-results.majylh73.xml This change just collects the XML files as artifacts. Once I know that's working, I can setup a test reporting plugin to build a summary from them. --- .ci/generate-buildkite-pipeline-premerge | 4 ++-- .ci/monolithic-linux.sh | 13 + .ci/monolithic-windows.sh| 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 7676ff716c4185..e52133751f09b1 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -272,7 +272,7 @@ if [[ "${linux_projects}" != "" ]]; then artifact_paths: - 'artifacts/**/*' - '*_result.json' - - 'build/test-results.xml' + - 'build/test-results*.xml' agents: ${LINUX_AGENTS} retry: automatic: @@ -295,7 +295,7 @@ if [[ "${windows_projects}" != "" ]]; then artifact_paths: - 'artifacts/**/*' - '*_result.json' - - 'build/test-results.xml' + - 'build/test-results*.xml' agents: ${WINDOWS_AGENTS} retry: automatic: diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index b78dc59432b65c..17ea51c08fafd3 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -37,6 +37,8 @@ trap show-stats EXIT projects="${1}" targets="${2}" +lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" + echo "--- cmake" pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt @@ -47,7 +49,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_ASSERTIONS=ON \ -D LLVM_BUILD_EXAMPLES=ON \ -D COMPILER_RT_BUILD_LIBFUZZER=OFF \ - -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \ + -D LLVM_LIT_ARGS="${lit_args}" \ -D LLVM_ENABLE_LLD=ON \ -D CMAKE_CXX_FLAGS=-gmlt \ -D LLVM_CCACHE_BUILD=ON \ @@ -87,7 +89,8 @@ if [[ "${runtimes}" != "" ]]; then -D CMAKE_BUILD_TYPE=RelWithDebInfo \ -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -D LIBCXX_TEST_PARAMS="std=c++03" \ - -D LIBCXXABI_TEST_PARAMS="std=c++03" + -D LIBCXXABI_TEST_PARAMS="std=c++03" \ + -D LLVM_LIT_ARGS="${lit_args}" echo "--- ninja runtimes C++03" @@ -104,7 +107,8 @@ if [[ "${runtimes}" != "" ]]; then -D CMAKE_BUILD_TYPE=RelWithDebInfo \ -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -D LIBCXX_TEST_PARAMS="std=c++26" \ - -D LIBCXXABI_TEST_PARAMS="std=c++26" + -D LIBCXXABI_TEST_PARAMS="std=c++26" \ + -D LLVM_LIT_ARGS="${lit_args}" echo "--- ninja runtimes C++26" @@ -121,7 +125,8 @@ if [[ "${runtimes}" != "" ]]; then -D CMAKE_BUILD_TYPE=RelWithDebInfo \ -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -D LIBCXX_TEST_PARAMS="enable_modules=clang" \ - -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" + -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \ + -D LLVM_LIT_ARGS="${lit_args}" echo "--- ninja runtimes clang modules" diff --git a/.ci/monolithic-windows.sh b/.ci/monolithic-windows.sh index 91e719c52d4363..9ec44c22442d06 100755 --- a/.ci/monolithic-windows.sh +++ b/.ci/monolithic-windows.sh @@ -53,7 +53,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_ASSERTIONS=ON \ -D LLVM_BUILD_EXAMPLES=ON \ -D COMPILER_RT_BUILD_LIBFUZZER=OFF \ - -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \ + -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" \ -D COMPILER_RT_BUILD_ORC=OFF \ -D CMAKE_C_COMPILER_LAUNCHER=sccache \ -D CM
[clang] [analyzer] Use dynamic type when invalidating by a member function call (PR #111138)
steakhal wrote: Ping https://github.com/llvm/llvm-project/pull/38 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Ci plugin (PR #113290)
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/113290 >From df728276026481b7397d2008541bfaed572774a7 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Mon, 21 Oct 2024 12:34:17 + Subject: [PATCH 01/13] [ci] Write test results to unique file names In this patch I'm using a new lit option so that the pipeline writes many results files, one for each time lit is run: ``` --use-unique-output-file-name When enabled, lit will add a unique element to the output file name, before the extension. For example "results.xml" will become "results..xml". The "" is not ordered in any way and is chosen so that existing files are not overwritten. [Default: Off] ``` (I added this to lit recently) Now if I run the Linux build: $ bash ./.ci/monolithic-linux.sh "clang;lldb;lld" "check-lldb-shell check-lld" "libcxx;libcxxabi" "check-libcxx check-libcxxabi" I get multiple test result files. In my case some tests fail so runtimes aren't checked, but all projects are so there is 1 file for lldb and one for lld: $ ls build/*.xml build/test-results.klc82utf.xml build/test-results.majylh73.xml This change just collects the XML files as artifacts. Once I know that's working, I can setup a test reporting plugin to build a summary from them. --- .ci/generate-buildkite-pipeline-premerge | 4 ++-- .ci/monolithic-linux.sh | 13 + .ci/monolithic-windows.sh| 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 7676ff716c4185..e52133751f09b1 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -272,7 +272,7 @@ if [[ "${linux_projects}" != "" ]]; then artifact_paths: - 'artifacts/**/*' - '*_result.json' - - 'build/test-results.xml' + - 'build/test-results*.xml' agents: ${LINUX_AGENTS} retry: automatic: @@ -295,7 +295,7 @@ if [[ "${windows_projects}" != "" ]]; then artifact_paths: - 'artifacts/**/*' - '*_result.json' - - 'build/test-results.xml' + - 'build/test-results*.xml' agents: ${WINDOWS_AGENTS} retry: automatic: diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index b78dc59432b65c..17ea51c08fafd3 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -37,6 +37,8 @@ trap show-stats EXIT projects="${1}" targets="${2}" +lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" + echo "--- cmake" pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt @@ -47,7 +49,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_ASSERTIONS=ON \ -D LLVM_BUILD_EXAMPLES=ON \ -D COMPILER_RT_BUILD_LIBFUZZER=OFF \ - -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \ + -D LLVM_LIT_ARGS="${lit_args}" \ -D LLVM_ENABLE_LLD=ON \ -D CMAKE_CXX_FLAGS=-gmlt \ -D LLVM_CCACHE_BUILD=ON \ @@ -87,7 +89,8 @@ if [[ "${runtimes}" != "" ]]; then -D CMAKE_BUILD_TYPE=RelWithDebInfo \ -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -D LIBCXX_TEST_PARAMS="std=c++03" \ - -D LIBCXXABI_TEST_PARAMS="std=c++03" + -D LIBCXXABI_TEST_PARAMS="std=c++03" \ + -D LLVM_LIT_ARGS="${lit_args}" echo "--- ninja runtimes C++03" @@ -104,7 +107,8 @@ if [[ "${runtimes}" != "" ]]; then -D CMAKE_BUILD_TYPE=RelWithDebInfo \ -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -D LIBCXX_TEST_PARAMS="std=c++26" \ - -D LIBCXXABI_TEST_PARAMS="std=c++26" + -D LIBCXXABI_TEST_PARAMS="std=c++26" \ + -D LLVM_LIT_ARGS="${lit_args}" echo "--- ninja runtimes C++26" @@ -121,7 +125,8 @@ if [[ "${runtimes}" != "" ]]; then -D CMAKE_BUILD_TYPE=RelWithDebInfo \ -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -D LIBCXX_TEST_PARAMS="enable_modules=clang" \ - -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" + -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \ + -D LLVM_LIT_ARGS="${lit_args}" echo "--- ninja runtimes clang modules" diff --git a/.ci/monolithic-windows.sh b/.ci/monolithic-windows.sh index 91e719c52d4363..9ec44c22442d06 100755 --- a/.ci/monolithic-windows.sh +++ b/.ci/monolithic-windows.sh @@ -53,7 +53,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_ASSERTIONS=ON \ -D LLVM_BUILD_EXAMPLES=ON \ -D COMPILER_RT_BUILD_LIBFUZZER=OFF \ - -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \ + -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" \ -D COMPILER_RT_BUILD_ORC=OFF \ -D CMAKE_C_COMPILER_LAUNCHER=sccache \ -D CM
[clang] Fieldregion descript name (PR #112313)
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/112313 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fieldregion descript name (PR #112313)
https://github.com/steakhal approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/112313 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fieldregion descript name (PR #112313)
@@ -751,12 +758,20 @@ std::string MemRegion::getDescriptiveName(bool UseQuotes) const { } // Get variable name. - if (R && R->canPrintPrettyAsExpr()) { -R->printPrettyAsExpr(os); -if (UseQuotes) - return (llvm::Twine("'") + os.str() + ArrayIndices + "'").str(); -else - return (llvm::Twine(os.str()) + ArrayIndices).str(); + if (R) { +// MemRegion can be pretty printed. +if (R->canPrintPrettyAsExpr()) { + R->printPrettyAsExpr(os); + return QuoteIfNeeded(llvm::Twine(os.str()) + ArrayIndices); +} + +// FieldRegion may have ElementRegion as SuperRegion. +if (const auto *FR = R->getAs()) { steakhal wrote: ```suggestion if (const auto *FR = R->getAs()) { ``` https://github.com/llvm/llvm-project/pull/112313 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fieldregion descript name (PR #112313)
https://github.com/T-Gruber updated https://github.com/llvm/llvm-project/pull/112313 >From dd562bb3d505c43070ceb8af51359cc66860a0ea Mon Sep 17 00:00:00 2001 From: "tobias.gruber" Date: Tue, 15 Oct 2024 07:19:12 +0200 Subject: [PATCH 1/5] Handle FieldRegions with ElementRegions as SuperRegions in getDescriptiveName --- clang/lib/StaticAnalyzer/Core/MemRegion.cpp | 25 +++ .../MemRegionDescriptiveNameTest.cpp | 14 +++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp index 693791c3aee8b9..4144cff8607926 100644 --- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -751,12 +751,27 @@ std::string MemRegion::getDescriptiveName(bool UseQuotes) const { } // Get variable name. - if (R && R->canPrintPrettyAsExpr()) { -R->printPrettyAsExpr(os); -if (UseQuotes) - return (llvm::Twine("'") + os.str() + ArrayIndices + "'").str(); -else + if (R) { +// MemRegion can be pretty printed. +if (R->canPrintPrettyAsExpr()) { + R->printPrettyAsExpr(os); + if (UseQuotes) +return (llvm::Twine("'") + os.str() + ArrayIndices + "'").str(); return (llvm::Twine(os.str()) + ArrayIndices).str(); +} + +// FieldRegion may have ElementRegion as SuperRegion. +if (const clang::ento::FieldRegion *FR = +R->getAs()) { + std::string Super = FR->getSuperRegion()->getDescriptiveName(false); + if (Super.empty()) +return ""; + + if (UseQuotes) +return (llvm::Twine("'") + Super + "." + FR->getDecl()->getName() + "'") +.str(); + return (llvm::Twine(Super) + "." + FR->getDecl()->getName()).str(); +} } return VariableName; diff --git a/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp b/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp index b13e7123ee524d..fe5defd1d47915 100644 --- a/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp +++ b/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp @@ -143,4 +143,18 @@ void top() { EXPECT_EQ(Output, "DescriptiveNameChecker: array[x]\n"); } +TEST(MemRegionDescriptiveNameTest, FieldRegWithSuperElementReg) { + StringRef Code = R"cpp( +void reportDescriptiveName(int *p); +struct val_struct { int val; }; +extern struct val_struct val_struct_array[3]; +void top() { + reportDescriptiveName(&val_struct_array[0].val); +})cpp"; + + std::string Output; + ASSERT_TRUE(runChecker(Code, Output)); + EXPECT_EQ(Output, "DescriptiveNameChecker: val_struct_array[0].val\n"); +} + } // namespace >From d8837ca3427e04d0d8a070ddce93da1485f2835f Mon Sep 17 00:00:00 2001 From: "tobias.gruber" Date: Tue, 15 Oct 2024 07:20:21 +0200 Subject: [PATCH 2/5] Remove unneeded include --- clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp b/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp index fe5defd1d47915..966e5c0e9a6124 100644 --- a/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp +++ b/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp @@ -12,7 +12,6 @@ #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" #include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h" #include "gtest/gtest.h" -#include using namespace clang; using namespace ento; >From b2b269fbc479751dafa5aa85a58a0a6756f442bf Mon Sep 17 00:00:00 2001 From: "tobias.gruber" Date: Tue, 15 Oct 2024 12:37:46 +0200 Subject: [PATCH 3/5] Include test case with multi-dim array --- .../MemRegionDescriptiveNameTest.cpp | 14 ++ 1 file changed, 14 insertions(+) diff --git a/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp b/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp index 966e5c0e9a6124..0f6e49bf42f4ac 100644 --- a/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp +++ b/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp @@ -156,4 +156,18 @@ void top() { EXPECT_EQ(Output, "DescriptiveNameChecker: val_struct_array[0].val\n"); } +TEST(MemRegionDescriptiveNameTest, FieldRegWithSuperMultidimElementReg) { + StringRef Code = R"cpp( +void reportDescriptiveName(int *p); +struct val_struct { int val; }; +extern struct val_struct val_struct_array[3][4]; +void top() { + reportDescriptiveName(&val_struct_array[1][2].val); +})cpp"; + + std::string Output; + ASSERT_TRUE(runChecker(Code, Output)); + EXPECT_EQ(Output, "DescriptiveNameChecker: val_struct_array[1][2].val\n"); +} + } // namespace >From 565de601620ee7dfe7156302f4169e6d46588a5d Mon Sep 17 00:00:00 2001 From: "tobias.gruber" Date: Tue, 15 Oct 2024 13:53:18 +0200 Subject: [PATCH 4/5] Function to enclose in quotes if needed --- clang/lib/Stati
[clang] [analyzer][StackAddressEscape] Remove redundant "returned to caller" suffix for compound literal (PR #112135)
z1nke wrote: @steakhal @NagyDonat Could you please review this PR? Thank you! https://github.com/llvm/llvm-project/pull/112135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-format] Fix working -assume-filename with .clang-format-ignore (PR #113100)
mydeveloperday wrote: > > Also, the main purpose of -assume-filename is to set the language for input > > from stdin, and IMO the pseudo filename should not be filtered out by any > > .clang-format-ignore file. > > It is also worth noting that if the `-style=file` option is specified, it > will look for `.clang-format`/`_clang-format` file in the same or parent > directory based on the pathname specified by the `-assume-filename` option. > > Since the specification is such for `.clang-format`/`_clang-format` file, > users would naturally expect the same behavior for `.clang-format-ignore` > file, wouldn't they? I'm a little confused.. So it seems you are saying... that an IDE that is using clang-format, formats the contents of the editor using stdin to clang-format, sort of like ``` echo "editor_buffer" | clang-format ``` and because it knows editor_buffer came from c:/project/myproject/src/lib/myfile.cxx its passing ``` echo "editor_buffer" | clang-format --assume-filename c:/project/myproject/src/lib/myfile.cxx ``` I presume in both case the IDE reads the output and puts it back in the editor rather than writing it to the file incase the user isn't ready to save just yet. which means if you are running with --stage=file its using that assume-filename to get the directory of that assume-file and then look up that tree for a .clang-format ``` echo "buffer" | clang-format --style=file --assume-filename c:/project/myproject/src/lib/myfile.cxx ``` However what you are saying is, its not using that assume-filename to locate the .clang-format-ignore file? which if it had might have seen that myfile.* should have been ignored. Hence in the IDE it reformats myfile.* meaning you can't save it unformatted Did I understand that correctly? (its likely exactly what you said...) https://github.com/llvm/llvm-project/pull/113100 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [flang][OpenMP] Support `target enter|update|exit .. nowait` (PR #113305)
ergawy wrote: Looks like this broke some buildbots. Looking into the reported failures ... 👀 https://github.com/llvm/llvm-project/pull/113305 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Make -fveclib={ArmPL, SLEEF} imply -fno-math-errno (PR #112580)
https://github.com/MacDue updated https://github.com/llvm/llvm-project/pull/112580 >From ce7cac7c2fcc672abfd8ab2a49b59a73994bee64 Mon Sep 17 00:00:00 2001 From: Benjamin Maxwell Date: Wed, 2 Oct 2024 10:28:29 + Subject: [PATCH 1/7] [clang] Make -fveclib={ArmPL,SLEEF} imply -fno-math-errno These two veclibs are only available for AArch64 targets, and as mentioned in https://discourse.llvm.org/t/rfc-should-fveclib-imply-fno-math-errno-for-all-targets/81384, we (Arm) think that `-fveclib` should imply `-fno-math-errno`. By setting `-fveclib` the user shows they intend to use the vector math functions, which implies they don't care about errno. However, currently, the vector mappings won't be used in many cases without setting `-fno-math-errno` separately. Making this change would also help resolve some inconsistencies in how vector mappings are applied (see https://github.com/llvm/llvm-project/pull/108980#discussion_r176660). --- clang/include/clang/Driver/Options.td | 3 ++- clang/lib/Driver/ToolChains/Clang.cpp | 8 clang/test/Driver/fveclib.c | 7 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 70f2fb6bdc4db9..452746bbd66a00 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -3410,7 +3410,8 @@ def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group; def fveclib : Joined<["-"], "fveclib=">, Group, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>, -HelpText<"Use the given vector functions library">, +HelpText<"Use the given vector functions library." + "Note: -fveclib={ArmPL,SLEEF} implies -fno-math-errno">, Values<"Accelerate,libmvec,MASSV,SVML,SLEEF,Darwin_libsystem_m,ArmPL,AMDLIBM,none">, NormalizedValuesScope<"llvm::driver::VectorLibrary">, NormalizedValues<["Accelerate", "LIBMVEC", "MASSV", "SVML", "SLEEF", diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index d032fd7a59f330..f8527035b7ae24 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -2854,6 +2854,10 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, bool OFastEnabled, const ArgList &Args, ArgStringList &CmdArgs, const JobAction &JA) { + // List of veclibs which when used with -fveclib imply -fno-math-errno. + constexpr std::array VecLibImpliesNoMathErrno{llvm::StringLiteral("ArmPL"), +llvm::StringLiteral("SLEEF")}; + // Handle various floating point optimization flags, mapping them to the // appropriate LLVM code generation flags. This is complicated by several // "umbrella" flags, so we do this by stepping through the flags incrementally @@ -3125,6 +3129,10 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, TrappingMathPresent = true; FPExceptionBehavior = "strict"; break; +case options::OPT_fveclib: + if (llvm::is_contained(VecLibImpliesNoMathErrno, A->getValue())) +MathErrno = false; + break; case options::OPT_fno_trapping_math: if (!TrappingMathPresent && !FPExceptionBehavior.empty() && FPExceptionBehavior != "ignore") diff --git a/clang/test/Driver/fveclib.c b/clang/test/Driver/fveclib.c index 9b0f1ce13aa2bd..2a3133541e3b72 100644 --- a/clang/test/Driver/fveclib.c +++ b/clang/test/Driver/fveclib.c @@ -36,16 +36,23 @@ /* Verify that the correct vector library is passed to LTO flags. */ // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=LIBMVEC -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-LIBMVEC %s +// CHECK-LTO-LIBMVEC: "-fmath-errno" // CHECK-LTO-LIBMVEC: "-plugin-opt=-vector-library=LIBMVEC-X86" // RUN: %clang -### --target=powerpc64-unknown-linux-gnu -fveclib=MASSV -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-MASSV %s +// CHECK-LTO-MASSV: "-fmath-errno" // CHECK-LTO-MASSV: "-plugin-opt=-vector-library=MASSV" // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=SVML -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-SVML %s +// CHECK-LTO-SVML: "-fmath-errno" // CHECK-LTO-SVML: "-plugin-opt=-vector-library=SVML" // RUN: %clang -### --target=aarch64-linux-gnu -fveclib=SLEEF -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-SLEEF %s +// CHECK-LTO-SLEEF-NOT: "-fmath-errno" // CHECK-LTO-SLEEF: "-plugin-opt=-vector-library=sleefgnuabi" +// CHECK-LTO-SLEEF-NOT: "-fmath-errno" // RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-ARMPL %s +// CHECK-LTO-ARMPL-NOT: "-fmath-errno" // CHECK-LTO-ARMPL: "-plugin-opt=-vector-library=ArmPL" +// CHECK-LTO-ARMPL-NOT: "-fmath-errno" >From c30fe
[clang] [clang-format] Fix working -assume-filename with .clang-format-ignore (PR #113100)
https://github.com/mydeveloperday approved this pull request. I think this makes sense now, please wait for @owenca and @HazardyKnusperkeks opinion https://github.com/llvm/llvm-project/pull/113100 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 684c26c - [analyzer] Remove redundant "returned to caller" suffix for compound literal in StackAddressEscape
Author: z1nke Date: 2024-10-23T10:46:36+02:00 New Revision: 684c26c89b8994fc31d1c4be0cf70d6cc6f2b7ca URL: https://github.com/llvm/llvm-project/commit/684c26c89b8994fc31d1c4be0cf70d6cc6f2b7ca DIFF: https://github.com/llvm/llvm-project/commit/684c26c89b8994fc31d1c4be0cf70d6cc6f2b7ca.diff LOG: [analyzer] Remove redundant "returned to caller" suffix for compound literal in StackAddressEscape This patch simplifies the diagnostic message in the core.StackAddrEscape for stack memory associated with compound literals by removing the redundant "returned to caller" suffix. Example: https://godbolt.org/z/KxM67vr7c ```c // clang --analyze -Xanalyzer -analyzer-checker=core.StackAddressEscape void* compound_literal() { return &(unsigned short){((unsigned short)0x22EF)}; } ``` warning: Address of stack memory associated with a compound literal declared on line 2 **returned to caller returned to caller** [core.StackAddressEscape] Added: Modified: clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp clang/test/Analysis/stack-addr-ps.c Removed: diff --git a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp index a76639bb86b208..f4de3b500499c4 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp @@ -78,7 +78,7 @@ SourceRange StackAddrEscapeChecker::genName(raw_ostream &os, const MemRegion *R, const CompoundLiteralExpr *CL = CR->getLiteralExpr(); os << "stack memory associated with a compound literal " "declared on line " - << SM.getExpansionLineNumber(CL->getBeginLoc()) << " returned to caller"; + << SM.getExpansionLineNumber(CL->getBeginLoc()); range = CL->getSourceRange(); } else if (const auto *AR = dyn_cast(R)) { const Expr *ARE = AR->getExpr(); diff --git a/clang/test/Analysis/stack-addr-ps.c b/clang/test/Analysis/stack-addr-ps.c index 7d7294455f1dbe..1adcb8c48d035d 100644 --- a/clang/test/Analysis/stack-addr-ps.c +++ b/clang/test/Analysis/stack-addr-ps.c @@ -20,17 +20,21 @@ int* f3(int x, int *y) { void* compound_literal(int x, int y) { if (x) -return &(unsigned short){((unsigned short)0x22EF)}; // expected-warning{{Address of stack memory}} expected-warning{{address of stack memory}} +return &(unsigned short){((unsigned short)0x22EF)}; + // expected-warning-re@-1{{Address of stack memory associated with a compound literal declared on line {{[0-9]+}} returned to caller [core.StackAddressEscape]}} + // expected-warning@-2{{address of stack memory}} int* array[] = {}; struct s { int z; double y; int w; }; if (y) -return &((struct s){ 2, 0.4, 5 * 8 }); // expected-warning{{Address of stack memory}} expected-warning{{address of stack memory}} - +return &((struct s){ 2, 0.4, 5 * 8 }); + // expected-warning-re@-1{{Address of stack memory associated with a compound literal declared on line {{[0-9]+}} returned to caller [core.StackAddressEscape]}} + // expected-warning@-2{{address of stack memory}} void* p = &((struct s){ 42, 0.4, x ? 42 : 0 }); - return p; // expected-warning{{Address of stack memory}} + return p; + // expected-warning-re@-1{{Address of stack memory associated with a compound literal declared on line {{[0-9]+}} returned to caller [core.StackAddressEscape]}} } void* alloca_test(void) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [flang][OpenMP] Support `target enter|update|exit .. nowait` (PR #113305)
https://github.com/ergawy closed https://github.com/llvm/llvm-project/pull/113305 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] ac5a201 - [PS5][Driver] Pass default -z options to PS5 linker (#113162)
Author: Edd Dawson Date: 2024-10-23T10:14:06+01:00 New Revision: ac5a2010ad35a72de3e75a1883e2495345b92a73 URL: https://github.com/llvm/llvm-project/commit/ac5a2010ad35a72de3e75a1883e2495345b92a73 DIFF: https://github.com/llvm/llvm-project/commit/ac5a2010ad35a72de3e75a1883e2495345b92a73.diff LOG: [PS5][Driver] Pass default -z options to PS5 linker (#113162) Until now, these options have been hardcoded as downstream patches in LLD. Add them to the driver so that the private patches can be removed. PS5 only. The implementation of these behaviours will remain in the proprietary linker on PS4. SIE tracker: TOOLCHAIN-16704 Added: Modified: clang/lib/Driver/ToolChains/PS4CPU.cpp clang/test/Driver/ps5-linker.c Removed: diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp index 7c028f18c0308f..02b1e034c28789 100644 --- a/clang/lib/Driver/ToolChains/PS4CPU.cpp +++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp @@ -229,6 +229,8 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA, const Driver &D = TC.getDriver(); ArgStringList CmdArgs; + const bool Relocatable = Args.hasArg(options::OPT_r); + // Silence warning for "clang -g foo.o -o foo" Args.ClaimAllArgs(options::OPT_g_Group); // and "clang -emit-llvm foo.o -o foo" @@ -246,6 +248,28 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasFlag(options::OPT_pie, options::OPT_no_pie, PIE)) CmdArgs.push_back("-pie"); + if (!Relocatable) { +// Lazy binding of PLTs is not supported on PlayStation. They are placed in +// the RelRo segment. +CmdArgs.push_back("-z"); +CmdArgs.push_back("now"); + +// Don't export linker-generated __start/stop... section bookends. +CmdArgs.push_back("-z"); +CmdArgs.push_back("start-stop-visibility=hidden"); + +// Patch relocated regions of DWARF whose targets are eliminated at link +// time with specific tombstones, such that they're recognisable by the +// PlayStation debugger. +CmdArgs.push_back("-z"); +CmdArgs.push_back("dead-reloc-in-nonalloc=.debug_*=0x"); +CmdArgs.push_back("-z"); +CmdArgs.push_back( +"dead-reloc-in-nonalloc=.debug_ranges=0xfffe"); +CmdArgs.push_back("-z"); +CmdArgs.push_back("dead-reloc-in-nonalloc=.debug_loc=0xfffe"); + } + if (Args.hasArg(options::OPT_static)) CmdArgs.push_back("-static"); if (Args.hasArg(options::OPT_rdynamic)) diff --git a/clang/test/Driver/ps5-linker.c b/clang/test/Driver/ps5-linker.c index 4ae65963e361aa..d18309a650726d 100644 --- a/clang/test/Driver/ps5-linker.c +++ b/clang/test/Driver/ps5-linker.c @@ -14,6 +14,22 @@ // CHECK-NO-PIE-NOT: "-pie" // CHECK-SHARED: "--shared" +// Test the driver passes PlayStation-specific -z options to the linker. + +// RUN: %clang --target=x86_64-sie-ps5 %s -### 2>&1 | FileCheck --check-prefixes=CHECK-Z %s + +// CHECK-Z: {{ld(\.exe)?}}" +// CHECK-Z-SAME: "-z" "now" +// CHECK-Z-SAME: "-z" "start-stop-visibility=hidden" +// CHECK-Z-SAME: "-z" "dead-reloc-in-nonalloc=.debug_*=0x" +// CHECK-Z-SAME: "-z" "dead-reloc-in-nonalloc=.debug_ranges=0xfffe" +// CHECK-Z-SAME: "-z" "dead-reloc-in-nonalloc=.debug_loc=0xfffe" + +// RUN: %clang --target=x86_64-sie-ps5 -r %s -### 2>&1 | FileCheck --check-prefixes=CHECK-NO-Z %s + +// CHECK-NO-Z: {{ld(\.exe)?}}" +// CHECK-NO-Z-NOT: "-z" + // Test that -static is forwarded to the linker // RUN: %clang --target=x86_64-sie-ps5 -static %s -### 2>&1 | FileCheck --check-prefixes=CHECK-STATIC %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PS5][Driver] Pass default -z options to PS5 linker (PR #113162)
https://github.com/playstation-edd closed https://github.com/llvm/llvm-project/pull/113162 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Ci plugin (PR #113290)
DavidSpickett wrote: Abandoning this, as confirmed by https://discourse.llvm.org/t/using-plugins-in-buildkite-ci-that-require-docker/82701/3?u=davidspickett we cannot run docker on our Linux instances without a lot of hassle. Plus, the plugin authors do not want to support running without docker. I will start on a script to generate reports instead. https://github.com/llvm/llvm-project/pull/113290 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Update the lifetimebound example with up-to-date expected warning and change the sample code to be a fully working example (PR #113437)
https://github.com/bricknerb converted_to_draft https://github.com/llvm/llvm-project/pull/113437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CLANG][AArch64]Add Neon vectors for mfloat8_t (PR #99865)
https://github.com/paulwalker-arm approved this pull request. https://github.com/llvm/llvm-project/pull/99865 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Apply internal buffering to clang diagnostics printing (PR #113440)
https://github.com/Fznamznon created https://github.com/llvm/llvm-project/pull/113440 To stabilize output of clang when clang is run in multiple build threads, the whole diagnostic message is written first to internal buffer and then the whole message is put to the output stream which usually points to stderr which is unbuffered by default. This helps to avoid printing to stderr with small chunks and interleaving of multiple diagnostic messages. This is also fixing a slight regression that happened somewhere in clang-17. I checked clang-14 and its output is slightly more stable. In general the tool that is run in several threads can't control output interleaving so this change might be questionable. It is up to build's system/script/tool that is running clang to handle output interleaving. However, it seems for example Make doesn't prevent compiler's output interleaving in case of many threads and gcc's output is much more stable. I was using a makefile to build 6 files within 6 thread, each file contained a warning, clang's output was like (just an illustration, it is pretty random): https://github.com/user-attachments/assets/7664b43b-70fb-4668-a6c6-083ec2a7f081";> gcc's output using the same makefile: https://github.com/user-attachments/assets/374be96b-884e-4ad1-a911-a2c55302f407";> So I decided to give it a try since it could greatly improve user experience for some cases. It turned out simple and gave a relatively stable result. clang's output after the change: https://github.com/user-attachments/assets/a2abfd17-f10d-4cef-a2e1-48fb1dda47fc";> I'm not sure how to test this properly, so the PR doesn't contain any test. But please let me know what you think, I'm open to any suggestions. >From 10439ffa9e61240402190538f7a1e1665ca215c8 Mon Sep 17 00:00:00 2001 From: "Podchishchaeva, Mariya" Date: Wed, 23 Oct 2024 02:50:50 -0700 Subject: [PATCH] [clang] Apply internal buffering to clang diagnostics printing To stabilize output of clang when clang is run in multiple build threads the whole diagnostic message is written first to internal buffer and then the whole message is put to the output stream which usually points to stderr to avoid printing to stderr with small chunks and interleaving of multiple diagnostic messages. --- clang/include/clang/Frontend/TextDiagnostic.h | 12 +++- clang/lib/Frontend/TextDiagnostic.cpp | 16 +--- clang/lib/Frontend/TextDiagnosticPrinter.cpp | 10 +++--- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/clang/include/clang/Frontend/TextDiagnostic.h b/clang/include/clang/Frontend/TextDiagnostic.h index a2fe8ae995423b..e47a111c1dcdc2 100644 --- a/clang/include/clang/Frontend/TextDiagnostic.h +++ b/clang/include/clang/Frontend/TextDiagnostic.h @@ -16,6 +16,7 @@ #define LLVM_CLANG_FRONTEND_TEXTDIAGNOSTIC_H #include "clang/Frontend/DiagnosticRenderer.h" +#include "llvm/ADT/SmallString.h" #include "llvm/Support/raw_ostream.h" namespace clang { @@ -33,8 +34,15 @@ namespace clang { /// DiagnosticClient is implemented through this class as is diagnostic /// printing coming out of libclang. class TextDiagnostic : public DiagnosticRenderer { - raw_ostream &OS; + raw_ostream &Out; const Preprocessor *PP; + // To stabilize output of clang when clang is run in multiple build threads + // the whole diagnostic message is written first to internal buffer and then + // the whole message is put to the output stream Out which usually points to + // stderr to avoid printing to stderr with small chunks and interleaving of + // multiple diagnostic messages. + SmallString<1024> InternalBuffer; + llvm::raw_svector_ostream OS; public: TextDiagnostic(raw_ostream &OS, const LangOptions &LangOpts, @@ -104,6 +112,8 @@ class TextDiagnostic : public DiagnosticRenderer { void emitBuildingModuleLocation(FullSourceLoc Loc, PresumedLoc PLoc, StringRef ModuleName) override; + void endDiagnostic(DiagOrStoredDiag D, + DiagnosticsEngine::Level Level) override; private: void emitFilename(StringRef Filename, const SourceManager &SM); diff --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp index 4119ce6048d45d..fddb846745aa83 100644 --- a/clang/lib/Frontend/TextDiagnostic.cpp +++ b/clang/lib/Frontend/TextDiagnostic.cpp @@ -656,7 +656,11 @@ static bool printWordWrapped(raw_ostream &OS, StringRef Str, unsigned Columns, TextDiagnostic::TextDiagnostic(raw_ostream &OS, const LangOptions &LangOpts, DiagnosticOptions *DiagOpts, const Preprocessor *PP) -: DiagnosticRenderer(LangOpts, DiagOpts), OS(OS), PP(PP) {} +: DiagnosticRenderer(LangOpts, DiagOpts), Out(OS), PP(PP), + OS(InternalBuffer) { + this->OS.buffer().clear(); + this->OS.enable_colors(true); +} TextDiagnostic::~TextDiagnostic() {} @@ -664,7 +668,7 @@ void TextDiagnostic::emitD
[clang] [clang] Apply internal buffering to clang diagnostics printing (PR #113440)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Mariya Podchishchaeva (Fznamznon) Changes To stabilize output of clang when clang is run in multiple build threads, the whole diagnostic message is written first to internal buffer and then the whole message is put to the output stream which usually points to stderr which is unbuffered by default. This helps to avoid printing to stderr with small chunks and interleaving of multiple diagnostic messages. This is also fixing a slight regression that happened somewhere in clang-17. I checked clang-14 and its output is slightly more stable. In general the tool that is run in several threads can't control output interleaving so this change might be questionable. It is up to build's system/script/tool that is running clang to handle output interleaving. However, it seems for example Make doesn't prevent compiler's output interleaving in case of many threads and gcc's output is much more stable. I was using a makefile to build 6 files within 6 thread, each file contained a warning, clang's output was like (just an illustration, it is pretty random):; gcc's output using the same makefile:
; So I decided to give it a try since it could greatly improve user experience for some cases. It turned out simple and gave a relatively stable result. clang's output after the change:
; I'm not sure how to test this properly, so the PR doesn't contain any test. But please let me know what you think, I'm open to any suggestions. --- Full diff: https://github.com/llvm/llvm-project/pull/113440.diff 3 Files Affected: - (modified) clang/include/clang/Frontend/TextDiagnostic.h (+11-1) - (modified) clang/lib/Frontend/TextDiagnostic.cpp (+13-3) - (modified) clang/lib/Frontend/TextDiagnosticPrinter.cpp (+7-3) ``diff diff --git a/clang/include/clang/Frontend/TextDiagnostic.h b/clang/include/clang/Frontend/TextDiagnostic.h index a2fe8ae995423b..e47a111c1dcdc2 100644 --- a/clang/include/clang/Frontend/TextDiagnostic.h +++ b/clang/include/clang/Frontend/TextDiagnostic.h @@ -16,6 +16,7 @@ #define LLVM_CLANG_FRONTEND_TEXTDIAGNOSTIC_H #include "clang/Frontend/DiagnosticRenderer.h" +#include "llvm/ADT/SmallString.h" #include "llvm/Support/raw_ostream.h" namespace clang { @@ -33,8 +34,15 @@ namespace clang { /// DiagnosticClient is implemented through this class as is diagnostic /// printing coming out of libclang. class TextDiagnostic : public DiagnosticRenderer { - raw_ostream &OS; + raw_ostream &Out; const Preprocessor *PP; + // To stabilize output of clang when clang is run in multiple build threads + // the whole diagnostic message is written first to internal buffer and then + // the whole message is put to the output stream Out which usually points to + // stderr to avoid printing to stderr with small chunks and interleaving of + // multiple diagnostic messages. + SmallString<1024> InternalBuffer; + llvm::raw_svector_ostream OS; public: TextDiagnostic(raw_ostream &OS, const LangOptions &LangOpts, @@ -104,6 +112,8 @@ class TextDiagnostic : public DiagnosticRenderer { void emitBuildingModuleLocation(FullSourceLoc Loc, PresumedLoc PLoc, StringRef ModuleName) override; + void endDiagnostic(DiagOrStoredDiag D, + DiagnosticsEngine::Level Level) override; private: void emitFilename(StringRef Filename, const SourceManager &SM); diff --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp index 4119ce6048d45d..fddb846745aa83 100644 --- a/clang/lib/Frontend/TextDiagnostic.cpp +++ b/clang/lib/Frontend/TextDiagnostic.cpp @@ -656,7 +656,11 @@ static bool printWordWrapped(raw_ostream &OS, StringRef Str, unsigned Columns, TextDiagnostic::TextDiagnostic(raw_ostream &OS, const LangOptions &LangOpts, DiagnosticOptions *DiagOpts, const Preprocessor *PP) -: DiagnosticRenderer(LangOpts, DiagOpts), OS(OS), PP(PP) {} +: DiagnosticRenderer(LangOpts, DiagOpts), Out(OS), PP(PP), + OS(InternalBuffer) { + this->OS.buffer().clear(); + this->OS.enable_colors(true); +} TextDiagnostic::~TextDiagnostic() {} @@ -664,7 +668,7 @@ void TextDiagnostic::emitDiagnosticMessage( FullSourceLoc Loc, PresumedLoc PLoc, DiagnosticsEngine::Level Level, StringRef Message, ArrayRef Ranges, DiagOrStoredDiag D) { - uint64_t StartOfLocationInfo = OS.tell(); + uint64_t StartOfLocationInfo = Out.tell(); // Emit the location of this particular diagnostic. if (Loc.isValid()) @@ -677,7 +681,7 @
[clang] [Clang][AArch64] Fix Pure Scalables Types argument passing and return (PR #112747)
@@ -0,0 +1,338 @@ +// RUN: %clang_cc1 -O3 -triple aarch64 -target-feature +sve -target-feature +sve2p1 -mvscale-min=1 -mvscale-max=1 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-AAPCS +// RUN: %clang_cc1 -O3 -triple arm64-apple-ios7.0 -target-abi darwinpcs -target-feature +sve -target-feature +sve2p1 -mvscale-min=1 -mvscale-max=1 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-DARWIN +// RUN: %clang_cc1 -O3 -triple aarch64-linux-gnu -target-feature +sve -target-feature +sve2p1 -mvscale-min=1 -mvscale-max=1 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-AAPCS + +// REQUIRES: aarch64-registered-target + +#include + +typedef svfloat32_t fvec32 __attribute__((arm_sve_vector_bits(128))); +typedef svfloat64_t fvec64 __attribute__((arm_sve_vector_bits(128))); +typedef svbool_t bvec __attribute__((arm_sve_vector_bits(128))); +typedef svmfloat8_t mfvec8 __attribute__((arm_sve_vector_bits(128))); + +typedef struct { +float f[4]; +} HFA; + +// Pure Scalable Type, needs 4 Z-regs, 2 P-regs +typedef struct { + bvec a; + fvec64 x; + fvec32 y[2]; + mfvec8 z; + bvec b; +} PST; + +// Pure Scalable Type, 1 Z-reg +typedef struct { +fvec32 x; +} SmallPST; + +// Big PST, does not fit in registers. +typedef struct { +struct { +bvec a; +fvec32 x[4]; +} u[2]; +fvec64 v; +} BigPST; + +// A small aggregate type +typedef struct { +char data[16]; +} SmallAgg; + +// CHECK: %struct.PST = type { <2 x i8>, <2 x double>, [2 x <4 x float>], <16 x i8>, <2 x i8> } + +// Test argument passing of Pure Scalable Types by examining the generated +// LLVM IR function declarations. A PST argument in C/C++ should map to: +// a) an `ptr` argument, if passed indirectly through memory +// b) a series of scalable vector arguments, if passed via registers + +// Simple argument passing, PST expanded into registers. +// a-> p0 +// b-> p1 +// x-> q0 +// y[0] -> q1 +// y[1] -> q2 +// z-> q3 +void test_argpass_simple(PST *p) { +void argpass_simple_callee(PST); +argpass_simple_callee(*p); +} +// CHECK-AAPCS: define dso_local void @test_argpass_simple(ptr nocapture noundef readonly %p) +// CHECK-AAPCS-NEXT: entry: +// CHECK-AAPCS-NEXT: %0 = load <2 x i8>, ptr %p, align 16 +// CHECK-AAPCS-NEXT: %cast.scalable = tail call @llvm.vector.insert.nxv2i8.v2i8( undef, <2 x i8> %0, i64 0) +// CHECK-AAPCS-NEXT: %1 = bitcast %cast.scalable to +// CHECK-AAPCS-NEXT: %2 = getelementptr inbounds nuw i8, ptr %p, i64 16 +// CHECK-AAPCS-NEXT: %3 = load <2 x double>, ptr %2, align 16 +// CHECK-AAPCS-NEXT: %cast.scalable1 = tail call @llvm.vector.insert.nxv2f64.v2f64( undef, <2 x double> %3, i64 0) +// CHECK-AAPCS-NEXT: %4 = getelementptr inbounds nuw i8, ptr %p, i64 32 +// CHECK-AAPCS-NEXT: %5 = load <4 x float>, ptr %4, align 16 +// CHECK-AAPCS-NEXT: %cast.scalable2 = tail call @llvm.vector.insert.nxv4f32.v4f32( undef, <4 x float> %5, i64 0) +// CHECK-AAPCS-NEXT: %6 = getelementptr inbounds nuw i8, ptr %p, i64 48 +// CHECK-AAPCS-NEXT: %7 = load <4 x float>, ptr %6, align 16 +// CHECK-AAPCS-NEXT: %cast.scalable3 = tail call @llvm.vector.insert.nxv4f32.v4f32( undef, <4 x float> %7, i64 0) +// CHECK-AAPCS-NEXT: %8 = getelementptr inbounds nuw i8, ptr %p, i64 64 +// CHECK-AAPCS-NEXT: %9 = load <16 x i8>, ptr %8, align 16 +// CHECK-AAPCS-NEXT: %cast.scalable4 = tail call @llvm.vector.insert.nxv16i8.v16i8( undef, <16 x i8> %9, i64 0) +// CHECK-AAPCS-NEXT: %10 = getelementptr inbounds nuw i8, ptr %p, i64 80 +// CHECK-AAPCS-NEXT: %11 = load <2 x i8>, ptr %10, align 16 +// CHECK-AAPCS-NEXT: %cast.scalable5 = tail call @llvm.vector.insert.nxv2i8.v2i8( undef, <2 x i8> %11, i64 0) +// CHECK-AAPCS-NEXT: %12 = bitcast %cast.scalable5 to +// CHECK-AAPCS-NEXT: tail call void @argpass_simple_callee( %1, %cast.scalable1, %cast.scalable2, %cast.scalable3, %cast.scalable4, %12) +// CHECK-AAPCS-NEXT: ret void + +// CHECK-AAPCS: declare void @argpass_simple_callee(, , , , , ) +// CHECK-DARWIN: declare void @argpass_simple_callee(ptr noundef) + +// Boundary case of using the last available Z-reg, PST expanded. +// 0.0 -> d0-d3 +// a-> p0 +// b-> p1 +// x-> q4 +// y[0] -> q5 +// y[1] -> q6 +// z-> q7 +void test_argpass_last_z(PST *p) { +void argpass_last_z_callee(double, double, double, double, PST); +argpass_last_z_callee(.0, .0, .0, .0, *p); +} +// CHECK-AAPCS: declare void @argpass_last_z_callee(double noundef, double noundef, double noundef, double noundef, , , , , , ) +// CHECK-DARWIN: declare void @argpass_last_z_callee(double noundef, double noundef, double noundef, double noundef, ptr noundef) + + +// Like the above, but using a tuple type to occupy some registers. +// x-> z0.d-z3.d +// a-> p0 +// b-> p1 +// x-> q4 +// y[0] -> q5 +// y[1] -> q6 +// z-> q7 +v
[clang] [analyzer] Use dynamic type when invalidating by a member function call (PR #111138)
https://github.com/Xazax-hun approved this pull request. Looks good to me, some minor nits inline. https://github.com/llvm/llvm-project/pull/38 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] Use dynamic type when invalidating by a member function call (PR #111138)
@@ -797,6 +798,10 @@ RuntimeDefinition CXXInstanceCall::getRuntimeDefinition() const { return {}; } + const MemRegion *R = getCXXThisVal().getAsRegion(); + DynamicTypeInfo DynType = getDynamicTypeInfo(getState(), R); Xazax-hun wrote: My understanding is that we do this lookup twice now and we only need the result of `DynType.canBeASubClass()`. I wonder if it would make sense for ` getDeclForDynamicType()` to return a pair, the pointer to a declaration and a bool if the dynamic type could be a subclass to avoid the extra lookup. Other clients of that API might also want to know how precise is the dynamic type. https://github.com/llvm/llvm-project/pull/38 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] Use dynamic type when invalidating by a member function call (PR #111138)
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/38 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] Use dynamic type when invalidating by a member function call (PR #111138)
@@ -748,6 +747,22 @@ SVal CXXInstanceCall::getCXXThisVal() const { return ThisVal; } +const CXXRecordDecl *CXXInstanceCall::getDeclForDynamicType() const { + const MemRegion *R = getCXXThisVal().getAsRegion(); + if (!R) +return nullptr; + + DynamicTypeInfo DynType = getDynamicTypeInfo(getState(), R); + if (!DynType.isValid()) +return nullptr; + + QualType Ty = DynType.getType()->getPointeeType(); + if (Ty.isNull()) Xazax-hun wrote: Previously we had an assertion here. Is this invariant of "DynamicTypeInfo" is not always a pointer not actually true? https://github.com/llvm/llvm-project/pull/38 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Update the lifetimebound example with up-to-date expected warning and change the sample code to be a fully working example (PR #113437)
https://github.com/bricknerb created https://github.com/llvm/llvm-project/pull/113437 None >From cdef16a4e359acb7bea578dfab5e44589f8b6e2b Mon Sep 17 00:00:00 2001 From: Boaz Brickner Date: Wed, 23 Oct 2024 11:44:45 +0200 Subject: [PATCH] [clang] Update the lifetimebound example with up-to-date expected warning and change the sample code to be a fully working example. --- clang/include/clang/Basic/AttrDocs.td | 28 +++ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index ee8126cadae232..c2552d459cb474 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -3702,20 +3702,32 @@ user-declared functions. For example: .. code-block:: c++ +#include +#include + +using namespace std::literals; + // Returns m[key] if key is present, or default_value if not. template const U &get_or_default(const std::map &m [[clang::lifetimebound]], const T &key, /* note, not lifetimebound */ -const U &default_value [[clang::lifetimebound]]); +const U &default_value [[clang::lifetimebound]]) { + if (auto iter = m.find(key); iter != m.end()) return iter->second; + else return default_value; +} -std::map m; -// warning: temporary "bar"s that might be bound to local reference 'val' -// will be destroyed at the end of the full-expression -const std::string &val = get_or_default(m, "foo"s, "bar"s); +int main() { + std::map m; + // warning: temporary bound to local reference 'val1' will be destroyed + // at the end of the full-expression + const std::string &val1 = get_or_default(m, "foo"s, "bar"s); -// No warning in this case. -std::string def_val = "bar"s; -const std::string &val = get_or_default(m, "foo"s, def_val); + // No warning in this case. + std::string def_val = "bar"s; + const std::string &val2 = get_or_default(m, "foo"s, def_val); + + return 0; +} The attribute can be applied to the implicit ``this`` parameter of a member function by writing the attribute after the function type: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Update the lifetimebound example with up-to-date expected warning and change the sample code to be a fully working example (PR #113437)
https://github.com/bricknerb edited https://github.com/llvm/llvm-project/pull/113437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [llvm] [clang] Introduce diagnostics suppression mappings (PR #112517)
kadircet wrote: gentle ping @AaronBallman, I believe you were supportive of this approach in final version of [RFC](https://discourse.llvm.org/t/rfc-add-support-for-controlling-diagnostics-severities-at-file-level-granularity-through-command-line/81292/12?u=kadircet) but I'd like to make sure this agreement was implemented in an accurate manner. So it'd be great if you can check the overall interaction in https://github.com/llvm/llvm-project/blob/61b963131975ca3f6536b38427e25024f8759c57/clang/test/Misc/warning-suppression-mappings.cpp and https://github.com/llvm/llvm-project/blob/61b963131975ca3f6536b38427e25024f8759c57/clang/test/Misc/Inputs/suppression-mapping.txt. If those look good, I am happy to settle on the details of the implementation with other reviewers. https://github.com/llvm/llvm-project/pull/112517 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Update the lifetimebound example with up-to-date expected warning and change the sample code to be a fully working example (PR #113437)
https://github.com/bricknerb edited https://github.com/llvm/llvm-project/pull/113437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)
vabridgers wrote: Thanks for the review comments. I believe I've resolved all review comments to date, including a small increase in scope for the original change (this check detects a few cases not detectable by the original CSA based check), and am ready for another round of review. @5chmidti , would you mind having a look? I'm happy to document future changes beyond this check, but would like to keep this PR's scope limited to just porting the original CSA based check to a tidy check as much as possible. Also, I've not yet completed a full systems test on a large open source project (like a clang build), but will do so after I get some indications this PR is good to proceed with that. I'd like to minimize re-testing if possible since it is not a small task. Thank you https://github.com/llvm/llvm-project/pull/110471 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Update the lifetimebound example with up-to-date expected warning and change the sample code to be a fully working example (PR #113437)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Boaz Brickner (bricknerb) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/113437.diff 1 Files Affected: - (modified) clang/include/clang/Basic/AttrDocs.td (+20-8) ``diff diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index ee8126cadae232..c2552d459cb474 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -3702,20 +3702,32 @@ user-declared functions. For example: .. code-block:: c++ +#include +#include + +using namespace std::literals; + // Returns m[key] if key is present, or default_value if not. template const U &get_or_default(const std::map &m [[clang::lifetimebound]], const T &key, /* note, not lifetimebound */ -const U &default_value [[clang::lifetimebound]]); +const U &default_value [[clang::lifetimebound]]) { + if (auto iter = m.find(key); iter != m.end()) return iter->second; + else return default_value; +} -std::map m; -// warning: temporary "bar"s that might be bound to local reference 'val' -// will be destroyed at the end of the full-expression -const std::string &val = get_or_default(m, "foo"s, "bar"s); +int main() { + std::map m; + // warning: temporary bound to local reference 'val1' will be destroyed + // at the end of the full-expression + const std::string &val1 = get_or_default(m, "foo"s, "bar"s); -// No warning in this case. -std::string def_val = "bar"s; -const std::string &val = get_or_default(m, "foo"s, def_val); + // No warning in this case. + std::string def_val = "bar"s; + const std::string &val2 = get_or_default(m, "foo"s, def_val); + + return 0; +} The attribute can be applied to the implicit ``this`` parameter of a member function by writing the attribute after the function type: `` https://github.com/llvm/llvm-project/pull/113437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Ci plugin (PR #113290)
https://github.com/DavidSpickett closed https://github.com/llvm/llvm-project/pull/113290 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)
https://github.com/vabridgers updated https://github.com/llvm/llvm-project/pull/110471 >From 75b49cae07d457a941655b65c961cb0a27995dc1 Mon Sep 17 00:00:00 2001 From: Vince Bridgers Date: Thu, 26 Sep 2024 16:24:59 +0200 Subject: [PATCH] [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy This change moves the alpha.nondeterministic.PointerSorting and alpha.nondeterministic.PointerIteration static analyzer checkers to a single clang-tidy check. Those checkers were implemented as clang-tidy checks wrapped in the static analyzer framework. The documentation was updated to describe what the checks can and cannot do, and testing was completed on a broad set of open source projects. --- .../bugprone/BugproneTidyModule.cpp | 3 + .../clang-tidy/bugprone/CMakeLists.txt| 1 + ...eterministicPointerIterationOrderCheck.cpp | 85 ++ ...ndeterministicPointerIterationOrderCheck.h | 37 + clang-tools-extra/docs/ReleaseNotes.rst | 6 + ...ndeterministic-pointer-iteration-order.rst | 35 .../system-header-simulator/sim_algorithm | 31 .../system-header-simulator/sim_c++config.h | 11 ++ .../sim_initializer_list | 39 + .../system-header-simulator/sim_iterator_base | 22 +++ .../Inputs/system-header-simulator/sim_map| 34 .../Inputs/system-header-simulator/sim_set| 44 + .../system-header-simulator/sim_stl_pair | 32 .../system-header-simulator/sim_type_traits | 19 +++ .../system-header-simulator/sim_unordered_map | 33 .../system-header-simulator/sim_unordered_set | 35 .../Inputs/system-header-simulator/sim_vector | 150 ++ ...ndeterministic-pointer-iteration-order.cpp | 84 ++ clang/docs/ReleaseNotes.rst | 6 + clang/docs/analyzer/checkers.rst | 31 .../clang/StaticAnalyzer/Checkers/Checkers.td | 18 --- .../StaticAnalyzer/Checkers/CMakeLists.txt| 2 - .../Checkers/PointerIterationChecker.cpp | 101 .../Checkers/PointerSortingChecker.cpp| 115 -- clang/test/Analysis/ptr-iter.cpp | 28 clang/test/Analysis/ptr-sort.cpp | 36 - 26 files changed, 707 insertions(+), 331 deletions(-) create mode 100644 clang-tools-extra/clang-tidy/bugprone/NondeterministicPointerIterationOrderCheck.cpp create mode 100644 clang-tools-extra/clang-tidy/bugprone/NondeterministicPointerIterationOrderCheck.h create mode 100644 clang-tools-extra/docs/clang-tidy/checks/bugprone/nondeterministic-pointer-iteration-order.rst create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_algorithm create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_c++config.h create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_initializer_list create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_iterator_base create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_map create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_set create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_stl_pair create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_type_traits create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_unordered_map create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_unordered_set create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_vector create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/nondeterministic-pointer-iteration-order.cpp delete mode 100644 clang/lib/StaticAnalyzer/Checkers/PointerIterationChecker.cpp delete mode 100644 clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp delete mode 100644 clang/test/Analysis/ptr-iter.cpp delete mode 100644 clang/test/Analysis/ptr-sort.cpp diff --git a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp index 9120c4b6c0d9ae..33ac65e715ce81 100644 --- a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp @@ -49,6 +49,7 @@ #include "MultipleStatementMacroCheck.h" #include "NoEscapeCheck.h" #include "NonZeroEnumToBoolConversionCheck.h" +#include "NondeterministicPointerIterationOrderCheck.h" #include "NotNullTerminatedResultCheck.h" #include "OptionalValueConversionCheck.h" #include "ParentVirtualCallCheck.h" @@ -174,6 +175,8 @@ class BugproneModule :
[clang] ad70f3e - [flang][OpenMP] Support `target enter|update|exit .. nowait` (#113305)
Author: Kareem Ergawy Date: 2024-10-23T10:48:54+02:00 New Revision: ad70f3e095f0f347702c447eb364dfd10af21242 URL: https://github.com/llvm/llvm-project/commit/ad70f3e095f0f347702c447eb364dfd10af21242 DIFF: https://github.com/llvm/llvm-project/commit/ad70f3e095f0f347702c447eb364dfd10af21242.diff LOG: [flang][OpenMP] Support `target enter|update|exit .. nowait` (#113305) Extends `nowait` support for other device directives. This PR refactors the task generation utils used for the `target` directive so that they are general enough to be reused for other device directives as well. Added: mlir/test/Target/LLVMIR/omptargetdata-nowait-llvm.mlir Modified: clang/lib/CodeGen/CGOpenMPRuntime.cpp llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp Removed: mlir/test/Target/LLVMIR/omptarget-nowait-unsupported-llvm.mlir diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 3747b00d4893ad..5e9f89b18918d2 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -9672,8 +9672,8 @@ static void emitTargetCallKernelLaunch( DynCGGroupMem, HasNoWait); CGF.Builder.restoreIP(OMPRuntime->getOMPBuilder().emitKernelLaunch( -CGF.Builder, OutlinedFn, OutlinedFnID, EmitTargetCallFallbackCB, Args, -DeviceID, RTLoc, AllocaIP)); +CGF.Builder, OutlinedFnID, EmitTargetCallFallbackCB, Args, DeviceID, +RTLoc, AllocaIP)); }; if (RequiresOuterTask) diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h index 8834c3b1f50115..c4735ec41e7134 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h +++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h @@ -2264,6 +2264,9 @@ class OpenMPIRBuilder { bool EmitDebug = false; +/// Whether the `target ... data` directive has a `nowait` clause. +bool HasNoWait = false; + explicit TargetDataInfo() {} explicit TargetDataInfo(bool RequiresDevicePointerInfo, bool SeparateBeginEndCalls) @@ -2342,7 +2345,6 @@ class OpenMPIRBuilder { /// Generate a target region entry call and host fallback call. /// /// \param Loc The location at which the request originated and is fulfilled. - /// \param OutlinedFn The outlined kernel function. /// \param OutlinedFnID The ooulined function ID. /// \param EmitTargetCallFallbackCB Call back function to generate host ///fallback code. @@ -2350,18 +2352,27 @@ class OpenMPIRBuilder { /// \param DeviceID Identifier for the device via the 'device' clause. /// \param RTLoc Source location identifier /// \param AllocaIP The insertion point to be used for alloca instructions. - InsertPointTy emitKernelLaunch( - const LocationDescription &Loc, Function *OutlinedFn, Value *OutlinedFnID, - EmitFallbackCallbackTy EmitTargetCallFallbackCB, TargetKernelArgs &Args, - Value *DeviceID, Value *RTLoc, InsertPointTy AllocaIP); + InsertPointTy + emitKernelLaunch(const LocationDescription &Loc, Value *OutlinedFnID, + EmitFallbackCallbackTy EmitTargetCallFallbackCB, + TargetKernelArgs &Args, Value *DeviceID, Value *RTLoc, + InsertPointTy AllocaIP); + + /// Callback type for generating the bodies of device directives that require + /// outer target tasks (e.g. in case of having `nowait` or `depend` clauses). + /// + /// \param DeviceID The ID of the device on which the target region will + ///execute. + /// \param RTLoc Source location identifier + /// \Param TargetTaskAllocaIP Insertion point for the alloca block of the + ///generated task. + using TargetTaskBodyCallbackTy = + function_ref; /// Generate a target-task for the target construct /// - /// \param OutlinedFn The outlined device/target kernel function. - /// \param OutlinedFnID The ooulined function ID. - /// \param EmitTargetCallFallbackCB Call back function to generate host - ///fallback code. - /// \param Args Data structure holding information about the kernel arguments. + /// \param TaskBodyCB Callback to generate the actual body of the target task. /// \param DeviceID Identifier for the device via the 'device' clause. /// \param RTLoc Source location identifier /// \param AllocaIP The insertion point to be used for alloca instructions. @@ -2370,10 +2381,10 @@ class OpenMPIRBuilder { /// \param HasNoWait True if the target construct had 'nowait' on it, false ///otherwise InsertPointTy emitTargetTask( - Function *OutlinedFn, Value *OutlinedFnID, - EmitFallbackCallbackTy EmitTargetCallFallbackCB, TargetKernelArgs &Args, - Value *DeviceID, Value *RTLoc, Insert
[clang] [llvm] [RISCV] Add Smrnmi extension (PR #111668)
https://github.com/dong-miao updated https://github.com/llvm/llvm-project/pull/111668 >From c7a9b55023bc1910e1d2e0383dfab0314f525213 Mon Sep 17 00:00:00 2001 From: dong-miao <65881865+dong-m...@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:49:38 +0800 Subject: [PATCH 01/23] Update RISCVSystemOperands.td --- llvm/lib/Target/RISCV/RISCVSystemOperands.td | 8 1 file changed, 8 insertions(+) diff --git a/llvm/lib/Target/RISCV/RISCVSystemOperands.td b/llvm/lib/Target/RISCV/RISCVSystemOperands.td index d85b4a9cf77b33..faec8d0b5bc003 100644 --- a/llvm/lib/Target/RISCV/RISCVSystemOperands.td +++ b/llvm/lib/Target/RISCV/RISCVSystemOperands.td @@ -276,6 +276,14 @@ foreach i = 0...15 in { foreach i = 0...63 in def : SysReg<"pmpaddr"#i, !add(0x3B0, i)>; +//===--===// +// Machine Non-Maskable Interrupt Handling +//===--===// +def:SysReg<"mnscratch",0x740>; +def:SysReg<"mnepc",0x741>; +def:SysReg<"mncause",0x742>; +def:SysReg<"mnstatus",0x744>; + //===--===// // Machine Counter and Timers //===--===// >From 91125a155eed67cbe4546fb22084d83fdab61a8e Mon Sep 17 00:00:00 2001 From: dong-miao <65881865+dong-m...@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:52:00 +0800 Subject: [PATCH 02/23] Update machine-csr-names.s --- llvm/test/MC/RISCV/machine-csr-names.s | 60 ++ 1 file changed, 60 insertions(+) diff --git a/llvm/test/MC/RISCV/machine-csr-names.s b/llvm/test/MC/RISCV/machine-csr-names.s index ae1af1fc8abc35..1e13d5c60b8a48 100644 --- a/llvm/test/MC/RISCV/machine-csr-names.s +++ b/llvm/test/MC/RISCV/machine-csr-names.s @@ -1913,6 +1913,66 @@ csrrs t1, mhpmcounter31, zero csrrs t2, 0xB1F, zero +## +# Machine Counter Setup +## +# mnscratch +# name +# CHECK-INST: csrrs t1, mnscratch, zero +# CHECK-ENC: encoding: [0x73,0x23,0x00,0x74] +# CHECK-INST-ALIAS: csrr t1, mnscratch +# uimm12 +# CHECK-INST: csrrs t2, mnscratch, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x00,0x74] +# CHECK-INST-ALIAS: csrr t2, mnscratch +# name +csrrs t1, mnscratch, zero +# uimm12 +csrrs t2, 0x740, zero + +# mnepc +# name +# CHECK-INST: csrrs t1, mnepc, zero +# CHECK-ENC: encoding: [0x73,0x23,0x10,0x74] +# CHECK-INST-ALIAS: csrr t1, mnepc +# uimm12 +# CHECK-INST: csrrs t2, mnepc, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x10,0x74] +# CHECK-INST-ALIAS: csrr t2, mnepc +# name +csrrs t1, mnepc, zero +# uimm12 +csrrs t2, 0x741, zero + +# mncause +# name +# CHECK-INST: csrrs t1, mncause, zero +# CHECK-ENC: encoding: [0x73,0x23,0x20,0x74] +# CHECK-INST-ALIAS: csrr t1, mncause +# uimm12 +# CHECK-INST: csrrs t2, mncause, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x20,0x74] +# CHECK-INST-ALIAS: csrr t2, mncause +# name +csrrs t1, mncause, zero +# uimm12 +csrrs t2, 0x742, zero + +# mnstatus +# name +# CHECK-INST: csrrs t1, mnstatus, zero +# CHECK-ENC: encoding: [0x73,0x23,0x40,0x74] +# CHECK-INST-ALIAS: csrr t1, mnstatus +# uimm12 +# CHECK-INST: csrrs t2, mnstatus, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x40,0x74] +# CHECK-INST-ALIAS: csrr t2, mnstatus +# name +csrrs t1, mnstatus, zero +# uimm12 +csrrs t2, 0x744, zero + + ## # Machine Counter Setup ## >From 6014139b67ae601ae33aa13919a4dd29b2e18313 Mon Sep 17 00:00:00 2001 From: dong-miao <65881865+dong-m...@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:53:54 +0800 Subject: [PATCH 03/23] Update riscv-target-features.c --- clang/test/Preprocessor/riscv-target-features.c | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index 05a8534ba13da1..5a595742939fff 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -30,6 +30,7 @@ // CHECK-NOT: __riscv_smcdeleg {{.*$}} // CHECK-NOT: __riscv_smcsrind {{.*$}} // CHECK-NOT: __riscv_smepmp {{.*$}} +// CHECK-NOT: __riscv_smrnmi {{.*$}} // CHECK-NOT: __riscv_smstateen {{.*$}} // CHECK-NOT: __riscv_ssaia {{.*$}} // CHECK-NOT: __riscv_ssccfg {{.*$}} >From 8706286d0d39eb72687b45a35dfd0a064edd1484 Mon Sep 17 00:00:00 2001 From: dong-miao <65881865+dong-m...@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:55:07 +0800 Subject: [PATCH 04/23] Update RISCVUsage.rst --- llvm/docs/RISCVUsage.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/docs/RISCVUsage.rst b/llvm/docs/RISCVUsage.rst index 5736f3807f131b..a7ea36191283a3 100644 --- a/llvm/docs/RISCVUsage.rst +++ b/llvm/docs/RISCVUsage.rst @@ -129,6 +129,7 @@ on support follow. ``Smcdeleg`` Supported ``Smcsrind`` Supported ``Smepmp``
[clang] [analyzer][StackAddressEscape] Remove redundant "returned to caller" suffix for compound literal (PR #112135)
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/112135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clangd] Harden incomingCalls() against possible misinterpretation of a range as pertaining to the wrong file (PR #111616)
@@ -2292,9 +2289,26 @@ incomingCalls(const CallHierarchyItem &Item, const SymbolIndex *Index) { Index->lookup(ContainerLookup, [&](const Symbol &Caller) { auto It = CallsIn.find(Caller.ID); assert(It != CallsIn.end()); -if (auto CHI = symbolToCallHierarchyItem(Caller, Item.uri.file())) +if (auto CHI = symbolToCallHierarchyItem(Caller, Item.uri.file())) { + SymbolLocation CallerLoc = + Caller.Definition ? Caller.Definition : Caller.CanonicalDeclaration; + std::vector FromRanges; + for (const SymbolLocation &L : It->second) { +if (StringRef{L.FileURI} != StringRef{CallerLoc.FileURI}) { + elog("incomingCalls: call location not in same file as caller, this " hokein wrote: I don't have a good solution, it looks like the LSP protocol assumes that the ranges are in the same file as from.uri. I think it is worth to reporting it to LSP. It is not a common case though, I think we could just drop these ranges in the current implementation. https://github.com/llvm/llvm-project/pull/111616 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clangd] Harden incomingCalls() against possible misinterpretation of a range as pertaining to the wrong file (PR #111616)
@@ -2272,18 +2273,14 @@ incomingCalls(const CallHierarchyItem &Item, const SymbolIndex *Index) { // Initially store the ranges in a map keyed by SymbolID of the caller. // This allows us to group different calls with the same caller // into the same CallHierarchyIncomingCall. - llvm::DenseMap> CallsIn; + llvm::DenseMap> CallsIn; // We can populate the ranges based on a refs request only. As we do so, we // also accumulate the container IDs into a lookup request. LookupRequest ContainerLookup; Index->refs(Request, [&](const Ref &R) { -auto Loc = indexToLSPLocation(R.Location, Item.uri.file()); -if (!Loc) { - elog("incomingCalls failed to convert location: {0}", Loc.takeError()); - return; -} -auto It = CallsIn.try_emplace(R.Container, std::vector{}).first; -It->second.push_back(Loc->range); +auto It = +CallsIn.try_emplace(R.Container, std::vector{}).first; +It->second.push_back(R.Location); hokein wrote: Yeah, I think it is fine for in-memory index, it is not safe for other implementations (e.g. remote index). https://github.com/llvm/llvm-project/pull/111616 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer][StackAddressEscape] Remove redundant "returned to caller" suffix for compound literal (PR #112135)
github-actions[bot] wrote: @z1nke Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail [here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr). If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of [LLVM development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy). You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! https://github.com/llvm/llvm-project/pull/112135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer][StackAddressEscape] Remove redundant "returned to caller" suffix for compound literal (PR #112135)
https://github.com/steakhal approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/112135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)
tgross35 wrote: > With this version, the fp16 values are passed to conversion functions as > integer, which seems to be the default. It is however a bit tricky to do this > and at the same time pass half values in FP registers. > > At this point I wonder for one thing if it would be better to pass FP16 > values to the conversion functions as _Float16 instead? It seems this may be > possible to change in the configurations by looking at > COMPILER_RT_HAS_FLOAT16 / compiler-rt/lib/builtins/extendhfsf2.c / > fp_extend.h... > > Not really sure if those conversion functions are supposed to be built and > only used for soft-promotion of fp16, or if there are any external > implications, for instance gcc compatability. My understanding is that in GCC's `__gnu_h2f_ieee`/`__gnu_f2h_ieee` is always `i32`<->`i16` (integer ABI), then `__extendhfsf2`/`__truncsfhf2` uses either `int16_t` or `_Float16` on a per-target basis as controlled by `__LIBGCC_HAS_HF_MODE__` (I don't know where this gets set). In LLVM compiler-rt, `COMPILER_RT_HAS_FLOAT16` is the control to do the same thing but it affects `extend`/`trunc` as well as `h2f`/`f2h`. I think the discrepancy works out here because if a target has `_Float16`, it will never be calling `__gnu_h2f_ieee` `__gnu_f2h_ieee`. >From your first two sentences it sounds like `f16` is getting passed in a FP >register but going >FP->GPR->__gnu_h2f_ieee->FP->some_math_op->FP->__gnu_f2h_ieee->GPR->FP? I >think it makes sense to either always pass `f16` as `i16` and avoid the FP >registers, or make `_Float16` available so `COMPILER_RT_HAS_FLOAT16` can be >used. @uweigand mentioned figuring out an ABI for `_Float16`, is this possible? That seems like the best option. A quick check seems to show that GCC 13 does not support `_Float16` on s390x, nor does the crossbuild `libgcc.a` provide `__gnu_h2f_ieee`, `__gnu_f2h_ieee`, `__extendhfsf2`, or `__truncsfhf2`. So I think LLVM will be the one to set the precedent here. Note that there are some common issues with these conversions, would probably be good to test against them if possible https://github.com/llvm/llvm-project/issues/97981 https://github.com/llvm/llvm-project/issues/97975. https://github.com/llvm/llvm-project/pull/109164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [llvm] [rtsan][llvm][NFC] Rename sanitize_realtime_unsafe attr to sanitize_realtime_blocking (PR #113155)
davidtrevelyan wrote: > > LGTM - would love some eyes from more established folks to make sure we are > > not breaking any bw-compatability foo, and seeing as this spans the tree a > > bit. > > Definitely I am for this change, I think the attr is more clear this way, > > and we caught it before LLVM 20 was cut. > > Having that it was just recently landed, I don't see a problem with breaking > bw-comp. > > Did you consider `sanitize_blocking` ? Many thanks for taking a look and for confirming the bw-comp issue. Thanks also for the suggestion on `sanitize_blocking`. We didn't consider it initially because rtsan is the only sanitizer that currently cares about it, and we wanted to keep its scope as small as possible. However - I'm not strongly opposed to renaming it `sanitize_blocking`, especially if other sanitizers might wish to do something with it in future. I'll wait a few days here for further feedback on this before landing, otherwise assuming everyone is happy enough going with `sanitize_realtime_blocking` for now 👍 https://github.com/llvm/llvm-project/pull/113155 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add test for CWG1898 "Use of “equivalent” in overload resolution" (PR #113439)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Vlad Serebrennikov (Endilll) Changes [CWG1898](https://cplusplus.github.io/CWG/issues/1898.html) Use of “equivalent” in overload resolution [P1787R6](https://wg21.link/p1787r6): > CWG1898 is resolved by explicitly using the defined term parameter-type-list. As for the wording, the first sentence [over.dcl]/1 where the word "equivalent" was used: > Two function declarations of the same name refer to the same function if they are in the same scope and have equivalent parameter declarations ([over.load]). was replaced with what is now known as "corresponding overloads", defined in [[basic.scope.scope]/4](https://eel.is/c++draft/basic.scope#scope-4). The definition is present in P1787R6, but it's hard to reference, because the "corresponding overloads" term was coined later. --- Full diff: https://github.com/llvm/llvm-project/pull/113439.diff 2 Files Affected: - (modified) clang/test/CXX/drs/cwg18xx.cpp (+45) - (modified) clang/www/cxx_dr_status.html (+1-1) ``diff diff --git a/clang/test/CXX/drs/cwg18xx.cpp b/clang/test/CXX/drs/cwg18xx.cpp index 7f0fb8cf589d48..3ec5c4d5c618b4 100644 --- a/clang/test/CXX/drs/cwg18xx.cpp +++ b/clang/test/CXX/drs/cwg18xx.cpp @@ -640,3 +640,48 @@ namespace H { struct S s; } } + +namespace cwg1898 { // cwg1898: 2.7 +void e(int) {} // #cwg1898-e-int +void e(int) {} +// expected-error@-1 {{redefinition of 'e'}} +// expected-note@#cwg1898-e-int {{previous definition is here}} +void e(long) {} + +void f(int) {} // #cwg1898-f-int +void f(const int) {} +// expected-error@-1 {{redefinition of 'f'}} +// expected-note@#cwg1898-f-int {{previous definition is here}} + +void g(int) {} // #cwg1898-g-int +void g(volatile int) {} +// since-cxx20-warning@-1 {{volatile-qualified parameter type 'volatile int' is deprecated}} +// expected-error@-2 {{redefinition of 'g'}} +// expected-note@#cwg1898-g-int {{previous definition is here}} + +void h(int *) {} // #cwg1898-h-int +void h(int[]) {} +// expected-error@-1 {{redefinition of 'h'}} +// expected-note@#cwg1898-h-int {{previous definition is here}} + +void i(int *) {} // #cwg1898-i-int +void i(int[2]) {} +// expected-error@-1 {{redefinition of 'i'}} +// expected-note@#cwg1898-i-int {{previous definition is here}} + +void j(void(*)()) {} // #cwg1898-j-int +void j(void()) {} +// expected-error@-1 {{redefinition of 'j'}} +// expected-note@#cwg1898-j-int {{previous definition is here}} + +struct A { + void k(int) {} // #cwg1898-k-int + void k(int) {} + // expected-error@-1 {{class member cannot be redeclared}} + // expected-note@#cwg1898-k-int {{previous definition is here}} +}; + +struct B : A { + void k(int) {} +}; +} // namespace cwg1898 diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 82ba9b370ba595..6640ed477a241e 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -11219,7 +11219,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/1898.html";>1898 CD6 Use of “equivalent” in overload resolution -Unknown +Clang 2.7 https://cplusplus.github.io/CWG/issues/1899.html";>1899 `` https://github.com/llvm/llvm-project/pull/113439 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add test for CWG1898 "Use of “equivalent” in overload resolution" (PR #113439)
https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/113439 [CWG1898](https://cplusplus.github.io/CWG/issues/1898.html) Use of “equivalent” in overload resolution [P1787R6](https://wg21.link/p1787r6): > CWG1898 is resolved by explicitly using the defined term parameter-type-list. As for the wording, the first sentence [over.dcl]/1 where the word "equivalent" was used: > Two function declarations of the same name refer to the same function if they > are in the same scope and have equivalent parameter declarations > ([over.load]). was replaced with what is now known as "corresponding overloads", defined in [[basic.scope.scope]/4](https://eel.is/c++draft/basic.scope#scope-4). The definition is present in P1787R6, but it's hard to reference, because the "corresponding overloads" term was coined later. >From 467c478cbc2400e1337e6dcc344a96e4a697341a Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 23 Oct 2024 12:59:36 +0300 Subject: [PATCH] =?UTF-8?q?[clang][NFC]=20Add=20test=20for=20CWG1898=20"Us?= =?UTF-8?q?e=20of=20=E2=80=9Cequivalent=E2=80=9D=20in=20overload=20resolut?= =?UTF-8?q?ion"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- clang/test/CXX/drs/cwg18xx.cpp | 45 ++ clang/www/cxx_dr_status.html | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/clang/test/CXX/drs/cwg18xx.cpp b/clang/test/CXX/drs/cwg18xx.cpp index 7f0fb8cf589d48..3ec5c4d5c618b4 100644 --- a/clang/test/CXX/drs/cwg18xx.cpp +++ b/clang/test/CXX/drs/cwg18xx.cpp @@ -640,3 +640,48 @@ namespace H { struct S s; } } + +namespace cwg1898 { // cwg1898: 2.7 +void e(int) {} // #cwg1898-e-int +void e(int) {} +// expected-error@-1 {{redefinition of 'e'}} +// expected-note@#cwg1898-e-int {{previous definition is here}} +void e(long) {} + +void f(int) {} // #cwg1898-f-int +void f(const int) {} +// expected-error@-1 {{redefinition of 'f'}} +// expected-note@#cwg1898-f-int {{previous definition is here}} + +void g(int) {} // #cwg1898-g-int +void g(volatile int) {} +// since-cxx20-warning@-1 {{volatile-qualified parameter type 'volatile int' is deprecated}} +// expected-error@-2 {{redefinition of 'g'}} +// expected-note@#cwg1898-g-int {{previous definition is here}} + +void h(int *) {} // #cwg1898-h-int +void h(int[]) {} +// expected-error@-1 {{redefinition of 'h'}} +// expected-note@#cwg1898-h-int {{previous definition is here}} + +void i(int *) {} // #cwg1898-i-int +void i(int[2]) {} +// expected-error@-1 {{redefinition of 'i'}} +// expected-note@#cwg1898-i-int {{previous definition is here}} + +void j(void(*)()) {} // #cwg1898-j-int +void j(void()) {} +// expected-error@-1 {{redefinition of 'j'}} +// expected-note@#cwg1898-j-int {{previous definition is here}} + +struct A { + void k(int) {} // #cwg1898-k-int + void k(int) {} + // expected-error@-1 {{class member cannot be redeclared}} + // expected-note@#cwg1898-k-int {{previous definition is here}} +}; + +struct B : A { + void k(int) {} +}; +} // namespace cwg1898 diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 82ba9b370ba595..6640ed477a241e 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -11219,7 +11219,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/1898.html";>1898 CD6 Use of “equivalent” in overload resolution -Unknown +Clang 2.7 https://cplusplus.github.io/CWG/issues/1899.html";>1899 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [LoongArch] [CodeGen] Support LoongArch-specific amswap[__db].{b/h} and amadd[__db].{b/h} instructions. (PR #113255)
@@ -2088,8 +2088,26 @@ multiclass binary_atomic_op_wd { (!cast(inst#"__DB_D"#signed) GPR:$rk, GPR:$rj)>; } +// Atomic operation for byte and half word +multiclass binary_atomic_op_bh { + def : Pat<(!cast(op#"_i8_monotonic") GPR:$rj, GPR:$rk), +(!cast(inst#"_B") GPR:$rk, GPR:$rj)>; + def : Pat<(!cast(op#"_i16_monotonic") GPR:$rj, GPR:$rk), +(!cast(inst#"_H") GPR:$rk, GPR:$rj)>; + + def : Pat<(!cast(op#"_i8") GPR:$rj, GPR:$rk), +(!cast(inst#"__DB_B") GPR:$rk, GPR:$rj)>; + def : Pat<(!cast(op#"_i16") GPR:$rj, GPR:$rk), +(!cast(inst#"__DB_H") GPR:$rk, GPR:$rj)>; +} + let Predicates = [IsLA64] in { +let Predicates = [ HasLAM_BH ] in { tangaac wrote: It does. I don't know this before, it's updated now. https://github.com/llvm/llvm-project/pull/113255 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [flang][OpenMP] Support `target enter|update|exit .. nowait` (PR #113305)
https://github.com/ergawy updated https://github.com/llvm/llvm-project/pull/113305 >From 83088c0b47f7582729f11f996d850e5757fcb872 Mon Sep 17 00:00:00 2001 From: ergawy Date: Tue, 22 Oct 2024 02:02:58 -0500 Subject: [PATCH] [flang][OpenMP] Support `target enter|update|exit .. nowait` Extends `nowait` support for other device directives. This PR refactors the task generation utils used for the `target` directive so that they are general enough to be reused for other device directives as well. --- clang/lib/CodeGen/CGOpenMPRuntime.cpp | 4 +- .../llvm/Frontend/OpenMP/OMPIRBuilder.h | 39 -- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 127 -- .../OpenMP/OpenMPToLLVMIRTranslation.cpp | 34 +++-- .../omptarget-nowait-unsupported-llvm.mlir| 39 -- .../LLVMIR/omptargetdata-nowait-llvm.mlir | 110 +++ 6 files changed, 243 insertions(+), 110 deletions(-) delete mode 100644 mlir/test/Target/LLVMIR/omptarget-nowait-unsupported-llvm.mlir create mode 100644 mlir/test/Target/LLVMIR/omptargetdata-nowait-llvm.mlir diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 3747b00d4893ad..5e9f89b18918d2 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -9672,8 +9672,8 @@ static void emitTargetCallKernelLaunch( DynCGGroupMem, HasNoWait); CGF.Builder.restoreIP(OMPRuntime->getOMPBuilder().emitKernelLaunch( -CGF.Builder, OutlinedFn, OutlinedFnID, EmitTargetCallFallbackCB, Args, -DeviceID, RTLoc, AllocaIP)); +CGF.Builder, OutlinedFnID, EmitTargetCallFallbackCB, Args, DeviceID, +RTLoc, AllocaIP)); }; if (RequiresOuterTask) diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h index 8834c3b1f50115..d71712a677078c 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h +++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h @@ -2264,6 +2264,9 @@ class OpenMPIRBuilder { bool EmitDebug = false; +/// Whether the `target ... data` directive has a `nowait` clause. +bool HasNoWait = false; + explicit TargetDataInfo() {} explicit TargetDataInfo(bool RequiresDevicePointerInfo, bool SeparateBeginEndCalls) @@ -2342,7 +2345,6 @@ class OpenMPIRBuilder { /// Generate a target region entry call and host fallback call. /// /// \param Loc The location at which the request originated and is fulfilled. - /// \param OutlinedFn The outlined kernel function. /// \param OutlinedFnID The ooulined function ID. /// \param EmitTargetCallFallbackCB Call back function to generate host ///fallback code. @@ -2350,18 +2352,27 @@ class OpenMPIRBuilder { /// \param DeviceID Identifier for the device via the 'device' clause. /// \param RTLoc Source location identifier /// \param AllocaIP The insertion point to be used for alloca instructions. - InsertPointTy emitKernelLaunch( - const LocationDescription &Loc, Function *OutlinedFn, Value *OutlinedFnID, - EmitFallbackCallbackTy EmitTargetCallFallbackCB, TargetKernelArgs &Args, - Value *DeviceID, Value *RTLoc, InsertPointTy AllocaIP); + InsertPointTy + emitKernelLaunch(const LocationDescription &Loc, Value *OutlinedFnID, + EmitFallbackCallbackTy EmitTargetCallFallbackCB, + TargetKernelArgs &Args, Value *DeviceID, Value *RTLoc, + InsertPointTy AllocaIP); + + /// Callback type for generating the bodies of device directives that require + /// outer tasks (e.g. in case of having `nowait` or `depend` clauses). + /// + /// \param DeviceID The ID of the device on which the target region will + ///execute. + /// \param RTLoc Source location identifier + /// \Param TargetTaskAllocaIP Insertion point for the alloca block of the + ///generated task. + using TaskBodyCallbackTy = + function_ref; /// Generate a target-task for the target construct /// - /// \param OutlinedFn The outlined device/target kernel function. - /// \param OutlinedFnID The ooulined function ID. - /// \param EmitTargetCallFallbackCB Call back function to generate host - ///fallback code. - /// \param Args Data structure holding information about the kernel arguments. + /// \param TaskBodyCB Callback to generate the actual body of the target task. /// \param DeviceID Identifier for the device via the 'device' clause. /// \param RTLoc Source location identifier /// \param AllocaIP The insertion point to be used for alloca instructions. @@ -2370,10 +2381,10 @@ class OpenMPIRBuilder { /// \param HasNoWait True if the target construct had 'nowait' on it, false ///otherwise InsertPointTy emitTargetTask( - Function *OutlinedFn, Value *OutlinedFnID, - EmitFallbackCallbackTy EmitTargetCallFallbackCB, TargetKernelArgs &Args, - V
[clang] [llvm] [mlir] [flang][OpenMP] Support `target enter|update|exit .. nowait` (PR #113305)
https://github.com/ergawy updated https://github.com/llvm/llvm-project/pull/113305 >From 70a0c97fa86445d1f888cf3645c0b59df9e4a9d7 Mon Sep 17 00:00:00 2001 From: ergawy Date: Tue, 22 Oct 2024 02:02:58 -0500 Subject: [PATCH] [flang][OpenMP] Support `target enter|update|exit .. nowait` Extends `nowait` support for other device directives. This PR refactors the task generation utils used for the `target` directive so that they are general enough to be reused for other device directives as well. --- clang/lib/CodeGen/CGOpenMPRuntime.cpp | 4 +- .../llvm/Frontend/OpenMP/OMPIRBuilder.h | 39 -- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 126 -- .../OpenMP/OpenMPToLLVMIRTranslation.cpp | 34 +++-- .../omptarget-nowait-unsupported-llvm.mlir| 39 -- .../LLVMIR/omptargetdata-nowait-llvm.mlir | 110 +++ 6 files changed, 242 insertions(+), 110 deletions(-) delete mode 100644 mlir/test/Target/LLVMIR/omptarget-nowait-unsupported-llvm.mlir create mode 100644 mlir/test/Target/LLVMIR/omptargetdata-nowait-llvm.mlir diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 3747b00d4893ad..5e9f89b18918d2 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -9672,8 +9672,8 @@ static void emitTargetCallKernelLaunch( DynCGGroupMem, HasNoWait); CGF.Builder.restoreIP(OMPRuntime->getOMPBuilder().emitKernelLaunch( -CGF.Builder, OutlinedFn, OutlinedFnID, EmitTargetCallFallbackCB, Args, -DeviceID, RTLoc, AllocaIP)); +CGF.Builder, OutlinedFnID, EmitTargetCallFallbackCB, Args, DeviceID, +RTLoc, AllocaIP)); }; if (RequiresOuterTask) diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h index 8834c3b1f50115..d71712a677078c 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h +++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h @@ -2264,6 +2264,9 @@ class OpenMPIRBuilder { bool EmitDebug = false; +/// Whether the `target ... data` directive has a `nowait` clause. +bool HasNoWait = false; + explicit TargetDataInfo() {} explicit TargetDataInfo(bool RequiresDevicePointerInfo, bool SeparateBeginEndCalls) @@ -2342,7 +2345,6 @@ class OpenMPIRBuilder { /// Generate a target region entry call and host fallback call. /// /// \param Loc The location at which the request originated and is fulfilled. - /// \param OutlinedFn The outlined kernel function. /// \param OutlinedFnID The ooulined function ID. /// \param EmitTargetCallFallbackCB Call back function to generate host ///fallback code. @@ -2350,18 +2352,27 @@ class OpenMPIRBuilder { /// \param DeviceID Identifier for the device via the 'device' clause. /// \param RTLoc Source location identifier /// \param AllocaIP The insertion point to be used for alloca instructions. - InsertPointTy emitKernelLaunch( - const LocationDescription &Loc, Function *OutlinedFn, Value *OutlinedFnID, - EmitFallbackCallbackTy EmitTargetCallFallbackCB, TargetKernelArgs &Args, - Value *DeviceID, Value *RTLoc, InsertPointTy AllocaIP); + InsertPointTy + emitKernelLaunch(const LocationDescription &Loc, Value *OutlinedFnID, + EmitFallbackCallbackTy EmitTargetCallFallbackCB, + TargetKernelArgs &Args, Value *DeviceID, Value *RTLoc, + InsertPointTy AllocaIP); + + /// Callback type for generating the bodies of device directives that require + /// outer tasks (e.g. in case of having `nowait` or `depend` clauses). + /// + /// \param DeviceID The ID of the device on which the target region will + ///execute. + /// \param RTLoc Source location identifier + /// \Param TargetTaskAllocaIP Insertion point for the alloca block of the + ///generated task. + using TaskBodyCallbackTy = + function_ref; /// Generate a target-task for the target construct /// - /// \param OutlinedFn The outlined device/target kernel function. - /// \param OutlinedFnID The ooulined function ID. - /// \param EmitTargetCallFallbackCB Call back function to generate host - ///fallback code. - /// \param Args Data structure holding information about the kernel arguments. + /// \param TaskBodyCB Callback to generate the actual body of the target task. /// \param DeviceID Identifier for the device via the 'device' clause. /// \param RTLoc Source location identifier /// \param AllocaIP The insertion point to be used for alloca instructions. @@ -2370,10 +2381,10 @@ class OpenMPIRBuilder { /// \param HasNoWait True if the target construct had 'nowait' on it, false ///otherwise InsertPointTy emitTargetTask( - Function *OutlinedFn, Value *OutlinedFnID, - EmitFallbackCallbackTy EmitTargetCallFallbackCB, TargetKernelArgs &Args, - V
[clang] [llvm] [mlir] [flang][OpenMP] Support `target enter|update|exit .. nowait` (PR #113305)
@@ -6403,16 +6401,45 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createTargetData( SrcLocInfo = getOrCreateIdent(SrcLocStr, SrcLocStrSize); } -Value *OffloadingArgs[] = {SrcLocInfo, DeviceID, - PointerNum, RTArgs.BasePointersArray, - RTArgs.PointersArray, RTArgs.SizesArray, - RTArgs.MapTypesArray, RTArgs.MapNamesArray, - RTArgs.MappersArray}; +SmallVector OffloadingArgs = { +SrcLocInfo, DeviceID, +PointerNum, RTArgs.BasePointersArray, +RTArgs.PointersArray, RTArgs.SizesArray, +RTArgs.MapTypesArray, RTArgs.MapNamesArray, +RTArgs.MappersArray}; if (IsStandAlone) { assert(MapperFunc && "MapperFunc missing for standalone target data"); - Builder.CreateCall(getOrCreateRuntimeFunctionPtr(*MapperFunc), - OffloadingArgs); + + auto TaskBodyCB = [&](Value *, Value *, IRBuilderBase::InsertPoint) { +if (Info.HasNoWait) { + OffloadingArgs.push_back(llvm::Constant::getNullValue(Int32)); + OffloadingArgs.push_back(llvm::Constant::getNullValue(VoidPtr)); + OffloadingArgs.push_back(llvm::Constant::getNullValue(Int32)); + OffloadingArgs.push_back(llvm::Constant::getNullValue(VoidPtr)); ergawy wrote: It does work. Thanks. https://github.com/llvm/llvm-project/pull/113305 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [llvm] [AArch64] Split FeatureMTE to FEAT_MTE and FEAT_MTE2. (PR #109299)
https://github.com/labrinea closed https://github.com/llvm/llvm-project/pull/109299 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [flang][OpenMP] Support `target enter|update|exit .. nowait` (PR #113305)
https://github.com/ergawy updated https://github.com/llvm/llvm-project/pull/113305 >From 52b59662de0693d3c9acb4e52d87e748cb9153cf Mon Sep 17 00:00:00 2001 From: ergawy Date: Tue, 22 Oct 2024 02:02:58 -0500 Subject: [PATCH] [flang][OpenMP] Support `target enter|update|exit .. nowait` Extends `nowait` support for other device directives. This PR refactors the task generation utils used for the `target` directive so that they are general enough to be reused for other device directives as well. --- clang/lib/CodeGen/CGOpenMPRuntime.cpp | 4 +- .../llvm/Frontend/OpenMP/OMPIRBuilder.h | 39 -- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 125 -- .../OpenMP/OpenMPToLLVMIRTranslation.cpp | 34 +++-- .../omptarget-nowait-unsupported-llvm.mlir| 39 -- .../LLVMIR/omptargetdata-nowait-llvm.mlir | 110 +++ 6 files changed, 241 insertions(+), 110 deletions(-) delete mode 100644 mlir/test/Target/LLVMIR/omptarget-nowait-unsupported-llvm.mlir create mode 100644 mlir/test/Target/LLVMIR/omptargetdata-nowait-llvm.mlir diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 3747b00d4893ad..5e9f89b18918d2 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -9672,8 +9672,8 @@ static void emitTargetCallKernelLaunch( DynCGGroupMem, HasNoWait); CGF.Builder.restoreIP(OMPRuntime->getOMPBuilder().emitKernelLaunch( -CGF.Builder, OutlinedFn, OutlinedFnID, EmitTargetCallFallbackCB, Args, -DeviceID, RTLoc, AllocaIP)); +CGF.Builder, OutlinedFnID, EmitTargetCallFallbackCB, Args, DeviceID, +RTLoc, AllocaIP)); }; if (RequiresOuterTask) diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h index 8834c3b1f50115..c4735ec41e7134 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h +++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h @@ -2264,6 +2264,9 @@ class OpenMPIRBuilder { bool EmitDebug = false; +/// Whether the `target ... data` directive has a `nowait` clause. +bool HasNoWait = false; + explicit TargetDataInfo() {} explicit TargetDataInfo(bool RequiresDevicePointerInfo, bool SeparateBeginEndCalls) @@ -2342,7 +2345,6 @@ class OpenMPIRBuilder { /// Generate a target region entry call and host fallback call. /// /// \param Loc The location at which the request originated and is fulfilled. - /// \param OutlinedFn The outlined kernel function. /// \param OutlinedFnID The ooulined function ID. /// \param EmitTargetCallFallbackCB Call back function to generate host ///fallback code. @@ -2350,18 +2352,27 @@ class OpenMPIRBuilder { /// \param DeviceID Identifier for the device via the 'device' clause. /// \param RTLoc Source location identifier /// \param AllocaIP The insertion point to be used for alloca instructions. - InsertPointTy emitKernelLaunch( - const LocationDescription &Loc, Function *OutlinedFn, Value *OutlinedFnID, - EmitFallbackCallbackTy EmitTargetCallFallbackCB, TargetKernelArgs &Args, - Value *DeviceID, Value *RTLoc, InsertPointTy AllocaIP); + InsertPointTy + emitKernelLaunch(const LocationDescription &Loc, Value *OutlinedFnID, + EmitFallbackCallbackTy EmitTargetCallFallbackCB, + TargetKernelArgs &Args, Value *DeviceID, Value *RTLoc, + InsertPointTy AllocaIP); + + /// Callback type for generating the bodies of device directives that require + /// outer target tasks (e.g. in case of having `nowait` or `depend` clauses). + /// + /// \param DeviceID The ID of the device on which the target region will + ///execute. + /// \param RTLoc Source location identifier + /// \Param TargetTaskAllocaIP Insertion point for the alloca block of the + ///generated task. + using TargetTaskBodyCallbackTy = + function_ref; /// Generate a target-task for the target construct /// - /// \param OutlinedFn The outlined device/target kernel function. - /// \param OutlinedFnID The ooulined function ID. - /// \param EmitTargetCallFallbackCB Call back function to generate host - ///fallback code. - /// \param Args Data structure holding information about the kernel arguments. + /// \param TaskBodyCB Callback to generate the actual body of the target task. /// \param DeviceID Identifier for the device via the 'device' clause. /// \param RTLoc Source location identifier /// \param AllocaIP The insertion point to be used for alloca instructions. @@ -2370,10 +2381,10 @@ class OpenMPIRBuilder { /// \param HasNoWait True if the target construct had 'nowait' on it, false ///otherwise InsertPointTy emitTargetTask( - Function *OutlinedFn, Value *OutlinedFnID, - EmitFallbackCallbackTy EmitTargetCallFallbackCB, TargetKernelArgs &A
[clang] [llvm] [mlir] [flang][OpenMP] Support `target enter|update|exit .. nowait` (PR #113305)
@@ -6403,16 +6401,45 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createTargetData( SrcLocInfo = getOrCreateIdent(SrcLocStr, SrcLocStrSize); } -Value *OffloadingArgs[] = {SrcLocInfo, DeviceID, - PointerNum, RTArgs.BasePointersArray, - RTArgs.PointersArray, RTArgs.SizesArray, - RTArgs.MapTypesArray, RTArgs.MapNamesArray, - RTArgs.MappersArray}; +SmallVector OffloadingArgs = { +SrcLocInfo, DeviceID, +PointerNum, RTArgs.BasePointersArray, +RTArgs.PointersArray, RTArgs.SizesArray, +RTArgs.MapTypesArray, RTArgs.MapNamesArray, +RTArgs.MappersArray}; if (IsStandAlone) { assert(MapperFunc && "MapperFunc missing for standalone target data"); - Builder.CreateCall(getOrCreateRuntimeFunctionPtr(*MapperFunc), - OffloadingArgs); + + auto TaskBodyCB = [&](Value *, Value *, IRBuilderBase::InsertPoint) { +if (Info.HasNoWait) { + OffloadingArgs.push_back(llvm::Constant::getNullValue(Int32)); + OffloadingArgs.push_back(llvm::Constant::getNullValue(VoidPtr)); + OffloadingArgs.push_back(llvm::Constant::getNullValue(Int32)); + OffloadingArgs.push_back(llvm::Constant::getNullValue(VoidPtr)); +} + +Builder.CreateCall(getOrCreateRuntimeFunctionPtr(*MapperFunc), + OffloadingArgs); + +if (Info.HasNoWait) { + BasicBlock *OffloadContBlock = + BasicBlock::Create(Builder.getContext(), "omp_offload.cont"); + auto *CurFn = Builder.GetInsertBlock()->getParent(); + emitBranch(OffloadContBlock); + emitBlock(OffloadContBlock, CurFn, /*IsFinished=*/true); ergawy wrote: Seems like `emitBlock` is enough indeed. Let's see if the CI objects. https://github.com/llvm/llvm-project/pull/113305 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)
https://github.com/vabridgers updated https://github.com/llvm/llvm-project/pull/110471 >From f9142f63cfdb4c298f8f0dbf915b8a6c4a510731 Mon Sep 17 00:00:00 2001 From: Vince Bridgers Date: Thu, 26 Sep 2024 16:24:59 +0200 Subject: [PATCH] [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy This change moves the alpha.nondeterministic.PointerSorting and alpha.nondeterministic.PointerIteration static analyzer checkers to a single clang-tidy check. Those checkers were implemented as clang-tidy checks wrapped in the static analyzer framework. The documentation was updated to describe what the checks can and cannot do, and testing was completed on a broad set of open source projects. --- .../bugprone/BugproneTidyModule.cpp | 3 + .../clang-tidy/bugprone/CMakeLists.txt| 1 + ...eterministicPointerIterationOrderCheck.cpp | 85 ++ ...ndeterministicPointerIterationOrderCheck.h | 37 + clang-tools-extra/docs/ReleaseNotes.rst | 6 + ...ndeterministic-pointer-iteration-order.rst | 35 .../system-header-simulator/sim_algorithm | 31 .../system-header-simulator/sim_c++config.h | 11 ++ .../sim_initializer_list | 39 + .../system-header-simulator/sim_iterator_base | 22 +++ .../Inputs/system-header-simulator/sim_map| 34 .../Inputs/system-header-simulator/sim_set| 44 + .../system-header-simulator/sim_stl_pair | 32 .../system-header-simulator/sim_type_traits | 19 +++ .../system-header-simulator/sim_unordered_map | 33 .../system-header-simulator/sim_unordered_set | 35 .../Inputs/system-header-simulator/sim_vector | 150 ++ ...ndeterministic-pointer-iteration-order.cpp | 84 ++ clang/docs/ReleaseNotes.rst | 6 + clang/docs/analyzer/checkers.rst | 31 .../clang/StaticAnalyzer/Checkers/Checkers.td | 18 --- .../StaticAnalyzer/Checkers/CMakeLists.txt| 2 - .../Checkers/PointerIterationChecker.cpp | 101 .../Checkers/PointerSortingChecker.cpp| 115 -- clang/test/Analysis/ptr-iter.cpp | 28 clang/test/Analysis/ptr-sort.cpp | 36 - 26 files changed, 707 insertions(+), 331 deletions(-) create mode 100644 clang-tools-extra/clang-tidy/bugprone/NondeterministicPointerIterationOrderCheck.cpp create mode 100644 clang-tools-extra/clang-tidy/bugprone/NondeterministicPointerIterationOrderCheck.h create mode 100644 clang-tools-extra/docs/clang-tidy/checks/bugprone/nondeterministic-pointer-iteration-order.rst create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_algorithm create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_c++config.h create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_initializer_list create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_iterator_base create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_map create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_set create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_stl_pair create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_type_traits create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_unordered_map create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_unordered_set create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_vector create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/nondeterministic-pointer-iteration-order.cpp delete mode 100644 clang/lib/StaticAnalyzer/Checkers/PointerIterationChecker.cpp delete mode 100644 clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp delete mode 100644 clang/test/Analysis/ptr-iter.cpp delete mode 100644 clang/test/Analysis/ptr-sort.cpp diff --git a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp index 9120c4b6c0d9ae..33ac65e715ce81 100644 --- a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp @@ -49,6 +49,7 @@ #include "MultipleStatementMacroCheck.h" #include "NoEscapeCheck.h" #include "NonZeroEnumToBoolConversionCheck.h" +#include "NondeterministicPointerIterationOrderCheck.h" #include "NotNullTerminatedResultCheck.h" #include "OptionalValueConversionCheck.h" #include "ParentVirtualCallCheck.h" @@ -174,6 +175,8 @@ class BugproneModule :
[clang] [clang] Update the lifetimebound example with up-to-date expected warning and change the sample code to be a fully working example (PR #113437)
https://github.com/bricknerb edited https://github.com/llvm/llvm-project/pull/113437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-repl][CMake][MSVC] Wrap /EXPORT linker option for ICX (PR #112867)
https://github.com/Maetveis updated https://github.com/llvm/llvm-project/pull/112867 From 2c2b4070b05db0a550fb2a63458be85020963a9a Mon Sep 17 00:00:00 2001 From: Gergely Meszaros Date: Thu, 17 Oct 2024 05:35:37 -0700 Subject: [PATCH] [clang-repl][CMake][MSVC] Wrap /EXPORT linker option for ICX The Intel C++ Compiler (ICX) passes linker flags through the driver unlike MSVC and clang-cl, and therefore needs them to be prefixed with `/Qoption,link` (the equivalent of -Wl, for gcc on *nix). Use the `LINKER:` prefix for the `/EXPORT:` options in clang-repl, this expands to the correct flag for ICX and nothing for MSVC / clang-cl. RFC: https://discourse.llvm.org/t/rfc-cmake-linker-flags-need-wl-equivalent-for-intel-c-icx-on-windows/82446 --- clang/tools/clang-repl/CMakeLists.txt | 6 ++ clang/unittests/Interpreter/CMakeLists.txt | 7 ++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/clang/tools/clang-repl/CMakeLists.txt b/clang/tools/clang-repl/CMakeLists.txt index 9ffe853d759caf..7aebbe7a19436a 100644 --- a/clang/tools/clang-repl/CMakeLists.txt +++ b/clang/tools/clang-repl/CMakeLists.txt @@ -48,11 +48,9 @@ if(MSVC) endif() # List to '/EXPORT:sym0 /EXPORT:sym1 /EXPORT:sym2 ...' - foreach(sym ${clang_repl_exports}) -set(clang_repl_link_str "${clang_repl_link_str} /EXPORT:${sym}") - endforeach(sym ${clang_repl_exports}) + list(TRANSFORM clang_repl_exports PREPEND "LINKER:/EXPORT:") - set_property(TARGET clang-repl APPEND_STRING PROPERTY LINK_FLAGS ${clang_repl_link_str}) + set_property(TARGET clang-repl APPEND PROPERTY LINK_OPTIONS ${clang_repl_exports}) endif(MSVC) diff --git a/clang/unittests/Interpreter/CMakeLists.txt b/clang/unittests/Interpreter/CMakeLists.txt index 1ed1216c772e8f..95378f9cfe7370 100644 --- a/clang/unittests/Interpreter/CMakeLists.txt +++ b/clang/unittests/Interpreter/CMakeLists.txt @@ -67,10 +67,7 @@ if(MSVC) endif() # List to '/EXPORT:sym0 /EXPORT:sym1 /EXPORT:sym2 ...' - foreach(sym ${ClangReplInterpreterTests_exports}) -set(ClangReplInterpreterTests_link_str "${ClangReplInterpreterTests_link_str} /EXPORT:${sym}") - endforeach(sym ${ClangReplInterpreterTests_exports}) - - set_property(TARGET ClangReplInterpreterTests APPEND_STRING PROPERTY LINK_FLAGS ${ClangReplInterpreterTests_link_str}) + list(TRANSFORM ClangReplInterpreterTests_exports PREPEND "LINKER:/EXPORT:") + set_property(TARGET ClangReplInterpreterTests APPEND PROPERTY LINK_OPTIONS ${ClangReplInterpreterTests_exports}) endif(MSVC) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-format] Fix working -assume-filename with .clang-format-ignore (PR #113100)
kakkoko wrote: @mydeveloperday > However what you are saying is, its not using that assume-filename to locate > the .clang-format-ignore file? > > Hence in the IDE it reformats myfile.* meaning you can't save it unformatted Yes, that is correct. You can see that in [the following file of `Clang-Format.cpp`, `main()`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.2/clang/tools/clang-format/ClangFormat.cpp#L709-L735): ```c++ // If no file name is specified on the command line to be processed, // formatting is performed on standard input and terminates. if (FileNames.empty()) return clang::format::format("-", FailOnIncompleteFormat); ... // Sequentially process each file specified on the command line for (const auto &FileName : FileNames) { // Check for .clang-format-ignore const bool Ignored = isIgnored(FileName); ... // If the pattern matches the pattern written in .clang-format-ignore, // do nothing and proceed to the next file if (Ignored) continue; ... // do formatting Error |= clang::format::format(FileName, FailOnIncompleteFormat); } ``` The `isIgnored()` function, which determines whether or not to ignore using `.clang-format-ignore`, is only called in the part that processes the files enumerated on the command line in order. https://github.com/llvm/llvm-project/pull/113100 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #113446)
https://github.com/anutosh491 created https://github.com/llvm/llvm-project/pull/113446 While building llvm (clang, lld) for wasm using emscripten (recipe hosted on emscripten-forge https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/llvm) I ended up with this error ``` │ │ wasm-ld: error: ../../../../lib/libclangInterpreter.a(Wasm.cpp.o): undefined symbol: lld::wasm::link(llvm::ArrayRef, llvm::raw_ostream&, llvm: │ │ :raw_ostream&, bool, bool) ``` This is due to the link function here https://github.com/llvm/llvm-project/blob/a4819bd46d8baebc3aaa8b38f78065de33593199/clang/lib/Interpreter/Wasm.cpp#L25-L30 This was added through this PR (https://github.com/llvm/llvm-project/pull/86402) as an attempt to support running clang-repl and executing C++ code interactively inside a Javascript engine using WebAssembly when built with Emscripten. The definition for link is present in lldwasm and when building for the emscripten platform we should be linking against it. >From a10d5c42b8685295a5092917750d18a59441bad5 Mon Sep 17 00:00:00 2001 From: anutosh491 Date: Wed, 23 Oct 2024 16:58:57 +0530 Subject: [PATCH] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm --- clang/lib/Interpreter/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/lib/Interpreter/CMakeLists.txt b/clang/lib/Interpreter/CMakeLists.txt index 2cc7c59b61d318..d5ffe78251d253 100644 --- a/clang/lib/Interpreter/CMakeLists.txt +++ b/clang/lib/Interpreter/CMakeLists.txt @@ -14,6 +14,7 @@ set(LLVM_LINK_COMPONENTS if (EMSCRIPTEN AND "lld" IN_LIST LLVM_ENABLE_PROJECTS) set(WASM_SRC Wasm.cpp) + set(WASM_LINK lldWasm) endif() add_clang_library(clangInterpreter @@ -44,6 +45,7 @@ add_clang_library(clangInterpreter clangParse clangSema clangSerialization + ${WASM_LINK} ) if ((MINGW OR CYGWIN) AND BUILD_SHARED_LIBS) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #113446)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Anutosh Bhat (anutosh491) Changes While building llvm (clang, lld) for wasm using emscripten (recipe hosted on emscripten-forge https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/llvm) I ended up with this error ``` │ │ wasm-ld: error: ../../../../lib/libclangInterpreter.a(Wasm.cpp.o): undefined symbol: lld::wasm::link(llvm::ArrayRef, llvm::raw_ostream&, llvm: │ │ :raw_ostream&, bool, bool) ``` This is due to the link function here https://github.com/llvm/llvm-project/blob/a4819bd46d8baebc3aaa8b38f78065de33593199/clang/lib/Interpreter/Wasm.cpp#L25-L30 This was added through this PR (https://github.com/llvm/llvm-project/pull/86402) as an attempt to support running clang-repl and executing C++ code interactively inside a Javascript engine using WebAssembly when built with Emscripten. The definition for link is present in lldwasm and when building for the emscripten platform we should be linking against it. --- Full diff: https://github.com/llvm/llvm-project/pull/113446.diff 1 Files Affected: - (modified) clang/lib/Interpreter/CMakeLists.txt (+2) ``diff diff --git a/clang/lib/Interpreter/CMakeLists.txt b/clang/lib/Interpreter/CMakeLists.txt index 2cc7c59b61d318..d5ffe78251d253 100644 --- a/clang/lib/Interpreter/CMakeLists.txt +++ b/clang/lib/Interpreter/CMakeLists.txt @@ -14,6 +14,7 @@ set(LLVM_LINK_COMPONENTS if (EMSCRIPTEN AND "lld" IN_LIST LLVM_ENABLE_PROJECTS) set(WASM_SRC Wasm.cpp) + set(WASM_LINK lldWasm) endif() add_clang_library(clangInterpreter @@ -44,6 +45,7 @@ add_clang_library(clangInterpreter clangParse clangSema clangSerialization + ${WASM_LINK} ) if ((MINGW OR CYGWIN) AND BUILD_SHARED_LIBS) `` https://github.com/llvm/llvm-project/pull/113446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #113446)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/113446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Ci report script testing! (PR #113447)
https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/113447 Do not commit! >From ba99bed96bd69db7c86d43a2119255569872f41f Mon Sep 17 00:00:00 2001 From: David Spickett Date: Mon, 21 Oct 2024 12:34:17 + Subject: [PATCH 1/4] [ci] Write test results to unique file names In this patch I'm using a new lit option so that the pipeline writes many results files, one for each time lit is run: ``` --use-unique-output-file-name When enabled, lit will add a unique element to the output file name, before the extension. For example "results.xml" will become "results..xml". The "" is not ordered in any way and is chosen so that existing files are not overwritten. [Default: Off] ``` (I added this to lit recently) Now if I run the Linux build: $ bash ./.ci/monolithic-linux.sh "clang;lldb;lld" "check-lldb-shell check-lld" "libcxx;libcxxabi" "check-libcxx check-libcxxabi" I get multiple test result files. In my case some tests fail so runtimes aren't checked, but all projects are so there is 1 file for lldb and one for lld: $ ls build/*.xml build/test-results.klc82utf.xml build/test-results.majylh73.xml This change just collects the XML files as artifacts. Once I know that's working, I can setup a test reporting plugin to build a summary from them. --- .ci/generate-buildkite-pipeline-premerge | 4 ++-- .ci/monolithic-linux.sh | 13 + .ci/monolithic-windows.sh| 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 7676ff716c4185..e52133751f09b1 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -272,7 +272,7 @@ if [[ "${linux_projects}" != "" ]]; then artifact_paths: - 'artifacts/**/*' - '*_result.json' - - 'build/test-results.xml' + - 'build/test-results*.xml' agents: ${LINUX_AGENTS} retry: automatic: @@ -295,7 +295,7 @@ if [[ "${windows_projects}" != "" ]]; then artifact_paths: - 'artifacts/**/*' - '*_result.json' - - 'build/test-results.xml' + - 'build/test-results*.xml' agents: ${WINDOWS_AGENTS} retry: automatic: diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index b78dc59432b65c..17ea51c08fafd3 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -37,6 +37,8 @@ trap show-stats EXIT projects="${1}" targets="${2}" +lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" + echo "--- cmake" pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt @@ -47,7 +49,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_ASSERTIONS=ON \ -D LLVM_BUILD_EXAMPLES=ON \ -D COMPILER_RT_BUILD_LIBFUZZER=OFF \ - -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \ + -D LLVM_LIT_ARGS="${lit_args}" \ -D LLVM_ENABLE_LLD=ON \ -D CMAKE_CXX_FLAGS=-gmlt \ -D LLVM_CCACHE_BUILD=ON \ @@ -87,7 +89,8 @@ if [[ "${runtimes}" != "" ]]; then -D CMAKE_BUILD_TYPE=RelWithDebInfo \ -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -D LIBCXX_TEST_PARAMS="std=c++03" \ - -D LIBCXXABI_TEST_PARAMS="std=c++03" + -D LIBCXXABI_TEST_PARAMS="std=c++03" \ + -D LLVM_LIT_ARGS="${lit_args}" echo "--- ninja runtimes C++03" @@ -104,7 +107,8 @@ if [[ "${runtimes}" != "" ]]; then -D CMAKE_BUILD_TYPE=RelWithDebInfo \ -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -D LIBCXX_TEST_PARAMS="std=c++26" \ - -D LIBCXXABI_TEST_PARAMS="std=c++26" + -D LIBCXXABI_TEST_PARAMS="std=c++26" \ + -D LLVM_LIT_ARGS="${lit_args}" echo "--- ninja runtimes C++26" @@ -121,7 +125,8 @@ if [[ "${runtimes}" != "" ]]; then -D CMAKE_BUILD_TYPE=RelWithDebInfo \ -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -D LIBCXX_TEST_PARAMS="enable_modules=clang" \ - -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" + -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \ + -D LLVM_LIT_ARGS="${lit_args}" echo "--- ninja runtimes clang modules" diff --git a/.ci/monolithic-windows.sh b/.ci/monolithic-windows.sh index 91e719c52d4363..9ec44c22442d06 100755 --- a/.ci/monolithic-windows.sh +++ b/.ci/monolithic-windows.sh @@ -53,7 +53,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLVM_ENABLE_ASSERTIONS=ON \ -D LLVM_BUILD_EXAMPLES=ON \ -D COMPILER_RT_BUILD_LIBFUZZER=OFF \ - -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \ + -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" \ -D COMPILER_RT_BUILD_ORC=OFF \ -D CMAKE_C_COMPILER_LAUNCHER=sccache
[clang] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #113446)
https://github.com/anutosh491 updated https://github.com/llvm/llvm-project/pull/113446 >From a19fb1d00dfd9a3be9463396d476ef7415391a0f Mon Sep 17 00:00:00 2001 From: anutosh491 Date: Wed, 23 Oct 2024 16:58:57 +0530 Subject: [PATCH] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm --- clang/lib/Interpreter/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/lib/Interpreter/CMakeLists.txt b/clang/lib/Interpreter/CMakeLists.txt index 2cc7c59b61d318..d5ffe78251d253 100644 --- a/clang/lib/Interpreter/CMakeLists.txt +++ b/clang/lib/Interpreter/CMakeLists.txt @@ -14,6 +14,7 @@ set(LLVM_LINK_COMPONENTS if (EMSCRIPTEN AND "lld" IN_LIST LLVM_ENABLE_PROJECTS) set(WASM_SRC Wasm.cpp) + set(WASM_LINK lldWasm) endif() add_clang_library(clangInterpreter @@ -44,6 +45,7 @@ add_clang_library(clangInterpreter clangParse clangSema clangSerialization + ${WASM_LINK} ) if ((MINGW OR CYGWIN) AND BUILD_SHARED_LIBS) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)
https://github.com/vabridgers updated https://github.com/llvm/llvm-project/pull/110471 >From cb8e45215a0f8899ccdeb5deb380d97b2d92b557 Mon Sep 17 00:00:00 2001 From: Vince Bridgers Date: Thu, 26 Sep 2024 16:24:59 +0200 Subject: [PATCH] [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy This change moves the alpha.nondeterministic.PointerSorting and alpha.nondeterministic.PointerIteration static analyzer checkers to a single clang-tidy check. Those checkers were implemented as clang-tidy checks wrapped in the static analyzer framework. The documentation was updated to describe what the checks can and cannot do, and testing was completed on a broad set of open source projects. --- .../bugprone/BugproneTidyModule.cpp | 3 + .../clang-tidy/bugprone/CMakeLists.txt| 1 + ...eterministicPointerIterationOrderCheck.cpp | 85 ++ ...ndeterministicPointerIterationOrderCheck.h | 37 + clang-tools-extra/docs/ReleaseNotes.rst | 6 + ...ndeterministic-pointer-iteration-order.rst | 35 .../system-header-simulator/sim_algorithm | 31 .../system-header-simulator/sim_c++config.h | 11 ++ .../sim_initializer_list | 39 + .../system-header-simulator/sim_iterator_base | 22 +++ .../Inputs/system-header-simulator/sim_map| 34 .../Inputs/system-header-simulator/sim_set| 44 + .../system-header-simulator/sim_stl_pair | 32 .../system-header-simulator/sim_type_traits | 19 +++ .../system-header-simulator/sim_unordered_map | 33 .../system-header-simulator/sim_unordered_set | 35 .../Inputs/system-header-simulator/sim_vector | 150 ++ ...ndeterministic-pointer-iteration-order.cpp | 84 ++ clang/docs/ReleaseNotes.rst | 6 + clang/docs/analyzer/checkers.rst | 31 .../clang/StaticAnalyzer/Checkers/Checkers.td | 18 --- .../StaticAnalyzer/Checkers/CMakeLists.txt| 2 - .../Checkers/PointerIterationChecker.cpp | 101 .../Checkers/PointerSortingChecker.cpp| 115 -- clang/test/Analysis/ptr-iter.cpp | 28 clang/test/Analysis/ptr-sort.cpp | 36 - 26 files changed, 707 insertions(+), 331 deletions(-) create mode 100644 clang-tools-extra/clang-tidy/bugprone/NondeterministicPointerIterationOrderCheck.cpp create mode 100644 clang-tools-extra/clang-tidy/bugprone/NondeterministicPointerIterationOrderCheck.h create mode 100644 clang-tools-extra/docs/clang-tidy/checks/bugprone/nondeterministic-pointer-iteration-order.rst create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_algorithm create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_c++config.h create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_initializer_list create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_iterator_base create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_map create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_set create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_stl_pair create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_type_traits create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_unordered_map create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_unordered_set create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/system-header-simulator/sim_vector create mode 100644 clang-tools-extra/test/clang-tidy/checkers/bugprone/nondeterministic-pointer-iteration-order.cpp delete mode 100644 clang/lib/StaticAnalyzer/Checkers/PointerIterationChecker.cpp delete mode 100644 clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp delete mode 100644 clang/test/Analysis/ptr-iter.cpp delete mode 100644 clang/test/Analysis/ptr-sort.cpp diff --git a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp index 9120c4b6c0d9ae..33ac65e715ce81 100644 --- a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp @@ -49,6 +49,7 @@ #include "MultipleStatementMacroCheck.h" #include "NoEscapeCheck.h" #include "NonZeroEnumToBoolConversionCheck.h" +#include "NondeterministicPointerIterationOrderCheck.h" #include "NotNullTerminatedResultCheck.h" #include "OptionalValueConversionCheck.h" #include "ParentVirtualCallCheck.h" @@ -174,6 +175,8 @@ class BugproneModule :
[clang] [llvm] [mlir] [OpenMP][OMPIRBuilder] Error propagation across callbacks (PR #112533)
@@ -1171,12 +1179,15 @@ void OpenMPIRBuilder::emitCancelationCheckImpl(Value *CancelFlag, // post finalization block that is known to the FiniCB callback. Builder.SetInsertPoint(CancellationBlock); if (ExitCB) -ExitCB(Builder.saveIP()); +if (Error Err = ExitCB(Builder.saveIP())) + return std::move(Err); skatrak wrote: Thank you for the pointers @tblah, I wasn't aware of this detail. I've now removed all these redundant uses of `std::move`. https://github.com/llvm/llvm-project/pull/112533 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-repl] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #113446)
https://github.com/anutosh491 edited https://github.com/llvm/llvm-project/pull/113446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #113446)
https://github.com/anutosh491 updated https://github.com/llvm/llvm-project/pull/113446 >From 921d6d4f2acdd85d95bb8c5904177b0d39b5393b Mon Sep 17 00:00:00 2001 From: anutosh491 Date: Wed, 23 Oct 2024 16:58:57 +0530 Subject: [PATCH] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm --- clang/lib/Interpreter/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/lib/Interpreter/CMakeLists.txt b/clang/lib/Interpreter/CMakeLists.txt index 2cc7c59b61d318..d5ffe78251d253 100644 --- a/clang/lib/Interpreter/CMakeLists.txt +++ b/clang/lib/Interpreter/CMakeLists.txt @@ -14,6 +14,7 @@ set(LLVM_LINK_COMPONENTS if (EMSCRIPTEN AND "lld" IN_LIST LLVM_ENABLE_PROJECTS) set(WASM_SRC Wasm.cpp) + set(WASM_LINK lldWasm) endif() add_clang_library(clangInterpreter @@ -44,6 +45,7 @@ add_clang_library(clangInterpreter clangParse clangSema clangSerialization + ${WASM_LINK} ) if ((MINGW OR CYGWIN) AND BUILD_SHARED_LIBS) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [OpenMP][OMPIRBuilder] Error propagation across callbacks (PR #112533)
@@ -2331,8 +2332,10 @@ void CGOpenMPRuntime::emitBarrierCall(CodeGenFunction &CGF, SourceLocation Loc, auto *OMPRegionInfo = dyn_cast_or_null(CGF.CapturedStmtInfo); if (CGF.CGM.getLangOpts().OpenMPIRBuilder) { -CGF.Builder.restoreIP(OMPBuilder.createBarrier( -CGF.Builder, Kind, ForceSimpleCall, EmitChecks)); +auto Result = OMPBuilder.createBarrier(CGF.Builder, Kind, ForceSimpleCall, skatrak wrote: This is done now, thanks for the suggestion. https://github.com/llvm/llvm-project/pull/112533 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add test for CWG1898 "Use of “equivalent” in overload resolution" (PR #113439)
@@ -640,3 +640,48 @@ namespace H { struct S s; } } + +namespace cwg1898 { // cwg1898: 2.7 +void e(int) {} // #cwg1898-e-int +void e(int) {} +// expected-error@-1 {{redefinition of 'e'}} +// expected-note@#cwg1898-e-int {{previous definition is here}} +void e(long) {} + +void f(int) {} // #cwg1898-f-int +void f(const int) {} +// expected-error@-1 {{redefinition of 'f'}} +// expected-note@#cwg1898-f-int {{previous definition is here}} + +void g(int) {} // #cwg1898-g-int +void g(volatile int) {} +// since-cxx20-warning@-1 {{volatile-qualified parameter type 'volatile int' is deprecated}} +// expected-error@-2 {{redefinition of 'g'}} +// expected-note@#cwg1898-g-int {{previous definition is here}} + +void h(int *) {} // #cwg1898-h-int +void h(int[]) {} +// expected-error@-1 {{redefinition of 'h'}} +// expected-note@#cwg1898-h-int {{previous definition is here}} + +void i(int *) {} // #cwg1898-i-int +void i(int[2]) {} +// expected-error@-1 {{redefinition of 'i'}} +// expected-note@#cwg1898-i-int {{previous definition is here}} + +void j(void(*)()) {} // #cwg1898-j-int +void j(void()) {} +// expected-error@-1 {{redefinition of 'j'}} +// expected-note@#cwg1898-j-int {{previous definition is here}} + +struct A { + void k(int) {} // #cwg1898-k-int + void k(int) {} + // expected-error@-1 {{class member cannot be redeclared}} + // expected-note@#cwg1898-k-int {{previous definition is here}} +}; + +struct B : A { + void k(int) {} +}; +} // namespace cwg1898 cor3ntin wrote: you could add all the examples there as-is https://eel.is/c++draft/dcl.dcl#dcl.fct-example-2 ```cpp void g(...); void g(); ``` There are a lot of tests with explicit object parameters but I don't think we need to cover them here, there are plenty of such tests already, and the issue predates deducing this https://github.com/llvm/llvm-project/pull/113439 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [OpenMP][OMPIRBuilder] Error propagation across callbacks (PR #112533)
@@ -1496,7 +1507,8 @@ IRBuilder<>::InsertPoint OpenMPIRBuilder::createParallel( // Let the caller create the body. assert(BodyGenCB && "Expected body generation callback!"); InsertPointTy CodeGenIP(PRegBodyBB, PRegBodyBB->begin()); - BodyGenCB(InnerAllocaIP, CodeGenIP); + if (Error Err = BodyGenCB(InnerAllocaIP, CodeGenIP)) +return std::move(Err); skatrak wrote: It looks like it works as expected in this case as well (if it created a copy it would be triggering runtime failures). I see `Expected` has an implicit move constructor for an `Error` argument, so perhaps that's what's enabling this. https://github.com/llvm/llvm-project/pull/112533 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Update the lifetimebound example with up-to-date expected warning and change the sample code to be a fully working example (PR #113437)
https://github.com/bricknerb ready_for_review https://github.com/llvm/llvm-project/pull/113437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Update the lifetimebound example with up-to-date expected warning and change the sample code to be a fully working example (PR #113437)
bricknerb wrote: The Test documentation build failure seems unrelated since it refers to ClangCommandLineReference. https://github.com/llvm/llvm-project/pull/113437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 6dad29a - [CLANG][AArch64]Add Neon vectors for mfloat8_t (#99865)
Author: CarolineConcatto Date: 2024-10-23T13:23:18+01:00 New Revision: 6dad29aebc6914b32ddd17a01cbac511d2979bb9 URL: https://github.com/llvm/llvm-project/commit/6dad29aebc6914b32ddd17a01cbac511d2979bb9 DIFF: https://github.com/llvm/llvm-project/commit/6dad29aebc6914b32ddd17a01cbac511d2979bb9.diff LOG: [CLANG][AArch64]Add Neon vectors for mfloat8_t (#99865) This patch adds these new vector sizes for neon: mfloat8x16_t and mfloat8x8_t According to the ARM ACLE PR#323[1]. [1] ARM-software/acle#323 Added: clang/test/CodeGen/arm-mfp8.c Modified: clang/include/clang/Basic/AArch64SVEACLETypes.def clang/include/clang/Serialization/ASTBitCodes.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/Type.cpp clang/lib/CodeGen/CodeGenTypes.cpp clang/test/Modules/no-external-type-id.cppm clang/test/Sema/arm-mfp8.cpp clang/utils/TableGen/NeonEmitter.cpp Removed: diff --git a/clang/include/clang/Basic/AArch64SVEACLETypes.def b/clang/include/clang/Basic/AArch64SVEACLETypes.def index 2b80e43b506384..25abf5f3f86b7d 100644 --- a/clang/include/clang/Basic/AArch64SVEACLETypes.def +++ b/clang/include/clang/Basic/AArch64SVEACLETypes.def @@ -97,6 +97,17 @@ SVE_TYPE(Name, Id, SingletonId) #endif +#ifndef AARCH64_VECTOR_TYPE +#define AARCH64_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \ + SVE_TYPE(Name, Id, SingletonId) +#endif + +#ifndef AARCH64_VECTOR_TYPE_MFLOAT +#define AARCH64_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, ElBits, NF) \ + AARCH64_VECTOR_TYPE(Name, MangledName, Id, SingletonId) +#endif + + //===- Vector point types ---===// SVE_VECTOR_TYPE_INT("__SVInt8_t", "__SVInt8_t", SveInt8, SveInt8Ty, 16, 8, 1, true) @@ -190,6 +201,9 @@ SVE_PREDICATE_TYPE_ALL("__clang_svboolx4_t", "svboolx4_t", SveBoolx4, SveBoolx4T SVE_OPAQUE_TYPE("__SVCount_t", "__SVCount_t", SveCount, SveCountTy) +AARCH64_VECTOR_TYPE_MFLOAT("__MFloat8x8_t", "__MFloat8x8_t", MFloat8x8, MFloat8x8Ty, 8, 8, 1) +AARCH64_VECTOR_TYPE_MFLOAT("__MFloat8x16_t", "__MFloat8x16_t", MFloat8x16, MFloat8x16Ty, 16, 8, 1) + #undef SVE_VECTOR_TYPE #undef SVE_VECTOR_TYPE_BFLOAT #undef SVE_VECTOR_TYPE_FLOAT @@ -197,4 +211,6 @@ SVE_OPAQUE_TYPE("__SVCount_t", "__SVCount_t", SveCount, SveCountTy) #undef SVE_PREDICATE_TYPE #undef SVE_PREDICATE_TYPE_ALL #undef SVE_OPAQUE_TYPE +#undef AARCH64_VECTOR_TYPE_MFLOAT +#undef AARCH64_VECTOR_TYPE #undef SVE_TYPE diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h index e397dff097652b..13173dc96e71ae 100644 --- a/clang/include/clang/Serialization/ASTBitCodes.h +++ b/clang/include/clang/Serialization/ASTBitCodes.h @@ -1149,7 +1149,7 @@ enum PredefinedTypeIDs { /// /// Type IDs for non-predefined types will start at /// NUM_PREDEF_TYPE_IDs. -const unsigned NUM_PREDEF_TYPE_IDS = 509; +const unsigned NUM_PREDEF_TYPE_IDS = 511; // Ensure we do not overrun the predefined types we reserved // in the enum PredefinedTypeIDs above. diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 4bf8ddd762e9a5..a4e8d95035b974 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2239,6 +2239,12 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const { Width = 0; \ Align = 16; \ break; +#define AARCH64_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, \ + ElBits, NF) \ + case BuiltinType::Id: \ +Width = NumEls * ElBits * NF; \ +Align = NumEls * ElBits; \ +break; #include "clang/Basic/AArch64SVEACLETypes.def" #define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: \ @@ -4361,6 +4367,11 @@ ASTContext::getBuiltinVectorTypeInfo(const BuiltinType *Ty) const { #define SVE_PREDICATE_TYPE_ALL(Name, MangledName, Id, SingletonId, NumEls, NF) \ case BuiltinType::Id: \ return {BoolTy, llvm::ElementCount::getScalable(NumEls), NF}; +#define AARCH64_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, \ + ElBits, NF) \ + case BuiltinType::Id: \ +return {getIntTypeForBitwidth(ElBits, false), \ +llvm::ElementCount::getFixed(NumEls), NF}; #defin
[clang] [CLANG][AArch64]Add Neon vectors for mfloat8_t (PR #99865)
https://github.com/CarolineConcatto closed https://github.com/llvm/llvm-project/pull/99865 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Make -fveclib={ArmPL, SLEEF} imply -fno-math-errno (PR #112580)
@@ -3410,7 +3410,8 @@ def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group; def fveclib : Joined<["-"], "fveclib=">, Group, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>, -HelpText<"Use the given vector functions library">, +HelpText<"Use the given vector functions library." + "Note: In clang -fveclib={ArmPL,SLEEF} implies -fno-math-errno">, kiranchandramohan wrote: There is a way to specify help separately for Clang. `HelpTextForVariants<[ClangOption,CC1Option]` https://github.com/llvm/llvm-project/pull/112580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-repl] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #113446)
https://github.com/anutosh491 updated https://github.com/llvm/llvm-project/pull/113446 >From d61f58f66839652ec4c1101521c2a7297cffacff Mon Sep 17 00:00:00 2001 From: anutosh491 Date: Wed, 23 Oct 2024 16:58:57 +0530 Subject: [PATCH] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm --- clang/lib/Interpreter/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/lib/Interpreter/CMakeLists.txt b/clang/lib/Interpreter/CMakeLists.txt index 2cc7c59b61d318..d5ffe78251d253 100644 --- a/clang/lib/Interpreter/CMakeLists.txt +++ b/clang/lib/Interpreter/CMakeLists.txt @@ -14,6 +14,7 @@ set(LLVM_LINK_COMPONENTS if (EMSCRIPTEN AND "lld" IN_LIST LLVM_ENABLE_PROJECTS) set(WASM_SRC Wasm.cpp) + set(WASM_LINK lldWasm) endif() add_clang_library(clangInterpreter @@ -44,6 +45,7 @@ add_clang_library(clangInterpreter clangParse clangSema clangSerialization + ${WASM_LINK} ) if ((MINGW OR CYGWIN) AND BUILD_SHARED_LIBS) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Make -fveclib={ArmPL, SLEEF} imply -fno-math-errno (PR #112580)
https://github.com/MacDue updated https://github.com/llvm/llvm-project/pull/112580 >From ce7cac7c2fcc672abfd8ab2a49b59a73994bee64 Mon Sep 17 00:00:00 2001 From: Benjamin Maxwell Date: Wed, 2 Oct 2024 10:28:29 + Subject: [PATCH 1/8] [clang] Make -fveclib={ArmPL,SLEEF} imply -fno-math-errno These two veclibs are only available for AArch64 targets, and as mentioned in https://discourse.llvm.org/t/rfc-should-fveclib-imply-fno-math-errno-for-all-targets/81384, we (Arm) think that `-fveclib` should imply `-fno-math-errno`. By setting `-fveclib` the user shows they intend to use the vector math functions, which implies they don't care about errno. However, currently, the vector mappings won't be used in many cases without setting `-fno-math-errno` separately. Making this change would also help resolve some inconsistencies in how vector mappings are applied (see https://github.com/llvm/llvm-project/pull/108980#discussion_r176660). --- clang/include/clang/Driver/Options.td | 3 ++- clang/lib/Driver/ToolChains/Clang.cpp | 8 clang/test/Driver/fveclib.c | 7 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 70f2fb6bdc4db9..452746bbd66a00 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -3410,7 +3410,8 @@ def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group; def fveclib : Joined<["-"], "fveclib=">, Group, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>, -HelpText<"Use the given vector functions library">, +HelpText<"Use the given vector functions library." + "Note: -fveclib={ArmPL,SLEEF} implies -fno-math-errno">, Values<"Accelerate,libmvec,MASSV,SVML,SLEEF,Darwin_libsystem_m,ArmPL,AMDLIBM,none">, NormalizedValuesScope<"llvm::driver::VectorLibrary">, NormalizedValues<["Accelerate", "LIBMVEC", "MASSV", "SVML", "SLEEF", diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index d032fd7a59f330..f8527035b7ae24 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -2854,6 +2854,10 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, bool OFastEnabled, const ArgList &Args, ArgStringList &CmdArgs, const JobAction &JA) { + // List of veclibs which when used with -fveclib imply -fno-math-errno. + constexpr std::array VecLibImpliesNoMathErrno{llvm::StringLiteral("ArmPL"), +llvm::StringLiteral("SLEEF")}; + // Handle various floating point optimization flags, mapping them to the // appropriate LLVM code generation flags. This is complicated by several // "umbrella" flags, so we do this by stepping through the flags incrementally @@ -3125,6 +3129,10 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, TrappingMathPresent = true; FPExceptionBehavior = "strict"; break; +case options::OPT_fveclib: + if (llvm::is_contained(VecLibImpliesNoMathErrno, A->getValue())) +MathErrno = false; + break; case options::OPT_fno_trapping_math: if (!TrappingMathPresent && !FPExceptionBehavior.empty() && FPExceptionBehavior != "ignore") diff --git a/clang/test/Driver/fveclib.c b/clang/test/Driver/fveclib.c index 9b0f1ce13aa2bd..2a3133541e3b72 100644 --- a/clang/test/Driver/fveclib.c +++ b/clang/test/Driver/fveclib.c @@ -36,16 +36,23 @@ /* Verify that the correct vector library is passed to LTO flags. */ // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=LIBMVEC -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-LIBMVEC %s +// CHECK-LTO-LIBMVEC: "-fmath-errno" // CHECK-LTO-LIBMVEC: "-plugin-opt=-vector-library=LIBMVEC-X86" // RUN: %clang -### --target=powerpc64-unknown-linux-gnu -fveclib=MASSV -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-MASSV %s +// CHECK-LTO-MASSV: "-fmath-errno" // CHECK-LTO-MASSV: "-plugin-opt=-vector-library=MASSV" // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=SVML -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-SVML %s +// CHECK-LTO-SVML: "-fmath-errno" // CHECK-LTO-SVML: "-plugin-opt=-vector-library=SVML" // RUN: %clang -### --target=aarch64-linux-gnu -fveclib=SLEEF -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-SLEEF %s +// CHECK-LTO-SLEEF-NOT: "-fmath-errno" // CHECK-LTO-SLEEF: "-plugin-opt=-vector-library=sleefgnuabi" +// CHECK-LTO-SLEEF-NOT: "-fmath-errno" // RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-ARMPL %s +// CHECK-LTO-ARMPL-NOT: "-fmath-errno" // CHECK-LTO-ARMPL: "-plugin-opt=-vector-library=ArmPL" +// CHECK-LTO-ARMPL-NOT: "-fmath-errno" >From c30fe
[clang] [clang] Make -fveclib={ArmPL, SLEEF} imply -fno-math-errno (PR #112580)
@@ -3410,7 +3410,8 @@ def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group; def fveclib : Joined<["-"], "fveclib=">, Group, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>, -HelpText<"Use the given vector functions library">, +HelpText<"Use the given vector functions library." + "Note: In clang -fveclib={ArmPL,SLEEF} implies -fno-math-errno">, MacDue wrote: Ah thanks, done :+1: https://github.com/llvm/llvm-project/pull/112580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Apply internal buffering to clang diagnostics printing (PR #113440)
Fznamznon wrote: BTW, the test failure IS caused by the patch. It somehow caused permanent swap of what clang-tidy prints in clang-tidy-run-with-database.cpp test. Not sure why... https://github.com/llvm/llvm-project/pull/113440 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Output an error when [[lifetimebound]] attribute is applied on a function parameter while the function returns void (PR #113460)
@@ -6970,6 +6970,18 @@ static void checkAttributesAfterMerging(Sema &S, NamedDecl &ND) { } } } + +for (unsigned int I = 0; I < FD->getNumParams(); ++I) { + const ParmVarDecl *P = FD->getParamDecl(I); + + // The [[lifetimebound]] attribute can be applied to a function parameter + // only if the function returns a value. + if (auto *A = P->getAttr()) { bricknerb wrote: I believe we don't. I've checked and the return type is TemplateTypeParm so it is not considered to be void. https://github.com/llvm/llvm-project/pull/113460 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Make -stdlib= option visible to flang and silently ignored by it (PR #110598)
DavidTruby wrote: @pawosm-arm do you still need this or do the CMake configuration changes I suggested work? Can we close this if it's not needed anymore? https://github.com/llvm/llvm-project/pull/110598 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Make -stdlib= option visible to flang and silently ignored by it (PR #110598)
pawosm-arm wrote: There was a change of plans, so I don't need it now. But I expect the subject will return sooner or later raised by someone else who stumble upon this just like me. Closing it for now. https://github.com/llvm/llvm-project/pull/110598 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Output an error when [[lifetimebound]] attribute is applied on a function parameter while the function returns void (PR #113460)
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/113460 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] a91ebcd - [FMV][AArch64] Unify aes with pmull and sve2-aes with sve2-pmull128. (#111673)
Author: Alexandros Lamprineas Date: 2024-10-23T16:28:55+01:00 New Revision: a91ebcdd91cae429762bbed39f569a4016fbf2b1 URL: https://github.com/llvm/llvm-project/commit/a91ebcdd91cae429762bbed39f569a4016fbf2b1 DIFF: https://github.com/llvm/llvm-project/commit/a91ebcdd91cae429762bbed39f569a4016fbf2b1.diff LOG: [FMV][AArch64] Unify aes with pmull and sve2-aes with sve2-pmull128. (#111673) According to the Arm Architecture Reference Manual for A-profile architecture you can't have one feature without having the other: ID_AA64ZFR0_EL1.AES, bits [7:4] > FEAT_SVE_AES implements the functionality identified by the value 0b0001. > FEAT_SVE_PMULL128 implements the functionality identified by the value 0b0010. > The permitted values are 0b and 0b0010. (The following was removed from the latest release of the specification, but it appears to be a mistake that was not intended to relax the architecture constraints. The discrepancy has been reported) ID_AA64ISAR0_EL1.AES, bits [7:4] > FEAT_AES implements the functionality identified by the value 0b0001. > FEAT_PMULL implements the functionality identified by the value 0b0010. > From Armv8, the permitted values are 0b and 0b0010. Approved in ACLE as https://github.com/ARM-software/acle/pull/352 Added: Modified: clang/test/CodeGen/aarch64-cpu-supports.c clang/test/CodeGen/aarch64-fmv-dependencies.c clang/test/CodeGen/attr-target-clones-aarch64.c clang/test/CodeGen/attr-target-version.c clang/test/Sema/attr-target-clones-aarch64.c clang/test/Sema/attr-target-version.c compiler-rt/lib/builtins/cpu_model/AArch64CPUFeatures.inc compiler-rt/lib/builtins/cpu_model/aarch64/fmv/apple.inc compiler-rt/lib/builtins/cpu_model/aarch64/fmv/fuchsia.inc compiler-rt/lib/builtins/cpu_model/aarch64/fmv/mrs.inc llvm/include/llvm/TargetParser/AArch64CPUFeatures.inc llvm/lib/Target/AArch64/AArch64FMV.td Removed: diff --git a/clang/test/CodeGen/aarch64-cpu-supports.c b/clang/test/CodeGen/aarch64-cpu-supports.c index dc96c929fdf4cb..76fcea0be31581 100644 --- a/clang/test/CodeGen/aarch64-cpu-supports.c +++ b/clang/test/CodeGen/aarch64-cpu-supports.c @@ -50,7 +50,7 @@ int main(void) { if (__builtin_cpu_supports("sb")) return 1; - if (__builtin_cpu_supports("sve2-pmull128+memtag")) + if (__builtin_cpu_supports("sve2-aes+memtag")) return 2; if (__builtin_cpu_supports("sme2+ls64+wfxt")) diff --git a/clang/test/CodeGen/aarch64-fmv-dependencies.c b/clang/test/CodeGen/aarch64-fmv-dependencies.c index 9aca1b7a9daf6e..6d230007f91ff9 100644 --- a/clang/test/CodeGen/aarch64-fmv-dependencies.c +++ b/clang/test/CodeGen/aarch64-fmv-dependencies.c @@ -3,7 +3,7 @@ // RUN: %clang --target=aarch64-linux-gnu --rtlib=compiler-rt -emit-llvm -S -o - %s | FileCheck %s -// CHECK: define dso_local i32 @fmv._Maes() #[[ATTR0:[0-9]+]] { +// CHECK: define dso_local i32 @fmv._Maes() #[[aes:[0-9]+]] { __attribute__((target_version("aes"))) int fmv(void) { return 0; } // CHECK: define dso_local i32 @fmv._Mbf16() #[[bf16_ebf16:[0-9]+]] { @@ -81,9 +81,6 @@ __attribute__((target_version("memtag3"))) int fmv(void) { return 0; } // CHECK: define dso_local i32 @fmv._Mmops() #[[mops:[0-9]+]] { __attribute__((target_version("mops"))) int fmv(void) { return 0; } -// CHECK: define dso_local i32 @fmv._Mpmull() #[[pmull:[0-9]+]] { -__attribute__((target_version("pmull"))) int fmv(void) { return 0; } - // CHECK: define dso_local i32 @fmv._Mpredres() #[[predres:[0-9]+]] { __attribute__((target_version("predres"))) int fmv(void) { return 0; } @@ -150,15 +147,12 @@ __attribute__((target_version("sve-i8mm"))) int fmv(void) { return 0; } // CHECK: define dso_local i32 @fmv._Msve2() #[[sve2:[0-9]+]] { __attribute__((target_version("sve2"))) int fmv(void) { return 0; } -// CHECK: define dso_local i32 @fmv._Msve2-aes() #[[sve2_aes_sve2_pmull128:[0-9]+]] { +// CHECK: define dso_local i32 @fmv._Msve2-aes() #[[sve2_aes:[0-9]+]] { __attribute__((target_version("sve2-aes"))) int fmv(void) { return 0; } // CHECK: define dso_local i32 @fmv._Msve2-bitperm() #[[sve2_bitperm:[0-9]+]] { __attribute__((target_version("sve2-bitperm"))) int fmv(void) { return 0; } -// CHECK: define dso_local i32 @fmv._Msve2-pmull128() #[[sve2_aes_sve2_pmull128:[0-9]+]] { -__attribute__((target_version("sve2-pmull128"))) int fmv(void) { return 0; } - // CHECK: define dso_local i32 @fmv._Msve2-sha3() #[[sve2_sha3:[0-9]+]] { __attribute__((target_version("sve2-sha3"))) int fmv(void) { return 0; } @@ -177,10 +171,11 @@ int caller() { return fmv(); } -// CHECK: attributes #[[ATTR0]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[aes]] = { {{.*}} "target-features"="+aes,+fp-armv8,+neon,+outline-atomics,+v8a" // CHECK: attributes #[[bf16_ebf16]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outlin
[clang] [llvm] [mlir] [OpenMP][OMPIRBuilder] Error propagation across callbacks (PR #112533)
https://github.com/tblah approved this pull request. LGTM. Thanks for the extensive cleanup https://github.com/llvm/llvm-project/pull/112533 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [llvm] [FMV][AArch64] Unify aes with pmull and sve2-aes with sve2-pmull128. (PR #111673)
https://github.com/labrinea closed https://github.com/llvm/llvm-project/pull/111673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang/AMDGPU] Zero sized arrays not allowed in HIP device code. (PR #113470)
https://github.com/VigneshwarJ created https://github.com/llvm/llvm-project/pull/113470 Added diagnosis to throw error when zero sized arrays are used in the HIP device code. SWDEV-449592 >From 0e2ee524f5b5c19169e446c55a386a00cfb0f6bc Mon Sep 17 00:00:00 2001 From: vigneshwar jayakumar Date: Wed, 23 Oct 2024 09:20:16 -0500 Subject: [PATCH] [Clang/AMDGPU] Zero sized arrays not allowed in HIP device code. Added diagnosis to throw error when zero sized arrays are used in the HIP device code. SWDEV-449592 --- .../clang/Basic/DiagnosticSemaKinds.td| 2 +- clang/lib/Sema/SemaType.cpp | 11 .../test/SemaHIP/zero-sized-device-array.hip | 25 +++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 clang/test/SemaHIP/zero-sized-device-array.hip diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 8e4718008ece72..b5fad40294c368 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -6251,7 +6251,7 @@ def err_typecheck_invalid_restrict_invalid_pointee : Error< def ext_typecheck_zero_array_size : Extension< "zero size arrays are an extension">, InGroup; def err_typecheck_zero_array_size : Error< - "zero-length arrays are not permitted in %select{C++|SYCL device code}0">; + "zero-length arrays are not permitted in %select{C++|SYCL device code|HIP device code}0">; def err_array_size_non_int : Error<"size of array has non-integer type %0">; def err_init_element_not_constant : Error< "initializer element is not a compile-time constant">; diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 6387fe9f1129ba..3f940102da51d2 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -2259,6 +2259,17 @@ QualType Sema::BuildArrayType(QualType T, ArraySizeModifier ASM, isSFINAEContext() ? diag::err_typecheck_zero_array_size : diag::ext_typecheck_zero_array_size) << 0 << ArraySize->getSourceRange(); + +// zero sized static arrays are not allowed in HIP device functions +if (LangOpts.HIP && LangOpts.CUDAIsDevice) { + auto *FD = dyn_cast_or_null(CurContext); + if (FD && (FD->hasAttr() || + FD->hasAttr())) { +Diag(ArraySize->getBeginLoc(), diag::err_typecheck_zero_array_size) +<< 2 << ArraySize->getSourceRange(); +return QualType(); + } +} } // Is the array too large? diff --git a/clang/test/SemaHIP/zero-sized-device-array.hip b/clang/test/SemaHIP/zero-sized-device-array.hip new file mode 100644 index 00..31fc943f5ae75b --- /dev/null +++ b/clang/test/SemaHIP/zero-sized-device-array.hip @@ -0,0 +1,25 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -fsyntax-only -x hip -fcuda-is-device -verify -triple amdgcn %s +#define __device__ __attribute__((device)) +#define __host__ __attribute__((host)) +#define __global__ __attribute__((global)) +#define __shared__ __attribute__((shared)) + +__global__ void global_fun() { +float array[0]; // expected-error {{zero-length arrays are not permitted in HIP device code}} +} + +// should not throw error for host side code. +__host__ void host_fun() { +float array[0]; +} + +__host__ __device__ void host_dev_fun() +{ +float array[0]; // expected-error {{zero-length arrays are not permitted in HIP device code}} +} + +__device__ void device_fun() +{ +__shared__ float array[0]; // expected-error {{zero-length arrays are not permitted in HIP device code}} +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Catch missing format attributes (PR #105479)
https://github.com/budimirarandjelovichtec updated https://github.com/llvm/llvm-project/pull/105479 From a8a958f0aea26187a2b0faf7c6768c780799d7f5 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Fri, 5 Apr 2024 15:20:37 +0200 Subject: [PATCH] [clang] Catch missing format attributes --- clang/docs/ReleaseNotes.rst | 2 + clang/include/clang/Basic/DiagnosticGroups.td | 1 - .../clang/Basic/DiagnosticSemaKinds.td| 4 + clang/include/clang/Sema/Attr.h | 7 + clang/include/clang/Sema/Sema.h | 2 + clang/lib/Sema/SemaDecl.cpp | 2 + clang/lib/Sema/SemaDeclAttr.cpp | 222 - clang/test/Sema/attr-format-missing.c | 228 ++ clang/test/Sema/attr-format-missing.cpp | 189 +++ 9 files changed, 654 insertions(+), 3 deletions(-) create mode 100644 clang/test/Sema/attr-format-missing.c create mode 100644 clang/test/Sema/attr-format-missing.cpp diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 28bb83a1c9d60f..ee61015adb16e5 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -424,6 +424,8 @@ Improvements to Clang's diagnostics name was a reserved name, which we improperly allowed to suppress the diagnostic. +- Clang now diagnoses missing format attributes for non-template functions and class/struct/union members. (#GH60718) + Improvements to Clang's time-trace -- diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index 72eada50a56cc9..f941f3883b78d7 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -530,7 +530,6 @@ def MainReturnType : DiagGroup<"main-return-type">; def MaxUnsignedZero : DiagGroup<"max-unsigned-zero">; def MissingBraces : DiagGroup<"missing-braces">; def MissingDeclarations: DiagGroup<"missing-declarations">; -def : DiagGroup<"missing-format-attribute">; def MissingIncludeDirs : DiagGroup<"missing-include-dirs">; def MissingNoreturn : DiagGroup<"missing-noreturn">; def MultiChar : DiagGroup<"multichar">; diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 8e4718008ece72..0229e3f63e2dbb 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -1051,6 +1051,10 @@ def err_opencl_invalid_param : Error< "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">; def err_opencl_invalid_return : Error< "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">; +def warn_missing_format_attribute : Warning< + "diagnostic behavior may be improved by adding the %0 format attribute to the declaration of %1">, + InGroup>, DefaultIgnore; +def note_format_function : Note<"%0 format function">; def warn_pragma_options_align_reset_failed : Warning< "#pragma options align=reset failed: %0">, InGroup; diff --git a/clang/include/clang/Sema/Attr.h b/clang/include/clang/Sema/Attr.h index 3f0b10212789a4..37c124ca7b454a 100644 --- a/clang/include/clang/Sema/Attr.h +++ b/clang/include/clang/Sema/Attr.h @@ -123,6 +123,13 @@ inline bool isInstanceMethod(const Decl *D) { return false; } +inline bool checkIfMethodHasImplicitObjectParameter(const Decl *D) { + if (const auto *MethodDecl = dyn_cast(D)) +return MethodDecl->isInstance() && + !MethodDecl->hasCXXExplicitFunctionObjectParameter(); + return false; +} + /// Diagnose mutually exclusive attributes when present on a given /// declaration. Returns true if diagnosed. template diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 9e6b04bc3f8f7c..f46adc5334ad34 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -4574,6 +4574,8 @@ class Sema final : public SemaBase { enum class RetainOwnershipKind { NS, CF, OS }; + void DiagnoseMissingFormatAttributes(Stmt *Body, const FunctionDecl *FDecl); + UuidAttr *mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI, StringRef UuidAsWritten, MSGuidDecl *GuidDecl); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 229c9080d558ec..37fbe669364e3d 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -16037,6 +16037,8 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, } } + DiagnoseMissingFormatAttributes(Body, FD); + // We might not have found a prototype because we didn't wish to warn on // the lack of a missing prototype. Try again without the checks for // whether we want to warn on the missing prototype. diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 601c6f2eef1d9c..6
[clang] [llvm] [AArch64] Split FeatureAES to FEAT_AES and FEAT_PMULL. (PR #110816)
https://github.com/labrinea closed https://github.com/llvm/llvm-project/pull/110816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Output an error when [[lifetimebound]] attribute is applied on a function parameter while the function returns void (PR #113460)
@@ -6970,6 +6970,18 @@ static void checkAttributesAfterMerging(Sema &S, NamedDecl &ND) { } } } + +for (unsigned int I = 0; I < FD->getNumParams(); ++I) { + const ParmVarDecl *P = FD->getParamDecl(I); + + // The [[lifetimebound]] attribute can be applied to a function parameter + // only if the function returns a value. + if (auto *A = P->getAttr()) { cor3ntin wrote: I think if the type is dependent, the check should be skipped. Hopefully the check is then run upon instantiation https://github.com/llvm/llvm-project/pull/113460 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CLANG][AArch64]Add Neon vectors for mfloat8_t (PR #99865)
kazutakahirata wrote: lldb is failing to build with: ``` lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4888:13: error: enumeration values 'MFloat8x8' and 'MFloat8x16' not handled in switch [-Werror,-Wswitch] switch (llvm::cast(qual_type)->getKind()) { ^~~~ 1 error generated. ``` Would you mind taking a look? Thanks! https://github.com/llvm/llvm-project/pull/99865 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [openmp] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)
@@ -0,0 +1,77 @@ +// RUN: %libomptarget-compile-generic -fprofile-instr-generate \ +// RUN: -Xclang "-fprofile-instrument=clang" +// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic \ +// RUN: --check-prefix="CLANG-PGO" +// RUN: %libomptarget-compile-generic -fprofile-generate \ +// RUN: -Xclang "-fprofile-instrument=llvm" +// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic \ +// RUN: --check-prefix="LLVM-PGO" + +// UNSUPPORTED: x86_64-pc-linux-gnu +// UNSUPPORTED: x86_64-pc-linux-gnu-LTO +// UNSUPPORTED: aarch64-unknown-linux-gnu +// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO +// REQUIRES: pgo + +#ifdef _OPENMP +#include +#endif + +int test1(int a) { return a / 2; } +int test2(int a) { return a * 2; } + +int main() { + int m = 2; +#pragma omp target + for (int i = 0; i < 10; i++) { +m = test1(m); +for (int j = 0; j < 2; j++) { + m = test2(m); +} + } +} + +// CLANG-PGO: Counters = +// CLANG-PGO-NEXT: [ 0 11 20 ] +// CLANG-PGO-NEXT: [ 10 ] +// CLANG-PGO-NEXT: [ 20 ] +// CLANG-PGO-NEXT: == Data === +// CLANG-PGO-NEXT: { {{[0-9]*}} {{[0-9]*}} +// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}} +// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}} +// CLANG-PGO-SAME: {{[0-9]*}} {{[0-9]*}} {{[0-9]*}} } +// CLANG-PGO-NEXT: { {{[0-9]*}} {{[0-9]*}} +// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}} +// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}} +// CLANG-PGO-SAME: {{[0-9]*}} {{[0-9]*}} {{[0-9]*}} } +// CLANG-PGO-NEXT: { {{[0-9]*}} {{[0-9]*}} +// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}} +// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}} +// CLANG-PGO-SAME: {{[0-9]*}} {{[0-9]*}} {{[0-9]*}} } +// CLANG-PGO-NEXT: Functions +// CLANG-PGO-NEXT: pgo1.c: +// CLANG-PGO-SAME: __omp_offloading_{{[_0-9a-zA-Z]*}}_main_{{[_0-9a-zA-Z]*}} +// CLANG-PGO-NEXT: test1 +// CLANG-PGO-NEXT: test2 + +// LLVM-PGO: Counters = +// LLVM-PGO-NEXT: [ 20 ] +// LLVM-PGO-NEXT: [ 10 ] +// LLVM-PGO-NEXT: [ 20 10 1 1 ] doru1004 wrote: @EthanLuisMcDonough https://github.com/llvm/llvm-project/pull/76587 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits