[PATCH] D117977: WIP: [cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore

2022-01-22 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 created this revision.
Ericson2314 added reviewers: beanz, compnerd, phosek.
Herald added subscribers: ayermolo, sdasgup3, wenzhicui, wrengr, Chia-hungDuan, 
dcaballe, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, 
grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, 
antiagainst, shauheen, mravishankar, rriddle, mehdi_amini, mgorny.
Herald added a reviewer: antiagainst.
Herald added a reviewer: sscalpone.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a project: Flang.
Ericson2314 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, openmp-commits, cfe-commits, yota9, 
sstefan1, stephenneuendorffer, nicolasvasilache, jdoerfert.
Herald added projects: clang, OpenMP, MLIR, LLVM.

First of all, `LLVM_TOOLS_INSTALL_DIR` put there breaks our NixOS
builds, because `LLVM_TOOLS_INSTALL_DIR` defined the same as
`CMAKE_INSTALL_BINDIR` becomes an *absolute* path, and then when
downstream projects try to install there too this breaks because our
builds always install to fresh directories for isolation's sake.

Second of all, note that `LLVM_TOOLS_INSTALL_DIR` stands out against the
other specially crafted `LLVM_CONFIG_*` variables substituted in
`llvm/cmake/modules/LLVMConfig.cmake.in`.

@beanz added it in d0e1c2a550ef348aae036d0fe78cab6f038c420c to fix a
dangling reference in `AddLLVM`, but I am suspicious of how this
variable doesn't follow the pattern.

Those other ones are carefully made to be build-time vs install-time
variables depending on which `LLVMConfig.cmake` is being generated, are
carefully made relative as appropriate, etc. etc. For my NixOS use-case
they are also fine because they are never used as downstream install
variables, only for reading not writing.

To avoid the problems I face, and restore symmetry, I deleted the
exported and arranged to have many `${project}_TOOLS_INSTALL_DIR`s.
`AddLLVM` now instead expects each project to define its own, and they
do so based on `CMAKE_INSTALL_BINDIR`. `LLVMConfig` still exports
`LLVM_TOOLS_BINARY_DIR` which is the location for the tools defined in
the usual way, matching the other remaining exported variables.

For the `AddLLVM` changes, I tried to copy the existing pattern of
internal vs non-internal or for LLVM vs for downstream function/macro
names, but it would good to confirm I did that correctly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117977

Files:
  bolt/tools/CMakeLists.txt
  bolt/tools/driver/CMakeLists.txt
  bolt/tools/merge-fdata/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  flang/CMakeLists.txt
  flang/cmake/modules/AddFlang.cmake
  lld/CMakeLists.txt
  lld/cmake/modules/AddLLD.cmake
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/CMakeLists.txt
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/cmake/modules/TableGen.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  mlir/tools/mlir-cpu-runner/CMakeLists.txt
  mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
  mlir/tools/mlir-lsp-server/CMakeLists.txt
  mlir/tools/mlir-opt/CMakeLists.txt
  mlir/tools/mlir-pdll/CMakeLists.txt
  mlir/tools/mlir-reduce/CMakeLists.txt
  mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt
  mlir/tools/mlir-translate/CMakeLists.txt
  mlir/tools/mlir-vulkan-runner/CMakeLists.txt
  openmp/libomptarget/tools/deviceinfo/CMakeLists.txt
  openmp/tools/CMakeLists.txt

Index: openmp/tools/CMakeLists.txt
===
--- openmp/tools/CMakeLists.txt
+++ openmp/tools/CMakeLists.txt
@@ -1,3 +1,17 @@
+set(OPENMP_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
+"Path for binary subdirectory (defaults to '${CMAKE_INSTALL_BINDIR}')")
+mark_as_advanced(OPENMP_TOOLS_INSTALL_DIR)
+
+# Move these macros to AddOpenMP if such a CMake module is ever created.
+
+macro(add_openmp_tool name)
+  llvm_add_tool(OPENMP ${ARGV})
+endmacro()
+
+macro(add_openmp_tool_symlink name)
+  llvm_add_tool_symlink(OPENMP ${ARGV})
+endmacro()
+
 # Discover the tools that use CMake in the subdirectories.
 # Note that explicit cmake invocation is required every time a new tool
 # is added or removed.
Index: openmp/libomptarget/tools/deviceinfo/CMakeLists.txt
===
--- openmp/libomptarget/tools/deviceinfo/CMakeLists.txt
+++ openmp/libomptarget/tools/deviceinfo/CMakeLists.txt
@@ -12,7 +12,7 @@
 
 libomptarget_say("Building the llvm-omp-device-info tool")
 
-add_llvm_tool(llvm-omp-device-info llvm-omp-device-info.cpp)
+llvm_add_tool(OPENMP llvm-omp-device-info llvm-omp-device-info.cpp)
 
 llvm_update_compile_flags(llvm-omp-device-info)
 
Index: mlir/tools/mlir-vulkan-runner/CMakeLists.txt
===
--- mlir/tools/mlir-vulkan-runner/CMakeLists.txt
+++ 

[PATCH] D117939: [clang-tidy] Add more documentation about check development

2022-01-22 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: clang-tools-extra/docs/clang-tidy/Contributing.rst:232
+
+If your check applies only to specific dialect of C or C++, you will
+want to override the method ``isLanguageVersionSupported`` to reflect that.

Objective-C is also supported.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117939/new/

https://reviews.llvm.org/D117939

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117939: [clang-tidy] Add more documentation about check development

2022-01-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 402284.
LegalizeAdulthood added a comment.

Clarify ninja build example


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117939/new/

https://reviews.llvm.org/D117939

Files:
  clang-tools-extra/docs/clang-tidy/Contributing.rst

Index: clang-tools-extra/docs/clang-tidy/Contributing.rst
===
--- clang-tools-extra/docs/clang-tidy/Contributing.rst
+++ clang-tools-extra/docs/clang-tidy/Contributing.rst
@@ -22,6 +22,8 @@
 check, it will create the check, update the CMake file and create a test;
   * ``rename_check.py`` does what the script name suggests, renames an existing
 check;
+  * :program:`pp-trace` logs method calls on `PPCallbacks` for a source file
+and is invaluable in understanding the preprocessor mechanism;
   * :program:`clang-query` is invaluable for interactive prototyping of AST
 matchers and exploration of the Clang AST;
   * `clang-check`_ with the ``-ast-dump`` (and optionally ``-ast-dump-filter``)
@@ -70,6 +72,13 @@
 .. _Using Clang Tools: https://clang.llvm.org/docs/ClangTools.html
 .. _How To Setup Clang Tooling For LLVM: https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
 
+When you `configure the CMake build `_,
+make sure that you enable the ``clang-tools-extra`` project to build :program:`clang-tidy`.
+Since your new check will have associated documentation, you will also want to install
+`Sphinx `_ and enable it in the CMake configuration.
+To save build time of the core Clang libraries you may want to only enable the ``X86``
+target in the CMake configuration.
+
 
 The Directory Structure
 ---
@@ -215,11 +224,194 @@
 and `clang-tidy/google/ExplicitConstructorCheck.cpp
 `_).
 
+If you need to interact macros and preprocessor directives, you will want to
+override the method ``registerPPCallbacks``.  The ``add_new_check.py`` script
+does not generate an override for this method in the starting point for your
+new check.
+
+If your check applies only to specific dialect of C or C++, you will
+want to override the method ``isLanguageVersionSupported`` to reflect that.
+
+Check development tips
+--
+
+Writing your first check can be a daunting task, particularly if you are unfamiliar
+with the LLVM and Clang code bases.  Here are some suggestions for orienting yourself
+in the codebase and working on your check incrementally.
+
+Guide to useful documentation
+^
+
+Many of the support classes created for LLVM are used by Clang, such as `StringRef
+`_
+and `SmallVector `_.
+These and other commonly used classes are described in the `Important and useful LLVM APIs
+`_ and
+`Picking the Right Data Structure for the Task
+`_
+sections of the `LLVM Programmer's Manual
+`_.  You don't need to memorize all the
+details of these classes; the generated `doxygen documentation `_
+has everything if you need it.  In the header `LLVM/ADT/STLExtras.h
+`_ you'll find useful versions of the STL
+algorithms that operate on LLVM containers, such as `llvm::all_of
+`_.
+
+Clang is implemented on top of LLVM and introduces its own set of classes that you
+will interact with while writing your check.  The most important of these are the
+classes relating the source code locations, source files, ranges of source locations
+and the `SourceManager
+`_ class.  These and
+other topics are described in the `"Clang" CFE Internals Manual
+`_.  Whereas the doxygen generated
+documentation serves as a reference to the internals of Clang, this document serves
+as a guide to other developers.  Topics in that manual of interest to a check developer
+are:
+
+- `The Clang "Basic" Library
+  `_ for
+  information about diagnostics, fix-it hints and source locations.
+- `The Lexer and Preprocessor Library
+  `_
+  for information about tokens, lexing (transforming characters into tokens) and the
+  preprocessor.
+- `The AST Library
+  

[PATCH] D117939: [clang-tidy] Add more documentation about check development

2022-01-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 402283.
LegalizeAdulthood added a comment.

Update from review comments


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117939/new/

https://reviews.llvm.org/D117939

Files:
  clang-tools-extra/docs/clang-tidy/Contributing.rst

Index: clang-tools-extra/docs/clang-tidy/Contributing.rst
===
--- clang-tools-extra/docs/clang-tidy/Contributing.rst
+++ clang-tools-extra/docs/clang-tidy/Contributing.rst
@@ -22,6 +22,8 @@
 check, it will create the check, update the CMake file and create a test;
   * ``rename_check.py`` does what the script name suggests, renames an existing
 check;
+  * :program:`pp-trace` logs method calls on `PPCallbacks` for a source file
+and is invaluable in understanding the preprocessor mechanism;
   * :program:`clang-query` is invaluable for interactive prototyping of AST
 matchers and exploration of the Clang AST;
   * `clang-check`_ with the ``-ast-dump`` (and optionally ``-ast-dump-filter``)
@@ -70,6 +72,13 @@
 .. _Using Clang Tools: https://clang.llvm.org/docs/ClangTools.html
 .. _How To Setup Clang Tooling For LLVM: https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
 
+When you `configure the CMake build `_,
+make sure that you enable the ``clang-tools-extra`` project to build :program:`clang-tidy`.
+Since your new check will have associated documentation, you will also want to install
+`Sphinx `_ and enable it in the CMake configuration.
+To save build time of the core Clang libraries you may want to only enable the ``X86``
+target in the CMake configuration.
+
 
 The Directory Structure
 ---
@@ -215,11 +224,194 @@
 and `clang-tidy/google/ExplicitConstructorCheck.cpp
 `_).
 
+If you need to interact macros and preprocessor directives, you will want to
+override the method ``registerPPCallbacks``.  The ``add_new_check.py`` script
+does not generate an override for this method in the starting point for your
+new check.
+
+If your check applies only to specific dialect of C or C++, you will
+want to override the method ``isLanguageVersionSupported`` to reflect that.
+
+Check development tips
+--
+
+Writing your first check can be a daunting task, particularly if you are unfamiliar
+with the LLVM and Clang code bases.  Here are some suggestions for orienting yourself
+in the codebase and working on your check incrementally.
+
+Guide to useful documentation
+^
+
+Many of the support classes created for LLVM are used by Clang, such as `StringRef
+`_
+and `SmallVector `_.
+These and other commonly used classes are described in the `Important and useful LLVM APIs
+`_ and
+`Picking the Right Data Structure for the Task
+`_
+sections of the `LLVM Programmer's Manual
+`_.  You don't need to memorize all the
+details of these classes; the generated `doxygen documentation `_
+has everything if you need it.  In the header `LLVM/ADT/STLExtras.h
+`_ you'll find useful versions of the STL
+algorithms that operate on LLVM containers, such as `llvm::all_of
+`_.
+
+Clang is implemented on top of LLVM and introduces its own set of classes that you
+will interact with while writing your check.  The most important of these are the
+classes relating the source code locations, source files, ranges of source locations
+and the `SourceManager
+`_ class.  These and
+other topics are described in the `"Clang" CFE Internals Manual
+`_.  Whereas the doxygen generated
+documentation serves as a reference to the internals of Clang, this document serves
+as a guide to other developers.  Topics in that manual of interest to a check developer
+are:
+
+- `The Clang "Basic" Library
+  `_ for
+  information about diagnostics, fix-it hints and source locations.
+- `The Lexer and Preprocessor Library
+  `_
+  for information about tokens, lexing (transforming characters into tokens) and the
+  preprocessor.
+- `The AST Library
+  

[PATCH] D117860: [RISCV] Remove experimental prefix from rvv-related extensions.

2022-01-22 Thread Yueh-Ting Chen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3cf15af2daa9: [RISCV] Remove experimental prefix from 
rvv-related extensions. (authored by eopXD).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117860/new/

https://reviews.llvm.org/D117860

Files:
  clang/test/CodeGen/RISCV/riscv-attr-builtin-alias-err.c
  clang/test/CodeGen/RISCV/riscv-attr-builtin-alias.c
  clang/test/CodeGen/RISCV/riscv-inline-asm-rvv.c
  clang/test/CodeGen/RISCV/riscv-v-debuginfo.c
  clang/test/CodeGen/RISCV/riscv-v-lifetime.cpp
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vaadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vadc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vand.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vasub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vcompress.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vcpop.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vdiv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfabs.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfclass.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfcvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfdiv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfirst.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmax.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmerge.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmin.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfncvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfneg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfnmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfnmadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfnmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfnmsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfrdiv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfrec7.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfredmax.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfredmin.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfredsum.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfrsqrt7.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfrsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfsgnj.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfslide1down.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfslide1up.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfsqrt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwcvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwnmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwnmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwredsum.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vget.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vid.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/viota.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vle.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vloxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vloxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlse.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlsegff.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlsseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vluxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vluxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmadc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmand.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmax.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmerge.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmfeq.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmfge.c
  

[PATCH] D115942: [X86][MS] Change the alignment of f80 to 16 bytes on Windows 32bits to match with ICC

2022-01-22 Thread Phoebe Wang via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG37d1d02200b9: [X86][MS] Change the alignment of f80 to 16 
bytes on Windows 32bits to match… (authored by pengfei).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115942/new/

https://reviews.llvm.org/D115942

Files:
  clang/lib/Basic/Targets/X86.h
  clang/test/CodeGen/target-data.c
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/test/Bitcode/upgrade-datalayout3.ll
  llvm/test/Bitcode/upgrade-datalayout4.ll
  llvm/test/CodeGen/X86/long-double-abi-align.ll
  llvm/test/CodeGen/X86/scalar-fp-to-i32.ll
  llvm/test/CodeGen/X86/scalar-fp-to-i64.ll
  llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp

Index: llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp
===
--- llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp
+++ llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp
@@ -24,7 +24,7 @@
   EXPECT_EQ(DL1, "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64"
  "-f80:128-n8:16:32:64-S128");
   EXPECT_EQ(DL2, "e-m:w-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64"
- "-f80:32-n8:16:32-S32");
+ "-f80:128-n8:16:32-S32");
   EXPECT_EQ(DL3, "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128"
  "-n32:64-S128");
 
Index: llvm/test/CodeGen/X86/scalar-fp-to-i64.ll
===
--- llvm/test/CodeGen/X86/scalar-fp-to-i64.ll
+++ llvm/test/CodeGen/X86/scalar-fp-to-i64.ll
@@ -909,8 +909,8 @@
 ; X86-AVX512-WIN:   # %bb.0:
 ; X86-AVX512-WIN-NEXT:pushl %ebp
 ; X86-AVX512-WIN-NEXT:movl %esp, %ebp
-; X86-AVX512-WIN-NEXT:andl $-8, %esp
-; X86-AVX512-WIN-NEXT:subl $8, %esp
+; X86-AVX512-WIN-NEXT:andl $-16, %esp
+; X86-AVX512-WIN-NEXT:subl $16, %esp
 ; X86-AVX512-WIN-NEXT:fldt 8(%ebp)
 ; X86-AVX512-WIN-NEXT:flds __real@5f00
 ; X86-AVX512-WIN-NEXT:xorl %edx, %edx
@@ -985,8 +985,8 @@
 ; X86-SSE3-WIN:   # %bb.0:
 ; X86-SSE3-WIN-NEXT:pushl %ebp
 ; X86-SSE3-WIN-NEXT:movl %esp, %ebp
-; X86-SSE3-WIN-NEXT:andl $-8, %esp
-; X86-SSE3-WIN-NEXT:subl $8, %esp
+; X86-SSE3-WIN-NEXT:andl $-16, %esp
+; X86-SSE3-WIN-NEXT:subl $16, %esp
 ; X86-SSE3-WIN-NEXT:fldt 8(%ebp)
 ; X86-SSE3-WIN-NEXT:flds __real@5f00
 ; X86-SSE3-WIN-NEXT:xorl %edx, %edx
@@ -1061,8 +1061,8 @@
 ; X86-SSE2-WIN:   # %bb.0:
 ; X86-SSE2-WIN-NEXT:pushl %ebp
 ; X86-SSE2-WIN-NEXT:movl %esp, %ebp
-; X86-SSE2-WIN-NEXT:andl $-8, %esp
-; X86-SSE2-WIN-NEXT:subl $16, %esp
+; X86-SSE2-WIN-NEXT:andl $-16, %esp
+; X86-SSE2-WIN-NEXT:subl $32, %esp
 ; X86-SSE2-WIN-NEXT:fldt 8(%ebp)
 ; X86-SSE2-WIN-NEXT:flds __real@5f00
 ; X86-SSE2-WIN-NEXT:xorl %edx, %edx
@@ -1161,8 +1161,8 @@
 ; X87-WIN:   # %bb.0:
 ; X87-WIN-NEXT:pushl %ebp
 ; X87-WIN-NEXT:movl %esp, %ebp
-; X87-WIN-NEXT:andl $-8, %esp
-; X87-WIN-NEXT:subl $16, %esp
+; X87-WIN-NEXT:andl $-16, %esp
+; X87-WIN-NEXT:subl $32, %esp
 ; X87-WIN-NEXT:fldt 8(%ebp)
 ; X87-WIN-NEXT:flds __real@5f00
 ; X87-WIN-NEXT:fucom %st(1)
@@ -1235,8 +1235,8 @@
 ; X86-AVX512-WIN:   # %bb.0:
 ; X86-AVX512-WIN-NEXT:pushl %ebp
 ; X86-AVX512-WIN-NEXT:movl %esp, %ebp
-; X86-AVX512-WIN-NEXT:andl $-8, %esp
-; X86-AVX512-WIN-NEXT:subl $8, %esp
+; X86-AVX512-WIN-NEXT:andl $-16, %esp
+; X86-AVX512-WIN-NEXT:subl $16, %esp
 ; X86-AVX512-WIN-NEXT:fldt 8(%ebp)
 ; X86-AVX512-WIN-NEXT:fisttpll (%esp)
 ; X86-AVX512-WIN-NEXT:movl (%esp), %eax
@@ -1275,8 +1275,8 @@
 ; X86-SSE3-WIN:   # %bb.0:
 ; X86-SSE3-WIN-NEXT:pushl %ebp
 ; X86-SSE3-WIN-NEXT:movl %esp, %ebp
-; X86-SSE3-WIN-NEXT:andl $-8, %esp
-; X86-SSE3-WIN-NEXT:subl $8, %esp
+; X86-SSE3-WIN-NEXT:andl $-16, %esp
+; X86-SSE3-WIN-NEXT:subl $16, %esp
 ; X86-SSE3-WIN-NEXT:fldt 8(%ebp)
 ; X86-SSE3-WIN-NEXT:fisttpll (%esp)
 ; X86-SSE3-WIN-NEXT:movl (%esp), %eax
@@ -1315,8 +1315,8 @@
 ; X86-SSE2-WIN:   # %bb.0:
 ; X86-SSE2-WIN-NEXT:pushl %ebp
 ; X86-SSE2-WIN-NEXT:movl %esp, %ebp
-; X86-SSE2-WIN-NEXT:andl $-8, %esp
-; X86-SSE2-WIN-NEXT:subl $16, %esp
+; X86-SSE2-WIN-NEXT:andl $-16, %esp
+; X86-SSE2-WIN-NEXT:subl $32, %esp
 ; X86-SSE2-WIN-NEXT:fldt 8(%ebp)
 ; X86-SSE2-WIN-NEXT:fnstcw {{[0-9]+}}(%esp)
 ; X86-SSE2-WIN-NEXT:movzwl {{[0-9]+}}(%esp), %eax
@@ -1379,8 +1379,8 @@
 ; X87-WIN:   # %bb.0:
 ; X87-WIN-NEXT:pushl %ebp
 ; X87-WIN-NEXT:movl %esp, %ebp
-; X87-WIN-NEXT:andl $-8, %esp
-; X87-WIN-NEXT:subl $16, %esp
+; X87-WIN-NEXT:andl $-16, %esp
+; X87-WIN-NEXT:subl $32, %esp
 ; X87-WIN-NEXT:fldt 8(%ebp)
 ; X87-WIN-NEXT:fnstcw {{[0-9]+}}(%esp)
 ; X87-WIN-NEXT:movzwl {{[0-9]+}}(%esp), %eax
Index: 

[PATCH] D117939: [clang-tidy] Add more documentation about check development

2022-01-22 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: clang-tools-extra/docs/clang-tidy/Contributing.rst:232
+
+If your check applies only to specific versions of the C++ standard, you will
+want to override the method ``isLanguageVersionSupported`` to reflect that.

Other languages and their versions are applicable too.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117939/new/

https://reviews.llvm.org/D117939

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 37d1d02 - [X86][MS] Change the alignment of f80 to 16 bytes on Windows 32bits to match with ICC

2022-01-22 Thread Phoebe Wang via cfe-commits

Author: Phoebe Wang
Date: 2022-01-23T09:58:46+08:00
New Revision: 37d1d02200b9472082304c191f396f0489d00e05

URL: 
https://github.com/llvm/llvm-project/commit/37d1d02200b9472082304c191f396f0489d00e05
DIFF: 
https://github.com/llvm/llvm-project/commit/37d1d02200b9472082304c191f396f0489d00e05.diff

LOG: [X86][MS] Change the alignment of f80 to 16 bytes on Windows 32bits to 
match with ICC

MSVC currently doesn't support 80 bits long double. ICC supports it when
the option `/Qlong-double` is specified. Changing the alignment of f80
to 16 bytes so that we can be compatible with ICC's option.

Reviewed By: rnk, craig.topper

Differential Revision: https://reviews.llvm.org/D115942

Added: 
llvm/test/Bitcode/upgrade-datalayout4.ll

Modified: 
clang/lib/Basic/Targets/X86.h
clang/test/CodeGen/target-data.c
llvm/lib/IR/AutoUpgrade.cpp
llvm/lib/Target/X86/X86TargetMachine.cpp
llvm/test/Bitcode/upgrade-datalayout3.ll
llvm/test/CodeGen/X86/long-double-abi-align.ll
llvm/test/CodeGen/X86/scalar-fp-to-i32.ll
llvm/test/CodeGen/X86/scalar-fp-to-i64.ll
llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index c952b8c9a3369..d1b66432e38b4 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -533,11 +533,12 @@ class LLVM_LIBRARY_VISIBILITY WindowsX86_32TargetInfo
 DoubleAlign = LongLongAlign = 64;
 bool IsWinCOFF =
 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
-resetDataLayout(IsWinCOFF ? "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:"
-"64-i64:64-f80:32-n8:16:32-a:0:32-S32"
-  : "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:"
-"64-i64:64-f80:32-n8:16:32-a:0:32-S32",
-IsWinCOFF ? "_" : "");
+bool IsMSVC = getTriple().isWindowsMSVCEnvironment();
+std::string Layout = IsWinCOFF ? "e-m:x" : "e-m:e";
+Layout += "-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-";
+Layout += IsMSVC ? "f80:128" : "f80:32";
+Layout += "-n8:16:32-a:0:32-S32";
+resetDataLayout(Layout, IsWinCOFF ? "_" : "");
   }
 };
 

diff  --git a/clang/test/CodeGen/target-data.c 
b/clang/test/CodeGen/target-data.c
index d702f845112bd..e4150837279ce 100644
--- a/clang/test/CodeGen/target-data.c
+++ b/clang/test/CodeGen/target-data.c
@@ -8,7 +8,7 @@
 
 // RUN: %clang_cc1 -triple i686-unknown-win32 -emit-llvm -o - %s | \
 // RUN: FileCheck --check-prefix=I686-WIN32 %s
-// I686-WIN32: target datalayout = 
"e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"
+// I686-WIN32: target datalayout = 
"e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32-a:0:32-S32"
 
 // RUN: %clang_cc1 -triple i686-unknown-cygwin -emit-llvm -o - %s | \
 // RUN: FileCheck --check-prefix=I686-CYGWIN %s

diff  --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 5aa3b3008581f..b820eabf173d7 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -4576,18 +4576,31 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, 
StringRef TT) {
 return DL.empty() ? std::string("G1") : (DL + "-G1").str();
   }
 
+  std::string Res = DL.str();
+  if (!T.isX86())
+return Res;
+
+  // If the datalayout matches the expected format, add pointer size address
+  // spaces to the datalayout.
   std::string AddrSpaces = "-p270:32:32-p271:32:32-p272:64:64";
-  // If X86, and the datalayout matches the expected format, add pointer size
-  // address spaces to the datalayout.
-  if (!T.isX86() || DL.contains(AddrSpaces))
-return std::string(DL);
+  if (!DL.contains(AddrSpaces)) {
+SmallVector Groups;
+Regex R("(e-m:[a-z](-p:32:32)?)(-[if]64:.*$)");
+if (R.match(DL, ))
+  Res = (Groups[1] + AddrSpaces + Groups[3]).str();
+  }
 
-  SmallVector Groups;
-  Regex R("(e-m:[a-z](-p:32:32)?)(-[if]64:.*$)");
-  if (!R.match(DL, ))
-return std::string(DL);
+  // For 32-bit MSVC targets, raise the alignment of f80 values to 16 bytes.
+  // Raising the alignment is safe because Clang did not produce f80 values in
+  // the MSVC environment before this upgrade was added.
+  if (T.isWindowsMSVCEnvironment() && !T.isArch64Bit()) {
+StringRef Ref = Res;
+auto I = Ref.find("-f80:32-");
+if (I != StringRef::npos)
+  Res = (Ref.take_front(I) + "-f80:128-" + Ref.drop_front(I + 8)).str();
+  }
 
-  return (Groups[1] + AddrSpaces + Groups[3]).str();
+  return Res;
 }
 
 void llvm::UpgradeAttributes(AttrBuilder ) {

diff  --git a/llvm/lib/Target/X86/X86TargetMachine.cpp 
b/llvm/lib/Target/X86/X86TargetMachine.cpp
index 78bc5519c23ff..e3d0128dd73da 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -127,7 +127,7 @@ static std::string 

[PATCH] D116882: [docs] [clang] Small documentation change for compilation databases

2022-01-22 Thread Shoaib Meenai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb8467952404c: [docs] [clang] Small documentation change for 
compilation databases (authored by croepha, committed by smeenai).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116882/new/

https://reviews.llvm.org/D116882

Files:
  clang/docs/JSONCompilationDatabase.rst


Index: clang/docs/JSONCompilationDatabase.rst
===
--- clang/docs/JSONCompilationDatabase.rst
+++ clang/docs/JSONCompilationDatabase.rst
@@ -29,6 +29,10 @@
 Supported Systems
 =
 
+Clang has the ablity to generate compilation database fragments via
+the :option:`-MJ argument >`. You can concatenate those
+fragments together between ``[`` and ``]`` to create a compilation database.
+
 Currently `CMake `_ (since 2.8.5) supports generation
 of compilation databases for Unix Makefile builds (Ninja builds in the
 works) with the option ``CMAKE_EXPORT_COMPILE_COMMANDS``.


Index: clang/docs/JSONCompilationDatabase.rst
===
--- clang/docs/JSONCompilationDatabase.rst
+++ clang/docs/JSONCompilationDatabase.rst
@@ -29,6 +29,10 @@
 Supported Systems
 =
 
+Clang has the ablity to generate compilation database fragments via
+the :option:`-MJ argument >`. You can concatenate those
+fragments together between ``[`` and ``]`` to create a compilation database.
+
 Currently `CMake `_ (since 2.8.5) supports generation
 of compilation databases for Unix Makefile builds (Ninja builds in the
 works) with the option ``CMAKE_EXPORT_COMPILE_COMMANDS``.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] b846795 - [docs] [clang] Small documentation change for compilation databases

2022-01-22 Thread Shoaib Meenai via cfe-commits

Author: Dave
Date: 2022-01-22T17:30:34-08:00
New Revision: b8467952404c3598c9c901332607eb1886e1721c

URL: 
https://github.com/llvm/llvm-project/commit/b8467952404c3598c9c901332607eb1886e1721c
DIFF: 
https://github.com/llvm/llvm-project/commit/b8467952404c3598c9c901332607eb1886e1721c.diff

LOG: [docs] [clang] Small documentation change for compilation databases

We have an page dedicated to compliation databases including
various ways to generate them, but we don't mention that clang
has a built in method to do this.  This addresses that.

Reviewed By: joerg

Differential Revision: https://reviews.llvm.org/D116882

Added: 


Modified: 
clang/docs/JSONCompilationDatabase.rst

Removed: 




diff  --git a/clang/docs/JSONCompilationDatabase.rst 
b/clang/docs/JSONCompilationDatabase.rst
index 3595cf452f4ca..6fd17fe440add 100644
--- a/clang/docs/JSONCompilationDatabase.rst
+++ b/clang/docs/JSONCompilationDatabase.rst
@@ -29,6 +29,10 @@ system is not necessarily the best solution:
 Supported Systems
 =
 
+Clang has the ablity to generate compilation database fragments via
+the :option:`-MJ argument >`. You can concatenate those
+fragments together between ``[`` and ``]`` to create a compilation database.
+
 Currently `CMake `_ (since 2.8.5) supports generation
 of compilation databases for Unix Makefile builds (Ninja builds in the
 works) with the option ``CMAKE_EXPORT_COMPILE_COMMANDS``.



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D112646: [clang-tidy] Add `readability-container-contains` check

2022-01-22 Thread Adrian Vogelsgesang via Phabricator via cfe-commits
avogelsgesang added a comment.

@xazax.hun ping re merging this to `main`. Would be amazing to get this in 
still in time for clang 14.

In case it makes merging easier for you, there is a copy of this commit on 
https://github.com/vogelsgesang/llvm-project/commits/avogelsgesang-tidy-readability-container-contains


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112646/new/

https://reviews.llvm.org/D112646

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D7982: [clang-tidy] Add readability-duplicate-include check

2022-01-22 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

In D7982#3263920 , @LegalizeAdulthood 
wrote:

> In D7982#3263790 , @carlosgalvezp 
> wrote:
>
>> Great patch, thanks!!
>
> Can you mark the patch as accepted in phabricator?
> Thanks

I did do that and it shows that I have accepted the revision, what else should 
I do?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7982/new/

https://reviews.llvm.org/D7982

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117973: [cmake] Support custom package install paths

2022-01-22 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 created this revision.
Ericson2314 added reviewers: compnerd, phosek, beanz, sterni.
Herald added subscribers: sdasgup3, wenzhicui, wrengr, Chia-hungDuan, dcaballe, 
cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, 
Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, 
shauheen, rriddle, mehdi_amini, mgorny.
Herald added a reviewer: bollu.
Herald added a reviewer: sscalpone.
Herald added a project: Flang.
Ericson2314 requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, stephenneuendorffer, 
nicolasvasilache, jdoerfert.
Herald added projects: clang, MLIR, LLVM.

Firstly, we we make an additional GNUInstallDirs-style variable. With
NixOS, for example, this is crucial as we want those to go in
`${dev}/lib/cmake` not `${out}/lib/cmake` as would a cmake subdir of the
"regular" libdir.

Secondly, we make *Config.cmake robust to absolute package install
paths. We for NixOS will in fact be passing them absolute paths to make
the `${dev}` vs `${out}` distinction mentioned above, and the
GNUInstallDirs-style variables are suposed to support absolute paths in
general so it's good practice besides the NixOS use-case.

Thirdly, we make `${project}_INSTALL_PACKAGE_DIR` CACHE PATHs like other
install dirs are.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117973

Files:
  clang/cmake/modules/CMakeLists.txt
  cmake/Modules/FindPrefixFromConfig.cmake
  cmake/Modules/GNUInstallPackageDir.cmake
  flang/cmake/modules/CMakeLists.txt
  lld/cmake/modules/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/CMakeLists.txt
  mlir/cmake/modules/CMakeLists.txt
  polly/cmake/CMakeLists.txt

Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -1,10 +1,19 @@
 # Keep this in sync with llvm/cmake/CMakeLists.txt!
 
+include(GNUInstallPackageDir)
 include(ExtendPath)
 include(FindPrefixFromConfig)
 
-set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
-set(POLLY_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/polly")
+set(POLLY_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/polly" CACHE STRING
+  "Path for CMake subdirectory for Polly (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/polly')")
+# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
+set(polly_cmake_builddir "${POLLY_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/polly")
+
+set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING
+  "Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')")
+# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
+set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+
 if (CMAKE_CONFIGURATION_TYPES)
   set(POLLY_EXPORTS_FILE_NAME "PollyExports-$>.cmake")
 else()
@@ -28,9 +37,6 @@
   set(POLLY_CONFIG_TARGET_${tgt}_TYPE ${tgt_type})
 endforeach()
 
-set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}")
-
 # generate the import code for bundled/undbundled libisl versions
 if (NOT POLLY_BUNDLED_ISL)
   get_property(incl TARGET ISL PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
@@ -50,7 +56,8 @@
 
 # Generate PollyConfig.cmake for the build tree.
 set(POLLY_CONFIG_CODE "")
-set(POLLY_CONFIG_CMAKE_DIR "${CMAKE_BINARY_DIR}/${POLLY_INSTALL_PACKAGE_DIR}")
+set(POLLY_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}")
+set(POLLY_CONFIG_CMAKE_DIR "${polly_cmake_builddir}")
 set(POLLY_CONFIG_INCLUDE_DIRS
   ${POLLY_SOURCE_DIR}/include
   ${ISL_INCLUDE_DIRS}
@@ -73,11 +80,11 @@
 # the imported locations
 configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfig.cmake.in
-  ${POLLY_CONFIG_CMAKE_DIR}/PollyConfig.cmake
+  ${polly_cmake_builddir}/PollyConfig.cmake
   @ONLY)
 
 file(GENERATE
-  OUTPUT ${POLLY_CONFIG_CMAKE_DIR}/${POLLY_EXPORTS_FILE_NAME}
+  OUTPUT ${polly_cmake_builddir}/${POLLY_EXPORTS_FILE_NAME}
   CONTENT "${POLLY_EXPORTS}")
 
 
Index: mlir/cmake/modules/CMakeLists.txt
===
--- mlir/cmake/modules/CMakeLists.txt
+++ mlir/cmake/modules/CMakeLists.txt
@@ -1,3 +1,4 @@
+include(GNUInstallPackageDir)
 include(ExtendPath)
 include(LLVMDistributionSupport)
 include(FindPrefixFromConfig)
@@ -5,12 +6,16 @@
 # Generate a list of CMake library targets so that other CMake projects can
 # link against them. LLVM calls its version of this file LLVMExports.cmake, but
 # the usual CMake convention seems to be ${Project}Targets.cmake.
-set(MLIR_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir)
-set(mlir_cmake_builddir "${CMAKE_BINARY_DIR}/${MLIR_INSTALL_PACKAGE_DIR}")
+set(MLIR_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/mlir" CACHE STRING
+  "Path for CMake subdirectory for Polly (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/polly')")
+# 

[PATCH] D117972: [PowerPC] Fix SSE translation on FreeBSD

2022-01-22 Thread Piotr Kubaj via Phabricator via cfe-commits
pkubaj created this revision.
pkubaj added reviewers: adalava, nemanjai.
Herald added subscribers: shchenz, kbarton, krytarowski.
pkubaj requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Fix for https://github.com/llvm/llvm-project/issues/53085


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117972

Files:
  clang/lib/Headers/ppc_wrappers/mm_malloc.h


Index: clang/lib/Headers/ppc_wrappers/mm_malloc.h
===
--- clang/lib/Headers/ppc_wrappers/mm_malloc.h
+++ clang/lib/Headers/ppc_wrappers/mm_malloc.h
@@ -19,7 +19,11 @@
 #ifndef __cplusplus
 extern int posix_memalign (void **, size_t, size_t);
 #else
+#if defined(__linux__)
 extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+#elif defined(__FreeBSD__)
+extern "C" int posix_memalign (void **, size_t, size_t);
+#endif
 #endif
 
 static __inline void *


Index: clang/lib/Headers/ppc_wrappers/mm_malloc.h
===
--- clang/lib/Headers/ppc_wrappers/mm_malloc.h
+++ clang/lib/Headers/ppc_wrappers/mm_malloc.h
@@ -19,7 +19,11 @@
 #ifndef __cplusplus
 extern int posix_memalign (void **, size_t, size_t);
 #else
+#if defined(__linux__)
 extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+#elif defined(__FreeBSD__)
+extern "C" int posix_memalign (void **, size_t, size_t);
+#endif
 #endif
 
 static __inline void *
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117939: [clang-tidy] Add more documentation about check development

2022-01-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments.



Comment at: clang-tools-extra/docs/clang-tidy/Contributing.rst:295
+Reference `_ to 
understand
+the relationship between the different matcher funtions.
+

Should be `functions`



Comment at: clang-tools-extra/docs/clang-tidy/Contributing.rst:338
+matching expressions to simplify your matcher.  Just like breaking up a huge 
function
+into smaller chunks with an intention revealing name can help you understand a 
complex
+algorithm, breaking up a matcher into smaller matchers with intention 
revealing names

chunks plural, "an intention revealing name" singular mismatch


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117939/new/

https://reviews.llvm.org/D117939

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D7982: [clang-tidy] Add readability-duplicate-include check

2022-01-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment.

In D7982#3263790 , @carlosgalvezp wrote:

> Great patch, thanks!!

Can you mark the patch as accepted in phabricator?
Thanks


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7982/new/

https://reviews.llvm.org/D7982

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117860: [RISCV] Remove experimental prefix from rvv-related extensions.

2022-01-22 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117860/new/

https://reviews.llvm.org/D117860

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99484: [clang-tools-extra][cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-22 Thread John Ericson via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7c16647c3676: [clang-tools-extra][cmake] Use 
`GNUInstallDirs` to support custom installation… (authored by Ericson2314).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99484/new/

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt


Index: clang-tools-extra/modularize/CMakeLists.txt
===
--- clang-tools-extra/modularize/CMakeLists.txt
+++ clang-tools-extra/modularize/CMakeLists.txt
@@ -23,5 +23,5 @@
   )
 
 install(TARGETS modularize
-RUNTIME DESTINATION bin
+RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
 COMPONENT clang-extras)
Index: clang-tools-extra/clang-tidy/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -52,9 +52,9 @@
 
 
 install(PROGRAMS clang-tidy-diff.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-tidy)
 install(PROGRAMS run-clang-tidy.py
-  DESTINATION bin
+  DESTINATION "${CMAKE_INSTALL_BINDIR}"
   COMPONENT clang-tidy
   RENAME run-clang-tidy)
Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -113,7 +113,7 @@
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
   install(DIRECTORY .
-DESTINATION include/clang-tidy
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/clang-tidy"
 COMPONENT clang-tidy-headers
 FILES_MATCHING
 PATTERN "*.h"
Index: clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
+++ clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
@@ -21,8 +21,8 @@
   )
 
 install(PROGRAMS clang-include-fixer.el
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-include-fixer)
 install(PROGRAMS clang-include-fixer.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-include-fixer)
Index: 
clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
+++ clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
@@ -20,5 +20,5 @@
   )
 
 install(PROGRAMS run-find-all-symbols.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT find-all-symbols)
Index: clang-tools-extra/clang-doc/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -19,9 +19,9 @@
   )
 
 install(FILES ../assets/clang-doc-default-stylesheet.css
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)
 
 install(FILES ../assets/index.js
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)
Index: clang-tools-extra/CMakeLists.txt
===
--- clang-tools-extra/CMakeLists.txt
+++ clang-tools-extra/CMakeLists.txt
@@ -1,4 +1,5 @@
 include(CMakeDependentOption)
+include(GNUInstallDirs)
 
 option(CLANG_TIDY_ENABLE_STATIC_ANALYZER
   "Include static analyzer checks in clang-tidy" ON)


Index: clang-tools-extra/modularize/CMakeLists.txt
===
--- clang-tools-extra/modularize/CMakeLists.txt
+++ clang-tools-extra/modularize/CMakeLists.txt
@@ -23,5 +23,5 @@
   )
 
 install(TARGETS modularize
-RUNTIME DESTINATION bin
+RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
 COMPONENT clang-extras)
Index: clang-tools-extra/clang-tidy/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -52,9 +52,9 @@
 
 
 install(PROGRAMS clang-tidy-diff.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-tidy)
 install(PROGRAMS run-clang-tidy.py
-  DESTINATION bin
+  DESTINATION "${CMAKE_INSTALL_BINDIR}"
   COMPONENT clang-tidy
   RENAME 

[clang-tools-extra] 7c16647 - [clang-tools-extra][cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-22 Thread John Ericson via cfe-commits

Author: John Ericson
Date: 2022-01-22T20:57:21Z
New Revision: 7c16647c3676587391f6bb80ec87d9621ca9472f

URL: 
https://github.com/llvm/llvm-project/commit/7c16647c3676587391f6bb80ec87d9621ca9472f
DIFF: 
https://github.com/llvm/llvm-project/commit/7c16647c3676587391f6bb80ec87d9621ca9472f.diff

LOG: [clang-tools-extra][cmake] Use `GNUInstallDirs` to support custom 
installation dirs.

This is the original patch in my GNUInstallDirs series, now last to merge as 
the final piece!

It arose as a new draft of D28234. I initially did the unorthodox thing of 
pushing to that when I wasn't the original author, but since I ended up

 - Using `GNUInstallDirs`, rather than mimicking it, as the original author was 
hesitant to do but others requested.

 - Converting all the packages, not just LLVM, effecting many more projects 
than LLVM itself.

I figured it was time to make a new revision.

I have used this patch series (and many back-ports) as the basis of 
https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS), which was 
merged last spring (2021). It looked like people were generally on board in 
D28234, but I make note of this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM already 
has some partial support for these sorts of things. Variables like 
`COMPILER_RT_INSTALL_PATH` have already been dealt with. Variables like 
`LLVM_LIBDIR_SUFFIX` however, will require further work, so that we may use 
`CMAKE_INSTALL_LIBDIR`.

These remaining items will be addressed in further patches. What is here is now 
rote and so we should get it out of the way before dealing more intricately 
with the remainder.

Reviewed By: #libunwind, #libc, #libc_abi, compnerd

Differential Revision: https://reviews.llvm.org/D99484

Added: 


Modified: 
clang-tools-extra/CMakeLists.txt
clang-tools-extra/clang-doc/tool/CMakeLists.txt
clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
clang-tools-extra/clang-tidy/CMakeLists.txt
clang-tools-extra/clang-tidy/tool/CMakeLists.txt
clang-tools-extra/modularize/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/CMakeLists.txt 
b/clang-tools-extra/CMakeLists.txt
index 2e73b6ba81d2e..7b8274a97336b 100644
--- a/clang-tools-extra/CMakeLists.txt
+++ b/clang-tools-extra/CMakeLists.txt
@@ -1,4 +1,5 @@
 include(CMakeDependentOption)
+include(GNUInstallDirs)
 
 option(CLANG_TIDY_ENABLE_STATIC_ANALYZER
   "Include static analyzer checks in clang-tidy" ON)

diff  --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt 
b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
index 7e71478869160..fb8317b272932 100644
--- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -19,9 +19,9 @@ target_link_libraries(clang-doc
   )
 
 install(FILES ../assets/clang-doc-default-stylesheet.css
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)
 
 install(FILES ../assets/index.js
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)

diff  --git 
a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt 
b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
index 8f5509d22e24a..e6926a0d5bd10 100644
--- a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
@@ -20,5 +20,5 @@ target_link_libraries(find-all-symbols
   )
 
 install(PROGRAMS run-find-all-symbols.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT find-all-symbols)

diff  --git a/clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt 
b/clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
index 3936ac1e8a5a5..5b9e00ab87cd8 100644
--- a/clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
@@ -21,8 +21,8 @@ target_link_libraries(clang-include-fixer
   )
 
 install(PROGRAMS clang-include-fixer.el
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-include-fixer)
 install(PROGRAMS clang-include-fixer.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-include-fixer)

diff  --git a/clang-tools-extra/clang-tidy/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/CMakeLists.txt
index 455645050d93d..075e9f9909d65 100644
--- a/clang-tools-extra/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -113,7 +113,7 @@ add_subdirectory(utils)
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
   install(DIRECTORY .
-DESTINATION include/clang-tidy
+DESTINATION 

[PATCH] D99484: [clang-tools-extra][cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-22 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 added a comment.

Alright, this is the last bit (except for D101070 
 which evidently caused the issues), looking 
good.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99484/new/

https://reviews.llvm.org/D99484

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117965: [AlwaysInliner] Enable call site inlining to make flatten attribute working again (PR53360)

2022-01-22 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added inline comments.



Comment at: llvm/lib/Transforms/IPO/AlwaysInliner.cpp:95
 
-  // Remember to try and delete this function afterward. This both avoids
-  // re-walking the rest of the module and avoids dealing with any iterator
-  // invalidation issues while deleting functions.
-  InlinedFunctions.push_back();
+  if (F.hasFnAttribute(Attribute::AlwaysInline))
+// Remember to try and delete this function afterward. This both avoids

avoid DCE of internal functions without always_inline; check test pr2945 in 
always-inline.ll


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117965/new/

https://reviews.llvm.org/D117965

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117965: [AlwaysInliner] Enable call site inlining to make flatten attribute working again (PR53360)

2022-01-22 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 created this revision.
xbolva00 added reviewers: leonardchan, aeubanks.
Herald added subscribers: ormris, hiraditya.
xbolva00 requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Problem: Migration to new PM broke flatten attribute.

This is one use case why LLVM should support inlining call-site with 
alwaysinline.  The flatten attribute is nowdays broken, so we should either 
land patch like this one or remove everything related to  flatten attribute 
from Clang.

Second use case is something like "per call site inlining intrinsics" to 
control inlining even more; mentioned in
https://lists.llvm.org/pipermail/cfe-dev/2018-September/059232.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117965

Files:
  clang/test/CodeGen/flatten.c
  clang/test/CodeGenCXX/flatten.cpp
  llvm/lib/Transforms/IPO/AlwaysInliner.cpp
  llvm/test/Transforms/Inline/always-inline.ll

Index: llvm/test/Transforms/Inline/always-inline.ll
===
--- llvm/test/Transforms/Inline/always-inline.ll
+++ llvm/test/Transforms/Inline/always-inline.ll
@@ -1,14 +1,7 @@
-; RUN: opt < %s -inline-threshold=0 -always-inline -enable-new-pm=0 -S | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-CALL
-;
-; Ensure the threshold has no impact on these decisions.
-; RUN: opt < %s -inline-threshold=2000 -always-inline -enable-new-pm=0 -S | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-CALL
-; RUN: opt < %s -inline-threshold=-2000 -always-inline -enable-new-pm=0 -S | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-CALL
-;
-; The new pass manager doesn't re-use any threshold based infrastructure for
-; the always inliner, but test that we get the correct result. The new PM
-; always inliner also doesn't support inlining call-site alwaysinline
-; annotations. It isn't clear that this is a reasonable use case for
-; 'alwaysinline'.
+; Ensure the threshold has no impact on these decisions. The new pass manager
+; doesn't re-use any threshold based infrastructure for the always inliner,
+; but test that we get the correct result.
+
 ; RUN: opt < %s -inline-threshold=0 -passes=always-inline -S | FileCheck %s --check-prefix=CHECK
 ; RUN: opt < %s -inline-threshold=2000 -passes=always-inline -S | FileCheck %s --check-prefix=CHECK
 ; RUN: opt < %s -inline-threshold=-2000 -passes=always-inline -S | FileCheck %s --check-prefix=CHECK
@@ -145,15 +138,24 @@
 ; CHECK-LABEL: @inner7(
   ret i32 1
 }
-define i32 @outer7() {
-; CHECK-CALL-LABEL: @outer7(
-; CHECK-CALL-NOT: call
-; CHECK-CALL: ret
+define i32 @outer7a() {
+; CHECK-LABEL: @outer7a(
+; CHECK-NOT: call
+; CHECK: ret
 
%r = call i32 @inner7() alwaysinline
ret i32 %r
 }
 
+define i32 @outer7b() {
+; CHECK-LABEL: @outer7b(
+; CHECK-NOT: call
+; CHECK: ret
+
+   %r = call i32 @inner7() #0
+   ret i32 %r
+}
+
 define internal float* @inner8(float* nocapture align 128 %a) alwaysinline {
 ; CHECK-NOT: @inner8(
   ret float* %a
@@ -318,3 +320,5 @@
   call void @inner14()
   ret void
 }
+
+attributes #0 = { alwaysinline }
Index: llvm/lib/Transforms/IPO/AlwaysInliner.cpp
===
--- llvm/lib/Transforms/IPO/AlwaysInliner.cpp
+++ llvm/lib/Transforms/IPO/AlwaysInliner.cpp
@@ -54,13 +54,13 @@
 if (F.isPresplitCoroutine())
   continue;
 
-if (!F.isDeclaration() && F.hasFnAttribute(Attribute::AlwaysInline) &&
-isInlineViable(F).isSuccess()) {
+if (!F.isDeclaration() && isInlineViable(F).isSuccess()) {
   Calls.clear();
 
   for (User *U : F.users())
 if (auto *CB = dyn_cast(U))
-  if (CB->getCalledFunction() == )
+  if (CB->getCalledFunction() ==  &&
+  CB->hasFnAttr(Attribute::AlwaysInline))
 Calls.insert(CB);
 
   for (CallBase *CB : Calls) {
@@ -92,10 +92,11 @@
 Changed = true;
   }
 
-  // Remember to try and delete this function afterward. This both avoids
-  // re-walking the rest of the module and avoids dealing with any iterator
-  // invalidation issues while deleting functions.
-  InlinedFunctions.push_back();
+  if (F.hasFnAttribute(Attribute::AlwaysInline))
+// Remember to try and delete this function afterward. This both avoids
+// re-walking the rest of the module and avoids dealing with any
+// iterator invalidation issues while deleting functions.
+InlinedFunctions.push_back();
 }
   }
 
Index: clang/test/CodeGenCXX/flatten.cpp
===
--- clang/test/CodeGenCXX/flatten.cpp
+++ clang/test/CodeGenCXX/flatten.cpp
@@ -1,7 +1,3 @@
-// UNSUPPORTED: experimental-new-pass-manager
-// See the comment for CodeGen/flatten.c on why this is unsupported with the new
-// PM.
-
 // RUN: %clang_cc1 -triple=x86_64-linux-gnu -std=c++11 %s -emit-llvm -o - 

[PATCH] D7982: [clang-tidy] Add readability-duplicate-include check

2022-01-22 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp accepted this revision.
carlosgalvezp added a comment.

Great patch, thanks!!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7982/new/

https://reviews.llvm.org/D7982

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117520: [clang-format] Fix SeparateDefinitionBlocks issues

2022-01-22 Thread ksyx via Phabricator via cfe-commits
ksyx marked 2 inline comments as done.
ksyx added a comment.

In D117520#3263403 , @MyDeveloperDay 
wrote:

> maybe slightly related https://github.com/llvm/llvm-project/issues/53183 in 
> that this is also impacted by the 5 character 
> `TT_FunctionLikeOrFreestandingMacro`

Yes this patch is just marking this type of recognition but surely it requires 
other changes to the formatter.

By the way are there any improvements needed for this patch? Thanks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117520/new/

https://reviews.llvm.org/D117520

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117939: [clang-tidy] Add more documentation about check development

2022-01-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 402238.
LegalizeAdulthood added a comment.

Update from review comments


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117939/new/

https://reviews.llvm.org/D117939

Files:
  clang-tools-extra/docs/clang-tidy/Contributing.rst

Index: clang-tools-extra/docs/clang-tidy/Contributing.rst
===
--- clang-tools-extra/docs/clang-tidy/Contributing.rst
+++ clang-tools-extra/docs/clang-tidy/Contributing.rst
@@ -22,6 +22,8 @@
 check, it will create the check, update the CMake file and create a test;
   * ``rename_check.py`` does what the script name suggests, renames an existing
 check;
+  * :program:`pp-trace` logs method calls on `PPCallbacks` for a source file
+and is invaluable in understanding the preprocessor mechanism;
   * :program:`clang-query` is invaluable for interactive prototyping of AST
 matchers and exploration of the Clang AST;
   * `clang-check`_ with the ``-ast-dump`` (and optionally ``-ast-dump-filter``)
@@ -70,6 +72,13 @@
 .. _Using Clang Tools: https://clang.llvm.org/docs/ClangTools.html
 .. _How To Setup Clang Tooling For LLVM: https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
 
+When you `configure the CMake build `_,
+make sure that you enable the ``clang-tools-extra`` project to build :program:`clang-tidy`.
+Since your new check will have associated documentation, you will also want to install
+`Sphinx `_ and enable it in the CMake configuration.
+To save build time of the core Clang libraries you may want to only enable the ``X86``
+target in the CMake configuration.
+
 
 The Directory Structure
 ---
@@ -215,11 +224,194 @@
 and `clang-tidy/google/ExplicitConstructorCheck.cpp
 `_).
 
+If you need to interact macros and preprocessor directives, you will want to
+override the method ``registerPPCallbacks``.  The ``add_new_check.py`` script
+does not generate an override for this method in the starting point for your
+new check.
+
+If your check applies only to specific versions of the C++ standard, you will
+want to override the method ``isLanguageVersionSupported`` to reflect that.
+
+Check development tips
+--
+
+Writing your first check can be a daunting task, particularly if you are unfamiliar
+with the LLVM and Clang code bases.  Here are some suggestions for orienting yourself
+in the codebase and working on your check incrementally.
+
+Guide to useful documentation
+^
+
+Many of the support classes created for LLVM are used by Clang, such as `StringRef
+`_
+and `SmallVector `_.
+These and other commonly used classes are described in the `Important and useful LLVM APIs
+`_ and
+`Picking the Right Data Structure for the Task
+`_
+sections of the `LLVM Programmer's Manual
+`_.  You don't need to memorize all the
+details of these classes; the generated `doxygen documentation `_
+has everything if you need it.  In the header `LLVM/ADT/STLExtras.h
+`_ you'll find useful versions of the STL
+algorithms that operate on LLVM containers, such as `llvm::all_of
+`_.
+
+Clang is implemented on top of LLVM and introduces its own set of classes that you
+will interact with while writing your check.  The most important of these are the
+classes relating the source code locations, source files, ranges of source locations
+and the `SourceManager
+`_ class.  These and
+other topics are described in the `"Clang" CFE Internals Manual
+`_.  Whereas the doxygen generated
+documentation serves as a reference to the internals of Clang, this document serves
+as a guide to other developers.  Topics in that manual of interest to a check developer
+are:
+
+- `The Clang "Basic" Library
+  `_ for
+  information about diagnostics, fix-it hints and source locations.
+- `The Lexer and Preprocessor Library
+  `_
+  for information about tokens, lexing (transforming characters into tokens) and the
+  preprocessor.
+- `The AST Library
+  

[PATCH] D117939: [clang-tidy] Add more documentation about check development

2022-01-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked 7 inline comments as done.
LegalizeAdulthood added a comment.

In D117939#3263180 , @Eugene.Zelenko 
wrote:

> It's also make sense to mention `isLanguageVersionSupported`.

Good idea.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117939/new/

https://reviews.llvm.org/D117939

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D7982: [clang-tidy] Add readability-duplicate-include check

2022-01-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/readability-duplicate-include.h:1
+#if !defined(READABILITY_DUPLICATE_INCLUDE_H)
+#define READABILITY_DUPLICATE_INCLUDE_H

carlosgalvezp wrote:
> LegalizeAdulthood wrote:
> > carlosgalvezp wrote:
> > > Nit: `#ifndef` 
> > It's a style thing.  I don't prefer `#ifndef` because it only differs from 
> > `#ifdef` by a single letter.
> You make a very valid point and I would definitely agree with that for 
> "regular" code.
> 
> However we are talking about a very special case here - header guards. Header 
> guards have a de-facto standard based on `#ifndef/#define`. It's actually 
> less error prone to write it like that - a well-written header guard will 
> have perfect visual alignment:
> 
> ```
> #ifndef FOO_H
> #define FOO_H
> ```
> 
> If you missed the `n` in `#ifndef`, you would notice the misalignment 
> immediately and know what to fix.
> 
> ```
> #ifdef FOO_H
> #define FOO_H
> ```
> 
> This also helps making sure that the macro name is identical on both lines. 
> This visual alignment is broken when using `#if !defined`, which makes it 
> harder to detect these problems.
> 
> Furthermore, I have run a quick search in the whole repo and I cannot find 
> one single instance where a header guard is written in the way that you 
> propose here.
> 
> ```
> $ git grep -E "#ifndef[ ]+[A-Z_]+_H" | wc -l
> 9573
> 
> $ git grep -E "#if[ ]+\!defined\([A-Z_]+_H\)" | wc -l
> 7
> ```
> All such 7 instances are exclusively used for error handling or other logic, 
> not for defining header guards.
> 
> Therefore I don't see this as a style choice, but rather a repo-wide 
> convention that shall be followed, and so I feel it's my duty as reviewer to 
> request changes. 
> 
> I understand this is annoying after 7 years waiting for a patch, but I think 
> it's a very easy fix to do. I can approve the patch right away after this if 
> fixed. Thank you for your patience! :) 
When it comes to matters that I consider a style preference, I
always prioritize the style of the team/project/code base over
my own style preferences unless I'm the only person working
on the existing code base `:)`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7982/new/

https://reviews.llvm.org/D7982

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D7982: [clang-tidy] Add readability-duplicate-include check

2022-01-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 402237.
LegalizeAdulthood added a comment.

Update from review comments


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7982/new/

https://reviews.llvm.org/D7982

Files:
  clang-tools-extra/clang-tidy/readability/CMakeLists.txt
  clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp
  clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.h
  clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-duplicate-include.rst
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/readability-duplicate-include.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/readability-duplicate-include2.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/iostream
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/string.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/sys/types.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/types.h
  clang-tools-extra/test/clang-tidy/checkers/readability-duplicate-include.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/readability-duplicate-include.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/readability-duplicate-include.cpp
@@ -0,0 +1,72 @@
+// RUN: %check_clang_tidy %s readability-duplicate-include %t -- -- -isystem %S/Inputs/readability-duplicate-include/system -I %S/Inputs/readability-duplicate-include
+
+int a;
+#include 
+int b;
+#include 
+int c;
+// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: duplicate include [readability-duplicate-include]
+// CHECK-FIXES:  {{^int a;$}}
+// CHECK-FIXES-NEXT: {{^#include $}}
+// CHECK-FIXES-NEXT: {{^int b;$}}
+// CHECK-FIXES-NEXT: {{^int c;$}}
+
+int d;
+#include 
+int e;
+#include  // extra stuff that will also be removed
+int f;
+// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: duplicate include
+// CHECK-FIXES:  {{^int d;$}}
+// CHECK-FIXES-NEXT: {{^#include $}}
+// CHECK-FIXES-NEXT: {{^int e;$}}
+// CHECK-FIXES-NEXT: {{^int f;$}}
+
+int g;
+#include "readability-duplicate-include.h"
+int h;
+#include "readability-duplicate-include.h"
+int i;
+// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: duplicate include
+// CHECK-FIXES:  {{^int g;$}}
+// CHECK-FIXES-NEXT: {{^#include "readability-duplicate-include.h"$}}
+// CHECK-FIXES-NEXT: {{^int h;$}}
+// CHECK-FIXES-NEXT: {{^int i;$}}
+
+#include 
+
+int j;
+#include 
+int k;
+#include 
+int l;
+// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: duplicate include
+// CHECK-FIXES:  {{^int j;$}}
+// CHECK-FIXES-NEXT: {{^#include $}}
+// CHECK-FIXES-NEXT: {{^int k;$}}
+// CHECK-FIXES-NEXT: {{^int l;$}}
+
+int m;
+#  include   // lots of space
+int n;
+// CHECK-MESSAGES: :[[@LINE-2]]:9: warning: duplicate include
+// CHECK-FIXES:  {{^int m;$}}
+// CHECK-FIXES-NEXT: {{^int n;$}}
+
+// defining a macro in the main file resets the included file cache
+#define ARBITRARY_MACRO
+int o;
+#include 
+int p;
+// CHECK-FIXES:  {{^int o;$}}
+// CHECK-FIXES-NEXT: {{^#include $}}
+// CHECK-FIXES-NEXT: {{^int p;$}}
+
+// undefining a macro resets the cache
+#undef ARBITRARY_MACRO
+int q;
+#include 
+int r;
+// CHECK-FIXES:  {{^int q;$}}
+// CHECK-FIXES-NEXT: {{^#include $}}
+// CHECK-FIXES-NEXT: {{^int r;$}}
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/types.h
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/types.h
@@ -0,0 +1 @@
+// This file is intentionally empty.
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/sys/types.h
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/sys/types.h
@@ -0,0 +1 @@
+// This file is intentionally empty.
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/string.h
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/string.h
@@ -0,0 +1 @@
+// This file is intentionally empty.
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/iostream
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-duplicate-include/system/iostream
@@ -0,0 +1 @@
+// This file is intentionally empty.

[PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-22 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 updated this revision to Diff 402234.
Ericson2314 added a comment.

Trim down, now that many parts have been landed already


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99484/new/

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt


Index: clang-tools-extra/modularize/CMakeLists.txt
===
--- clang-tools-extra/modularize/CMakeLists.txt
+++ clang-tools-extra/modularize/CMakeLists.txt
@@ -23,5 +23,5 @@
   )
 
 install(TARGETS modularize
-RUNTIME DESTINATION bin
+RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
 COMPONENT clang-extras)
Index: clang-tools-extra/clang-tidy/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -52,9 +52,9 @@
 
 
 install(PROGRAMS clang-tidy-diff.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-tidy)
 install(PROGRAMS run-clang-tidy.py
-  DESTINATION bin
+  DESTINATION "${CMAKE_INSTALL_BINDIR}"
   COMPONENT clang-tidy
   RENAME run-clang-tidy)
Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -113,7 +113,7 @@
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
   install(DIRECTORY .
-DESTINATION include/clang-tidy
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/clang-tidy"
 COMPONENT clang-tidy-headers
 FILES_MATCHING
 PATTERN "*.h"
Index: clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
+++ clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
@@ -21,8 +21,8 @@
   )
 
 install(PROGRAMS clang-include-fixer.el
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-include-fixer)
 install(PROGRAMS clang-include-fixer.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-include-fixer)
Index: 
clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
+++ clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
@@ -20,5 +20,5 @@
   )
 
 install(PROGRAMS run-find-all-symbols.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT find-all-symbols)
Index: clang-tools-extra/clang-doc/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -19,9 +19,9 @@
   )
 
 install(FILES ../assets/clang-doc-default-stylesheet.css
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)
 
 install(FILES ../assets/index.js
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)
Index: clang-tools-extra/CMakeLists.txt
===
--- clang-tools-extra/CMakeLists.txt
+++ clang-tools-extra/CMakeLists.txt
@@ -1,4 +1,5 @@
 include(CMakeDependentOption)
+include(GNUInstallDirs)
 
 option(CLANG_TIDY_ENABLE_STATIC_ANALYZER
   "Include static analyzer checks in clang-tidy" ON)


Index: clang-tools-extra/modularize/CMakeLists.txt
===
--- clang-tools-extra/modularize/CMakeLists.txt
+++ clang-tools-extra/modularize/CMakeLists.txt
@@ -23,5 +23,5 @@
   )
 
 install(TARGETS modularize
-RUNTIME DESTINATION bin
+RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
 COMPONENT clang-extras)
Index: clang-tools-extra/clang-tidy/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -52,9 +52,9 @@
 
 
 install(PROGRAMS clang-tidy-diff.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-tidy)
 install(PROGRAMS run-clang-tidy.py
-  DESTINATION bin
+  DESTINATION "${CMAKE_INSTALL_BINDIR}"
   COMPONENT clang-tidy
   RENAME run-clang-tidy)
Index: clang-tools-extra/clang-tidy/CMakeLists.txt

[PATCH] D117929: [XRay] Add support for RISCV

2022-01-22 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added a comment.

In D117929#3263462 , @ashwin98 wrote:

> Thank you for your feedback! I could combine the riscv32 and 64 cpp files 
> with some xlen conditions if that will work better, but that might take a bit 
> of a hit in terms of readability (do I explain both sleds in the comments 
> preceding the implementation).

In one sense yes it will be slightly less readable. In another sense it 
actually makes it //more// readable, because seeing the XLEN-based conditions 
makes it clear what things are word-sized and what things are explicitly 32-bit 
(in the RV32 code any LW is unclear whether it's loading an int, a size_t or a 
`void *`). And yes, you explain both, but most of it is the same so can be 
combined into a single explanation, e.g. like LLD does for documenting its PLT 
stubs in lld/ELF/Arch/RISCV.cpp.

> I wasn't too sure about how to work around sign extension in RISCV, which you 
> have picked up on - adding 0x800 wasn't something I thought of. Thinking 
> about it a bit more, it makes sense, we're not adding 4096 like how I was, 
> though it has the same effect; I'll reason it out, I'm sure carry propagation 
> deals with it like you've mentioned. I'll update the code to reflect the same.

It's important that it's only added when computing the HI relocation. As an 
example, `%hi(0x81734)` (to pick a number at random that's not too boring) 
would be `(0x81734 + 0x800) >> 12` = `0x81f34 >> 12` = `0x81`, whereas 
`%hi(0x81934)` = `(0x81934 + 0x800) >> 12` = `0x82134 >> 12` = `0x82`. You can 
see how the adding `1 << 11` combined with right-shifting by one more results 
in adding one to the upper 20 bits if and only if bit 11 of the input is 1; if 
it's 0 there is no carry out so the only bit that's modified is bit 11, which 
the right shift will shift out.

> I had a related question with respect to the 64 bit sleds though - given that 
> lui is also sign extended, we need a work around for it as well while 
> constructing the 32 bit values, and while combining the 2 32 bit values into 
> a 64 bit value. I have currently been getting rid of the upper 32 bits by 
> performing a left shift followed by a right shift, but I'm sure there is a 
> better solution to it.

That's one way of doing it, though requires more than one temporary register. 
RISCVMatInt's generateInstSeqImpl has an alternate sequence documented for the 
general case (as well as various optimised special cases) that is the same 
number of instructions but only needs one register. If you have multiple 
registers then your sequence probably performs better on an out-of-order core. 
Synthesising 64-bit addresses is pretty inefficient; you might prefer instead 
just loading from a constant pool adjacent to the code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117929/new/

https://reviews.llvm.org/D117929

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117913: [Clang][RISCV] Guard vmulh, vsmul correctly

2022-01-22 Thread Yueh-Ting Chen via Phabricator via cfe-commits
eopXD added a comment.

In D117913#3263493 , @khchen wrote:

> why the new test filename extension is `.c.c`?

Thanks for the reminder.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117913/new/

https://reviews.llvm.org/D117913

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117913: [Clang][RISCV] Guard vmulh, vsmul correctly

2022-01-22 Thread Zakk Chen via Phabricator via cfe-commits
khchen added a comment.

why the new test filename extension is `.c.c`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117913/new/

https://reviews.llvm.org/D117913

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117929: [XRay] Add support for RISCV

2022-01-22 Thread Ashwin Poduval via Phabricator via cfe-commits
ashwin98 added a comment.

Thank you for your feedback! I could combine the riscv32 and 64 cpp files with 
some xlen conditions if that will work better, but that might take a bit of a 
hit in terms of readability (do I explain both sleds in the comments preceding 
the implementation). I have commented riscv32 out because I haven't managed to 
test it out yet, I've had some difficulty getting llvm set up for riscv 32 - I 
will leave riscv32 commented out only in the cmake file.

I wasn't too sure about how to work around sign extension in RISCV, which you 
have picked up on - I agree that adding 0x800 would help deal with sign 
extension, but wouldn't that only be required if the LSBs were sign extended? 
The way I understand it, if we were to always add 0x800, we'd end up adding 
4096 even when our address is a small positive number like 40.

I had a similar question with respect to the 64 bit sleds - given that lui is 
also sign extended, we need a work around for it as well while constructing the 
32 bit values, and while combining the 2 32 bit values into a 64 bit value. I 
have currently been getting rid of the upper 32 bits by performing a left shift 
followed by a right shift, but I'm sure there is a better solution to it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117929/new/

https://reviews.llvm.org/D117929

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114611: [AVR] Expand STDWSPQRr & STDSPQRr, approach #2

2022-01-22 Thread Patryk Wychowaniec via Phabricator via cfe-commits
Patryk27 updated this revision to Diff 402213.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114611/new/

https://reviews.llvm.org/D114611

Files:
  clang/docs/tools/clang-formatted-files.txt
  llvm/lib/Target/AVR/AVR.h
  llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp
  llvm/lib/Target/AVR/AVRFrameLowering.cpp
  llvm/lib/Target/AVR/AVRRegisterInfo.cpp
  llvm/lib/Target/AVR/AVRRelaxMemOperations.cpp
  llvm/lib/Target/AVR/AVRSubtarget.h
  llvm/lib/Target/AVR/AVRTargetMachine.cpp
  llvm/lib/Target/AVR/CMakeLists.txt
  llvm/test/CodeGen/AVR/PR31344.ll
  llvm/test/CodeGen/AVR/PR31345.ll
  llvm/test/CodeGen/AVR/PR37143.ll
  llvm/test/CodeGen/AVR/avr-rust-issue-123.ll
  llvm/test/CodeGen/AVR/frmidx-iterator-bug.ll
  llvm/test/CodeGen/AVR/hardware-mul.ll
  llvm/test/CodeGen/AVR/mul-hardware.ll
  llvm/test/CodeGen/AVR/mul-software.ll
  llvm/test/CodeGen/AVR/past-bugs/D114611.ll
  llvm/test/CodeGen/AVR/past-bugs/PR31344.ll
  llvm/test/CodeGen/AVR/past-bugs/PR31345.ll
  llvm/test/CodeGen/AVR/past-bugs/PR37143.ll
  llvm/test/CodeGen/AVR/past-bugs/avr-rust-issue-123.ll
  llvm/test/CodeGen/AVR/past-bugs/frmidx-iterator-bug.ll
  llvm/test/CodeGen/AVR/past-bugs/rust-avr-bug-112.ll
  llvm/test/CodeGen/AVR/past-bugs/rust-avr-bug-37.ll
  llvm/test/CodeGen/AVR/past-bugs/rust-avr-bug-95.ll
  llvm/test/CodeGen/AVR/past-bugs/rust-avr-bug-99.ll
  llvm/test/CodeGen/AVR/pseudo/STDSPQRr.mir
  llvm/test/CodeGen/AVR/pseudo/STDWPtrQRr.mir
  llvm/test/CodeGen/AVR/pseudo/STDWSPQRr.mir
  llvm/test/CodeGen/AVR/relax-mem/STDWPtrQRr.mir
  llvm/test/CodeGen/AVR/rust-avr-bug-112.ll
  llvm/test/CodeGen/AVR/rust-avr-bug-37.ll
  llvm/test/CodeGen/AVR/rust-avr-bug-95.ll
  llvm/test/CodeGen/AVR/rust-avr-bug-99.ll
  llvm/test/CodeGen/AVR/software-mul.ll
  llvm/utils/UpdateTestChecks/asm.py
  llvm/utils/gn/secondary/llvm/lib/Target/AVR/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/lib/Target/AVR/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/lib/Target/AVR/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/lib/Target/AVR/BUILD.gn
@@ -37,7 +37,6 @@
 "AVRInstrInfo.cpp",
 "AVRMCInstLower.cpp",
 "AVRRegisterInfo.cpp",
-"AVRRelaxMemOperations.cpp",
 "AVRShiftExpand.cpp",
 "AVRSubtarget.cpp",
 "AVRTargetMachine.cpp",
Index: llvm/utils/UpdateTestChecks/asm.py
===
--- llvm/utils/UpdateTestChecks/asm.py
+++ llvm/utils/UpdateTestChecks/asm.py
@@ -391,6 +391,7 @@
 def get_triple_from_march(march):
   triples = {
   'amdgcn': 'amdgcn',
+  'avr': 'avr',
   'r600': 'r600',
   'mips': 'mips',
   'sparc': 'sparc',
Index: llvm/test/CodeGen/AVR/relax-mem/STDWPtrQRr.mir
===
--- llvm/test/CodeGen/AVR/relax-mem/STDWPtrQRr.mir
+++ /dev/null
@@ -1,31 +0,0 @@
-# RUN: llc -O0 -run-pass=avr-relax-mem %s -o - | FileCheck %s
-
 |
-  target triple = "avr--"
-  define void @test() {
-  entry:
-ret void
-  }
-...
-

-name:test
-body: |
-  bb.0.entry:
-
-; CHECK-LABEL: test
-
-; We shouldn't expand things which already have 6-bit imms.
-; CHECK: STDWPtrQRr $r29r28, 63, $r1r0
-STDWPtrQRr $r29r28, 63, $r1r0
-
-; We shouldn't expand things which already have 6-bit imms.
-; CHECK-NEXT: STDWPtrQRr $r29r28, 0, $r1r0
-STDWPtrQRr $r29r28, 0, $r1r0
-
-; CHECK-NEXT: PUSHWRr $r29r28, implicit-def $sp, implicit $sp
-; CHECK-NEXT: $r29r28 = SBCIWRdK $r29r28, -64, implicit-def $sreg, implicit $sreg
-; CHECK-NEXT: STWPtrRr $r29r28, $r1r0
-; CHECK-NEXT: $r29r28 = POPWRd implicit-def $sp, implicit $sp
-STDWPtrQRr $r29r28, 64, $r1r0
-...
Index: llvm/test/CodeGen/AVR/pseudo/STDWSPQRr.mir
===
--- /dev/null
+++ llvm/test/CodeGen/AVR/pseudo/STDWSPQRr.mir
@@ -0,0 +1,20 @@
+# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - | FileCheck %s
+
+--- |
+  target triple = "avr--"
+  define void @test() {
+  entry:
+ret void
+  }
+...
+
+---
+name:test
+body: |
+  bb.0.entry:
+
+; CHECK: STDPtrQRr $r31r30, 10, $r9
+; CHECK-NEXT: STDPtrQRr $r31r30, 11, $r10
+
+STDWSPQRr $sp, 10, $r10r9, implicit-def $sp
+...
Index: llvm/test/CodeGen/AVR/pseudo/STDWPtrQRr.mir
===
--- llvm/test/CodeGen/AVR/pseudo/STDWPtrQRr.mir
+++ llvm/test/CodeGen/AVR/pseudo/STDWPtrQRr.mir
@@ -15,8 +15,52 @@
 
 ; CHECK-LABEL: test
 
-; CHECK:  STDPtrQRr $r29r28, 10, $r0
-; CHECK-NEXT: STDPtrQRr $r29r28, 11, $r1
+; Small displacement (<63):
+; CHECK:  STDPtrQRr $r29r28, 3, $r0
+; CHECK-NEXT: STDPtrQRr $r29r28, 4, $r1
+STDWPtrQRr $r29r28, 3, $r1r0
 
-STDWPtrQRr $r29r28, 10, $r1r0
+; Small displacement where the destination register is killed:
+; CHECK:  STDPtrQRr $r29r28, 3, $r0
+; CHECK-NEXT: 

[PATCH] D117091: [Clang] Add attributes alloc_size and alloc_align to mm_malloc

2022-01-22 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 updated this revision to Diff 402207.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117091/new/

https://reviews.llvm.org/D117091

Files:
  clang/lib/Headers/mm_malloc.h
  clang/test/Headers/mm_malloc.c


Index: clang/test/Headers/mm_malloc.c
===
--- /dev/null
+++ clang/test/Headers/mm_malloc.c
@@ -0,0 +1,11 @@
+// RUN: %clang -emit-llvm -std=c11 -x c %s -O1 --target=x86_64-linux-gnu -S -o 
- | FileCheck %s
+#include 
+
+_Bool align_test(void) {
+// CHECK-LABEL: @align_test(
+// CHECK:ret i1 true
+ void *p = _mm_malloc(1024, 16);
+_Bool ret = ((__UINTPTR_TYPE__)p % 16) == 0;
+_mm_free(p);
+return ret;
+}
Index: clang/lib/Headers/mm_malloc.h
===
--- clang/lib/Headers/mm_malloc.h
+++ clang/lib/Headers/mm_malloc.h
@@ -28,9 +28,9 @@
 
 #if !(defined(_WIN32) && defined(_mm_malloc))
 static __inline__ void *__attribute__((__always_inline__, __nodebug__,
-   __malloc__))
-_mm_malloc(size_t __size, size_t __align)
-{
+   __malloc__, alloc_size(1),
+   alloc_align(2)))
+_mm_malloc(size_t __size, size_t __align) {
   if (__align == 1) {
 return malloc(__size);
   }


Index: clang/test/Headers/mm_malloc.c
===
--- /dev/null
+++ clang/test/Headers/mm_malloc.c
@@ -0,0 +1,11 @@
+// RUN: %clang -emit-llvm -std=c11 -x c %s -O1 --target=x86_64-linux-gnu -S -o - | FileCheck %s
+#include 
+
+_Bool align_test(void) {
+// CHECK-LABEL: @align_test(
+// CHECK:ret i1 true
+ void *p = _mm_malloc(1024, 16);
+_Bool ret = ((__UINTPTR_TYPE__)p % 16) == 0;
+_mm_free(p);
+return ret;
+}
Index: clang/lib/Headers/mm_malloc.h
===
--- clang/lib/Headers/mm_malloc.h
+++ clang/lib/Headers/mm_malloc.h
@@ -28,9 +28,9 @@
 
 #if !(defined(_WIN32) && defined(_mm_malloc))
 static __inline__ void *__attribute__((__always_inline__, __nodebug__,
-   __malloc__))
-_mm_malloc(size_t __size, size_t __align)
-{
+   __malloc__, alloc_size(1),
+   alloc_align(2)))
+_mm_malloc(size_t __size, size_t __align) {
   if (__align == 1) {
 return malloc(__size);
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117091: [Clang] Add attributes alloc_size and alloc_align to mm_malloc

2022-01-22 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 updated this revision to Diff 402206.
xbolva00 added a comment.

Added testcase


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117091/new/

https://reviews.llvm.org/D117091

Files:
  clang/lib/Headers/mm_malloc.h
  clang/test/Headers/mm_malloc.c


Index: clang/test/Headers/mm_malloc.c
===
--- /dev/null
+++ clang/test/Headers/mm_malloc.c
@@ -0,0 +1,11 @@
+// RUN: %clang -emit-llvm -std=c11 -x c %s -O1 --target=x86_64-linux-gnu -S -o 
- | FileCheck %s
+#include 
+
+_Bool align_test(void) {
+// CHECK-LABEL: @align_test(
+// CHECK:ret i1 true
+ void *p = _mm_malloc(2014, 16);
+_Bool ret = ((__UINTPTR_TYPE__)p % 16) == 0;
+_mm_free(p);
+return ret;
+}
Index: clang/lib/Headers/mm_malloc.h
===
--- clang/lib/Headers/mm_malloc.h
+++ clang/lib/Headers/mm_malloc.h
@@ -28,9 +28,9 @@
 
 #if !(defined(_WIN32) && defined(_mm_malloc))
 static __inline__ void *__attribute__((__always_inline__, __nodebug__,
-   __malloc__))
-_mm_malloc(size_t __size, size_t __align)
-{
+   __malloc__, alloc_size(1),
+   alloc_align(2)))
+_mm_malloc(size_t __size, size_t __align) {
   if (__align == 1) {
 return malloc(__size);
   }


Index: clang/test/Headers/mm_malloc.c
===
--- /dev/null
+++ clang/test/Headers/mm_malloc.c
@@ -0,0 +1,11 @@
+// RUN: %clang -emit-llvm -std=c11 -x c %s -O1 --target=x86_64-linux-gnu -S -o - | FileCheck %s
+#include 
+
+_Bool align_test(void) {
+// CHECK-LABEL: @align_test(
+// CHECK:ret i1 true
+ void *p = _mm_malloc(2014, 16);
+_Bool ret = ((__UINTPTR_TYPE__)p % 16) == 0;
+_mm_free(p);
+return ret;
+}
Index: clang/lib/Headers/mm_malloc.h
===
--- clang/lib/Headers/mm_malloc.h
+++ clang/lib/Headers/mm_malloc.h
@@ -28,9 +28,9 @@
 
 #if !(defined(_WIN32) && defined(_mm_malloc))
 static __inline__ void *__attribute__((__always_inline__, __nodebug__,
-   __malloc__))
-_mm_malloc(size_t __size, size_t __align)
-{
+   __malloc__, alloc_size(1),
+   alloc_align(2)))
+_mm_malloc(size_t __size, size_t __align) {
   if (__align == 1) {
 return malloc(__size);
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114611: [AVR] Expand STDWSPQRr & STDSPQRr, approach #2

2022-01-22 Thread Patryk Wychowaniec via Phabricator via cfe-commits
Patryk27 added inline comments.



Comment at: llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp:1261
+if (!DstIsKill) {
+  buildMI(MBB, MBBI, AVR::POPWRd).addDef(Dst.getReg());
+}

I'm not sure if that's correct, but the previous approach:
```
buildMI(MBB, MBBI, AVR::POPWRd)
.addDef(Ptr.getReg(), getKillRegState(Ptr.isKill()));
```
... wasn't correct either, since it's not possible to `addDef()` a killed 
register (this crashes LLVM, but there was no test to check it on our side).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114611/new/

https://reviews.llvm.org/D114611

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114611: [AVR] Expand STDWSPQRr & STDSPQRr, approach #2

2022-01-22 Thread Patryk Wychowaniec via Phabricator via cfe-commits
Patryk27 updated this revision to Diff 402203.
Herald added subscribers: cfe-commits, mgorny.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114611/new/

https://reviews.llvm.org/D114611

Files:
  clang/docs/tools/clang-formatted-files.txt
  llvm/lib/Target/AVR/AVR.h
  llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp
  llvm/lib/Target/AVR/AVRFrameLowering.cpp
  llvm/lib/Target/AVR/AVRRegisterInfo.cpp
  llvm/lib/Target/AVR/AVRRelaxMemOperations.cpp
  llvm/lib/Target/AVR/AVRSubtarget.h
  llvm/lib/Target/AVR/AVRTargetMachine.cpp
  llvm/lib/Target/AVR/CMakeLists.txt
  llvm/test/CodeGen/AVR/PR31344.ll
  llvm/test/CodeGen/AVR/PR31345.ll
  llvm/test/CodeGen/AVR/PR37143.ll
  llvm/test/CodeGen/AVR/avr-rust-issue-123.ll
  llvm/test/CodeGen/AVR/frmidx-iterator-bug.ll
  llvm/test/CodeGen/AVR/hardware-mul.ll
  llvm/test/CodeGen/AVR/mul-hardware.ll
  llvm/test/CodeGen/AVR/mul-software.ll
  llvm/test/CodeGen/AVR/past-bugs/D114611.ll
  llvm/test/CodeGen/AVR/past-bugs/PR31344.ll
  llvm/test/CodeGen/AVR/past-bugs/PR31345.ll
  llvm/test/CodeGen/AVR/past-bugs/PR37143.ll
  llvm/test/CodeGen/AVR/past-bugs/avr-rust-issue-123.ll
  llvm/test/CodeGen/AVR/past-bugs/frmidx-iterator-bug.ll
  llvm/test/CodeGen/AVR/past-bugs/rust-avr-bug-112.ll
  llvm/test/CodeGen/AVR/past-bugs/rust-avr-bug-37.ll
  llvm/test/CodeGen/AVR/past-bugs/rust-avr-bug-95.ll
  llvm/test/CodeGen/AVR/past-bugs/rust-avr-bug-99.ll
  llvm/test/CodeGen/AVR/pseudo/STDSPQRr.mir
  llvm/test/CodeGen/AVR/pseudo/STDWPtrQRr.mir
  llvm/test/CodeGen/AVR/pseudo/STDWSPQRr.mir
  llvm/test/CodeGen/AVR/relax-mem/STDWPtrQRr.mir
  llvm/test/CodeGen/AVR/rust-avr-bug-112.ll
  llvm/test/CodeGen/AVR/rust-avr-bug-37.ll
  llvm/test/CodeGen/AVR/rust-avr-bug-95.ll
  llvm/test/CodeGen/AVR/rust-avr-bug-99.ll
  llvm/test/CodeGen/AVR/software-mul.ll
  llvm/utils/UpdateTestChecks/asm.py
  llvm/utils/gn/secondary/llvm/lib/Target/AVR/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/lib/Target/AVR/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/lib/Target/AVR/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/lib/Target/AVR/BUILD.gn
@@ -37,7 +37,6 @@
 "AVRInstrInfo.cpp",
 "AVRMCInstLower.cpp",
 "AVRRegisterInfo.cpp",
-"AVRRelaxMemOperations.cpp",
 "AVRShiftExpand.cpp",
 "AVRSubtarget.cpp",
 "AVRTargetMachine.cpp",
Index: llvm/utils/UpdateTestChecks/asm.py
===
--- llvm/utils/UpdateTestChecks/asm.py
+++ llvm/utils/UpdateTestChecks/asm.py
@@ -391,6 +391,7 @@
 def get_triple_from_march(march):
   triples = {
   'amdgcn': 'amdgcn',
+  'avr': 'avr',
   'r600': 'r600',
   'mips': 'mips',
   'sparc': 'sparc',
Index: llvm/test/CodeGen/AVR/relax-mem/STDWPtrQRr.mir
===
--- llvm/test/CodeGen/AVR/relax-mem/STDWPtrQRr.mir
+++ /dev/null
@@ -1,31 +0,0 @@
-# RUN: llc -O0 -run-pass=avr-relax-mem %s -o - | FileCheck %s
-
 |
-  target triple = "avr--"
-  define void @test() {
-  entry:
-ret void
-  }
-...
-

-name:test
-body: |
-  bb.0.entry:
-
-; CHECK-LABEL: test
-
-; We shouldn't expand things which already have 6-bit imms.
-; CHECK: STDWPtrQRr $r29r28, 63, $r1r0
-STDWPtrQRr $r29r28, 63, $r1r0
-
-; We shouldn't expand things which already have 6-bit imms.
-; CHECK-NEXT: STDWPtrQRr $r29r28, 0, $r1r0
-STDWPtrQRr $r29r28, 0, $r1r0
-
-; CHECK-NEXT: PUSHWRr $r29r28, implicit-def $sp, implicit $sp
-; CHECK-NEXT: $r29r28 = SBCIWRdK $r29r28, -64, implicit-def $sreg, implicit $sreg
-; CHECK-NEXT: STWPtrRr $r29r28, $r1r0
-; CHECK-NEXT: $r29r28 = POPWRd implicit-def $sp, implicit $sp
-STDWPtrQRr $r29r28, 64, $r1r0
-...
Index: llvm/test/CodeGen/AVR/pseudo/STDWSPQRr.mir
===
--- /dev/null
+++ llvm/test/CodeGen/AVR/pseudo/STDWSPQRr.mir
@@ -0,0 +1,20 @@
+# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - | FileCheck %s
+
+--- |
+  target triple = "avr--"
+  define void @test() {
+  entry:
+ret void
+  }
+...
+
+---
+name:test
+body: |
+  bb.0.entry:
+
+; CHECK: STDPtrQRr $r31r30, 10, $r9
+; CHECK-NEXT: STDPtrQRr $r31r30, 11, $r10
+
+STDWSPQRr $sp, 10, $r10r9, implicit-def $sp
+...
Index: llvm/test/CodeGen/AVR/pseudo/STDWPtrQRr.mir
===
--- llvm/test/CodeGen/AVR/pseudo/STDWPtrQRr.mir
+++ llvm/test/CodeGen/AVR/pseudo/STDWPtrQRr.mir
@@ -15,8 +15,52 @@
 
 ; CHECK-LABEL: test
 
-; CHECK:  STDPtrQRr $r29r28, 10, $r0
-; CHECK-NEXT: STDPtrQRr $r29r28, 11, $r1
+; Small displacement (<63):
+; CHECK:  STDPtrQRr $r29r28, 3, $r0
+; CHECK-NEXT: STDPtrQRr $r29r28, 4, $r1
+STDWPtrQRr $r29r28, 3, $r1r0
 
-STDWPtrQRr $r29r28, 10, $r1r0
+; Small displacement where the destination register 

[PATCH] D117520: [clang-format] Fix SeparateDefinitionBlocks issues

2022-01-22 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

maybe slightly related https://github.com/llvm/llvm-project/issues/53183 in 
that this is also impacted by the 5 character 
`TT_FunctionLikeOrFreestandingMacro`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117520/new/

https://reviews.llvm.org/D117520

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117416: [clang-format] Handle C variables with name that matches c++ access specifier

2022-01-22 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay accepted this revision.
MyDeveloperDay added a comment.

new nits but basically I think this looks like it might handle this ok? LGTM

We need to run this across a large code base to check




Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:106
+  bool returnValue{false};
+  if (RootToken.isAccessSpecifier(Style.isCpp())) {
+returnValue = true;

remove extraneous `{}` braces


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117416/new/

https://reviews.llvm.org/D117416

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117924: [compiler_rt] Add a seperate runtime for Mac Catalyst

2022-01-22 Thread Byoungchan Lee via Phabricator via cfe-commits
bc-lee updated this revision to Diff 402201.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117924/new/

https://reviews.llvm.org/D117924

Files:
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/test/Driver/darwin-sanitizer-ld.c
  compiler-rt/cmake/builtin-config-ix.cmake
  compiler-rt/cmake/config-ix.cmake

Index: compiler-rt/cmake/config-ix.cmake
===
--- compiler-rt/cmake/config-ix.cmake
+++ compiler-rt/cmake/config-ix.cmake
@@ -310,7 +310,7 @@
   if ("${platform}" STREQUAL "")
 message(FATAL_ERROR "platform cannot be empty")
   endif()
-  if ("${platform}" MATCHES "^(osx|((ios|watchos|tvos)(sim)?))$")
+  if ("${platform}" MATCHES "^(osx|((ios|watchos|tvos)(sim)?)|catalyst)$")
 set(is_valid TRUE)
   endif()
   set(${is_valid_out} ${is_valid} PARENT_SCOPE)
@@ -347,6 +347,7 @@
   include(CompilerRTDarwinUtils)
 
   find_darwin_sdk_dir(DARWIN_osx_SYSROOT macosx)
+  find_darwin_sdk_dir(DARWIN_catalyst_SYSROOT macosx)
   find_darwin_sdk_dir(DARWIN_iossim_SYSROOT iphonesimulator)
   find_darwin_sdk_dir(DARWIN_ios_SYSROOT iphoneos)
   find_darwin_sdk_dir(DARWIN_watchossim_SYSROOT watchsimulator)
@@ -372,6 +373,12 @@
 set(DARWIN_iossim_MIN_VER_FLAG -mios-simulator-version-min)
 set(DARWIN_iossim_SANITIZER_MIN_VER_FLAG
   ${DARWIN_iossim_MIN_VER_FLAG}=${DARWIN_ios_MIN_VER})
+list(APPEND DARWIN_EMBEDDED_PLATFORMS catalyst)
+set(DARWIN_catalyst_MIN_VER 13.0)
+set(DARWIN_catalyst_SANITIZER_MIN_VER_FLAG
+${DARWIN_ios_MIN_VER_FLAG}=${DARWIN_catalyst_MIN_VER}
+-target
+${LIB_ARCH}-apple-ios${DARWIN_catalyst_MIN_VER}-macabi)
   endif()
   if(COMPILER_RT_ENABLE_WATCHOS)
 list(APPEND DARWIN_EMBEDDED_PLATFORMS watchos)
@@ -499,6 +506,10 @@
 endforeach()
   endif()
 
+  if("${platform}" STREQUAL "catalyst")
+set(DARWIN_${platform}_SKIP_CC_KEXT On)
+  endif()
+
   if(DARWIN_${platform}_SYSROOT)
 set(DARWIN_${platform}_CFLAGS
   ${DARWIN_COMMON_CFLAGS}
Index: compiler-rt/cmake/builtin-config-ix.cmake
===
--- compiler-rt/cmake/builtin-config-ix.cmake
+++ compiler-rt/cmake/builtin-config-ix.cmake
@@ -71,6 +71,7 @@
 if(APPLE)
 
   find_darwin_sdk_dir(DARWIN_osx_SYSROOT macosx)
+  find_darwin_sdk_dir(DARWIN_catalyst_SYSROOT macosx)
   find_darwin_sdk_dir(DARWIN_iossim_SYSROOT iphonesimulator)
   find_darwin_sdk_dir(DARWIN_ios_SYSROOT iphoneos)
   find_darwin_sdk_dir(DARWIN_watchossim_SYSROOT watchsimulator)
@@ -115,7 +116,14 @@
 set(DARWIN_ios_BUILTIN_MIN_VER_FLAG
   ${DARWIN_ios_MIN_VER_FLAG}=${DARWIN_ios_BUILTIN_MIN_VER})
 set(DARWIN_ios_BUILTIN_ALL_POSSIBLE_ARCHS ${ARM64} ${ARM32})
-set(DARWIN_iossim_BUILTIN_ALL_POSSIBLE_ARCHS ${X86} ${X86_64})
+set(DARWIN_iossim_BUILTIN_ALL_POSSIBLE_ARCHS ${X86} ${X86_64} ${ARM64})
+list(APPEND DARWIN_EMBEDDED_PLATFORMS catalyst)
+set(DARWIN_catalyst_BUILTIN_MIN_VER 13.0)
+set(DARWIN_catalyst_BUILTIN_MIN_VER_FLAG
+${DARWIN_ios_MIN_VER_FLAG}=${DARWIN_catalyst_BUILTIN_MIN_VER}
+-target
+${LIB_ARCH}-apple-ios${DARWIN_catalyst_BUILTIN_MIN_VER}-macabi)
+set(DARWIN_catalyst_BUILTIN_ALL_POSSIBLE_ARCHS ${X86_64} ${ARM64})
   endif()
   if(COMPILER_RT_ENABLE_WATCHOS)
 list(APPEND DARWIN_EMBEDDED_PLATFORMS watchos)
@@ -178,6 +186,10 @@
   endforeach()
 endif()
 
+if("${platform}" STREQUAL "catalyst")
+  set(DARWIN_${platform}_SKIP_CC_KEXT On)
+endif()
+
 if(DARWIN_${platform}_SYSROOT)
   darwin_test_archs(${platform}
 DARWIN_${platform}_BUILTIN_ARCHS
Index: clang/test/Driver/darwin-sanitizer-ld.c
===
--- clang/test/Driver/darwin-sanitizer-ld.c
+++ clang/test/Driver/darwin-sanitizer-ld.c
@@ -101,7 +101,7 @@
 // CHECK-ASAN-MACCATALYST: "{{.*}}ld{{(.exe)?}}"
 // CHECK-ASAN-MACCATALYST-NOT: "-lstdc++"
 // CHECK-ASAN-MACCATALYST-NOT: "-lc++"
-// CHECK-ASAN-MACCATALYST: libclang_rt.asan_osx_dynamic.dylib"
+// CHECK-ASAN-MACCATALYST: libclang_rt.asan_catalyst_dynamic.dylib"
 // CHECK-ASAN-MACCATALYST: "-rpath" "@executable_path"
 // CHECK-ASAN-MACCATALYST: "-rpath" "{{.*}}lib{{.*}}darwin"
 
Index: clang/lib/Driver/ToolChains/Darwin.cpp
===
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1219,7 +1219,7 @@
 return "osx";
   case DarwinPlatformKind::IPhoneOS:
 if (TargetEnvironment == MacCatalyst)
-  return "osx";
+  return "catalyst";
 return TargetEnvironment == NativeEnvironment || IgnoreSim ? "ios"
: "iossim";
   case DarwinPlatformKind::TvOS:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D116478: [clang-tidy] A semicolon-separated list of the names of functions or methods to be considered as not having side-effects

2022-01-22 Thread Zinovy Nis via Phabricator via cfe-commits
zinovy.nis updated this revision to Diff 402199.
zinovy.nis added a comment.

- Remove unused include.
- Update release notes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116478/new/

https://reviews.llvm.org/D116478

Files:
  clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/bugprone-assert-side-effect.rst
  clang-tools-extra/test/clang-tidy/checkers/bugprone-assert-side-effect.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-assert-side-effect.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone-assert-side-effect.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone-assert-side-effect.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s bugprone-assert-side-effect %t -- -config="{CheckOptions: [{key: bugprone-assert-side-effect.CheckFunctionCalls, value: true}, {key: bugprone-assert-side-effect.AssertMacros, value: 'assert,assert2,my_assert,convoluted_assert,msvc_assert'}]}" -- -fexceptions
+// RUN: %check_clang_tidy %s bugprone-assert-side-effect %t -- -config="{CheckOptions: [{key: bugprone-assert-side-effect.CheckFunctionCalls, value: true}, {key: bugprone-assert-side-effect.AssertMacros, value: 'assert,assert2,my_assert,convoluted_assert,msvc_assert'}, {key: bugprone-assert-side-effect.IgnoredFunctions, value: 'MyClass::badButIgnoredFunc'}]}" -- -fexceptions
 
 //===--- assert definition block --===//
 int abort() { return 0; }
@@ -43,9 +43,12 @@
 
 //===--===//
 
+bool badButIgnoredFunc(int a, int b) { return a * b > 0; }
+
 class MyClass {
 public:
   bool badFunc(int a, int b) { return a * b > 0; }
+  bool badButIgnoredFunc(int a, int b) { return a * b > 0; }
   bool goodFunc(int a, int b) const { return a * b > 0; }
 
   MyClass =(const MyClass ) { return *this; }
@@ -57,6 +60,11 @@
   void operator delete(void *p) {}
 };
 
+class SomeoneElseClass {
+public:
+  bool badButIgnoredFunc(int a, int b) { return a * b > 0; }
+};
+
 bool freeFunction() {
   return true;
 }
@@ -85,8 +93,16 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: side effect in assert() condition discarded in release builds
 
   MyClass mc;
+  SomeoneElseClass sec;
   assert(mc.badFunc(0, 1));
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: side effect in assert() condition discarded in release builds
+  assert(mc.badButIgnoredFunc(0, 1));
+  // badButIgnoredFunc is not ignored as only class members are ignored by the config
+  assert(badButIgnoredFunc(0, 1));
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: side effect in assert() condition discarded in release builds
+  // sec.badButIgnoredFunc is not ignored as only MyClass members are ignored by the config
+  assert(sec.badButIgnoredFunc(0, 1));
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: side effect in assert() condition discarded in release builds
   assert(mc.goodFunc(0, 1));
 
   MyClass mc2;
Index: clang-tools-extra/docs/clang-tidy/checks/bugprone-assert-side-effect.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/bugprone-assert-side-effect.rst
+++ clang-tools-extra/docs/clang-tidy/checks/bugprone-assert-side-effect.rst
@@ -21,3 +21,13 @@
Whether to treat non-const member and non-member functions as they produce
side effects. Disabled by default because it can increase the number of false
positive warnings.
+
+.. option:: IgnoredFunctions
+
+   A semicolon-separated list of the names of functions or methods to be
+   considered as not having side-effects. Regular expressions are accepted,
+   e.g. `[Rr]ef(erence)?$` matches every type with suffix `Ref`, `ref`,
+   `Reference` and `reference`. The default is empty. If a name in the list
+   contains the sequence `::` it is matched against the qualified typename
+   (i.e. `namespace::Type`, otherwise it is matched against only
+   the type name (i.e. `Type`).
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -156,7 +156,13 @@
 Changes in existing checks
 ^^
 
+- :doc:`bugprone-assert-side-effect `
+  check now supports an ``IgnoredFunctions`` option to explicitly consider
+  the specified semicolon-separated functions list as not any having
+  side-effects. Regular expressions for the list items are also accepted.
+
 - Removed default setting ``cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors = "true"``,
+  from :doc:`cppcoreguidelines-explicit-virtual-functions `
   to match the current state of the C++ Core Guidelines.
 
 - Updated :doc:`google-readability-casting
@@ -168,10 

[PATCH] D117881: [X86] Remove avx512f integer and/or/xor/min/max reduction intrinsics and use generic equivalents

2022-01-22 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei accepted this revision.
pengfei added a comment.

I see. Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117881/new/

https://reviews.llvm.org/D117881

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117881: [X86] Remove avx512f integer and/or/xor/min/max reduction intrinsics and use generic equivalents

2022-01-22 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added a comment.

In D117881#3263152 , @pengfei wrote:

> What's the difference between `__builtin_reduce_and` and generating a 
> `Intrinsic::vector_reduce_and` in code? If this is just a simplification, why 
> can't be applied to `add` too?

There's a few questions about whether we can reuse a `__builtin_reduce_add` 
builtin for both integer and float types - they need to be addressed before we 
can decide on its final functionality - same for `__builtin_reduce_mul`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117881/new/

https://reviews.llvm.org/D117881

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117860: [RISCV] Remove experimental prefix from rvv-related extensions.

2022-01-22 Thread Yueh-Ting Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 402192.
eopXD added a comment.

Rebase.
Resolve conflict due to addition of zbkc.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117860/new/

https://reviews.llvm.org/D117860

Files:
  clang/test/CodeGen/RISCV/riscv-attr-builtin-alias-err.c
  clang/test/CodeGen/RISCV/riscv-attr-builtin-alias.c
  clang/test/CodeGen/RISCV/riscv-inline-asm-rvv.c
  clang/test/CodeGen/RISCV/riscv-v-debuginfo.c
  clang/test/CodeGen/RISCV/riscv-v-lifetime.cpp
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vaadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vadc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vand.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vasub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vcompress.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vcpop.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vdiv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfabs.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfclass.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfcvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfdiv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfirst.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmax.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmerge.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmin.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfncvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfneg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfnmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfnmadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfnmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfnmsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfrdiv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfrec7.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfredmax.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfredmin.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfredsum.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfrsqrt7.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfrsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfsgnj.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfslide1down.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfslide1up.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfsqrt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwcvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwnmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwnmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwredsum.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vget.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vid.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/viota.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vle.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vloxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vloxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlse.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlsegff.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlsseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vluxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vluxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmadc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmand.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmax.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmerge.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmfeq.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmfge.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmfgt.c
  

[PATCH] D117854: [RISCV] Decouple Zve* extensions and the V extension.

2022-01-22 Thread Jianjian Guan via Phabricator via cfe-commits
jacquesguan updated this revision to Diff 402188.
jacquesguan added a comment.

Fix test case


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117854/new/

https://reviews.llvm.org/D117854

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/RISCV.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/RISCV/rvb-intrinsics/riscv32-zbb-error.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/rvv-error.c
  clang/utils/TableGen/RISCVVEmitter.cpp
  llvm/lib/Support/RISCVISAInfo.cpp
  llvm/lib/Target/RISCV/RISCV.td
  llvm/lib/Target/RISCV/RISCVSubtarget.h
  llvm/test/CodeGen/RISCV/attributes.ll
  llvm/test/MC/RISCV/attribute-arch.s

Index: llvm/test/MC/RISCV/attribute-arch.s
===
--- llvm/test/MC/RISCV/attribute-arch.s
+++ llvm/test/MC/RISCV/attribute-arch.s
@@ -36,7 +36,7 @@
 ## Experimental extensions require version string to be explicitly specified
 
 .attribute arch, "rv32iv0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32izba1p0"
 # CHECK: attribute  5, "rv32i2p0_zba1p0"
@@ -75,43 +75,43 @@
 # CHECK: attribute  5, "rv32i2p0_f2p0_zfh1p0_zfhmin1p0"
 
 .attribute arch, "rv32iv0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl32b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl64b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl128b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl256b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl512b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl1024b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl1024b0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl2048b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl4096b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl8192b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10"
 
 .attribute arch, "rv32iv0p10zvl16384b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl1024b0p10_zvl128b0p10_zvl16384b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10"
+# CHECK: 

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-01-22 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray marked an inline comment as done.
lichray added a comment.

Restricted the ellipsis only to diagnosis. Type comparison now shows full 
initializers, which could be made smarter next time.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115031/new/

https://reviews.llvm.org/D115031

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117854: [RISCV] Decouple Zve* extensions and the V extension.

2022-01-22 Thread Jianjian Guan via Phabricator via cfe-commits
jacquesguan added inline comments.



Comment at: clang/lib/Sema/SemaChecking.cpp:3978
   for (StringRef F : ReqFeatures) {
-if (TI.hasFeature(F))
-  continue;
-
-// If the feature is 64bit, alter the string so it will print better in
-// the diagnostic.
-if (F == "64bit")
-  F = "RV64";
-
-// Convert features like "zbr" and "experimental-zbr" to "Zbr".
-F.consume_front("experimental-");
-std::string FeatureStr = F.str();
-FeatureStr[0] = std::toupper(FeatureStr[0]);
+SmallVector ReqOpFeatures;
+F.split(ReqOpFeatures, '|');

craig.topper wrote:
> Is this change testable?
Done, I add a test case `clang/test/CodeGen/RISCV/rvv-intrinsics/rvv-error.c` 
to test this.



Comment at: llvm/lib/Support/RISCVISAInfo.cpp:697
   bool HasZvl = MinVLen != 0;
 
   if (HasE && !IsRv32)

craig.topper wrote:
> Should we check that Zve and V are not specified together?
Done.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117854/new/

https://reviews.llvm.org/D117854

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117854: [RISCV] Decouple Zve* extensions and the V extension.

2022-01-22 Thread Jianjian Guan via Phabricator via cfe-commits
jacquesguan updated this revision to Diff 402184.
jacquesguan added a comment.

Address comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117854/new/

https://reviews.llvm.org/D117854

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/RISCV.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/RISCV/rvb-intrinsics/riscv32-zbb-error.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/rvv-error.c
  clang/utils/TableGen/RISCVVEmitter.cpp
  llvm/lib/Support/RISCVISAInfo.cpp
  llvm/lib/Target/RISCV/RISCV.td
  llvm/lib/Target/RISCV/RISCVSubtarget.h
  llvm/test/CodeGen/RISCV/attributes.ll
  llvm/test/MC/RISCV/attribute-arch.s

Index: llvm/test/MC/RISCV/attribute-arch.s
===
--- llvm/test/MC/RISCV/attribute-arch.s
+++ llvm/test/MC/RISCV/attribute-arch.s
@@ -36,7 +36,7 @@
 ## Experimental extensions require version string to be explicitly specified
 
 .attribute arch, "rv32iv0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32izba1p0"
 # CHECK: attribute  5, "rv32i2p0_zba1p0"
@@ -75,43 +75,43 @@
 # CHECK: attribute  5, "rv32i2p0_f2p0_zfh1p0_zfhmin1p0"
 
 .attribute arch, "rv32iv0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl32b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl64b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl128b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl256b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl512b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl1024b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl1024b0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl2048b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl4096b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10"
 
 .attribute arch, "rv32iv0p10zvl8192b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10"
 
 .attribute arch, "rv32iv0p10zvl16384b0p10"
-# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zve32f0p10_zve32x0p10_zve64d0p10_zve64f0p10_zve64x0p10_zvl1024b0p10_zvl128b0p10_zvl16384b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10"
+#