[PATCH] D134284: [AIX] change "llvm-nm" to "env OBJECT_MODE=any llvm-nm" in clang/test for AIX OS

2022-09-21 Thread James Henderson via Phabricator via cfe-commits
jhenderson accepted this revision.
jhenderson added a comment.

LGTM, with nit.




Comment at: clang/test/lit.cfg.py:287
+
+# llvm-nm tools support an environment variable "OBJECT_MODE" on AIX OS, which
+# controls the kind of objects they will support. If there is no "OBJECT_MODE"




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134284

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


[PATCH] D88299: [clang-format] Add MacroUnexpander.

2022-09-21 Thread Owen Pan via Phabricator via cfe-commits
owenpan added subscribers: MyDeveloperDay, owenpan.
owenpan added a comment.

@sstwcw thanks for pointing it out. See D134329 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88299

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


[PATCH] D133108: [clang] Rework IsTailPaddedMemberArray into isFlexibleArrayMemberExpr

2022-09-21 Thread serge via Phabricator via cfe-commits
serge-sans-paille added inline comments.



Comment at: clang/test/Sema/unbounded-array-bounds.c:101
+  char tail[1];  // addr16-note {{declared here}} addr32-note {{declared here}}
+} fam1;
+

msebor wrote:
> msebor wrote:
> > There's a difference between the sizes of `fam1` and `fam` that makes 
> > accesses to the four leading elements of `fam1.tail` strictly in bounds, 
> > while no access to either `fam.tail` or `fam0.tail` is (`sizeof fam` is the 
> > same as `sizeof int` while `sizeof fam1` is equal to `sizeof (int[2])` on 
> > common targets).  It would be helpful to capture that difference in the 
> > tests, both for the warning and for `__builtin_object_size`.
> > 
> > There should also be a difference between accessing elements of an object 
> > of an initialized struct with a flexible array member (i.e., one whose size 
> > is known) and those of an object that's only declared but that's defined in 
> > some other translation unit.  Since the size of the object is determined by 
> > its initializer, it should be reflected in `__builtin_object_size` and 
> > accesses to it checked by `-Warray-bounds`.  The size of the latter object 
> > is unknown it must be assumed to be `PTRDIFF_MAX - sizeof (int) - 1`.  It 
> > would also be helpful to add tests for these cases.
> > 
> > As far as I can see, none of these cases seems to be handled quite right on 
> > trunk.  For example, the size of `s` below should be 8 but Clang evaluates 
> > `__builtin_object_size(&s, N)` to 4, without diagnosing any past-the-end 
> > accesses to `s.a`:
> > ```
> > struct S {
> >   int n;
> >   char a[];
> > } s = { 1, { 2, 3, 4, 5 } };
> > ```
> I opened [[ https://github.com/llvm/llvm-project/issues/57860 | PR #57860 ]] 
> to better show what I mean.
Agreed. I suggest we discuss that in this PR, while me merge this "code cleanup 
with enhancement", if @aaron.ballman agrees :-)


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

https://reviews.llvm.org/D133108

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


[PATCH] D134329: [clang-format][NFC] Reformat clang/lib/Format using 6257832bf94f

2022-09-21 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay accepted this revision.
MyDeveloperDay added a comment.
This revision is now accepted and ready to land.

LGTM, we of all people have to dogfood this stuff..


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134329

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


[PATCH] D134270: [clang] [Driver] Support multiple configuration files

2022-09-21 Thread Michał Górny via Phabricator via cfe-commits
mgorny updated this revision to Diff 461803.
mgorny added a comment.

Combining `--config` and default configuration files is now explicitly allowed.

Adjust the code to load default configs before explicitly specified files. 
Update tests to cover combining `--config` with defaults. Update the 
documentation.


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

https://reviews.llvm.org/D134270

Files:
  clang/docs/UsersManual.rst
  clang/include/clang/Driver/Driver.h
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/config-file-errs.c
  clang/test/Driver/config-file.c
  clang/test/Driver/config-file3.c

Index: clang/test/Driver/config-file3.c
===
--- clang/test/Driver/config-file3.c
+++ clang/test/Driver/config-file3.c
@@ -34,12 +34,13 @@
 // RUN: %t/testdmode/qqq-clang-g++ --config-system-dir= --config-user-dir=%t/testdmode -c -### %s 2>&1 | FileCheck %s -check-prefix SYMLINK
 //
 // SYMLINK: Configuration file: {{.*}}/testdmode/qqq-clang-g++.cfg
-//
-//--- File specified by --config overrides config inferred from clang executable.
+
+//--- File specified by --config is loaded after the one inferred from the executable.
 //
 // RUN: %t/testdmode/qqq-clang-g++ --config-system-dir=%S/Inputs/config --config-user-dir= --config i386-qqq.cfg -c -no-canonical-prefixes -### %s 2>&1 | FileCheck %s -check-prefix CHECK-EXPLICIT
 //
-// CHECK-EXPLICIT: Configuration file: {{.*}}/Inputs/config/i386-qqq.cfg
+// CHECK-EXPLICIT: Configuration file: {{.*}}/testdmode/qqq-clang-g++.cfg
+// CHECK-EXPLICIT-NEXT: Configuration file: {{.*}}/Inputs/config/i386-qqq.cfg
 
 //--- --no-default-config disables config search.
 //
@@ -47,6 +48,13 @@
 //
 // NO-DEFAULT-CONFIG-NOT: Configuration file:
 
+//--- Explicit --config works with --no-default-config.
+//
+// RUN: %t/testdmode/qqq-clang-g++ --config-system-dir=%S/Inputs/config --config-user-dir= --no-default-config --config i386-qqq.cfg -c -no-canonical-prefixes -### %s 2>&1 | FileCheck %s -check-prefix CHECK-EXPLICIT-NO-DEFAULT
+//
+// CHECK-EXPLICIT-NO-DEFAULT-NOT: Configuration file: {{.*}}/testdmode/qqq-clang-g++.cfg
+// CHECK-EXPLICIT-NO-DEFAULT: Configuration file: {{.*}}/Inputs/config/i386-qqq.cfg
+
 //--- Invocation qqq-clang-g++ tries to find config file qqq.cfg if qqq-clang-g++.cfg is not found.
 //
 // RUN: rm %t/testdmode/qqq-clang-g++.cfg
Index: clang/test/Driver/config-file.c
===
--- clang/test/Driver/config-file.c
+++ clang/test/Driver/config-file.c
@@ -73,6 +73,10 @@
 // CHECK-PRECEDENCE: -Wall
 
 
-//--- Duplicate --config options are allowed if the value is the same
-// RUN: %clang --config-system-dir=%S/Inputs/config --config-user-dir=%S/Inputs/config2 --config config-4.cfg --config config-4.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-SAME-CONFIG
-// CHECK-SAME-CONFIG: Configuration file: {{.*}}Inputs{{.}}config2{{.}}config-4.cfg
+//--- Multiple configuration files can be specified.
+// RUN: %clang --config-system-dir=%S/Inputs/config --config-user-dir= --config config-4.cfg --config %S/Inputs/config2/config-4.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-TWO-CONFIGS
+// CHECK-TWO-CONFIGS: Configuration file: {{.*}}Inputs{{.}}config{{.}}config-4.cfg
+// CHECK-TWO-CONFIGS-NEXT: Configuration file: {{.*}}Inputs{{.}}config2{{.}}config-4.cfg
+// CHECK-TWO-CONFIGS: -isysroot
+// CHECK-TWO-CONFIGS-SAME: /opt/data
+// CHECK-TWO-CONFIGS-SAME: -Wall
Index: clang/test/Driver/config-file-errs.c
===
--- clang/test/Driver/config-file-errs.c
+++ clang/test/Driver/config-file-errs.c
@@ -1,9 +1,3 @@
-//--- No more than one '--config' may be specified.
-//
-// RUN: not %clang --config 1.cfg --config 2.cfg 2>&1 | FileCheck %s -check-prefix CHECK-DUPLICATE
-// CHECK-DUPLICATE: no more than one option '--config' is allowed
-
-
 //--- '--config' must be followed by config file name.
 //
 // RUN: not %clang --config 2>&1 | FileCheck %s -check-prefix CHECK-MISSING-FILE
@@ -22,6 +16,11 @@
 // CHECK-NONEXISTENT: configuration file '{{.*}}somewhere/nonexistent-config-file' does not exist
 
 
+//--- All '--config' arguments must be existing files.
+//
+// RUN: not %clang --config %S/Inputs/config-4.cfg --config somewhere/nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NONEXISTENT
+
+
 //--- Argument of '--config' must exist somewhere in well-known directories, if it is specified by bare name.
 //
 // RUN: not %clang --config-system-dir= --config-user-dir= --config nonexistent-config-file.cfg 2>&1 | FileCheck %s -check-prefix CHECK-NOTFOUND0
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -929,6 +929,22 @@
   return false;
 }
 
+static void appendOneArg(InputArgList &Args, const Arg *Opt,
+ 

[PATCH] D134270: [clang] [Driver] Support multiple configuration files

2022-09-21 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

For the record, I'm working on support for loading defaults from multiple files 
in a separate patch.


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

https://reviews.llvm.org/D134270

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


[PATCH] D88299: [clang-format] Add MacroUnexpander.

2022-09-21 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

In D88299#3804910 , @owenpan wrote:

> @sstwcw thanks for pointing it out. See D134329 
> .

Thanks Owen, really appreciate this! And sorry for not getting to it yet myself 
:(


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88299

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


[PATCH] D134325: [clang-format] Look ahead before consuming `bool` in requires clause.

2022-09-21 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

In D134325#3804817 , @zzyyyl wrote:

> What if `concept c = (bool)(...)` ?
>
> or `concept c = static_cast(...)`

Aren't these handled elsewhere in the case (by the static_cast and l_paren 
rules)? but possibly worth a test either an annotation test or an actual 
formatting example.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134325

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


[PATCH] D134325: [clang-format] Look ahead before consuming `bool` in requires clause.

2022-09-21 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

given that #57538 manifested itself as a incorrect format (no doubt because of 
incorrect  token annotation), should we add a verifyFormat tests somewhere for 
the example from the github issue, (it just protects the formatting for being 
broken by some other change)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134325

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


[PATCH] D134316: [clang][docs] Fix supported element types for `__builtin_reduce_(add|mul)`

2022-09-21 Thread Nikita Popov via Phabricator via cfe-commits
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134316

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


[PATCH] D134337: [clang] [Driver] More flexible rules for loading default configs (WIP)

2022-09-21 Thread Michał Górny via Phabricator via cfe-commits
mgorny created this revision.
mgorny added reviewers: sepavloff, MaskRay.
Herald added subscribers: StephenFan, pengfei.
Herald added a reviewer: sscalpone.
Herald added a project: All.
mgorny requested review of this revision.

Update the rules used to load default configuration files to permit
more flexible setups.  Attempt to find `-.cfg` first,
and fall back to loading *both* `.cfg` and `.cfg` if it
does not exist.

While looking for the file, attempt three filenames, in order:

1. The effective target (i.e. respecting `-target`) and effective driver mode 
(i.e. respecting `--driver-mode`).

2. The prefix and mode suffix deduced from the filename, with the architecture 
part substituted to match the effective target.

3. The original prefix and mode suffix from the filename.

When looking for the split configs, try the three prefixes and two mode
suffixes respectively.

One notable change in behavior is that the full filename deduced from
the original prefix and mode suffix (e.g. `x86_64-clang.cfg`) will now
take precedence over the file containing only the "fixed" prefix (e.g.
`i386.cfg`).  Unfortunately, there does not seem to be a clean way of
preserving backwards compatibility without introducing confusing
behavior.

TODO: update docs & tests


https://reviews.llvm.org/D134337

Files:
  clang/lib/Driver/Driver.cpp

Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1058,73 +1058,75 @@
 bool Driver::loadDefaultConfigFiles(ArrayRef CfgFileSearchDirs) {
   if (CLOptions && CLOptions->hasArg(options::OPT_no_default_config))
 return false;
-  if (ClangNameParts.TargetPrefix.empty())
-return false;
 
   // If config file is not specified explicitly, try to deduce configuration
-  // from executable name. For instance, an executable 'armv7l-clang' will
-  // search for config file 'armv7l-clang.cfg'.
-  std::string CfgFileName =
-ClangNameParts.TargetPrefix + '-' + ClangNameParts.ModeSuffix;
-
-  // Determine architecture part of the file name, if it is present.
-  StringRef CfgFileArch = CfgFileName;
-  size_t ArchPrefixLen = CfgFileArch.find('-');
-  if (ArchPrefixLen == StringRef::npos)
-ArchPrefixLen = CfgFileArch.size();
-  llvm::Triple CfgTriple;
-  CfgFileArch = CfgFileArch.take_front(ArchPrefixLen);
-  CfgTriple = llvm::Triple(llvm::Triple::normalize(CfgFileArch));
-  if (CfgTriple.getArch() == llvm::Triple::ArchType::UnknownArch)
-ArchPrefixLen = 0;
-
-  if (!StringRef(CfgFileName).endswith(".cfg"))
-CfgFileName += ".cfg";
-
-  // If config file starts with architecture name and command line options
-  // redefine architecture (with options like -m32 -LE etc), try finding new
-  // config file with that architecture.
-  SmallString<128> FixedConfigFile;
-  size_t FixedArchPrefixLen = 0;
-  if (ArchPrefixLen) {
-// Get architecture name from config file name like 'i386.cfg' or
-// 'armv7l-clang.cfg'.
-// Check if command line options changes effective triple.
-llvm::Triple EffectiveTriple =
-computeTargetTriple(*this, CfgTriple.getTriple(), *CLOptions);
-if (CfgTriple.getArch() != EffectiveTriple.getArch()) {
-  FixedConfigFile = EffectiveTriple.getArchName();
-  FixedArchPrefixLen = FixedConfigFile.size();
-  // Append the rest of original file name so that file name transforms
-  // like: i386-clang.cfg -> x86_64-clang.cfg.
-  if (ArchPrefixLen < CfgFileName.size())
-FixedConfigFile += CfgFileName.substr(ArchPrefixLen);
-}
-  }
-
-  // Try to find config file. First try file with corrected architecture.
+  // from executable name.
+
+  StringRef EffectiveDriverMode;
+  if (CLOptions)
+EffectiveDriverMode = CLOptions->getLastArgValue(options::OPT_driver_mode);
+  if (EffectiveDriverMode.empty())
+EffectiveDriverMode = ClangNameParts.DriverMode;
+
+  llvm::Triple EffectiveTriple =
+  computeTargetTriple(*this, TargetTriple, *CLOptions);
+  assert(!EffectiveTriple.str().empty());
+  StringRef EffectiveModeSuffix = llvm::StringSwitch(EffectiveDriverMode)
+   .Case("g++", "clang++")
+   .Case("cpp", "clang-cpp")
+   .Case("cl", "clang-cl")
+   .Case("flang", "flang")
+   .Case("dxc", "clang-dxc")
+   .Default("clang");
+
+  // Start with the effective triple and driver mode since this should yield the most correct config for our invocation.
   llvm::SmallString<128> CfgFilePath;
-  if (!FixedConfigFile.empty()) {
-if (searchForFile(CfgFilePath, CfgFileSearchDirs, FixedConfigFile,
-  getVFS()))
-  return readConfigFile(CfgFilePath);
-// If 'x86_64-clang.cfg' was not found, try 'x86_64.cfg'.
-FixedConfigFile.resize(FixedArchPrefixLen);
-FixedConfigFile.append(".cfg");
-if (searchForFile(CfgFilePath, CfgFileSearchDirs, FixedConfigFile,
- 

[PATCH] D134337: [clang] [Driver] More flexible rules for loading default configs (WIP)

2022-09-21 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

@sepavloff, I'd appreciate if you could take a look at the logic before I start 
updating tests.


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

https://reviews.llvm.org/D134337

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


[PATCH] D133633: [CMake] Add ClangBootstrap configuration

2022-09-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: clang/CMakeLists.txt:912-926
+TABLEGEN
+-DLLVM_TABLEGEN=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-tblgen
+-DCLANG_TABLEGEN=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-tblgen
+LINKER  -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/ld.lld
+AR  -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar
+RANLIB  -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib
+OBJCOPY -DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy

I don't think we need a dedicated keyword for each tool, I'd just pass these 
through `CMAKE_ARGS`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133633

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


[PATCH] D132975: [CMake] Add clang-bolt target

2022-09-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek 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/D132975/new/

https://reviews.llvm.org/D132975

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


[PATCH] D132329: [X86][RFC] Using `__bf16` for AVX512_BF16 intrinsics

2022-09-21 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei added inline comments.



Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:2185
+addRegisterClass(MVT::v32bf16, &X86::VR512RegClass);
+setOperationAction(ISD::BUILD_VECTOR, MVT::bf16, Custom);
+setOperationAction(ISD::BUILD_VECTOR, MVT::v8bf16, Custom);

RKSimon wrote:
> Isn't MVT::bf16 scalar? 
Yes, when legalize the source operand, the legalizer gets action as the type 
action, i.e., `TypeSoftPromoteHalf`. However, we don't provide methods to 
handle any vector actions in soft promote. So we need to set it `Custom` here 
to do the customization.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132329

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


[PATCH] D132329: [X86][RFC] Using `__bf16` for AVX512_BF16 intrinsics

2022-09-21 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei added inline comments.



Comment at: llvm/test/CodeGen/X86/avx512bf16-intrinsics-upgrade.ll:30
 ; X64-NEXT:kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
-; X64-NEXT:vcvtne2ps2bf16 %zmm1, %zmm0, %zmm0 {%k1} {z} # encoding: 
[0x62,0xf2,0x7f,0xc9,0x72,0xc1]
+; X64-NEXT:vmovdqu16 %zmm0, %zmm0 {%k1} {z} # encoding: 
[0x62,0xf1,0xff,0xc9,0x6f,0xc0]
 ; X64-NEXT:retq # encoding: [0xc3]

RKSimon wrote:
> any chance we can recover the predicated instruction?
It's possible, e.g., iterate all users of the intrinsic, bitcast all the select 
operands as well; or add patterns for i16; or make vselect peek through bitcast 
etc.
But I think the small performance regression is not a critical requirement as 
the backward compatibility for the old intrinsics. It may not worth the code 
complexity.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132329

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


[PATCH] D134339: [clang][llvm] generate accessibility metadata for type aliases

2022-09-21 Thread Jonathan Camilleri via Phabricator via cfe-commits
J-Camilleri created this revision.
J-Camilleri added a reviewer: dexonsmith.
Herald added subscribers: jeroen.dobbelaere, hiraditya.
Herald added a project: All.
J-Camilleri requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

The accessibility level of a typedef or using declaration in a
struct or class was being lost when producing debug information.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134339

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenCXX/debug-info-access.cpp
  llvm/include/llvm/IR/DIBuilder.h
  llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  llvm/lib/IR/DIBuilder.cpp
  llvm/test/DebugInfo/X86/debug-info-access.ll

Index: llvm/test/DebugInfo/X86/debug-info-access.ll
===
--- llvm/test/DebugInfo/X86/debug-info-access.ll
+++ llvm/test/DebugInfo/X86/debug-info-access.ll
@@ -9,14 +9,30 @@
 ;   struct A {
 ; void pub_default();
 ; static int pub_default_static;
+;
+; using pub_default_using = int;
+; pub_default_using a_pub;
 ;   };
 ;
 ;   class B : public A {
 ;   public:
 ; void pub();
 ; static int public_static;
+;
+; typedef int pub_typedef;
+; pub_typedef pub_member;
+;
+;   protected:
+; using prot_using = int;
+; prot_using prot_member;
+;
+;   private:
+; using priv_using = int;
+; priv_using priv_member;
+;
 ;   protected:
 ; void prot();
+;
 ;   private:
 ; void priv_default();
 ;   };
@@ -28,9 +44,13 @@
 ;   protected:
 ; union E {
 ; };
+;   private:
+; struct J {
+; };
 ;   public:
 ; D d;
 ; E e;
+; J j;
 ;   };
 ;
 ;   struct F {
@@ -57,9 +77,9 @@
 ;
 ;   void free() {}
 ;
+;   U u;
 ;   A a;
 ;   B b;
-;   U u;
 ;   C c;
 ;   F f;
 ;   H h;
@@ -76,7 +96,13 @@
 ; CHECK: DW_TAG_member
 ; CHECK: DW_AT_name {{.*}}"pub_default_static")
 ; CHECK-NOT: DW_AT_accessibility
-; CHECK-NOT: DW_TAG
+
+; CHECK: DW_TAG_member
+; CHECK: DW_AT_name {{.*}}"a_pub")
+
+; CHECK: DW_TAG_typedef
+; CHECK: DW_AT_name {{.*}}"pub_default_using")
+; CHECK-NOT: DW_AT_accessibility
 
 ; CHECK: DW_TAG_subprogram
 ; CHECK: DW_AT_name {{.*}}"pub_default")
@@ -92,6 +118,30 @@
 ; CHECK-NOT: DW_TAG
 ; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public)
 
+; CHECK: DW_TAG_member
+; CHECK: DW_AT_name {{.*}}"pub_member")
+
+; CHECK: DW_TAG_typedef
+; CHECK: DW_AT_name {{.*}}"pub_typedef")
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public)
+
+; CHECK: DW_TAG_member
+; CHECK: DW_AT_name {{.*}}"prot_member")
+
+; CHECK: DW_TAG_typedef
+; CHECK: DW_AT_name {{.*}}"prot_using")
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_protected)
+
+; CHECK: DW_TAG_member
+; CHECK: DW_AT_name {{.*}}"priv_member")
+
+; CHECK: DW_TAG_typedef
+; CHECK: DW_AT_name {{.*}}"priv_using")
+; CHECK-NOT: DW_TAG
+; CHECK-NOT: DW_AT_accessibility
+
 ; CHECK: DW_TAG_subprogram
 ; CHECK: DW_AT_name {{.*}}"pub")
 ; CHECK-NOT: DW_TAG
@@ -129,95 +179,111 @@
 ; CHECK-NOT: DW_AT_accessibility
 
 %union.U = type { i32 }
-%struct.A = type { i8 }
-%class.B = type { i8 }
-%class.C = type { %"struct.C::D", %"union.C::E" }
+%struct.A = type { i32 }
+%class.B = type { %struct.A, i32, i32, i32 }
+%class.C = type { %"struct.C::D", %"union.C::E", %"struct.C::J" }
 %"struct.C::D" = type { i8 }
 %"union.C::E" = type { i8 }
+%"struct.C::J" = type { i8 }
 %struct.F = type { %"union.F::G" }
 %"union.F::G" = type { i8 }
 %union.H = type { %"class.H::I" }
 %"class.H::I" = type { i8 }
 
-@u = global %union.U zeroinitializer, align 4, !dbg !0
-@a = global %struct.A zeroinitializer, align 1, !dbg !5
-@b = global %class.B zeroinitializer, align 1, !dbg !16
-@c = global %class.C zeroinitializer, align 1, !dbg !28
-@f = global %struct.F zeroinitializer, align 1, !dbg !37
-@h = global %union.H zeroinitializer, align 1, !dbg !43
+@u = dso_local global %union.U zeroinitializer, align 4, !dbg !0
+@a = dso_local global %struct.A zeroinitializer, align 4, !dbg !5
+@b = dso_local global %class.B zeroinitializer, align 4, !dbg !18
+@c = dso_local global %class.C zeroinitializer, align 1, !dbg !36
+@f = dso_local global %struct.F zeroinitializer, align 1, !dbg !47
+@h = dso_local global %union.H zeroinitializer, align 1, !dbg !53
 
-; Function Attrs: mustprogress noinline nounwind optnone
-define dso_local void @_Z4freev() #0 !dbg !59 {
+; Function Attrs: mustprogress noinline nounwind optnone uwtable
+define dso_local void @_Z4freev() #0 !dbg !74 {
 entry:
-  ret void, !dbg !62
+  ret void, !dbg !77
 }
 
-attributes #0 = { mustprogress noinline nounwind optnone "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+attributes #0 = { mustprogress noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "

[PATCH] D133807: Update Unicode to 15.0

2022-09-21 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment.

@tahonermann ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133807

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


[PATCH] D133574: [C2x] reject type definitions in offsetof

2022-09-21 Thread YingChi Long via Phabricator via cfe-commits
inclyc updated this revision to Diff 461822.
inclyc added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133574

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Parse/RAIIObjectsForParser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Parser/declarators.c
  clang/test/Sema/offsetof.c
  clang/test/SemaCXX/offsetof.cpp

Index: clang/test/SemaCXX/offsetof.cpp
===
--- clang/test/SemaCXX/offsetof.cpp
+++ clang/test/SemaCXX/offsetof.cpp
@@ -83,3 +83,18 @@
   expected-error {{invalid application of 'offsetof' to a field of a virtual base}}
 };
 }
+
+// Reject definitions in __builtin_offsetof
+// https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
+int test_definition(void) {
+  return __builtin_offsetof(struct A // expected-error{{'A' cannot be defined in '__builtin_offsetof'}} 
+  { 
+int a;
+struct B
+{
+  int c;
+  int d;
+};
+B x;
+  }, a);
+}
Index: clang/test/Sema/offsetof.c
===
--- clang/test/Sema/offsetof.c
+++ clang/test/Sema/offsetof.c
@@ -70,3 +70,16 @@
   return __builtin_offsetof(Array, array[*(int*)0]); // expected-warning{{indirection of non-volatile null pointer}} expected-note{{__builtin_trap}}
 }
 
+// Reject definitions in __builtin_offsetof
+// https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
+int test_definition(void) {
+  return __builtin_offsetof(struct A // expected-error{{'struct A' cannot be defined in '__builtin_offsetof'}} 
+  { 
+int a;
+struct B // expected-error{{'struct B' cannot be defined in '__builtin_offsetof'}}
+{
+  int c;
+  int d;
+} x;
+  }, a);
+}
Index: clang/test/Parser/declarators.c
===
--- clang/test/Parser/declarators.c
+++ clang/test/Parser/declarators.c
@@ -80,10 +80,6 @@
 struct test10 { int a; } static test10x;
 struct test11 { int a; } const test11x;
 
-// PR6216
-void test12(void) {
-  (void)__builtin_offsetof(struct { char c; int i; }, i);
-}
 
 // rdar://7608537
 struct test13 { int a; } (test13x);
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -16256,7 +16256,7 @@
  SourceLocation ScopedEnumKWLoc,
  bool ScopedEnumUsesClassTag, TypeResult UnderlyingType,
  bool IsTypeSpecifier, bool IsTemplateParamOrArg,
- SkipBodyInfo *SkipBody) {
+ SkipBodyInfo *SkipBody, bool IsWithinOffsetOf) {
   // If this is not a definition, it must have a name.
   IdentifierInfo *OrigName = Name;
   assert((Name != nullptr || TUK == TUK_Definition) &&
@@ -17029,10 +17029,16 @@
cast_or_null(PrevDecl));
   }
 
+  if (IsWithinOffsetOf && TUK == TUK_Definition) {
+Diag(New->getLocation(), diag::err_type_defined_in_offsetof)
+<< Context.getTagDeclType(New);
+Invalid = true;
+  }
+
   // C++11 [dcl.type]p3:
   //   A type-specifier-seq shall not define a class or enumeration [...].
-  if (getLangOpts().CPlusPlus && (IsTypeSpecifier || IsTemplateParamOrArg) &&
-  TUK == TUK_Definition) {
+  if (!Invalid && getLangOpts().CPlusPlus &&
+  (IsTypeSpecifier || IsTemplateParamOrArg) && TUK == TUK_Definition) {
 Diag(New->getLocation(), diag::err_type_defined_in_type_specifier)
   << Context.getTagDeclType(New);
 Invalid = true;
Index: clang/lib/Parse/ParseExpr.cpp
===
--- clang/lib/Parse/ParseExpr.cpp
+++ clang/lib/Parse/ParseExpr.cpp
@@ -2579,6 +2579,7 @@
   }
   case tok::kw___builtin_offsetof: {
 SourceLocation TypeLoc = Tok.getLocation();
+InBuiltInOffsetOfBaseRAIIObject InOffsetof(*this, true);
 TypeResult Ty = ParseTypeName();
 if (Ty.isInvalid()) {
   SkipUntil(tok::r_paren, StopAtSemi);
Index: clang/lib/Parse/ParseDeclCXX.cpp
===
--- clang/lib/Parse/ParseDeclCXX.cpp
+++ clang/lib/Parse/ParseDeclCXX.cpp
@@ -2030,7 +2030,7 @@
 DSC == DeclSpecContext::DSC_type_specifier,
 DSC == DeclSpecContext::DSC_template_param ||
 DSC == DeclSpecContext::DSC_template_type_arg,
-&SkipBody);
+&SkipBody, InBuiltInOffsetOfBase);
 
 // If ActOnTag said the type was dependent, try again with the
 // less common call.
Index: clang/include/clang/Sema/Sema.h
===

[PATCH] D132855: [OpenMP] Extend the lit test for uses_allocators in target region

2022-09-21 Thread Animesh Kumar via Phabricator via cfe-commits
animeshk-amd updated this revision to Diff 461827.
animeshk-amd added a comment.

Updated the LIT test for omp_thread_mem_alloc allocator


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132855

Files:
  clang/test/OpenMP/target_map_codegen_10.cpp
  clang/test/OpenMP/target_uses_allocators.c

Index: clang/test/OpenMP/target_uses_allocators.c
===
--- clang/test/OpenMP/target_uses_allocators.c
+++ clang/test/OpenMP/target_uses_allocators.c
@@ -1,9 +1,8 @@
 // Test host codegen.
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50  -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50  -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -verify -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -include-pch %t %s -emit-llvm -o - | FileCheck %s
 
-// expected-no-diagnostics
 #ifndef HEADER
 #define HEADER
 
@@ -39,6 +38,71 @@
   {}
   #pragma omp target uses_allocators(omp_pteam_mem_alloc) allocate(omp_pteam_mem_alloc: x) firstprivate(x)
   {}
+  #pragma omp target uses_allocators(omp_thread_mem_alloc) allocate(omp_thread_mem_alloc: x) firstprivate(x) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target' directive}}
+  {}
 }
 
 #endif
+
+// CHECK: %[[#R0:]] = call i32 @__kmpc_global_thread_num(ptr @1)
+// CHECK-NEXT: store i64 %x, ptr %x.addr, align 8
+// CHECK-NEXT: %.x..void.addr = call ptr @__kmpc_alloc(i32 %[[#R0]], i64 4, ptr null)
+// CHECK-NEXT: %[[#R1:]] = load i32, ptr %x.addr, align 4
+// CHECK-NEXT: store i32 %[[#R1]], ptr %.x..void.addr, align 4
+// CHECK-NEXT: call void @__kmpc_free(i32 %[[#R0]], ptr %.x..void.addr, ptr null)
+
+// CHECK: %[[#R0:]] = call i32 @__kmpc_global_thread_num(ptr @1)
+// CHECK-NEXT: store i64 %x, ptr %x.addr, align 8
+// CHECK-NEXT: %.x..void.addr = call ptr @__kmpc_alloc(i32 %[[#R0]], i64 4, ptr inttoptr (i64 1 to ptr))
+// CHECK-NEXT: %[[#R1:]] = load i32, ptr %x.addr, align 4
+// CHECK-NEXT: store i32 %[[#R1]], ptr %.x..void.addr, align 4
+// CHECK-NEXT: call void @__kmpc_free(i32 %[[#R0]], ptr %.x..void.addr, ptr inttoptr (i64 1 to ptr))
+
+// CHECK: %[[#R0:]] = call i32 @__kmpc_global_thread_num(ptr @1)
+// CHECK-NEXT: store i64 %x, ptr %x.addr, align 8
+// CHECK-NEXT: %.x..void.addr = call ptr @__kmpc_alloc(i32 %[[#R0]], i64 4, ptr inttoptr (i64 2 to ptr))
+// CHECK-NEXT: %[[#R1:]] = load i32, ptr %x.addr, align 4
+// CHECK-NEXT: store i32 %[[#R1]], ptr %.x..void.addr, align 4
+// CHECK-NEXT: call void @__kmpc_free(i32 %[[#R0]], ptr %.x..void.addr, ptr inttoptr (i64 2 to ptr))
+
+// CHECK: %[[#R0:]] = call i32 @__kmpc_global_thread_num(ptr @1)
+// CHECK-NEXT: store i64 %x, ptr %x.addr, align 8
+// CHECK-NEXT: %.x..void.addr = call ptr @__kmpc_alloc(i32 %[[#R0]], i64 4, ptr inttoptr (i64 3 to ptr))
+// CHECK-NEXT: %[[#R1:]] = load i32, ptr %x.addr, align 4
+// CHECK-NEXT: store i32 %[[#R1]], ptr %.x..void.addr, align 4
+// CHECK-NEXT: call void @__kmpc_free(i32 %[[#R0]], ptr %.x..void.addr, ptr inttoptr (i64 3 to ptr))
+
+// CHECK: %[[#R0:]] = call i32 @__kmpc_global_thread_num(ptr @1)
+// CHECK-NEXT: store i64 %x, ptr %x.addr, align 8
+// CHECK-NEXT: %.x..void.addr = call ptr @__kmpc_alloc(i32 %[[#R0]], i64 4, ptr inttoptr (i64 4 to ptr))
+// CHECK-NEXT: %[[#R1:]] = load i32, ptr %x.addr, align 4
+// CHECK-NEXT: store i32 %[[#R1]], ptr %.x..void.addr, align 4
+// CHECK-NEXT: call void @__kmpc_free(i32 %[[#R0]], ptr %.x..void.addr, ptr inttoptr (i64 4 to ptr))
+
+// CHECK: %[[#R0:]] = call i32 @__kmpc_global_thread_num(ptr @1)
+// CHECK-NEXT: store i64 %x, ptr %x.addr, align 8
+// CHECK-NEXT: %.x..void.addr = call ptr @__kmpc_alloc(i32 %[[#R0]], i64 4, ptr inttoptr (i64 5 to ptr))
+// CHECK-NEXT: %[[#R1:]] = load i32, ptr %x.addr, align 4
+// CHECK-NEXT: store i32 %[[#R1]], ptr %.x..void.addr, align 4
+// CHECK-NEXT: call void @__kmpc_free(i32 %[[#R0]], ptr %.x..void.addr, ptr inttoptr (i64 5 to ptr))
+
+// CHECK: %[[#R0:]] = call i32 @__kmpc_global_thread_num(ptr @1)
+// CHECK-NEXT: store i64 %x, ptr %x.addr, align 8
+// CHECK-NEXT: %.x..void.addr = call ptr @__kmpc_alloc(i32 %[[#R0]], i64 4, ptr inttoptr (i64 6 to ptr))
+// CHECK-NEXT:

[PATCH] D130513: [Flang] Add -fconvert option to swap endianness for unformatted files

2022-09-21 Thread Peixin Qiao via Phabricator via cfe-commits
peixin added a comment.

LGTM. Tested on one little-endian machine with our internal tests (I attached 
them in the issue https://github.com/llvm/llvm-project/issues/55961) for the 
priority of `-fconvert=` option and `CONVERT` argument in open statement and 
all passed. I didn't see the the `GFORTRAN_CONVERT_UNIT` used in HPC workloads 
and don't have tests for it. For now, I would avoid full combination tests for 
it.

@jeanPerier @clementval Can you help double check the lowering part?


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

https://reviews.llvm.org/D130513

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


[PATCH] D134339: [clang][llvm] generate accessibility metadata for type aliases

2022-09-21 Thread Jonathan Camilleri via Phabricator via cfe-commits
J-Camilleri added a comment.

The premerge checks have failed but the only message I can see is `HTTP 28` in 
the log. I am not sure where to look for more information about the failure, 
Can someone please point me in the right direction?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134339

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


[PATCH] D134270: [clang] [Driver] Support multiple configuration files

2022-09-21 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added inline comments.



Comment at: clang/lib/Driver/Driver.cpp:1061
 return false;
+  if (ClangNameParts.TargetPrefix.empty())
+return false;

Does it mean that executable without prefix won't load implicit config file? 
For example, execution of `clang` won't trigger loading `clang.cfg` or 
`default.cfg`?


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

https://reviews.llvm.org/D134270

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


[PATCH] D133853: [AST] Add msvc-specific C++11 attributes

2022-09-21 Thread H. Vetinari via Phabricator via cfe-commits
h-vetinari added a comment.

In D133853#3797598 , @RIscRIpt wrote:

> I am afraid it would take me some effort to implement semantics of 
> `[[msvc::no_unique_address]]`, so I'd like to focus only on 
> `[[msvc::constexpr]]` in current patch.

Just for context, `[[msvc::no_unique_address]]` is 100% 

 like the standardized `[[no_unique_address]]`, but MSFT was... exceedingly 
cautious... about introducing this, as - even for an explicitly opt-in new 
feature - someone might have compiled code containing `[[no_unique_address]]` 
at a time when it was a no-op in their compiler (as an unknown attribute), and 
changing the semantics after the fact would have violated their very strict 
compatibility guarantees.

I assume the reasoning behind `[[msvc::constexpr]]` to be along the same lines.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133853

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


[clang] 003566c - [clang][dataflow] Remove deprecated overloads of `checkDataflow` in `TestingSupport.h`.

2022-09-21 Thread Wei Yi Tee via cfe-commits

Author: Wei Yi Tee
Date: 2022-09-21T10:36:44Z
New Revision: 003566cb1faec315f86e69f57da3998ff3f922aa

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

LOG: [clang][dataflow] Remove deprecated overloads of `checkDataflow` in 
`TestingSupport.h`.

Reviewed By: gribozavr2

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

Added: 


Modified: 
clang/unittests/Analysis/FlowSensitive/TestingSupport.h

Removed: 




diff  --git a/clang/unittests/Analysis/FlowSensitive/TestingSupport.h 
b/clang/unittests/Analysis/FlowSensitive/TestingSupport.h
index 7ea51d83e25ed..909a475bbf9e1 100644
--- a/clang/unittests/Analysis/FlowSensitive/TestingSupport.h
+++ b/clang/unittests/Analysis/FlowSensitive/TestingSupport.h
@@ -356,97 +356,6 @@ checkDataflow(AnalysisInputs AI,
   });
 }
 
-// Deprecated.
-// FIXME: Remove this function after usage has been updated to the overload
-// which uses the `AnalysisInputs` struct.
-//
-/// Runs dataflow specified from `MakeAnalysis` on the body of the function 
that
-/// matches `TargetFuncMatcher` in `Code`. Given the state computed at each
-/// annotated statement, `VerifyResults` checks that the results from the
-/// analysis are correct.
-///
-/// Requirements:
-///
-///   `AnalysisT` contains a type `Lattice`.
-///
-///   `Code`, `TargetFuncMatcher`, `MakeAnalysis` and `VerifyResults` must be
-///   provided.
-///
-///   Any annotations appearing in `Code` must come after a statement.
-///
-///   There can be at most one annotation attached per statement.
-///
-///   Annotations must not be repeated.
-template 
-llvm::Error checkDataflow(
-llvm::StringRef Code,
-ast_matchers::internal::Matcher TargetFuncMatcher,
-std::function MakeAnalysis,
-std::function>>,
-ASTContext &)>
-VerifyResults,
-ArrayRef Args,
-const tooling::FileContentMappings &VirtualMappedFiles = {}) {
-  return checkDataflow(
-  AnalysisInputs(Code, std::move(TargetFuncMatcher),
-std::move(MakeAnalysis))
-  .withASTBuildArgs(std::move(Args))
-  .withASTBuildVirtualMappedFiles(std::move(VirtualMappedFiles)),
-  [&VerifyResults](const llvm::StringMap> &AnnotationStates,
-   const AnalysisOutputs &AO) {
-std::vector>>
-AnnotationStatesAsVector;
-for (const auto &P : AnnotationStates) {
-  AnnotationStatesAsVector.push_back(
-  std::make_pair(P.first().str(), std::move(P.second)));
-}
-llvm::sort(AnnotationStatesAsVector,
-   [](auto a, auto b) { return a.first < b.first; });
-
-VerifyResults(AnnotationStatesAsVector, AO.ASTCtx);
-  });
-}
-
-// Deprecated.
-// FIXME: Remove this function after usage has been updated to the overload
-// which uses the `AnalysisInputs` struct.
-//
-/// Runs dataflow specified from `MakeAnalysis` on the body of the function
-/// named `TargetFun` in `Code`. Given the state computed at each annotated
-/// statement, `VerifyResults` checks that the results from the analysis are
-/// correct.
-///
-/// Requirements:
-///
-///   `AnalysisT` contains a type `Lattice`.
-///
-///   Any annotations appearing in `Code` must come after a statement.
-///
-///   `Code`, `TargetFun`, `MakeAnalysis` and `VerifyResults` must be provided.
-///
-///   There can be at most one annotation attached per statement.
-///
-///   Annotations must not be repeated.
-template 
-llvm::Error checkDataflow(
-llvm::StringRef Code, llvm::StringRef TargetFun,
-std::function MakeAnalysis,
-std::function>>,
-ASTContext &)>
-VerifyResults,
-ArrayRef Args,
-const tooling::FileContentMappings &VirtualMappedFiles = {}) {
-  return checkDataflow(
-  Code, ast_matchers::hasName(TargetFun), std::move(MakeAnalysis),
-  std::move(VerifyResults), Args, VirtualMappedFiles);
-}
-
 /// Returns the `ValueDecl` for the given identifier.
 ///
 /// Requirements:



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


[PATCH] D134081: [clang][dataflow] Remove deprecated overloads of `checkDataflow` in `TestingSupport.h`.

2022-09-21 Thread weiyi 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 rG003566cb1fae: [clang][dataflow] Remove deprecated overloads 
of `checkDataflow` in… (authored by wyt).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134081

Files:
  clang/unittests/Analysis/FlowSensitive/TestingSupport.h

Index: clang/unittests/Analysis/FlowSensitive/TestingSupport.h
===
--- clang/unittests/Analysis/FlowSensitive/TestingSupport.h
+++ clang/unittests/Analysis/FlowSensitive/TestingSupport.h
@@ -356,97 +356,6 @@
   });
 }
 
-// Deprecated.
-// FIXME: Remove this function after usage has been updated to the overload
-// which uses the `AnalysisInputs` struct.
-//
-/// Runs dataflow specified from `MakeAnalysis` on the body of the function that
-/// matches `TargetFuncMatcher` in `Code`. Given the state computed at each
-/// annotated statement, `VerifyResults` checks that the results from the
-/// analysis are correct.
-///
-/// Requirements:
-///
-///   `AnalysisT` contains a type `Lattice`.
-///
-///   `Code`, `TargetFuncMatcher`, `MakeAnalysis` and `VerifyResults` must be
-///   provided.
-///
-///   Any annotations appearing in `Code` must come after a statement.
-///
-///   There can be at most one annotation attached per statement.
-///
-///   Annotations must not be repeated.
-template 
-llvm::Error checkDataflow(
-llvm::StringRef Code,
-ast_matchers::internal::Matcher TargetFuncMatcher,
-std::function MakeAnalysis,
-std::function>>,
-ASTContext &)>
-VerifyResults,
-ArrayRef Args,
-const tooling::FileContentMappings &VirtualMappedFiles = {}) {
-  return checkDataflow(
-  AnalysisInputs(Code, std::move(TargetFuncMatcher),
-std::move(MakeAnalysis))
-  .withASTBuildArgs(std::move(Args))
-  .withASTBuildVirtualMappedFiles(std::move(VirtualMappedFiles)),
-  [&VerifyResults](const llvm::StringMap> &AnnotationStates,
-   const AnalysisOutputs &AO) {
-std::vector>>
-AnnotationStatesAsVector;
-for (const auto &P : AnnotationStates) {
-  AnnotationStatesAsVector.push_back(
-  std::make_pair(P.first().str(), std::move(P.second)));
-}
-llvm::sort(AnnotationStatesAsVector,
-   [](auto a, auto b) { return a.first < b.first; });
-
-VerifyResults(AnnotationStatesAsVector, AO.ASTCtx);
-  });
-}
-
-// Deprecated.
-// FIXME: Remove this function after usage has been updated to the overload
-// which uses the `AnalysisInputs` struct.
-//
-/// Runs dataflow specified from `MakeAnalysis` on the body of the function
-/// named `TargetFun` in `Code`. Given the state computed at each annotated
-/// statement, `VerifyResults` checks that the results from the analysis are
-/// correct.
-///
-/// Requirements:
-///
-///   `AnalysisT` contains a type `Lattice`.
-///
-///   Any annotations appearing in `Code` must come after a statement.
-///
-///   `Code`, `TargetFun`, `MakeAnalysis` and `VerifyResults` must be provided.
-///
-///   There can be at most one annotation attached per statement.
-///
-///   Annotations must not be repeated.
-template 
-llvm::Error checkDataflow(
-llvm::StringRef Code, llvm::StringRef TargetFun,
-std::function MakeAnalysis,
-std::function>>,
-ASTContext &)>
-VerifyResults,
-ArrayRef Args,
-const tooling::FileContentMappings &VirtualMappedFiles = {}) {
-  return checkDataflow(
-  Code, ast_matchers::hasName(TargetFun), std::move(MakeAnalysis),
-  std::move(VerifyResults), Args, VirtualMappedFiles);
-}
-
 /// Returns the `ValueDecl` for the given identifier.
 ///
 /// Requirements:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D132329: [X86][RFC] Using `__bf16` for AVX512_BF16 intrinsics

2022-09-21 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added inline comments.



Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:2185
+addRegisterClass(MVT::v32bf16, &X86::VR512RegClass);
+setOperationAction(ISD::BUILD_VECTOR, MVT::bf16, Custom);
+setOperationAction(ISD::BUILD_VECTOR, MVT::v8bf16, Custom);

pengfei wrote:
> RKSimon wrote:
> > Isn't MVT::bf16 scalar? 
> Yes, when legalize the source operand, the legalizer gets action as the type 
> action, i.e., `TypeSoftPromoteHalf`. However, we don't provide methods to 
> handle any vector actions in soft promote. So we need to set it `Custom` here 
> to do the customization.
OK - please can you add a short comment explaining that


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132329

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


[PATCH] D134270: [clang] [Driver] Support multiple configuration files

2022-09-21 Thread Michał Górny via Phabricator via cfe-commits
mgorny added inline comments.



Comment at: clang/lib/Driver/Driver.cpp:1061
 return false;
+  if (ClangNameParts.TargetPrefix.empty())
+return false;

sepavloff wrote:
> Does it mean that executable without prefix won't load implicit config file? 
> For example, execution of `clang` won't trigger loading `clang.cfg` or 
> `default.cfg`?
Yes, this patch doesn't change how defaults are loaded. This is tackled 
separately in D134337.


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

https://reviews.llvm.org/D134270

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


[PATCH] D125418: [Arm64EC 6/?] Implement C/C++ mangling for Arm64EC function definitions.

2022-09-21 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

I think this looks reasonable to me, but I don't think I'm knowledgeable enough 
to give this a proper review, sorry.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125418

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


[PATCH] D125419: [Arm64EC 7/?] clang side of Arm64EC varargs ABI.

2022-09-21 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

I think this looks reasonable to me - if noone else has time to approve it, I 
guess I could, but I'd rather have the more authoritative reviewers complete 
their reviews.




Comment at: llvm/utils/UpdateTestChecks/common.py:330
 OPT_FUNCTION_RE = re.compile(
-
r'^(\s*;\s*Function\sAttrs:\s(?P[\w\s]+?))?\s*define\s+(?:internal\s+)?[^@]*@(?P[\w.$-]+?)\s*'
+
r'^(\s*;\s*Function\sAttrs:\s(?P[\w\s]+?))?\s*define\s+(?:internal\s+)?[^@]*@(?P[\w.$-]+?|".+?")\s*'
 r'(?P\((\)|(.*?[\w.-]+?)\))[^{]*\{)\n(?P.*?)^\}$',

I dunno what the practice is for updates to this script - should this change be 
split out and committed separately? (I guess we don't have tests for the script 
itself?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125419

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


[PATCH] D134337: [clang] [Driver] More flexible rules for loading default configs (WIP)

2022-09-21 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

To explain this better, let's take the following example call:

  x86_64-pc-linux-gnu-clang --driver-mode=g++ -target i386

This maps to:

- effective triple: `i386` (from `-target`)
- effective mode: `clang++` (from `--driver-mode`)
- name prefix: `x86_64-pc-linux-gnu`
- "fixed" name prefix: `i386-pc-linux-gnu` (with arch substituted based on 
effective triple)
- name suffix: `clang`

The algorithm will first try to use the first of the following configuration 
files:

1. `i386-clang++.cfg` (effective triple + effective mode)
2. `i386-pc-linux-gnu-clang.cfg` ("fixed" prefix + suffix)
3. `x86_64-pc-linux-gnu-clang.cfg` (orig. prefix + suffix)

If neither of these files are found, it will try to load one config file for 
the target and another for the driver.

For target, it will try:

1. `i386.cfg` (effective triple)
2. `i386-pc-linux-gnu.cfg` ("fixed" prefix)
3. `x86_64-pc-linux-gnu.cfg` (orig. prefix)

For driver, it will try:

1. `clang++.cfg` (effective mode)
2. `clang.cfg` (suffix)

This version doesn't include any further fallback, i.e. assumes we need to 
cover all triples and driver modes we care about. However, adding one should be 
trivial.




Comment at: clang/lib/Driver/Driver.cpp:1065-1080
+  StringRef EffectiveDriverMode;
+  if (CLOptions)
+EffectiveDriverMode = CLOptions->getLastArgValue(options::OPT_driver_mode);
+  if (EffectiveDriverMode.empty())
+EffectiveDriverMode = ClangNameParts.DriverMode;
+
+  llvm::Triple EffectiveTriple =

This part is mostly proof-of-concept, I need to look into how to do this 
properly.


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

https://reviews.llvm.org/D134337

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


[PATCH] D134270: [clang] [Driver] Support multiple configuration files

2022-09-21 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff accepted this revision.
sepavloff added a comment.
This revision is now accepted and ready to land.

LGTM.

Thanks!


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

https://reviews.llvm.org/D134270

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


[clang] 9474709 - [clang][dataflow] Remove deprecated `transfer(const Stmt *, ...)` API.

2022-09-21 Thread Wei Yi Tee via cfe-commits

Author: Wei Yi Tee
Date: 2022-09-21T11:06:21Z
New Revision: 94747094c782d8a45b61414717df8308f8a25919

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

LOG: [clang][dataflow] Remove deprecated `transfer(const Stmt *, ...)` API.

Reviewed By: gribozavr2

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

Added: 


Modified: 
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h

Removed: 




diff  --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h 
b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
index cbd20ad9ee568..6184f22f786c7 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
@@ -20,7 +20,6 @@
 #include 
 
 #include "clang/AST/ASTContext.h"
-#include "clang/AST/Stmt.h"
 #include "clang/Analysis/CFG.h"
 #include "clang/Analysis/FlowSensitive/ControlFlowContext.h"
 #include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
@@ -33,17 +32,6 @@
 namespace clang {
 namespace dataflow {
 
-template >
-struct HasTransferFor : std::false_type {};
-
-template 
-struct HasTransferFor<
-AnalysisT, LatticeT, InputT,
-std::void_t().transfer(
-std::declval(), std::declval(),
-std::declval()))>> : std::true_type {};
-
 /// Base class template for dataflow analyses built on a single lattice type.
 ///
 /// Requirements:
@@ -110,17 +98,7 @@ class DataflowAnalysis : public TypeErasedDataflowAnalysis {
   void transferTypeErased(const CFGElement *Element, TypeErasedLattice &E,
   Environment &Env) final {
 Lattice &L = llvm::any_cast(E.Value);
-if constexpr (HasTransferFor::value) {
-  static_cast(this)->transfer(Element, L, Env);
-}
-
-// FIXME: Remove after users have been updated to implement `transfer` on
-// `CFGElement`.
-if constexpr (HasTransferFor::value) {
-  if (auto Stmt = Element->getAs()) {
-static_cast(this)->transfer(Stmt->getStmt(), L, Env);
-  }
-}
+static_cast(this)->transfer(Element, L, Env);
   }
 
 private:



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


[PATCH] D134318: [clang][dataflow] Remove deprecated `transfer(const Stmt *, ...)` API.

2022-09-21 Thread weiyi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG94747094c782: [clang][dataflow] Remove deprecated 
`transfer(const Stmt *, ...)` API. (authored by wyt).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134318

Files:
  clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h


Index: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
===
--- clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
+++ clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
@@ -20,7 +20,6 @@
 #include 
 
 #include "clang/AST/ASTContext.h"
-#include "clang/AST/Stmt.h"
 #include "clang/Analysis/CFG.h"
 #include "clang/Analysis/FlowSensitive/ControlFlowContext.h"
 #include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
@@ -33,17 +32,6 @@
 namespace clang {
 namespace dataflow {
 
-template >
-struct HasTransferFor : std::false_type {};
-
-template 
-struct HasTransferFor<
-AnalysisT, LatticeT, InputT,
-std::void_t().transfer(
-std::declval(), std::declval(),
-std::declval()))>> : std::true_type {};
-
 /// Base class template for dataflow analyses built on a single lattice type.
 ///
 /// Requirements:
@@ -110,17 +98,7 @@
   void transferTypeErased(const CFGElement *Element, TypeErasedLattice &E,
   Environment &Env) final {
 Lattice &L = llvm::any_cast(E.Value);
-if constexpr (HasTransferFor::value) {
-  static_cast(this)->transfer(Element, L, Env);
-}
-
-// FIXME: Remove after users have been updated to implement `transfer` on
-// `CFGElement`.
-if constexpr (HasTransferFor::value) {
-  if (auto Stmt = Element->getAs()) {
-static_cast(this)->transfer(Stmt->getStmt(), L, Env);
-  }
-}
+static_cast(this)->transfer(Element, L, Env);
   }
 
 private:


Index: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
===
--- clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
+++ clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
@@ -20,7 +20,6 @@
 #include 
 
 #include "clang/AST/ASTContext.h"
-#include "clang/AST/Stmt.h"
 #include "clang/Analysis/CFG.h"
 #include "clang/Analysis/FlowSensitive/ControlFlowContext.h"
 #include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
@@ -33,17 +32,6 @@
 namespace clang {
 namespace dataflow {
 
-template >
-struct HasTransferFor : std::false_type {};
-
-template 
-struct HasTransferFor<
-AnalysisT, LatticeT, InputT,
-std::void_t().transfer(
-std::declval(), std::declval(),
-std::declval()))>> : std::true_type {};
-
 /// Base class template for dataflow analyses built on a single lattice type.
 ///
 /// Requirements:
@@ -110,17 +98,7 @@
   void transferTypeErased(const CFGElement *Element, TypeErasedLattice &E,
   Environment &Env) final {
 Lattice &L = llvm::any_cast(E.Value);
-if constexpr (HasTransferFor::value) {
-  static_cast(this)->transfer(Element, L, Env);
-}
-
-// FIXME: Remove after users have been updated to implement `transfer` on
-// `CFGElement`.
-if constexpr (HasTransferFor::value) {
-  if (auto Stmt = Element->getAs()) {
-static_cast(this)->transfer(Stmt->getStmt(), L, Env);
-  }
-}
+static_cast(this)->transfer(Element, L, Env);
   }
 
 private:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8a774c3 - [clang] [Driver] Support multiple configuration files

2022-09-21 Thread Michał Górny via cfe-commits

Author: Michał Górny
Date: 2022-09-21T13:14:36+02:00
New Revision: 8a774c35e9f8c6a200a8f4d00aae909840f5004a

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

LOG: [clang] [Driver] Support multiple configuration files

Support specifying multiple configuration files via multiple `--config`
options.  When multiple files are specified, the options from subsequent
files are appended to the options from the initial file.

While at it, remove the incorrect assertion about CfgFileName being
non-empty.  It can be empty if `--config ""` is passed, and it makes
sense to report it as non-existing file rather than crash.

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

Added: 


Modified: 
clang/docs/UsersManual.rst
clang/include/clang/Driver/Driver.h
clang/lib/Driver/Driver.cpp
clang/test/Driver/config-file-errs.c
clang/test/Driver/config-file.c
clang/test/Driver/config-file3.c

Removed: 




diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index 0ddbb61f1d540..9c0a916f1a10d 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -883,13 +883,18 @@ specified just by referencing the configuration file. 
They may be used, for
 example, to collect options required to tune compilation for particular
 target, such as ``-L``, ``-I``, ``-l``, ``--sysroot``, codegen options, etc.
 
-The command line option ``--config`` can be used to specify configuration
-file in a Clang invocation. For example:
+Configuration files can be either specified on the command line or loaded
+from default locations. If both variants are present, the default configuration
+files are loaded first.
+
+The command line option ``--config`` can be used to specify explicit
+configuration files in a Clang invocation. If the option is used multiple 
times,
+all specified files are loaded, in order. For example:
 
 ::
 
 clang --config /home/user/cfgs/testing.txt
-clang --config debug.cfg
+clang --config debug.cfg --config runtimes.cfg
 
 If the provided argument contains a directory separator, it is considered as
 a file path, and options are read from that file. Otherwise the argument is
@@ -904,14 +909,15 @@ clang build using CMake parameters, 
``CLANG_CONFIG_FILE_USER_DIR`` and
 ``CLANG_CONFIG_FILE_SYSTEM_DIR`` respectively. The first file found is used.
 It is an error if the required file cannot be found.
 
-If no explicit configuration file is specified, Clang searches for a default
-configuration file following the rules described in the next paragraphs.
-To disable this behavior, ``--no-default-config`` flag can be used.
+The default configuration files are searched for in the same directories
+following the rules described in the next paragraphs. Loading default
+configuration files can be disabled entirely via passing
+the ``--no-default-config`` flag.
 
-Another way to specify a configuration file is to encode it in executable name.
-For example, if the Clang executable is named ``armv7l-clang`` (it may be a
-symbolic link to ``clang``), then Clang will search for file ``armv7l.cfg``
-in the directory where Clang resides.
+The name of the default configuration file is deduced from the clang executable
+name.  For example, if the Clang executable is named ``armv7l-clang`` (it may
+be a symbolic link to ``clang``), then Clang will search for file
+``armv7l.cfg`` in the directory where Clang resides.
 
 If a driver mode is specified in invocation, Clang tries to find a file 
specific
 for the specified mode. For example, if the executable file is named

diff  --git a/clang/include/clang/Driver/Driver.h 
b/clang/include/clang/Driver/Driver.h
index 59c2f1f52cecf..203557a5cfc66 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -19,6 +19,7 @@
 #include "clang/Driver/ToolChain.h"
 #include "clang/Driver/Types.h"
 #include "clang/Driver/Util.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Option/Arg.h"
@@ -28,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace llvm {
 class Triple;
@@ -258,8 +260,8 @@ class Driver {
   /// Name to use when invoking gcc/g++.
   std::string CCCGenericGCCName;
 
-  /// Name of configuration file if used.
-  std::string ConfigFile;
+  /// Paths to configuration files used.
+  std::vector ConfigFiles;
 
   /// Allocator for string saver.
   llvm::BumpPtrAllocator Alloc;
@@ -353,7 +355,9 @@ class Driver {
   /// Name to use when invoking gcc/g++.
   const std::string &getCCCGenericGCCName() const { return CCCGenericGCCName; }
 
-  const std::string &getConfigFile() const { return ConfigFile; }
+  llvm::ArrayRef getConfigFiles() const {
+return ConfigFiles;
+  }
 
   const llvm::opt::Opt

[PATCH] D134270: [clang] [Driver] Support multiple configuration files

2022-09-21 Thread Michał Górny 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 rG8a774c35e9f8: [clang] [Driver] Support multiple 
configuration files (authored by mgorny).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134270

Files:
  clang/docs/UsersManual.rst
  clang/include/clang/Driver/Driver.h
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/config-file-errs.c
  clang/test/Driver/config-file.c
  clang/test/Driver/config-file3.c

Index: clang/test/Driver/config-file3.c
===
--- clang/test/Driver/config-file3.c
+++ clang/test/Driver/config-file3.c
@@ -34,12 +34,13 @@
 // RUN: %t/testdmode/qqq-clang-g++ --config-system-dir= --config-user-dir=%t/testdmode -c -### %s 2>&1 | FileCheck %s -check-prefix SYMLINK
 //
 // SYMLINK: Configuration file: {{.*}}/testdmode/qqq-clang-g++.cfg
-//
-//--- File specified by --config overrides config inferred from clang executable.
+
+//--- File specified by --config is loaded after the one inferred from the executable.
 //
 // RUN: %t/testdmode/qqq-clang-g++ --config-system-dir=%S/Inputs/config --config-user-dir= --config i386-qqq.cfg -c -no-canonical-prefixes -### %s 2>&1 | FileCheck %s -check-prefix CHECK-EXPLICIT
 //
-// CHECK-EXPLICIT: Configuration file: {{.*}}/Inputs/config/i386-qqq.cfg
+// CHECK-EXPLICIT: Configuration file: {{.*}}/testdmode/qqq-clang-g++.cfg
+// CHECK-EXPLICIT-NEXT: Configuration file: {{.*}}/Inputs/config/i386-qqq.cfg
 
 //--- --no-default-config disables config search.
 //
@@ -47,6 +48,13 @@
 //
 // NO-DEFAULT-CONFIG-NOT: Configuration file:
 
+//--- Explicit --config works with --no-default-config.
+//
+// RUN: %t/testdmode/qqq-clang-g++ --config-system-dir=%S/Inputs/config --config-user-dir= --no-default-config --config i386-qqq.cfg -c -no-canonical-prefixes -### %s 2>&1 | FileCheck %s -check-prefix CHECK-EXPLICIT-NO-DEFAULT
+//
+// CHECK-EXPLICIT-NO-DEFAULT-NOT: Configuration file: {{.*}}/testdmode/qqq-clang-g++.cfg
+// CHECK-EXPLICIT-NO-DEFAULT: Configuration file: {{.*}}/Inputs/config/i386-qqq.cfg
+
 //--- Invocation qqq-clang-g++ tries to find config file qqq.cfg if qqq-clang-g++.cfg is not found.
 //
 // RUN: rm %t/testdmode/qqq-clang-g++.cfg
Index: clang/test/Driver/config-file.c
===
--- clang/test/Driver/config-file.c
+++ clang/test/Driver/config-file.c
@@ -73,6 +73,10 @@
 // CHECK-PRECEDENCE: -Wall
 
 
-//--- Duplicate --config options are allowed if the value is the same
-// RUN: %clang --config-system-dir=%S/Inputs/config --config-user-dir=%S/Inputs/config2 --config config-4.cfg --config config-4.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-SAME-CONFIG
-// CHECK-SAME-CONFIG: Configuration file: {{.*}}Inputs{{.}}config2{{.}}config-4.cfg
+//--- Multiple configuration files can be specified.
+// RUN: %clang --config-system-dir=%S/Inputs/config --config-user-dir= --config config-4.cfg --config %S/Inputs/config2/config-4.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-TWO-CONFIGS
+// CHECK-TWO-CONFIGS: Configuration file: {{.*}}Inputs{{.}}config{{.}}config-4.cfg
+// CHECK-TWO-CONFIGS-NEXT: Configuration file: {{.*}}Inputs{{.}}config2{{.}}config-4.cfg
+// CHECK-TWO-CONFIGS: -isysroot
+// CHECK-TWO-CONFIGS-SAME: /opt/data
+// CHECK-TWO-CONFIGS-SAME: -Wall
Index: clang/test/Driver/config-file-errs.c
===
--- clang/test/Driver/config-file-errs.c
+++ clang/test/Driver/config-file-errs.c
@@ -1,9 +1,3 @@
-//--- No more than one '--config' may be specified.
-//
-// RUN: not %clang --config 1.cfg --config 2.cfg 2>&1 | FileCheck %s -check-prefix CHECK-DUPLICATE
-// CHECK-DUPLICATE: no more than one option '--config' is allowed
-
-
 //--- '--config' must be followed by config file name.
 //
 // RUN: not %clang --config 2>&1 | FileCheck %s -check-prefix CHECK-MISSING-FILE
@@ -22,6 +16,11 @@
 // CHECK-NONEXISTENT: configuration file '{{.*}}somewhere/nonexistent-config-file' does not exist
 
 
+//--- All '--config' arguments must be existing files.
+//
+// RUN: not %clang --config %S/Inputs/config-4.cfg --config somewhere/nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NONEXISTENT
+
+
 //--- Argument of '--config' must exist somewhere in well-known directories, if it is specified by bare name.
 //
 // RUN: not %clang --config-system-dir= --config-user-dir= --config nonexistent-config-file.cfg 2>&1 | FileCheck %s -check-prefix CHECK-NOTFOUND0
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -929,6 +929,22 @@
   return false;
 }
 
+static void appendOneArg(InputArgList &Args, const Arg *Opt,
+

[PATCH] D134270: [clang] [Driver] Support multiple configuration files

2022-09-21 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

Thanks a lot!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134270

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


[PATCH] D134325: [clang-format] Look ahead before consuming `bool` in requires clause.

2022-09-21 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks accepted this revision.
HazardyKnusperkeks added a comment.
This revision is now accepted and ready to land.

Thanks for the fix.

In D134325#3804969 , @MyDeveloperDay 
wrote:

> given that #57538 manifested itself as a incorrect format (no doubt because 
> of incorrect  token annotation), should we add a verifyFormat tests somewhere 
> for the example from the github issue, (it just protects the formatting for 
> being broken by some other change)

Yeah we disagree here, but I have to redisagree.
It's the wrong annotation, it's not related to any formatting. And the format 
tests cpp is a monster.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134325

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


[PATCH] D133468: [clang] Implement divergence for TypedefType and UsingType

2022-09-21 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 461850.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133468

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/JSONNodeDumper.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/ASTStructuralEquivalence.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/AST/Type.cpp
  clang/test/SemaCXX/sugar-common-types.cpp

Index: clang/test/SemaCXX/sugar-common-types.cpp
===
--- clang/test/SemaCXX/sugar-common-types.cpp
+++ clang/test/SemaCXX/sugar-common-types.cpp
@@ -112,3 +112,22 @@
 C2 auto t26_3 = (::SB1){};
 N t26 = 0 ? t26_1 : t26_2; // expected-error {{from 'SB1' (aka 'SS1')}}
 N t27 = 0 ? t26_1 : t26_3; // expected-error {{from 'SB1' (aka 'SS1')}}
+
+using RPB1 = X1*;
+using RPX1 = RPB1;
+using RPB1 = Y1*; // redeclared
+using RPY1 = RPB1;
+N t28 = *(RPB1){}; // expected-error {{lvalue of type 'Y1' (aka 'int')}}
+auto t29 = 0 ? (RPX1){} : (RPY1){};
+N t30 = t29;  // expected-error {{lvalue of type 'RPB1' (aka 'int *')}}
+N t31 = *t29; // expected-error {{lvalue of type 'B1' (aka 'int')}}
+
+namespace A { using type1 = X1*; };
+namespace C { using A::type1; };
+using UPX1 = C::type1;
+namespace A { using type1 = Y1*; };  // redeclared
+namespace C { using A::type1; }; // redeclared
+using UPY1 = C::type1;
+auto t32 = 0 ? (UPX1){} : (UPY1){};
+N t33 = t32;  // expected-error {{lvalue of type 'C::type1' (aka 'int *')}}
+N t34 = *t32; // expected-error {{lvalue of type 'B1' (aka 'int')}}
Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3434,25 +3434,34 @@
 }
 
 TypedefType::TypedefType(TypeClass tc, const TypedefNameDecl *D,
- QualType underlying, QualType can)
-: Type(tc, can, toSemanticDependence(underlying->getDependence())),
+ QualType Underlying, QualType can)
+: Type(tc, can, toSemanticDependence(can->getDependence())),
   Decl(const_cast(D)) {
   assert(!isa(can) && "Invalid canonical type");
+  TypedefBits.isDivergent = !Underlying.isNull();
+  if (isDivergent())
+*getTrailingObjects() = Underlying;
 }
 
 QualType TypedefType::desugar() const {
-  return getDecl()->getUnderlyingType();
+  return isDivergent() ? *getTrailingObjects()
+   : Decl->getUnderlyingType();
 }
 
 UsingType::UsingType(const UsingShadowDecl *Found, QualType Underlying,
  QualType Canon)
-: Type(Using, Canon, toSemanticDependence(Underlying->getDependence())),
+: Type(Using, Canon, toSemanticDependence(Canon->getDependence())),
   Found(const_cast(Found)) {
-  assert(Underlying == getUnderlyingType());
+  UsingBits.isDivergent = !Underlying.isNull();
+  if (isDivergent())
+*getTrailingObjects() = Underlying;
 }
 
 QualType UsingType::getUnderlyingType() const {
-  return QualType(cast(Found->getTargetDecl())->getTypeForDecl(), 0);
+  return isDivergent()
+ ? *getTrailingObjects()
+ : QualType(
+   cast(Found->getTargetDecl())->getTypeForDecl(), 0);
 }
 
 QualType MacroQualifiedType::desugar() const { return getUnderlyingType(); }
Index: clang/lib/AST/TextNodeDumper.cpp
===
--- clang/lib/AST/TextNodeDumper.cpp
+++ clang/lib/AST/TextNodeDumper.cpp
@@ -1543,10 +1543,14 @@
 
 void TextNodeDumper::VisitUsingType(const UsingType *T) {
   dumpDeclRef(T->getFoundDecl());
+  if (T->isDivergent())
+OS << " divergent";
 }
 
 void TextNodeDumper::VisitTypedefType(const TypedefType *T) {
   dumpDeclRef(T->getDecl());
+  if (T->isDivergent())
+OS << " divergent";
 }
 
 void TextNodeDumper::VisitUnaryTransformType(const UnaryTransformType *T) {
Index: clang/lib/AST/JSONNodeDumper.cpp
===
--- clang/lib/AST/JSONNodeDumper.cpp
+++ clang/lib/AST/JSONNodeDumper.cpp
@@ -530,6 +530,14 @@
 
 void JSONNodeDumper::VisitTypedefType(const TypedefType *TT) {
   JOS.attribute("decl", createBareDeclRef(TT->getDecl()));
+  if (TT->isDivergent())
+JOS.attribute("type", createQualType(TT->desugar()));
+}
+
+void JSONNodeDumper::VisitUsingType(const UsingType *TT) {
+  JOS.attribute("decl", createBareDeclRef(TT->getFoundDecl()));
+  if (TT->isDivergent())
+JOS.attribute("type", createQualType(TT->desugar()));
 }
 
 void JSONNodeDumper::VisitFunctionType(const FunctionType *T) {
Index: clang/lib/AST/ASTStructuralEquivalence.cpp
===
--- clang/lib/AST/ASTStructuralEquivalence.cpp
+++ clang/lib/AST/ASTStructuralEquivalence.cpp
@@ -957,11 +957,17 @@
 i

[PATCH] D132816: [clang] AST: SubstTemplateTypeParmType support for non-canonical underlying type

2022-09-21 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 461851.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132816

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/TreeTransform.h
  clang/test/AST/ast-dump-template-decls.cpp

Index: clang/test/AST/ast-dump-template-decls.cpp
===
--- clang/test/AST/ast-dump-template-decls.cpp
+++ clang/test/AST/ast-dump-template-decls.cpp
@@ -162,3 +162,22 @@
 // CHECK:  SubstTemplateTypeParmType 0x{{[^ ]*}} 'short' sugar pack_index 0
 // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'U' dependent contains_unexpanded_pack depth 0 index 0 pack
 } // namespace PR56099
+
+namespace subst_default_argument {
+template class A {};
+template> class D1, class D2> using D = D1;
+
+template class E {};
+using test1 = D;
+// CHECK:  TypeAliasDecl 0x{{[^ ]*}}  col:7 test1 'D':'subst_default_argument::E>'
+// CHECK:  TemplateSpecializationType 0x{{[^ ]*}} 'A' sugar A
+// CHECK-NEXT: |-TemplateArgument type 'int':'int'
+// CHECK-NEXT: | `-SubstTemplateTypeParmType 0x{{[^ ]*}} 'int' sugar
+// CHECK-NEXT: |   |-TemplateTypeParmType 0x{{[^ ]*}} 'C1' dependent depth 1 index 0
+// CHECK-NEXT: |   | `-TemplateTypeParm 0x{{[^ ]*}} 'C1'
+// CHECK-NEXT: |   `-SubstTemplateTypeParmType 0x{{[^ ]*}} 'int' sugar
+// CHECK-NEXT: | |-TemplateTypeParmType 0x{{[^ ]*}} 'type-parameter-0-1' dependent depth 0 index 1
+// CHECK-NEXT: | `-BuiltinType 0x{{[^ ]*}} 'int'
+// CHECK-NEXT: `-RecordType 0x{{[^ ]*}} 'subst_default_argument::A'
+// CHECK-NEXT:   `-ClassTemplateSpecialization 0x{{[^ ]*}} 'A'
+} // namespace subst_default_argument
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -6408,8 +6408,6 @@
   if (Replacement.isNull())
 return QualType();
 
-  // Always canonicalize the replacement type.
-  Replacement = SemaRef.Context.getCanonicalType(Replacement);
   QualType Result = SemaRef.Context.getSubstTemplateTypeParmType(
   T->getReplacedParameter(), Replacement, T->getPackIndex());
 
Index: clang/lib/Sema/SemaTemplate.cpp
===
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -3513,8 +3513,7 @@
 0, IndexReplaced, false,
 cast(TPL->getParam(IndexReplaced)));
 return SemaRef.Context.getSubstTemplateTypeParmType(
-cast(TTP), Replacement.getCanonicalType(),
-PackIndexReplaced);
+cast(TTP), Replacement, PackIndexReplaced);
   };
 
   switch (BTD->getBuiltinTemplateKind()) {
Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3659,10 +3659,16 @@
 }
 
 SubstTemplateTypeParmType::SubstTemplateTypeParmType(
-const TemplateTypeParmType *Param, QualType Canon,
+const TemplateTypeParmType *Param, QualType Replacement,
 Optional PackIndex)
-: Type(SubstTemplateTypeParm, Canon, Canon->getDependence()),
+: Type(SubstTemplateTypeParm, Replacement.getCanonicalType(),
+   Replacement->getDependence()),
   Replaced(Param) {
+  SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType =
+  Replacement != getCanonicalTypeInternal();
+  if (SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType)
+*getTrailingObjects() = Replacement;
+
   SubstTemplateTypeParmTypeBits.PackIndex = PackIndex ? *PackIndex + 1 : 0;
 }
 
Index: clang/lib/AST/ASTImporter.cpp
===
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -1534,8 +1534,7 @@
 return ToReplacementTypeOrErr.takeError();
 
   return Importer.getToContext().getSubstTemplateTypeParmType(
-  *ReplacedOrErr, ToReplacementTypeOrErr->getCanonicalType(),
-  T->getPackIndex());
+  *ReplacedOrErr, *ToReplacementTypeOrErr, T->getPackIndex());
 }
 
 ExpectedType ASTNodeImporter::VisitSubstTemplateTypeParmPackType(
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -4790,9 +4790,6 @@
 ASTContext::getSubstTemplateTypeParmType(const TemplateTypeParmType *Parm,
  QualType Replacement,
  Optional PackIndex) const {
-  assert(Replacement.isCanonical()
- && "replacement types must always be canonical");
-
   llvm::FoldingSetNodeID ID;
   SubstTemplateTypeParmType::Profile(ID, Parm, Replacement, PackIndex);
   void *InsertPos = nullptr;
@@ -4800,8 +4797,

[PATCH] D131858: [clang] Track the templated entity in type substitution.

2022-09-21 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 461852.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131858

Files:
  clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp
  clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
  clang-tools-extra/clangd/AST.cpp
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/ASTNodeTraverser.h
  clang/include/clang/AST/JSONNodeDumper.h
  clang/include/clang/AST/TextNodeDumper.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Sema/Template.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/ASTStructuralEquivalence.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/ODRHash.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/Sema/SemaConcept.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/lib/StaticAnalyzer/Checkers/MismatchedIteratorChecker.cpp
  clang/test/AST/ast-dump-openmp-begin-declare-variant_reference.cpp
  clang/test/AST/ast-dump-template-decls.cpp
  clang/test/AST/deduction-guides.cpp
  clang/test/SemaTemplate/deduction-guide.cpp
  clang/test/SemaTemplate/make_integer_seq.cpp
  clang/test/SemaTemplate/type_pack_element.cpp
  libcxx/DELETE.ME

Index: libcxx/DELETE.ME
===
--- /dev/null
+++ libcxx/DELETE.ME
@@ -0,0 +1 @@
+D131858
Index: clang/test/SemaTemplate/type_pack_element.cpp
===
--- clang/test/SemaTemplate/type_pack_element.cpp
+++ clang/test/SemaTemplate/type_pack_element.cpp
@@ -11,14 +11,13 @@
 // CHECK-NEXT:   | `-IntegerLiteral 0x{{[0-9A-Fa-f]+}}  'int' 0
 // CHECK-NEXT:   |-TemplateArgument type 'int'
 // CHECK-NEXT:   | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
-// CHECK-NEXT:   `-SubstTemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'int' sugar pack_index 0
-// CHECK-NEXT: |-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'auto' dependent depth 0 index 1
-// CHECK-NEXT: | `-TemplateTypeParm 0x{{[0-9A-Fa-f]+}} ''
+// CHECK-NEXT:   `-SubstTemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'int' sugar typename depth 0 index 1 ... pack_index 0
+// CHECK-NEXT: |-BuiltinTemplate 0x{{[0-9A-Fa-f]+}} '__type_pack_element'
 // CHECK-NEXT: `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
 
 template struct A {
   using test2 = __type_pack_element;
-//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test2 '__type_pack_element':'__type_pack_element'
+//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test2 '__type_pack_element':'__type_pack_element'
 // CHECK-NEXT:   `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' sugar dependent
 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' sugar dependent alias __type_pack_element
 // CHECK-NEXT:   |-TemplateArgument expr
@@ -38,7 +37,7 @@
 // CHECK-NEXT:   `-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'type-parameter-0-1' dependent contains_unexpanded_pack depth 0 index 1 pack
 
   using test3 = __type_pack_element<0, Ts...>;
-//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test3 '__type_pack_element<0, Ts...>':'__type_pack_element<0, type-parameter-0-1...>'
+//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test3 '__type_pack_element<0, Ts...>':'__type_pack_element<0, type-parameter-0-1...>'
 // CHECK-NEXT:   `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__type_pack_element<0, Ts...>' sugar dependent
 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__type_pack_element<0, Ts...>' sugar dependent alias __type_pack_element
 // CHECK-NEXT:   |-TemplateArgument expr
@@ -58,7 +57,7 @@
 // CHECK-NEXT:   `-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'type-parameter-0-1' dependent contains_unexpanded_pack depth 0 index 1 pack
 
   using test4 = __type_pack_element;
-//  CHECK: `-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test4 '__type_pack_element':'__type_pack_element'
+//  CHECK: `-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test4 '__type_pack_element':'__type_pack_element'
 // CHECK-NEXT:   `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' sugar dependent
 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' sugar dependent alias __type_pack_element
 // CHECK-NEXT:   |-TemplateArgument expr
Index: clang/test/SemaTemplate/make_integer_seq.cpp
===
--- clang/test/SemaTemplate/make_inte

[PATCH] D125418: [Arm64EC 6/?] Implement C/C++ mangling for Arm64EC function definitions.

2022-09-21 Thread chenglin.bi via Phabricator via cfe-commits
bcl5980 added a comment.

A question about the mangle and alias part.
Should we move the code to create alias to backend also?Sometimes we will emit 
the alias here but later the function will be inlined or eliminated by DCE.
And later we need to emit alias for direct call thunk also, like 
$originname$exitthunk. Put all of them into arm64eccalllowering pass should be 
better I think.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125418

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


[PATCH] D131858: [clang] Track the templated entity in type substitution.

2022-09-21 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov marked an inline comment as done.
mizvekov added inline comments.



Comment at: clang/lib/Serialization/ASTReaderDecl.cpp:890-893
+  struct {
+bool DoIt;
+FunctionDecl *Existing = nullptr;
+  } Merge = {false};

ChuanqiXu wrote:
> Is this struct necessary? I feel two separate variables may be more clear.
I would have used a tuple, but a struct allows us to give names to the 
components.

I think it makes sense and is more clear to group these things together, but 
maybe it could be even clearer if there was a lambda to setup the merge 
instead, so I will go ahead and implement that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131858

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


[PATCH] D134351: AArch64: add definitions for recent Apple CPUs

2022-09-21 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover created this revision.
t.p.northover added a reviewer: ab.
Herald added subscribers: hiraditya, kristof.beyls, mcrosier.
Herald added a project: All.
t.p.northover requested review of this revision.
Herald added projects: clang, LLVM.
Herald added a subscriber: cfe-commits.

This adds support for Apple CPUs released since the last batch: apple-a15, 
apple-a16 and apple-m2.

They're roughly ARMv8.6. This works in the .td file, but in 
AArch64TargetParser.def, marking them v8.6 brings in support for the SM4 
cryptographic hash and we don't actually have that. So TargetParser side 
they're marked as v8.5, with the extra features (BF16 and I8MM added manually).

Finally, A16 supports the HCX extension in addition to v8.6. This has no 
TargetParser implications.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134351

Files:
  clang/test/Misc/target-invalid-cpu-note.c
  llvm/include/llvm/Support/AArch64TargetParser.def
  llvm/lib/Target/AArch64/AArch64.td
  llvm/lib/Target/AArch64/AArch64Subtarget.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/unittests/Support/TargetParserTest.cpp

Index: llvm/unittests/Support/TargetParserTest.cpp
===
--- llvm/unittests/Support/TargetParserTest.cpp
+++ llvm/unittests/Support/TargetParserTest.cpp
@@ -1112,6 +1112,24 @@
  AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
  AArch64::AEK_FP16FML | AArch64::AEK_SHA3,
  "8.5-A"),
+ARMCPUTestParams("apple-a15", "armv8.5-a", "crypto-neon-fp-armv8",
+ AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
+ AArch64::AEK_FP | AArch64::AEK_SIMD |
+ AArch64::AEK_LSE | AArch64::AEK_RAS |
+ AArch64::AEK_RDM | AArch64::AEK_RCPC |
+ AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
+ AArch64::AEK_FP16FML | AArch64::AEK_SHA3 |
+ AArch64::AEK_BF16 | AArch64::AEK_I8MM,
+ "8.5-A"),
+ARMCPUTestParams("apple-a16", "armv8.5-a", "crypto-neon-fp-armv8",
+ AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
+ AArch64::AEK_FP | AArch64::AEK_SIMD |
+ AArch64::AEK_LSE | AArch64::AEK_RAS |
+ AArch64::AEK_RDM | AArch64::AEK_RCPC |
+ AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
+ AArch64::AEK_FP16FML | AArch64::AEK_SHA3 |
+ AArch64::AEK_BF16 | AArch64::AEK_I8MM,
+ "8.5-A"),
 ARMCPUTestParams("apple-m1", "armv8.5-a", "crypto-neon-fp-armv8",
  AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
  AArch64::AEK_FP | AArch64::AEK_SIMD |
@@ -1120,6 +1138,15 @@
  AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
  AArch64::AEK_FP16FML | AArch64::AEK_SHA3,
  "8.5-A"),
+ARMCPUTestParams("apple-m2", "armv8.5-a", "crypto-neon-fp-armv8",
+ AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
+ AArch64::AEK_FP | AArch64::AEK_SIMD |
+ AArch64::AEK_LSE | AArch64::AEK_RAS |
+ AArch64::AEK_RDM | AArch64::AEK_RCPC |
+ AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
+ AArch64::AEK_FP16FML | AArch64::AEK_SHA3 |
+ AArch64::AEK_BF16 | AArch64::AEK_I8MM,
+ "8.5-A"),
 ARMCPUTestParams("apple-s4", "armv8.3-a", "crypto-neon-fp-armv8",
  AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
  AArch64::AEK_FP | AArch64::AEK_SIMD |
@@ -1188,14 +1215,15 @@
  AArch64::AEK_SVE2 | AArch64::AEK_SVE2BITPERM |
  AArch64::AEK_BF16 | AArch64::AEK_I8MM,
  "8.5-A"),
-ARMCPUTestParams("ampere1", "armv8.6-a", "crypto-neon-fp-armv8",
- AArch64::AEK_CRC  | AArch64::AEK_FP   | AArch64::AEK_FP16   |
- AArch64::AEK_SIMD | AArch64::AEK_RAS  | AArch64::AEK_LSE |
- AArch64::AEK_RDM  | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD |
- AArch64::AEK_SM4  | AArch64::AEK_SHA3 | AArch64::AEK_BF16|
- AArch64::AEK_SHA2 | AArch64::AEK_AES  | AArch64::AEK_I8MM|
- AArch64::AEK_SSBS | AArch64::AEK_SB,
- "8.6-A"),
+ARMCPUTestParams(
+"ampere1", "armv8.6-a", "crypto-neon-fp-armv8",
+AArch64::AEK_CRC | AArch64::AEK_FP | AArch64::AEK_FP16 |
+AArch6

[PATCH] D134351: AArch64: add definitions for recent Apple CPUs

2022-09-21 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover updated this revision to Diff 461858.
t.p.northover added a comment.

Accidentally clang-formatted the `ampere1` test. Undo that.


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

https://reviews.llvm.org/D134351

Files:
  clang/test/Misc/target-invalid-cpu-note.c
  llvm/include/llvm/Support/AArch64TargetParser.def
  llvm/lib/Target/AArch64/AArch64.td
  llvm/lib/Target/AArch64/AArch64Subtarget.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/unittests/Support/TargetParserTest.cpp

Index: llvm/unittests/Support/TargetParserTest.cpp
===
--- llvm/unittests/Support/TargetParserTest.cpp
+++ llvm/unittests/Support/TargetParserTest.cpp
@@ -1112,6 +1112,24 @@
  AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
  AArch64::AEK_FP16FML | AArch64::AEK_SHA3,
  "8.5-A"),
+ARMCPUTestParams("apple-a15", "armv8.5-a", "crypto-neon-fp-armv8",
+ AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
+ AArch64::AEK_FP | AArch64::AEK_SIMD |
+ AArch64::AEK_LSE | AArch64::AEK_RAS |
+ AArch64::AEK_RDM | AArch64::AEK_RCPC |
+ AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
+ AArch64::AEK_FP16FML | AArch64::AEK_SHA3 |
+ AArch64::AEK_BF16 | AArch64::AEK_I8MM,
+ "8.5-A"),
+ARMCPUTestParams("apple-a16", "armv8.5-a", "crypto-neon-fp-armv8",
+ AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
+ AArch64::AEK_FP | AArch64::AEK_SIMD |
+ AArch64::AEK_LSE | AArch64::AEK_RAS |
+ AArch64::AEK_RDM | AArch64::AEK_RCPC |
+ AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
+ AArch64::AEK_FP16FML | AArch64::AEK_SHA3 |
+ AArch64::AEK_BF16 | AArch64::AEK_I8MM,
+ "8.5-A"),
 ARMCPUTestParams("apple-m1", "armv8.5-a", "crypto-neon-fp-armv8",
  AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
  AArch64::AEK_FP | AArch64::AEK_SIMD |
@@ -1120,6 +1138,15 @@
  AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
  AArch64::AEK_FP16FML | AArch64::AEK_SHA3,
  "8.5-A"),
+ARMCPUTestParams("apple-m2", "armv8.5-a", "crypto-neon-fp-armv8",
+ AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
+ AArch64::AEK_FP | AArch64::AEK_SIMD |
+ AArch64::AEK_LSE | AArch64::AEK_RAS |
+ AArch64::AEK_RDM | AArch64::AEK_RCPC |
+ AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
+ AArch64::AEK_FP16FML | AArch64::AEK_SHA3 |
+ AArch64::AEK_BF16 | AArch64::AEK_I8MM,
+ "8.5-A"),
 ARMCPUTestParams("apple-s4", "armv8.3-a", "crypto-neon-fp-armv8",
  AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
  AArch64::AEK_FP | AArch64::AEK_SIMD |
@@ -1257,7 +1284,7 @@
  AArch64::AEK_LSE | AArch64::AEK_RDM,
  "8.2-A")));
 
-static constexpr unsigned NumAArch64CPUArchs = 54;
+static constexpr unsigned NumAArch64CPUArchs = 57;
 
 TEST(TargetParserTest, testAArch64CPUArchList) {
   SmallVector List;
Index: llvm/lib/Target/AArch64/AArch64Subtarget.h
===
--- llvm/lib/Target/AArch64/AArch64Subtarget.h
+++ llvm/lib/Target/AArch64/AArch64Subtarget.h
@@ -47,6 +47,8 @@
 AppleA12,
 AppleA13,
 AppleA14,
+AppleA15,
+AppleA16,
 Carmel,
 CortexA35,
 CortexA53,
Index: llvm/lib/Target/AArch64/AArch64Subtarget.cpp
===
--- llvm/lib/Target/AArch64/AArch64Subtarget.cpp
+++ llvm/lib/Target/AArch64/AArch64Subtarget.cpp
@@ -160,6 +160,8 @@
   case AppleA12:
   case AppleA13:
   case AppleA14:
+  case AppleA15:
+  case AppleA16:
 CacheLineSize = 64;
 PrefetchDistance = 280;
 MinPrefetchStride = 2048;
Index: llvm/lib/Target/AArch64/AArch64.td
===
--- llvm/lib/Target/AArch64/AArch64.td
+++ llvm/lib/Target/AArch64/AArch64.td
@@ -857,6 +857,38 @@
 FeatureZCRegMove,
 FeatureZCZeroing]>;
 
+def TuneAppleA15 : SubtargetFeature<"apple-a15", "ARMProcFamily", "AppleA15",
+"Apple A15", [
+FeatureAlternateSExtLoadCVTF32Pattern,
+  

[PATCH] D134352: [AArch64] Add Neoverse V2 CPU support

2022-09-21 Thread David Sherwood via Phabricator via cfe-commits
david-arm created this revision.
david-arm added reviewers: sdesmalen, paulwalker-arm, dmgreen, MarkMurrayARM, 
CarolineConcatto.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
david-arm requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Adds support for the Neoverse V2 CPU to the AArch64 backend.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134352

Files:
  clang/test/Driver/aarch64-mcpu.c
  clang/test/Misc/target-invalid-cpu-note.c
  llvm/include/llvm/Support/AArch64TargetParser.def
  llvm/lib/Support/Host.cpp
  llvm/lib/Target/AArch64/AArch64.td
  llvm/lib/Target/AArch64/AArch64Subtarget.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/test/CodeGen/AArch64/cpus.ll
  llvm/unittests/Support/TargetParserTest.cpp

Index: llvm/unittests/Support/TargetParserTest.cpp
===
--- llvm/unittests/Support/TargetParserTest.cpp
+++ llvm/unittests/Support/TargetParserTest.cpp
@@ -1026,6 +1026,16 @@
 AArch64::AEK_PROFILE | AArch64::AEK_RAND |
 AArch64::AEK_FP16FML | AArch64::AEK_I8MM,
 "8.4-A"),
+ARMCPUTestParams(
+"neoverse-v2", "armv9-a", "neon-fp-armv8",
+AArch64::AEK_RAS | AArch64::AEK_SVE | AArch64::AEK_SSBS |
+AArch64::AEK_RCPC | AArch64::AEK_CRC | AArch64::AEK_FP |
+AArch64::AEK_SIMD | AArch64::AEK_RAS | AArch64::AEK_LSE |
+AArch64::AEK_RDM | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD |
+AArch64::AEK_FP16 | AArch64::AEK_BF16 | AArch64::AEK_SVE2 |
+AArch64::AEK_PROFILE | AArch64::AEK_FP16FML |
+AArch64::AEK_I8MM,
+"9-A"),
 ARMCPUTestParams("cortex-r82", "armv8-r", "crypto-neon-fp-armv8",
  AArch64::AEK_CRC | AArch64::AEK_RDM |
  AArch64::AEK_SSBS | AArch64::AEK_DOTPROD |
@@ -1257,7 +1267,7 @@
  AArch64::AEK_LSE | AArch64::AEK_RDM,
  "8.2-A")));
 
-static constexpr unsigned NumAArch64CPUArchs = 54;
+static constexpr unsigned NumAArch64CPUArchs = 55;
 
 TEST(TargetParserTest, testAArch64CPUArchList) {
   SmallVector List;
Index: llvm/test/CodeGen/AArch64/cpus.ll
===
--- llvm/test/CodeGen/AArch64/cpus.ll
+++ llvm/test/CodeGen/AArch64/cpus.ll
@@ -23,6 +23,7 @@
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=neoverse-n2 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=neoverse-512tvb 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=neoverse-v1 2>&1 | FileCheck %s
+; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=neoverse-v2 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=exynos-m3 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=exynos-m4 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=exynos-m5 2>&1 | FileCheck %s
Index: llvm/lib/Target/AArch64/AArch64Subtarget.h
===
--- llvm/lib/Target/AArch64/AArch64Subtarget.h
+++ llvm/lib/Target/AArch64/AArch64Subtarget.h
@@ -74,6 +74,7 @@
 NeoverseN2,
 Neoverse512TVB,
 NeoverseV1,
+NeoverseV2,
 Saphira,
 ThunderX2T99,
 ThunderX,
Index: llvm/lib/Target/AArch64/AArch64Subtarget.cpp
===
--- llvm/lib/Target/AArch64/AArch64Subtarget.cpp
+++ llvm/lib/Target/AArch64/AArch64Subtarget.cpp
@@ -210,6 +210,12 @@
 MaxBytesForLoopAlignment = 16;
 VScaleForTuning = 2;
 break;
+  case NeoverseV2:
+PrefFunctionLogAlignment = 4;
+PrefLoopLogAlignment = 5;
+MaxBytesForLoopAlignment = 16;
+VScaleForTuning = 1;
+break;
   case Neoverse512TVB:
 PrefFunctionLogAlignment = 4;
 VScaleForTuning = 1;
Index: llvm/lib/Target/AArch64/AArch64.td
===
--- llvm/lib/Target/AArch64/AArch64.td
+++ llvm/lib/Target/AArch64/AArch64.td
@@ -936,6 +936,10 @@
   FeatureLSLFast,
   FeaturePostRAScheduler]>;
 
+def TuneNeoverseV2 : SubtargetFeature<"neoversev2", "ARMProcFamily", "NeoverseV2",
+  "Neoverse V2 ARM processors", [
+  FeaturePostRAScheduler]>;
+
 def TuneSaphira  : SubtargetFeature<"saphira", "ARMProcFamily", "Saphira",
"Qualcomm Saphira processors", [
FeatureCustomCheapAsMoveHandling,
@@ -1100,6 +1104,10 @@
FeatureFullFP16, FeatureMatMulInt8, FeatureNEON,
FeaturePerfMon, FeatureRandGen,

[clang] ef4bbfe - [clang] AST: SubstTemplateTypeParmType support for non-canonical underlying type

2022-09-21 Thread Matheus Izvekov via cfe-commits

Author: Matheus Izvekov
Date: 2022-09-21T14:22:19+02:00
New Revision: ef4bbfe338bd85a9938d47c2d65f0eef874a6f7c

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

LOG: [clang] AST: SubstTemplateTypeParmType support for non-canonical 
underlying type

This change allows us to represent in the AST some specific
circumstances where we substitute a template parameter type
which is part of the underlying type of a previous substitution.

This presently happens in some circumstances dealing with
substitution of defaulted parameters of template template
parameters, and in some other cases during concepts substitution.

The main motivation for this change is for the future use in the
implementation of template specialization resugaring, as this will
allow us to represent a substitution with sugared types.

Signed-off-by: Matheus Izvekov 

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

Added: 


Modified: 
clang/include/clang/AST/Type.h
clang/include/clang/AST/TypeProperties.td
clang/lib/AST/ASTContext.cpp
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/Type.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/TreeTransform.h
clang/test/AST/ast-dump-template-decls.cpp

Removed: 




diff  --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 9d3aea0a3acda..347088780e4b8 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -1798,6 +1798,8 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
 
 unsigned : NumTypeBits;
 
+unsigned HasNonCanonicalUnderlyingType : 1;
+
 /// Represents the index within a pack if this represents a substitution
 /// from a pack expansion. This index starts at the end of the pack and
 /// increments towards the beginning.
@@ -4985,8 +4987,12 @@ class TemplateTypeParmType : public Type, public 
llvm::FoldingSetNode {
 /// been replaced with these.  They are used solely to record that a
 /// type was originally written as a template type parameter;
 /// therefore they are never canonical.
-class SubstTemplateTypeParmType : public Type, public llvm::FoldingSetNode {
+class SubstTemplateTypeParmType final
+: public Type,
+  public llvm::FoldingSetNode,
+  private llvm::TrailingObjects {
   friend class ASTContext;
+  friend class llvm::TrailingObjects;
 
   // The original type parameter.
   const TemplateTypeParmType *Replaced;
@@ -5003,7 +5009,9 @@ class SubstTemplateTypeParmType : public Type, public 
llvm::FoldingSetNode {
   /// Gets the type that was substituted for the template
   /// parameter.
   QualType getReplacementType() const {
-return getCanonicalTypeInternal();
+return SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType
+   ? *getTrailingObjects()
+   : getCanonicalTypeInternal();
   }
 
   Optional getPackIndex() const {
@@ -5023,7 +5031,7 @@ class SubstTemplateTypeParmType : public Type, public 
llvm::FoldingSetNode {
   const TemplateTypeParmType *Replaced,
   QualType Replacement, Optional PackIndex) {
 ID.AddPointer(Replaced);
-ID.AddPointer(Replacement.getAsOpaquePtr());
+Replacement.Profile(ID);
 ID.AddInteger(PackIndex ? *PackIndex - 1 : 0);
   }
 

diff  --git a/clang/include/clang/AST/TypeProperties.td 
b/clang/include/clang/AST/TypeProperties.td
index aa8bb79fc4706..6d4bf515389a1 100644
--- a/clang/include/clang/AST/TypeProperties.td
+++ b/clang/include/clang/AST/TypeProperties.td
@@ -739,10 +739,9 @@ let Class = SubstTemplateTypeParmType in {
   }
 
   def : Creator<[{
-// The call to getCanonicalType here existed in ASTReader.cpp, too.
 return ctx.getSubstTemplateTypeParmType(
 cast(replacedParameter),
-ctx.getCanonicalType(replacementType), PackIndex);
+replacementType, PackIndex);
   }]>;
 }
 

diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 622bad78e59a8..d9811ce19eb6c 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -4764,9 +4764,6 @@ QualType
 ASTContext::getSubstTemplateTypeParmType(const TemplateTypeParmType *Parm,
  QualType Replacement,
  Optional PackIndex) const {
-  assert(Replacement.isCanonical()
- && "replacement types must always be canonical");
-
   llvm::FoldingSetNodeID ID;
   SubstTemplateTypeParmType::Profile(ID, Parm, Replacement, PackIndex);
   void *InsertPos = nullptr;
@@ -4774,8 +4771,11 @@ ASTContext::getSubstTemplateTypeParmType(const 
TemplateTypeParmType *Parm,
 = SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
 
   if (!SubstParm) {
-SubstParm = new (*this, TypeAlignment)
-SubstTem

[PATCH] D132816: [clang] AST: SubstTemplateTypeParmType support for non-canonical underlying type

2022-09-21 Thread Matheus Izvekov via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGef4bbfe338bd: [clang] AST: SubstTemplateTypeParmType support 
for non-canonical underlying type (authored by mizvekov).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132816

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/TreeTransform.h
  clang/test/AST/ast-dump-template-decls.cpp

Index: clang/test/AST/ast-dump-template-decls.cpp
===
--- clang/test/AST/ast-dump-template-decls.cpp
+++ clang/test/AST/ast-dump-template-decls.cpp
@@ -162,3 +162,22 @@
 // CHECK:  SubstTemplateTypeParmType 0x{{[^ ]*}} 'short' sugar pack_index 0
 // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'U' dependent contains_unexpanded_pack depth 0 index 0 pack
 } // namespace PR56099
+
+namespace subst_default_argument {
+template class A {};
+template> class D1, class D2> using D = D1;
+
+template class E {};
+using test1 = D;
+// CHECK:  TypeAliasDecl 0x{{[^ ]*}}  col:7 test1 'D':'subst_default_argument::E>'
+// CHECK:  TemplateSpecializationType 0x{{[^ ]*}} 'A' sugar A
+// CHECK-NEXT: |-TemplateArgument type 'int':'int'
+// CHECK-NEXT: | `-SubstTemplateTypeParmType 0x{{[^ ]*}} 'int' sugar
+// CHECK-NEXT: |   |-TemplateTypeParmType 0x{{[^ ]*}} 'C1' dependent depth 1 index 0
+// CHECK-NEXT: |   | `-TemplateTypeParm 0x{{[^ ]*}} 'C1'
+// CHECK-NEXT: |   `-SubstTemplateTypeParmType 0x{{[^ ]*}} 'int' sugar
+// CHECK-NEXT: | |-TemplateTypeParmType 0x{{[^ ]*}} 'type-parameter-0-1' dependent depth 0 index 1
+// CHECK-NEXT: | `-BuiltinType 0x{{[^ ]*}} 'int'
+// CHECK-NEXT: `-RecordType 0x{{[^ ]*}} 'subst_default_argument::A'
+// CHECK-NEXT:   `-ClassTemplateSpecialization 0x{{[^ ]*}} 'A'
+} // namespace subst_default_argument
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -6408,8 +6408,6 @@
   if (Replacement.isNull())
 return QualType();
 
-  // Always canonicalize the replacement type.
-  Replacement = SemaRef.Context.getCanonicalType(Replacement);
   QualType Result = SemaRef.Context.getSubstTemplateTypeParmType(
   T->getReplacedParameter(), Replacement, T->getPackIndex());
 
Index: clang/lib/Sema/SemaTemplate.cpp
===
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -3513,8 +3513,7 @@
 0, IndexReplaced, false,
 cast(TPL->getParam(IndexReplaced)));
 return SemaRef.Context.getSubstTemplateTypeParmType(
-cast(TTP), Replacement.getCanonicalType(),
-PackIndexReplaced);
+cast(TTP), Replacement, PackIndexReplaced);
   };
 
   switch (BTD->getBuiltinTemplateKind()) {
Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3650,10 +3650,16 @@
 }
 
 SubstTemplateTypeParmType::SubstTemplateTypeParmType(
-const TemplateTypeParmType *Param, QualType Canon,
+const TemplateTypeParmType *Param, QualType Replacement,
 Optional PackIndex)
-: Type(SubstTemplateTypeParm, Canon, Canon->getDependence()),
+: Type(SubstTemplateTypeParm, Replacement.getCanonicalType(),
+   Replacement->getDependence()),
   Replaced(Param) {
+  SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType =
+  Replacement != getCanonicalTypeInternal();
+  if (SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType)
+*getTrailingObjects() = Replacement;
+
   SubstTemplateTypeParmTypeBits.PackIndex = PackIndex ? *PackIndex + 1 : 0;
 }
 
Index: clang/lib/AST/ASTImporter.cpp
===
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -1530,8 +1530,7 @@
 return ToReplacementTypeOrErr.takeError();
 
   return Importer.getToContext().getSubstTemplateTypeParmType(
-  *ReplacedOrErr, ToReplacementTypeOrErr->getCanonicalType(),
-  T->getPackIndex());
+  *ReplacedOrErr, *ToReplacementTypeOrErr, T->getPackIndex());
 }
 
 ExpectedType ASTNodeImporter::VisitSubstTemplateTypeParmPackType(
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -4764,9 +4764,6 @@
 ASTContext::getSubstTemplateTypeParmType(const TemplateTypeParmType *Parm,
  QualType Replacement,
 

[PATCH] D134286: [C2x] implement typeof and typeof_unqual

2022-09-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman marked 4 inline comments as done.
aaron.ballman added inline comments.



Comment at: clang/include/clang/AST/Type.h:1902
 AutoTypeBitfields AutoTypeBits;
+TypeOfBitfields TypeOfBits;
 BuiltinTypeBitfields BuiltinTypeBits;

erichkeane wrote:
> So the downside to doing the bitfields is that EVERY 'Type' pays for them, or 
> at least, pays for the largest one.  As this is a rarely used and 'leaf' AST 
> node, I would say using the bitfields for this is at minimum 'unnecessary'.
> 
> That said, I doubt it is the 'biggest one', so I could go either way.
This is a union of objects, I'm certain all of them are at least one bit wide, 
so we're not adding to any extra overhead, we're taking advantage of the 
overhead we're already paying for.



Comment at: clang/lib/AST/ASTContext.cpp:12910-12916
+// FIXME:: is this assumption correct or do we need to do work here to find
+// the common type sugar regarding the stripped qualifiers if only one side
+// is unqual?
+assert(cast(X)->isUnqual() == cast(Y)->isUnqual() 
&&
+   "typeof vs typeof_unqual mismatch?");
+return Ctx.getTypeOfType(Ctx.getQualifiedType(Underlying),
+ cast(X)->isUnqual());

aaron.ballman wrote:
> mizvekov wrote:
> > mizvekov wrote:
> > > erichkeane wrote:
> > > > I'm unfamiliar with this function, but I would expect you MIGHT need 
> > > > to?  If only because they are the same AST node.  Should 'unqual' 
> > > > version be its own node?  I'm on the fence, as it is a LOT of code to 
> > > > do so, but also ends up being simpler in many places.
> > > A qualified and an unqualified typeof could have the same underlying 
> > > type, so this assert can trip.
> > > 
> > > I think what makes most sense is to unify them to a qualified typeof in 
> > > case they differ, as that holds the underlying type unchanged:
> > > ```
> > > return Ctx.getTypeOfType(Ctx.getQualifiedType(Underlying),
> > >  cast(X)->isUnqual() && 
> > > cast(Y)->isUnqual());
> > > ```
> > By the way, one thing to notice is the confusion regarding what is the 
> > underlying type of this node, the result of `desugar()` or the result of 
> > `getUnderlyingType()`?
> > 
> > On my previous post, I meant the former.
> > 
> > Maybe this is a good reason to rename `getUnderlyingType()` to 
> > `getUnmodifiedType()` or something similar?
> FWIW: I still have to address these comments in the patch, but I'll do that 
> tomorrow.
Thanks @mizvekov -- that makes sense to me. I've changed the implementation 
here, and I've also renamed `getUnderlyingType()` to `getUnmodifiedType()`. I 
was hesitant to do the rename before (but I was thinking about it!) because all 
of the "this type represents another type" types use `getUnderlyingType()` 
(such as `DecltypeType`, `UnaryTransformType`, etc). But in this case, the 
"underlying type" is less clear because of the unqual variant, so I think 
renaming is a good idea here.



Comment at: clang/lib/AST/Type.cpp:3474
+: Type(TypeOfExpr,
+   Kind == TypeOfKind::Unqualified ? Can.getTypeofUnqualType() : Can,
toTypeDependence(E->getDependence()) |

erichkeane wrote:
> Does this have to be defensive about `Can` being the 'default' value of an 
> empty qual-type?
`getTypeofUnqualType()` looks for a null type and handles it appropriately 
already. If `Can` isn't valid, then we pass along the invalid type in either 
branch.


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

https://reviews.llvm.org/D134286

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


[PATCH] D131465: C++/ObjC++: switch to gnu++17 as the default standard

2022-09-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D131465#3804893 , @glandium wrote:

> This didn't change the default for msvc targets, was that expected?

Can confirm: https://godbolt.org/z/EPxn1T6za

I did not expect this (and I'm a bit shocked that we had no test failures from 
it).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131465

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


[PATCH] D134286: [C2x] implement typeof and typeof_unqual

2022-09-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman updated this revision to Diff 461867.
aaron.ballman marked 2 inline comments as done.
aaron.ballman added a comment.
Herald added a subscriber: arphaman.

Updating based on review feedback; I believe this handles all of the comments.


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

https://reviews.llvm.org/D134286

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/CanonicalType.h
  clang/include/clang/AST/PropertiesBase.td
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeLoc.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/Specifiers.h
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Sema/DeclSpec.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/ASTStructuralEquivalence.cpp
  clang/lib/AST/ODRHash.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypeLoc.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Sema/DeclSpec.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/C/C2x/n2927.c
  clang/test/C/C2x/n2927_2.c
  clang/test/C/C2x/n2930.c
  clang/test/Lexer/keywords_test.c
  clang/test/Parser/c2x-typeof-ext-warns.c
  clang/test/Parser/c2x-typeof.c
  clang/test/Sema/c2x-typeof.c
  clang/tools/libclang/CIndex.cpp
  clang/www/c_status.html

Index: clang/www/c_status.html
===
--- clang/www/c_status.html
+++ clang/www/c_status.html
@@ -1092,17 +1092,11 @@
 

 https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2927.htm";>N2927
-
-  Partial
-Clang supports typeof in GNU standards mode, but its
-compatibility with this proposal is unknown. Also, Clang does not yet
-support remove_quals.
-  
-
+Clang 16
   

 https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2930.pdf";>N2930
-No
+Clang 16
   
 
   Type annex tgmath narrowing macros with integer args v2
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -1817,7 +1817,7 @@
 }
 
 bool CursorVisitor::VisitTypeOfTypeLoc(TypeOfTypeLoc TL) {
-  if (TypeSourceInfo *TSInfo = TL.getUnderlyingTInfo())
+  if (TypeSourceInfo *TSInfo = TL.getUnmodifiedTInfo())
 return Visit(TSInfo->getTypeLoc());
 
   return false;
Index: clang/test/Sema/c2x-typeof.c
===
--- /dev/null
+++ clang/test/Sema/c2x-typeof.c
@@ -0,0 +1,94 @@
+// RUN: %clang_cc1 -verify -std=c2x %s
+
+// Demonstrate that we get the correct type information. Do this by leaning
+// heavily on redeclarations needing to use the same type for both decls.
+extern int i;
+extern typeof(i) i;
+extern typeof_unqual(i) i;
+
+extern const int j;
+extern typeof(j) j;
+
+extern const int n; // expected-note 2 {{previous declaration is here}}
+extern typeof(i) n; // expected-error {{redeclaration of 'n' with a different type: 'typeof (i)' (aka 'int') vs 'const int'}}
+extern typeof_unqual(n) n;  // expected-error {{redeclaration of 'n' with a different type: 'typeof_unqual (n)' (aka 'int') vs 'const int'}}
+
+// Ensure we get a redeclaration error here for the types not matching.
+extern typeof(j) k;// expected-note {{previous declaration is here}}
+extern typeof_unqual(j) k; // expected-error {{redeclaration of 'k' with a different type: 'typeof_unqual (j)' (aka 'int') vs 'typeof (j)' (aka 'const int')}}
+
+// Make sure the type-form of the operator also works.
+extern typeof(int) l;
+extern typeof_unqual(const int) l;
+
+extern typeof(const int) m;// expected-note {{previous declaration is here}}
+extern typeof_unqual(const int) m; // expected-error {{redeclaration of 'm' with a different type: 'typeof_unqual(const int)' (aka 'int') vs 'typeof(const int)' (aka 'const int')}}
+
+// Show that we can use an incomplete type which is then completed later.
+extern typeof(struct T) *o;
+struct T { int a; } t;
+extern typeof(struct T) *o;
+extern typeof(t) *o;
+extern typeof(&t) o;
+extern typeof_unqual(volatile struct T) *o;
+extern typeof_unqual(t) *o;
+extern typeof_unqual(&t) o;
+
+// Show that we properly strip the _Atomic qualifier.
+extern _Atomic int i2;
+extern _Atomic(int) i2;
+extern typeof(i2) i2;//

[PATCH] D134334: [Clang] Fix crash in isCXXDeclarationSpecifier when attempting to annotate template name

2022-09-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

I have no real idea what is going on here, the parser isn't an area where I 
spend much time.  Can you ELI5?


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

https://reviews.llvm.org/D134334

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


[PATCH] D126907: Deferred Concept Instantiation Implementation Take 2

2022-09-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane reopened this revision.
erichkeane added a comment.
This revision is now accepted and ready to land.

I have a replacement patch that should fix all of the bugs I'm aware of.


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

https://reviews.llvm.org/D126907

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


[PATCH] D134286: [C2x] implement typeof and typeof_unqual

2022-09-21 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov added inline comments.



Comment at: clang/lib/AST/Type.cpp:3504-3507
+  // We strip all qualifier-like attributes as well.
+  if (const auto *AT = dyn_cast(Ret.getTypePtr());
+  AT && AT->isQualifier())
+Ret = AT->getModifiedType();

I think this block of code is not actually needed.

So the AttributedType node is just sugar right, the address space are real 
qualifiers applied to the type, just like const and such.

So the `getAtomicUnqualifiedType()` alone should do that, as it uses 
`getUnqualifiedType()` on the final result.

When unqualifying a type, this will already strip all top level sugar nodes 
necessary to get rid of the qualifiers.


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

https://reviews.llvm.org/D134286

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


[PATCH] D134286: [C2x] implement typeof and typeof_unqual

2022-09-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/include/clang/AST/Type.h:1902
 AutoTypeBitfields AutoTypeBits;
+TypeOfBitfields TypeOfBits;
 BuiltinTypeBitfields BuiltinTypeBits;

aaron.ballman wrote:
> erichkeane wrote:
> > So the downside to doing the bitfields is that EVERY 'Type' pays for them, 
> > or at least, pays for the largest one.  As this is a rarely used and 'leaf' 
> > AST node, I would say using the bitfields for this is at minimum 
> > 'unnecessary'.
> > 
> > That said, I doubt it is the 'biggest one', so I could go either way.
> This is a union of objects, I'm certain all of them are at least one bit 
> wide, so we're not adding to any extra overhead, we're taking advantage of 
> the overhead we're already paying for.
Yep, this was a 'general lament'.  Sorry for not being more clear.


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

https://reviews.llvm.org/D134286

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


[PATCH] D125419: [Arm64EC 7/?] clang side of Arm64EC varargs ABI.

2022-09-21 Thread David Spickett via Phabricator via cfe-commits
DavidSpickett added a comment.

I don't have the expertise to approve, but one question.

Why is there more testing in the `.c` than in `.cpp`. Is the same logic being 
used for both so there's no point checking twice?

If so what things is the `.cpp` test looking for specifically? I struggle to 
see how the lines it checks for map into the call to the variadic function. Is 
it looking at the mangling, the choice of pointer or not?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125419

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


[PATCH] D134286: [C2x] implement typeof and typeof_unqual

2022-09-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman marked an inline comment as done.
aaron.ballman added inline comments.



Comment at: clang/lib/AST/Type.cpp:3504-3507
+  // We strip all qualifier-like attributes as well.
+  if (const auto *AT = dyn_cast(Ret.getTypePtr());
+  AT && AT->isQualifier())
+Ret = AT->getModifiedType();

mizvekov wrote:
> I think this block of code is not actually needed.
> 
> So the AttributedType node is just sugar right, the address space are real 
> qualifiers applied to the type, just like const and such.
> 
> So the `getAtomicUnqualifiedType()` alone should do that, as it uses 
> `getUnqualifiedType()` on the final result.
> 
> When unqualifying a type, this will already strip all top level sugar nodes 
> necessary to get rid of the qualifiers.
The situation I had in mind for this was something like:
```
typedef __attribute__((address_space(1))) int foo;
_Atomic foo i;
typeof_unqual(i) j; // Should be int
```
but I didn't realize we distribute the qualifiers from the inner type to the 
atomic type: https://godbolt.org/z/bbafvTKsj 

So I think you're correct -- we don't seem to need this function at all. 
(Function type attributes like calling conventions, etc aren't handled via an 
`AttributedType` either, but are on the `ExtInfo` object for the function type.)

Good catch!


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

https://reviews.llvm.org/D134286

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


[PATCH] D126907: Deferred Concept Instantiation Implementation Take 2

2022-09-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

I spoke too soon, I found another crash that came out of @wlei s repro from 
last time.


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

https://reviews.llvm.org/D126907

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


[PATCH] D134355: [AMDGPU] Emit module flag for all code object versions

2022-09-21 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added reviewers: b-sumner, cfang.
Herald added subscribers: kosarev, kerbowa, t-tye, tpr, dstuttard, jvesely, 
kzhuravl.
Herald added a project: All.
yaxunl requested review of this revision.
Herald added a subscriber: wdng.

https://reviews.llvm.org/D134355

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGenCUDA/amdgpu-code-object-version.cu
  clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu


Index: clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu
===
--- clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu
+++ clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu
@@ -18,7 +18,7 @@
 // COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel1Pi(i32 
addrspace(1)*{{.*}} %x.coerce)
 // CHECK: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to 
[[TYPE]]*
 // CHECK-NOT: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to 
[[TYPE]]*
-// OPT: [[VAL:%.*]] = load i32, i32 addrspace(1)* %x.coerce, align 4, 
!amdgpu.noclobber !2
+// OPT: [[VAL:%.*]] = load i32, i32 addrspace(1)* %x.coerce, align 4, 
!amdgpu.noclobber ![[MD:[0-9]+]]
 // OPT: [[INC:%.*]] = add nsw i32 [[VAL]], 1
 // OPT: store i32 [[INC]], i32 addrspace(1)* %x.coerce, align 4
 // OPT: ret void
@@ -30,7 +30,7 @@
 // COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel2Ri(i32 
addrspace(1)*{{.*}} nonnull align 4 dereferenceable(4) %x.coerce)
 // CHECK: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to 
[[TYPE]]*
 // CHECK-NOT: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to 
[[TYPE]]*
-// OPT: [[VAL:%.*]] = load i32, i32 addrspace(1)* %x.coerce, align 4, 
!amdgpu.noclobber !2
+// OPT: [[VAL:%.*]] = load i32, i32 addrspace(1)* %x.coerce, align 4, 
!amdgpu.noclobber ![[MD]]
 // OPT: [[INC:%.*]] = add nsw i32 [[VAL]], 1
 // OPT: store i32 [[INC]], i32 addrspace(1)* %x.coerce, align 4
 // OPT: ret void
@@ -68,7 +68,7 @@
 // OPT: [[R1:%.*]] = getelementptr inbounds %struct.S, %struct.S addrspace(4)* 
%0, i64 0, i32 1
 // OPT: [[P1:%.*]] = load float*, float* addrspace(4)* [[R1]], align 8
 // OPT: [[G1:%.*]] ={{.*}} addrspacecast float* [[P1]] to float addrspace(1)*
-// OPT: [[V0:%.*]] = load i32, i32 addrspace(1)* [[G0]], align 4, 
!amdgpu.noclobber !2
+// OPT: [[V0:%.*]] = load i32, i32 addrspace(1)* [[G0]], align 4, 
!amdgpu.noclobber ![[MD]]
 // OPT: [[INC:%.*]] = add nsw i32 [[V0]], 1
 // OPT: store i32 [[INC]], i32 addrspace(1)* [[G0]], align 4
 // OPT: [[V1:%.*]] = load float, float addrspace(1)* [[G1]], align 4
@@ -103,7 +103,7 @@
 // OPT: [[R1:%.*]] = getelementptr inbounds %struct.T, %struct.T addrspace(4)* 
%0, i64 0, i32 0, i64 1
 // OPT: [[P1:%.*]] = load float*, float* addrspace(4)* [[R1]], align 8
 // OPT: [[G1:%.*]] ={{.*}} addrspacecast float* [[P1]] to float addrspace(1)*
-// OPT: [[V0:%.*]] = load float, float addrspace(1)* [[G0]], align 4, 
!amdgpu.noclobber !2
+// OPT: [[V0:%.*]] = load float, float addrspace(1)* [[G0]], align 4, 
!amdgpu.noclobber ![[MD]]
 // OPT: [[ADD0:%.*]] = fadd contract float [[V0]], 1.00e+00
 // OPT: store float [[ADD0]], float addrspace(1)* [[G0]], align 4
 // OPT: [[V1:%.*]] = load float, float addrspace(1)* [[G1]], align 4
@@ -130,7 +130,7 @@
 // COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel82SS(float 
addrspace(1)*{{.*}} %a.coerce)
 // CHECK: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to 
[[TYPE]]*
 // CHECK-NOT: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to 
[[TYPE]]*
-// OPT: [[VAL:%.*]] = load float, float addrspace(1)* %a.coerce, align 4, 
!amdgpu.noclobber !2
+// OPT: [[VAL:%.*]] = load float, float addrspace(1)* %a.coerce, align 4, 
!amdgpu.noclobber ![[MD]]
 // OPT: [[INC:%.*]] = fadd contract float [[VAL]], 3.00e+00
 // OPT: store float [[INC]], float addrspace(1)* %a.coerce, align 4
 // OPT: ret void
Index: clang/test/CodeGenCUDA/amdgpu-code-object-version.cu
===
--- clang/test/CodeGenCUDA/amdgpu-code-object-version.cu
+++ clang/test/CodeGenCUDA/amdgpu-code-object-version.cu
@@ -1,16 +1,16 @@
 // Create module flag for code object version.
 
 // RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \
-// RUN:   -o - %s | FileCheck %s -check-prefix=NONE
+// RUN:   -o - %s | FileCheck %s -check-prefix=V4
 
 // RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \
-// RUN:   -mcode-object-version=2 -o - %s | FileCheck -check-prefix=NONE %s
+// RUN:   -mcode-object-version=2 -o - %s | FileCheck -check-prefix=V2 %s
 
 // RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \
-// RUN:   -mcode-object-version=3 -o - %s | FileCheck -check-prefix=NONE %s
+// RUN:   -mcode-object-version=3 -o - %s | FileCheck -check-prefix=V3 %s
 
 // RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \
-// RUN:   -mcode-object-version=4 -o - %s | FileCheck -check

[PATCH] D134128: Resubmit an implemention for constrained template template parameters [P0857R0 Part B]

2022-09-21 Thread Liming Liu via Phabricator via cfe-commits
lime added a comment.

I have not looked deep into D126907 , but the 
rule it referred seems related to something as follows:

  template  concept C = true;
  
  template 
  struct S {
  template  U> typename> friend void foo(S) {}
  };
  
  // Does the rule say these two are not the same?
  template  T> typename> S foo(S s) { return s; }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134128

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


[PATCH] D126907: Deferred Concept Instantiation Implementation Take 2

2022-09-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In D126907#3805640 , @erichkeane 
wrote:

> I spoke too soon, I found another crash that came out of @wlei s repro from 
> last time.

Actually, what I found was a reduction that had gone haywire before and 
generated invalid code, so I don't think it is worth blocking this patch.  The 
actual preprocessed file from @wlei actually compiles perfectly.


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

https://reviews.llvm.org/D126907

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


[PATCH] D134352: [AArch64] Add Neoverse V2 CPU support

2022-09-21 Thread Dave Green via Phabricator via cfe-commits
dmgreen added inline comments.



Comment at: llvm/lib/Target/AArch64/AArch64.td:941
+  "Neoverse V2 ARM processors", [
+  FeaturePostRAScheduler]>;
+

Please add FeatureFuseAES and FeatureLSLFast.



Comment at: llvm/lib/Target/AArch64/AArch64.td:1110
+   FeatureMatMulInt8, FeatureNEON, 
FeatureSVE2BitPerm,
+   FeatureSVE2, FeatureFP16FML, 
FeatureMTE];
   list Saphira= [HasV8_4aOps, FeatureCrypto, 
FeatureFPARMv8,

HasV9_0aOps implies some of these features already.



Comment at: llvm/lib/Target/AArch64/AArch64Subtarget.cpp:213
 break;
+  case NeoverseV2:
+PrefFunctionLogAlignment = 4;

This can use the same block as NeoverseN2?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134352

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


[PATCH] D134303: [AST] Preserve more structure in UsingEnumDecl node.

2022-09-21 Thread Nathan Sidwell via Phabricator via cfe-commits
urnathan added a comment.

AFAICT the UsingDecl doesn't capture the NestedNameSpecifier location, is 
UsingEnumDecl special in some way, or would this information be better placed 
in BaseUsingDecl?  Thanks for spotting the possible mid-air collistion with 
D134283 .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134303

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


[PATCH] D130460: [pseudo] Add recovery for declarations

2022-09-21 Thread Haojian Wu via Phabricator via cfe-commits
hokein commandeered this revision.
hokein edited reviewers, added: sammccall; removed: hokein.
hokein added inline comments.



Comment at: clang-tools-extra/pseudo/lib/cxx/CXX.cpp:333
+  // Walk over tokens at the appropriate bracket nesting level.
+  for (const Token *T = &P.Tokens.tokens()[P.Begin].next(); T->Kind != 
tok::eof;
+   T = &T->next()) {

`P.Tokens.tokens()[P.Begin].next()` doesn't seem like correct, we should start 
with `P.Tokens.tokens()[P.Begin]`, otherwise we will ignore the first token, 

example:

```
namespace  {
}
foo foo;
```



Comment at: clang-tools-extra/pseudo/lib/cxx/CXX.cpp:342
+   "How did we parse an unmatched closing bracket?!");
+return P.Tokens.index(*T);
+  }

we should return `index() +1`



Comment at: clang-tools-extra/pseudo/lib/cxx/CXX.cpp:347
+  P.Tokens.index(*B) >= P.Cursor)
+return P.Tokens.index(*B);
+  // Skip over opening/closing bracket pair.

the same, +1.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130460

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


[PATCH] D130460: [pseudo] Add recovery for declarations

2022-09-21 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

I'm going to pick this up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130460

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


[PATCH] D134329: [clang-format][NFC] Reformat clang/lib/Format using 6257832bf94f

2022-09-21 Thread sstwcw via Phabricator via cfe-commits
sstwcw added a comment.

Did you leave out `clang/include/clang/Format` and `clang/unittests/Format`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134329

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


[PATCH] D134355: [AMDGPU] Emit module flag for all code object versions

2022-09-21 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments.



Comment at: clang/lib/CodeGen/CodeGenModule.cpp:590-591
 // times 100.
-// ToDo: Enable module flag for all code object version when ROCm device
-// library is ready.
-if (getTarget().getTargetOpts().CodeObjectVersion == TargetOptions::COV_5) 
{
+if (getTarget().getTargetOpts().CodeObjectVersion !=
+TargetOptions::COV_None) {
   getModule().addModuleFlag(llvm::Module::Error,

What is the flag default value? What does it mean to target none?


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

https://reviews.llvm.org/D134355

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


[clang] d47f0be - [AIX] change "llvm-nm" to "env OBJECT_MODE=any llvm-nm" in clang/test for AIX OS

2022-09-21 Thread via cfe-commits

Author: zhijian
Date: 2022-09-21T09:38:13-04:00
New Revision: d47f0be0e82b46aed8d23e0dd4b596adefad2448

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

LOG: [AIX] change "llvm-nm" to "env OBJECT_MODE=any llvm-nm" in clang/test for 
AIX OS

Summary:
   since default object mode of llvm-nm is change to -X32 (from default -Xany) 
in patch https://reviews.llvm.org/D132494.In order not effect the test cases in 
clang/test we need to change "llvm-nm" to "env OBJECT_MODE=any llvm-nm" in 
clang/test for AIX OS

Reviewers: James Henderson,David Tenty, Hubert Tong
Differential Revision: https://reviews.llvm.org/D134284

Added: 


Modified: 
clang/test/lit.cfg.py

Removed: 




diff  --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 7fa46e3d99fc..3fb88c3c7ef8 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -276,3 +276,13 @@ def exclude_unsupported_files_for_aix(dirname):
 config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
 elif platform.system() == 'AIX':
 config.environment['AIXTHREAD_STK'] = '4194304'
+
+# The llvm-nm tool supports an environment variable "OBJECT_MODE" on AIX OS, 
which
+# controls the kind of objects they will support. If there is no "OBJECT_MODE"
+# environment variable specified, the default behaviour is to support 32-bit
+# objects only. In order to not affect most test cases, which expect to support
+# 32-bit and 64-bit objects by default, set the environment variable
+# "OBJECT_MODE" to 'any' for llvm-nm on AIX OS.
+
+if 'system-aix' in config.available_features:
+config.substitutions.append(('llvm-nm', 'env OBJECT_MODE=any llvm-nm'))



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


[PATCH] D134284: [AIX] change "llvm-nm" to "env OBJECT_MODE=any llvm-nm" in clang/test for AIX OS

2022-09-21 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd47f0be0e82b: [AIX] change "llvm-nm" to "env 
OBJECT_MODE=any llvm-nm" in clang/test for AIX OS (authored by zhijian 
).

Changed prior to commit:
  https://reviews.llvm.org/D134284?vs=461598&id=461879#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134284

Files:
  clang/test/lit.cfg.py


Index: clang/test/lit.cfg.py
===
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -276,3 +276,13 @@
 config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
 elif platform.system() == 'AIX':
 config.environment['AIXTHREAD_STK'] = '4194304'
+
+# The llvm-nm tool supports an environment variable "OBJECT_MODE" on AIX OS, 
which
+# controls the kind of objects they will support. If there is no "OBJECT_MODE"
+# environment variable specified, the default behaviour is to support 32-bit
+# objects only. In order to not affect most test cases, which expect to support
+# 32-bit and 64-bit objects by default, set the environment variable
+# "OBJECT_MODE" to 'any' for llvm-nm on AIX OS.
+
+if 'system-aix' in config.available_features:
+config.substitutions.append(('llvm-nm', 'env OBJECT_MODE=any llvm-nm'))


Index: clang/test/lit.cfg.py
===
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -276,3 +276,13 @@
 config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
 elif platform.system() == 'AIX':
 config.environment['AIXTHREAD_STK'] = '4194304'
+
+# The llvm-nm tool supports an environment variable "OBJECT_MODE" on AIX OS, which
+# controls the kind of objects they will support. If there is no "OBJECT_MODE"
+# environment variable specified, the default behaviour is to support 32-bit
+# objects only. In order to not affect most test cases, which expect to support
+# 32-bit and 64-bit objects by default, set the environment variable
+# "OBJECT_MODE" to 'any' for llvm-nm on AIX OS.
+
+if 'system-aix' in config.available_features:
+config.substitutions.append(('llvm-nm', 'env OBJECT_MODE=any llvm-nm'))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D134314: [HIP] stop forcing the lang std in the driver

2022-09-21 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134314

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


[PATCH] D134127: [ARM] Check target feature support for __builtin_arm_crc*

2022-09-21 Thread Dave Green via Phabricator via cfe-commits
dmgreen added a comment.

The arm_acle.h header is shared across Arm and AArch64 - they use the same 
builtin names even if they are replicated to a certain degree across the 
backends. As this is used in both it would be good to fix them at the same 
time. It doesn't need to change the guards as D133359 
 does, the better error message from 
TARGET_BUILTIN is a good starts (and helps to simplify D133359 
).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134127

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


[PATCH] D134127: [ARM] Check target feature support for __builtin_arm_crc*

2022-09-21 Thread Dave Green via Phabricator via cfe-commits
dmgreen accepted this revision.
dmgreen added a comment.
This revision is now accepted and ready to land.

Whether you do that here or in another patch, the change LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134127

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


[PATCH] D133983: [HLSL] Add SV_DispatchThreadID

2022-09-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

There are no tests for applying this to a global variable, so those should be 
added.




Comment at: clang/include/clang/Basic/AttrDocs.td:6596-6598
+The ``SV_DispatchThreadID`` semantic, when applied to an input parameter, 
specifies a
+data binding to map global thread offset within the Dispatch call(per 
dimension of the group) to the specified parameter.
+This attribute is only supported in compute shaders.

It doesn't specify what happens when applied to a global variable.



Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:113
+static Value *buildVectorInput(IRBuilder<> &B, Function *F, llvm::Type *Ty) {
+  if (FixedVectorType *VT = dyn_cast(Ty)) {
+Value *Result = PoisonValue::get(Ty);





Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:120-121
+return Result;
+  } else
+return B.CreateCall(F, {B.getInt32(0)});
+}





Comment at: clang/lib/Sema/SemaDeclAttr.cpp:6925
+  }
+
+  D->addAttr(::new (S.Context) HLSLSV_DispatchThreadIDAttr(S.Context, AL));

Are there other restrictions we need to care about, like what the type of the 
parameter/global is, etc?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133983

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


[PATCH] D134303: [AST] Preserve more structure in UsingEnumDecl node.

2022-09-21 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

In D134303#3805687 , @urnathan wrote:

> AFAICT the UsingDecl doesn't capture the NestedNameSpecifier location

We have `NestedNameSpecifierLoc UsingDecl::QualifierLoc` already, maybe I'm 
misunderstanding.

> is UsingEnumDecl special in some way, or would this information be better 
> placed in BaseUsingDecl?

It would be possible to unify the two by moving UsingDecl's QualifierLoc into 
BaseUsingDecl..

I think this comes at the cost of a worse API for UsingEnumDecl: making the 
qualifier as part of a Typeloc/TypeSourceInfo means that AST consumers with 
some generic handling for TypeLocs can reuse it. (e.g. the clangd changes in 
this patch are mostly just testing various things that now work for free).

UsingDecl already has that comparatively awkward API today - it's one of the 
AST nodes that very often needs to be handled explicitly - unavoidably as 
"reference to a decl" is not modeled in the AST, and because it may point to an 
overload set etc anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134303

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


[PATCH] D134326: [HLSL] Allow SV_GroupIndex for lib profile.

2022-09-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

This looks reasonable to me, but I leave the final sign-off to @beanz.




Comment at: clang/test/CodeGenHLSL/GlobalDestructors.hlsl:1
-// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -S 
-emit-llvm -disable-llvm-passes %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -S 
-emit-llvm -disable-llvm-passes %s -o - | FileCheck %s 
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -std=hlsl202x -S 
-emit-llvm -disable-llvm-passes %s -o - | FileCheck %s --check-prefixes=CHECK

Strips an introduced trailing whitespace.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134326

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


[PATCH] D134128: Resubmit an implemention for constrained template template parameters [P0857R0 Part B]

2022-09-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In D134128#3805675 , @lime wrote:

> I have not looked deep into D126907 , but 
> the rule it referred seems related to something as follows:

You shouldn't have to look 'deep' into it, just rebase and see what happens.  
Note that it has not been committed yet, so you'll have to manually apply it.

>   template  concept C = true;
>   
>   template 
>   struct S {
>   template  U> typename> friend void foo(S) {}
>   };
>   
>   // Does the rule say these two are not the same?
>   template  T> typename> S foo(S s) { return s; }

Right, those are not the same because of: https://eel.is/c++draft/temp.friend#9


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134128

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


[PATCH] D126907: Deferred Concept Instantiation Implementation Take 2

2022-09-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

Failure I noticed was NOT a regression: https://godbolt.org/z/MnvqP88vv


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

https://reviews.llvm.org/D126907

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


[PATCH] D134128: Resubmit an implemention for constrained template template parameters [P0857R0 Part B]

2022-09-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In D134128#3805675 , @lime wrote:

> I have not looked deep into D126907 , but 
> the rule it referred seems related to something as follows:
>
>   template  concept C = true;
>   
>   template 
>   struct S1 {
>   template  U> typename> friend void foo() {}
>   };
>   
>   // Does the rule say these two functions are not the same?
>   template 
>   struct S2 {
>   template  U> typename> friend void foo() {}
>   };
>
> BTW, I could not image a non-template friend declaration with a 
> requires-clause...

You edited while I was answering, but I believe the answer is the same: those 
are not the same thanks to temp.friend p9.

That D126907  is actually NOT just the 
friends, this is an entire omnibus "fix the deferred concepts implementation".  
The original concepts implementation used a greedy instantiation mechanism, 
which is unfortunately not permitted by the standard.  This patch is delaying 
the concept instantiation until it is required for checking.  Along the way 
that 'friend' example was run across.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134128

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


[PATCH] D134286: [C2x] implement typeof and typeof_unqual

2022-09-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman updated this revision to Diff 461886.
aaron.ballman marked an inline comment as done.
aaron.ballman added a comment.

Simplifying based on review feedback.


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

https://reviews.llvm.org/D134286

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/CanonicalType.h
  clang/include/clang/AST/PropertiesBase.td
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeLoc.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/Specifiers.h
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Sema/DeclSpec.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/ASTStructuralEquivalence.cpp
  clang/lib/AST/ODRHash.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypeLoc.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Sema/DeclSpec.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/C/C2x/n2927.c
  clang/test/C/C2x/n2927_2.c
  clang/test/C/C2x/n2930.c
  clang/test/Lexer/keywords_test.c
  clang/test/Parser/c2x-typeof-ext-warns.c
  clang/test/Parser/c2x-typeof.c
  clang/test/Sema/c2x-typeof.c
  clang/tools/libclang/CIndex.cpp
  clang/www/c_status.html

Index: clang/www/c_status.html
===
--- clang/www/c_status.html
+++ clang/www/c_status.html
@@ -1092,17 +1092,11 @@
 

 https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2927.htm";>N2927
-
-  Partial
-Clang supports typeof in GNU standards mode, but its
-compatibility with this proposal is unknown. Also, Clang does not yet
-support remove_quals.
-  
-
+Clang 16
   

 https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2930.pdf";>N2930
-No
+Clang 16
   
 
   Type annex tgmath narrowing macros with integer args v2
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -1817,7 +1817,7 @@
 }
 
 bool CursorVisitor::VisitTypeOfTypeLoc(TypeOfTypeLoc TL) {
-  if (TypeSourceInfo *TSInfo = TL.getUnderlyingTInfo())
+  if (TypeSourceInfo *TSInfo = TL.getUnmodifiedTInfo())
 return Visit(TSInfo->getTypeLoc());
 
   return false;
Index: clang/test/Sema/c2x-typeof.c
===
--- /dev/null
+++ clang/test/Sema/c2x-typeof.c
@@ -0,0 +1,94 @@
+// RUN: %clang_cc1 -verify -std=c2x %s
+
+// Demonstrate that we get the correct type information. Do this by leaning
+// heavily on redeclarations needing to use the same type for both decls.
+extern int i;
+extern typeof(i) i;
+extern typeof_unqual(i) i;
+
+extern const int j;
+extern typeof(j) j;
+
+extern const int n; // expected-note 2 {{previous declaration is here}}
+extern typeof(i) n; // expected-error {{redeclaration of 'n' with a different type: 'typeof (i)' (aka 'int') vs 'const int'}}
+extern typeof_unqual(n) n;  // expected-error {{redeclaration of 'n' with a different type: 'typeof_unqual (n)' (aka 'int') vs 'const int'}}
+
+// Ensure we get a redeclaration error here for the types not matching.
+extern typeof(j) k;// expected-note {{previous declaration is here}}
+extern typeof_unqual(j) k; // expected-error {{redeclaration of 'k' with a different type: 'typeof_unqual (j)' (aka 'int') vs 'typeof (j)' (aka 'const int')}}
+
+// Make sure the type-form of the operator also works.
+extern typeof(int) l;
+extern typeof_unqual(const int) l;
+
+extern typeof(const int) m;// expected-note {{previous declaration is here}}
+extern typeof_unqual(const int) m; // expected-error {{redeclaration of 'm' with a different type: 'typeof_unqual(const int)' (aka 'int') vs 'typeof(const int)' (aka 'const int')}}
+
+// Show that we can use an incomplete type which is then completed later.
+extern typeof(struct T) *o;
+struct T { int a; } t;
+extern typeof(struct T) *o;
+extern typeof(t) *o;
+extern typeof(&t) o;
+extern typeof_unqual(volatile struct T) *o;
+extern typeof_unqual(t) *o;
+extern typeof_unqual(&t) o;
+
+// Show that we properly strip the _Atomic qualifier.
+extern _Atomic int i2;
+extern _Atomic(int) i2;
+extern typeof(i2) i2;// expected-note {{previous declaration is here}}
+extern typeof_unqual(i2) i2; 

[PATCH] D115169: Create a generic ABI document for _BitInt

2022-09-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman edited reviewers, added: efriedma; removed: rsmith.
aaron.ballman added a comment.

Now that C2x is closer to getting finalized, I would like to get this 
documentation up somewhere public so that other implementations can see what we 
do and match our behavior more easily. Changing up the reviewers and pinging 
the review again, but I believe this documentation is still accurate except for 
mention of vector types (which are powers-of-two currently and so behave the 
same as existing vector types and thus don't need a lot of documentation aside 
from mentioning that).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115169

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


[PATCH] D133694: [Clang][OpenMP] Fix use_device_addr

2022-09-21 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 abandoned this revision.
doru1004 added a comment.

The outcome of this discussion resulted in a fix to the original program from 
use_device_addr(x) to use_device_addr(x[:count]).


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

https://reviews.llvm.org/D133694

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


[PATCH] D134361: [clang][Interp] Fix copy constructors of structs with array members

2022-09-21 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision.
tbaeder added reviewers: aaron.ballman, erichkeane, shafik, tahonermann.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This implements `ArrayInitLoopExpr`s in initializers and fixes a few issues I 
encountered along the way, with copy constructors generally.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134361

Files:
  clang/lib/AST/Interp/ByteCodeExprGen.cpp
  clang/lib/AST/Interp/ByteCodeExprGen.h
  clang/lib/AST/Interp/ByteCodeStmtGen.cpp
  clang/test/AST/Interp/records.cpp

Index: clang/test/AST/Interp/records.cpp
===
--- clang/test/AST/Interp/records.cpp
+++ clang/test/AST/Interp/records.cpp
@@ -37,6 +37,9 @@
 static_assert(ints.b == 30, "");
 static_assert(ints.c, "");
 static_assert(ints.getTen() == 10, "");
+static_assert(ints.numbers[0] == 1, "");
+static_assert(ints.numbers[1] == 2, "");
+static_assert(ints.numbers[2] == 3, "");
 
 constexpr const BoolPair &BP = ints.bp;
 static_assert(BP.first, "");
@@ -64,11 +67,17 @@
 static_assert(ints4.a == (40 * 50), "");
 static_assert(ints4.b == 0, "");
 static_assert(ints4.c, "");
-
-
-// FIXME: Implement initialization by DeclRefExpr.
-//constexpr Ints ints4 = ints3;  TODO
-
+static_assert(ints4.numbers[0] == 1, "");
+static_assert(ints4.numbers[1] == 2, "");
+static_assert(ints4.numbers[2] == 3, "");
+
+constexpr Ints ints5 = ints4;
+static_assert(ints5.a == (40 * 50), "");
+static_assert(ints5.b == 0, "");
+static_assert(ints5.c, "");
+static_assert(ints5.numbers[0] == 1, "");
+static_assert(ints5.numbers[1] == 2, "");
+static_assert(ints5.numbers[2] == 3, "");
 
 
 struct Ints2 {
Index: clang/lib/AST/Interp/ByteCodeStmtGen.cpp
===
--- clang/lib/AST/Interp/ByteCodeStmtGen.cpp
+++ clang/lib/AST/Interp/ByteCodeStmtGen.cpp
@@ -105,7 +105,7 @@
   const Record::Field *F = R->getField(Member);
 
   if (Optional T = this->classify(InitExpr->getType())) {
-if (!this->emitDupPtr(InitExpr))
+if (!this->emitThis(InitExpr))
   return false;
 
 if (!this->visit(InitExpr))
@@ -116,7 +116,7 @@
   } else {
 // Non-primitive case. Get a pointer to the field-to-initialize
 // on the stack and call visitInitialzer() for it.
-if (!this->emitDupPtr(InitExpr))
+if (!this->emitThis(InitExpr))
   return false;
 
 if (!this->emitGetPtrField(F->Offset, InitExpr))
Index: clang/lib/AST/Interp/ByteCodeExprGen.h
===
--- clang/lib/AST/Interp/ByteCodeExprGen.h
+++ clang/lib/AST/Interp/ByteCodeExprGen.h
@@ -85,6 +85,8 @@
   bool VisitConstantExpr(const ConstantExpr *E);
   bool VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *E);
   bool VisitMemberExpr(const MemberExpr *E);
+  bool VisitArrayInitIndexExpr(const ArrayInitIndexExpr *E);
+  bool VisitOpaqueValueExpr(const OpaqueValueExpr *E);
 
 protected:
   bool visitExpr(const Expr *E) override;
@@ -260,7 +262,7 @@
   /// Current scope.
   VariableScope *VarScope = nullptr;
 
-  /// Current argument index.
+  /// Current argument index. Needed to emit ArrayInitIndexExpr.
   llvm::Optional ArrayIndex;
 
   /// Flag indicating if return value is to be discarded.
Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp
===
--- clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -325,6 +325,18 @@
   return false;
 }
 
+template 
+bool ByteCodeExprGen::VisitArrayInitIndexExpr(
+const ArrayInitIndexExpr *E) {
+  assert(ArrayIndex);
+  return this->emitConstUint64(*ArrayIndex, E);
+}
+
+template 
+bool ByteCodeExprGen::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
+  return this->visit(E->getSourceExpr());
+}
+
 template  bool ByteCodeExprGen::discard(const Expr *E) {
   OptionScope Scope(this, /*NewDiscardResult=*/true);
   return this->Visit(E);
@@ -626,6 +638,33 @@
 return true;
   } else if (const auto *DIE = dyn_cast(Initializer)) {
 return this->visitInitializer(DIE->getExpr());
+  } else if (const auto AILE = dyn_cast(Initializer)) {
+// TODO: This compiles to quite a lot of bytecode if the array is larger.
+//   Investigate compiling this to a loop, or at least try to use
+//   the AILE's Common expr.
+const Expr *SubExpr = AILE->getSubExpr();
+size_t Size = AILE->getArraySize().getZExtValue();
+Optional ElemT = classify(SubExpr->getType());
+
+if (!ElemT)
+  return false;
+
+for (size_t I = 0; I != Size; ++I) {
+  ArrayIndex = I;
+  if (!this->emitDupPtr(SubExpr))
+return false;
+
+  if (!this->visit(SubExpr))
+return false;
+
+  if (!this->emitInitElem(*ElemT, I, Initializer))
+return false;
+
+  if (!this-

[PATCH] D134054: [clang][Interp] Properly destruct allocated Records

2022-09-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM as well (modulo Erich's comments).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134054

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


[PATCH] D132329: [X86][RFC] Using `__bf16` for AVX512_BF16 intrinsics

2022-09-21 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added inline comments.



Comment at: llvm/test/CodeGen/X86/avx512bf16-intrinsics-upgrade.ll:30
 ; X64-NEXT:kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
-; X64-NEXT:vcvtne2ps2bf16 %zmm1, %zmm0, %zmm0 {%k1} {z} # encoding: 
[0x62,0xf2,0x7f,0xc9,0x72,0xc1]
+; X64-NEXT:vmovdqu16 %zmm0, %zmm0 {%k1} {z} # encoding: 
[0x62,0xf1,0xff,0xc9,0x6f,0xc0]
 ; X64-NEXT:retq # encoding: [0xc3]

pengfei wrote:
> RKSimon wrote:
> > any chance we can recover the predicated instruction?
> It's possible, e.g., iterate all users of the intrinsic, bitcast all the 
> select operands as well; or add patterns for i16; or make vselect peek 
> through bitcast etc.
> But I think the small performance regression is not a critical requirement as 
> the backward compatibility for the old intrinsics. It may not worth the code 
> complexity.
OK - how come the mask_move_lowering_f16_bf16 refactoring in X86InstrAVX512.td 
didn't fix this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132329

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


[PATCH] D134157: [LoongArch] Add inline asm support for constraints f/l/I/K

2022-09-21 Thread WÁNG Xuěruì via Phabricator via cfe-commits
xen0n added a comment.

I don't know if the clang changes should be split into its own commit (or the 
title of this commit amended to mention `[Clang]` but I don't know if this is 
appropriate), but the rest looks reasonable.




Comment at: llvm/test/CodeGen/LoongArch/inline-asm-constraint-error.ll:2
+; RUN: not llc -mtriple=loongarch32 < %s 2>&1 | FileCheck %s
+; RUN: not llc -mtriple=loongarch64 < %s 2>&1 | FileCheck %s
+

double dashes for `--mtriple`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134157

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


[PATCH] D134362: [clang] Fix interaction between asm labels and inline builtins

2022-09-21 Thread serge via Phabricator via cfe-commits
serge-sans-paille created this revision.
serge-sans-paille added reviewers: RKSimon, aaron.ballman, nickdesaulniers.
Herald added a project: All.
serge-sans-paille requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

One must pick the same name as the one referenced in CodeGenFunction when
generating .inline version of an inline builtin, otherwise they are not
correctly replaced.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134362

Files:
  clang/lib/CodeGen/CGExpr.cpp
  clang/test/CodeGen/asm-label-inline-builtins.c


Index: clang/test/CodeGen/asm-label-inline-builtins.c
===
--- /dev/null
+++ clang/test/CodeGen/asm-label-inline-builtins.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -triple x86_64 -S -emit-llvm -disable-llvm-passes -o - %s | 
FileCheck %s
+//
+// Verifies that clang-generated *.inline carry the same name at call and 
callee
+// site, in spite of asm labels.
+
+typedef struct _IO_FILE FILE;
+extern FILE *stdout;
+extern int vprintf (const char *__restrict __format, __builtin_va_list __arg);
+extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
+  const char *__restrict __format, __builtin_va_list __ap);
+extern int __vprintf_chk (int __flag, const char *__restrict __format,
+ __builtin_va_list __ap);
+
+extern __typeof (vprintf) vprintf __asm ("" "__" "vprintf" "ieee128");
+extern __typeof (__vfprintf_chk) __vfprintf_chk __asm ("" "__" "vfprintf_chk" 
"ieee128");
+extern __typeof (__vprintf_chk) __vprintf_chk __asm ("" "__" "vprintf_chk" 
"ieee128");
+
+// CHECK-NOT: @vprintf(
+// CHECK-NOT: @__vprintf_chk
+// CHECK-NOT: @vprintf.inline(
+
+extern __inline __attribute__ ((__always_inline__)) __attribute__ 
((__gnu_inline__)) __attribute__ ((__artificial__)) int
+vprintf (const char *__restrict __fmt, __builtin_va_list __ap)
+{
+  return __vfprintf_chk (stdout, 2 - 1, __fmt, __ap);
+}
+// CHECK-LABEL: void @test(
+void test(const char *fmt, __builtin_va_list ap) {
+  // CHECK: call i32 @__vfprintf_chkieee128
+  vprintf(fmt, ap);
+}
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -5051,7 +5051,12 @@
   if (auto builtinID = FD->getBuiltinID()) {
 std::string NoBuiltinFD = ("no-builtin-" + FD->getName()).str();
 std::string NoBuiltins = "no-builtins";
-std::string FDInlineName = (FD->getName() + ".inline").str();
+
+std::string FDInlineName;
+if (FD->hasAttr())
+  FDInlineName = FD->getAttr()->getLabel().str();
+else
+  FDInlineName = (FD->getName() + ".inline").str();
 
 bool IsPredefinedLibFunction =
 CGF.getContext().BuiltinInfo.isPredefinedLibFunction(builtinID);


Index: clang/test/CodeGen/asm-label-inline-builtins.c
===
--- /dev/null
+++ clang/test/CodeGen/asm-label-inline-builtins.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -triple x86_64 -S -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
+//
+// Verifies that clang-generated *.inline carry the same name at call and callee
+// site, in spite of asm labels.
+
+typedef struct _IO_FILE FILE;
+extern FILE *stdout;
+extern int vprintf (const char *__restrict __format, __builtin_va_list __arg);
+extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
+  const char *__restrict __format, __builtin_va_list __ap);
+extern int __vprintf_chk (int __flag, const char *__restrict __format,
+ __builtin_va_list __ap);
+
+extern __typeof (vprintf) vprintf __asm ("" "__" "vprintf" "ieee128");
+extern __typeof (__vfprintf_chk) __vfprintf_chk __asm ("" "__" "vfprintf_chk" "ieee128");
+extern __typeof (__vprintf_chk) __vprintf_chk __asm ("" "__" "vprintf_chk" "ieee128");
+
+// CHECK-NOT: @vprintf(
+// CHECK-NOT: @__vprintf_chk
+// CHECK-NOT: @vprintf.inline(
+
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) int
+vprintf (const char *__restrict __fmt, __builtin_va_list __ap)
+{
+  return __vfprintf_chk (stdout, 2 - 1, __fmt, __ap);
+}
+// CHECK-LABEL: void @test(
+void test(const char *fmt, __builtin_va_list ap) {
+  // CHECK: call i32 @__vfprintf_chkieee128
+  vprintf(fmt, ap);
+}
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -5051,7 +5051,12 @@
   if (auto builtinID = FD->getBuiltinID()) {
 std::string NoBuiltinFD = ("no-builtin-" + FD->getName()).str();
 std::string NoBuiltins = "no-builtins";
-std::string FDInlineName = (FD->getName() + ".inline").str();
+
+std::string FDInlineName;
+if (FD->hasAttr())
+  FDInlineName = FD->getAttr()->getLabel().str();
+else
+  FDInlineName = (FD->getName() + ".inline").str();
 
 bool IsPredefi

[PATCH] D132329: [X86][RFC] Using `__bf16` for AVX512_BF16 intrinsics

2022-09-21 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei added inline comments.



Comment at: llvm/test/CodeGen/X86/avx512bf16-intrinsics-upgrade.ll:30
 ; X64-NEXT:kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
-; X64-NEXT:vcvtne2ps2bf16 %zmm1, %zmm0, %zmm0 {%k1} {z} # encoding: 
[0x62,0xf2,0x7f,0xc9,0x72,0xc1]
+; X64-NEXT:vmovdqu16 %zmm0, %zmm0 {%k1} {z} # encoding: 
[0x62,0xf1,0xff,0xc9,0x6f,0xc0]
 ; X64-NEXT:retq # encoding: [0xc3]

RKSimon wrote:
> pengfei wrote:
> > RKSimon wrote:
> > > any chance we can recover the predicated instruction?
> > It's possible, e.g., iterate all users of the intrinsic, bitcast all the 
> > select operands as well; or add patterns for i16; or make vselect peek 
> > through bitcast etc.
> > But I think the small performance regression is not a critical requirement 
> > as the backward compatibility for the old intrinsics. It may not worth the 
> > code complexity.
> OK - how come the mask_move_lowering_f16_bf16 refactoring in 
> X86InstrAVX512.td didn't fix this?
The `mask_move_lowering_f16_bf16` should do nothing with it. I think the 
problem is after AutoUpgrade the IR becomes:
```
  %0 = tail call <32 x bfloat> @llvm.x86.avx512bf16.cvtne2ps2bf16.512(<16 x 
float> %A, <16 x float> %B)
  %1 = bitcast i32 %U to <32 x i1>
  %2 = bitcast <32 x bfloat> %0 to <32 x i16>
  %3 = select <32 x i1> %1, <32 x i16> %2, <32 x i16> zeroinitializer
  %4 = bitcast <32 x i16> %3 to <8 x i64>
  ret <8 x i64> %4
```
And after refactoring of X86InstrAVX512.td, we are able to match
```
  %0 = tail call <32 x bfloat> @llvm.x86.avx512bf16.cvtne2ps2bf16.512(<16 x 
float> %A, <16 x float> %B)
  ... ...
  %2 = select <32 x i1> %1, <32 x bfloat> %0, <32 x bfloat> zeroinitializer
```
So leaving the upgraded IRs failed to match the predicated instruction.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132329

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


[PATCH] D134362: [clang] Fix interaction between asm labels and inline builtins

2022-09-21 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 461893.
serge-sans-paille added a comment.

(rebased on main branch)


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

https://reviews.llvm.org/D134362

Files:
  clang/lib/CodeGen/CGExpr.cpp
  clang/test/CodeGen/asm-label-inline-builtins.c


Index: clang/test/CodeGen/asm-label-inline-builtins.c
===
--- /dev/null
+++ clang/test/CodeGen/asm-label-inline-builtins.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -triple x86_64 -S -emit-llvm -disable-llvm-passes -o - %s | 
FileCheck %s
+//
+// Verifies that clang-generated *.inline carry the same name at call and 
callee
+// site, in spite of asm labels.
+
+typedef struct _IO_FILE FILE;
+extern FILE *stdout;
+extern int vprintf (const char *__restrict __format, __builtin_va_list __arg);
+extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
+  const char *__restrict __format, __builtin_va_list __ap);
+extern int __vprintf_chk (int __flag, const char *__restrict __format,
+ __builtin_va_list __ap);
+
+extern __typeof (vprintf) vprintf __asm ("" "__" "vprintf" "ieee128");
+extern __typeof (__vfprintf_chk) __vfprintf_chk __asm ("" "__" "vfprintf_chk" 
"ieee128");
+extern __typeof (__vprintf_chk) __vprintf_chk __asm ("" "__" "vprintf_chk" 
"ieee128");
+
+// CHECK-NOT: @vprintf(
+// CHECK-NOT: @__vprintf_chk
+// CHECK-NOT: @vprintf.inline(
+
+extern __inline __attribute__ ((__always_inline__)) __attribute__ 
((__gnu_inline__)) __attribute__ ((__artificial__)) int
+vprintf (const char *__restrict __fmt, __builtin_va_list __ap)
+{
+  return __vfprintf_chk (stdout, 2 - 1, __fmt, __ap);
+}
+// CHECK-LABEL: void @test(
+void test(const char *fmt, __builtin_va_list ap) {
+  // CHECK: call i32 @__vfprintf_chkieee128
+  vprintf(fmt, ap);
+}
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -5051,7 +5051,12 @@
   if (auto builtinID = FD->getBuiltinID()) {
 std::string NoBuiltinFD = ("no-builtin-" + FD->getName()).str();
 std::string NoBuiltins = "no-builtins";
-std::string FDInlineName = (FD->getName() + ".inline").str();
+
+std::string FDInlineName;
+if (FD->hasAttr())
+  FDInlineName = FD->getAttr()->getLabel().str();
+else
+  FDInlineName = (FD->getName() + ".inline").str();
 
 bool IsPredefinedLibFunction =
 CGF.getContext().BuiltinInfo.isPredefinedLibFunction(builtinID);


Index: clang/test/CodeGen/asm-label-inline-builtins.c
===
--- /dev/null
+++ clang/test/CodeGen/asm-label-inline-builtins.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -triple x86_64 -S -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
+//
+// Verifies that clang-generated *.inline carry the same name at call and callee
+// site, in spite of asm labels.
+
+typedef struct _IO_FILE FILE;
+extern FILE *stdout;
+extern int vprintf (const char *__restrict __format, __builtin_va_list __arg);
+extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
+  const char *__restrict __format, __builtin_va_list __ap);
+extern int __vprintf_chk (int __flag, const char *__restrict __format,
+ __builtin_va_list __ap);
+
+extern __typeof (vprintf) vprintf __asm ("" "__" "vprintf" "ieee128");
+extern __typeof (__vfprintf_chk) __vfprintf_chk __asm ("" "__" "vfprintf_chk" "ieee128");
+extern __typeof (__vprintf_chk) __vprintf_chk __asm ("" "__" "vprintf_chk" "ieee128");
+
+// CHECK-NOT: @vprintf(
+// CHECK-NOT: @__vprintf_chk
+// CHECK-NOT: @vprintf.inline(
+
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) int
+vprintf (const char *__restrict __fmt, __builtin_va_list __ap)
+{
+  return __vfprintf_chk (stdout, 2 - 1, __fmt, __ap);
+}
+// CHECK-LABEL: void @test(
+void test(const char *fmt, __builtin_va_list ap) {
+  // CHECK: call i32 @__vfprintf_chkieee128
+  vprintf(fmt, ap);
+}
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -5051,7 +5051,12 @@
   if (auto builtinID = FD->getBuiltinID()) {
 std::string NoBuiltinFD = ("no-builtin-" + FD->getName()).str();
 std::string NoBuiltins = "no-builtins";
-std::string FDInlineName = (FD->getName() + ".inline").str();
+
+std::string FDInlineName;
+if (FD->hasAttr())
+  FDInlineName = FD->getAttr()->getLabel().str();
+else
+  FDInlineName = (FD->getName() + ".inline").str();
 
 bool IsPredefinedLibFunction =
 CGF.getContext().BuiltinInfo.isPredefinedLibFunction(builtinID);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D131424: Remove the unused/undefined _cmd parameter to objc_direct methods.

2022-09-21 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak accepted this revision.
ahatanak added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D131424

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


[PATCH] D134355: [AMDGPU] Emit module flag for all code object versions

2022-09-21 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked an inline comment as done.
yaxunl added inline comments.



Comment at: clang/lib/CodeGen/CodeGenModule.cpp:590-591
 // times 100.
-// ToDo: Enable module flag for all code object version when ROCm device
-// library is ready.
-if (getTarget().getTargetOpts().CodeObjectVersion == TargetOptions::COV_5) 
{
+if (getTarget().getTargetOpts().CodeObjectVersion !=
+TargetOptions::COV_None) {
   getModule().addModuleFlag(llvm::Module::Error,

arsenm wrote:
> What is the flag default value? What does it mean to target none?
> What is the flag default value? What does it mean to target none?

Default value is COV_V4. COV_None is for device library, which needs to link 
with bitcode containing any code object version. COV_None is only specified 
with a clang -cc1 option which is used when compiling device library.


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

https://reviews.llvm.org/D134355

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


[PATCH] D134352: [AArch64] Add Neoverse V2 CPU support

2022-09-21 Thread David Sherwood via Phabricator via cfe-commits
david-arm updated this revision to Diff 461898.
david-arm added a comment.

- Changed lists of tuning features.
- Removed redundant arch features from list.
- Combined neoverse-v2 and neoverse-n2 cases together in AArch64Subtarget.


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

https://reviews.llvm.org/D134352

Files:
  clang/test/Driver/aarch64-mcpu.c
  clang/test/Misc/target-invalid-cpu-note.c
  llvm/include/llvm/Support/AArch64TargetParser.def
  llvm/lib/Support/Host.cpp
  llvm/lib/Target/AArch64/AArch64.td
  llvm/lib/Target/AArch64/AArch64Subtarget.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/test/CodeGen/AArch64/cpus.ll
  llvm/unittests/Support/TargetParserTest.cpp

Index: llvm/unittests/Support/TargetParserTest.cpp
===
--- llvm/unittests/Support/TargetParserTest.cpp
+++ llvm/unittests/Support/TargetParserTest.cpp
@@ -1026,6 +1026,16 @@
 AArch64::AEK_PROFILE | AArch64::AEK_RAND |
 AArch64::AEK_FP16FML | AArch64::AEK_I8MM,
 "8.4-A"),
+ARMCPUTestParams(
+"neoverse-v2", "armv9-a", "neon-fp-armv8",
+AArch64::AEK_RAS | AArch64::AEK_SVE | AArch64::AEK_SSBS |
+AArch64::AEK_RCPC | AArch64::AEK_CRC | AArch64::AEK_FP |
+AArch64::AEK_SIMD | AArch64::AEK_RAS | AArch64::AEK_LSE |
+AArch64::AEK_RDM | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD |
+AArch64::AEK_FP16 | AArch64::AEK_BF16 | AArch64::AEK_SVE2 |
+AArch64::AEK_PROFILE | AArch64::AEK_FP16FML |
+AArch64::AEK_I8MM,
+"9-A"),
 ARMCPUTestParams("cortex-r82", "armv8-r", "crypto-neon-fp-armv8",
  AArch64::AEK_CRC | AArch64::AEK_RDM |
  AArch64::AEK_SSBS | AArch64::AEK_DOTPROD |
@@ -1257,7 +1267,7 @@
  AArch64::AEK_LSE | AArch64::AEK_RDM,
  "8.2-A")));
 
-static constexpr unsigned NumAArch64CPUArchs = 54;
+static constexpr unsigned NumAArch64CPUArchs = 55;
 
 TEST(TargetParserTest, testAArch64CPUArchList) {
   SmallVector List;
Index: llvm/test/CodeGen/AArch64/cpus.ll
===
--- llvm/test/CodeGen/AArch64/cpus.ll
+++ llvm/test/CodeGen/AArch64/cpus.ll
@@ -23,6 +23,7 @@
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=neoverse-n2 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=neoverse-512tvb 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=neoverse-v1 2>&1 | FileCheck %s
+; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=neoverse-v2 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=exynos-m3 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=exynos-m4 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=exynos-m5 2>&1 | FileCheck %s
Index: llvm/lib/Target/AArch64/AArch64Subtarget.h
===
--- llvm/lib/Target/AArch64/AArch64Subtarget.h
+++ llvm/lib/Target/AArch64/AArch64Subtarget.h
@@ -74,6 +74,7 @@
 NeoverseN2,
 Neoverse512TVB,
 NeoverseV1,
+NeoverseV2,
 Saphira,
 ThunderX2T99,
 ThunderX,
Index: llvm/lib/Target/AArch64/AArch64Subtarget.cpp
===
--- llvm/lib/Target/AArch64/AArch64Subtarget.cpp
+++ llvm/lib/Target/AArch64/AArch64Subtarget.cpp
@@ -199,6 +199,7 @@
 MaxBytesForLoopAlignment = 16;
 break;
   case NeoverseN2:
+  case NeoverseV2:
 PrefFunctionLogAlignment = 4;
 PrefLoopLogAlignment = 5;
 MaxBytesForLoopAlignment = 16;
Index: llvm/lib/Target/AArch64/AArch64.td
===
--- llvm/lib/Target/AArch64/AArch64.td
+++ llvm/lib/Target/AArch64/AArch64.td
@@ -936,6 +936,12 @@
   FeatureLSLFast,
   FeaturePostRAScheduler]>;
 
+def TuneNeoverseV2 : SubtargetFeature<"neoversev2", "ARMProcFamily", "NeoverseV2",
+  "Neoverse V2 ARM processors", [
+  FeatureFuseAES,
+  FeatureLSLFast,
+  FeaturePostRAScheduler]>;
+
 def TuneSaphira  : SubtargetFeature<"saphira", "ARMProcFamily", "Saphira",
"Qualcomm Saphira processors", [
FeatureCustomCheapAsMoveHandling,
@@ -1100,6 +1106,10 @@
FeatureFullFP16, FeatureMatMulInt8, FeatureNEON,
FeaturePerfMon, FeatureRandGen, FeatureSPE,
FeatureSSBS, FeatureSVE];
+  list NeoverseV2 = [HasV9_0aOps, FeatureBF16, FeatureSPE,
+   

[PATCH] D134352: [AArch64] Add Neoverse V2 CPU support

2022-09-21 Thread David Sherwood via Phabricator via cfe-commits
david-arm marked 3 inline comments as done.
david-arm added a comment.

Thanks for the quick review @dmgreen!


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

https://reviews.llvm.org/D134352

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


[PATCH] D115169: Create a generic ABI document for _BitInt

2022-09-21 Thread Jens Gustedt via Phabricator via cfe-commits
gustedt added a comment.

It seems that this has already shipped on some platforms. Since this basically 
binds others to use the same ABI, it would perhaps be nice if the document 
could have a table that lists `MaxFundamentalWidth` and `chunk_t`. Also 
discussing consequences for `va_arg` functions such as `printf` would be nice.
Thanks!`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115169

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


[clang] bc14ed7 - Add clang_CXXMethod_isDeleted function

2022-09-21 Thread Aaron Ballman via cfe-commits

Author: Anders Langlands
Date: 2022-09-21T11:12:48-04:00
New Revision: bc14ed7de0f1f038c500b5f1d6c7a86a4a2d4527

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

LOG: Add clang_CXXMethod_isDeleted function

Adds a function to check if a method has been deleted by copy-pasting
the existing implementation of clang_CXXMethod_isDefaulted and changing
it to call CXXMethod::isDeleted() instead.

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

Added: 
clang/test/Index/deletion.cpp

Modified: 
clang/bindings/python/clang/cindex.py
clang/docs/ReleaseNotes.rst
clang/include/clang-c/Index.h
clang/test/Index/availability.cpp
clang/tools/c-index-test/c-index-test.c
clang/tools/libclang/CIndex.cpp
clang/tools/libclang/libclang.map

Removed: 




diff  --git a/clang/bindings/python/clang/cindex.py 
b/clang/bindings/python/clang/cindex.py
index 89063dd40155b..a8fe6e3e7ed56 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -1473,6 +1473,12 @@ def is_default_method(self):
 """
 return conf.lib.clang_CXXMethod_isDefaulted(self)
 
+def is_deleted_method(self):
+"""Returns True if the cursor refers to a C++ member function or member
+function template that is declared '= delete'.
+"""
+return conf.lib.clang_CXXMethod_isDeleted(self)
+
 def is_mutable_field(self):
 """Returns True if the cursor refers to a C++ field that is declared
 'mutable'.
@@ -3426,6 +3432,10 @@ def cursor(self):
[Cursor],
bool),
 
+  ("clang_CXXMethod_isDeleted",
+   [Cursor],
+   bool),
+
   ("clang_CXXMethod_isPureVirtual",
[Cursor],
bool),

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 372661814ab9a..258884cd2ba34 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -398,6 +398,8 @@ libclang
   the behavior of ``QualType::getUnqualifiedType`` for ``CXType``.
 - Introduced the new function ``clang_getNonReferenceType``, which mimics
   the behavior of ``QualType::getNonReferenceType`` for ``CXType``.
+- Introduced the new function ``clang_CXXMethod_isDeleted``, which queries
+  whether the method is declared ``= delete``.
 
 Static Analyzer
 ---

diff  --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index c0dbad869114b..a9810aa4cf9d0 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -4924,6 +4924,11 @@ CINDEX_LINKAGE unsigned 
clang_CXXField_isMutable(CXCursor C);
  */
 CINDEX_LINKAGE unsigned clang_CXXMethod_isDefaulted(CXCursor C);
 
+/**
+ * Determine if a C++ method is declared '= delete'.
+ */
+CINDEX_LINKAGE unsigned clang_CXXMethod_isDeleted(CXCursor C);
+
 /**
  * Determine if a C++ member function or member function template is
  * pure virtual.

diff  --git a/clang/test/Index/availability.cpp 
b/clang/test/Index/availability.cpp
index d8cd3bfb65414..05963b09ad478 100644
--- a/clang/test/Index/availability.cpp
+++ b/clang/test/Index/availability.cpp
@@ -9,5 +9,5 @@ struct Foo {
 // RUN: c-index-test -test-print-type --std=c++11 %s | FileCheck %s
 // CHECK: FunctionDecl=foo:1:6 (unavailable) [type=void ()] 
[typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0]
 // CHECK: StructDecl=Foo:3:8 (Definition) [type=Foo] [typekind=Record] 
[isPOD=1]
-// CHECK: CXXMethod=foo:4:7 (unavailable) [type=int (){{.*}}] 
[typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0]
-// CHECK: CXXConstructor=Foo:5:3 (unavailable) (default constructor) 
[type=void (){{.*}}] [typekind=FunctionProto] [resulttype=void] 
[resulttypekind=Void] [isPOD=0]
+// CHECK: CXXMethod=foo:4:7 (unavailable) (deleted) [type=int (){{.*}}] 
[typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0]
+// CHECK: CXXConstructor=Foo:5:3 (unavailable) (default constructor) (deleted) 
[type=void (){{.*}}] [typekind=FunctionProto] [resulttype=void] 
[resulttypekind=Void] [isPOD=0]

diff  --git a/clang/test/Index/deletion.cpp b/clang/test/Index/deletion.cpp
new file mode 100644
index 0..aa5e869a86288
--- /dev/null
+++ b/clang/test/Index/deletion.cpp
@@ -0,0 +1,14 @@
+struct Foo {
+  int foo() = delete;
+  int bar();
+  Foo() = delete;
+  Foo(int);
+};
+
+
+// RUN: c-index-test -test-print-type --std=c++11 %s | FileCheck %s
+// CHECK: StructDecl=Foo:1:8 (Definition) [type=Foo] [typekind=Record] 
[isPOD=1]
+// CHECK: CXXMethod=foo:2:7 (unavailable) (deleted) [type=int (){{.*}}] 
[typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0]
+// CHECK: CXXMethod=bar:3:7 [type=int (){{.*}}] [typekind=FunctionProto] 
[resulttype=int] [resulttypekind=Int] [isPOD=0]
+// CHECK: CXXConstructor=Foo:4:3 (unavailable) (def

[PATCH] D133924: add clang_CXXMethod_isDeleted function

2022-09-21 Thread Aaron Ballman via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbc14ed7de0f1: Add clang_CXXMethod_isDeleted function 
(authored by anderslanglands, committed by aaron.ballman).

Changed prior to commit:
  https://reviews.llvm.org/D133924?vs=460865&id=461900#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133924

Files:
  clang/bindings/python/clang/cindex.py
  clang/docs/ReleaseNotes.rst
  clang/include/clang-c/Index.h
  clang/test/Index/availability.cpp
  clang/test/Index/deletion.cpp
  clang/tools/c-index-test/c-index-test.c
  clang/tools/libclang/CIndex.cpp
  clang/tools/libclang/libclang.map

Index: clang/tools/libclang/libclang.map
===
--- clang/tools/libclang/libclang.map
+++ clang/tools/libclang/libclang.map
@@ -409,6 +409,7 @@
   global:
 clang_getUnqualifiedType;
 clang_getNonReferenceType;
+clang_CXXMethod_isDeleted;
 };
 
 # Example of how to add a new symbol version entry.  If you do add a new symbol
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -8861,6 +8861,16 @@
   return (Method && Method->isDefaulted()) ? 1 : 0;
 }
 
+unsigned clang_CXXMethod_isDeleted(CXCursor C) {
+  if (!clang_isDeclaration(C.kind))
+return 0;
+
+  const Decl *D = cxcursor::getCursorDecl(C);
+  const CXXMethodDecl *Method =
+  D ? dyn_cast_if_present(D->getAsFunction()) : nullptr;
+  return (Method && Method->isDeleted()) ? 1 : 0;
+}
+
 unsigned clang_CXXMethod_isStatic(CXCursor C) {
   if (!clang_isDeclaration(C.kind))
 return 0;
Index: clang/tools/c-index-test/c-index-test.c
===
--- clang/tools/c-index-test/c-index-test.c
+++ clang/tools/c-index-test/c-index-test.c
@@ -900,6 +900,8 @@
   printf(" (mutable)");
 if (clang_CXXMethod_isDefaulted(Cursor))
   printf(" (defaulted)");
+if (clang_CXXMethod_isDeleted(Cursor))
+  printf(" (deleted)");
 if (clang_CXXMethod_isStatic(Cursor))
   printf(" (static)");
 if (clang_CXXMethod_isVirtual(Cursor))
Index: clang/test/Index/deletion.cpp
===
--- /dev/null
+++ clang/test/Index/deletion.cpp
@@ -0,0 +1,14 @@
+struct Foo {
+  int foo() = delete;
+  int bar();
+  Foo() = delete;
+  Foo(int);
+};
+
+
+// RUN: c-index-test -test-print-type --std=c++11 %s | FileCheck %s
+// CHECK: StructDecl=Foo:1:8 (Definition) [type=Foo] [typekind=Record] [isPOD=1]
+// CHECK: CXXMethod=foo:2:7 (unavailable) (deleted) [type=int (){{.*}}] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0]
+// CHECK: CXXMethod=bar:3:7 [type=int (){{.*}}] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0]
+// CHECK: CXXConstructor=Foo:4:3 (unavailable) (default constructor) (deleted) [type=void (){{.*}}] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0]
+// CHECK: CXXConstructor=Foo:5:3 (converting constructor) [type=void (int){{.*}}] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [args= [int] [Int]] [isPOD=0]
Index: clang/test/Index/availability.cpp
===
--- clang/test/Index/availability.cpp
+++ clang/test/Index/availability.cpp
@@ -9,5 +9,5 @@
 // RUN: c-index-test -test-print-type --std=c++11 %s | FileCheck %s
 // CHECK: FunctionDecl=foo:1:6 (unavailable) [type=void ()] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0]
 // CHECK: StructDecl=Foo:3:8 (Definition) [type=Foo] [typekind=Record] [isPOD=1]
-// CHECK: CXXMethod=foo:4:7 (unavailable) [type=int (){{.*}}] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0]
-// CHECK: CXXConstructor=Foo:5:3 (unavailable) (default constructor) [type=void (){{.*}}] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0]
+// CHECK: CXXMethod=foo:4:7 (unavailable) (deleted) [type=int (){{.*}}] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0]
+// CHECK: CXXConstructor=Foo:5:3 (unavailable) (default constructor) (deleted) [type=void (){{.*}}] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0]
Index: clang/include/clang-c/Index.h
===
--- clang/include/clang-c/Index.h
+++ clang/include/clang-c/Index.h
@@ -4924,6 +4924,11 @@
  */
 CINDEX_LINKAGE unsigned clang_CXXMethod_isDefaulted(CXCursor C);
 
+/**
+ * Determine if a C++ method is declared '= delete'.
+ */
+CINDEX_LINKAGE unsigned clang_CXXMethod_isDeleted(CXCursor C);
+
 /**
  * Determine if a C++ member function or member function template is
  * pure virtual.
Index: clang/docs/ReleaseNotes.rst
==

[PATCH] D129755: Thread safety analysis: Support copy-elided production of scoped capabilities through arbitrary calls

2022-09-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D129755#3796799 , @aaronpuchert 
wrote:

> In D129755#3779997 , @aaron.ballman 
> wrote:
>
>> Please be sure to add a release note for the changes!
>
> Any opinion as to what the release note might say? I'm asking since we 
> dropped the documentation changes.

No strong opinion, but `Technically this could break existing code, but the 
current handling seems unexpected enough to justify this change.` suggests we 
should be mentioning to users what we changed and what code could theoretically 
break.

> Perhaps I should add them back in, but without function bodies (thus 
> eliminating the need to add `NO_THREAD_SAFETY_ANALYSIS`)? Something like this:
>
>   // Same as constructors, but without tag types. (Requires C++17 copy 
> elision.)
>   static MutexLocker Lock(Mutex *mu) ACQUIRE(mu);
>   static MutexLocker Adopt(Mutex *mu) REQUIRES(mu);
>   static MutexLocker ReaderLock(Mutex *mu) ACQUIRE_SHARED(mu);
>   static MutexLocker AdoptReaderLock(Mutex *mu) REQUIRES_SHARED(mu);
>   static MutexLocker DeferLock(Mutex *mu) EXCLUDES(mu);
>
> Then I could write in the note that this is now possible, and annotations on 
> move constructors are without effect.

I'd be okay with that!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129755

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


[clang] bc97751 - [NFC] Add GitHub issues to HLSL FIXME comments

2022-09-21 Thread Chris Bieneman via cfe-commits

Author: Chris Bieneman
Date: 2022-09-21T10:31:25-05:00
New Revision: bc97751a236e619dc33f81e9fc9b3fe6bd0ba7b6

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

LOG: [NFC] Add GitHub issues to HLSL FIXME comments

In order to make this easier to track I've filed issues for each of the
HLSL FIXME comments that I can find. I may have missed some, but I want
this to be the new default mode.

Added: 


Modified: 
clang/lib/CodeGen/CGHLSLRuntime.cpp
clang/lib/Driver/ToolChains/HLSL.cpp
clang/lib/Sema/SemaDecl.cpp
clang/test/CodeGenHLSL/validator_version.hlsl

Removed: 




diff  --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp 
b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 8e0088784e548..c61a65813aea5 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -143,6 +143,7 @@ void CGHLSLRuntime::emitEntryFunction(const FunctionDecl 
*FD,
   IRBuilder<> B(BB);
   llvm::SmallVector Args;
   // FIXME: support struct parameters where semantics are on members.
+  // See: https://github.com/llvm/llvm-project/issues/57874
   for (const auto *Param : FD->parameters()) {
 Args.push_back(emitInputSemantic(B, *Param));
   }
@@ -150,6 +151,7 @@ void CGHLSLRuntime::emitEntryFunction(const FunctionDecl 
*FD,
   CallInst *CI = B.CreateCall(FunctionCallee(Fn), Args);
   (void)CI;
   // FIXME: Handle codegen for return type semantics.
+  // See: https://github.com/llvm/llvm-project/issues/57875
   B.CreateRetVoid();
 }
 

diff  --git a/clang/lib/Driver/ToolChains/HLSL.cpp 
b/clang/lib/Driver/ToolChains/HLSL.cpp
index a80fea2e3efe2..69a7820946246 100644
--- a/clang/lib/Driver/ToolChains/HLSL.cpp
+++ b/clang/lib/Driver/ToolChains/HLSL.cpp
@@ -209,5 +209,6 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, 
StringRef BoundArch,
   }
   // FIXME: add validation for enable_16bit_types should be after HLSL 2018 and
   // shader model 6.2.
+  // See: https://github.com/llvm/llvm-project/issues/57876
   return DAL;
 }

diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 0f567d91dc81e..865388ccd5fa8 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -11896,6 +11896,7 @@ void Sema::CheckHLSLEntryPoint(FunctionDecl *FD) {
   for (const auto *Param : FD->parameters()) {
 if (!Param->hasAttr()) {
   // FIXME: Handle struct parameters where annotations are on struct 
fields.
+  // See: https://github.com/llvm/llvm-project/issues/57875
   Diag(FD->getLocation(), diag::err_hlsl_missing_semantic_annotation);
   Diag(Param->getLocation(), diag::note_previous_decl) << Param;
   FD->setInvalidDecl();

diff  --git a/clang/test/CodeGenHLSL/validator_version.hlsl 
b/clang/test/CodeGenHLSL/validator_version.hlsl
index 0d2cbb96dbe48..a3fc4fa1b63c4 100644
--- a/clang/test/CodeGenHLSL/validator_version.hlsl
+++ b/clang/test/CodeGenHLSL/validator_version.hlsl
@@ -1,6 +1,7 @@
 // RUN: %clang -cc1 -S -triple dxil-pc-shadermodel6.3-library -S -emit-llvm 
-xhlsl -validator-version 1.1 -o - %s | FileCheck %s
 
 // FIXME:The following line should work once SPIR-V support for HLSL is added.
+// See: https://github.com/llvm/llvm-project/issues/57877
 // DISABLED: %clang -cc1 -S -triple spirv32 -S -emit-llvm -xhlsl 
-validator-version 1.1 -o - %s | FileCheck %s --check-prefix=NOT_DXIL
 
 // CHECK:!dx.valver = !{![[valver:[0-9]+]]}



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


[PATCH] D132513: [lit] Implement DEFINE and REDEFINE directives

2022-09-21 Thread Joel E. Denny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG28412d1800e3: [lit] Implement DEFINE and REDEFINE directives 
(authored by jdenny).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132513

Files:
  clang/test/CodeGen/attr-noundef.cpp
  clang/test/CodeGen/indirect-noundef.cpp
  clang/test/Preprocessor/init.c
  llvm/docs/CommandGuide/lit.rst
  llvm/docs/TestingGuide.rst
  llvm/test/tools/llvm-cvtres/help.test
  llvm/test/tools/yaml2obj/ELF/custom-null-section.yaml
  llvm/utils/lit/lit/TestRunner.py
  llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/before-name.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/between-name-equals.txt
  llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-empty.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-with-dot.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-with-equals.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-with-newline.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-with-number.txt
  llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-with-ws.txt
  llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/empty.txt
  llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/no-equals.txt
  llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/no-name.txt
  llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/ws-only.txt
  llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/empty.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/end-in-double-backslash.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-define-bad-redefine.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-define-continuation.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-define-redefine.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-define-run.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-define.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-redefine-bad-define.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-redefine-continuation.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-redefine-define.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-redefine-run.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-redefine.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-run-define.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-run-redefine.txt
  llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/ws-only.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-already-by-config.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-already-by-test.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-inside-pattern.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-multiple-exact.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-multiple-once-exact.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-prefixes-pattern.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-suffixes-pattern.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/redefine-inside-pattern.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/redefine-multiple-exact.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/redefine-multiple-once-exact.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/redefine-none.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/redefine-prefixes-pattern.txt
  
llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/redefine-suffixes-pattern.txt
  llvm/utils/lit/tests/Inputs/shtest-define/errors/location-range.txt
  llvm/utils/lit/tests/Inputs/shtest-define/errors/no-run.txt
  llvm/utils/lit/tests/Inputs/shtest-define/examples/param-subst.txt
  llvm/utils/lit/tests/Inputs/shtest-define/expansion-order.txt
  llvm/utils/lit/tests/Inputs/shtest-define/line-number-substitutions.txt
  llvm/utils/lit/tests/Inputs/shtest-define/lit.cfg
  llvm/utils/lit/tests/Inputs/shtest-define/name-chars.txt
  llvm/utils/lit/tests/Inputs/shtest-define/recursiveExpansionLimit.txt
  llvm/utils/lit/tests/Inputs/shtest-define/shared-substs-0.txt
  llvm/utils/lit/tests/Inputs/shtest-define/shared-substs-1.txt
  llvm/utils/lit/tests/Inputs/shtest-define/value-equals.tx

[clang] 28412d1 - [lit] Implement DEFINE and REDEFINE directives

2022-09-21 Thread Joel E. Denny via cfe-commits

Author: Joel E. Denny
Date: 2022-09-21T11:32:05-04:00
New Revision: 28412d1800e391c5ba8e7607bb15c74b106d581b

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

LOG: [lit] Implement DEFINE and REDEFINE directives

These directives define per-test lit substitutions.  The concept was
discussed at
.

For example, the following directives can be inserted into a test file
to define `%{cflags}` and `%{fcflags}` substitutions with empty
initial values, which serve as the parameters of another newly defined
`%{check}` substitution:

```
// DEFINE: %{cflags} =
// DEFINE: %{fcflags} =

// DEFINE: %{check} = %clang_cc1 %{cflags} -emit-llvm -o - %s | \
// DEFINE:FileCheck %{fcflags} %s
```

The following directives then redefine the parameters before each use
of `%{check}`:

```
// REDEFINE: %{cflags} = -foo
// REDEFINE: %{fcflags} = -check-prefix=FOO
// RUN: %{check}

// REDEFINE: %{cflags} = -bar
// REDEFINE: %{fcflags} = -check-prefix=BAR
// RUN: %{check}
```

Of course, `%{check}` would typically be more elaborate, increasing
the benefit of the reuse.

One issue is that the strings `DEFINE:` and `REDEFINE:` already appear
in 5 tests.  This patch adjusts those tests not to use those strings.
Our prediction is that, in the vast majority of cases, if a test
author mistakenly uses one of those strings for another purpose, the
text appearing after the string will not happen to have the syntax
required for these directives.  Thus, the test author will discover
the mistake immediately when lit reports the syntax error.

This patch also expands the documentation on existing lit substitution
behavior.

Reviewed By: jhenderson, MaskRay, awarzynski

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

Added: 
llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/before-name.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/between-name-equals.txt
llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-empty.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-with-dot.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-with-equals.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-with-newline.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-with-number.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/braces-with-ws.txt
llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/empty.txt
llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/no-equals.txt
llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/no-name.txt
llvm/utils/lit/tests/Inputs/shtest-define/errors/assignment/ws-only.txt
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/empty.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/end-in-double-backslash.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-define-bad-redefine.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-define-continuation.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-define-redefine.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-define-run.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-define.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-redefine-bad-define.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-redefine-continuation.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-redefine-define.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-redefine-run.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-redefine.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-run-define.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/unterminated-run-redefine.txt
llvm/utils/lit/tests/Inputs/shtest-define/errors/continuation/ws-only.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-already-by-config.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-already-by-test.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-inside-pattern.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-multiple-exact.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-multiple-once-exact.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-check/define-prefixes-pattern.txt

llvm/utils/lit/tests/Inputs/shtest-define/errors/defined-c

[PATCH] D134326: [HLSL] Allow SV_GroupIndex for lib profile.

2022-09-21 Thread Chris Bieneman via Phabricator via cfe-commits
beanz added inline comments.



Comment at: clang/lib/Sema/SemaDeclAttr.cpp:6901
+// FIXME: it is OK for a compute shader entry and pixel shader entry live 
in
+// same HLSL file.
 uint32_t Pipeline =

I think the underlying issue here is that some attributes should only be 
validated on entry points that are being compiled as entry points in the 
current compilation action. Please file a GitHub issue for this and put the 
issue URL in the comment here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134326

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


  1   2   3   >