[PATCH] D111400: [Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr

2022-03-19 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments.



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:1904-1906
+if (!SemaRef.LangOpts.CPlusPlus2b &&
+CheckLiteralType(SemaRef, Kind, VD->getLocation(), VD->getType(),
  diag::err_constexpr_local_var_non_literal_type,

hubert.reinterpretcast wrote:
> This seems to unconditionally error in pre-C++2b modes. For consistency, this 
> should be a `-Wc++2b-extensions` warning.
We agreed not have this an extension in earlier modes because a valid c++20 
program can sfinea on that. Is it not a direction you agree with anymore>



Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3-2b.cpp:38
+  if (!b)
+NonLiteral n;
+}

hubert.reinterpretcast wrote:
> For consistency, this should warn (under `-Wpre-c++2b-compat`).
I though we decided *not* to do that


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400

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


[PATCH] D111400: [Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr

2022-03-19 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 416672.
cor3ntin marked 2 inline comments as done.
cor3ntin added a comment.

- Test dcl.constexpr/dtor.cpp in both C++20 and C++23 modes
- Make sure j/k are actually called in constant-expression-cxx2b.cpp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticASTKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/AST/ExprConstant.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/dtor.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3-2b.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
  clang/test/Lexer/cxx-features.cpp
  clang/test/SemaCXX/constant-expression-cxx14.cpp
  clang/test/SemaCXX/constant-expression-cxx2b.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -1361,7 +1361,7 @@
 
   Non-literal variables (and labels and gotos) in constexpr functions
   https://wg21.link/P2242R3";>P2242R3
-  No
+  Clang 15
 
 
   Character encoding of diagnostic text
Index: clang/test/SemaCXX/constant-expression-cxx2b.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/constant-expression-cxx2b.cpp
@@ -0,0 +1,154 @@
+// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify %s -fcxx-exceptions -triple=x86_64-linux-gnu -Wpre-c++2b-compat
+
+constexpr int f(int n) {  // expected-error {{constexpr function never produces a constant expression}}
+  static const int m = n; // expected-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}} \
+  // expected-note {{control flows through the declaration of a static variable}}
+  return m;
+}
+constexpr int g(int n) {// expected-error {{constexpr function never produces a constant expression}}
+  thread_local const int m = n; // expected-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}} \
+// expected-note {{control flows through the declaration of a thread_local variable}}
+  return m;
+}
+
+constexpr int h(int n) {  // expected-error {{constexpr function never produces a constant expression}}
+  static const int m = n; // expected-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}} \
+  // expected-note {{control flows through the declaration of a static variable}}
+  return &m - &m;
+}
+constexpr int i(int n) {// expected-error {{constexpr function never produces a constant expression}}
+  thread_local const int m = n; // expected-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}} \
+// expected-note {{control flows through the declaration of a thread_local variable}}
+  return &m - &m;
+}
+
+constexpr int j(int n) {
+  if (!n)
+return 0;
+  static const int m = n; // expected-warning{{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
+  return m;
+}
+constexpr int j0 = j(0);
+
+constexpr int k(int n) {
+  if (!n)
+return 0;
+  thread_local const int m = n; // expected-warning{{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
+
+  return m;
+}
+constexpr int k0 = k(0);
+
+constexpr int j_evaluated(int n) {
+  if (!n)
+return 0;
+  static const int m = n; // expected-warning{{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}} \
+  // expected-note {{control flows through the declaration of a static variable}}
+  return m;
+}
+
+constexpr int je = j_evaluated(1); // expected-error {{constexpr variable 'je' must be initialized by a constant expression}}  \
+   // expected-note {{in call}}
+
+constexpr int k_evaluated(int n) {
+  if (!n)
+return 0;
+  thread_local const int m = n; // expected-warning{{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}} \
+// expected-note {{control flows through the declaration of a thread_local variable}}
+
+  return m;
+}
+
+constexpr int ke = k_evaluated(1); // expected-error {{constexpr variable 'ke' must be initialized by a constant expression}} \
+   // expected-note {{in call}}
+
+constexpr int static_constexpr() { // expected-error {{constexpr function 

[PATCH] D111400: [Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr

2022-03-19 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin marked 2 inline comments as done.
cor3ntin added inline comments.



Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/dtor.cpp:1
-// RUN: %clang_cc1 -std=c++2a -verify %s
 

hubert.reinterpretcast wrote:
> aaron.ballman wrote:
> > I think we want to keep testing the C++20 behavior and want new tests for 
> > the C++2b behavior. We still need to be sure we're correct in C++20 mode 
> > given the differences (even in extensions because `-pedantic-errors` is a 
> > thing). So I'd recommend splitting this test into two or using an 
> > additional RUN line.
> @cor3ntin, I don't think Aaron's comment has been addressed. I think keeping 
> `-std=c++2a` and adding `-Wc++2b-extensions` would be appropriate. I know 
> there are tests elsewhere that also focus on paragraph 3, but this test has 
> coverage specifically for destructors.
Yes, I missed that, thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400

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


[PATCH] D111400: [Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr

2022-03-19 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin marked an inline comment as done.
cor3ntin added inline comments.



Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp:1-3
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu 
-std=c++11 -Werror=c++14-extensions -Werror=c++20-extensions 
-Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu 
-std=c++14 -DCXX14 -Werror=c++20-extensions -Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu 
-std=c++20 -DCXX14 -DCXX20 -Werror=c++2b-extensions %s

hubert.reinterpretcast wrote:
> The use `-Werror` hides potential issues where the error is categorically 
> produced (instead of under the warning group).
> 
> Considering that there is a relevant design consistency issue of exactly that 
> sort right now that this test could have highlighted (but didn't), a change 
> to stop using `-Werror` may be prudent.
This seems inconsistent with how that file is currently structured though


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400

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


[PATCH] D122064: [clang-format][docs] Fix incorrect 'clang-format 11' option markers

2022-03-19 Thread Krystian Kuzniarek via Phabricator via cfe-commits
kuzkry created this revision.
kuzkry added reviewers: MyDeveloperDay, HazardyKnusperkeks.
kuzkry added a project: clang-format.
Herald added a project: All.
kuzkry requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Introduced by 23a5090c6 
, some 
style option markers indicated
'clang-format 11', though their respective options were available in
earlier releases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122064

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h

Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -462,7 +462,7 @@
 
   /// Dependent on the value, ``while (true) { continue; }`` can be put on a
   /// single line.
-  /// \version 11
+  /// \version 3.5
   ShortBlockStyle AllowShortBlocksOnASingleLine;
 
   /// If ``true``, short case labels will be contracted to a single line.
@@ -1926,7 +1926,7 @@
 
   /// \brief Analyze the formatted file for the most used line ending (``\r\n``
   /// or ``\n``). ``UseCRLF`` is only used as a fallback if none can be derived.
-  /// \version 11
+  /// \version 10
   bool DeriveLineEnding;
 
   /// If ``true``, analyze the formatted file for the most common
@@ -3574,7 +3574,7 @@
   ///void f() { }   vs.   void f() {}
   ///while (true) { } while (true) {}
   /// \endcode
-  /// \version 11
+  /// \version 10
   bool SpaceInEmptyBlock;
 
   /// If ``true``, spaces may be inserted into ``()``.
@@ -3637,7 +3637,7 @@
   ///if ( a )  { ... }  vs. if (a) { ... }
   ///while ( i < 5 )  { ... }   while (i < 5) { ... }
   /// \endcode
-  /// \version 11
+  /// \version 10
   bool SpacesInConditionalStatement;
 
   /// If ``true``, spaces are inserted inside container literals (e.g.
@@ -3724,7 +3724,7 @@
   ///int a [5];vs.  int a[5];
   ///int a [5][5]; vs.  int a[5][5];
   /// \endcode
-  /// \version 11
+  /// \version 10
   bool SpaceBeforeSquareBrackets;
 
   /// Styles for adding spacing around ``:`` in bitfield definitions.
@@ -3831,7 +3831,7 @@
 
   /// \brief Use ``\r\n`` instead of ``\n`` for line breaks.
   /// Also used as fallback if ``DeriveLineEnding`` is true.
-  /// \version 11
+  /// \version 10
   bool UseCRLF;
 
   /// The way to use tab characters in the resulting file.
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -894,7 +894,7 @@
 int d,
 int e);
 
-**AllowShortBlocksOnASingleLine** (``ShortBlockStyle``) :versionbadge:`clang-format 11`
+**AllowShortBlocksOnASingleLine** (``ShortBlockStyle``) :versionbadge:`clang-format 3.5`
   Dependent on the value, ``while (true) { continue; }`` can be put on a
   single line.
 
@@ -2418,7 +2418,7 @@
  f(MyMap[{composite, key}]);f(MyMap[{ composite, key }]);
  new int[3]{1, 2, 3};   new int[3]{ 1, 2, 3 };
 
-**DeriveLineEnding** (``Boolean``) :versionbadge:`clang-format 11`
+**DeriveLineEnding** (``Boolean``) :versionbadge:`clang-format 10`
   Analyze the formatted file for the most used line ending (``\r\n``
   or ``\n``). ``UseCRLF`` is only used as a fallback if none can be derived.
 
@@ -4295,7 +4295,7 @@
  true:  false:
  for (auto v : values) {}   vs. for(auto v: values) {}
 
-**SpaceBeforeSquareBrackets** (``Boolean``) :versionbadge:`clang-format 11`
+**SpaceBeforeSquareBrackets** (``Boolean``) :versionbadge:`clang-format 10`
   If ``true``, spaces will be before  ``[``.
   Lambdas will not be affected. Only the first ``[`` will get a space added.
 
@@ -4305,7 +4305,7 @@
  int a [5];vs.  int a[5];
  int a [5][5]; vs.  int a[5][5];
 
-**SpaceInEmptyBlock** (``Boolean``) :versionbadge:`clang-format 11`
+**SpaceInEmptyBlock** (``Boolean``) :versionbadge:`clang-format 10`
   If ``true``, spaces will be inserted into ``{}``.
 
   .. code-block:: c++
@@ -4379,7 +4379,7 @@
  true:  false:
  x = ( int32 )y vs. x = (int32)y
 
-**SpacesInConditionalStatement** (``Boolean``) :versionbadge:`clang-format 11`
+**SpacesInConditionalStatement** (``Boolean``) :versionbadge:`clang-format 10`
   If ``true``, spaces will be inserted around if/for/switch/while
   conditions.
 
@@ -4543,7 +4543,7 @@
 
   For example: OpenSSL STACK_OF, BSD LIST_ENTRY.
 
-**UseCRLF** (``Boolean``) :versionbadge:`clang-format 11`
+**UseCRLF** (``Boolean``) :versionbadge:`clang-format 10`
   Use ``\r\n`` inste

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

2022-03-19 Thread Ben Shi via Phabricator via cfe-commits
benshi001 added a comment.

It would be better to write a clear commit message with clear title.

  [AVR] Expand pseudo instructions STDWSPQRr & STDSPQRr
  
  1. What is the issue / Why there is a failure in instruction selection ?
  2. How you fix it. 

This is just my suggestion, a unique clear commit message is necessary when 
committing to the main branch, nobody would like to track links to learn all 
about your work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114611

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


[PATCH] D122064: [clang-format][docs] Fix incorrect 'clang-format 11' option markers

2022-03-19 Thread Krystian Kuzniarek via Phabricator via cfe-commits
kuzkry added a comment.

Here's a list of earliest commits where each option changed in this PR was 
introduced:

AllowShortBlocksOnASingleLine - introduced by 
17605d396118f3066a0bd4dfd128b7a8893f8b94
DeriveLineEnding - introduced by 358eaa3dcea1dee6350c2cbf80aab3c25db4d4d9 

SpaceBeforeSquareBrackets - introduced by 
a4a7c1259e8a8f2d11fa29686a6c2834948c1358 

SpaceInEmptyBlock - introduced by db4ad3603ac9bc2f118aa5f176dc04979f836c25
SpacesInConditionalStatement - introduced by 
26748a321e20a7aa952ce8daa4f030c384ae7032 

UseCRLF - introduced by 358eaa3dcea1dee6350c2cbf80aab3c25db4d4d9 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122064

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


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

2022-03-19 Thread Ben Shi via Phabricator via cfe-commits
benshi001 added a comment.

I find some test files locations are moved, I suggested you create a seperate 
patch for that, and this patch only focuses on fixing the instruction selection 
failure.

Also I can help review and commit the other patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114611

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


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

2022-03-19 Thread Ben Shi via Phabricator via cfe-commits
benshi001 added inline comments.



Comment at: llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp:1246
+  // few operations
+  if (Imm >= 63) {
+if (!DstIsKill) {

I suggest we make another patch for merge `AVRRelaxMem::relax` 
into `expand`, for the case `Imm >= 63`. And we select that 
merge patch as baseline / parent of current patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114611

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


[PATCH] D121271: [C++20] [Modules] Don't generate strong function of a partition in importing modules

2022-03-19 Thread Iain Sandoe via Phabricator via cfe-commits
iains added a comment.

it looks like the test case is failing everywhere - perhaps as a result of 
changes in the mangling scheme?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121271

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


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

2022-03-19 Thread Ben Shi via Phabricator via cfe-commits
benshi001 added inline comments.



Comment at: llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp:1234
+
+  MachineOperand &Dst = MI.getOperand(0);
+  Register DstReg = Dst.getReg();

Why we need an extra `Dst` local variable here? I did not find there is any 
more use besides `.getReg()` .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114611

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


[PATCH] D119601: [analyzer] Refactor makeNull to makeNullWithWidth (NFC)

2022-03-19 Thread Vince Bridgers via Phabricator via cfe-commits
vabridgers added inline comments.



Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h:378
+type = type->isReferenceType()
+   ? Context.getPointerType(type->getPointeeType())
+   : type;

NoQ wrote:
> vabridgers wrote:
> > NoQ wrote:
> > > How do you discover the pointer width by looking only at the pointee 
> > > type? Are objects of specific type always restricted to a specific 
> > > address space? I.e., does every `int *` have the same width everywhere in 
> > > the program? If not, how is this code supposed to work?
> > The case this code addresses is represented in the test case 
> > clang/test/Analysis/cast-value-notes.cpp, this function ...
> > 
> > ```
> >  24 void evalReferences(const Shape &S) {
> >  25   const auto &C = dyn_cast(S);
> >  26   // expected-note@-1 {{Assuming 'S' is not a 'Circle'}}
> >  27   // expected-note@-2 {{Dereference of null pointer}}
> >  28   // expected-warning@-3 {{Dereference of null pointer}}
> >  29 }
> > 
> > ```
> > The crash occurs from line 25 above. 
> > 
> > Debug printing what I see at this point in the code for this case ...
> > 
> > ```
> > QualType type : LValueReferenceType 0xffea820 'const class clang::Circle &'
> > `-QualType 0xffea7c1 'const class clang::Circle' const
> >   `-SubstTemplateTypeParmType 0xffea7c0 'class clang::Circle' sugar
> > |-TemplateTypeParmType 0xffe4f90 'X' dependent depth 0 index 0
> > | `-TemplateTypeParm 0xffe4f40 'X'
> > `-RecordType 0xffea090 'class clang::Circle'
> >   `-CXXRecord 0xffea000 'Circle'
> > 
> > Context.getPointerType(type) : PointerType 0x10006ab0 'const class 
> > clang::Circle &*'
> > `-LValueReferenceType 0xffea820 'const class clang::Circle &'
> >   `-QualType 0xffea7c1 'const class clang::Circle' const
> > `-SubstTemplateTypeParmType 0xffea7c0 'class clang::Circle' sugar
> >   |-TemplateTypeParmType 0xffe4f90 'X' dependent depth 0 index 0
> >   | `-TemplateTypeParm 0xffe4f40 'X'
> >   `-RecordType 0xffea090 'class clang::Circle'
> > `-CXXRecord 0xffea000 'Circle'
> > 
> > Context.getPointerType(type->getPointeeType()) : PointerType 0x10006ae0 
> > 'const class clang::Circle *'
> > `-QualType 0xffea7c1 'const class clang::Circle' const
> >   `-SubstTemplateTypeParmType 0xffea7c0 'class clang::Circle' sugar
> > |-TemplateTypeParmType 0xffe4f90 'X' dependent depth 0 index 0
> > | `-TemplateTypeParm 0xffe4f40 'X'
> > `-RecordType 0xffea090 'class clang::Circle'
> >   `-CXXRecord 0xffea000 'Circle'
> > 
> > ```
> > The LValueReferenceType causes a crash if I do not get a pointer type, 
> > looks like ... 
> > 
> > ```
> > clang:  
> > /clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h:219:
> >  const llvm::APSInt& 
> > clang::ento::BasicValueFactory::getZeroWithTypeSize(clang::QualType): 
> > Assertion `T->isScalarType()' failed.
> > 
> > ```
> > I'm assuming the pointer type retains the address space attribute of the 
> > LValueReferenceType. 
> > 
> > Context.getPointerType(type->getPointeeType()) produces a QualType :  
> > PointerType 'const class clang::Circle *' from an original QualType : 
> > LValueReferenceType 'const class clang::Circle &'
> > 
> > Is this not what's wanted - a pointer type instead of a reference, with the 
> > same address space qualifiers, or am I missing something in the query? 
> > 
> > Thanks
> Do I understand correctly that `__attribute__((address_space))` is a type 
> attribute that gets applied to values rather than to pointers, so 
> `__attribute__((address_space(3))) int *x` defines `x` as "pointer to (int 
> that lives in address_space(3))", so when you unwrap the pointer type you get 
> an "int that lives in address_space(3)"?
> 
> Can you share some dumps to demonstrate that the attribute is correctly 
> preserved by this procedure? Damn, a test case could be great if we could 
> have them.
I'll see what can be done about a test case, and provide the dumps for 
evaluation. Best


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119601

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


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

2022-03-19 Thread Ben Shi via Phabricator via cfe-commits
benshi001 added inline comments.



Comment at: llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp:1240
+
+  MachineOperand &Src = MI.getOperand(2);
+  Register SrcReg = Src.getReg();

Also, I did not find any other use of `Src`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114611

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


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

2022-03-19 Thread Ben Shi via Phabricator via cfe-commits
benshi001 added inline comments.



Comment at: llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp:1253
+.addReg(DstReg, RegState::Define)
+.addReg(DstReg)
+.addImm(-Imm);

```
buildMI(MBB, MBBI, AVR::SBCIWRdK)
.addReg(DstReg, RegState::Define)
.addReg(DstReg, RegState::Kill)
.addImm(-Imm);
```
The original DstReg is indeed killed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114611

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


[PATCH] D119477: Ignore FullExpr when traversing cast sub-expressions

2022-03-19 Thread Kim Gräsman via Phabricator via cfe-commits
kimgr updated this revision to Diff 416695.
kimgr added a comment.

Address review feedback

- Restore accidentally removed test line
- Clarify diagnostic expectations


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119477

Files:
  clang/lib/AST/Expr.cpp
  clang/test/SemaCXX/cxx2a-consteval.cpp
  clang/unittests/Tooling/CastExprTest.cpp

Index: clang/unittests/Tooling/CastExprTest.cpp
===
--- clang/unittests/Tooling/CastExprTest.cpp
+++ clang/unittests/Tooling/CastExprTest.cpp
@@ -14,12 +14,19 @@
 
 struct CastExprVisitor : TestVisitor {
   std::function OnExplicitCast;
+  std::function OnCast;
 
   bool VisitExplicitCastExpr(ExplicitCastExpr *Expr) {
 if (OnExplicitCast)
   OnExplicitCast(Expr);
 return true;
   }
+
+  bool VisitCastExpr(CastExpr *Expr) {
+if (OnCast)
+  OnCast(Expr);
+return true;
+  }
 };
 
 TEST(CastExprTest, GetSubExprAsWrittenThroughMaterializedTemporary) {
@@ -54,4 +61,57 @@
   CastExprVisitor::Lang_CXX2a);
 }
 
+// Verify that getConversionFunction looks through a ConstantExpr for implicit
+// constructor conversions (https://github.com/llvm/llvm-project/issues/53044):
+//
+// `-ImplicitCastExpr 'X' 
+//   `-ConstantExpr 'X'
+// |-value: Struct
+// `-CXXConstructExpr 'X' 'void (const char *)'
+//   `-ImplicitCastExpr 'const char *' 
+// `-StringLiteral 'const char [7]' lvalue "foobar"
+TEST(CastExprTest, GetCtorConversionFunctionThroughConstantExpr) {
+  CastExprVisitor Visitor;
+  Visitor.OnCast = [](CastExpr *Expr) {
+if (Expr->getCastKind() == CK_ConstructorConversion) {
+  auto *Conv = Expr->getConversionFunction();
+  EXPECT_TRUE(isa(Conv))
+  << "Expected CXXConstructorDecl, but saw " << Conv->getDeclKindName();
+}
+  };
+  Visitor.runOver("struct X { consteval X(const char *) {} };\n"
+  "void f() { X x = \"foobar\"; }\n",
+  CastExprVisitor::Lang_CXX2a);
+}
+
+// Verify that getConversionFunction looks through a ConstantExpr for implicit
+// user-defined conversions.
+//
+// `-ImplicitCastExpr 'const char *' 
+//   `-ConstantExpr 'const char *'
+// |-value: LValue
+// `-CXXMemberCallExpr 'const char *'
+//   `-MemberExpr '' .operator const char *
+// `-DeclRefExpr 'const X' lvalue Var 'x' 'const X'
+TEST(CastExprTest, GetUserDefinedConversionFunctionThroughConstantExpr) {
+  CastExprVisitor Visitor;
+  Visitor.OnCast = [](CastExpr *Expr) {
+if (Expr->getCastKind() == CK_UserDefinedConversion) {
+  auto *Conv = Expr->getConversionFunction();
+  EXPECT_TRUE(isa(Conv))
+  << "Expected CXXMethodDecl, but saw " << Conv->getDeclKindName();
+}
+  };
+  Visitor.runOver("struct X {\n"
+  "  consteval operator const char *() const {\n"
+  "return nullptr;\n"
+  "  }\n"
+  "};\n"
+  "const char *f() {\n"
+  "  constexpr X x;\n"
+  "  return x;\n"
+  "}\n",
+  CastExprVisitor::Lang_CXX2a);
+}
+
 } // namespace
Index: clang/test/SemaCXX/cxx2a-consteval.cpp
===
--- clang/test/SemaCXX/cxx2a-consteval.cpp
+++ clang/test/SemaCXX/cxx2a-consteval.cpp
@@ -359,22 +359,34 @@
   // expected-note@-1 {{is not a constant expression}}
   { A k = to_lvalue_ref(A()); } // expected-error {{is not a constant expression}}
   // expected-note@-1 {{is not a constant expression}} expected-note@-1 {{temporary created here}}
-  { A k = to_lvalue_ref(A().ret_a()); } // expected-error {{is not a constant expression}}
-  // expected-note@-1 {{is not a constant expression}} expected-note@-1 {{temporary created here}}
+  { A k = to_lvalue_ref(A().ret_a()); }
+  // expected-error@-1 {{'alloc::A::ret_a' is not a constant expression}}
+  // expected-note@-2 {{heap-allocated object is not a constant expression}}
+  // expected-error@-3 {{'alloc::to_lvalue_ref' is not a constant expression}}
+  // expected-note@-4 {{reference to temporary is not a constant expression}}
+  // expected-note@-5 {{temporary created here}}
   { int k = A().ret_a().ret_i(); }
+  // expected-error@-1 {{'alloc::A::ret_a' is not a constant expression}}
+  // expected-note@-2 {{heap-allocated object is not a constant expression}}
   { int k = by_value_a(A()); }
   { int k = const_a_ref(A()); }
   { int k = const_a_ref(a); }
   { int k = rvalue_ref(A()); }
   { int k = rvalue_ref(std::move(a)); }
   { int k = const_a_ref(A().ret_a()); }
+  // expected-error@-1 {{'alloc::A::ret_a' is not a constant expression}}
+  // expected-note@-2 {{is not a constant expression}}
   { int k = const_a_ref(to_lvalue_ref(A().ret_a())); }
+  // expected-error@-1 {{'alloc::A::ret_a' is not a constant expression}}
+  // expected-note@-2 {{is not a constan

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

2022-03-19 Thread Ben Shi via Phabricator via cfe-commits
benshi001 added inline comments.



Comment at: llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp:1256
 
-  auto MIBHI = buildMI(MBB, MBBI, OpHi)
-   .addReg(DstReg, getKillRegState(DstIsKill))
-   .addImm(Imm + 1)
-   .addReg(SrcHiReg, getKillRegState(SrcIsKill));
+buildMI(MBB, MBBI, AVR::STWPtrRr)
+.addReg(Dst.getReg())

```
buildMI(MBB, MBBI, AVR::STWPtrRr)
.addReg(Dst.getReg(), RegState::Kill)
.addReg(Src.getReg(), getKillRegState(SrcIsKill));
```

No matter `DstIsKill` is true or false, the new `DstReg` is always killed.



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

I think 

```
   if (!DstIsKill)
  buildMI(MBB, MBBI, AVR::POPWRd).addReg(DstReg, RegState::Define);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114611

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


[PATCH] D119476: Generalize and harmonize sub-expression traversal

2022-03-19 Thread Kim Gräsman via Phabricator via cfe-commits
kimgr added a comment.

Thanks! Could you help me land it? Author: Kim Gräsman .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119476

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


[PATCH] D122069: [Clang] Add binary format for bundling offloading metadata

2022-03-19 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, JonChesterfield.
Herald added subscribers: ormris, dexonsmith, hiraditya, mgorny.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, sstefan1.
Herald added projects: clang, LLVM.

We need to embed certain metadata along with a binary image when we wish
to perform a device-linking job on it. Currently this metadata was
embedded in the section name of the data itself. This worked, but made
adding new metadata very difficult and didn't work if the user did any
sort of section linking.

This patch introduces a custom binary format for bundling offloading
metadata with a device object file. This binary format is fundamentally
a simple string table with some additional data and an embedded image. I
decided to use a custom format rather than using an existing format
(ELF, JSON, etc) because of the specialty use-case of this.

This extension will make it easier to extend the linker wrapper's
capabilties with whatever data is necessary. Eventually this will allow
us to remove all the external arguments passed to the linker wrapper and
embed it directly in the host's linker so device linking behaves exactly
like host linking.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122069

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Basic/Offloading.h
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/Offloading.cpp
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/openmp-offload-gpu.c
  clang/test/Frontend/embed-object.c
  clang/test/Frontend/embed-object.ll
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp

Index: llvm/lib/Transforms/Utils/ModuleUtils.cpp
===
--- llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -266,14 +266,13 @@
 
 void llvm::embedBufferInModule(Module &M, MemoryBufferRef Buf,
StringRef SectionName) {
-  // Embed the buffer into the module.
+  // Embed the memory buffer into the module.
   Constant *ModuleConstant = ConstantDataArray::get(
   M.getContext(), makeArrayRef(Buf.getBufferStart(), Buf.getBufferSize()));
   GlobalVariable *GV = new GlobalVariable(
-  M, ModuleConstant->getType(), true, GlobalValue::ExternalLinkage,
-  ModuleConstant, SectionName.drop_front());
+  M, ModuleConstant->getType(), true, GlobalValue::PrivateLinkage,
+  ModuleConstant, "llvm.embedded.object");
   GV->setSection(SectionName);
-  GV->setVisibility(GlobalValue::HiddenVisibility);
 
   appendToCompilerUsed(M, GV);
 }
Index: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===
--- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -447,7 +447,7 @@
   Name == getInstrProfSectionName(IPSK_covfun, Triple::ELF,
   /*AddSegmentInfo=*/false) ||
   Name == ".llvmbc" || Name == ".llvmcmd" ||
-  Name.startswith(".llvm.offloading."))
+  Name.startswith(".llvm.offloading"))
 return SectionKind::getMetadata();
 
   if (Name.empty() || Name[0] != '.') return K;
Index: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
===
--- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -15,6 +15,7 @@
 //===-===//
 
 #include "OffloadWrapper.h"
+#include "clang/Basic/Offloading.h"
 #include "clang/Basic/Version.h"
 #include "llvm/BinaryFormat/Magic.h"
 #include "llvm/Bitcode/BitcodeWriter.h"
@@ -47,6 +48,7 @@
 #include "llvm/Target/TargetMachine.h"
 
 using namespace llvm;
+using namespace clang;
 using namespace llvm::object;
 
 static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden);
@@ -146,9 +148,10 @@
 static codegen::RegisterCodeGenFlags CodeGenFlags;
 
 /// Magic section string that marks the existence of offloading data. The
-/// section string will be formatted as `.llvm.offloading..`.
-#define OFFLOAD_SECTION_MAGIC_STR ".llvm.offloading."
+/// section will contain one or more offloading binaries stored contiguously.
+#define OFFLOAD_SECTION_MAGIC_STR ".llvm.offloading"
 
+// TODO: Replace all uses of DeviceFile with OffloadFile.
 /// Information for a device offloading file extracted from the host.
 struct DeviceFile {
   DeviceFile(StringRef Kind, StringRef TheTriple, StringRef Arch,
@@ -296,39 +299,50 @@
   StringRef Prefix = sys::path::stem(Obj.getFileName());
   SmallVector ToBeStripped;
 
-  // Extract data from sections of the form `.llvm.offloading..`.
+  /

[PATCH] D122069: [Clang] Add binary format for bundling offloading metadata

2022-03-19 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 added inline comments.



Comment at: clang/include/clang/Basic/Offloading.h:1
+//===--- Offloading.h - Utilities for handling offloading code  -*- C++ 
-*-===//
+//

Not sure if this should live in Clang or LLVM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122069

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


[PATCH] D121969: Pass split-machine-functions to code generator when flto is used

2022-03-19 Thread Wenlei He via Phabricator via cfe-commits
wenlei added inline comments.



Comment at: clang/test/Driver/split-machine-functions.c:2
+// Split machine functions only work for ELF, so disable the test on Windows
+// UNSUPPORTED: system-windows
+

My understanding is that if you specify target, e.g. `-target 
x86_64-unknown-linux`, the test should still be runnable on windows host 
platform. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121969

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


[PATCH] D122069: [Clang] Add binary format for bundling offloading metadata

2022-03-19 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 updated this revision to Diff 416713.
jhuber6 added a comment.

Update alignment to worse-case padding of 16. I'm not sure if there's a bette 
solution for preventing the linker from adding padding between these sections 
if they are combined.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122069

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Basic/Offloading.h
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/Offloading.cpp
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/openmp-offload-gpu.c
  clang/test/Frontend/embed-object.c
  clang/test/Frontend/embed-object.ll
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp

Index: llvm/lib/Transforms/Utils/ModuleUtils.cpp
===
--- llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -266,14 +266,13 @@
 
 void llvm::embedBufferInModule(Module &M, MemoryBufferRef Buf,
StringRef SectionName) {
-  // Embed the buffer into the module.
+  // Embed the memory buffer into the module.
   Constant *ModuleConstant = ConstantDataArray::get(
   M.getContext(), makeArrayRef(Buf.getBufferStart(), Buf.getBufferSize()));
   GlobalVariable *GV = new GlobalVariable(
-  M, ModuleConstant->getType(), true, GlobalValue::ExternalLinkage,
-  ModuleConstant, SectionName.drop_front());
+  M, ModuleConstant->getType(), true, GlobalValue::PrivateLinkage,
+  ModuleConstant, "llvm.embedded.object");
   GV->setSection(SectionName);
-  GV->setVisibility(GlobalValue::HiddenVisibility);
 
   appendToCompilerUsed(M, GV);
 }
Index: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===
--- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -447,7 +447,7 @@
   Name == getInstrProfSectionName(IPSK_covfun, Triple::ELF,
   /*AddSegmentInfo=*/false) ||
   Name == ".llvmbc" || Name == ".llvmcmd" ||
-  Name.startswith(".llvm.offloading."))
+  Name.startswith(".llvm.offloading"))
 return SectionKind::getMetadata();
 
   if (Name.empty() || Name[0] != '.') return K;
Index: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
===
--- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -15,6 +15,7 @@
 //===-===//
 
 #include "OffloadWrapper.h"
+#include "clang/Basic/Offloading.h"
 #include "clang/Basic/Version.h"
 #include "llvm/BinaryFormat/Magic.h"
 #include "llvm/Bitcode/BitcodeWriter.h"
@@ -47,6 +48,7 @@
 #include "llvm/Target/TargetMachine.h"
 
 using namespace llvm;
+using namespace clang;
 using namespace llvm::object;
 
 static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden);
@@ -146,9 +148,10 @@
 static codegen::RegisterCodeGenFlags CodeGenFlags;
 
 /// Magic section string that marks the existence of offloading data. The
-/// section string will be formatted as `.llvm.offloading..`.
-#define OFFLOAD_SECTION_MAGIC_STR ".llvm.offloading."
+/// section will contain one or more offloading binaries stored contiguously.
+#define OFFLOAD_SECTION_MAGIC_STR ".llvm.offloading"
 
+// TODO: Replace all uses of DeviceFile with OffloadFile.
 /// Information for a device offloading file extracted from the host.
 struct DeviceFile {
   DeviceFile(StringRef Kind, StringRef TheTriple, StringRef Arch,
@@ -201,16 +204,6 @@
 llvm::errs() << *IC << (std::next(IC) != IE ? " " : "\n");
 }
 
-static StringRef getDeviceFileExtension(StringRef DeviceTriple,
-bool IsBitcode = false) {
-  Triple TheTriple(DeviceTriple);
-  if (TheTriple.isAMDGPU() || IsBitcode)
-return "bc";
-  if (TheTriple.isNVPTX())
-return "cubin";
-  return "o";
-}
-
 std::string getMainExecutable(const char *Name) {
   void *Ptr = (void *)(intptr_t)&getMainExecutable;
   auto COWPath = sys::fs::getMainExecutable(Name, Ptr);
@@ -296,39 +289,50 @@
   StringRef Prefix = sys::path::stem(Obj.getFileName());
   SmallVector ToBeStripped;
 
-  // Extract data from sections of the form `.llvm.offloading..`.
+  // Extract offloading binaries from sections with the name `.llvm.offloading`.
   for (const SectionRef &Sec : Obj.sections()) {
 Expected Name = Sec.getName();
-if (!Name || !Name->startswith(OFFLOAD_SECTION_MAGIC_STR))
+if (!Name || !Name->equals(OFFLOAD_SECTION_MAGIC_STR))
   continue;
 
-SmallVector SectionFields;
-Name->split(SectionFields, '.');
-StringRef Kind = SectionFie

[PATCH] D122075: [clang-tidy] Skip parentheses in `readability-make-member-function-const`

2022-03-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision.
Izaron added reviewers: mgehre-amd, njames93, aaron.ballman.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a project: All.
Izaron requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

The checker should ignore parentheses when looking whether the
function should be marked as `const`.

Fixes https://github.com/llvm/llvm-project/issues/52838


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122075

Files:
  clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
  
clang-tools-extra/test/clang-tidy/checkers/readability-make-member-function-const.cpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/readability-make-member-function-const.cpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/readability-make-member-function-const.cpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/readability-make-member-function-const.cpp
@@ -40,6 +40,12 @@
 return ConstM;
   }
 
+  int read_fields_in_parentheses() {
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: method 
'read_fields_in_parentheses' can be made const
+// CHECK-FIXES: {{^}}  int read_fields_in_parentheses() const {
+return (this)->M + (Struct.M) + ((this->ConstM));
+  }
+
   void call_const_member() {
 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: method 'call_const_member' can 
be made const
 // CHECK-FIXES: {{^}}  void call_const_member() const {
Index: clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
===
--- clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
+++ clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
@@ -66,6 +66,15 @@
 return Parents.begin()->get();
   }
 
+  const Stmt *getParentStmt(const Expr *E) { return getParent(E); }
+
+  const Expr *getParentExpr(const Expr *E) {
+const Expr *Parent = getParent(E);
+while (isa_and_nonnull(Parent))
+  Parent = getParent(Parent);
+return Parent;
+  }
+
   bool VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *) {
 // An UnresolvedMemberExpr might resolve to a non-const non-static
 // member function.
@@ -103,7 +112,7 @@
 if (!QT.isConstQualified())
   return false; // Stop traversal.
 
-const auto *Parent = getParent(Cast);
+const auto *Parent = getParentStmt(Cast);
 if (!Parent)
   return false; // Stop traversal.
 
@@ -140,7 +149,7 @@
   return true;
 }
 
-const auto *Parent = getParent(Member);
+const auto *Parent = getParentExpr(Member);
 
 if (const auto *Cast = dyn_cast_or_null(Parent)) {
   // A read access to a member is safe when the member either
@@ -167,12 +176,12 @@
   bool VisitCXXThisExpr(const CXXThisExpr *E) {
 Usage = Const;
 
-const auto *Parent = getParent(E);
+const auto *Parent = getParentExpr(E);
 
 // Look through deref of this.
 if (const auto *UnOp = dyn_cast_or_null(Parent)) {
   if (UnOp->getOpcode() == UO_Deref) {
-Parent = getParent(UnOp);
+Parent = getParentExpr(UnOp);
   }
 }
 


Index: clang-tools-extra/test/clang-tidy/checkers/readability-make-member-function-const.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/readability-make-member-function-const.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability-make-member-function-const.cpp
@@ -40,6 +40,12 @@
 return ConstM;
   }
 
+  int read_fields_in_parentheses() {
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: method 'read_fields_in_parentheses' can be made const
+// CHECK-FIXES: {{^}}  int read_fields_in_parentheses() const {
+return (this)->M + (Struct.M) + ((this->ConstM));
+  }
+
   void call_const_member() {
 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: method 'call_const_member' can be made const
 // CHECK-FIXES: {{^}}  void call_const_member() const {
Index: clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
===
--- clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
+++ clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
@@ -66,6 +66,15 @@
 return Parents.begin()->get();
   }
 
+  const Stmt *getParentStmt(const Expr *E) { return getParent(E); }
+
+  const Expr *getParentExpr(const Expr *E) {
+const Expr *Parent = getParent(E);
+while (isa_and_nonnull(Parent))
+  Parent = getParent(Parent);
+return Parent;
+  }
+
   bool VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *) {
 // An UnresolvedMemberExpr might resolve to a non-const non-static
 // member function.
@@ -103,7 +112,7 @@
 if (!QT.isConstQualified())
   return false; // Stop traversal

[PATCH] D121961: [clang] Produce a "multiversion" annotation in textual AST output.

2022-03-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM (I was surprised to see the Windows CI pass with that `sed` invocation!)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121961

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


[PATCH] D122069: [Clang] Add binary format for bundling offloading metadata

2022-03-19 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 updated this revision to Diff 416719.
jhuber6 added a comment.

Fix test after increasing alignment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122069

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Basic/Offloading.h
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/Offloading.cpp
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/openmp-offload-gpu.c
  clang/test/Frontend/embed-object.c
  clang/test/Frontend/embed-object.ll
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp

Index: llvm/lib/Transforms/Utils/ModuleUtils.cpp
===
--- llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -266,14 +266,13 @@
 
 void llvm::embedBufferInModule(Module &M, MemoryBufferRef Buf,
StringRef SectionName) {
-  // Embed the buffer into the module.
+  // Embed the memory buffer into the module.
   Constant *ModuleConstant = ConstantDataArray::get(
   M.getContext(), makeArrayRef(Buf.getBufferStart(), Buf.getBufferSize()));
   GlobalVariable *GV = new GlobalVariable(
-  M, ModuleConstant->getType(), true, GlobalValue::ExternalLinkage,
-  ModuleConstant, SectionName.drop_front());
+  M, ModuleConstant->getType(), true, GlobalValue::PrivateLinkage,
+  ModuleConstant, "llvm.embedded.object");
   GV->setSection(SectionName);
-  GV->setVisibility(GlobalValue::HiddenVisibility);
 
   appendToCompilerUsed(M, GV);
 }
Index: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===
--- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -447,7 +447,7 @@
   Name == getInstrProfSectionName(IPSK_covfun, Triple::ELF,
   /*AddSegmentInfo=*/false) ||
   Name == ".llvmbc" || Name == ".llvmcmd" ||
-  Name.startswith(".llvm.offloading."))
+  Name.startswith(".llvm.offloading"))
 return SectionKind::getMetadata();
 
   if (Name.empty() || Name[0] != '.') return K;
Index: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
===
--- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -15,6 +15,7 @@
 //===-===//
 
 #include "OffloadWrapper.h"
+#include "clang/Basic/Offloading.h"
 #include "clang/Basic/Version.h"
 #include "llvm/BinaryFormat/Magic.h"
 #include "llvm/Bitcode/BitcodeWriter.h"
@@ -47,6 +48,7 @@
 #include "llvm/Target/TargetMachine.h"
 
 using namespace llvm;
+using namespace clang;
 using namespace llvm::object;
 
 static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden);
@@ -146,9 +148,10 @@
 static codegen::RegisterCodeGenFlags CodeGenFlags;
 
 /// Magic section string that marks the existence of offloading data. The
-/// section string will be formatted as `.llvm.offloading..`.
-#define OFFLOAD_SECTION_MAGIC_STR ".llvm.offloading."
+/// section will contain one or more offloading binaries stored contiguously.
+#define OFFLOAD_SECTION_MAGIC_STR ".llvm.offloading"
 
+// TODO: Replace all uses of DeviceFile with OffloadFile.
 /// Information for a device offloading file extracted from the host.
 struct DeviceFile {
   DeviceFile(StringRef Kind, StringRef TheTriple, StringRef Arch,
@@ -201,16 +204,6 @@
 llvm::errs() << *IC << (std::next(IC) != IE ? " " : "\n");
 }
 
-static StringRef getDeviceFileExtension(StringRef DeviceTriple,
-bool IsBitcode = false) {
-  Triple TheTriple(DeviceTriple);
-  if (TheTriple.isAMDGPU() || IsBitcode)
-return "bc";
-  if (TheTriple.isNVPTX())
-return "cubin";
-  return "o";
-}
-
 std::string getMainExecutable(const char *Name) {
   void *Ptr = (void *)(intptr_t)&getMainExecutable;
   auto COWPath = sys::fs::getMainExecutable(Name, Ptr);
@@ -296,39 +289,50 @@
   StringRef Prefix = sys::path::stem(Obj.getFileName());
   SmallVector ToBeStripped;
 
-  // Extract data from sections of the form `.llvm.offloading..`.
+  // Extract offloading binaries from sections with the name `.llvm.offloading`.
   for (const SectionRef &Sec : Obj.sections()) {
 Expected Name = Sec.getName();
-if (!Name || !Name->startswith(OFFLOAD_SECTION_MAGIC_STR))
+if (!Name || !Name->equals(OFFLOAD_SECTION_MAGIC_STR))
   continue;
 
-SmallVector SectionFields;
-Name->split(SectionFields, '.');
-StringRef Kind = SectionFields[3];
-StringRef DeviceTriple = SectionFields[4];
-StringRef Arch = SectionFields[5];
+Expected Contents = Sec.getContents();
+  

[PATCH] D122078: [clang-tidy] Ignore concepts in `misc-redundant-expression`

2022-03-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision.
Izaron added reviewers: hokein, njames93, aaron.ballman.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a project: All.
Izaron requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

The checker should ignore requirement expressions inside concept
definitions, because redundant expressions still make sense here

Fixes https://github.com/llvm/llvm-project/issues/54114


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122078

Files:
  clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/misc-redundant-expression.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/misc-redundant-expression.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/misc-redundant-expression.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/misc-redundant-expression.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-redundant-expression %t -- -- -fno-delayed-template-parsing
+// RUN: %check_clang_tidy %s misc-redundant-expression -std=c++20 %t -- -- -fno-delayed-template-parsing
 
 typedef __INT64_TYPE__ I64;
 
@@ -807,3 +807,13 @@
 };
 
 } // namespace no_crash
+
+namespace concepts {
+// redundant expressions inside concepts make sense, ignore them
+template 
+concept TestConcept = requires(I i) {
+  {i - i};
+  {i && i};
+  {i ? i : i};
+};
+} // namespace concepts
Index: clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
@@ -10,6 +10,7 @@
 #include "../utils/Matchers.h"
 #include "../utils/OptionsUtils.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ExprConcepts.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
@@ -438,6 +439,8 @@
   return Node.isIntegerConstantExpr(Finder->getASTContext());
 }
 
+AST_MATCHER(Expr, isRequiresExpr) { return isa(Node); }
+
 AST_MATCHER(BinaryOperator, operandsAreEquivalent) {
   return areEquivalentExpr(Node.getLHS(), Node.getRHS());
 }
@@ -831,6 +834,7 @@
 
   const auto BannedIntegerLiteral =
   integerLiteral(expandedByMacro(KnownBannedMacroNames));
+  const auto BannedAncestor = expr(isRequiresExpr());
 
   // Binary with equivalent operands, like (X != 2 && X != 2).
   Finder->addMatcher(
@@ -846,7 +850,8 @@
unless(hasType(realFloatingPointType())),
unless(hasEitherOperand(hasType(realFloatingPointType(,
unless(hasLHS(AnyLiteralExpr)),
-   unless(hasDescendant(BannedIntegerLiteral)))
+   unless(hasDescendant(BannedIntegerLiteral)),
+   unless(hasAncestor(BannedAncestor)))
.bind("binary")),
   this);
 
@@ -859,7 +864,8 @@
  unless(isInTemplateInstantiation()),
  unless(binaryOperatorIsInMacro()),
  // TODO: if the banned macros are themselves duplicated
- unless(hasDescendant(BannedIntegerLiteral)))
+ unless(hasDescendant(BannedIntegerLiteral)),
+ unless(hasAncestor(BannedAncestor)))
   .bind("nested-duplicates"),
   this);
 
@@ -869,7 +875,8 @@
conditionalOperator(expressionsAreEquivalent(),
// Filter noisy false positives.
unless(conditionalOperatorIsInMacro()),
-   unless(isInTemplateInstantiation()))
+   unless(isInTemplateInstantiation()),
+   unless(hasAncestor(BannedAncestor)))
.bind("cond")),
   this);
 
@@ -882,7 +889,8 @@
 ">=", "&&", "||", "="),
parametersAreEquivalent(),
// Filter noisy false positives.
-   unless(isMacro()), unless(isInTemplateInstantiation()))
+   unless(isMacro()), unless(isInTemplateInstantiation()),
+   unless(hasAncestor(BannedAncestor)))
.bind("call")),
   this);
 
@@ -892,7 +900,8 @@
   hasAnyOverloadedOperatorName("|", "&", "||", "&&", "^"),
   nestedParametersAreEquivalent(), argumentCountIs(2),
   // Filter noisy false positives.
-  unless(isMacro()), unless(isInTemplateInstantiation()))
+  unless(isMacro()), unless(isInTemplateInstantiation()),
+  unless(hasAncestor(BannedAncestor)))
   .bind("nested-duplicates"),
   this);
 
@@ -909,7 +918,8 @@
binaryOperator(hasAnyOperatorName("|", "&")

[PATCH] D121961: [clang] Produce a "multiversion" annotation in textual AST output.

2022-03-19 Thread Tom Honermann via Phabricator via cfe-commits
tahonermann added a comment.

> I was surprised to see the Windows CI pass with that sed invocation!

Ha! I didn't even think about that. I had copied the `RUN` lines from another 
test and only adjusted what was necessary. The bots must have Cygwin, MSYS[2], 
GnuWin32, or similar installed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121961

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


[PATCH] D119601: [analyzer] Refactor makeNull to makeNullWithWidth (NFC)

2022-03-19 Thread Vince Bridgers via Phabricator via cfe-commits
vabridgers updated this revision to Diff 416735.
vabridgers marked an inline comment as not done.
vabridgers added a comment.

add updated test cases per comments from NoQ


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119601

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
  clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
  clang/lib/StaticAnalyzer/Core/RegionStore.cpp
  clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
  clang/test/Analysis/cast-value-notes.cpp

Index: clang/test/Analysis/cast-value-notes.cpp
===
--- clang/test/Analysis/cast-value-notes.cpp
+++ clang/test/Analysis/cast-value-notes.cpp
@@ -1,9 +1,22 @@
 // RUN: %clang_analyze_cc1 -std=c++14 \
 // RUN:  -analyzer-checker=core,apiModeling.llvm.CastValue,debug.ExprInspection\
-// RUN:  -analyzer-output=text -verify %s
+// RUN:  -analyzer-output=text -verify -DDEFAULT_TRIPLE %s 2>&1 | FileCheck %s -check-prefix=DEFAULT-CHECK
+//
+// RUN: %clang_analyze_cc1 -std=c++14 -triple amdgcn-unknown-unknown \
+// RUN: -analyzer-checker=core,apiModeling.llvm.CastValue,debug.ExprInspection\
+// RUN: -analyzer-output=text -verify -DAMDGCN_TRIPLE %s 2>&1 | FileCheck %s -check-prefix=AMDGCN-CHECK
 
 #include "Inputs/llvm.h"
 
+// The amggcn triple case uses an intentionally different address space.
+// The core.NullDereference checker intentionally ignores checks
+// that use address spaces, so the case is differentiated here.
+//
+// From https://llvm.org/docs/AMDGPUUsage.html#address-spaces,
+// select address space 3 (local), since the pointer size is
+// different than Generic.
+#define DEVICE __attribute__((address_space(3)))
+
 namespace clang {
 struct Shape {
   template 
@@ -21,12 +34,30 @@
 using namespace llvm;
 using namespace clang;
 
+void clang_analyzer_printState();
+
+#if defined(DEFAULT_TRIPLE)
 void evalReferences(const Shape &S) {
   const auto &C = dyn_cast(S);
   // expected-note@-1 {{Assuming 'S' is not a 'Circle'}}
   // expected-note@-2 {{Dereference of null pointer}}
   // expected-warning@-3 {{Dereference of null pointer}}
+  clang_analyzer_printState();
+  // DEFAULT-CHECK: "dynamic_types": [
+  // DEFAULT-CHECK-NEXT: { "region": "SymRegion{reg_$0}", "dyn_type": "const class clang::Circle &", "sub_classable": true }
+  (void)C;
+}
+#elif defined(AMDGCN_TRIPLE)
+void evalReferences(const Shape &S) {
+  const auto &C = dyn_cast(S);
+  clang_analyzer_printState();
+  // AMDGCN-CHECK: "dynamic_types": [
+  // AMDGCN-CHECK-NEXT: { "region": "SymRegion{reg_$0}", "dyn_type": "const __attribute__((address_space(3))) class clang::Circle &", "sub_classable": true }
+  (void)C;
 }
+#else
+#error Target must be specified, and must be pinned
+#endif
 
 void evalNonNullParamNonNullReturnReference(const Shape &S) {
   const auto *C = dyn_cast_or_null(S);
Index: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
===
--- clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -61,7 +61,7 @@
 
 DefinedOrUnknownSVal SValBuilder::makeZeroVal(QualType type) {
   if (Loc::isLocType(type))
-return makeNull();
+return makeNullWithType(type);
 
   if (type->isIntegralOrEnumerationType())
 return makeIntVal(0, type);
@@ -359,7 +359,7 @@
 return makeBoolVal(cast(E));
 
   case Stmt::CXXNullPtrLiteralExprClass:
-return makeNull();
+return makeNullWithType(E->getType());
 
   case Stmt::CStyleCastExprClass:
   case Stmt::CXXFunctionalCastExprClass:
@@ -399,7 +399,7 @@
 
 if (Loc::isLocType(E->getType()))
   if (E->isNullPointerConstant(Ctx, Expr::NPC_ValueDependentIsNotNull))
-return makeNull();
+return makeNullWithType(E->getType());
 
 return None;
   }
Index: clang/lib/StaticAnalyzer/Core/RegionStore.cpp
===
--- clang/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ clang/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -2410,7 +2410,7 @@
   SVal V;
 
   if (Loc::isLocType(T))
-V = svalBuilder.makeNull();
+V = svalBuilder.makeNullWithType(T);
   else if (T->isIntegralOrEnumerationType())
 V = svalBuilder.makeZeroVal(T);
   else if (T->isStructureOrClassType() || T->isArrayType()) {
Index: clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
===
--- clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
+++ clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
@@ -460,7 +460,8 @@
 continue;
   } else {
 //

[PATCH] D119601: [analyzer] Refactor makeNull to makeNullWithWidth (NFC)

2022-03-19 Thread Vince Bridgers via Phabricator via cfe-commits
vabridgers added inline comments.



Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h:378
+type = type->isReferenceType()
+   ? Context.getPointerType(type->getPointeeType())
+   : type;

vabridgers wrote:
> NoQ wrote:
> > vabridgers wrote:
> > > NoQ wrote:
> > > > How do you discover the pointer width by looking only at the pointee 
> > > > type? Are objects of specific type always restricted to a specific 
> > > > address space? I.e., does every `int *` have the same width everywhere 
> > > > in the program? If not, how is this code supposed to work?
> > > The case this code addresses is represented in the test case 
> > > clang/test/Analysis/cast-value-notes.cpp, this function ...
> > > 
> > > ```
> > >  24 void evalReferences(const Shape &S) {
> > >  25   const auto &C = dyn_cast(S);
> > >  26   // expected-note@-1 {{Assuming 'S' is not a 'Circle'}}
> > >  27   // expected-note@-2 {{Dereference of null pointer}}
> > >  28   // expected-warning@-3 {{Dereference of null pointer}}
> > >  29 }
> > > 
> > > ```
> > > The crash occurs from line 25 above. 
> > > 
> > > Debug printing what I see at this point in the code for this case ...
> > > 
> > > ```
> > > QualType type : LValueReferenceType 0xffea820 'const class clang::Circle 
> > > &'
> > > `-QualType 0xffea7c1 'const class clang::Circle' const
> > >   `-SubstTemplateTypeParmType 0xffea7c0 'class clang::Circle' sugar
> > > |-TemplateTypeParmType 0xffe4f90 'X' dependent depth 0 index 0
> > > | `-TemplateTypeParm 0xffe4f40 'X'
> > > `-RecordType 0xffea090 'class clang::Circle'
> > >   `-CXXRecord 0xffea000 'Circle'
> > > 
> > > Context.getPointerType(type) : PointerType 0x10006ab0 'const class 
> > > clang::Circle &*'
> > > `-LValueReferenceType 0xffea820 'const class clang::Circle &'
> > >   `-QualType 0xffea7c1 'const class clang::Circle' const
> > > `-SubstTemplateTypeParmType 0xffea7c0 'class clang::Circle' sugar
> > >   |-TemplateTypeParmType 0xffe4f90 'X' dependent depth 0 index 0
> > >   | `-TemplateTypeParm 0xffe4f40 'X'
> > >   `-RecordType 0xffea090 'class clang::Circle'
> > > `-CXXRecord 0xffea000 'Circle'
> > > 
> > > Context.getPointerType(type->getPointeeType()) : PointerType 0x10006ae0 
> > > 'const class clang::Circle *'
> > > `-QualType 0xffea7c1 'const class clang::Circle' const
> > >   `-SubstTemplateTypeParmType 0xffea7c0 'class clang::Circle' sugar
> > > |-TemplateTypeParmType 0xffe4f90 'X' dependent depth 0 index 0
> > > | `-TemplateTypeParm 0xffe4f40 'X'
> > > `-RecordType 0xffea090 'class clang::Circle'
> > >   `-CXXRecord 0xffea000 'Circle'
> > > 
> > > ```
> > > The LValueReferenceType causes a crash if I do not get a pointer type, 
> > > looks like ... 
> > > 
> > > ```
> > > clang:  
> > > /clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h:219:
> > >  const llvm::APSInt& 
> > > clang::ento::BasicValueFactory::getZeroWithTypeSize(clang::QualType): 
> > > Assertion `T->isScalarType()' failed.
> > > 
> > > ```
> > > I'm assuming the pointer type retains the address space attribute of the 
> > > LValueReferenceType. 
> > > 
> > > Context.getPointerType(type->getPointeeType()) produces a QualType :  
> > > PointerType 'const class clang::Circle *' from an original QualType : 
> > > LValueReferenceType 'const class clang::Circle &'
> > > 
> > > Is this not what's wanted - a pointer type instead of a reference, with 
> > > the same address space qualifiers, or am I missing something in the 
> > > query? 
> > > 
> > > Thanks
> > Do I understand correctly that `__attribute__((address_space))` is a type 
> > attribute that gets applied to values rather than to pointers, so 
> > `__attribute__((address_space(3))) int *x` defines `x` as "pointer to (int 
> > that lives in address_space(3))", so when you unwrap the pointer type you 
> > get an "int that lives in address_space(3)"?
> > 
> > Can you share some dumps to demonstrate that the attribute is correctly 
> > preserved by this procedure? Damn, a test case could be great if we could 
> > have them.
> I'll see what can be done about a test case, and provide the dumps for 
> evaluation. Best
I developed "a" test methodology to demonstrate this at work. I modified the 
LIT case to use "dyn_cast(S)" and 
"dyn_cast<__attribute__((address_space(3))) Circle>(S)", checking the program 
state using clang_analyzer_printState(). Here's the info I see from the program 
state and from debug prints in each case. 

First, the "dyn_cast(S)" case.


```
void evalReferences(const Shape &S) {
  const auto &C = dyn_cast(S);
  clang_analyzer_printState();
  ...
}

  "dynamic_types": [
{ "region": "SymRegion{reg_$0}", "dyn_type": 
"const class clang::Circle &", "sub_classable": true }


QualType type : LValueReferenceType 0x1118ef60 'const class clang::Circle &'
`-QualType 0x1118ef01 'const class clang::Circle' const
  `-SubstTemplat

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

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



Comment at: llvm/test/Transforms/InstCombine/icmp-or.ll:371
+
+define i1 @ctpop_or_eq_to_ctpop(i32 %0) {
+; CHECK-LABEL: @ctpop_or_eq_to_ctpop(

Please add a test with vector type.



Comment at: llvm/test/Transforms/InstCombine/ispow2.ll:538
 
 ; Negative test - wrong predicate (but this could reduce).
 

Now reduced.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122077

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


[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-19 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2613
 
+  if (Value *V = foldOrOfCtpop(LHS, RHS, Builder))
+return V;

Should we also handle the opposite version `ctpop(x) != 1 && x != 0`?



Comment at: llvm/test/Transforms/InstCombine/icmp-or.ll:399
+  ret i1 %5
+}

Can you add a vector test as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122077

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


[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-19 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added inline comments.



Comment at: llvm/test/Transforms/InstCombine/icmp-or.ll:382
+  ret i1 %5
+}
+

What about if the ctpop has multi uses?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122077

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


[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-19 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/test/Transforms/InstCombine/icmp-or.ll:382
+  ret i1 %5
+}
+

RKSimon wrote:
> What about if the ctpop has multi uses?
The ctpop isn't being changed. Does it matter if it has more uses?

What is interesting is if the (icmp eq (ctpop(x)), 1) has another user other 
than the or.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122077

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


[PATCH] D122083: [Concepts] Fix placeholder constraints when references are involved

2022-03-19 Thread Roy Jacobson via Phabricator via cfe-commits
royjacobson created this revision.
Herald added a project: All.
royjacobson requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Placeholder types were not checked for constraint satisfaction when modified by 
references.
GitHub issue #54443


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122083

Files:
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/test/SemaTemplate/concepts.cpp


Index: clang/test/SemaTemplate/concepts.cpp
===
--- clang/test/SemaTemplate/concepts.cpp
+++ clang/test/SemaTemplate/concepts.cpp
@@ -171,7 +171,7 @@
 }
 
 namespace PR49188 {
-  template concept C = false; // expected-note 6 {{because 
'false' evaluated to false}}
+  template concept C = false; // expected-note 7 {{because 
'false' evaluated to false}}
 
   C auto f1() { // expected-error {{deduced type 'void' does not satisfy 'C'}}
 return void();
@@ -189,7 +189,7 @@
   }
   C decltype(auto) f6() { // expected-error {{deduced type 'void' does not 
satisfy 'C'}}
   }
-  C auto& f7() { // expected-error {{cannot form a reference to 'void'}}
+  C auto& f7() { // expected-error {{deduced type 'void' does not satisfy 'C'}}
 return void();
   }
   C auto& f8() {
@@ -222,3 +222,26 @@
 };
 void (*f2)() = B::f; // expected-error {{address of overloaded function 'f' 
does not match required type}}
 }
+
+namespace PR54443 {
+
+template 
+struct is_same { static constexpr bool value = false; };
+
+template 
+struct is_same { static constexpr bool value = true; };
+
+template 
+concept same_as = is_same::value; // expected-note-re 4 {{because {{.*}} 
evaluated to false}}
+
+int const &f();
+
+same_as auto i1 = f(); // expected-error {{deduced type 'int' does 
not satisfy 'same_as'}}
+same_as auto &i2 = f();
+same_as auto &&i3 = f(); // expected-error {{deduced type 'const 
int &' does not satisfy 'same_as'}}
+
+same_as auto i4 = f(); // expected-error {{deduced type 'int' 
does not satisfy 'same_as'}}
+same_as auto &i5 = f(); // expected-error {{deduced type 'const 
int' does not satisfy 'same_as'}}
+same_as auto &&i6 = f();
+
+}
Index: clang/lib/Sema/SemaTemplateDeduction.cpp
===
--- clang/lib/Sema/SemaTemplateDeduction.cpp
+++ clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -4769,7 +4769,8 @@
   return DAR_FailedAlreadyDiagnosed;
   }
 
-  if (const auto *AT = Type.getType()->getAs()) {
+  if (const auto *AT =
+  Type.getType().getNonReferenceType()->getAs()) {
 if (AT->isConstrained() && !IgnoreConstraints) {
   auto ConstraintsResult =
   CheckDeducedPlaceholderConstraints(*this, *AT,


Index: clang/test/SemaTemplate/concepts.cpp
===
--- clang/test/SemaTemplate/concepts.cpp
+++ clang/test/SemaTemplate/concepts.cpp
@@ -171,7 +171,7 @@
 }
 
 namespace PR49188 {
-  template concept C = false; // expected-note 6 {{because 'false' evaluated to false}}
+  template concept C = false; // expected-note 7 {{because 'false' evaluated to false}}
 
   C auto f1() { // expected-error {{deduced type 'void' does not satisfy 'C'}}
 return void();
@@ -189,7 +189,7 @@
   }
   C decltype(auto) f6() { // expected-error {{deduced type 'void' does not satisfy 'C'}}
   }
-  C auto& f7() { // expected-error {{cannot form a reference to 'void'}}
+  C auto& f7() { // expected-error {{deduced type 'void' does not satisfy 'C'}}
 return void();
   }
   C auto& f8() {
@@ -222,3 +222,26 @@
 };
 void (*f2)() = B::f; // expected-error {{address of overloaded function 'f' does not match required type}}
 }
+
+namespace PR54443 {
+
+template 
+struct is_same { static constexpr bool value = false; };
+
+template 
+struct is_same { static constexpr bool value = true; };
+
+template 
+concept same_as = is_same::value; // expected-note-re 4 {{because {{.*}} evaluated to false}}
+
+int const &f();
+
+same_as auto i1 = f(); // expected-error {{deduced type 'int' does not satisfy 'same_as'}}
+same_as auto &i2 = f();
+same_as auto &&i3 = f(); // expected-error {{deduced type 'const int &' does not satisfy 'same_as'}}
+
+same_as auto i4 = f(); // expected-error {{deduced type 'int' does not satisfy 'same_as'}}
+same_as auto &i5 = f(); // expected-error {{deduced type 'const int' does not satisfy 'same_as'}}
+same_as auto &&i6 = f();
+
+}
Index: clang/lib/Sema/SemaTemplateDeduction.cpp
===
--- clang/lib/Sema/SemaTemplateDeduction.cpp
+++ clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -4769,7 +4769,8 @@
   return DAR_FailedAlreadyDiagnosed;
   }
 
-  if (const auto *AT = Type.getType()->getAs()) {
+  if (const auto *AT =
+  Type.getType().getNonReferenceType()->getAs()) {
 if (AT->isConstrained() && !IgnoreConstraints) {
   auto ConstraintsResult =
   CheckDeducedPlaceholderCo

[PATCH] D122085: Add clang DirectX target support

2022-03-19 Thread Chris Bieneman via Phabricator via cfe-commits
beanz created this revision.
beanz added reviewers: MaskRay, tstellar, pete, jdoerfert, sheredom, kuhar, 
antiagainst, nhaehnle, rnk.
Herald added a subscriber: mgorny.
Herald added a project: All.
beanz requested review of this revision.
Herald added a project: clang.

This change adds a stub DirectX target for clang to enable targeting
dxil targets.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122085

Files:
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/DirectX.cpp
  clang/lib/Basic/Targets/DirectX.h
  clang/test/CodeGenHLSL/basic-target.c
  clang/test/CodeGenHLSL/lit.local.cfg

Index: clang/test/CodeGenHLSL/lit.local.cfg
===
--- /dev/null
+++ clang/test/CodeGenHLSL/lit.local.cfg
@@ -0,0 +1 @@
+config.suffixes = ['.c', '.hlsl']
Index: clang/test/CodeGenHLSL/basic-target.c
===
--- /dev/null
+++ clang/test/CodeGenHLSL/basic-target.c
@@ -0,0 +1,10 @@
+// RUN: %clang -target dxil-pc-shadermodel6.0-pixel -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang -target dxil-pc-shadermodel6.0-vertex -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang -target dxil-pc-shadermodel6.0-compute -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang -target dxil-pc-shadermodel6.0-library -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang -target dxil-pc-shadermodel6.0-hull -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang -target dxil-pc-shadermodel6.0-domain -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang -target dxil-pc-shadermodel6.0-geometry -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
+// CHECK: target triple = "dxil-pc-shadermodel6.0-{{[a-z]+}}"
Index: clang/lib/Basic/Targets/DirectX.h
===
--- /dev/null
+++ clang/lib/Basic/Targets/DirectX.h
@@ -0,0 +1,92 @@
+//===--- DirectX.h - Declare DirectX target feature support -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file declares DXIL TargetInfo objects.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_DIRECTX_H
+#define LLVM_CLANG_LIB_BASIC_TARGETS_DIRECTX_H
+#include "clang/Basic/TargetInfo.h"
+#include "clang/Basic/TargetOptions.h"
+#include "llvm/ADT/Triple.h"
+#include "llvm/Support/Compiler.h"
+
+namespace clang {
+namespace targets {
+
+static const unsigned DirectXAddrSpaceMap[] = {
+0, // Default
+1, // opencl_global
+3, // opencl_local
+2, // opencl_constant
+0, // opencl_private
+4, // opencl_generic
+5, // opencl_global_device
+6, // opencl_global_host
+0, // cuda_device
+0, // cuda_constant
+0, // cuda_shared
+// SYCL address space values for this map are dummy
+0, // sycl_global
+0, // sycl_global_device
+0, // sycl_global_host
+0, // sycl_local
+0, // sycl_private
+0, // ptr32_sptr
+0, // ptr32_uptr
+0  // ptr64
+};
+
+class LLVM_LIBRARY_VISIBILITY DirectXTargetInfo : public TargetInfo {
+public:
+  DirectXTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
+  : TargetInfo(Triple) {
+TLSSupported = false;
+VLASupported = false;
+LongWidth = LongAlign = 64;
+AddrSpaceMap = &DirectXAddrSpaceMap;
+UseAddrSpaceMapMangling = true;
+HasLegalHalfType = true;
+HasFloat16 = true;
+NoAsmVariants = true;
+resetDataLayout("e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:"
+"32-f64:64-n8:16:32:64");
+  }
+
+  void getTargetDefines(const LangOptions &Opts,
+MacroBuilder &Builder) const override;
+
+  bool hasFeature(StringRef Feature) const override {
+return Feature == "directx";
+  }
+
+  ArrayRef getTargetBuiltins() const override { return None; }
+
+  const char *getClobbers() const override { return ""; }
+
+  ArrayRef getGCCRegNames() const override { return None; }
+
+  bool validateAsmConstraint(const char *&Name,
+ TargetInfo::ConstraintInfo &info) const override {
+return true;
+  }
+
+  ArrayRef getGCCRegAliases() const override {
+return None;
+  }
+
+  BuiltinVaListKind getBuiltinVaListKind() const override {
+return TargetInfo::VoidPtrBuiltinVaList;
+  }
+};
+
+} // namespace targets
+} // namespace clang
+
+#endif // LLVM_CLANG_LIB_BASIC_TARGETS_DIRECTX_H
Index: clang/lib/Basic/Targets/DirectX.cpp
===
--- /dev/null
+++ clang/lib/Basic/Targets/DirectX.c

[PATCH] D122085: Add clang DirectX target support

2022-03-19 Thread Pete Cooper via Phabricator via cfe-commits
pete accepted this revision.
pete added a comment.
This revision is now accepted and ready to land.

All seems very reasonable to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122085

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


[PATCH] D122087: Add HLSL Language Option and Preprocessor

2022-03-19 Thread Chris Bieneman via Phabricator via cfe-commits
beanz created this revision.
beanz added reviewers: MaskRay, tstellar, pete, jdoerfert, sheredom, kuhar, 
antiagainst, nhaehnle, rnk.
Herald added a subscriber: dexonsmith.
Herald added a project: All.
beanz requested review of this revision.
Herald added a project: clang.

Bringing in HLSL as a language as well as language options for each of
the HLSL language standards.

While the HLSL language is unimplemented, this patch adds the
HLSL-specific preprocessor defines which enables testing of the command
line options through the driver.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122087

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Basic/LangStandard.h
  clang/include/clang/Basic/LangStandards.def
  clang/include/clang/Driver/Types.def
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Frontend/FrontendActions.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Driver/lit.local.cfg
  clang/test/Preprocessor/predefined-macros-hlsl.c
  clang/test/lit.cfg.py

Index: clang/test/lit.cfg.py
===
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -25,7 +25,7 @@
 config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
 
 # suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.c', '.cpp', '.i', '.cppm', '.m', '.mm', '.cu', '.hip',
+config.suffixes = ['.c', '.cpp', '.i', '.cppm', '.m', '.mm', '.cu', '.hip', '.hlsl',
'.ll', '.cl', '.clcpp', '.s', '.S', '.modulemap', '.test', '.rs', '.ifs', '.rc']
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
Index: clang/test/Preprocessor/predefined-macros-hlsl.c
===
--- /dev/null
+++ clang/test/Preprocessor/predefined-macros-hlsl.c
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -triple dxil-pc-shadermodel6.0-amplification | FileCheck -match-full-lines %s --check-prefixes=CHECK,AMPLIFICATION
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -triple dxil-pc-shadermodel6.0-compute | FileCheck -match-full-lines %s --check-prefixes=CHECK,COMPUTE
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -triple dxil-pc-shadermodel6.0-domain | FileCheck -match-full-lines %s --check-prefixes=CHECK,DOMAIN
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -triple dxil-pc-shadermodel6.0-geometry | FileCheck -match-full-lines %s --check-prefixes=CHECK,GEOMETRY
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -triple dxil-pc-shadermodel6.0-hull | FileCheck -match-full-lines %s --check-prefixes=CHECK,HULL
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -triple dxil-pc-shadermodel6.0-library | FileCheck -match-full-lines %s --check-prefixes=CHECK,LIBRARY
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -triple dxil-pc-shadermodel6.0-mesh | FileCheck -match-full-lines %s --check-prefixes=CHECK,MESH
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -triple dxil-pc-shadermodel6.0-pixel | FileCheck -match-full-lines %s --check-prefixes=CHECK,PIXEL
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -triple dxil-pc-shadermodel6.0-vertex | FileCheck -match-full-lines %s --check-prefixes=CHECK,VERTEX
+
+// CHECK: #define __HLSL_VERSION 2021
+// CHECK: #define __SHADER_STAGE_AMPLIFICATION 14
+// CHECK: #define __SHADER_STAGE_COMPUTE 5
+// CHECK: #define __SHADER_STAGE_DOMAIN 4
+// CHECK: #define __SHADER_STAGE_GEOMETRY 2
+// CHECK: #define __SHADER_STAGE_HULL 3
+// CHECK: #define __SHADER_STAGE_LIBRARY 6
+// CHECK: #define __SHADER_STAGE_MESH 13
+// CHECK: #define __SHADER_STAGE_PIXEL 0
+// CHECK: #define __SHADER_STAGE_VERTEX 1
+
+// AMPLIFICATION: #define __SHADER_TARGET_STAGE 14
+// COMPUTE: #define __SHADER_TARGET_STAGE 5
+// DOMAIN: #define __SHADER_TARGET_STAGE 4
+// GEOMETRY: #define __SHADER_TARGET_STAGE 2
+// HULL: #define __SHADER_TARGET_STAGE 3
+// LIBRARY: #define __SHADER_TARGET_STAGE 6
+// MESH: #define __SHADER_TARGET_STAGE 13
+// PIXEL: #define __SHADER_TARGET_STAGE 0
+// VERTEX: #define __SHADER_TARGET_STAGE 1
+
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -std=hlsl2015 | FileCheck -match-full-lines %s --check-prefixes=STD2015
+// STD2015: #define __HLSL_VERSION 2015
+
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -std=hlsl2016 | FileCheck -match-full-lines %s --check-prefixes=STD2016
+// STD2016: #define __HLSL_VERSION 2016
+
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -std=hlsl2017 | FileCheck -match-full-lines %s --check-prefixes=STD2017
+// STD2017: #define __HLSL_VERSION 2017
+
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -std=hlsl2018 | FileCheck -match-full-lines %s --check-prefixes=STD2018
+// STD2018: #define __HLSL_VERSION 2018
+
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -std=hlsl2021 | FileCheck -match-full-lines %s --check-prefixes=STD2021
+// STD2021: #define __HLSL_VERSION 2021
+
+// RUN: %clang_cc1 %s -E -dM -o - -x hlsl -std=hlsl202x | FileCheck -match-full-lines %s --check-prefixes=STD202x
+// STD20

[PATCH] D122089: [CUDA] Add getTargetFeatures for the NVPTX toolchain

2022-03-19 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, tra, tianshilei1992, yaxunl.
Herald added a subscriber: asavonic.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

The NVPTX toolchain uses target features to determine the PTX version to
use. However this isn't exposed externally like most other toolchain
specific target features are. Add this functionaliy in preparation for
using it in for OpenMP offloading.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122089

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/lib/Driver/ToolChains/Cuda.h

Index: clang/lib/Driver/ToolChains/Cuda.h
===
--- clang/lib/Driver/ToolChains/Cuda.h
+++ clang/lib/Driver/ToolChains/Cuda.h
@@ -124,6 +124,11 @@
  const char *LinkingOutput) const override;
 };
 
+void getNVPTXTargetFeatures(const Driver &D, const llvm::Triple &Triple,
+const llvm::opt::ArgList &Args,
+std::vector &Features,
+Optional CudaVersion = None);
+
 } // end namespace NVPTX
 } // end namespace tools
 
Index: clang/lib/Driver/ToolChains/Cuda.cpp
===
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -630,6 +630,43 @@
   Exec, CmdArgs, Inputs, Output));
 }
 
+void NVPTX::getNVPTXTargetFeatures(const Driver &D, const llvm::Triple &Triple,
+   const llvm::opt::ArgList &Args,
+   std::vector &Features,
+   Optional CudaVersion) {
+  if (!CudaVersion) {
+CudaInstallationDetector CudaInstallation(D, Triple, Args);
+CudaVersion = CudaInstallation.version();
+  }
+
+  // New CUDA versions often introduce new instructions that are only supported
+  // by new PTX version, so we need to raise PTX level to enable them in NVPTX
+  // back-end.
+  const char *PtxFeature = nullptr;
+  switch (*CudaVersion) {
+#define CASE_CUDA_VERSION(CUDA_VER, PTX_VER)   \
+  case CudaVersion::CUDA_##CUDA_VER:   \
+PtxFeature = "+ptx" #PTX_VER;  \
+break;
+CASE_CUDA_VERSION(115, 75);
+CASE_CUDA_VERSION(114, 74);
+CASE_CUDA_VERSION(113, 73);
+CASE_CUDA_VERSION(112, 72);
+CASE_CUDA_VERSION(111, 71);
+CASE_CUDA_VERSION(110, 70);
+CASE_CUDA_VERSION(102, 65);
+CASE_CUDA_VERSION(101, 64);
+CASE_CUDA_VERSION(100, 63);
+CASE_CUDA_VERSION(92, 61);
+CASE_CUDA_VERSION(91, 61);
+CASE_CUDA_VERSION(90, 60);
+#undef CASE_CUDA_VERSION
+  default:
+PtxFeature = "+ptx42";
+  }
+  Features.push_back(PtxFeature);
+}
+
 /// CUDA toolchain.  Our assembler is ptxas, and our "linker" is fatbinary,
 /// which isn't properly a linker but nonetheless performs the step of stitching
 /// together object files from the assembler into a single blob.
@@ -701,32 +738,11 @@
 
   clang::CudaVersion CudaInstallationVersion = CudaInstallation.version();
 
-  // New CUDA versions often introduce new instructions that are only supported
-  // by new PTX version, so we need to raise PTX level to enable them in NVPTX
-  // back-end.
-  const char *PtxFeature = nullptr;
-  switch (CudaInstallationVersion) {
-#define CASE_CUDA_VERSION(CUDA_VER, PTX_VER)   \
-  case CudaVersion::CUDA_##CUDA_VER:   \
-PtxFeature = "+ptx" #PTX_VER;  \
-break;
-CASE_CUDA_VERSION(115, 75);
-CASE_CUDA_VERSION(114, 74);
-CASE_CUDA_VERSION(113, 73);
-CASE_CUDA_VERSION(112, 72);
-CASE_CUDA_VERSION(111, 71);
-CASE_CUDA_VERSION(110, 70);
-CASE_CUDA_VERSION(102, 65);
-CASE_CUDA_VERSION(101, 64);
-CASE_CUDA_VERSION(100, 63);
-CASE_CUDA_VERSION(92, 61);
-CASE_CUDA_VERSION(91, 61);
-CASE_CUDA_VERSION(90, 60);
-#undef CASE_CUDA_VERSION
-  default:
-PtxFeature = "+ptx42";
-  }
-  CC1Args.append({"-target-feature", PtxFeature});
+  std::vector Features;
+  NVPTX::getNVPTXTargetFeatures(getDriver(), getTriple(), DriverArgs, Features,
+CudaInstallationVersion);
+  for (StringRef PtxFeature : Features)
+CC1Args.append({"-target-feature", DriverArgs.MakeArgString(PtxFeature)});
   if (DriverArgs.hasFlag(options::OPT_fcuda_short_ptr,
  options::OPT_fno_cuda_short_ptr, false))
 CC1Args.append({"-mllvm", "--nvptx-short-ptr"});
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cp

[PATCH] D122069: [Clang] Add binary format for bundling offloading metadata

2022-03-19 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 updated this revision to Diff 416749.
jhuber6 added a comment.

Changing to add alignment to the global variable. Should ensure that the section
alignment is correct.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122069

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Basic/Offloading.h
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/Offloading.cpp
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/openmp-offload-gpu.c
  clang/test/Frontend/embed-object.c
  clang/test/Frontend/embed-object.ll
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  llvm/include/llvm/Transforms/Utils/ModuleUtils.h
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp

Index: llvm/lib/Transforms/Utils/ModuleUtils.cpp
===
--- llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -265,15 +265,15 @@
 }
 
 void llvm::embedBufferInModule(Module &M, MemoryBufferRef Buf,
-   StringRef SectionName) {
-  // Embed the buffer into the module.
+   StringRef SectionName, Align Alignment) {
+  // Embed the memory buffer into the module.
   Constant *ModuleConstant = ConstantDataArray::get(
   M.getContext(), makeArrayRef(Buf.getBufferStart(), Buf.getBufferSize()));
   GlobalVariable *GV = new GlobalVariable(
-  M, ModuleConstant->getType(), true, GlobalValue::ExternalLinkage,
-  ModuleConstant, SectionName.drop_front());
+  M, ModuleConstant->getType(), true, GlobalValue::PrivateLinkage,
+  ModuleConstant, "llvm.embedded.object");
   GV->setSection(SectionName);
-  GV->setVisibility(GlobalValue::HiddenVisibility);
+  GV->setAlignment(Alignment);
 
   appendToCompilerUsed(M, GV);
 }
Index: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===
--- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -447,7 +447,7 @@
   Name == getInstrProfSectionName(IPSK_covfun, Triple::ELF,
   /*AddSegmentInfo=*/false) ||
   Name == ".llvmbc" || Name == ".llvmcmd" ||
-  Name.startswith(".llvm.offloading."))
+  Name.startswith(".llvm.offloading"))
 return SectionKind::getMetadata();
 
   if (Name.empty() || Name[0] != '.') return K;
Index: llvm/include/llvm/Transforms/Utils/ModuleUtils.h
===
--- llvm/include/llvm/Transforms/Utils/ModuleUtils.h
+++ llvm/include/llvm/Transforms/Utils/ModuleUtils.h
@@ -14,6 +14,7 @@
 #define LLVM_TRANSFORMS_UTILS_MODULEUTILS_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Alignment.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include  // for std::pair
 
@@ -109,7 +110,8 @@
 
 /// Embed the memory buffer \p Buf into the module \p M as a global using the
 /// specified section name.
-void embedBufferInModule(Module &M, MemoryBufferRef Buf, StringRef SectionName);
+void embedBufferInModule(Module &M, MemoryBufferRef Buf, StringRef SectionName,
+ Align Alignment = Align(1));
 
 class CallInst;
 namespace VFABI {
Index: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
===
--- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -15,6 +15,7 @@
 //===-===//
 
 #include "OffloadWrapper.h"
+#include "clang/Basic/Offloading.h"
 #include "clang/Basic/Version.h"
 #include "llvm/BinaryFormat/Magic.h"
 #include "llvm/Bitcode/BitcodeWriter.h"
@@ -47,6 +48,7 @@
 #include "llvm/Target/TargetMachine.h"
 
 using namespace llvm;
+using namespace clang;
 using namespace llvm::object;
 
 static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden);
@@ -146,9 +148,10 @@
 static codegen::RegisterCodeGenFlags CodeGenFlags;
 
 /// Magic section string that marks the existence of offloading data. The
-/// section string will be formatted as `.llvm.offloading..`.
-#define OFFLOAD_SECTION_MAGIC_STR ".llvm.offloading."
+/// section will contain one or more offloading binaries stored contiguously.
+#define OFFLOAD_SECTION_MAGIC_STR ".llvm.offloading"
 
+// TODO: Replace all uses of DeviceFile with OffloadFile.
 /// Information for a device offloading file extracted from the host.
 struct DeviceFile {
   DeviceFile(StringRef Kind, StringRef TheTriple, StringRef Arch,
@@ -201,16 +204,6 @@
 llvm::errs() << *IC << (std::next(IC) != IE ? " " : "\n");
 }
 
-static StringRef getDeviceFileExtension(StringRef DeviceTriple,
-bool IsBitcode = false) {
-  Triple

[PATCH] D122087: Add HLSL Language Option and Preprocessor

2022-03-19 Thread Pete Cooper via Phabricator via cfe-commits
pete accepted this revision.
pete 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/D122087/new/

https://reviews.llvm.org/D122087

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


[PATCH] D111400: [Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr

2022-03-19 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

> I think labels can be left as is.

Yes, the `static`, `thread_local`, label, and `goto` cases would all 
categorically contribute to a IFNDR program in the older modes (and we 
currently reliably diagnose them in the definition context).




Comment at: clang/lib/Sema/SemaDeclCXX.cpp:1904-1906
+if (!SemaRef.LangOpts.CPlusPlus2b &&
+CheckLiteralType(SemaRef, Kind, VD->getLocation(), VD->getType(),
  diag::err_constexpr_local_var_non_literal_type,

cor3ntin wrote:
> hubert.reinterpretcast wrote:
> > This seems to unconditionally error in pre-C++2b modes. For consistency, 
> > this should be a `-Wc++2b-extensions` warning.
> We agreed not have this an extension in earlier modes because a valid c++20 
> program can sfinea on that. Is it not a direction you agree with anymore>
I think, now that we have the lambda cases all working, we can be confident 
that `return false;` in older modes is what this code is responsible for in the 
SFINAE case.

For handling SFINAE-related cases, there may (eventually) be some restructuring 
to allow focus on only the template-dependent cases, but C++23 might end up 
needing to do the checking even for non-dependent cases during constant 
expression evaluation (because the template definition becomes well-formed due 
to pending removal of IFNDR).

I've also found indications that Clang generally fails to perform strict 
constant expression evaluation in relation to instantiations that fail to 
satisfy the requirements for a constexpr function:
```
template 
struct A {
  constexpr int f() {
T t;  // cannot be trivial default initialization until P1331
  // (not DR out of Cologne 2019)
t = T();
return 42 + t;
  }
};

template 
short g(int, char (*)[N] = 0);

template 
long g(void *);

struct Z {
  constexpr Z() {}
  constexpr operator int() { return 0; }
};
const int x = A().f();

extern decltype(g(0)) q;
short q;
```




Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp:1-3
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu 
-std=c++11 -Werror=c++14-extensions -Werror=c++20-extensions 
-Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu 
-std=c++14 -DCXX14 -Werror=c++20-extensions -Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu 
-std=c++20 -DCXX14 -DCXX20 -Werror=c++2b-extensions %s

cor3ntin wrote:
> hubert.reinterpretcast wrote:
> > The use `-Werror` hides potential issues where the error is categorically 
> > produced (instead of under the warning group).
> > 
> > Considering that there is a relevant design consistency issue of exactly 
> > that sort right now that this test could have highlighted (but didn't), a 
> > change to stop using `-Werror` may be prudent.
> This seems inconsistent with how that file is currently structured though
I meant to change the entire file to check for warnings instead of errors. I 
guess that really should be a separate patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400

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


[PATCH] D97625: fix check-clang-tools tests that fail due to Windows CRLF line endings

2022-03-19 Thread Brian Cain via Phabricator via cfe-commits
bcain added a comment.
Herald added a project: All.

In D97625#3337018 , @dmgreen wrote:

> Hello. I noticed this was applied to the base /test directory in the llvm 
> repo: https://github.com/llvm/llvm-project/tree/main/test
> Was it intended be in clang-tools-extra: 
> https://github.com/llvm/llvm-project/tree/main/clang-tools-extra/test? I'm 
> not sure it will do much where it is.

It's almost certainly the case.

@LegalizeAdulthood this commit should be reverted.  If it makes sense, it could 
be re-applied to `clang-tools-extra/test/`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97625

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


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

2022-03-19 Thread Ben Shi via Phabricator via cfe-commits
benshi001 added a comment.

I summary my suggestion in general, excluding some inline comments about coding 
details.

1. Seperate the location movement of test files into a different patch A.
2. Seperate the elimination of `AVRRelaxMemPass` / combination into 
`expand` to a different patch B.

3. I also concern current solution is a bit agresssive, so I would like to 
suggest a moderate way.

3.1 Kill the function `fixStackStores` and its orginal calls.
3.2 Mark the definition of `STDWSPQRr`/`STDSPQRr` with `Defs = [R31R30]` (Most 
ordinary `STDWSPQRr`/`STDSPQRr` will be substituted before regalloc, so that is 
fine.)
3.3 Still implement `expand` and `expand` as 
current patch does, but do not substitute to 
`AVR::STDPtrQRr`/`AVR::STDWPtrQRr`, we should do real instruction expansion 
with several `buildMI` calls. Since we have marked `Defs = [R31R30]` to 
`STDWSPQRr`/`STDSPQRr`, it is safe to expand to

  in r30, 62
  in r31, 63
  subiw z, offset
  std z, Rsrc


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114611

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


[PATCH] D111400: [Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr

2022-03-19 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3-2b.cpp:17-22
+constexpr int g() { // expected-error {{constexpr function never produces a 
constant expression}}
+  goto test;// expected-note {{subexpression not valid in a constant 
expression}} \
+   // expected-warning {{use of this statement in a constexpr function 
is incompatible with C++ standards before C++2b}}
+test:
+  return 0;
+}

Still trying to make the choice of tests consistent between the different cases 
(static local variable, goto statement, etc.) and consistent within files...

The test that is here (function will unconditionally evaluate) seems to belong 
in `constant-expression-cxx2b.cpp`... or at least that is where the equivalent 
tests for the static local variable case, etc. is (and correctly, I think).

The test that should be here is the "conditionally will evaluate" case where 
the function is not called. That is, this file has tests that check that the 
warnings are produced purely from the definition being present.



Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3-2b.cpp:32-34
+constexpr void non_literal() { // expected-error {{constexpr function never 
produces a constant expression}}
+  NonLiteral n;// expected-note {{non-literal type 
'NonLiteral' cannot be used in a constant expression}}
+}

For the reason above, I think this should be in `constant-expression-cxx2b.cpp` 
instead.



Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp:1-3
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu 
-std=c++11 -Werror=c++14-extensions -Werror=c++20-extensions 
-Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu 
-std=c++14 -DCXX14 -Werror=c++20-extensions -Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu 
-std=c++20 -DCXX14 -DCXX20 -Werror=c++2b-extensions %s

hubert.reinterpretcast wrote:
> cor3ntin wrote:
> > hubert.reinterpretcast wrote:
> > > The use `-Werror` hides potential issues where the error is categorically 
> > > produced (instead of under the warning group).
> > > 
> > > Considering that there is a relevant design consistency issue of exactly 
> > > that sort right now that this test could have highlighted (but didn't), a 
> > > change to stop using `-Werror` may be prudent.
> > This seems inconsistent with how that file is currently structured though
> I meant to change the entire file to check for warnings instead of errors. I 
> guess that really should be a separate patch.
I guess the change will cause the "never produces a constant expression" 
warning unless if that is suppressed with `-Wno-invalid-constexpr`.



Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:95
+} // namespace eval_goto
+
+int test_in_lambdas() {

I see no tests in the entire patch where a labelled statement is evaluated 
successfully in a constant expression evaluation. This file will be where such 
a test should be.



Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:96-123
+int test_in_lambdas() {
+  auto a = [] constexpr {// expected-error{{constexpr function never 
produces a constant expression}}
+static const int m = 32; // expected-note {{control flows through the 
declaration of a static variable}} \
+ // expected-warning {{incompatible with C++ 
standards before C++2b}}
+return m;
+  };
+

I think it would be more meaningful to have the explicitly `constexpr` lambda 
tests in the file (see comment on the later code below) that also runs under 
C++20 mode. The tests should be structured to demonstrate that the explicitly 
`constexpr` lambdas are usable in constant expression evaluation even in older 
modes.



Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:125-154
+int test_lambdas_implicitly_constexpr() {
+  auto a = [] {
+static const int m = 32;
+return m;
+  };
+
+  auto b = [](int n) {

It is quite important that all of the cases (label, `goto`, `static`, 
`thread_local`, and non-literal) is tested in lambdas not explicitly 
`constexpr` and run in C++20 mode too. The focus should be that:

  - the cases that are implicitly constexpr only in C++2b are not usable in 
constant expression evaluation in C++20 mode, and
  - they //are// usable in constant expression evaluation in C++2b mode.

I suggest a separate file for this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400

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


[PATCH] D111400: [Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr

2022-03-19 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/dtor.cpp:26
   };
-  struct Nonlit { Nonlit(); }; // expected-note {{not literal}}
+  struct Nonlit { // cxx2a-note {{'Nonlit' is not literal becaus}}
+Nonlit();

s/becaus/because/;




Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3-2b.cpp:36-39
+constexpr void non_literal2(bool b) {
+  if (!b)
+NonLiteral n;
+}

There should be a version of this in `constant-expression-cxx2b.cpp` where the 
function is called successfully during constant expression evaluation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400

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