[PATCH] D110209: [CSSPGO] Set PseudoProbeInserter as a default pass.

2021-09-21 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

lld/test/ELF/lto/pseudo-probe-lto.ll needs update


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110209

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


[PATCH] D109818: [HIPSPV] Convert HIP kernels to SPIR-V kernels

2021-09-21 Thread Henry Linjamäki via Phabricator via cfe-commits
linjamaki added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:10221
+ABIArgInfo SPIRABIInfo::classifyKernelArgumentType(QualType Ty) const {
+  if (getContext().getLangOpts().HIP && getTarget().getTriple().isSPIRV()) {
+// Coerce pointer arguments with default address space to CrossWorkGroup

Anastasia wrote:
> It feels like this needs to be in `SPIRVABIInfo`  or something? Or can this 
> be generalized to both  - SPIR and SPIR-V?
A comment was added in D109144 to state that the SPIRABIInfo is an ABI 
implementation for both the SPIR and SPIR-V. For now, there is not much 
difference between SPIR and SPIR-V for this class. Would it be satisfactory if 
the class is renamed to something more general (like CommonSPIRABIInfo)?



Comment at: clang/lib/CodeGen/TargetInfo.cpp:10224
+// pointers for HIPSPV. When the language mode is HIP, the SPIRTargetInfo
+// maps cuda_device to SPIR-V's CrossWorkGroup address space.
+llvm::Type *LTy = CGT.ConvertType(Ty);

Anastasia wrote:
> Can you explain why this mapping is needed? We already have an address space 
> map to perform the mapping of address spaces b/w language and target. It 
> would be good if we don't replicate similar logic in too many places.
HIP does not require address space qualifiers on kernel pointer arguments (e.g. 
see hipspv-kernel.cpp) nor there are AS qualifiers that can be placed on them. 
With the default logic, provided by SPIRVTargetInfo’s address space map, the 
kernel pointer arguments get converted to generic pointers which are not 
allowed by the OpenCL SPIR-V Environment Specification.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109818

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


[PATCH] D93298: [RISCV] add the MC layer support of Zfinx extension

2021-09-21 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVRegisterInfo.td:539
 
+let RegAltNameIndices = [ABIRegAltName] in {
+  foreach Index = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22,

This needs to be coordinated with D95588; you both define GPR pairs for RV32 
but in different ways. There needs to be only one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93298

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


[PATCH] D93298: [RISCV] add the MC layer support of Zfinx extension

2021-09-21 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added a comment.

The amount of duplication here really depresses me and is only going to get 
worse once codegen is added, but TableGen isn't able to have operands that use 
different register classes based on even HwMode, that I know of, and whilst you 
could make use of multi classes to generate both versions of the instructions 
you can't easily do that for patterns, so I don't know what the right answer is.




Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoZdinx.td:193
+let Predicates = [HasStdExtZdinx, IsRV32] in {
+let DecoderNamespace = "RV32DZfinx" in {
+def FMADD_D_IN32X  : FPFMADINX_rrr_frm,

Old extension name


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93298

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


[clang] 2ff049b - DebugInfo: Don't use preferred template names in debug info

2021-09-21 Thread David Blaikie via cfe-commits

Author: David Blaikie
Date: 2021-09-21T20:08:16-07:00
New Revision: 2ff049b12ee3fb60581835a28bf9d0acc1723f23

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

LOG: DebugInfo: Don't use preferred template names in debug info

Using the preferred name creates a mismatch between the textual name of
a type and the DWARF tags describing the parameters as well as possible
inconsistency between DWARF producers (like Clang and GCC, or
older/newer Clang versions, etc).

Added: 


Modified: 
clang/include/clang/AST/PrettyPrinter.h
clang/lib/AST/TypePrinter.cpp
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/debug-info-template.cpp

Removed: 




diff  --git a/clang/include/clang/AST/PrettyPrinter.h 
b/clang/include/clang/AST/PrettyPrinter.h
index 3baf2b2ba94d6..8cab7f1895598 100644
--- a/clang/include/clang/AST/PrettyPrinter.h
+++ b/clang/include/clang/AST/PrettyPrinter.h
@@ -74,7 +74,8 @@ struct PrintingPolicy {
 MSWChar(LO.MicrosoftExt && !LO.WChar), IncludeNewlines(true),
 MSVCFormatting(false), ConstantsAsWritten(false),
 SuppressImplicitBase(false), FullyQualifiedName(false),
-PrintCanonicalTypes(false), PrintInjectedClassNameWithArguments(true) 
{}
+PrintCanonicalTypes(false), PrintInjectedClassNameWithArguments(true),
+UsePreferredNames(true) {}
 
   /// Adjust this printing policy for cases where it's known that we're
   /// printing C++ code (for instance, if AST dumping reaches a C++-only
@@ -272,6 +273,7 @@ struct PrintingPolicy {
   /// written. When a template argument is unnamed, printing it results in
   /// invalid C++ code.
   unsigned PrintInjectedClassNameWithArguments : 1;
+  unsigned UsePreferredNames : 1;
 
   /// Callbacks to use to allow the behavior of printing to be customized.
   const PrintingCallbacks *Callbacks = nullptr;

diff  --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp
index 749a3e25d28a4..3c7a6b8b9e953 100644
--- a/clang/lib/AST/TypePrinter.cpp
+++ b/clang/lib/AST/TypePrinter.cpp
@@ -1370,9 +1370,11 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream ) {
 
 void TypePrinter::printRecordBefore(const RecordType *T, raw_ostream ) {
   // Print the preferred name if we have one for this type.
-  for (const auto *PNA : T->getDecl()->specific_attrs()) {
-if (declaresSameEntity(PNA->getTypedefType()->getAsCXXRecordDecl(),
-   T->getDecl())) {
+  if (Policy.UsePreferredNames) {
+for (const auto *PNA : T->getDecl()->specific_attrs()) {
+  if (!declaresSameEntity(PNA->getTypedefType()->getAsCXXRecordDecl(),
+  T->getDecl()))
+continue;
   // Find the outermost typedef or alias template.
   QualType T = PNA->getTypedefType();
   while (true) {

diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 8660e23726b35..5889647e2de96 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -245,6 +245,7 @@ PrintingPolicy CGDebugInfo::getPrintingPolicy() const {
 
   PP.SuppressInlineNamespace = false;
   PP.PrintCanonicalTypes = true;
+  PP.UsePreferredNames = false;
 
   // Apply -fdebug-prefix-map.
   PP.Callbacks = 

diff  --git a/clang/test/CodeGenCXX/debug-info-template.cpp 
b/clang/test/CodeGenCXX/debug-info-template.cpp
index 546fe01833a7c..ba25e2136b221 100644
--- a/clang/test/CodeGenCXX/debug-info-template.cpp
+++ b/clang/test/CodeGenCXX/debug-info-template.cpp
@@ -258,3 +258,15 @@ template void f1();
 // CHECK: ![[TEMP_TEMP_INL_ARGS]] = !{![[TEMP_TEMP_INL_ARGS_T:[0-9]*]]}
 // CHECK: ![[TEMP_TEMP_INL_ARGS_T]] = !DITemplateValueParameter(tag: 
DW_TAG_GNU_template_template_param, value: 
!"TemplateTemplateParamInlineNamespace::inl::t1")
 } // namespace TemplateTemplateParamInlineNamespace
+
+namespace NoPreferredNames {
+template  struct t1;
+using t1i = t1;
+template 
+struct __attribute__((__preferred_name__(t1i))) t1 {};
+template 
+void f1() {}
+template void f1>();
+// CHECK: !DISubprogram(name: "f1 >",
+
+} // namespace NoPreferredNames



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


[PATCH] D109799: [RISCV] add Half-precision test for clang

2021-09-21 Thread Shao-Ce Sun via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe247fed23b92: [RISCV] add Half-precision test for clang 
(authored by achieveartificialintelligence).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109799

Files:
  clang/test/CodeGen/RISCV/rvv-intrinsics/vcompress.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfabs.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfclass.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfcvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfdiv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmax.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmerge.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmin.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfncvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfneg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfnmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfnmadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfnmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfnmsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfrdiv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfrec7.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfredmax.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfredmin.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfredsum.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfrsqrt7.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfrsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfsgnj.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfslide1down.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfslide1up.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfsqrt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwcvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwnmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwnmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwredosum.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwredsum.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vleff.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vloxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vloxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlse.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlsegff.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlsseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vluxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vluxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmerge.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmfeq.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmfge.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmfgt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmfle.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmflt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmfne.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vreinterpret.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vrgather.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vslidedown.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vslideup.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsoxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsoxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsse.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vssseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsuxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsuxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vundefined.c

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


[PATCH] D95588: [RISCV] Implement the MC layer support of P extension

2021-09-21 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added inline comments.



Comment at: llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp:442
+
+if (STI.getFeatureBits()[RISCV::FeatureExtZpsfoperand] &&
+!STI.getFeatureBits()[RISCV::Feature64Bit]) {

Jim wrote:
> jrtc27 wrote:
> > The table is called RISCV32POnly but you're checking for Zpsfoperand 
> > (whatever that mouthful of an extension is). Which is it?
> Rename RISCV32POnly to RISCV32Zpsfoperand. 
> This is for the instruction with even/odd paired-register operands on RV32. 
> 
> In RISCV32Zpsfoperand, two kinds of instruction defined for the same 
> instruction in spec, one for RV32 with even/odd paired-register operands 
> defined in RISCV32Zpsfoperand table , the other one for RV64 with normal GPR 
> operands.
> 
> 
Is there a reason why this needs to be limited to Zpsfoperand? We don't have 
separate namespaces for every extension, we only add them when there are 
conflicts (with the "more common" extension being in the default namespace). 
I'd expect RISCV32Only_ with just a Feature64Bit check, like we do for some 
RV32C instructions, to be sufficient.



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoP.td:10
+/// This file describes the RISC-V instructions from the standard 'P' SIMD
+/// extension, version 0.96.
+/// This version is still experimental as the 'P' extension hasn't been

Isn't it 0.9.6 (or 0.9.7 now)? Not that that's a legal extension version 
number...



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoP.td:147
+  Predicates = [HasStdExtZpsfoperand, IsRV32] in
+  def "32" : RVPALU64Pair;
+  let Predicates = [HasStdExtZpsfoperand, IsRV64] in

FOO32 vs FOO64 intuitively implies something about the width of operands to me, 
not what ISA they're for. For B the instruction definitions use _RV32 and _RV64 
suffices.

Especially since the instructions are already called things like ADD64, this 
will generate nonsense ADD6432 and ADD6464 names...



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoP.td:169
+: RVInstR;

This, RVPSMAL64Pair and RVPALU64Pair are all just RVPBinary with different 
numbers of the operands changed to GPR32PairOp, I think this would be better 
with default (to GPR) template arguments added to RVPBinary for rd/rs1/rs2 
rather than having three almost-identical copies of the same thing under 
varying names



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoP.td:181
+let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
+class RVPMA64Pair funct7, bits<3> funct3, string opcodestr>
+: RVInstR {
+  let Size = 64;

Why is this untyped?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95588

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


[PATCH] D93298: [RISCV] add the MC layer support of Zfinx extension

2021-09-21 Thread Shao-Ce Sun via Phabricator via cfe-commits
achieveartificialintelligence added a comment.

ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93298

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


[PATCH] D109799: [RISCV] add Half-precision test for clang

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

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109799

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


Re: r307232 - [modules ts] Do not emit strong function definitions from the module interface unit in every user.

2021-09-21 Thread David Blaikie via cfe-commits
Ping

On Sun, Sep 5, 2021 at 11:28 AM David Blaikie  wrote:

> Hey Richard - was just going back over some of the modular codegen code
> (due to a discussion on the EWG mailing list about file extensions that
> ended up touching on the nature of how modules are built) - and I came
> across this code & had the same question I see I wrote up here already but
> got lost in the *-commits mail.
>
> Wondering if you've got some thoughts on why this choice was implemented
> for C++20 modules - not homing inline functions/variables, only the extern
> linkage ones for correctness?
>
> On Sun, Jul 16, 2017 at 8:26 PM David Blaikie  wrote:
>
>> Looks good - does this support available_externally definitions of strong
>> external linkage functions in the users of a module? (is that tested?)
>> Should it?
>>
>> Also should we consider having two flags for modular codegen - one for
>> correctness (external function definitions), one for linkage size
>> optimization (inline functions). Given the current data on optimized builds
>> with inline functions (that it hurts object size to emit
>> weak+available_externally definitions rather than linkonce_odr because so
>> many definitions are optimized away entirely, that the bytes for the weak
>> definition are wasted/unnecessary) - or at least something to keep in
>> mind/run numbers on in the future for more generic codebases than Google's
>> protobuf-heavy (& only protobuf modularized) code.
>>
>> On Wed, Jul 5, 2017 at 5:30 PM Richard Smith via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: rsmith
>>> Date: Wed Jul  5 17:30:00 2017
>>> New Revision: 307232
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=307232=rev
>>> Log:
>>> [modules ts] Do not emit strong function definitions from the module
>>> interface unit in every user.
>>>
>>> Added:
>>> cfe/trunk/test/CXX/modules-ts/basic/basic.def.odr/
>>> cfe/trunk/test/CXX/modules-ts/basic/basic.def.odr/p4/
>>> cfe/trunk/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp
>>> cfe/trunk/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cppm
>>> cfe/trunk/test/CXX/modules-ts/basic/basic.def.odr/p4/user.cpp
>>> Modified:
>>> cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
>>>
>>> Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=307232=307231=307232=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
>>> +++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Wed Jul  5 17:30:00
>>> 2017
>>> @@ -2233,8 +2233,18 @@ void ASTRecordWriter::AddFunctionDefinit
>>>Writer->ClearSwitchCaseIDs();
>>>
>>>assert(FD->doesThisDeclarationHaveABody());
>>> -  bool ModulesCodegen = Writer->Context->getLangOpts().ModulesCodegen &&
>>> -Writer->WritingModule &&
>>> !FD->isDependentContext();
>>> +  bool ModulesCodegen = false;
>>> +  if (Writer->WritingModule && !FD->isDependentContext()) {
>>> +// Under -fmodules-codegen, codegen is performed for all defined
>>> functions.
>>> +// When building a C++ Modules TS module interface unit, a strong
>>> definition
>>> +// in the module interface is provided by the compilation of that
>>> module
>>> +// interface unit, not by its users. (Inline functions are still
>>> emitted
>>> +// in module users.)
>>> +ModulesCodegen =
>>> +Writer->Context->getLangOpts().ModulesCodegen ||
>>> +(Writer->WritingModule->Kind == Module::ModuleInterfaceUnit &&
>>> + Writer->Context->GetGVALinkageForFunction(FD) ==
>>> GVA_StrongExternal);
>>> +  }
>>>Record->push_back(ModulesCodegen);
>>>if (ModulesCodegen)
>>>  Writer->ModularCodegenDecls.push_back(Writer->GetDeclRef(FD));
>>>
>>> Added: cfe/trunk/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp?rev=307232=auto
>>>
>>> ==
>>> --- cfe/trunk/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp
>>> (added)
>>> +++ cfe/trunk/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp Wed
>>> Jul  5 17:30:00 2017
>>> @@ -0,0 +1,23 @@
>>> +// RUN: %clang_cc1 -fmodules-ts %S/module.cppm -triple
>>> %itanium_abi_triple -emit-module-interface -o %t
>>> +// RUN: %clang_cc1 -fmodules-ts %s -triple %itanium_abi_triple
>>> -fmodule-file=%t -emit-llvm -o - | FileCheck %s --implicit-check-not=unused
>>> --implicit-check-not=global_module
>>> +
>>> +module Module;
>>> +
>>> +void use() {
>>> +  // CHECK: define linkonce_odr {{.*}}@_Z20used_inline_exportedv
>>> +  used_inline_exported();
>>> +  // CHECK: declare {{.*}}@_Z18noninline_exportedv
>>> +  noninline_exported();
>>> +
>>> +  // FIXME: This symbol should not be visible here.
>>> +  // CHECK: define 

[PATCH] D109865: [NFC] `goto fail` has failed us in the past...

2021-09-21 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D109865#3014106 , @beanz wrote:

> I was talking with @lhames the other day about building a `doWithCleanup` 
> abstraction that could take a labmda to perform and a lambda to cleanup on 
> failure.
>
> I was thinking I may take a stab at that this week.

Sure, would be nice - though I'd probably still argue that a 400 line lambda 
might be a bit unwieldy/unclear.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109865

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


[PATCH] D109799: [RISCV] add Half-precision test for clang

2021-09-21 Thread Shao-Ce Sun via Phabricator via cfe-commits
achieveartificialintelligence added a comment.

In D109799#3008067 , @craig.topper 
wrote:

> This patch is really large and touches tests for integer operations. Can you 
> just pre-commit the removal of lines with just comment characters. No need to 
> review for that. That should reduce the noise in this patch.

Addressed, and thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109799

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


[PATCH] D109799: [RISCV] add Half-precision test for clang

2021-09-21 Thread Shao-Ce Sun via Phabricator via cfe-commits
achieveartificialintelligence updated this revision to Diff 374095.
achieveartificialintelligence added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109799

Files:
  clang/test/CodeGen/RISCV/rvv-intrinsics/vcompress.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfabs.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfclass.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfcvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfdiv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmax.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmerge.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmin.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfmv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfncvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfneg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfnmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfnmadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfnmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfnmsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfrdiv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfrec7.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfredmax.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfredmin.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfredsum.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfrsqrt7.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfrsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfsgnj.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfslide1down.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfslide1up.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfsqrt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwcvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwnmacc.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwnmsac.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwredosum.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwredsum.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vfwsub.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vleff.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlmul.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vloxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vloxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlse.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlsegff.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlsseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vluxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vluxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmerge.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmfeq.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmfge.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmfgt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmfle.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmflt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmfne.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vmv.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vreinterpret.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vrgather.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vslidedown.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vslideup.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsoxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsoxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsse.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vssseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsuxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsuxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vundefined.c

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


[clang] db6f1e8 - DebugInfo: Don't suppress inline namespaces when printing template template parameter names

2021-09-21 Thread David Blaikie via cfe-commits

Author: David Blaikie
Date: 2021-09-21T19:30:13-07:00
New Revision: db6f1e8a8857ccaa339304131373f3150528e812

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

LOG: DebugInfo: Don't suppress inline namespaces when printing template 
template parameter names

Added: 


Modified: 
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/debug-info-template.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 37d53dfbc7014..8660e23726b35 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2066,11 +2066,15 @@ 
CGDebugInfo::CollectTemplateParams(Optional OArgs,
   TemplateParams.push_back(DBuilder.createTemplateValueParameter(
   TheCU, Name, TTy, defaultParameter, V));
 } break;
-case TemplateArgument::Template:
+case TemplateArgument::Template: {
+  std::string QualName;
+  llvm::raw_string_ostream OS(QualName);
+  TA.getAsTemplate().getAsTemplateDecl()->printQualifiedName(
+  OS, getPrintingPolicy());
   TemplateParams.push_back(DBuilder.createTemplateTemplateParameter(
-  TheCU, Name, nullptr,
-  TA.getAsTemplate().getAsTemplateDecl()->getQualifiedNameAsString()));
+  TheCU, Name, nullptr, OS.str()));
   break;
+}
 case TemplateArgument::Pack:
   TemplateParams.push_back(DBuilder.createTemplateParameterPack(
   TheCU, Name, nullptr,

diff  --git a/clang/test/CodeGenCXX/debug-info-template.cpp 
b/clang/test/CodeGenCXX/debug-info-template.cpp
index d536cc5d34c33..546fe01833a7c 100644
--- a/clang/test/CodeGenCXX/debug-info-template.cpp
+++ b/clang/test/CodeGenCXX/debug-info-template.cpp
@@ -245,3 +245,16 @@ void f1() {}
 template void f1();
 // CHECK: !DISubprogram(name: "f1",
 } // namespace Nullptr_t
+
+namespace TemplateTemplateParamInlineNamespace {
+inline namespace inl {
+  template
+  struct t1 { };
+} // namespace inl
+template class> void f1() { }
+template void f1();
+// CHECK: !DISubprogram(name: 
"f1",
+// CHECK-SAME: templateParams: ![[TEMP_TEMP_INL_ARGS:[0-9]*]],
+// CHECK: ![[TEMP_TEMP_INL_ARGS]] = !{![[TEMP_TEMP_INL_ARGS_T:[0-9]*]]}
+// CHECK: ![[TEMP_TEMP_INL_ARGS_T]] = !DITemplateValueParameter(tag: 
DW_TAG_GNU_template_template_param, value: 
!"TemplateTemplateParamInlineNamespace::inl::t1")
+} // namespace TemplateTemplateParamInlineNamespace



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


[clang] d31dfc3 - DebugInfo: Unify some printing policy adjustments

2021-09-21 Thread David Blaikie via cfe-commits

Author: David Blaikie
Date: 2021-09-21T19:30:12-07:00
New Revision: d31dfc30115705332034a81b6b2ab904ca1cf029

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

LOG: DebugInfo: Unify some printing policy adjustments

Added: 


Modified: 
clang/lib/CodeGen/CGDebugInfo.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 00ed07ae2fc3c..37d53dfbc7014 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -243,6 +243,9 @@ PrintingPolicy CGDebugInfo::getPrintingPolicy() const {
 PP.SplitTemplateClosers = true;
   }
 
+  PP.SuppressInlineNamespace = false;
+  PP.PrintCanonicalTypes = true;
+
   // Apply -fdebug-prefix-map.
   PP.Callbacks = 
   return PP;
@@ -4850,12 +4853,8 @@ llvm::DIGlobalVariableExpression 
*CGDebugInfo::CollectAnonRecordDecls(
 std::string CGDebugInfo::GetName(const Decl *D, bool Qualified) const {
   std::string Name;
   llvm::raw_string_ostream OS(Name);
-  if (const NamedDecl *ND = dyn_cast(D)) {
-PrintingPolicy PP = getPrintingPolicy();
-PP.PrintCanonicalTypes = true;
-PP.SuppressInlineNamespace = false;
-ND->getNameForDiagnostic(OS, PP, Qualified);
-  }
+  if (const NamedDecl *ND = dyn_cast(D))
+ND->getNameForDiagnostic(OS, getPrintingPolicy(), Qualified);
   return Name;
 }
 



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


[PATCH] D109865: [NFC] `goto fail` has failed us in the past...

2021-09-21 Thread Chris Bieneman via Phabricator via cfe-commits
beanz added a subscriber: lhames.
beanz added a comment.

I was talking with @lhames the other day about building a `doWithCleanup` 
abstraction that could take a labmda to perform and a lambda to cleanup on 
failure.

I was thinking I may take a stab at that this week.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109865

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


[PATCH] D95588: [RISCV] Implement the MC layer support of P extension

2021-09-21 Thread Jim Lin via Phabricator via cfe-commits
Jim added a comment.

In D95588#3003090 , @Jim wrote:

> Any feedback? I think this patch is good enough to be accepted.

Ping? Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95588

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


[PATCH] D109865: [NFC] `goto fail` has failed us in the past...

2021-09-21 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

(A possibly more robust option - so that this doesn't regress if someone adds a 
new "return true" codepath & forgets to release the cleanup (it looks like a 
pretty long function with several exits, etc) - would be to move the code into 
an "impl" function and have the original function call it, check the result, 
and do the cleanup once?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109865

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


[PATCH] D105191: [Clang][OpenMP] Add support for Static Device Libraries

2021-09-21 Thread Saiyedul Islam via Phabricator via cfe-commits
saiislam added a comment.

In D105191#3013955 , @ye-luo wrote:

> This patch doesn't seem to break anything on my side.
> @saiislam could you
>
> 1. address all the in-source review comments
> 2. update the title to `[Clang][OpenMP] Add partial support for Static Device 
> Libraries`
> 3. update the patch description about what works and what doesn't.
>
> I will accept this patch once these minor revisions are added.

Sure. I will do these changes. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105191

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


[PATCH] D110029: [OpenMP][Offloading] Use bitset to indicate execution mode instead of value

2021-09-21 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 updated this revision to Diff 374089.
tianshilei1992 added a comment.

It looks better to use `enum` in this case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110029

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_target_parallel_proc_bind_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_target_simd_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_simd_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/get_hardware_num_threads_in_block_fold.ll
  llvm/test/Transforms/OpenMP/is_spmd_exec_mode_fold.ll
  llvm/test/Transforms/OpenMP/spmdization.ll
  llvm/test/Transforms/OpenMP/spmdization_assumes.ll
  llvm/test/Transforms/OpenMP/spmdization_guarding.ll
  openmp/libomptarget/plugins/cuda/CMakeLists.txt
  openmp/libomptarget/plugins/cuda/src/rtl.cpp

Index: openmp/libomptarget/plugins/cuda/src/rtl.cpp
===
--- openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -28,6 +28,8 @@
 
 #include "MemoryManager.h"
 
+#include "llvm/Frontend/OpenMP/OMPConstants.h"
+
 // Utility for retrieving and printing CUDA error string.
 #ifdef OMPTARGET_DEBUG
 #define CUDA_ERR_STRING(err)   \
@@ -71,28 +73,17 @@
   std::vector<__tgt_offload_entry> Entries;
 };
 
-enum ExecutionModeType {
-  SPMD, // constructors, destructors,
-// combined constructs (`teams distribute parallel for [simd]`)
-  GENERIC,  // everything else
-  SPMD_GENERIC, // Generic kernel with SPMD execution
-  NONE
-};
-
 /// Use a single entity to encode a kernel and a set of flags.
 struct KernelTy {
   CUfunction Func;
 
   // execution mode of kernel
-  // 0 - SPMD mode (without master warp)
-  // 1 - Generic mode (with master warp)
-  // 2 - SPMD mode execution with Generic mode semantics.
-  int8_t ExecutionMode;
+  llvm::omp::OMPTgtExecModeFlags ExecutionMode;
 
   /// Maximal number of threads per block for this kernel.
   int MaxThreadsPerBlock = 0;
 
-  KernelTy(CUfunction _Func, int8_t _ExecutionMode)
+  KernelTy(CUfunction _Func, llvm::omp::OMPTgtExecModeFlags _ExecutionMode)
   : Func(_Func), ExecutionMode(_ExecutionMode) {}
 };
 
@@ -867,7 +858,7 @@
  DPxPTR(E - HostBegin), E->name, DPxPTR(Func));
 
   // default value GENERIC (in case symbol is missing from cubin file)
-  int8_t ExecModeVal = ExecutionModeType::GENERIC;
+  llvm::omp::OMPTgtExecModeFlags ExecModeVal;
   std::string ExecModeNameStr(E->name);
   ExecModeNameStr += "_exec_mode";
   const char *ExecModeName = ExecModeNameStr.c_str();
@@ -876,9 +867,9 @@
   size_t CUSize;
   Err = cuModuleGetGlobal(, , Module, ExecModeName);
   if (Err == CUDA_SUCCESS) {
-if (CUSize != sizeof(int8_t)) {
+if (CUSize != sizeof(llvm::omp::OMPTgtExecModeFlags)) {
   DP("Loading global exec_mode '%s' - size mismatch (%zd != %zd)\n",
- ExecModeName, CUSize, sizeof(int8_t));
+ ExecModeName, CUSize, sizeof(llvm::omp::OMPTgtExecModeFlags));
   return nullptr;
 }
 
@@ -890,12 +881,6 @@
   CUDA_ERR_STRING(Err);
   return nullptr;
 }
-
-if (ExecModeVal < 0 || ExecModeVal > 2) {
-  DP("Error wrong exec_mode value specified in cubin file: %d\n",
- ExecModeVal);
-  return nullptr;
-}
   } else {
 DP("Loading global exec_mode '%s' - symbol missing, using default "
"value GENERIC (1)\n",
@@ -1098,12 +1083,19 @@
 
 KernelTy *KernelInfo = reinterpret_cast(TgtEntryPtr);
 
+const bool IsSPMDGenericMode =
+KernelInfo->ExecutionMode == llvm::omp::OMP_TGT_EXEC_MODE_GENERIC_SPMD;
+const bool IsSPMDMode =
+KernelInfo->ExecutionMode == llvm::omp::OMP_TGT_EXEC_MODE_SPMD;
+const bool IsGenericMode =
+KernelInfo->ExecutionMode == llvm::omp::OMP_TGT_EXEC_MODE_GENERIC;
+
 int CudaThreadsPerBlock;
 if (ThreadLimit > 0) {
   DP("Setting CUDA threads per block to requested %d\n", ThreadLimit);
   CudaThreadsPerBlock = ThreadLimit;
   // Add master warp if necessary
-  if (KernelInfo->ExecutionMode == GENERIC) {
+  if (IsGenericMode) {
 DP("Adding master warp: +%d threads\n", DeviceData[DeviceId].WarpSize);
 CudaThreadsPerBlock += DeviceData[DeviceId].WarpSize;
   }
@@ -1136,13 +1128,21 @@
 unsigned int CudaBlocksPerGrid;
 if (TeamNum <= 0) {
   if (LoopTripCount > 0 && EnvNumTeams < 0) {
-if (KernelInfo->ExecutionMode == SPMD) {
+if (IsSPMDGenericMode) {
+  // If we reach this point, then we are executing a kernel that was
+  // transformed from 

[PATCH] D108696: [Coroutines] [Frontend] Lookup in std namespace first

2021-09-21 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu added a comment.

@ldionne @Quuxplusone Now the compiler wouldn't emit warning for 
 any more. So I think this is good. Do you feel good 
with this? This is necessary to conform the implementation of coroutine since 
the compiler would search coroutine components in corresponding namespace 
(std::experimental before and both std and std::experimental after this patch).


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

https://reviews.llvm.org/D108696

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


[PATCH] D104386: [PowerPC][Builtins] Added a number of builtins for compatibility with XL.

2021-09-21 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai added a comment.

In D104386#2979830 , @dim wrote:

> In D104386#2977302 , @nemanjai 
> wrote:
>
>> The idea with putting all of these in a separate function was to:
>>
>> 1. Make it easy to limit it to specific targets as I suggested above
>> 2. Have them all in one place to easily identify which ones are added for 
>> this compatibility so we can eventually pull this support once they are no 
>> longer needed
>> 3. Just kind of isolate this to keep it out of the way
>>
>> I really think the best way forward might be to limit this to Linux and AIX. 
>> I don't think IBM provided XLC/C++ on FreeBSD.
>
> Well, glibc also uses at least some of these `__` aliases, e.g. for `__bcopy`:
>
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/powerpc64/power7/memmove.S;h=f61949d30fa317ec487deb81b20e67ed3df05e32;hb=HEAD#l829
>
> and
>
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/powerpc64/le/power10/memmove.S;h=7dfd57edeb37e8e47a31fe6e19f254bc1fcd312b;hb=HEAD#l312
>
> but there might be more collisions...

I think it is reasonable for the GLIBC build to undef these macros in the build 
system. Patch to restrict this to AIX/Linux in https://reviews.llvm.org/D110213


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104386

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


[PATCH] D110213: [PowerPC] Define XL-compatible macros only for AIX and Linux

2021-09-21 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai created this revision.
nemanjai added reviewers: PowerPC, dim.
Herald added subscribers: steven.zhang, shchenz, kbarton.
nemanjai requested review of this revision.
Herald added a project: clang.

Since XLC only ever shipped on PowerPC AIX and Linux, it is not reasonable to 
provide the compatibility macros on any target other than those two. This patch 
restricts those macros to AIX/Linux.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110213

Files:
  clang/lib/Basic/Targets/PPC.cpp
  clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond-64bit-only.c
  clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
  clang/test/CodeGen/builtins-ppc-xlcompat-cas.c
  clang/test/CodeGen/builtins-ppc-xlcompat-cipher.c
  clang/test/CodeGen/builtins-ppc-xlcompat-cmplx.c
  clang/test/CodeGen/builtins-ppc-xlcompat-compare.c
  clang/test/CodeGen/builtins-ppc-xlcompat-conversionfunc.c
  clang/test/CodeGen/builtins-ppc-xlcompat-darn.c
  clang/test/CodeGen/builtins-ppc-xlcompat-error.c
  clang/test/CodeGen/builtins-ppc-xlcompat-expect.c
  clang/test/CodeGen/builtins-ppc-xlcompat-fetch.c
  clang/test/CodeGen/builtins-ppc-xlcompat-fp.c
  clang/test/CodeGen/builtins-ppc-xlcompat-load-store-reversed-64bit-only.c
  clang/test/CodeGen/builtins-ppc-xlcompat-load-store-reversed.c
  clang/test/CodeGen/builtins-ppc-xlcompat-macros.c
  clang/test/CodeGen/builtins-ppc-xlcompat-math.c
  clang/test/CodeGen/builtins-ppc-xlcompat-move-tofrom-regs.c
  clang/test/CodeGen/builtins-ppc-xlcompat-multiply-64bit-only.c
  clang/test/CodeGen/builtins-ppc-xlcompat-multiply.c
  clang/test/CodeGen/builtins-ppc-xlcompat-popcnt.c
  clang/test/CodeGen/builtins-ppc-xlcompat-prefetch.c
  clang/test/CodeGen/builtins-ppc-xlcompat-pwr8.c
  clang/test/CodeGen/builtins-ppc-xlcompat-pwr9-64bit.c
  clang/test/CodeGen/builtins-ppc-xlcompat-pwr9-error.c
  clang/test/CodeGen/builtins-ppc-xlcompat-pwr9-warning.c
  clang/test/CodeGen/builtins-ppc-xlcompat-pwr9.c
  clang/test/CodeGen/builtins-ppc-xlcompat-rotate.c
  clang/test/CodeGen/builtins-ppc-xlcompat-stfiw.c
  clang/test/CodeGen/builtins-ppc-xlcompat-swdiv_nochk.c
  clang/test/CodeGen/builtins-ppc-xlcompat-sync.c
  clang/test/CodeGen/builtins-ppc-xlcompat-trap-64bit-only.c
  clang/test/CodeGen/builtins-ppc-xlcompat-trap.c
  clang/test/CodeGen/builtins-ppc-xlcompat-vec-error.c
  clang/test/CodeGen/builtins-ppc-xlcompat.c

Index: clang/test/CodeGen/builtins-ppc-xlcompat.c
===
--- clang/test/CodeGen/builtins-ppc-xlcompat.c
+++ clang/test/CodeGen/builtins-ppc-xlcompat.c
@@ -1,9 +1,9 @@
 // REQUIRES: powerpc-registered-target
 // RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \
-// RUN:   -triple powerpc64-unknown-unknown -emit-llvm %s -o - \
+// RUN:   -triple powerpc64-unknown-linux-gnu -emit-llvm %s -o - \
 // RUN:   -D__XL_COMPAT_ALTIVEC__ -target-cpu pwr7 | FileCheck %s
 // RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \
-// RUN:   -triple powerpc64le-unknown-unknown -emit-llvm %s -o - \
+// RUN:   -triple powerpc64le-unknown-linux-gnu -emit-llvm %s -o - \
 // RUN:   -D__XL_COMPAT_ALTIVEC__ -target-cpu pwr8 | FileCheck %s
 #include 
 vector double vd = { 3.4e22, 1.8e-3 };
Index: clang/test/CodeGen/builtins-ppc-xlcompat-vec-error.c
===
--- clang/test/CodeGen/builtins-ppc-xlcompat-vec-error.c
+++ clang/test/CodeGen/builtins-ppc-xlcompat-vec-error.c
@@ -1,7 +1,7 @@
 // REQUIRES: powerpc-registered-target
-// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -fsyntax-only \
+// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -fsyntax-only \
 // RUN:   -target-cpu pwr8 -Wall -Werror -verify %s
-// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -fsyntax-only \
+// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -fsyntax-only \
 // RUN:   -target-cpu pwr8 -Wall -Werror -verify %s
 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fsyntax-only \
 // RUN:   -target-cpu pwr8 -Wall -Werror -verify %s
Index: clang/test/CodeGen/builtins-ppc-xlcompat-trap.c
===
--- clang/test/CodeGen/builtins-ppc-xlcompat-trap.c
+++ clang/test/CodeGen/builtins-ppc-xlcompat-trap.c
@@ -1,8 +1,8 @@
 // REQUIRES: powerpc-registered-target
-// RUN: %clang_cc1 -O2 -triple powerpc64-unknown-unknown \
+// RUN: %clang_cc1 -O2 -triple powerpc64-unknown-linux-gnu \
 // RUN:   -emit-llvm %s -o - -target-cpu pwr7 | \
 // RUN:  FileCheck %s
-// RUN: %clang_cc1 -O2 -triple powerpc64le-unknown-unknown \
+// RUN: %clang_cc1 -O2 -triple powerpc64le-unknown-linux-gnu \
 // RUN:   -emit-llvm %s -o - -target-cpu pwr8 | \
 // RUN:  FileCheck %s
 // RUN: %clang_cc1 -O2 -triple powerpc-unknown-aix \
Index: clang/test/CodeGen/builtins-ppc-xlcompat-trap-64bit-only.c
===
--- 

[PATCH] D110210: [clang] NFC: include non friendly types and missing sugar in test expectations

2021-09-21 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov created this revision.
mizvekov edited the summary of this revision.
mizvekov published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The dump of all diagnostics of all tests under 
`clang/test/{CXX,SemaCXX,SemaTemplate}` was analyzed , and all the cases where 
there were obviously bad canonical types being printed, like 
`type-parameter-*-*` and `` were identified. Also a 
small amount of cases of missing sugar were analyzed.

This patch then spells those explicitly in the test expectations, as 
preparatory work for future fixes for these problems.

Signed-off-by: Matheus Izvekov 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110210

Files:
  clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp
  clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp
  clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
  clang/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp
  clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
  clang/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
  clang/test/SemaCXX/conversion-function.cpp
  clang/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp
  clang/test/SemaCXX/cxx1y-generic-lambdas.cpp
  clang/test/SemaCXX/cxx1z-decomposition.cpp
  clang/test/SemaCXX/deduced-return-type-cxx14.cpp
  clang/test/SemaCXX/recovery-expr-type.cpp
  clang/test/SemaCXX/redeclared-alias-template.cpp
  clang/test/SemaTemplate/instantiate-var-template.cpp
  clang/test/SemaTemplate/temp_arg_nontype.cpp
  clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp

Index: clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
===
--- clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
+++ clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
@@ -43,7 +43,7 @@
   typedef A d;
   typedef A d;
   typedef A> d;
-  typedef A> e; // expected-error {{is not implicitly convertible}}
+  typedef A> e; // expected-error {{value of type '' is not implicitly convertible to 'void (*)()'}}
 
   typedef A x; // expected-error {{not allowed in a converted constant}}
   typedef A y;
Index: clang/test/SemaTemplate/temp_arg_nontype.cpp
===
--- clang/test/SemaTemplate/temp_arg_nontype.cpp
+++ clang/test/SemaTemplate/temp_arg_nontype.cpp
@@ -437,7 +437,7 @@
 
   template class X> struct A {
 template N> struct B; // expected-note 2{{here}}
-template struct B {}; // expected-error {{specializes a template parameter with dependent type 'Y'}}
+template struct B {}; // expected-error {{non-type template argument specializes a template parameter with dependent type 'Y' (aka 'type-parameter-0-0 *')}}
   };
   A::B ax;
   A::B ay; // expected-error {{undefined}} expected-note {{instantiation of}}
Index: clang/test/SemaTemplate/instantiate-var-template.cpp
===
--- clang/test/SemaTemplate/instantiate-var-template.cpp
+++ clang/test/SemaTemplate/instantiate-var-template.cpp
@@ -31,7 +31,7 @@
   static_assert(b == 1, ""); // expected-note {{in instantiation of}} expected-error {{not an integral constant}}
 
   template void f() {
-static_assert(a == 0, ""); // expected-error {{static_assert failed}}
+static_assert(a == 0, ""); // expected-error {{static_assert failed due to requirement 'a == 0'}}
   }
 }
 
Index: clang/test/SemaCXX/redeclared-alias-template.cpp
===
--- clang/test/SemaCXX/redeclared-alias-template.cpp
+++ clang/test/SemaCXX/redeclared-alias-template.cpp
@@ -5,7 +5,7 @@
 template using A = T1; // expected-error {{too many template parameters in template redeclaration}}
 
 template using B = T1; // expected-note {{previous}}
-template using B = T1; // expected-error {{type alias template redefinition with different types}}
+template using B = T1; // expected-error {{type alias template redefinition with different types ('T1' (aka 'type-parameter-0-1') vs 'T1' (aka 'type-parameter-0-0'))}}
 
 
 template struct S;
Index: clang/test/SemaCXX/recovery-expr-type.cpp
===
--- clang/test/SemaCXX/recovery-expr-type.cpp
+++ clang/test/SemaCXX/recovery-expr-type.cpp
@@ -133,7 +133,7 @@
 template  S(T t) -> S;
 
 void baz() {
-  bar(S(123)); // expected-error {{no matching conversion}}
+  bar(S(123)); // expected-error {{no matching conversion for functional-style cast from 'int' to 'test11::S<>'}}
 }
 } // namespace test11
 
Index: clang/test/SemaCXX/deduced-return-type-cxx14.cpp
===
--- clang/test/SemaCXX/deduced-return-type-cxx14.cpp
+++ clang/test/SemaCXX/deduced-return-type-cxx14.cpp
@@ -146,7 +146,7 @@
   auto fwd_decl(); // expected-note {{candidate template ignored: could not match 'auto ()' against 'int ()'}}
   int g = 

[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

2021-09-21 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen requested review of this revision.
ychen added a comment.

This and 45c0ebe00efb 
 should 
make `-Werror` build of libcxx tests pass.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103938

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


[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

2021-09-21 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 374080.
ychen added a comment.

- Remove accidentally included change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103938

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/test/Analysis/dead-stores.c
  clang/test/CXX/basic/basic.link/p8.cpp
  clang/test/CXX/drs/dr14xx.cpp
  clang/test/CXX/drs/dr20xx.cpp
  clang/test/CXX/drs/dr7xx.cpp
  clang/test/CXX/temp/temp.constr/temp.constr.constr/partial-specializations.cpp
  clang/test/CodeCompletion/pragma-macro-token-caching.c
  clang/test/Frontend/fixed_point_crash.c
  clang/test/PCH/cxx-explicit-specifier.cpp
  clang/test/Parser/cxx-ambig-decl-expr.cpp
  clang/test/Parser/cxx0x-ambig.cpp
  clang/test/Parser/cxx1z-init-statement.cpp
  clang/test/Parser/objc-messaging-1.m
  clang/test/Parser/objc-try-catch-1.m
  clang/test/Parser/objcxx11-attributes.mm
  clang/test/Sema/const-eval.c
  clang/test/Sema/exprs.c
  clang/test/Sema/i-c-e.c
  clang/test/Sema/sizeless-1.c
  clang/test/Sema/switch-1.c
  clang/test/Sema/vla-2.c
  clang/test/Sema/warn-type-safety.c
  clang/test/Sema/warn-unused-value.c
  clang/test/SemaCXX/attr-annotate.cpp
  clang/test/SemaCXX/builtin-constant-p.cpp
  clang/test/SemaCXX/constant-expression-cxx2a.cpp
  clang/test/SemaCXX/constant-expression.cpp
  clang/test/SemaCXX/expression-traits.cpp
  clang/test/SemaCXX/matrix-type-operators.cpp
  clang/test/SemaCXX/overloaded-operator.cpp
  clang/test/SemaCXX/sizeless-1.cpp
  clang/test/SemaCXX/vector.cpp
  clang/test/SemaCXX/warn-comma-operator.cpp
  clang/test/SemaCXX/warn-unused-value.cpp
  clang/test/SemaTemplate/derived.cpp
  clang/test/SemaTemplate/lambda-capture-pack.cpp

Index: clang/test/SemaTemplate/lambda-capture-pack.cpp
===
--- clang/test/SemaTemplate/lambda-capture-pack.cpp
+++ clang/test/SemaTemplate/lambda-capture-pack.cpp
@@ -18,7 +18,7 @@
 namespace PR41576 {
   template  constexpr int f(Xs ...xs) {
 return [&](auto ...ys) { // expected-note {{instantiation}}
-  return ((xs + ys), ...); // expected-warning {{unused}}
+  return ((xs + ys), ...); // expected-warning {{left operand of comma operator has no effect}}
 }(1, 2);
   }
   static_assert(f(3, 4) == 6); // expected-note {{instantiation}}
Index: clang/test/SemaTemplate/derived.cpp
===
--- clang/test/SemaTemplate/derived.cpp
+++ clang/test/SemaTemplate/derived.cpp
@@ -49,6 +49,6 @@
 
   class A {
 TFP m_p;
-void Enable() { 0, A(); } // expected-warning {{unused}}
+void Enable() { 0, A(); } // expected-warning {{left operand of comma operator has no effect}}
   };
 }
Index: clang/test/SemaCXX/warn-unused-value.cpp
===
--- clang/test/SemaCXX/warn-unused-value.cpp
+++ clang/test/SemaCXX/warn-unused-value.cpp
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value %s
 // RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value -std=c++98 %s
 // RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value -std=c++17 %s
 
 // PR4806
 namespace test0 {
@@ -138,3 +139,26 @@
   (void)arr3;
   (void)arr4;
 }
+
+#if __cplusplus >= 201103L // C++11 or later
+namespace test5 {
+int v[(5, 6)]; // expected-warning {{left operand of comma operator has no effect}}
+void foo() {
+  new double[false ? (1, 2) : 3]
+// FIXME: We shouldn't diagnose the unreachable constant expression
+// here.
+[false ? (1, 2) : 3]; // expected-warning {{left operand of comma operator has no effect}}
+}
+} // namespace test5
+#endif
+
+#if __cplusplus >= 201703L // C++17 or later
+namespace test6 {
+auto b() {
+  if constexpr (false)
+return (1,0);
+  else
+return (1.0,0.0); // expected-warning {{left operand of comma operator has no effect}}
+}
+} // namespace test6
+#endif
Index: clang/test/SemaCXX/warn-comma-operator.cpp
===
--- clang/test/SemaCXX/warn-comma-operator.cpp
+++ clang/test/SemaCXX/warn-comma-operator.cpp
@@ -242,8 +242,8 @@
 
 template 
 class Foo {
-  typedef bool_seq<(xs::value, true)...> all_true;
-  typedef bool_seq<(xs::value, false)...> all_false;
+  typedef bool_seq<((void)xs::value, true)...> all_true;
+  typedef bool_seq<((void)xs::value, false)...> all_false;
   typedef bool_seq seq;
 };
 
Index: clang/test/SemaCXX/vector.cpp
===
--- clang/test/SemaCXX/vector.cpp
+++ clang/test/SemaCXX/vector.cpp
@@ -381,8 +381,8 @@
 typedef int inte2 __attribute__((__ext_vector_type__(2)));
 
 void test_vector_literal(inte4 res) {
-  

[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

2021-09-21 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 374078.
ychen edited the summary of this revision.
ychen added a comment.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
This revision now requires review to proceed.

- Check the scope correctly: first line of `DiagIfReachable` should be 
`getCurFunctionOrMethodDecl()`. And the `FunctionScopes` should be kept to deal 
with `requires` expression where `FunctionScopes` could be empty.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103938

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/test/Analysis/dead-stores.c
  clang/test/CXX/basic/basic.link/p8.cpp
  clang/test/CXX/drs/dr14xx.cpp
  clang/test/CXX/drs/dr20xx.cpp
  clang/test/CXX/drs/dr7xx.cpp
  clang/test/CXX/temp/temp.constr/temp.constr.constr/partial-specializations.cpp
  clang/test/CodeCompletion/pragma-macro-token-caching.c
  clang/test/Frontend/fixed_point_crash.c
  clang/test/PCH/cxx-explicit-specifier.cpp
  clang/test/Parser/cxx-ambig-decl-expr.cpp
  clang/test/Parser/cxx0x-ambig.cpp
  clang/test/Parser/cxx1z-init-statement.cpp
  clang/test/Parser/objc-messaging-1.m
  clang/test/Parser/objc-try-catch-1.m
  clang/test/Parser/objcxx11-attributes.mm
  clang/test/Sema/const-eval.c
  clang/test/Sema/exprs.c
  clang/test/Sema/i-c-e.c
  clang/test/Sema/sizeless-1.c
  clang/test/Sema/switch-1.c
  clang/test/Sema/vla-2.c
  clang/test/Sema/warn-type-safety.c
  clang/test/Sema/warn-unused-value.c
  clang/test/SemaCXX/attr-annotate.cpp
  clang/test/SemaCXX/builtin-constant-p.cpp
  clang/test/SemaCXX/constant-expression-cxx2a.cpp
  clang/test/SemaCXX/constant-expression.cpp
  clang/test/SemaCXX/expression-traits.cpp
  clang/test/SemaCXX/matrix-type-operators.cpp
  clang/test/SemaCXX/overloaded-operator.cpp
  clang/test/SemaCXX/sizeless-1.cpp
  clang/test/SemaCXX/vector.cpp
  clang/test/SemaCXX/warn-comma-operator.cpp
  clang/test/SemaCXX/warn-unused-value.cpp
  clang/test/SemaTemplate/derived.cpp
  clang/test/SemaTemplate/lambda-capture-pack.cpp
  libcxx/include/variant

Index: libcxx/include/variant
===
--- libcxx/include/variant
+++ libcxx/include/variant
@@ -549,7 +549,7 @@
   inline _LIBCPP_INLINE_VISIBILITY
   static constexpr auto __make_fdiagonal_impl() {
 return __make_dispatch<_Fp, _Vs...>(
-index_sequence<(__identity<_Vs>{}, _Ip)...>{});
+index_sequence<((void)__identity<_Vs>{}, _Ip)...>{});
   }
 
   template 
Index: clang/test/SemaTemplate/lambda-capture-pack.cpp
===
--- clang/test/SemaTemplate/lambda-capture-pack.cpp
+++ clang/test/SemaTemplate/lambda-capture-pack.cpp
@@ -18,7 +18,7 @@
 namespace PR41576 {
   template  constexpr int f(Xs ...xs) {
 return [&](auto ...ys) { // expected-note {{instantiation}}
-  return ((xs + ys), ...); // expected-warning {{unused}}
+  return ((xs + ys), ...); // expected-warning {{left operand of comma operator has no effect}}
 }(1, 2);
   }
   static_assert(f(3, 4) == 6); // expected-note {{instantiation}}
Index: clang/test/SemaTemplate/derived.cpp
===
--- clang/test/SemaTemplate/derived.cpp
+++ clang/test/SemaTemplate/derived.cpp
@@ -49,6 +49,6 @@
 
   class A {
 TFP m_p;
-void Enable() { 0, A(); } // expected-warning {{unused}}
+void Enable() { 0, A(); } // expected-warning {{left operand of comma operator has no effect}}
   };
 }
Index: clang/test/SemaCXX/warn-unused-value.cpp
===
--- clang/test/SemaCXX/warn-unused-value.cpp
+++ clang/test/SemaCXX/warn-unused-value.cpp
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value %s
 // RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value -std=c++98 %s
 // RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value -std=c++17 %s
 
 // PR4806
 namespace test0 {
@@ -138,3 +139,26 @@
   (void)arr3;
   (void)arr4;
 }
+
+#if __cplusplus >= 201103L // C++11 or later
+namespace test5 {
+int v[(5, 6)]; // expected-warning {{left operand of comma operator has no effect}}
+void foo() {
+  new double[false ? (1, 2) : 3]
+// FIXME: We shouldn't diagnose the unreachable constant expression
+// here.
+[false ? (1, 2) : 3]; // expected-warning {{left operand of comma operator has no effect}}
+}
+} // namespace test5
+#endif
+
+#if __cplusplus >= 201703L // C++17 or later
+namespace test6 {
+auto b() {
+  if constexpr (false)
+return (1,0);
+  else
+return (1.0,0.0); // expected-warning {{left operand of comma operator has no effect}}
+}

[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

2021-09-21 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen reopened this revision.
ychen added a comment.
This revision is now accepted and ready to land.

reopen to fix tests failure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103938

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


[PATCH] D105191: [Clang][OpenMP] Add support for Static Device Libraries

2021-09-21 Thread Ye Luo via Phabricator via cfe-commits
ye-luo added a comment.

This patch doesn't seem to break anything on my side.
@saiislam could you

1. address all the in-source review comments
2. update the title to `[Clang][OpenMP] Add partial support for Static Device 
Libraries`
3. update the patch description about what works and what doesn't.

I will accept this patch once these minor revisions are added.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105191

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


[PATCH] D110209: [CSSPGO] Set PseudoProbeInserter as a default pass.

2021-09-21 Thread Wenlei He via Phabricator via cfe-commits
wenlei accepted this revision.
wenlei added a comment.
This revision is now accepted and ready to land.

thanks for the change. control this through metadata is more reliable than 
through LTO time flags. Scheduling a non-op pass shouldn't incur overhead 
either. lgtm.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110209

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


[PATCH] D110111: [WebAssembly] Add relaxed-simd feature

2021-09-21 Thread Thomas Lively via Phabricator via cfe-commits
tlively added a comment.

Nice! Thanks for writing this :D Do you know what happens when you actually try 
to compile some code with `-mrelaxed-simd`? I'm concerned that it will throw an 
error because the "relaxed-simd" target feature has not yet been defined in the 
backend (specifically in WebAssembly.td and in WebAssemblySubtarget.{h,cpp}).




Comment at: clang/lib/Basic/Targets/WebAssembly.cpp:105-107
+case RelaxedSIMD:
+  Features["relaxed-simd"] = true;
+  LLVM_FALLTHROUGH;

I believe this should be above the `SIMD128` case so that when `RelaxedSIMD` is 
enabled it falls through and marks `SIMD128` as enabled as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110111

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


[PATCH] D110129: [DebugInfo] Support typedef with btf_tag attributes

2021-09-21 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 374073.
yonghong-song added a comment.

- updated tests based on @probinson suggestions.
- The only thing left is for llvm/test/DebugInfo/X86/attr-btf_tag-typedef.ll 
for which I didn't use `%itanium_abi_triple` as it seems only available for 
%clang ... and not available for llc.

  [$ ~/work/llvm-project/llvm/test] egrep -r itanium_abi_triple
  [$~/work/llvm-project/llvm/test]


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110129

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/attr-btf_tag-typedef.c
  llvm/include/llvm/IR/DIBuilder.h
  llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  llvm/lib/IR/DIBuilder.cpp
  llvm/test/Bitcode/attr-btf_tag-typedef.ll
  llvm/test/DebugInfo/X86/attr-btf_tag-typedef.ll

Index: llvm/test/DebugInfo/X86/attr-btf_tag-typedef.ll
===
--- /dev/null
+++ llvm/test/DebugInfo/X86/attr-btf_tag-typedef.ll
@@ -0,0 +1,69 @@
+; RUN: llc -mtriple=x86_64-linux -filetype=obj -o %t %s
+; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s
+;
+; Source:
+;   #define __tag1 __attribute__((btf_tag("tag1")))
+;   typedef struct { int a; } __s __tag1;
+;   typedef unsigned __tag1 * __u;
+;   __s a;
+;   __u u;
+; Compilation flag:
+;   clang -S -g -emit-llvm typedef.c
+
+%struct.__s = type { i32 }
+
+@a = dso_local global %struct.__s zeroinitializer, align 4, !dbg !0
+@u = dso_local global i32* null, align 8, !dbg !5
+
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!17, !18, !19, !20, !21}
+!llvm.ident = !{!22}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 4, type: !12, isLocal: false, isDefinition: true)
+!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 14.0.0 (https://github.com/llvm/llvm-project.git b9757992b73e823edf1fa699372ff9cd29db6cb7)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
+!3 = !DIFile(filename: "typedef.c", directory: "/home/yhs/work/tests/llvm/btf_tag")
+!4 = !{!0, !5}
+!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
+!6 = distinct !DIGlobalVariable(name: "u", scope: !2, file: !3, line: 5, type: !7, isLocal: false, isDefinition: true)
+!7 = !DIDerivedType(tag: DW_TAG_typedef, name: "__u", file: !3, line: 3, baseType: !8, annotations: !10)
+!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64)
+!9 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
+!10 = !{!11}
+!11 = !{!"btf_tag", !"tag1"}
+!12 = !DIDerivedType(tag: DW_TAG_typedef, name: "__s", file: !3, line: 2, baseType: !13, annotations: !10)
+!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !3, line: 2, size: 32, elements: !14)
+!14 = !{!15}
+!15 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !13, file: !3, line: 2, baseType: !16, size: 32)
+!16 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+
+; CHECK:DW_TAG_typedef
+; CHECK-NEXT: DW_AT_type
+; CHECK-NEXT: DW_AT_name  ("__s")
+; CHECK-NEXT: DW_AT_decl_file
+; CHECK-NEXT: DW_AT_decl_line
+; CHECK-EMPTY:
+; CHECK-NEXT: DW_TAG_LLVM_annotation
+; CHECK-NEXT:   DW_AT_name("btf_tag")
+; CHECK-NEXT:   DW_AT_const_value ("tag1")
+; CHECK-EMPTY:
+; CHECK-NEXT: NULL
+
+; CHECK:DW_TAG_typedef
+; CHECK-NEXT: DW_AT_type
+; CHECK-NEXT: DW_AT_name  ("__u")
+; CHECK-NEXT: DW_AT_decl_file
+; CHECK-NEXT: DW_AT_decl_line
+; CHECK-EMPTY:
+; CHECK-NEXT: DW_TAG_LLVM_annotation
+; CHECK-NEXT:   DW_AT_name("btf_tag")
+; CHECK-NEXT:   DW_AT_const_value ("tag1")
+; CHECK-EMPTY:
+; CHECK-NEXT: NULL
+
+!17 = !{i32 7, !"Dwarf Version", i32 4}
+!18 = !{i32 2, !"Debug Info Version", i32 3}
+!19 = !{i32 1, !"wchar_size", i32 4}
+!20 = !{i32 7, !"uwtable", i32 1}
+!21 = !{i32 7, !"frame-pointer", i32 2}
+!22 = !{!"clang version 14.0.0 (https://github.com/llvm/llvm-project.git b9757992b73e823edf1fa699372ff9cd29db6cb7)"}
Index: llvm/test/Bitcode/attr-btf_tag-typedef.ll
===
--- /dev/null
+++ llvm/test/Bitcode/attr-btf_tag-typedef.ll
@@ -0,0 +1,54 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+;
+; Source:
+;   #define __tag1 __attribute__((btf_tag("tag1")))
+;   typedef struct { int a; } __s __tag1;
+;   typedef unsigned __tag1 * __u;
+;   __s a;
+;   __u u;
+; Compilation flag:
+;   clang -S -g -emit-llvm typedef.c
+
+%struct.__s = type { i32 }
+
+@a = dso_local global %struct.__s zeroinitializer, align 4, !dbg !0
+@u = dso_local global i32* null, align 8, !dbg !5
+
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!17, !18, !19, !20, !21}
+!llvm.ident = !{!22}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = 

[PATCH] D110209: [CSSPGO] Set PseudoProbeInserter as a default pass.

2021-09-21 Thread Hongtao Yu via Phabricator via cfe-commits
hoy created this revision.
Herald added subscribers: ormris, modimo, wenlei, dang, pengfei, steven_wu, 
hiraditya, arichardson, emaste.
Herald added a reviewer: MaskRay.
hoy requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Currenlty PseudoProbeInserter is a pass conditioned on a target switch. It 
works well with a single clang invocation. It doesn't work so well when the 
backend is called separately (i.e, through the linker or llc), where user has 
always to pass -pseudo-probe-for-profiling explictly. I'm making the pass a 
default pass that requires no command line arg to trigger, but will be actually 
run depending on whether the CU comes with `llvm.pseudo_probe_desc` metadata.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110209

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/LTO.cpp
  lld/ELF/Options.td
  llvm/include/llvm/CodeGen/CommandFlags.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/CommandFlags.cpp
  llvm/lib/CodeGen/PseudoProbeInserter.cpp
  llvm/lib/CodeGen/TargetPassConfig.cpp
  llvm/test/CodeGen/X86/O0-pipeline.ll
  llvm/test/CodeGen/X86/opt-pipeline.ll
  llvm/test/Transforms/SampleProfile/pseudo-probe-dangle.ll
  llvm/test/Transforms/SampleProfile/pseudo-probe-emit-inline.ll
  llvm/test/Transforms/SampleProfile/pseudo-probe-emit.ll
  llvm/test/Transforms/SampleProfile/pseudo-probe-instsched.ll
  llvm/test/tools/llvm-profgen/truncated-pseudoprobe.test

Index: llvm/test/tools/llvm-profgen/truncated-pseudoprobe.test
===
--- llvm/test/tools/llvm-profgen/truncated-pseudoprobe.test
+++ llvm/test/tools/llvm-profgen/truncated-pseudoprobe.test
@@ -20,5 +20,5 @@
 ; CHECK-NEXT:  !Attributes: 1
 
 ; truncated-pseudoprobe.perfbin is from the following compile commands:
-; llc -pseudo-probe-for-profiling truncated-pseudoprobe.ll -filetype=obj -o truncated-pseudoprobe.o
+; llc truncated-pseudoprobe.ll -filetype=obj -o truncated-pseudoprobe.o
 ; clang truncated-pseudoprobe.o -o truncated-pseudoprobe.perfbin
Index: llvm/test/Transforms/SampleProfile/pseudo-probe-instsched.ll
===
--- llvm/test/Transforms/SampleProfile/pseudo-probe-instsched.ll
+++ llvm/test/Transforms/SampleProfile/pseudo-probe-instsched.ll
@@ -1,5 +1,5 @@
 ; REQUIRES: x86_64-linux
-; RUN: llc < %s -mcpu=generic -mtriple=x86_64-- -pseudo-probe-for-profiling -O3 | FileCheck %s
+; RUN: llc < %s -mcpu=generic -mtriple=x86_64-- -O3 | FileCheck %s
 
 define float @foo(float %x) #0 {
   %tmp1 = fmul float %x, 3.00e+00
Index: llvm/test/Transforms/SampleProfile/pseudo-probe-emit.ll
===
--- llvm/test/Transforms/SampleProfile/pseudo-probe-emit.ll
+++ llvm/test/Transforms/SampleProfile/pseudo-probe-emit.ll
@@ -1,10 +1,10 @@
 ; REQUIRES: x86_64-linux
 ; RUN: opt < %s -passes=pseudo-probe -function-sections -S -o %t
 ; RUN: FileCheck %s < %t --check-prefix=CHECK-IL
-; RUN: llc %t -pseudo-probe-for-profiling -stop-after=pseudo-probe-inserter -o - | FileCheck %s --check-prefix=CHECK-MIR
-; RUN: llc %t -pseudo-probe-for-profiling -function-sections -filetype=asm -o %t1
+; RUN: llc %t -stop-after=pseudo-probe-inserter -o - | FileCheck %s --check-prefix=CHECK-MIR
+; RUN: llc %t -function-sections -filetype=asm -o %t1
 ; RUN: FileCheck %s < %t1 --check-prefix=CHECK-ASM
-; RUN: llc %t -pseudo-probe-for-profiling -function-sections -filetype=obj -o %t2
+; RUN: llc %t -function-sections -filetype=obj -o %t2
 ; RUN: llvm-objdump --section-headers  %t2 | FileCheck %s --check-prefix=CHECK-OBJ
 ; RUN: llvm-mc %t1 -filetype=obj -o %t3
 ; RUN: llvm-objdump --section-headers  %t3 | FileCheck %s --check-prefix=CHECK-OBJ
Index: llvm/test/Transforms/SampleProfile/pseudo-probe-emit-inline.ll
===
--- llvm/test/Transforms/SampleProfile/pseudo-probe-emit-inline.ll
+++ llvm/test/Transforms/SampleProfile/pseudo-probe-emit-inline.ll
@@ -1,9 +1,9 @@
 ; REQUIRES: x86_64-linux
 ; RUN: opt < %s -passes='pseudo-probe,cgscc(inline)' -function-sections -mtriple=x86_64-unknown-linux-gnu -S -o %t
 ; RUN: FileCheck %s < %t --check-prefix=CHECK-IL
-; RUN: llc -pseudo-probe-for-profiling -function-sections <%t -filetype=asm -o %t1
+; RUN: llc -function-sections <%t -filetype=asm -o %t1
 ; RUN: FileCheck %s < %t1 --check-prefix=CHECK-ASM
-; RUN: llc -pseudo-probe-for-profiling -function-sections <%t -filetype=obj -o %t2
+; RUN: llc -function-sections <%t -filetype=obj -o %t2
 ; RUN: llvm-objdump --section-headers  %t2 | FileCheck %s --check-prefix=CHECK-OBJ
 ; RUN: llvm-mc -filetype=asm <%t1 -o %t3
 ; RUN: FileCheck %s < %t3 --check-prefix=CHECK-ASM
Index: llvm/test/Transforms/SampleProfile/pseudo-probe-dangle.ll

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Ron Lieberman via Phabricator via cfe-commits
ronlieb added a subscriber: pdhaliwal.
ronlieb added a comment.

@pdhaliwal 
i will pass the problem over to Pushpinder Singh who should be waking up soon.

George, thank you for reverting it. i can reproduce the issue on a local system.
building latest (revert present) passes.
Revert the revert and fails

one test that fails :
in build directory:
export LOC=`pwd`; cd $LOC/runtimes/runtimes-bins/openmp && /usr/bin/python3.8 
$LOC/./bin/llvm-l
it -vv --show-unsupported --show-xfail -j 32  
$LOC/runtimes/runtimes-bins/openmp/libomptarget/test/amdgcn-amd-amdhsa/mapping/declare_mapper_targe
t_data.cpp

command stderr:
===

[GPU Memory Error] Addr: 0x0 Reason: Page not present or supervisor privilege.
Memory access fault by GPU node-2 (Agent handle: 0x18ae1d0) on address (nil). 
Reason: Page not present or supervisor privilege.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D110127: [Clang] Support typedef with btf_tag attributes

2021-09-21 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

In D110127#3012215 , @aaron.ballman 
wrote:

>> First, to build linux kernel with btf_tag annotated user pointer, we have
>>
>> #define __user __attribute__((btf_tag("user")))
>> and the linux kernel contains code like below ([2])
>>
>> typedef __signalfn_t __user *__sighandler_t;
>> and the user attribute applies to typedef type sighandler_t.
>> So clang needs to support btf_tag attribute with typedef type
>> to avoid compilation error.
>
> I want to make sure we're clear on the semantics here. That defines 
> `__sighandler_t` to be the type `__signalfn_t __user *`, so you expect this 
> to annotate the type, not the declaration of the typedef. So this is about 
> allowing `btf_tag` on types in addition to declarations?

This is a good question and below are some examples:
[$ ~/work/tests/llvm/btf_tag] cat t.c
#define __tag1 __attribute__((btf_tag("tag1")))
typedef __tag1 unsigned * __u;
__u u;
[$ ~/work/tests/llvm/btf_tag] clang -Xclang -ast-dump -c t.c
...

| -TypedefDecl 0x8279c00 <>  implicit 
__builtin_va_list 'struct __va_list_tag [1]' |
| `-ConstantArrayType 0x8234e30 'struct __va_list_tag [1]' 1
   |
| `-RecordType 0x8234c70 'struct __va_list_tag' 
   |
| `-Record 0x8234be8 '__va_list_tag'
   |
| -TypedefDecl 0x8279d00  col:27 referenced __u 'unsigned int 
*'  |
|   
   | -PointerType 0x8279cc0 'unsigned int *' |
|   
   | `-BuiltinType 0x8234040 'unsigned int'  |
| `-BTFTagAttr 0x8279d58  "tag1" 
   |
|

`-VarDecl 0x8279df0  col:5 u '__u':'unsigned int *'

[$ ~/work/tests/llvm/btf_tag] cat t.c
#define __tag1 __attribute__((btf_tag("tag1")))
typedef unsigned __tag1 * __u;
__u u;
[$ ~/work/tests/llvm/btf_tag] clang -Xclang -ast-dump -c t.c
...

| -TypedefDecl 0x8279c00 <>  implicit 
__builtin_va_list 'struct __va_list_tag [1]' |
| `-ConstantArrayType 0x8234e30 'struct __va_list_tag [1]' 1
   |
| `-RecordType 0x8234c70 'struct __va_list_tag' 
   |
| `-Record 0x8234be8 '__va_list_tag'
   |
| -TypedefDecl 0x8279d00  col:27 referenced __u 'unsigned int 
*'  |
|   
   | -PointerType 0x8279cc0 'unsigned int *' |
|   
   | `-BuiltinType 0x8234040 'unsigned int'  |
| `-BTFTagAttr 0x8279d58  "tag1" 
   |
|

`-VarDecl 0x8279df0  col:5 u '__u':'unsigned int *'

[$ ~/work/tests/llvm/btf_tag] cat t.c
#define __tag1 __attribute__((btf_tag("tag1")))
typedef unsigned * __tag1 __u;
__u u;
[$ ~/work/tests/llvm/btf_tag] clang -Xclang -ast-dump -c t.c
...

| -TypedefDecl 0x8279c00 <>  implicit 
__builtin_va_list 'struct __va_list_tag [1]' |
| `-ConstantArrayType 0x8234e30 'struct __va_list_tag [1]' 1
   |
| `-RecordType 0x8234c70 'struct __va_list_tag' 
   |
| `-Record 0x8234be8 '__va_list_tag'
   |
| -TypedefDecl 0x8279d00  col:27 referenced __u 'unsigned int 
*'  |
|   
   | -PointerType 0x8279cc0 'unsigned int *' |
|   
   | `-BuiltinType 0x8234040 'unsigned int'  |
| `-BTFTagAttr 0x8279d58  "tag1" 
   |
|

`-VarDecl 0x8279df0  col:5 u '__u':'unsigned int *'

[$ ~/work/tests/llvm/btf_tag] cat t.c
#define __tag1 __attribute__((btf_tag("tag1")))
typedef unsigned * __u __tag1;
__u u;
[$ ~/work/tests/llvm/btf_tag] clang -Xclang -ast-dump -c t.c
...

| -TypedefDecl 0x8279c00 <>  implicit 
__builtin_va_list 'struct __va_list_tag [1]' |
| `-ConstantArrayType 0x8234e30 'struct __va_list_tag [1]' 1
   |
| `-RecordType 0x8234c70 'struct __va_list_tag' 
   |
| `-Record 0x8234be8 '__va_list_tag'
 

[PATCH] D109437: [PowerPC] FP compare and test XL compat builtins.

2021-09-21 Thread Quinn Pham via Phabricator via cfe-commits
quinnp updated this revision to Diff 374064.
quinnp added a comment.

Separating the switch case in ISelLowering into two switch cases. One for 
`compare_exp_` and another for `test_data_class`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109437

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Basic/Targets/PPC.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtins-ppc-xlcompat-pwr9-error.c
  clang/test/CodeGen/builtins-ppc-xlcompat-test.c
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-test.ll

Index: llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-test.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-test.ll
@@ -0,0 +1,99 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-unknown \
+; RUN:   -mcpu=pwr9 < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-unknown \
+; RUN:   -mcpu=pwr9 < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-aix \
+; RUN:   -mcpu=pwr9 < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix \
+; RUN:   -mcpu=pwr9 < %s | FileCheck %s
+
+define i32 @test_builtin_ppc_compare_exp_eq(double %d) {
+; CHECK-LABEL: test_builtin_ppc_compare_exp_eq:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:xscmpexpdp 0, 1, 1
+; CHECK-NEXT:li 3, 0
+; CHECK-NEXT:li 4, 1
+; CHECK-NEXT:iseleq 3, 4, 3
+; CHECK-NEXT:blr
+entry:
+  %0 = tail call i32 @llvm.ppc.compare.exp.eq(double %d, double %d)
+  ret i32 %0
+}
+
+declare i32 @llvm.ppc.compare.exp.eq(double, double)
+
+define i32 @test_builtin_ppc_compare_exp_lt(double %d) {
+; CHECK-LABEL: test_builtin_ppc_compare_exp_lt:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:xscmpexpdp 0, 1, 1
+; CHECK-NEXT:li 3, 0
+; CHECK-NEXT:li 4, 1
+; CHECK-NEXT:isellt 3, 4, 3
+; CHECK-NEXT:blr
+entry:
+  %0 = tail call i32 @llvm.ppc.compare.exp.lt(double %d, double %d)
+  ret i32 %0
+}
+
+declare i32 @llvm.ppc.compare.exp.lt(double, double)
+
+define i32 @test_builtin_ppc_compare_exp_gt(double %d) {
+; CHECK-LABEL: test_builtin_ppc_compare_exp_gt:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:xscmpexpdp 0, 1, 1
+; CHECK-NEXT:li 3, 0
+; CHECK-NEXT:li 4, 1
+; CHECK-NEXT:iselgt 3, 4, 3
+; CHECK-NEXT:blr
+entry:
+  %0 = tail call i32 @llvm.ppc.compare.exp.gt(double %d, double %d)
+  ret i32 %0
+}
+
+declare i32 @llvm.ppc.compare.exp.gt(double, double)
+
+define i32 @test_builtin_ppc_compare_exp_uo(double %d) {
+; CHECK-LABEL: test_builtin_ppc_compare_exp_uo:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:xscmpexpdp 0, 1, 1
+; CHECK-NEXT:li 3, 0
+; CHECK-NEXT:li 4, 1
+; CHECK-NEXT:isel 3, 4, 3, 3
+; CHECK-NEXT:blr
+entry:
+  %0 = tail call i32 @llvm.ppc.compare.exp.uo(double %d, double %d)
+  ret i32 %0
+}
+
+declare i32 @llvm.ppc.compare.exp.uo(double, double)
+
+define i32 @test_builtin_ppc_test_data_class_d(double %d) {
+; CHECK-LABEL: test_builtin_ppc_test_data_class_d:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:xststdcdp 0, 1, 0
+; CHECK-NEXT:li 3, 0
+; CHECK-NEXT:li 4, 1
+; CHECK-NEXT:iseleq 3, 4, 3
+; CHECK-NEXT:blr
+entry:
+  %test_data_class = tail call i32 @llvm.ppc.test.data.class.d(double %d, i32 0)
+  ret i32 %test_data_class
+}
+
+declare i32 @llvm.ppc.test.data.class.d(double, i32 immarg)
+
+define i32 @test_builtin_ppc_test_data_class_f(float %f) {
+; CHECK-LABEL: test_builtin_ppc_test_data_class_f:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:xststdcsp 0, 1, 127
+; CHECK-NEXT:li 3, 0
+; CHECK-NEXT:li 4, 1
+; CHECK-NEXT:iseleq 3, 4, 3
+; CHECK-NEXT:blr
+entry:
+  %test_data_class = tail call i32 @llvm.ppc.test.data.class.f(float %f, i32 127)
+  ret i32 %test_data_class
+}
+
+declare i32 @llvm.ppc.test.data.class.f(float, i32 immarg)
Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
===
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -10373,6 +10373,56 @@
 }
 return DAG.getMergeValues(RetOps, dl);
   }
+  case Intrinsic::ppc_compare_exp_lt:
+  case Intrinsic::ppc_compare_exp_gt:
+  case Intrinsic::ppc_compare_exp_eq:
+  case Intrinsic::ppc_compare_exp_uo: {
+unsigned Pred;
+switch (IntrinsicID) {
+default:
+  llvm_unreachable("Unknown Intrinsic");
+case Intrinsic::ppc_compare_exp_lt:
+  Pred = PPC::PRED_LT;
+  break;
+case Intrinsic::ppc_compare_exp_gt:
+  Pred = PPC::PRED_GT;
+  

[PATCH] D109902: [PowerPC] Improved codegen related to xscvdpsxws/xscvdpuxws

2021-09-21 Thread Albion Fung via Phabricator via cfe-commits
Conanap updated this revision to Diff 374059.
Conanap marked an inline comment as done.
Conanap added a comment.

Removed AIX test line as it has the same code gen as BE


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

https://reviews.llvm.org/D109902

Files:
  llvm/lib/Target/PowerPC/PPCInstrVSX.td
  llvm/test/CodeGen/PowerPC/test-vector-insert.ll
  llvm/test/CodeGen/PowerPC/vec_conv_fp64_to_i32_elts.ll

Index: llvm/test/CodeGen/PowerPC/vec_conv_fp64_to_i32_elts.ll
===
--- llvm/test/CodeGen/PowerPC/vec_conv_fp64_to_i32_elts.ll
+++ llvm/test/CodeGen/PowerPC/vec_conv_fp64_to_i32_elts.ll
@@ -13,12 +13,8 @@
 ; CHECK-P8-LABEL: test2elt:
 ; CHECK-P8:   # %bb.0: # %entry
 ; CHECK-P8-NEXT:xxswapd vs0, v2
-; CHECK-P8-NEXT:xscvdpuxws f1, v2
-; CHECK-P8-NEXT:xscvdpuxws f0, f0
-; CHECK-P8-NEXT:mffprwz r3, f1
-; CHECK-P8-NEXT:mtvsrwz v2, r3
-; CHECK-P8-NEXT:mffprwz r4, f0
-; CHECK-P8-NEXT:mtvsrwz v3, r4
+; CHECK-P8-NEXT:xscvdpsxws v2, v2
+; CHECK-P8-NEXT:xscvdpsxws v3, f0
 ; CHECK-P8-NEXT:vmrghw v2, v2, v3
 ; CHECK-P8-NEXT:xxswapd vs0, v2
 ; CHECK-P8-NEXT:mffprd r3, f0
@@ -26,26 +22,18 @@
 ;
 ; CHECK-P9-LABEL: test2elt:
 ; CHECK-P9:   # %bb.0: # %entry
-; CHECK-P9-NEXT:xscvdpuxws f0, v2
-; CHECK-P9-NEXT:mffprwz r3, f0
 ; CHECK-P9-NEXT:xxswapd vs0, v2
-; CHECK-P9-NEXT:mtvsrwz v3, r3
-; CHECK-P9-NEXT:xscvdpuxws f0, f0
-; CHECK-P9-NEXT:mffprwz r3, f0
-; CHECK-P9-NEXT:mtvsrwz v2, r3
+; CHECK-P9-NEXT:xscvdpsxws v3, v2
+; CHECK-P9-NEXT:xscvdpsxws v2, f0
 ; CHECK-P9-NEXT:vmrghw v2, v3, v2
 ; CHECK-P9-NEXT:mfvsrld r3, v2
 ; CHECK-P9-NEXT:blr
 ;
 ; CHECK-BE-LABEL: test2elt:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:xscvdpuxws f0, v2
-; CHECK-BE-NEXT:mffprwz r3, f0
 ; CHECK-BE-NEXT:xxswapd vs0, v2
-; CHECK-BE-NEXT:mtvsrwz v3, r3
-; CHECK-BE-NEXT:xscvdpuxws f0, f0
-; CHECK-BE-NEXT:mffprwz r3, f0
-; CHECK-BE-NEXT:mtvsrwz v2, r3
+; CHECK-BE-NEXT:xscvdpsxws v3, v2
+; CHECK-BE-NEXT:xscvdpsxws v2, f0
 ; CHECK-BE-NEXT:vmrgow v2, v3, v2
 ; CHECK-BE-NEXT:mfvsrd r3, v2
 ; CHECK-BE-NEXT:blr
@@ -305,12 +293,8 @@
 ; CHECK-P8-LABEL: test2elt_signed:
 ; CHECK-P8:   # %bb.0: # %entry
 ; CHECK-P8-NEXT:xxswapd vs0, v2
-; CHECK-P8-NEXT:xscvdpsxws f1, v2
-; CHECK-P8-NEXT:xscvdpsxws f0, f0
-; CHECK-P8-NEXT:mffprwz r3, f1
-; CHECK-P8-NEXT:mtvsrwz v2, r3
-; CHECK-P8-NEXT:mffprwz r4, f0
-; CHECK-P8-NEXT:mtvsrwz v3, r4
+; CHECK-P8-NEXT:xscvdpsxws v2, v2
+; CHECK-P8-NEXT:xscvdpsxws v3, f0
 ; CHECK-P8-NEXT:vmrghw v2, v2, v3
 ; CHECK-P8-NEXT:xxswapd vs0, v2
 ; CHECK-P8-NEXT:mffprd r3, f0
@@ -318,26 +302,18 @@
 ;
 ; CHECK-P9-LABEL: test2elt_signed:
 ; CHECK-P9:   # %bb.0: # %entry
-; CHECK-P9-NEXT:xscvdpsxws f0, v2
-; CHECK-P9-NEXT:mffprwz r3, f0
 ; CHECK-P9-NEXT:xxswapd vs0, v2
-; CHECK-P9-NEXT:mtvsrwz v3, r3
-; CHECK-P9-NEXT:xscvdpsxws f0, f0
-; CHECK-P9-NEXT:mffprwz r3, f0
-; CHECK-P9-NEXT:mtvsrwz v2, r3
+; CHECK-P9-NEXT:xscvdpsxws v3, v2
+; CHECK-P9-NEXT:xscvdpsxws v2, f0
 ; CHECK-P9-NEXT:vmrghw v2, v3, v2
 ; CHECK-P9-NEXT:mfvsrld r3, v2
 ; CHECK-P9-NEXT:blr
 ;
 ; CHECK-BE-LABEL: test2elt_signed:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:xscvdpsxws f0, v2
-; CHECK-BE-NEXT:mffprwz r3, f0
 ; CHECK-BE-NEXT:xxswapd vs0, v2
-; CHECK-BE-NEXT:mtvsrwz v3, r3
-; CHECK-BE-NEXT:xscvdpsxws f0, f0
-; CHECK-BE-NEXT:mffprwz r3, f0
-; CHECK-BE-NEXT:mtvsrwz v2, r3
+; CHECK-BE-NEXT:xscvdpsxws v3, v2
+; CHECK-BE-NEXT:xscvdpsxws v2, f0
 ; CHECK-BE-NEXT:vmrgow v2, v3, v2
 ; CHECK-BE-NEXT:mfvsrd r3, v2
 ; CHECK-BE-NEXT:blr
Index: llvm/test/CodeGen/PowerPC/test-vector-insert.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/test-vector-insert.ll
@@ -0,0 +1,118 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; xscvdpsxws and uxws is only available on Power7 and above
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:  -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-LE
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
+; RUN:  -mcpu=pwr7 < %s | FileCheck %s --check-prefix=CHECK-BE
+
+define dso_local <4 x i32> @test(<4 x i32> %a, double %b) {
+; CHECK-LE-LABEL: test:
+; CHECK-LE:   # %bb.0: # %entry
+; CHECK-LE-NEXT:xscvdpsxws 35, 1
+; CHECK-LE-NEXT:addis 3, 2, .LCPI0_0@toc@ha
+; CHECK-LE-NEXT:addi 3, 3, .LCPI0_0@toc@l
+; CHECK-LE-NEXT:lvx 4, 0, 3
+; CHECK-LE-NEXT:vperm 2, 3, 2, 4
+; CHECK-LE-NEXT:blr
+;
+; CHECK-BE-LABEL: test:
+; CHECK-BE:   # %bb.0: # %entry
+; CHECK-BE-NEXT:xscvdpsxws 0, 1
+; CHECK-BE-NEXT:addi 3, 1, -4
+; CHECK-BE-NEXT:stfiwx 0, 0, 3
+; CHECK-BE-NEXT: 

[PATCH] D110116: [Clang] Ignore BTFTag attr if used as a type attribute

2021-09-21 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

@aaron.ballman Addressed your comments, please take a look. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110116

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


[PATCH] D110116: [Clang] Ignore BTFTag attr if used as a type attribute

2021-09-21 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 374057.
yonghong-song added a comment.

- change to use DeclOrTypeAttr in Attr.td to indicate the attribute can be used 
for declarations or type qualifier.
- add explanation of why the change in AttrDocs.td and the test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110116

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/AST/TypePrinter.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/Sema/attr-btf_tag.c


Index: clang/test/Sema/attr-btf_tag.c
===
--- clang/test/Sema/attr-btf_tag.c
+++ clang/test/Sema/attr-btf_tag.c
@@ -40,3 +40,11 @@
 int __tag1 foo(struct t1 *arg __tag1, struct t2 *arg2) {
   return arg->a + arg2->a;
 }
+
+void * convert(long arg) {
+  /* FIXME: the attribute __tag1 is accepted but didn't really do type 
conversion
+   * or enforce type checking. This is to permit linux kernel build with 
btf_tag
+   * attribute.
+   */
+  return (void __tag1 *)arg;
+}
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -8127,6 +8127,12 @@
 case ParsedAttr::IgnoredAttribute:
   break;
 
+case ParsedAttr::AT_BTFTag:
+  // FIXME: Linux kernel may also use this attribute for type casting 
check,
+  // which clang doesn's support for now. Let us ignore them so linux 
kernel
+  // build won't break.
+  attr.setUsedAsTypeAttr();
+  break;
 case ParsedAttr::AT_MayAlias:
   // FIXME: This attribute needs to actually be handled, but if we ignore
   // it it breaks large amounts of Linux software.
Index: clang/lib/AST/TypePrinter.cpp
===
--- clang/lib/AST/TypePrinter.cpp
+++ clang/lib/AST/TypePrinter.cpp
@@ -1702,6 +1702,7 @@
   case attr::UPtr:
   case attr::AddressSpace:
   case attr::CmseNSCall:
+  case attr::BTFTag:
 llvm_unreachable("This attribute should have been handled already");
 
   case attr::NSReturnsRetained:
Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -2019,6 +2019,9 @@
 function, function parameter or variable declaration. If -g is specified,
 the ``ARGUMENT`` info will be preserved in IR and be emitted to dwarf.
 For BPF targets, the ``ARGUMENT`` info will be emitted to .BTF ELF section too.
+
+The attribute can also be used as a type qualifier. Right now it is accepted
+and silently ignored in order to permit linux kernel build with the attribute.
   }];
 }
 
Index: clang/include/clang/Basic/Attr.td
===
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1835,7 +1835,7 @@
   let LangOpts = [COnly];
 }
 
-def BTFTag : InheritableAttr {
+def BTFTag : DeclOrTypeAttr {
   let Spellings = [Clang<"btf_tag">];
   let Args = [StringArgument<"BTFTag">];
   let Subjects = SubjectList<[Var, Function, Record, Field], ErrorDiag>;


Index: clang/test/Sema/attr-btf_tag.c
===
--- clang/test/Sema/attr-btf_tag.c
+++ clang/test/Sema/attr-btf_tag.c
@@ -40,3 +40,11 @@
 int __tag1 foo(struct t1 *arg __tag1, struct t2 *arg2) {
   return arg->a + arg2->a;
 }
+
+void * convert(long arg) {
+  /* FIXME: the attribute __tag1 is accepted but didn't really do type conversion
+   * or enforce type checking. This is to permit linux kernel build with btf_tag
+   * attribute.
+   */
+  return (void __tag1 *)arg;
+}
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -8127,6 +8127,12 @@
 case ParsedAttr::IgnoredAttribute:
   break;
 
+case ParsedAttr::AT_BTFTag:
+  // FIXME: Linux kernel may also use this attribute for type casting check,
+  // which clang doesn's support for now. Let us ignore them so linux kernel
+  // build won't break.
+  attr.setUsedAsTypeAttr();
+  break;
 case ParsedAttr::AT_MayAlias:
   // FIXME: This attribute needs to actually be handled, but if we ignore
   // it it breaks large amounts of Linux software.
Index: clang/lib/AST/TypePrinter.cpp
===
--- clang/lib/AST/TypePrinter.cpp
+++ clang/lib/AST/TypePrinter.cpp
@@ -1702,6 +1702,7 @@
   case attr::UPtr:
   case attr::AddressSpace:
   case attr::CmseNSCall:
+  case attr::BTFTag:
 llvm_unreachable("This attribute should have been handled already");
 
   case attr::NSReturnsRetained:
Index: clang/include/clang/Basic/AttrDocs.td

[PATCH] D110204: Make DiagnosticInfoResourceLimit's limit param required

2021-09-21 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe42234383e2c: Make DiagnosticInfoResourceLimits limit 
param required (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110204

Files:
  clang/test/Misc/backend-resource-limit-diagnostics.cl
  clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp
  llvm/include/llvm/IR/DiagnosticInfo.h
  llvm/lib/CodeGen/PrologEpilogInserter.cpp
  llvm/lib/IR/DiagnosticInfo.cpp
  llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
  llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll

Index: llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll
===
--- llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll
+++ llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll
@@ -3,7 +3,7 @@
 
 declare void @llvm.memset.p5i8.i32(i8 addrspace(5)* nocapture, i8, i32, i32, i1) #1
 
-; ERROR: error: stack frame size (131061) exceeds limit in function 'stack_size_limit_wave64'
+; ERROR: error: stack frame size (131061) exceeds limit (131056) in function 'stack_size_limit_wave64'
 ; GCN: ; ScratchSize: 131061
 define amdgpu_kernel void @stack_size_limit_wave64() #0 {
 entry:
@@ -13,7 +13,7 @@
   ret void
 }
 
-; ERROR: error: stack frame size (262117) exceeds limit in function 'stack_size_limit_wave32'
+; ERROR: error: stack frame size (262117) exceeds limit (262112) in function 'stack_size_limit_wave32'
 ; GCN: ; ScratchSize: 262117
 define amdgpu_kernel void @stack_size_limit_wave32() #1 {
 entry:
Index: llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -678,7 +678,8 @@
   GCNSubtarget::MaxWaveScratchSize / STM.getWavefrontSize();
   if (ProgInfo.ScratchSize > MaxScratchPerWorkitem) {
 DiagnosticInfoStackSize DiagStackSize(MF.getFunction(),
-  ProgInfo.ScratchSize, DS_Error);
+  ProgInfo.ScratchSize,
+  MaxScratchPerWorkitem, DS_Error);
 MF.getFunction().getContext().diagnose(DiagStackSize);
   }
 
@@ -697,11 +698,9 @@
 if (ProgInfo.NumSGPR > MaxAddressableNumSGPRs) {
   // This can happen due to a compiler bug or when using inline asm.
   LLVMContext  = MF.getFunction().getContext();
-  DiagnosticInfoResourceLimit Diag(MF.getFunction(),
-   "addressable scalar registers",
-   ProgInfo.NumSGPR, DS_Error,
-   DK_ResourceLimit,
-   MaxAddressableNumSGPRs);
+  DiagnosticInfoResourceLimit Diag(
+  MF.getFunction(), "addressable scalar registers", ProgInfo.NumSGPR,
+  MaxAddressableNumSGPRs, DS_Error, DK_ResourceLimit);
   Ctx.diagnose(Diag);
   ProgInfo.NumSGPR = MaxAddressableNumSGPRs - 1;
 }
@@ -745,11 +744,9 @@
   // This can happen due to a compiler bug or when using inline asm to use
   // the registers which are usually reserved for vcc etc.
   LLVMContext  = MF.getFunction().getContext();
-  DiagnosticInfoResourceLimit Diag(MF.getFunction(),
-   "scalar registers",
-   ProgInfo.NumSGPR, DS_Error,
-   DK_ResourceLimit,
-   MaxAddressableNumSGPRs);
+  DiagnosticInfoResourceLimit Diag(MF.getFunction(), "scalar registers",
+   ProgInfo.NumSGPR, MaxAddressableNumSGPRs,
+   DS_Error, DK_ResourceLimit);
   Ctx.diagnose(Diag);
   ProgInfo.NumSGPR = MaxAddressableNumSGPRs;
   ProgInfo.NumSGPRsForWavesPerEU = MaxAddressableNumSGPRs;
@@ -766,14 +763,16 @@
   if (MFI->getNumUserSGPRs() > STM.getMaxNumUserSGPRs()) {
 LLVMContext  = MF.getFunction().getContext();
 DiagnosticInfoResourceLimit Diag(MF.getFunction(), "user SGPRs",
- MFI->getNumUserSGPRs(), DS_Error);
+ MFI->getNumUserSGPRs(),
+ STM.getMaxNumUserSGPRs(), DS_Error);
 Ctx.diagnose(Diag);
   }
 
   if (MFI->getLDSSize() > static_cast(STM.getLocalMemorySize())) {
 LLVMContext  = MF.getFunction().getContext();
 DiagnosticInfoResourceLimit Diag(MF.getFunction(), "local memory",
- MFI->getLDSSize(), DS_Error);
+ MFI->getLDSSize(),
+ STM.getLocalMemorySize(), DS_Error);
 Ctx.diagnose(Diag);
   }
 
Index: llvm/lib/IR/DiagnosticInfo.cpp

[clang] e422343 - Make DiagnosticInfoResourceLimit's limit param required

2021-09-21 Thread Arthur Eubanks via cfe-commits

Author: Arthur Eubanks
Date: 2021-09-21T15:27:58-07:00
New Revision: e42234383e2c0a7472413cd8047889f6ad4afc88

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

LOG: Make DiagnosticInfoResourceLimit's limit param required

And always print it.

This makes some LLVM diagnostics match up better with Clang's diagnostics.

Updated some AMDGPU uses of DiagnosticInfoResourceLimit and now we print
better diagnostics for those.

Reviewed By: dblaikie

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

Added: 


Modified: 
clang/test/Misc/backend-resource-limit-diagnostics.cl
clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp
llvm/include/llvm/IR/DiagnosticInfo.h
llvm/lib/CodeGen/PrologEpilogInserter.cpp
llvm/lib/IR/DiagnosticInfo.cpp
llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll

Removed: 




diff  --git a/clang/test/Misc/backend-resource-limit-diagnostics.cl 
b/clang/test/Misc/backend-resource-limit-diagnostics.cl
index d80f44f691867..fd37e0bd0ef86 100644
--- a/clang/test/Misc/backend-resource-limit-diagnostics.cl
+++ b/clang/test/Misc/backend-resource-limit-diagnostics.cl
@@ -1,7 +1,7 @@
 // REQUIRES: amdgpu-registered-target
 // RUN: not %clang_cc1 -emit-codegen-only -triple=amdgcn-- %s 2>&1 | FileCheck 
%s
 
-// CHECK: error: local memory (48) exceeds limit in function 'use_huge_lds'
+// CHECK: error: local memory (48) exceeds limit (32768) in function 
'use_huge_lds'
 kernel void use_huge_lds()
 {
 volatile local int huge[12];

diff  --git a/clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp 
b/clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp
index 79c6ba9b23f6d..aabadc61ecf00 100644
--- a/clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp
+++ b/clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp
@@ -13,7 +13,7 @@ namespace frameSizeThunkWarning {
   };
 
   // CHECK: warning: stack frame size ([[#]]) exceeds limit ([[#]]) in 
function 'frameSizeThunkWarning::B::f'
-  // CHECK: warning: stack frame size ([[#]]) exceeds limit in function 
'_ZTv0_n12_N21frameSizeThunkWarning1B1fEv'
+  // CHECK: warning: stack frame size ([[#]]) exceeds limit ([[#]]) in 
function '_ZTv0_n12_N21frameSizeThunkWarning1B1fEv'
   void B::f() {
 volatile int x = 0; // Ensure there is stack usage.
   }

diff  --git a/llvm/include/llvm/IR/DiagnosticInfo.h 
b/llvm/include/llvm/IR/DiagnosticInfo.h
index 164c43ee84bfe..44047d9f1211c 100644
--- a/llvm/include/llvm/IR/DiagnosticInfo.h
+++ b/llvm/include/llvm/IR/DiagnosticInfo.h
@@ -195,10 +195,9 @@ class DiagnosticInfoResourceLimit : public DiagnosticInfo {
   /// \p The function that is concerned by this stack size diagnostic.
   /// \p The computed stack size.
   DiagnosticInfoResourceLimit(const Function , const char *ResourceName,
-  uint64_t ResourceSize,
+  uint64_t ResourceSize, uint64_t ResourceLimit,
   DiagnosticSeverity Severity = DS_Warning,
-  DiagnosticKind Kind = DK_ResourceLimit,
-  uint64_t ResourceLimit = 0)
+  DiagnosticKind Kind = DK_ResourceLimit)
   : DiagnosticInfo(Kind, Severity), Fn(Fn), ResourceName(ResourceName),
 ResourceSize(ResourceSize), ResourceLimit(ResourceLimit) {}
 
@@ -219,10 +218,10 @@ class DiagnosticInfoStackSize : public 
DiagnosticInfoResourceLimit {
   void anchor() override;
 public:
   DiagnosticInfoStackSize(const Function , uint64_t StackSize,
-  DiagnosticSeverity Severity = DS_Warning,
-  uint64_t StackLimit = 0)
-  : DiagnosticInfoResourceLimit(Fn, "stack frame size", StackSize, 
Severity,
-DK_StackSize, StackLimit) {}
+  uint64_t StackLimit,
+  DiagnosticSeverity Severity = DS_Warning)
+  : DiagnosticInfoResourceLimit(Fn, "stack frame size", StackSize,
+StackLimit, Severity, DK_StackSize) {}
 
   uint64_t getStackSize() const { return getResourceSize(); }
   uint64_t getStackLimit() const { return getResourceLimit(); }

diff  --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp 
b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 1870bb4f445d8..b736aa213d092 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -285,7 +285,7 @@ bool PEI::runOnMachineFunction(MachineFunction ) {
 (void)Failed;
   }
   if (StackSize > Threshold) {
-DiagnosticInfoStackSize DiagStackSize(F, StackSize, DS_Warning, Threshold);
+DiagnosticInfoStackSize DiagStackSize(F, StackSize, 

[PATCH] D110204: Make DiagnosticInfoResourceLimit's limit param required

2021-09-21 Thread David Blaikie via Phabricator via cfe-commits
dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

Looks good!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110204

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


[PATCH] D110204: Make DiagnosticInfoResourceLimit's limit param required

2021-09-21 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
aeubanks added a reviewer: dblaikie.
Herald added subscribers: foad, dexonsmith, kerbowa, hiraditya, tpr, nhaehnle, 
jvesely, arsenm.
aeubanks requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

And always print it.

This makes some LLVM diagnostics match up better with Clang's diagnostics.

Updated some AMDGPU uses of DiagnosticInfoResourceLimit and now we print
better diagnostics for those.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110204

Files:
  clang/test/Misc/backend-resource-limit-diagnostics.cl
  clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp
  llvm/include/llvm/IR/DiagnosticInfo.h
  llvm/lib/CodeGen/PrologEpilogInserter.cpp
  llvm/lib/IR/DiagnosticInfo.cpp
  llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
  llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll

Index: llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll
===
--- llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll
+++ llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll
@@ -3,7 +3,7 @@
 
 declare void @llvm.memset.p5i8.i32(i8 addrspace(5)* nocapture, i8, i32, i32, i1) #1
 
-; ERROR: error: stack frame size (131061) exceeds limit in function 'stack_size_limit_wave64'
+; ERROR: error: stack frame size (131061) exceeds limit (131056) in function 'stack_size_limit_wave64'
 ; GCN: ; ScratchSize: 131061
 define amdgpu_kernel void @stack_size_limit_wave64() #0 {
 entry:
@@ -13,7 +13,7 @@
   ret void
 }
 
-; ERROR: error: stack frame size (262117) exceeds limit in function 'stack_size_limit_wave32'
+; ERROR: error: stack frame size (262117) exceeds limit (262112) in function 'stack_size_limit_wave32'
 ; GCN: ; ScratchSize: 262117
 define amdgpu_kernel void @stack_size_limit_wave32() #1 {
 entry:
Index: llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -678,7 +678,8 @@
   GCNSubtarget::MaxWaveScratchSize / STM.getWavefrontSize();
   if (ProgInfo.ScratchSize > MaxScratchPerWorkitem) {
 DiagnosticInfoStackSize DiagStackSize(MF.getFunction(),
-  ProgInfo.ScratchSize, DS_Error);
+  ProgInfo.ScratchSize,
+  MaxScratchPerWorkitem, DS_Error);
 MF.getFunction().getContext().diagnose(DiagStackSize);
   }
 
@@ -697,11 +698,9 @@
 if (ProgInfo.NumSGPR > MaxAddressableNumSGPRs) {
   // This can happen due to a compiler bug or when using inline asm.
   LLVMContext  = MF.getFunction().getContext();
-  DiagnosticInfoResourceLimit Diag(MF.getFunction(),
-   "addressable scalar registers",
-   ProgInfo.NumSGPR, DS_Error,
-   DK_ResourceLimit,
-   MaxAddressableNumSGPRs);
+  DiagnosticInfoResourceLimit Diag(
+  MF.getFunction(), "addressable scalar registers", ProgInfo.NumSGPR,
+  MaxAddressableNumSGPRs, DS_Error, DK_ResourceLimit);
   Ctx.diagnose(Diag);
   ProgInfo.NumSGPR = MaxAddressableNumSGPRs - 1;
 }
@@ -745,11 +744,9 @@
   // This can happen due to a compiler bug or when using inline asm to use
   // the registers which are usually reserved for vcc etc.
   LLVMContext  = MF.getFunction().getContext();
-  DiagnosticInfoResourceLimit Diag(MF.getFunction(),
-   "scalar registers",
-   ProgInfo.NumSGPR, DS_Error,
-   DK_ResourceLimit,
-   MaxAddressableNumSGPRs);
+  DiagnosticInfoResourceLimit Diag(MF.getFunction(), "scalar registers",
+   ProgInfo.NumSGPR, MaxAddressableNumSGPRs,
+   DS_Error, DK_ResourceLimit);
   Ctx.diagnose(Diag);
   ProgInfo.NumSGPR = MaxAddressableNumSGPRs;
   ProgInfo.NumSGPRsForWavesPerEU = MaxAddressableNumSGPRs;
@@ -766,14 +763,16 @@
   if (MFI->getNumUserSGPRs() > STM.getMaxNumUserSGPRs()) {
 LLVMContext  = MF.getFunction().getContext();
 DiagnosticInfoResourceLimit Diag(MF.getFunction(), "user SGPRs",
- MFI->getNumUserSGPRs(), DS_Error);
+ MFI->getNumUserSGPRs(),
+ STM.getMaxNumUserSGPRs(), DS_Error);
 Ctx.diagnose(Diag);
   }
 
   if (MFI->getLDSSize() > static_cast(STM.getLocalMemorySize())) {
 LLVMContext  = MF.getFunction().getContext();
 DiagnosticInfoResourceLimit Diag(MF.getFunction(), "local memory",
- MFI->getLDSSize(), DS_Error);
+ 

[PATCH] D110160: [clang][tooling] NFC: Refactor command-line diagnostic tests

2021-09-21 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

Stepping back, maybe it'd be better to use a more generic option that is 
unlikely to have special behaviour in any target (or downstream).

Best one I could find is triggering `err_drv_unknown_language` with `-x 
this-is-an-unknown-language`. WDYT?




Comment at: clang/unittests/Tooling/ToolingTest.cpp:280-281
   InMemoryFileSystem->addFile(
-  "test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int a() {}\n"));
-  ErrorCountingDiagnosticConsumer Consumer;
+  "test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("void a() {}\n"));
+  TextDiagnosticBuffer Consumer;
   Invocation.setDiagnosticConsumer();

Can this just be empty and use `-E`? But if you switch to another error maybe 
you don't need to modify this anyway?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110160

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


[PATCH] D110201: [clang] Make -Rpass imply -Rpass=.*

2021-09-21 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe1ed02181ffc: [clang] Make -Rpass imply -Rpass=.* (authored 
by aeubanks).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110201

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Frontend/optimization-remark-analysis.c
  clang/test/Frontend/optimization-remark.c


Index: clang/test/Frontend/optimization-remark.c
===
--- clang/test/Frontend/optimization-remark.c
+++ clang/test/Frontend/optimization-remark.c
@@ -26,11 +26,11 @@
 // RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -w 
-emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
 // RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -w 
-emit-llvm -mllvm -mandatory-inlining-first=false -o - 2>&1 | FileCheck %s 
--check-prefix=CHECK-REMARKS
 //
-// FIXME: -Reverything should imply -Rpass=.*.
-// RUN: %clang_cc1 %s -Reverything -emit-llvm -o - 2>/dev/null | FileCheck %s 
--check-prefix=CHECK-NO-REMARKS
+// -Reverything implies -Rpass=.*.
+// RUN: %clang_cc1 %s -Reverything -emit-llvm -o - 2>&1 | FileCheck %s 
--check-prefix=CHECK-REMARKS
 //
-// FIXME: -Rpass should either imply -Rpass=.* or should be rejected.
-// RUN: %clang_cc1 %s -Rpass -emit-llvm -o - 2>/dev/null | FileCheck %s 
--check-prefix=CHECK-NO-REMARKS
+// -Rpass implies -Rpass=.*
+// RUN: %clang_cc1 %s -Rpass -emit-llvm -o - 2>&1 | FileCheck %s 
--check-prefix=CHECK-REMARKS
 
 // CHECK-REMARKS: remark:
 // CHECK-NO-REMARKS-NOT: remark:
Index: clang/test/Frontend/optimization-remark-analysis.c
===
--- clang/test/Frontend/optimization-remark-analysis.c
+++ clang/test/Frontend/optimization-remark-analysis.c
@@ -1,8 +1,8 @@
 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm 
-Rpass-analysis -S %s -o - 2>&1 | FileCheck %s --check-prefix=RPASS
 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -S %s 
-o - 2>&1 | FileCheck %s
 
-// RPASS: {{.*}}:7:8: remark: loop not vectorized: loop contains a switch 
statement
-// CHECK-NOT: {{.*}}:7:8: remark: loop not vectorized: loop contains a switch 
statement
+// RPASS: {{.*}}:12:5: remark: loop not vectorized: loop contains a switch 
statement
+// CHECK-NOT: remark: loop not vectorized: loop contains a switch statement
 
 double foo(int N, int *Array) {
   double v = 0.0;
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1174,8 +1174,9 @@
 OptSpecifier OptEQ, StringRef Name) {
   CodeGenOptions::OptRemark Result;
 
-  auto InitializeResultPattern = [, , ](const Arg *A) {
-Result.Pattern = A->getValue();
+  auto InitializeResultPattern = [, , ](const Arg *A,
+  StringRef Pattern) {
+Result.Pattern = Pattern.str();
 
 std::string RegexError;
 Result.Regex = std::make_shared(Result.Pattern);
@@ -1200,19 +1201,21 @@
 Result.Kind = CodeGenOptions::RK_Disabled;
   else if (Value == "no-everything")
 Result.Kind = CodeGenOptions::RK_DisabledEverything;
+
+  if (Result.Kind == CodeGenOptions::RK_Disabled ||
+  Result.Kind == CodeGenOptions::RK_DisabledEverything) {
+Result.Pattern = "";
+Result.Regex = nullptr;
+  } else {
+InitializeResultPattern(A, ".*");
+  }
 } else if (A->getOption().matches(OptEQ)) {
   Result.Kind = CodeGenOptions::RK_WithPattern;
-  if (!InitializeResultPattern(A))
+  if (!InitializeResultPattern(A, A->getValue()))
 return CodeGenOptions::OptRemark();
 }
   }
 
-  if (Result.Kind == CodeGenOptions::RK_Disabled ||
-  Result.Kind == CodeGenOptions::RK_DisabledEverything) {
-Result.Pattern = "";
-Result.Regex = nullptr;
-  }
-
   return Result;
 }
 


Index: clang/test/Frontend/optimization-remark.c
===
--- clang/test/Frontend/optimization-remark.c
+++ clang/test/Frontend/optimization-remark.c
@@ -26,11 +26,11 @@
 // RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -w -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
 // RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -w -emit-llvm -mllvm -mandatory-inlining-first=false -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
 //
-// FIXME: -Reverything should imply -Rpass=.*.
-// RUN: %clang_cc1 %s -Reverything -emit-llvm -o - 2>/dev/null | FileCheck %s --check-prefix=CHECK-NO-REMARKS
+// -Reverything implies -Rpass=.*.
+// RUN: %clang_cc1 %s -Reverything 

[clang] e1ed021 - [clang] Make -Rpass imply -Rpass=.*

2021-09-21 Thread Arthur Eubanks via cfe-commits

Author: Arthur Eubanks
Date: 2021-09-21T14:35:56-07:00
New Revision: e1ed02181ffcfea7de952d252a5e25953c822251

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

LOG: [clang] Make -Rpass imply -Rpass=.*

Previously with -Rpass (and friends) we'd have remarks "enabled", but
without an actual regex.

As seen in the test change to line numbers, this can give us better
diagnostics by properly enabling NeedLocTracking with -Rpass.

Reviewed By: dblaikie

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

Added: 


Modified: 
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Frontend/optimization-remark-analysis.c
clang/test/Frontend/optimization-remark.c

Removed: 




diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 38abcf91ab7d3..10b2e96e89578 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1174,8 +1174,9 @@ ParseOptimizationRemark(DiagnosticsEngine , ArgList 
,
 OptSpecifier OptEQ, StringRef Name) {
   CodeGenOptions::OptRemark Result;
 
-  auto InitializeResultPattern = [, , ](const Arg *A) {
-Result.Pattern = A->getValue();
+  auto InitializeResultPattern = [, , ](const Arg *A,
+  StringRef Pattern) {
+Result.Pattern = Pattern.str();
 
 std::string RegexError;
 Result.Regex = std::make_shared(Result.Pattern);
@@ -1200,19 +1201,21 @@ ParseOptimizationRemark(DiagnosticsEngine , 
ArgList ,
 Result.Kind = CodeGenOptions::RK_Disabled;
   else if (Value == "no-everything")
 Result.Kind = CodeGenOptions::RK_DisabledEverything;
+
+  if (Result.Kind == CodeGenOptions::RK_Disabled ||
+  Result.Kind == CodeGenOptions::RK_DisabledEverything) {
+Result.Pattern = "";
+Result.Regex = nullptr;
+  } else {
+InitializeResultPattern(A, ".*");
+  }
 } else if (A->getOption().matches(OptEQ)) {
   Result.Kind = CodeGenOptions::RK_WithPattern;
-  if (!InitializeResultPattern(A))
+  if (!InitializeResultPattern(A, A->getValue()))
 return CodeGenOptions::OptRemark();
 }
   }
 
-  if (Result.Kind == CodeGenOptions::RK_Disabled ||
-  Result.Kind == CodeGenOptions::RK_DisabledEverything) {
-Result.Pattern = "";
-Result.Regex = nullptr;
-  }
-
   return Result;
 }
 

diff  --git a/clang/test/Frontend/optimization-remark-analysis.c 
b/clang/test/Frontend/optimization-remark-analysis.c
index b396327976186..e43984942a6ef 100644
--- a/clang/test/Frontend/optimization-remark-analysis.c
+++ b/clang/test/Frontend/optimization-remark-analysis.c
@@ -1,8 +1,8 @@
 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm 
-Rpass-analysis -S %s -o - 2>&1 | FileCheck %s --check-prefix=RPASS
 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -S %s 
-o - 2>&1 | FileCheck %s
 
-// RPASS: {{.*}}:7:8: remark: loop not vectorized: loop contains a switch 
statement
-// CHECK-NOT: {{.*}}:7:8: remark: loop not vectorized: loop contains a switch 
statement
+// RPASS: {{.*}}:12:5: remark: loop not vectorized: loop contains a switch 
statement
+// CHECK-NOT: remark: loop not vectorized: loop contains a switch statement
 
 double foo(int N, int *Array) {
   double v = 0.0;

diff  --git a/clang/test/Frontend/optimization-remark.c 
b/clang/test/Frontend/optimization-remark.c
index 2287693a45e40..d4cab0bdec0cb 100644
--- a/clang/test/Frontend/optimization-remark.c
+++ b/clang/test/Frontend/optimization-remark.c
@@ -26,11 +26,11 @@
 // RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -w 
-emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
 // RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -w 
-emit-llvm -mllvm -mandatory-inlining-first=false -o - 2>&1 | FileCheck %s 
--check-prefix=CHECK-REMARKS
 //
-// FIXME: -Reverything should imply -Rpass=.*.
-// RUN: %clang_cc1 %s -Reverything -emit-llvm -o - 2>/dev/null | FileCheck %s 
--check-prefix=CHECK-NO-REMARKS
+// -Reverything implies -Rpass=.*.
+// RUN: %clang_cc1 %s -Reverything -emit-llvm -o - 2>&1 | FileCheck %s 
--check-prefix=CHECK-REMARKS
 //
-// FIXME: -Rpass should either imply -Rpass=.* or should be rejected.
-// RUN: %clang_cc1 %s -Rpass -emit-llvm -o - 2>/dev/null | FileCheck %s 
--check-prefix=CHECK-NO-REMARKS
+// -Rpass implies -Rpass=.*
+// RUN: %clang_cc1 %s -Rpass -emit-llvm -o - 2>&1 | FileCheck %s 
--check-prefix=CHECK-REMARKS
 
 // CHECK-REMARKS: remark:
 // CHECK-NO-REMARKS-NOT: remark:



___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-21 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

Most of clang-tidy warnings are irrelevant -- it tries to parse the header all 
by itself, without CUDA headers.
It also ignores `NOLINTNEXTLINE(clang-diagnostic-error)` which was intended to 
suppress the warning triggered by `#error`.

The only useful one was in SemaChecking.cpp -- fixed now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110089

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


[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-21 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374034.
tra added a comment.

Undo useless NOLINT


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110089

Files:
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/__clang_cuda_runtime_wrapper.h
  clang/lib/Headers/__clang_cuda_texture_intrinsics.h
  clang/lib/Sema/SemaChecking.cpp

Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -1447,6 +1447,9 @@
   case llvm::Triple::riscv32:
   case llvm::Triple::riscv64:
 return CheckRISCVBuiltinFunctionCall(TI, BuiltinID, TheCall);
+  case llvm::Triple::nvptx:
+  case llvm::Triple::nvptx64:
+return CheckNVPTXBuiltinFunctionCall(BuiltinID, TheCall);
   }
 }
 
@@ -3559,6 +3562,27 @@
   return false;
 }
 
+static bool CheckNVVMTextureOp(Sema , unsigned BuiltinID, CallExpr *TheCall) {
+  // First argument of the __nvvm_texture_op must be a string literal.
+  Expr *ArgExpr = TheCall->getArg(0);
+  Expr::EvalResult ArgResult;
+  if (!ArgExpr->EvaluateAsConstantExpr(ArgResult, S.Context))
+return S.Diag(ArgExpr->getExprLoc(), diag::err_expr_not_string_literal)
+   << ArgExpr->getType();
+  return false;
+}
+
+bool Sema::CheckNVPTXBuiltinFunctionCall(unsigned BuiltinID,
+ CallExpr *TheCall) {
+  // position of memory order and scope arguments in the builtin
+  switch (BuiltinID) {
+  case Builtin::BI__nvvm_texture_op:
+return CheckNVVMTextureOp(*this, BuiltinID, TheCall);
+  default:
+return false;
+  }
+}
+
 bool Sema::CheckRISCVLMUL(CallExpr *TheCall, unsigned ArgNum) {
   llvm::APSInt Result;
 
Index: clang/lib/Headers/__clang_cuda_texture_intrinsics.h
===
--- /dev/null
+++ clang/lib/Headers/__clang_cuda_texture_intrinsics.h
@@ -0,0 +1,608 @@
+/*===--- __clang_cuda_texture_intrinsics.h - Device-side texture support ---===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===---===
+ */
+#ifndef __CLANG_CUDA_TEXTURE_INTRINSICS_H__
+#define __CLANG_CUDA_TEXTURE_INTRINSICS_H__
+#ifndef __CUDA__
+#error "This file is for CUDA __compilation only."
+#endif
+
+#pragma push_macro("__Args")
+#pragma push_macro("__ID")
+#pragma push_macro("__ID")
+#pragma push_macro("__IDV")
+#pragma push_macro("__IMPL_2DGATHER")
+#pragma push_macro("__IMPL_ALIAS")
+#pragma push_macro("__IMPL_ALIASI")
+#pragma push_macro("__IMPL_F1")
+#pragma push_macro("__IMPL_F3")
+#pragma push_macro("__IMPL_F3N")
+#pragma push_macro("__IMPL_F3S")
+#pragma push_macro("__IMPL_S")
+#pragma push_macro("__IMPL_S3")
+#pragma push_macro("__IMPL_S3I")
+#pragma push_macro("__IMPL_S3N")
+#pragma push_macro("__IMPL_S3NI")
+#pragma push_macro("__IMPL_S3S")
+#pragma push_macro("__IMPL_S3SI")
+#pragma push_macro("__IMPL_SI")
+#pragma push_macro("__L")
+#pragma push_macro("__STRIP_PARENS")
+#pragma push_macro("__V4")
+#pragma push_macro("__V4P")
+
+#include 
+
+namespace {
+
+template  struct __Tag;
+#define __nv_tex_surf_handler(__op, __ptr, ...)\
+  __tex_fetch<__Tag<__nvvm_texture_op(__op)>>(__ptr, __VA_ARGS__)
+
+#define __ID(__op) __Tag<__nvvm_texture_op(__op)>
+// Tags for variants of particular operation. E.g. tex2Dgather can translate
+// into 4 different instructions.
+#define __IDV(__op, __variant) \
+  __Tag<1 + __nvvm_texture_op(__op) * 100 + __variant>
+
+// Helper classes for figuring out the fetch type.
+template  struct __FT;
+// Fundamental types.
+template <> struct __FT {
+  using __bt = float;
+  using __ft = float4;
+};
+template <> struct __FT {
+  using __bt = char;
+  using __ft = int4;
+};
+template <> struct __FT {
+  using __bt = signed char;
+  using __ft = int4;
+};
+template <> struct __FT {
+  using __bt = unsigned char;
+  using __ft = uint4;
+};
+template <> struct __FT {
+  using __bt = short;
+  using __ft = int4;
+};
+template <> struct __FT {
+  using __bt = ushort;
+  using __ft = uint4;
+};
+template <> struct __FT {
+  using __bt = int;
+  using __ft = int4;
+};
+template <> struct __FT {
+  using __bt = uint;
+  using __ft = uint4;
+};
+
+// Derived base/fetch types for N-element vectors.
+template  struct __FT {
+  using __bt = decltype(__T::x);
+  using __ft = typename __FT<__bt>::__ft;
+};
+
+// Classes that implement specific texture ops.
+template  struct __tex_fetch_v4;
+template <> struct __tex_fetch_v4<__Tag<-1>>; // Unknown op
+
+// Helper macros to strip parens from a macro 

[PATCH] D110068: [Clang][AST] Resolve FIXME: Remove ObjCObjectPointer from isSpecifierType

2021-09-21 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

I'm a bit hesitant to trust lack of tests as proof that old FIXMEs can be 
resolved safely. Can you add some background information about why this was 
originally a specifier, and why it's safe to fix it now? (If you don't know, I 
suggest looking through git-blame to figure it out (unless @ahatanak already 
knows?).)




Comment at: clang/lib/AST/DeclPrinter.cpp:161-163
+else if (const ArrayType *ATy = dyn_cast(BaseType))
   BaseType = ATy->getElementType();
+else if (const FunctionType *FTy = BaseType->getAs())

Seems unrelated to this commit?



Comment at: clang/lib/AST/TypePrinter.cpp:313
   // Print qualifiers as appropriate.
-
   bool CanPrefixQualifiers = false;

Seems unrelated to this commit?


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

https://reviews.llvm.org/D110068

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


[PATCH] D110084: [PowerPC] Support for vector bool int128 on vector comparison builtins

2021-09-21 Thread Albion Fung via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb93359ea3fe5: [PowerPC] Support for vector bool int128 on 
vector comparison builtins (authored by Conanap).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110084

Files:
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/builtins-ppc-p10vector.c

Index: clang/test/CodeGen/builtins-ppc-p10vector.c
===
--- clang/test/CodeGen/builtins-ppc-p10vector.c
+++ clang/test/CodeGen/builtins-ppc-p10vector.c
@@ -19,6 +19,7 @@
 vector unsigned long long vulla, vullb, vullc;
 vector signed __int128 vsi128a, vsi128b, vsi128c;
 vector unsigned __int128 vui128a, vui128b, vui128c;
+vector bool __int128 vbi128a, vbi128b;
 vector float vfa, vfb;
 vector double vda, vdb;
 float fa;
@@ -1637,6 +1638,13 @@
   return vec_cmpeq(vui128a, vui128b);
 }
 
+vector bool __int128 test_vec_cmpeq_bool_int128(void) {
+  // CHECK-LABEL: @test_vec_cmpeq_bool_int128(
+  // CHECK: call <1 x i128> @llvm.ppc.altivec.vcmpequq(<1 x i128>
+  // CHECK-NEXT: ret <1 x i128>
+  return vec_cmpeq(vbi128a, vbi128b);
+}
+
 vector bool __int128 test_vec_cmpne_s128(void) {
   // CHECK-LABEL: @test_vec_cmpne_s128(
   // CHECK: call <1 x i128> @llvm.ppc.altivec.vcmpequq(<1 x i128>
@@ -1653,6 +1661,14 @@
   return vec_cmpne(vui128a, vui128b);
 }
 
+vector bool __int128 test_vec_cmpne_bool_int128(void) {
+  // CHECK-LABEL: @test_vec_cmpne_bool_int128(
+  // CHECK: call <1 x i128> @llvm.ppc.altivec.vcmpequq(<1 x i128>
+  // CHECK-NEXT: %neg.i = xor <1 x i128> %4, 
+  // CHECK-NEXT: ret <1 x i128>
+  return vec_cmpne(vbi128a, vbi128b);
+}
+
 vector bool __int128 test_vec_cmpgt_s128(void) {
   // CHECK-LABEL: @test_vec_cmpgt_s128(
   // CHECK: call <1 x i128> @llvm.ppc.altivec.vcmpgtsq(<1 x i128>
@@ -1727,6 +1743,13 @@
   return vec_any_eq(vsi128a, vsi128b);
 }
 
+int test_vec_any_eq_bool_int128(void) {
+  // CHECK-LABEL: @test_vec_any_eq_bool_int128(
+  // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 1, <1 x i128> %2, <1 x i128> %3)
+  // CHECK-NEXT: ret i32
+  return vec_any_eq(vbi128a, vbi128b);
+}
+
 int test_vec_any_ne_s128(void) {
   // CHECK-LABEL: @test_vec_any_ne_s128(
   // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 3, <1 x i128> %2, <1 x i128> %3)
@@ -1741,6 +1764,13 @@
   return vec_any_ne(vui128a, vui128b);
 }
 
+int test_vec_any_ne_bool_int128(void) {
+  // CHECK-LABEL: @test_vec_any_ne_bool_int128(
+  // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 3, <1 x i128> %2, <1 x i128> %3)
+  // CHECK-NEXT: ret i32
+  return vec_any_ne(vbi128a, vbi128b);
+}
+
 int test_vec_any_lt_s128(void) {
   // CHECK-LABEL: @test_vec_any_lt_s128(
   // CHECK: call i32 @llvm.ppc.altivec.vcmpgtsq.p(i32 1, <1 x i128> %2, <1 x i128> %3)
@@ -1811,6 +1841,13 @@
   return vec_all_eq(vui128a, vui128b);
 }
 
+int test_vec_all_eq_bool_int128(void) {
+  // CHECK-LABEL: @test_vec_all_eq_bool_int128
+  // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 2, <1 x i128> %2, <1 x i128> %3)
+  // CHECK-NEXT: ret i32
+  return vec_all_eq(vbi128a, vbi128b);
+}
+
 int test_vec_all_ne_s128(void) {
   // CHECK-LABEL: @test_vec_all_ne_s128(
   // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 0, <1 x i128> %2, <1 x i128> %3)
@@ -1825,6 +1862,13 @@
   return vec_all_ne(vui128a, vui128b);
 }
 
+int test_vec_all_ne_bool_int128(void) {
+  // CHECK-LABEL: test_vec_all_ne_bool_int128
+  // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 0, <1 x i128> %2, <1 x i128> %3)
+  // CHECK-NEXT: ret i32
+  return vec_all_ne(vbi128a, vbi128b);
+}
+
 int test_vec_all_lt_s128(void) {
   // CHECK-LABEL: @test_vec_all_lt_s128(
   // CHECK: call i32 @llvm.ppc.altivec.vcmpgtsq.p(i32 2, <1 x i128> %2, <1 x i128> %3)
Index: clang/lib/Headers/altivec.h
===
--- clang/lib/Headers/altivec.h
+++ clang/lib/Headers/altivec.h
@@ -1810,6 +1810,11 @@
   return (vector bool __int128)__builtin_altivec_vcmpequq(
   (vector bool __int128)__a, (vector bool __int128)__b);
 }
+
+static __inline__ vector bool __int128 __ATTRS_o_ai
+vec_cmpeq(vector bool __int128 __a, vector bool  __int128 __b) {
+  return (vector bool __int128)__builtin_altivec_vcmpequq(__a, __b);
+}
 #endif
 
 #ifdef __POWER9_VECTOR__
@@ -1887,6 +1892,11 @@
   return (vector bool __int128) ~(__builtin_altivec_vcmpequq(
   (vector bool __int128)__a, (vector bool __int128)__b));
 }
+
+static __inline__ vector bool __int128 __ATTRS_o_ai
+vec_cmpne(vector bool __int128 __a, vector bool __int128 __b) {
+  return (vector bool __int128) ~(__builtin_altivec_vcmpequq(__a, __b));
+}
 #endif
 
 /* vec_cmpnez */
@@ -14870,6 +14880,11 @@
   vector unsigned __int128 __b) {
   return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b);
 }
+
+static __inline__ int 

[clang] b93359e - [PowerPC] Support for vector bool int128 on vector comparison builtins

2021-09-21 Thread Albion Fung via cfe-commits

Author: Albion Fung
Date: 2021-09-21T16:29:37-05:00
New Revision: b93359ea3fe59ea0c652f5e61ee68231e2fb60c4

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

LOG: [PowerPC] Support for vector bool int128 on vector comparison builtins

This patch implements support for the type vector bool int128
for arguments on vector comparison builtins listed below,
which would otherwise crash due to ambiguity.

The following builtins are added:

vec_all_eq (vector bool __int128, vector bool __int128)
vec_all_ne (vector bool __int128, vector bool __int128)
vec_any_eq (vector bool __int128, vector bool __int128)
vec_any_ne (vector bool __int128, vector bool __int128)
vec_cmpne(vector bool __int128 a, vector bool __int128 b)
vec_cmpeq(vector bool __int128 a, vector bool __int128 b)

Differential revision: https://reviews.llvm.org/D110084

Added: 


Modified: 
clang/lib/Headers/altivec.h
clang/test/CodeGen/builtins-ppc-p10vector.c

Removed: 




diff  --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h
index fa9100a2639db..239c93d5b115c 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -1810,6 +1810,11 @@ vec_cmpeq(vector unsigned __int128 __a, vector unsigned 
__int128 __b) {
   return (vector bool __int128)__builtin_altivec_vcmpequq(
   (vector bool __int128)__a, (vector bool __int128)__b);
 }
+
+static __inline__ vector bool __int128 __ATTRS_o_ai
+vec_cmpeq(vector bool __int128 __a, vector bool  __int128 __b) {
+  return (vector bool __int128)__builtin_altivec_vcmpequq(__a, __b);
+}
 #endif
 
 #ifdef __POWER9_VECTOR__
@@ -1887,6 +1892,11 @@ vec_cmpne(vector signed __int128 __a, vector signed 
__int128 __b) {
   return (vector bool __int128) ~(__builtin_altivec_vcmpequq(
   (vector bool __int128)__a, (vector bool __int128)__b));
 }
+
+static __inline__ vector bool __int128 __ATTRS_o_ai
+vec_cmpne(vector bool __int128 __a, vector bool __int128 __b) {
+  return (vector bool __int128) ~(__builtin_altivec_vcmpequq(__a, __b));
+}
 #endif
 
 /* vec_cmpnez */
@@ -14870,6 +14880,11 @@ static __inline__ int __ATTRS_o_ai vec_all_eq(vector 
unsigned __int128 __a,
   vector unsigned __int128 __b) {
   return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b);
 }
+
+static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool __int128 __a,
+  vector bool __int128 __b) {
+  return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b);
+}
 #endif
 
 /* vec_all_ge */
@@ -15815,6 +15830,11 @@ static __inline__ int __ATTRS_o_ai vec_all_ne(vector 
unsigned __int128 __a,
   vector unsigned __int128 __b) {
   return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b);
 }
+
+static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool __int128 __a,
+  vector bool __int128 __b) {
+  return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b);
+}
 #endif
 
 /* vec_all_nge */
@@ -16104,6 +16124,11 @@ static __inline__ int __ATTRS_o_ai vec_any_eq(vector 
unsigned __int128 __a,
   vector unsigned __int128 __b) {
   return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b);
 }
+
+static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool __int128 __a,
+  vector bool __int128 __b) {
+  return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b);
+}
 #endif
 
 /* vec_any_ge */
@@ -17079,6 +17104,11 @@ static __inline__ int __ATTRS_o_ai vec_any_ne(vector 
unsigned __int128 __a,
   vector unsigned __int128 __b) {
   return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b);
 }
+
+static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool __int128 __a,
+  vector bool __int128 __b) {
+  return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b);
+}
 #endif
 
 /* vec_any_nge */

diff  --git a/clang/test/CodeGen/builtins-ppc-p10vector.c 
b/clang/test/CodeGen/builtins-ppc-p10vector.c
index f97b445509267..8816ae8028ebf 100644
--- a/clang/test/CodeGen/builtins-ppc-p10vector.c
+++ b/clang/test/CodeGen/builtins-ppc-p10vector.c
@@ -19,6 +19,7 @@ vector signed long long vslla, vsllb;
 vector unsigned long long vulla, vullb, vullc;
 vector signed __int128 vsi128a, vsi128b, vsi128c;
 vector unsigned __int128 vui128a, vui128b, vui128c;
+vector bool __int128 vbi128a, vbi128b;
 vector float vfa, vfb;
 vector double vda, vdb;
 float fa;
@@ -1637,6 +1638,13 @@ vector bool __int128 test_vec_cmpeq_u128(void) {
   return vec_cmpeq(vui128a, vui128b);
 }
 
+vector bool __int128 test_vec_cmpeq_bool_int128(void) {
+  // CHECK-LABEL: @test_vec_cmpeq_bool_int128(
+  // 

[PATCH] D110201: [clang] Make -Rpass imply -Rpass=.*

2021-09-21 Thread David Blaikie via Phabricator via cfe-commits
dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

Great!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110201

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


[PATCH] D109632: [clang] de-duplicate methods from AST files

2021-09-21 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

In D109632#3013523 , @vsapsai wrote:

> 2. Serialize only methods owned by the current module (and change 
> `ReadMethodPoolVisitor` appropriately).

Would that require visiting all in-memory modules every time there's a global 
method pool lookup?

If so, that sounds expensive... and similar to the problem that had to be 
solved to make identifier lookup fast. Maybe the same approach can/should be 
used here?

Or if not, can you clarify for me?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109632

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


[PATCH] D110201: [clang] Make -Rpass imply -Rpass=.*

2021-09-21 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
aeubanks added a reviewer: dblaikie.
aeubanks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Previously with -Rpass (and friends) we'd have remarks "enabled", but
without an actual regex.

As seen in the test change to line numbers, this can give us better
diagnostics by properly enabling NeedLocTracking with -Rpass.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110201

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Frontend/optimization-remark-analysis.c
  clang/test/Frontend/optimization-remark.c


Index: clang/test/Frontend/optimization-remark.c
===
--- clang/test/Frontend/optimization-remark.c
+++ clang/test/Frontend/optimization-remark.c
@@ -26,11 +26,11 @@
 // RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -w 
-emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
 // RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -w 
-emit-llvm -mllvm -mandatory-inlining-first=false -o - 2>&1 | FileCheck %s 
--check-prefix=CHECK-REMARKS
 //
-// FIXME: -Reverything should imply -Rpass=.*.
-// RUN: %clang_cc1 %s -Reverything -emit-llvm -o - 2>/dev/null | FileCheck %s 
--check-prefix=CHECK-NO-REMARKS
+// -Reverything implies -Rpass=.*.
+// RUN: %clang_cc1 %s -Reverything -emit-llvm -o - 2>&1 | FileCheck %s 
--check-prefix=CHECK-REMARKS
 //
-// FIXME: -Rpass should either imply -Rpass=.* or should be rejected.
-// RUN: %clang_cc1 %s -Rpass -emit-llvm -o - 2>/dev/null | FileCheck %s 
--check-prefix=CHECK-NO-REMARKS
+// -Rpass implies -Rpass=.*
+// RUN: %clang_cc1 %s -Rpass -emit-llvm -o - 2>&1 | FileCheck %s 
--check-prefix=CHECK-REMARKS
 
 // CHECK-REMARKS: remark:
 // CHECK-NO-REMARKS-NOT: remark:
Index: clang/test/Frontend/optimization-remark-analysis.c
===
--- clang/test/Frontend/optimization-remark-analysis.c
+++ clang/test/Frontend/optimization-remark-analysis.c
@@ -1,8 +1,8 @@
 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm 
-Rpass-analysis -S %s -o - 2>&1 | FileCheck %s --check-prefix=RPASS
 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -S %s 
-o - 2>&1 | FileCheck %s
 
-// RPASS: {{.*}}:7:8: remark: loop not vectorized: loop contains a switch 
statement
-// CHECK-NOT: {{.*}}:7:8: remark: loop not vectorized: loop contains a switch 
statement
+// RPASS: {{.*}}:12:5: remark: loop not vectorized: loop contains a switch 
statement
+// CHECK-NOT: remark: loop not vectorized: loop contains a switch statement
 
 double foo(int N, int *Array) {
   double v = 0.0;
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1174,8 +1174,9 @@
 OptSpecifier OptEQ, StringRef Name) {
   CodeGenOptions::OptRemark Result;
 
-  auto InitializeResultPattern = [, , ](const Arg *A) {
-Result.Pattern = A->getValue();
+  auto InitializeResultPattern = [, , ](const Arg *A,
+  StringRef Pattern) {
+Result.Pattern = Pattern.str();
 
 std::string RegexError;
 Result.Regex = std::make_shared(Result.Pattern);
@@ -1200,19 +1201,21 @@
 Result.Kind = CodeGenOptions::RK_Disabled;
   else if (Value == "no-everything")
 Result.Kind = CodeGenOptions::RK_DisabledEverything;
+
+  if (Result.Kind == CodeGenOptions::RK_Disabled ||
+  Result.Kind == CodeGenOptions::RK_DisabledEverything) {
+Result.Pattern = "";
+Result.Regex = nullptr;
+  } else {
+InitializeResultPattern(A, ".*");
+  }
 } else if (A->getOption().matches(OptEQ)) {
   Result.Kind = CodeGenOptions::RK_WithPattern;
-  if (!InitializeResultPattern(A))
+  if (!InitializeResultPattern(A, A->getValue()))
 return CodeGenOptions::OptRemark();
 }
   }
 
-  if (Result.Kind == CodeGenOptions::RK_Disabled ||
-  Result.Kind == CodeGenOptions::RK_DisabledEverything) {
-Result.Pattern = "";
-Result.Regex = nullptr;
-  }
-
   return Result;
 }
 


Index: clang/test/Frontend/optimization-remark.c
===
--- clang/test/Frontend/optimization-remark.c
+++ clang/test/Frontend/optimization-remark.c
@@ -26,11 +26,11 @@
 // RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -w -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
 // RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -w -emit-llvm -mllvm -mandatory-inlining-first=false -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
 //
-// FIXME: -Reverything should imply -Rpass=.*.
-// RUN: %clang_cc1 %s -Reverything -emit-llvm -o - 

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-21 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374028.
tra added a comment.

Minor cleanups


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110089

Files:
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/__clang_cuda_runtime_wrapper.h
  clang/lib/Headers/__clang_cuda_texture_intrinsics.h
  clang/lib/Sema/SemaChecking.cpp

Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -1447,6 +1447,9 @@
   case llvm::Triple::riscv32:
   case llvm::Triple::riscv64:
 return CheckRISCVBuiltinFunctionCall(TI, BuiltinID, TheCall);
+  case llvm::Triple::nvptx:
+  case llvm::Triple::nvptx64:
+return CheckNVPTXBuiltinFunctionCall(BuiltinID, TheCall);
   }
 }
 
@@ -3559,6 +3562,27 @@
   return false;
 }
 
+static bool CheckNVVMTextureOp(Sema , unsigned BuiltinID, CallExpr *TheCall) {
+  // First argument of the __nvvm_texture_op must be a string literal.
+  Expr *ArgExpr = TheCall->getArg(0);
+  Expr::EvalResult ArgResult;
+  if (!ArgExpr->EvaluateAsConstantExpr(ArgResult, S.Context))
+return S.Diag(ArgExpr->getExprLoc(), diag::err_expr_not_string_literal)
+   << ArgExpr->getType();
+  return false;
+}
+
+bool Sema::CheckNVPTXBuiltinFunctionCall(unsigned BuiltinID,
+ CallExpr *TheCall) {
+  // position of memory order and scope arguments in the builtin
+  switch (BuiltinID) {
+  case Builtin::BI__nvvm_texture_op:
+return CheckNVVMTextureOp(*this, BuiltinID, TheCall);
+  default:
+return false;
+  }
+}
+
 bool Sema::CheckRISCVLMUL(CallExpr *TheCall, unsigned ArgNum) {
   llvm::APSInt Result;
 
Index: clang/lib/Headers/__clang_cuda_texture_intrinsics.h
===
--- /dev/null
+++ clang/lib/Headers/__clang_cuda_texture_intrinsics.h
@@ -0,0 +1,609 @@
+/*===--- __clang_cuda_texture_intrinsics.h - Device-side texture support ---===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===---===
+ */
+#ifndef __CLANG_CUDA_TEXTURE_INTRINSICS_H__
+#define __CLANG_CUDA_TEXTURE_INTRINSICS_H__
+#ifndef __CUDA__
+// NOLINTNEXTLINE(clang-diagnostic-error)
+#error "This file is for CUDA __compilation only."
+#endif
+
+#pragma push_macro("__Args")
+#pragma push_macro("__ID")
+#pragma push_macro("__ID")
+#pragma push_macro("__IDV")
+#pragma push_macro("__IMPL_2DGATHER")
+#pragma push_macro("__IMPL_ALIAS")
+#pragma push_macro("__IMPL_ALIASI")
+#pragma push_macro("__IMPL_F1")
+#pragma push_macro("__IMPL_F3")
+#pragma push_macro("__IMPL_F3N")
+#pragma push_macro("__IMPL_F3S")
+#pragma push_macro("__IMPL_S")
+#pragma push_macro("__IMPL_S3")
+#pragma push_macro("__IMPL_S3I")
+#pragma push_macro("__IMPL_S3N")
+#pragma push_macro("__IMPL_S3NI")
+#pragma push_macro("__IMPL_S3S")
+#pragma push_macro("__IMPL_S3SI")
+#pragma push_macro("__IMPL_SI")
+#pragma push_macro("__L")
+#pragma push_macro("__STRIP_PARENS")
+#pragma push_macro("__V4")
+#pragma push_macro("__V4P")
+
+#include 
+
+namespace {
+
+template  struct __Tag;
+#define __nv_tex_surf_handler(__op, __ptr, ...)\
+  __tex_fetch<__Tag<__nvvm_texture_op(__op)>>(__ptr, __VA_ARGS__)
+
+#define __ID(__op) __Tag<__nvvm_texture_op(__op)>
+// Tags for variants of particular operation. E.g. tex2Dgather can translate
+// into 4 different instructions.
+#define __IDV(__op, __variant) \
+  __Tag<1 + __nvvm_texture_op(__op) * 100 + __variant>
+
+// Helper classes for figuring out the fetch type.
+template  struct __FT;
+// Fundamental types.
+template <> struct __FT {
+  using __bt = float;
+  using __ft = float4;
+};
+template <> struct __FT {
+  using __bt = char;
+  using __ft = int4;
+};
+template <> struct __FT {
+  using __bt = signed char;
+  using __ft = int4;
+};
+template <> struct __FT {
+  using __bt = unsigned char;
+  using __ft = uint4;
+};
+template <> struct __FT {
+  using __bt = short;
+  using __ft = int4;
+};
+template <> struct __FT {
+  using __bt = ushort;
+  using __ft = uint4;
+};
+template <> struct __FT {
+  using __bt = int;
+  using __ft = int4;
+};
+template <> struct __FT {
+  using __bt = uint;
+  using __ft = uint4;
+};
+
+// Derived base/fetch types for N-element vectors.
+template  struct __FT {
+  using __bt = decltype(__T::x);
+  using __ft = typename __FT<__bt>::__ft;
+};
+
+// Classes that implement specific texture ops.
+template  struct __tex_fetch_v4;
+template <> struct __tex_fetch_v4<__Tag<-1>>; // Unknown op
+
+// Helper 

[clang] 52832cd - [CodeGen] regenerate test checks; NFC

2021-09-21 Thread Sanjay Patel via cfe-commits

Author: Sanjay Patel
Date: 2021-09-21T16:53:41-04:00
New Revision: 52832cd917af00e2b9c6a9d1476ba79754dcabff

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

LOG: [CodeGen] regenerate test checks; NFC

This broke with 2f6b07316f56 because it wrongly runs the entire LLVM optimizer.

Added: 


Modified: 
clang/test/CodeGen/aapcs-bitfield.c

Removed: 




diff  --git a/clang/test/CodeGen/aapcs-bitfield.c 
b/clang/test/CodeGen/aapcs-bitfield.c
index 13db68d6ae81..316986c764bc 100644
--- a/clang/test/CodeGen/aapcs-bitfield.c
+++ b/clang/test/CodeGen/aapcs-bitfield.c
@@ -1034,7 +1034,7 @@ struct st6 {
 // LE-NEXT:[[BF_ASHR:%.*]] = ashr exact i16 [[BF_SHL]], 4
 // LE-NEXT:[[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
 // LE-NEXT:[[B:%.*]] = getelementptr inbounds [[STRUCT_ST6]], %struct.st6* 
[[M]], i32 0, i32 1
-// LE-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, !tbaa !3
+// LE-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, !tbaa 
[[TBAA3:![0-9]+]]
 // LE-NEXT:[[CONV:%.*]] = sext i8 [[TMP1]] to i32
 // LE-NEXT:[[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
 // LE-NEXT:[[C:%.*]] = getelementptr inbounds [[STRUCT_ST6]], %struct.st6* 
[[M]], i32 0, i32 2
@@ -1052,7 +1052,7 @@ struct st6 {
 // BE-NEXT:[[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 4
 // BE-NEXT:[[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
 // BE-NEXT:[[B:%.*]] = getelementptr inbounds [[STRUCT_ST6]], %struct.st6* 
[[M]], i32 0, i32 1
-// BE-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, !tbaa !3
+// BE-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, !tbaa 
[[TBAA3:![0-9]+]]
 // BE-NEXT:[[CONV:%.*]] = sext i8 [[TMP1]] to i32
 // BE-NEXT:[[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
 // BE-NEXT:[[C:%.*]] = getelementptr inbounds [[STRUCT_ST6]], %struct.st6* 
[[M]], i32 0, i32 2
@@ -1070,7 +1070,7 @@ struct st6 {
 // LENUMLOADS-NEXT:[[BF_ASHR:%.*]] = ashr exact i16 [[BF_SHL]], 4
 // LENUMLOADS-NEXT:[[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
 // LENUMLOADS-NEXT:[[B:%.*]] = getelementptr inbounds [[STRUCT_ST6]], 
%struct.st6* [[M]], i32 0, i32 1
-// LENUMLOADS-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, 
!tbaa !3
+// LENUMLOADS-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, 
!tbaa [[TBAA3:![0-9]+]]
 // LENUMLOADS-NEXT:[[CONV:%.*]] = sext i8 [[TMP1]] to i32
 // LENUMLOADS-NEXT:[[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
 // LENUMLOADS-NEXT:[[C:%.*]] = getelementptr inbounds [[STRUCT_ST6]], 
%struct.st6* [[M]], i32 0, i32 2
@@ -1088,7 +1088,7 @@ struct st6 {
 // BENUMLOADS-NEXT:[[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 4
 // BENUMLOADS-NEXT:[[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
 // BENUMLOADS-NEXT:[[B:%.*]] = getelementptr inbounds [[STRUCT_ST6]], 
%struct.st6* [[M]], i32 0, i32 1
-// BENUMLOADS-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, 
!tbaa !3
+// BENUMLOADS-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, 
!tbaa [[TBAA3:![0-9]+]]
 // BENUMLOADS-NEXT:[[CONV:%.*]] = sext i8 [[TMP1]] to i32
 // BENUMLOADS-NEXT:[[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
 // BENUMLOADS-NEXT:[[C:%.*]] = getelementptr inbounds [[STRUCT_ST6]], 
%struct.st6* [[M]], i32 0, i32 2
@@ -1106,7 +1106,7 @@ struct st6 {
 // LEWIDTH-NEXT:[[BF_ASHR:%.*]] = ashr exact i16 [[BF_SHL]], 4
 // LEWIDTH-NEXT:[[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
 // LEWIDTH-NEXT:[[B:%.*]] = getelementptr inbounds [[STRUCT_ST6]], 
%struct.st6* [[M]], i32 0, i32 1
-// LEWIDTH-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, !tbaa 
!3
+// LEWIDTH-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, !tbaa 
[[TBAA3:![0-9]+]]
 // LEWIDTH-NEXT:[[CONV:%.*]] = sext i8 [[TMP1]] to i32
 // LEWIDTH-NEXT:[[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
 // LEWIDTH-NEXT:[[C:%.*]] = getelementptr inbounds [[STRUCT_ST6]], 
%struct.st6* [[M]], i32 0, i32 2
@@ -1124,7 +1124,7 @@ struct st6 {
 // BEWIDTH-NEXT:[[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 4
 // BEWIDTH-NEXT:[[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
 // BEWIDTH-NEXT:[[B:%.*]] = getelementptr inbounds [[STRUCT_ST6]], 
%struct.st6* [[M]], i32 0, i32 1
-// BEWIDTH-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, !tbaa 
!3
+// BEWIDTH-NEXT:[[TMP1:%.*]] = load volatile i8, i8* [[B]], align 2, !tbaa 
[[TBAA3:![0-9]+]]
 // BEWIDTH-NEXT:[[CONV:%.*]] = sext i8 [[TMP1]] to i32
 // BEWIDTH-NEXT:[[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
 // BEWIDTH-NEXT:[[C:%.*]] = getelementptr inbounds [[STRUCT_ST6]], 
%struct.st6* [[M]], i32 0, i32 2
@@ -1142,7 +1142,7 @@ struct st6 {
 // LEWIDTHNUM-NEXT:[[BF_ASHR:%.*]] = ashr 

[PATCH] D109967: Simplify handling of builtin with inline redefinition

2021-09-21 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers accepted this revision.
nickdesaulniers added a comment.
This revision is now accepted and ready to land.

Looks reasonable. Can you give us some time to test this on the Linux kernel?




Comment at: clang/test/CodeGen/memcpy-inline-builtin.c:3
+
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - %s | 
FileCheck %s
+//

are you able to leave off the `-unknown-unknown` from the triple? I assume 
those are the defaults; I know you can with `llc` but not sure about `clang`.


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

https://reviews.llvm.org/D109967

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


[PATCH] D109632: [clang] de-duplicate methods from AST files

2021-09-21 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

In D109632#3012647 , @rmaz wrote:

>> What folks are thinking about writing less in METHOD_POOL?
>
> I prefer the idea of it, but I think the `ReadMethodPoolVisitor` also has to 
> be changed for this to work. When it finds a selector in a module it will 
> return true, which causes the search to stop descending into dependent 
> modules:
>
>   if (!Visitor(*CurrentModule))
> continue;
>   
>   // The visitor has requested that cut off visitation of any
>   // module that the current module depends on. To indicate this
>   // behavior, we mark all of the reachable modules as having been visited.
>
> Wouldn't this logic have to be changed to ensure we pick up all the 
> transitive methods from dependent modules?

You are right, suggested implementation is insufficient and I've added a test 
to https://reviews.llvm.org/D110123 to catch it.

Right now `MODULE_POOL` seems to be caching all transitive modules but it does 
so poorly in case of shared dependencies and sometimes the cache is empty 
forcing you to collect methods from imported modules. So it looks like we are 
somewhere in the middle on caching --- non-caching spectrum. I'd prefer to go 
entirely to one of the ends and for that I see 2 options:

1. Deduplicate methods from shared dependencies when reading method pools from 
imported modules.
2. Serialize only methods owned by the current module (and change 
`ReadMethodPoolVisitor` appropriately).

I think the option 2 would be better as it seems to be easier to understand. 
Implementation complexity seems to be comparable, runtime seems to be better 
for option 2. Also given that collecting methods from a module is basically 
`InstanceMethods.append(Data.Instance.begin(), Data.Instance.end())`, I don't 
think caching methods from transitive dependencies saves us processing time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109632

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


[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

2021-09-21 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

This flags this code from absl:

  template ::value, int>::type 
=
(GenT{}, 0)>
  constexpr FlagDefaultArg DefaultArg(int) {
return {FlagDefaultSrc(GenT{}.value), FlagDefaultKind::kOneWord};
  }

(https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/flags/internal/flag.h;l=293?q=third_party%2Fabseil-cpp%2Fabsl%2Fflags%2Finternal%2Fflag.h)

  ../../third_party/abseil-cpp/absl/flags/internal/flag.h:293:16: warning: left 
operand of comma operator has no effect [-Wunused-value]
(GenT{}, 0)>
 ^   ~~
  ../../third_party/abseil-cpp/absl/flags/internal/flag.h:293:16: warning: left 
operand of comma operator has no effect [-Wunused-value]
(GenT{}, 0)>
 ^   ~~

I guess it has a SFINAE effect there?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103938

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


[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-21 Thread Michael Liao via Phabricator via cfe-commits
hliao accepted this revision.
hliao added a comment.
This revision is now accepted and ready to land.

Cool! I like the idea of *compile-time* dispatch. LGTM except minor warnings 
from clang-tidy. Could you fix them before committing this change?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110089

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D102107#3013437 , @ronlieb wrote:

> Please revert the patch so our buildbot can resume greeness, and we can look 
> into it with urgency today (me or Jon)
> as it should be reproducible

Sounds good. @ggeorgakoudis let's revert and wait for input.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a subscriber: dpalermo.
JonChesterfield added a comment.

@ronlieb can you apply this to amd-stg-open? If it breaks there we have a 
chance of trying a debugger on it. @dpalermo might be available again now.

@jdoerfert I debug stuff like this by inspection, guesswork and a DIY printf 
implementation that is itself not totally robust. Very occasionally the thing 
can be isolated as a unit test. If we're lucky a debug llvm + debug rocr build 
will be more verbose about what is going wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D110123: [Proof of concept] Serialize fewer transitive methods in `METHOD_POOL`.

2021-09-21 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai updated this revision to Diff 374017.
vsapsai added a comment.

Simplify the test and make it less sensitive to what "method" clang selects to 
use.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110123

Files:
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/Modules/method_pool_transitive.m


Index: clang/test/Modules/method_pool_transitive.m
===
--- /dev/null
+++ clang/test/Modules/method_pool_transitive.m
@@ -0,0 +1,40 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: %clang_cc1 -Wobjc-multiple-method-names -fsyntax-only 
-fmodules-cache-path=%t/modules.cache -fmodules -fimplicit-module-maps -F 
%t/Frameworks %t/test.m -verify
+
+// Verify we are handling methods from transitive modules, not just from 
immediate ones.
+
+//--- Frameworks/Indirect.framework/Headers/Indirect.h
+@interface NSObject
+@end
+
+@interface Indirect : NSObject
+- (int)method;
+@end
+
+//--- Frameworks/Indirect.framework/Modules/module.modulemap
+framework module Indirect {
+  header "Indirect.h"
+  export *
+}
+
+//--- Frameworks/Immediate.framework/Headers/Immediate.h
+#import 
+@interface Immediate : NSObject
+- (void)method;
+@end
+
+//--- Frameworks/Immediate.framework/Modules/module.modulemap
+framework module Immediate {
+  header "Immediate.h"
+  export *
+}
+
+//--- test.m
+#import 
+
+void test(id obj) {
+  [obj method];  // expected-warning{{multiple methods named 'method' found}}
+  // expected-note@Frameworks/Indirect.framework/Headers/Indirect.h:5{{using}}
+  // expected-note@Frameworks/Immediate.framework/Headers/Immediate.h:3{{also 
found}}
+}
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -3130,15 +3130,21 @@
   if (Chain && ID < FirstSelectorID) {
 // Selector already exists. Did it change?
 bool changed = false;
-for (ObjCMethodList *M = 
- !changed && M && M->getMethod(); M = M->getNext()) {
-  if (!M->getMethod()->isFromASTFile())
+for (ObjCMethodList *M =  M && M->getMethod();
+ M = M->getNext()) {
+  if (!M->getMethod()->isFromASTFile()) {
 changed = true;
+Data.Instance = *M;
+break;
+  }
 }
-for (ObjCMethodList *M =  !changed && M && 
M->getMethod();
+for (ObjCMethodList *M =  M && M->getMethod();
  M = M->getNext()) {
-  if (!M->getMethod()->isFromASTFile())
+  if (!M->getMethod()->isFromASTFile()) {
 changed = true;
+Data.Factory = *M;
+break;
+  }
 }
 if (!changed)
   continue;


Index: clang/test/Modules/method_pool_transitive.m
===
--- /dev/null
+++ clang/test/Modules/method_pool_transitive.m
@@ -0,0 +1,40 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: %clang_cc1 -Wobjc-multiple-method-names -fsyntax-only -fmodules-cache-path=%t/modules.cache -fmodules -fimplicit-module-maps -F %t/Frameworks %t/test.m -verify
+
+// Verify we are handling methods from transitive modules, not just from immediate ones.
+
+//--- Frameworks/Indirect.framework/Headers/Indirect.h
+@interface NSObject
+@end
+
+@interface Indirect : NSObject
+- (int)method;
+@end
+
+//--- Frameworks/Indirect.framework/Modules/module.modulemap
+framework module Indirect {
+  header "Indirect.h"
+  export *
+}
+
+//--- Frameworks/Immediate.framework/Headers/Immediate.h
+#import 
+@interface Immediate : NSObject
+- (void)method;
+@end
+
+//--- Frameworks/Immediate.framework/Modules/module.modulemap
+framework module Immediate {
+  header "Immediate.h"
+  export *
+}
+
+//--- test.m
+#import 
+
+void test(id obj) {
+  [obj method];  // expected-warning{{multiple methods named 'method' found}}
+  // expected-note@Frameworks/Indirect.framework/Headers/Indirect.h:5{{using}}
+  // expected-note@Frameworks/Immediate.framework/Headers/Immediate.h:3{{also found}}
+}
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -3130,15 +3130,21 @@
   if (Chain && ID < FirstSelectorID) {
 // Selector already exists. Did it change?
 bool changed = false;
-for (ObjCMethodList *M = 
- !changed && M && M->getMethod(); M = M->getNext()) {
-  if (!M->getMethod()->isFromASTFile())
+for (ObjCMethodList *M =  M && M->getMethod();
+ M = M->getNext()) {
+  if (!M->getMethod()->isFromASTFile()) {
 changed = true;
+Data.Instance = *M;
+break;
+  }
 }
-for (ObjCMethodList 

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Ron Lieberman via Phabricator via cfe-commits
ronlieb added a comment.

Please revert the patch so our buildbot can resume greeness, and we can look 
into it with urgency today (me or Jon)
as it should be reproducible


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D69764: [clang-format] Add Left/Right Const fixer capability

2021-09-21 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments.



Comment at: clang/lib/Format/QualifierAlignmentFixer.cpp:57
+
+  std::string NewText = " " + Qualifier + " ";
+  NewText += Next->TokenText;

MyDeveloperDay wrote:
> HazardyKnusperkeks wrote:
> > Does not need to be addressed here, but does LLVM have a string builder or 
> > so? This produces a lot of (de-)allocations.
> I'm not a massive fan of this either, but I'm unsure if LLVM has anything, I 
> think getting functional first is important, we can go for fast if someone 
> can point out a better pattern.
Full support for that.



Comment at: clang/lib/Format/QualifierAlignmentFixer.h:30
+  // Left to Right ordering requires multiple passes
+  SmallVector Passes;
+  StringRef 

MyDeveloperDay wrote:
> HazardyKnusperkeks wrote:
> > Has the 8 some meaning? Then maybe give it a name. Or is it just 
> > coincidence that you repeat the 8 for QualifierTokens?
> For SmallVector this is basically a "ShortStringOptimization" for vector i.e. 
> its stack allocated until the vector goes over 8, I have 7 qualifiers, and I 
> wanted it an order of 2 so hence 8 (its shouldn't grow (and heap allocation) 
> unless we define more qualifier types (this only supports what I say for now)
> 
> I think the use of a literal is quite common in this case, its really just a 
> hint, I think its ok to use without it being a variable.
I know what it is. So the 8 is `NumberOfSupportedQualifiers`? My point is that 
if we add something, let's say attributes ;), one only need to change that 
constant and both vectors grow accordingly, so that no heap allocation happens.

Nothing I would block that change for.



Comment at: clang/unittests/Format/QualifierFixerTest.cpp:573
+  // The Default
+  EXPECT_EQ(Style.QualifierOrder.size(), 5);
+  EXPECT_EQ(Style.QualifierOrder[0], "inline");

This one would suffice, since we add the values within the test now. But 
actually I would go for Style.QualifierOrder = {"inline",...}; and no EXPECTs 
needed.



Comment at: clang/unittests/Format/QualifierFixerTest.cpp:855
+
+  Style.TypenameMacros.push_back("HRESULT");
+  Style.TypenameMacros.push_back("DWORD");

This is not correct, the documentation of TypenameMacros says
```These are expected to be macros of the form:

STACK_OF(...)
```
and HRESULT is just a typedef.
So a test against `STACK_OF(int)` is useful. But the macro detection should be 
reworked, or maybe dropped?
The handling of `LLVM_NODISARD` basically boils down to handling attributes and 
`AttributeMacros`.


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

https://reviews.llvm.org/D69764

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


[PATCH] D110123: [Proof of concept] Serialize fewer transitive methods in `METHOD_POOL`.

2021-09-21 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai updated this revision to Diff 374016.
vsapsai added a comment.

Add a [failing] test case that checks handling methods from transitive modules.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110123

Files:
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/Modules/method_pool_transitive.m


Index: clang/test/Modules/method_pool_transitive.m
===
--- /dev/null
+++ clang/test/Modules/method_pool_transitive.m
@@ -0,0 +1,46 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: %clang_cc1 -Wobjc-multiple-method-names -fsyntax-only 
-fmodules-cache-path=%t/modules.cache -fmodules -fimplicit-module-maps -F 
%t/Frameworks %t/test.m -verify
+
+// Verify we are handling methods from transitive modules, not just from 
immediate ones.
+
+//--- Frameworks/Indirect.framework/Headers/Indirect.h
+@interface NSObject
+@end
+
+@interface Indirect : NSObject
+- (int)method;
+@end
+
+//--- Frameworks/Indirect.framework/Modules/module.modulemap
+framework module Indirect {
+  header "Indirect.h"
+  export *
+}
+
+//--- Frameworks/Immediate.framework/Headers/Immediate.h
+#import 
+@interface Immediate : NSObject
+- (void)method;
+@end
+
+//--- Frameworks/Immediate.framework/Modules/module.modulemap
+framework module Immediate {
+  header "Immediate.h"
+  export *
+}
+
+//--- test.m
+#import 
+
+int foo(id obj) {
+  return [obj method];  // expected-warning{{multiple methods named 'method' 
found}}
+  // expected-note@Frameworks/Indirect.framework/Headers/Indirect.h:5{{using}}
+  // expected-note@Frameworks/Immediate.framework/Headers/Immediate.h:3{{also 
found}}
+}
+
+void bar(id obj) {
+  [obj method];  // expected-warning{{multiple methods named 'method' found}}
+  // expected-note@Frameworks/Indirect.framework/Headers/Indirect.h:5{{using}}
+  // expected-note@Frameworks/Immediate.framework/Headers/Immediate.h:3{{also 
found}}
+}
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -3130,15 +3130,21 @@
   if (Chain && ID < FirstSelectorID) {
 // Selector already exists. Did it change?
 bool changed = false;
-for (ObjCMethodList *M = 
- !changed && M && M->getMethod(); M = M->getNext()) {
-  if (!M->getMethod()->isFromASTFile())
+for (ObjCMethodList *M =  M && M->getMethod();
+ M = M->getNext()) {
+  if (!M->getMethod()->isFromASTFile()) {
 changed = true;
+Data.Instance = *M;
+break;
+  }
 }
-for (ObjCMethodList *M =  !changed && M && 
M->getMethod();
+for (ObjCMethodList *M =  M && M->getMethod();
  M = M->getNext()) {
-  if (!M->getMethod()->isFromASTFile())
+  if (!M->getMethod()->isFromASTFile()) {
 changed = true;
+Data.Factory = *M;
+break;
+  }
 }
 if (!changed)
   continue;


Index: clang/test/Modules/method_pool_transitive.m
===
--- /dev/null
+++ clang/test/Modules/method_pool_transitive.m
@@ -0,0 +1,46 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: %clang_cc1 -Wobjc-multiple-method-names -fsyntax-only -fmodules-cache-path=%t/modules.cache -fmodules -fimplicit-module-maps -F %t/Frameworks %t/test.m -verify
+
+// Verify we are handling methods from transitive modules, not just from immediate ones.
+
+//--- Frameworks/Indirect.framework/Headers/Indirect.h
+@interface NSObject
+@end
+
+@interface Indirect : NSObject
+- (int)method;
+@end
+
+//--- Frameworks/Indirect.framework/Modules/module.modulemap
+framework module Indirect {
+  header "Indirect.h"
+  export *
+}
+
+//--- Frameworks/Immediate.framework/Headers/Immediate.h
+#import 
+@interface Immediate : NSObject
+- (void)method;
+@end
+
+//--- Frameworks/Immediate.framework/Modules/module.modulemap
+framework module Immediate {
+  header "Immediate.h"
+  export *
+}
+
+//--- test.m
+#import 
+
+int foo(id obj) {
+  return [obj method];  // expected-warning{{multiple methods named 'method' found}}
+  // expected-note@Frameworks/Indirect.framework/Headers/Indirect.h:5{{using}}
+  // expected-note@Frameworks/Immediate.framework/Headers/Immediate.h:3{{also found}}
+}
+
+void bar(id obj) {
+  [obj method];  // expected-warning{{multiple methods named 'method' found}}
+  // expected-note@Frameworks/Indirect.framework/Headers/Indirect.h:5{{using}}
+  // expected-note@Frameworks/Immediate.framework/Headers/Immediate.h:3{{also found}}
+}
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -3130,15 +3130,21 @@
   

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D102107#3013233 , @ronlieb wrote:

> seeing buildbot failures after this patch landed 
> https://lab.llvm.org/staging/#/builders/183/builds/1598

This looks like another AMDGPU issue. The code in question doesn't do anything 
AMDGPU specific.
@ronlieb @JonChesterfield How to debug this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D110127: [Clang] Support typedef with btf_tag attributes

2021-09-21 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

Given this is about being preserved into debug info - I imagine it'll have the 
same behavior as using a typedef in a function return type - whenever that 
currently shows up in the DWARF, this attribute would. Where it doesn't, this 
doesn't.

So I wouldn't expect this feature to do any checking/require the typedef to be 
used consistently - but fair questions to consider.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110127

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


[PATCH] D109951: [clang-format] Constructor initializer lists format with pp directives

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

Looks good.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109951

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


[PATCH] D109800: [clang] don't mark as Elidable CXXConstruct expressions used in NRVO

2021-09-21 Thread Matheus Izvekov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd9308aa39b23: [clang] dont mark as Elidable 
CXXConstruct expressions used in NRVO (authored by mizvekov).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109800

Files:
  clang/include/clang/Sema/Initialization.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/CodeGen/CGExprCXX.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaCoroutine.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaLambda.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/test/CodeGen/nrvo-tracking.cpp
  clang/test/CodeGenCXX/copy-elision.cpp

Index: clang/test/CodeGenCXX/copy-elision.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/copy-elision.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown-gnu -emit-llvm -O1 -fexperimental-new-pass-manager -o - %s | FileCheck %s
+
+template  T test() {
+  return T();
+}
+
+struct A {
+  A();
+  A(A &);
+  A(int);
+  operator int();
+};
+
+// FIXME: There should be copy elision here.
+// CHECK-LABEL: define{{.*}} void @_Z4testI1AET_v
+// CHECK:   call void @_ZN1AC1Ev
+// CHECK-NEXT:  call i32 @_ZN1AcviEv
+// CHECK-NEXT:  call void @_ZN1AC1Ei
+// CHECK-NEXT:  call void @llvm.lifetime.end
+template A test();
+
+struct BSub {};
+struct B : BSub {
+  B();
+  B(B &);
+  B(const BSub &);
+};
+
+// FIXME: There should be copy elision here.
+// CHECK-LABEL: define{{.*}} void @_Z4testI1BET_v
+// CHECK:   call void @_ZN1BC1Ev
+// CHECK:   call void @_ZN1BC1ERK4BSub
+// CHECK-NEXT:  call void @llvm.lifetime.end
+template B test();
Index: clang/test/CodeGen/nrvo-tracking.cpp
===
--- clang/test/CodeGen/nrvo-tracking.cpp
+++ clang/test/CodeGen/nrvo-tracking.cpp
@@ -282,3 +282,40 @@
 }
 
 } // namespace test_alignas
+
+namespace PR51862 {
+
+template  T test() {
+  T a;
+  T b;
+  if (0)
+return a;
+  return b;
+}
+
+struct A {
+  A();
+  A(A &);
+  A(int);
+  operator int();
+};
+
+// CHECK-LABEL: define{{.*}} void @_ZN7PR518624testINS_1AEEET_v
+// CHECK:   call i32 @_ZN7PR518621AcviEv
+// CHECK-NEXT:  call void @_ZN7PR518621AC1Ei
+// CHECK-NEXT:  call void @llvm.lifetime.end
+template A test();
+
+struct BSub {};
+struct B : BSub {
+  B();
+  B(B &);
+  B(const BSub &);
+};
+
+// CHECK-LABEL: define{{.*}} void @_ZN7PR518624testINS_1BEEET_v
+// CHECK:   call void @_ZN7PR518621BC1ERKNS_4BSubE
+// CHECK-NEXT:  call void @llvm.lifetime.end
+template B test();
+
+} // namespace PR51862
Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -3653,8 +3653,8 @@
 
 // In C++ the return statement is handled via a copy initialization.
 // the C version of which boils down to CheckSingleAssignmentConstraints.
-InitializedEntity Entity = InitializedEntity::InitializeResult(
-ReturnLoc, FnRetType, NRVOCandidate != nullptr);
+InitializedEntity Entity =
+InitializedEntity::InitializeResult(ReturnLoc, FnRetType);
 ExprResult Res = PerformMoveOrCopyInitialization(
 Entity, NRInfo, RetValExp, SupressSimplerImplicitMoves);
 if (Res.isInvalid()) {
@@ -4085,8 +4085,8 @@
 // the C version of which boils down to CheckSingleAssignmentConstraints.
 if (!HasDependentReturnType && !RetValExp->isTypeDependent()) {
   // we have a non-void function with an expression, continue checking
-  InitializedEntity Entity = InitializedEntity::InitializeResult(
-  ReturnLoc, RetType, NRVOCandidate != nullptr);
+  InitializedEntity Entity =
+  InitializedEntity::InitializeResult(ReturnLoc, RetType);
   ExprResult Res = PerformMoveOrCopyInitialization(
   Entity, NRInfo, RetValExp, SupressSimplerImplicitMoves);
   if (Res.isInvalid()) {
Index: clang/lib/Sema/SemaObjCProperty.cpp
===
--- clang/lib/Sema/SemaObjCProperty.cpp
+++ clang/lib/Sema/SemaObjCProperty.cpp
@@ -1467,8 +1467,7 @@
   LoadSelfExpr, true, true);
   ExprResult Res = PerformCopyInitialization(
   InitializedEntity::InitializeResult(PropertyDiagLoc,
-  getterMethod->getReturnType(),
-  /*NRVO=*/false),
+  getterMethod->getReturnType()),
   PropertyDiagLoc, IvarRefExpr);
   if (!Res.isInvalid()) {
 Expr *ResExpr = Res.getAs();
Index: clang/lib/Sema/SemaLambda.cpp

[clang] d9308aa - [clang] don't mark as Elidable CXXConstruct expressions used in NRVO

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

Author: Matheus Izvekov
Date: 2021-09-21T21:41:20+02:00
New Revision: d9308aa39b236064a680ca57178af3c731e13e49

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

LOG: [clang] don't mark as Elidable CXXConstruct expressions used in NRVO

See PR51862.

The consumers of the Elidable flag in CXXConstructExpr assume that
an elidable construction just goes through a single copy/move construction,
so that the source object is immediately passed as an argument and is the same
type as the parameter itself.

With the implementation of P2266 and after some adjustments to the
implementation of P1825, we started (correctly, as per standard)
allowing more cases where the copy initialization goes through
user defined conversions.

With this patch we stop using this flag in NRVO contexts, to preserve code
that relies on that assumption.
This causes no known functional changes, we just stop firing some asserts
in a cople of included test cases.

Reviewed By: rsmith

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

Added: 
clang/test/CodeGenCXX/copy-elision.cpp

Modified: 
clang/include/clang/Sema/Initialization.h
clang/lib/AST/ExprConstant.cpp
clang/lib/CodeGen/CGExprCXX.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaCoroutine.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaLambda.cpp
clang/lib/Sema/SemaObjCProperty.cpp
clang/lib/Sema/SemaStmt.cpp
clang/test/CodeGen/nrvo-tracking.cpp

Removed: 




diff  --git a/clang/include/clang/Sema/Initialization.h 
b/clang/include/clang/Sema/Initialization.h
index 4664861c4e32a..8c1856f208279 100644
--- a/clang/include/clang/Sema/Initialization.h
+++ b/clang/include/clang/Sema/Initialization.h
@@ -298,8 +298,8 @@ class alignas(8) InitializedEntity {
 
   /// Create the initialization entity for the result of a function.
   static InitializedEntity InitializeResult(SourceLocation ReturnLoc,
-QualType Type, bool NRVO) {
-return InitializedEntity(EK_Result, ReturnLoc, Type, NRVO);
+QualType Type) {
+return InitializedEntity(EK_Result, ReturnLoc, Type);
   }
 
   static InitializedEntity InitializeStmtExprResult(SourceLocation ReturnLoc,
@@ -308,20 +308,20 @@ class alignas(8) InitializedEntity {
   }
 
   static InitializedEntity InitializeBlock(SourceLocation BlockVarLoc,
-   QualType Type, bool NRVO) {
-return InitializedEntity(EK_BlockElement, BlockVarLoc, Type, NRVO);
+   QualType Type) {
+return InitializedEntity(EK_BlockElement, BlockVarLoc, Type);
   }
 
   static InitializedEntity InitializeLambdaToBlock(SourceLocation BlockVarLoc,
-   QualType Type, bool NRVO) {
+   QualType Type) {
 return InitializedEntity(EK_LambdaToBlockConversionBlockElement,
- BlockVarLoc, Type, NRVO);
+ BlockVarLoc, Type);
   }
 
   /// Create the initialization entity for an exception object.
   static InitializedEntity InitializeException(SourceLocation ThrowLoc,
-   QualType Type, bool NRVO) {
-return InitializedEntity(EK_Exception, ThrowLoc, Type, NRVO);
+   QualType Type) {
+return InitializedEntity(EK_Exception, ThrowLoc, Type);
   }
 
   /// Create the initialization entity for an object allocated via new.

diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 296e9e7e5995e..ea7818c43e321 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -9933,10 +9933,19 @@ bool RecordExprEvaluator::VisitCXXConstructExpr(const 
CXXConstructExpr *E,
 return false;
 
   // Avoid materializing a temporary for an elidable copy/move constructor.
-  if (E->isElidable() && !ZeroInit)
-if (const MaterializeTemporaryExpr *ME
-  = dyn_cast(E->getArg(0)))
+  if (E->isElidable() && !ZeroInit) {
+// FIXME: This only handles the simplest case, where the source object
+//is passed directly as the first argument to the constructor.
+//This should also handle stepping though implicit casts and
+//and conversion sequences which involve two steps, with a
+//conversion operator followed by a converting constructor.
+const Expr *SrcObj = E->getArg(0);
+assert(SrcObj->isTemporaryObject(Info.Ctx, FD->getParent()));
+assert(Info.Ctx.hasSameUnqualifiedType(E->getType(), SrcObj->getType()));
+if (const 

[PATCH] D109362: [SystemZ][z/OS] Add GOFF Support to the DataLayout

2021-09-21 Thread Anirudh Prasad via Phabricator via cfe-commits
anirudhp marked 2 inline comments as done.
anirudhp added inline comments.



Comment at: clang/test/CodeGen/target-data.c:256
 
+// RUN: %clang_cc1 -triple s390x-none-zos -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=ZOS

MaskRay wrote:
> MaskRay wrote:
> > anirudhp wrote:
> > > MaskRay wrote:
> > > > If you add so many RUN lines at once, please use unittests instead. 
> > > > This would cost some test execution time
> > > We're essentially matching what was available for the systemz elf target 
> > > (above lines) for the z/OS target. Is there a real concern for the 
> > > execution time here for moving it to a separate unit test. If we did, it 
> > > would seem to "stand out" for just the z/OS target.
> > This is a real concern. Perhaps you can also move the SYstemZ ELF tests to 
> > a unit test.
> It also doesn't appear useful to enumerate every combination when the patch 
> doesn't touch these combination individually.
> 
> I.e. if you add z/OS condition to `arch8` code, then having a test is fine. 
> If you don't touch it, I don't think you should enumerate `{elf,goff} * 
> {z10,arch8,z196,arch9,...}`
After a bit of discussions with @uweigand , we've reduced the number of run 
lines for the SystemZ target(s) (both elf and goff). They should be greatly 
reduced now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109362

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


[PATCH] D109710: [PowerPC] Add range checks for P10 Vector Builtins

2021-09-21 Thread Quinn Pham via Phabricator via cfe-commits
quinnp updated this revision to Diff 374000.
quinnp added a comment.

Adding a testcase where the second parameter of vec_splati_ins is out of the 
range 0,1.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109710

Files:
  clang/lib/Headers/altivec.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtins-ppc-p10vector-error.c
  clang/test/CodeGen/builtins-ppc-p10vector.c

Index: clang/test/CodeGen/builtins-ppc-p10vector.c
===
--- clang/test/CodeGen/builtins-ppc-p10vector.c
+++ clang/test/CodeGen/builtins-ppc-p10vector.c
@@ -1370,10 +1370,12 @@
 }
 
 vector signed int test_vec_vec_splati_ins_si(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1383,10 +1385,12 @@
 }
 
 vector unsigned int test_vec_vec_splati_ins_ui(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1396,10 +1400,12 @@
 }
 
 vector float test_vec_vec_splati_ins_f(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x float>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1408,6 +1414,21 @@
   return vec_splati_ins(vfa, 0, 1.0f);
 }
 
+vector signed int test_vec_vec_splati_ins_range(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
+  // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
+  // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
+  // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
+  // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
+  // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
+  // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
+  // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
+  // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T2]]
+  // CHECK-LE: ret <4 x i32>
+  return vec_splati_ins(vsia, 2, -17);
+}
+
 void test_vec_xst_trunc_sc(vector signed __int128 __a, signed long long __b,
signed char *__c) {
   // CHECK: store i8 %{{.+}}, i8* %{{.+}}, align 1
Index: clang/test/CodeGen/builtins-ppc-p10vector-error.c
===
--- /dev/null
+++ clang/test/CodeGen/builtins-ppc-p10vector-error.c
@@ -0,0 +1,32 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc-unknown-aix -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+
+#include 
+
+vector unsigned char vuca;
+vector unsigned short vusa;
+vector unsigned int vuia;
+vector unsigned long long vulla;
+
+unsigned long long test_vec_cntm_uc(void) {
+  return vec_cntm(vuca, -1); // expected-error 1+ {{argument value 255 is outside the valid range [0, 1]}}
+}
+
+unsigned long long test_vec_cntm_us(void) {
+  return vec_cntm(vusa, -1); // expected-error 1+ {{argument value 255 is outside the valid range [0, 1]}}
+}
+
+unsigned long long test_vec_cntm_ui(void) {
+  return vec_cntm(vuia, 2); // expected-error 1+ {{argument value 2 is outside the valid range [0, 1]}}
+}
+
+unsigned long long test_vec_cntm_ull(void) {
+  return vec_cntm(vulla, 2); // expected-error 1+ {{argument value 2 is outside the valid range [0, 1]}}
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- 

[PATCH] D109362: [SystemZ][z/OS] Add GOFF Support to the DataLayout

2021-09-21 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.

Thanks for cleaning up RUN lines :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109362

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


[PATCH] D109362: [SystemZ][z/OS] Add GOFF Support to the DataLayout

2021-09-21 Thread Ulrich Weigand via Phabricator via cfe-commits
uweigand added a comment.

In D109362#3013253 , @anirudhp wrote:

> - Reduced the number of test lines in target-data.c, since we don't have to 
> check for every combination of arch,cpu for the SystemZ target (for both elf 
> and z/OS)

These changes still LGTM from a SystemZ target perspective.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109362

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


[PATCH] D109362: [SystemZ][z/OS] Add GOFF Support to the DataLayout

2021-09-21 Thread Anirudh Prasad via Phabricator via cfe-commits
anirudhp updated this revision to Diff 373999.
anirudhp added a comment.

- Reduced the number of test lines in target-data.c, since we don't have to 
check for every combination of arch,cpu for the SystemZ target (for both elf 
and z/OS)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109362

Files:
  clang/lib/Basic/Targets/SystemZ.h
  clang/test/CodeGen/target-data.c
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/DataLayout.h
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
  llvm/unittests/IR/ManglerTest.cpp

Index: llvm/unittests/IR/ManglerTest.cpp
===
--- llvm/unittests/IR/ManglerTest.cpp
+++ llvm/unittests/IR/ManglerTest.cpp
@@ -156,4 +156,22 @@
 "L..foo");
 }
 
+TEST(ManglerTest, GOFF) {
+  LLVMContext Ctx;
+  DataLayout DL("m:l"); // GOFF
+  Module Mod("test", Ctx);
+  Mod.setDataLayout(DL);
+  Mangler Mang;
+
+  EXPECT_EQ(mangleStr("foo", Mang, DL), "foo");
+  EXPECT_EQ(mangleStr("\01foo", Mang, DL), "foo");
+  EXPECT_EQ(mangleStr("?foo", Mang, DL), "?foo");
+  EXPECT_EQ(mangleFunc("foo", llvm::GlobalValue::ExternalLinkage,
+   llvm::CallingConv::C, Mod, Mang),
+"foo");
+  EXPECT_EQ(mangleFunc("foo", llvm::GlobalValue::PrivateLinkage,
+   llvm::CallingConv::C, Mod, Mang),
+"@foo");
+}
+
 } // end anonymous namespace
Index: llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
===
--- llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
+++ llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
@@ -84,8 +84,9 @@
   // 128-bit floats are aligned only to 64 bits.
   Ret += "-f128:64";
 
-  // When using the vector ABI, 128-bit vectors are also aligned to 64 bits.
-  if (VectorABI)
+  // When using the vector ABI on Linux, 128-bit vectors are also aligned to 64
+  // bits. On z/OS, vector types are always aligned to 64 bits.
+  if (VectorABI || TT.isOSzOS())
 Ret += "-v128:64";
 
   // We prefer 16 bits of aligned for all globals; see above.
Index: llvm/lib/IR/DataLayout.cpp
===
--- llvm/lib/IR/DataLayout.cpp
+++ llvm/lib/IR/DataLayout.cpp
@@ -151,6 +151,8 @@
 //===--===//
 
 const char *DataLayout::getManglingComponent(const Triple ) {
+  if (T.isOSBinFormatGOFF())
+return "-m:l";
   if (T.isOSBinFormatMachO())
 return "-m:o";
   if (T.isOSWindows() && T.isOSBinFormatCOFF())
@@ -500,6 +502,9 @@
   case 'e':
 ManglingMode = MM_ELF;
 break;
+  case 'l':
+ManglingMode = MM_GOFF;
+break;
   case 'o':
 ManglingMode = MM_MachO;
 break;
Index: llvm/include/llvm/IR/DataLayout.h
===
--- llvm/include/llvm/IR/DataLayout.h
+++ llvm/include/llvm/IR/DataLayout.h
@@ -135,6 +135,7 @@
 MM_MachO,
 MM_WinCOFF,
 MM_WinCOFFX86,
+MM_GOFF,
 MM_Mips,
 MM_XCOFF
   };
@@ -316,6 +317,7 @@
 switch (ManglingMode) {
 case MM_None:
 case MM_ELF:
+case MM_GOFF:
 case MM_Mips:
 case MM_WinCOFF:
 case MM_XCOFF:
@@ -334,6 +336,8 @@
 case MM_ELF:
 case MM_WinCOFF:
   return ".L";
+case MM_GOFF:
+  return "@";
 case MM_Mips:
   return "$";
 case MM_MachO:
Index: llvm/docs/LangRef.rst
===
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -2593,6 +2593,7 @@
 options are
 
 * ``e``: ELF mangling: Private symbols get a ``.L`` prefix.
+* ``l``: GOFF mangling: Private symbols get a ``@`` prefix.
 * ``m``: Mips mangling: Private symbols get a ``$`` prefix.
 * ``o``: Mach-O mangling: Private symbols get ``L`` prefix. Other
   symbols get a ``_`` prefix.
Index: clang/test/CodeGen/target-data.c
===
--- clang/test/CodeGen/target-data.c
+++ clang/test/CodeGen/target-data.c
@@ -219,40 +219,24 @@
 // RUN: FileCheck %s -check-prefix=HEXAGON
 // HEXAGON: target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
 
-// RUN: %clang_cc1 -triple s390x-unknown -o - -emit-llvm %s | \
-// RUN: FileCheck %s -check-prefix=SYSTEMZ
 // RUN: %clang_cc1 -triple s390x-unknown -target-cpu z10 -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=SYSTEMZ
-// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch8 -o - -emit-llvm %s | \
-// RUN: FileCheck %s -check-prefix=SYSTEMZ
-// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z196 -o - -emit-llvm %s | \
-// RUN: FileCheck %s -check-prefix=SYSTEMZ
-// RUN: %clang_cc1 -triple s390x-unknown 

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D102107#3013233 , @ronlieb wrote:

> seeing buildbot failures after this patch landed 
> https://lab.llvm.org/staging/#/builders/183/builds/1598

Looking it at @ronlieb, thanks for reporting


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D110128: [Driver] Correctly handle static C++ standard library

2021-09-21 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/test/Driver/linux-ld.c:499
 
+// RUN: %clangxx -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux-gnu \

`-no-canonical-prefixes` is only useful when the CHECK lines inspect the 
spelling of clang.
Otherwise `-no-canonical-prefixes` can be omitted.

Omit `-o %t.o` since it is not used.



Comment at: clang/test/Driver/linux-ld.c:504
+// CHECK-BASIC-LIBCXX-SHARED: "--push-state"
+// CHECK-BASIC-LIBCXX-SHARED: "--as-needed"
+// CHECK-BASIC-LIBCXX-SHARED: "-lc++"

To improve the robustness of the test, use the `-SAME: {{^}}` style in 
linux-cross.cpp, or just place these consecutive options on the same line.



Comment at: clang/test/Driver/linux-ld.c:509
+// RUN: %clangxx -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux-gnu \
+// RUN: -stdlib=libc++ -static-libstdc++ \

Prefer `--target=` to `-target `


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110128

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


[PATCH] D110128: [Driver] Correctly handle static C++ standard library

2021-09-21 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

LGTM.

I looked at this in 2019 but did not change because GNU ld 2.25 (2014) 
introduced --push-state. (gold added it in 2016 but I think we can have higher 
version requirement for gold.)
In 2021, binutils 2.24 (2013) compatibility should be irrelevant now...




Comment at: clang/lib/Driver/ToolChains/Fuchsia.cpp:143
 if (OnlyLibstdcxxStatic)
   CmdArgs.push_back("-Bstatic");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);

`--as-needed` only applies to shared objects so you can move it into the `else` 
code path.



Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:581
+  CmdArgs.push_back("--push-state");
+  CmdArgs.push_back("--as-needed");
   if (OnlyLibstdcxxStatic)

The --as-needed change should be dropped from this patch.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110128

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Ron Lieberman via Phabricator via cfe-commits
ronlieb added a comment.

seeing buildbot failures after this patch landed 
https://lab.llvm.org/staging/#/builders/183/builds/1598


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D110044: Print nullptr_t namespace qualified within std::

2021-09-21 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: clang/lib/AST/Type.cpp:3045
   case NullPtr:
-return "nullptr_t";
+return "std::nullptr_t";
   case Overload:

aaron.ballman wrote:
> dblaikie wrote:
> > aaron.ballman wrote:
> > > Should this be `::std::nullptr_t` to differentiate it from odd things 
> > > like:
> > > ```
> > > namespace my {
> > > namespace std {
> > > class nullptr_t {};
> > > }
> > > }
> > > ```
> > I was hoping not to get overly pedantic - I think clang omits the global 
> > namespace scope when naming other types in namespaces?
> > 
> > Yeah:
> > ```
> > scope.cpp:5:5: error: invalid operands to binary expression ('int' and 
> > 'ns::inner')
> >   1 + ns::inner();
> >   ~ ^ ~~~
> > ```
> > 
> > So this seems consistent with that, at least. That's true also when 
> > rendering template parameter type names, etc, so far as I know.
> Okay, I'm sold, thank you!
Thanks for the review!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110044

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


[PATCH] D110044: Print nullptr_t namespace qualified within std::

2021-09-21 Thread David Blaikie via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG131e8786640a: Print nullptr_t namespace qualified within 
std:: (authored by dblaikie).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110044

Files:
  clang/lib/AST/Type.cpp
  clang/test/AST/ast-dump-recovery.cpp
  clang/test/Analysis/plist-diagnostics-template-record.cpp
  clang/test/CXX/drs/dr15xx.cpp
  clang/test/CXX/drs/dr6xx.cpp
  clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1-11.cpp
  clang/test/CXX/temp/temp.param/p10-2a.cpp
  clang/test/CodeGenCXX/debug-info-template.cpp
  clang/test/OpenMP/task_affinity_messages.cpp
  clang/test/OpenMP/task_depend_messages.cpp
  clang/test/Sema/builtins-arm64-mte.c
  clang/test/Sema/format-strings-pedantic.c
  clang/test/SemaCXX/cxx0x-noexcept-expression.cpp
  clang/test/SemaCXX/cxx2a-explicit-bool.cpp
  clang/test/SemaCXX/nullability.cpp
  clang/test/SemaCXX/nullptr.cpp
  clang/test/SemaTemplate/deduction-guide.cpp
  clang/test/SemaTemplate/deduction.cpp
  clang/test/SemaTemplate/friend.cpp
  clang/test/SemaTemplate/instantiate-local-class.cpp

Index: clang/test/SemaTemplate/instantiate-local-class.cpp
===
--- clang/test/SemaTemplate/instantiate-local-class.cpp
+++ clang/test/SemaTemplate/instantiate-local-class.cpp
@@ -489,7 +489,7 @@
 namespace PR45000 {
   template 
   void f(int x = [](T x = nullptr) -> int { return x; }());
-  // expected-error@-1 {{cannot initialize a parameter of type 'int' with an rvalue of type 'nullptr_t'}}
+  // expected-error@-1 {{cannot initialize a parameter of type 'int' with an rvalue of type 'std::nullptr_t'}}
   // expected-note@-2 {{passing argument to parameter 'x' here}}
 
   void g() { f(); }
Index: clang/test/SemaTemplate/friend.cpp
===
--- clang/test/SemaTemplate/friend.cpp
+++ clang/test/SemaTemplate/friend.cpp
@@ -146,5 +146,5 @@
   template struct T { friend auto f(X*) { return nullptr; } };
   struct X1 { friend auto f(X1*); };
   template struct T;
-  int n = f((X1*)nullptr); // expected-error {{cannot initialize a variable of type 'int' with an rvalue of type 'nullptr_t'}}
+  int n = f((X1*)nullptr); // expected-error {{cannot initialize a variable of type 'int' with an rvalue of type 'std::nullptr_t'}}
 }
Index: clang/test/SemaTemplate/deduction.cpp
===
--- clang/test/SemaTemplate/deduction.cpp
+++ clang/test/SemaTemplate/deduction.cpp
@@ -313,7 +313,7 @@
   }
 
   template class X, typename T, int *P>
-void f0(X) {} // expected-note {{deduced non-type template argument does not have the same type as the corresponding template parameter ('nullptr_t' vs 'int *')}}
+void f0(X) {} // expected-note {{deduced non-type template argument does not have the same type as the corresponding template parameter ('std::nullptr_t' vs 'int *')}}
   void h0() {
 f0(X());
 f0(X()); // expected-error {{no matching function}}
Index: clang/test/SemaTemplate/deduction-guide.cpp
===
--- clang/test/SemaTemplate/deduction-guide.cpp
+++ clang/test/SemaTemplate/deduction-guide.cpp
@@ -73,7 +73,7 @@
 // CHECK: `-CXXDeductionGuideDecl {{.*}} 'auto (X) -> B'
 // CHECK:   |-TemplateArgument type 'char'
 // CHECK:   |-TemplateArgument integral 120
-// CHECK:   |-TemplateArgument type 'nullptr_t'
+// CHECK:   |-TemplateArgument type 'std::nullptr_t'
 // CHECK:   |-TemplateArgument nullptr
 // CHECK:   `-ParmVarDecl {{.*}} 'X':'X'
 // CHECK: FunctionProtoType {{.*}} 'auto (X) -> B' dependent trailing_return
Index: clang/test/SemaCXX/nullptr.cpp
===
--- clang/test/SemaCXX/nullptr.cpp
+++ clang/test/SemaCXX/nullptr.cpp
@@ -57,7 +57,7 @@
   o2(nullptr); // expected-error {{ambiguous}}
 
   // nullptr is an rvalue, null is an lvalue
-  (void) // expected-error {{cannot take the address of an rvalue of type 'nullptr_t'}}
+  (void) // expected-error {{cannot take the address of an rvalue of type 'std::nullptr_t'}}
   nullptr_t *pn = 
 
   // You can reinterpret_cast nullptr to an integer.
Index: clang/test/SemaCXX/nullability.cpp
===
--- clang/test/SemaCXX/nullability.cpp
+++ clang/test/SemaCXX/nullability.cpp
@@ -15,7 +15,7 @@
 // Nullability applies to all pointer types.
 typedef int (X::* _Nonnull member_function_type_1)(int);
 typedef int X::* _Nonnull member_data_type_1;
-typedef nullptr_t _Nonnull nonnull_nullptr_t; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'nullptr_t'}}
+typedef nullptr_t _Nonnull nonnull_nullptr_t; // expected-error{{nullability specifier '_Nonnull' cannot 

[clang] 131e878 - Print nullptr_t namespace qualified within std::

2021-09-21 Thread David Blaikie via cfe-commits

Author: David Blaikie
Date: 2021-09-21T11:21:40-07:00
New Revision: 131e8786640a49daf533b7ead4d3b5b82e0aea2a

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

LOG: Print nullptr_t namespace qualified within std::

This improves diagnostic (& important to me, DWARF) accuracy - otherwise
there could be ambiguities between "std::nullptr_t" and some user-defined
type that's /actually/ "nullptr_t" defined in the global namespace.

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

Added: 


Modified: 
clang/lib/AST/Type.cpp
clang/test/AST/ast-dump-recovery.cpp
clang/test/Analysis/plist-diagnostics-template-record.cpp
clang/test/CXX/drs/dr15xx.cpp
clang/test/CXX/drs/dr6xx.cpp
clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1-11.cpp
clang/test/CXX/temp/temp.param/p10-2a.cpp
clang/test/CodeGenCXX/debug-info-template.cpp
clang/test/OpenMP/task_affinity_messages.cpp
clang/test/OpenMP/task_depend_messages.cpp
clang/test/Sema/builtins-arm64-mte.c
clang/test/Sema/format-strings-pedantic.c
clang/test/SemaCXX/cxx0x-noexcept-expression.cpp
clang/test/SemaCXX/cxx2a-explicit-bool.cpp
clang/test/SemaCXX/nullability.cpp
clang/test/SemaCXX/nullptr.cpp
clang/test/SemaTemplate/deduction-guide.cpp
clang/test/SemaTemplate/deduction.cpp
clang/test/SemaTemplate/friend.cpp
clang/test/SemaTemplate/instantiate-local-class.cpp

Removed: 




diff  --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index f71c05d639ce3..112218d6eb369 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -3042,7 +3042,7 @@ StringRef BuiltinType::getName(const PrintingPolicy 
) const {
   case Char32:
 return "char32_t";
   case NullPtr:
-return "nullptr_t";
+return "std::nullptr_t";
   case Overload:
 return "";
   case BoundMember:

diff  --git a/clang/test/AST/ast-dump-recovery.cpp 
b/clang/test/AST/ast-dump-recovery.cpp
index 5ea9c08519695..8c6563961bd60 100644
--- a/clang/test/AST/ast-dump-recovery.cpp
+++ b/clang/test/AST/ast-dump-recovery.cpp
@@ -250,7 +250,7 @@ using Escape = decltype([] { return undef(); }());
 // CHECK-NEXT: `-RecoveryExpr {{.*}} '' contains-errors lvalue
 // CHECK-NEXT:   `-InitListExpr
 // CHECK-NEXT: `-DesignatedInitExpr {{.*}} 'void'
-// CHECK-NEXT:   `-CXXNullPtrLiteralExpr {{.*}} 'nullptr_t'
+// CHECK-NEXT:   `-CXXNullPtrLiteralExpr {{.*}} 'std::nullptr_t'
 struct {
   int& abc;
 } NoCrashOnInvalidInitList = {

diff  --git a/clang/test/Analysis/plist-diagnostics-template-record.cpp 
b/clang/test/Analysis/plist-diagnostics-template-record.cpp
index ffd6d03088363..3f45a43d260b9 100644
--- a/clang/test/Analysis/plist-diagnostics-template-record.cpp
+++ b/clang/test/Analysis/plist-diagnostics-template-record.cpp
@@ -38,5 +38,5 @@ int main() {
 
 // CHECK:  Calling constructor for DivByZeroint, float, 
double, 0
 // CHECK:  Calling constructor for DivByZerochar, float, 
double, 0
-// CHECK:  Calling constructor for 
DivByZeroVariadicchar, float, double, nullptr_t
+// CHECK:  Calling constructor for 
DivByZeroVariadicchar, float, double, 
std::nullptr_t
 

diff  --git a/clang/test/CXX/drs/dr15xx.cpp b/clang/test/CXX/drs/dr15xx.cpp
index e4f1105ceebe0..c588891a75d6a 100644
--- a/clang/test/CXX/drs/dr15xx.cpp
+++ b/clang/test/CXX/drs/dr15xx.cpp
@@ -113,7 +113,7 @@ namespace dr1512 { // dr1512: 4
   }
 
 #if __cplusplus >= 201103L
-  template struct Wrap { operator T(); }; // expected-note 
4{{converted to type 'nullptr_t'}} expected-note 4{{converted to type 'int *'}}
+  template struct Wrap { operator T(); }; // expected-note 
4{{converted to type 'std::nullptr_t'}} expected-note 4{{converted to type 'int 
*'}}
   void test_overload() {
 using nullptr_t = decltype(nullptr);
 void(Wrap() == Wrap());
@@ -127,7 +127,7 @@ namespace dr1512 { // dr1512: 4
 // but then only convert as far as 'nullptr_t', which we then can't 
convert to 'int*'.
 void(Wrap() == Wrap());
 void(Wrap() != Wrap());
-void(Wrap() < Wrap()); // expected-error {{invalid 
operands to binary expression ('Wrap' and 'Wrap')}}
+void(Wrap() < Wrap()); // expected-error {{invalid 
operands to binary expression ('Wrap' (aka 'Wrap') 
and 'Wrap')}}
 void(Wrap() > Wrap()); // expected-error {{invalid 
operands}}
 void(Wrap() <= Wrap()); // expected-error {{invalid 
operands}}
 void(Wrap() >= Wrap()); // expected-error {{invalid 
operands}}

diff  --git a/clang/test/CXX/drs/dr6xx.cpp b/clang/test/CXX/drs/dr6xx.cpp
index efca2b4292748..d3cf925eb3f3e 100644
--- a/clang/test/CXX/drs/dr6xx.cpp
+++ b/clang/test/CXX/drs/dr6xx.cpp
@@ -590,7 +590,7 @@ namespace dr652 { // dr652: yes
 namespace dr654 { // dr654: sup 1423
   void f() {
 if (nullptr) {} // expected-warning 

[PATCH] D110142: [clang][Driver] Correct runtime path for Arm hard float targets

2021-09-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In D110142#3013138 , @MaskRay wrote:

> Do you know why `--target=armv8l-unknown-linux-gnueabihf` picks 
> `armhf-unknown-linux-gnueabihf` instead of `armv8l-unknown-linux-gnueabihf`?
> (For new tests, prefer `--target=` to `-target `; space separated driver 
> options are not the convention.)
>
> The direction the Clang driver should move to is less magic. See D109727 
> 

I agree with @MaskRay, we discussed this when updating the Clang multiarch 
layout and the decision was to use normalized LLVM triples to avoid additional 
translations as is done in this change.

It also seems like `armhf-unknown-linux-gnueabihf` duplicates the `hf` bit 
(there's both `armhf` and `gnueabihf`) which seems unnecessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110142

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1d66649adf28: [OpenMP] Codegen aggregate for outlined 
function captures (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/declare_variant_construct_codegen_1.c
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/metadirective_device_kind_codegen.c
  clang/test/OpenMP/metadirective_device_kind_codegen.cpp
  clang/test/OpenMP/metadirective_implementation_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  

[PATCH] D110142: [clang][Driver] Correct runtime path for Arm hard float targets

2021-09-21 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/test/Driver/arm-float-abi-runtime-path.c:7
+// RUN:-resource-dir=%S/Inputs/arm_float_abi_runtime_path 2>&1 | 
FileCheck -check-prefix=ARMHF %s
+// RUN: %clang %s -target armv7-unknown-linux-gnueabihf -print-runtime-dir \
+// RUN:-resource-dir=%S/Inputs/arm_float_abi_runtime_path 2>&1 | 
FileCheck -check-prefix=ARMHF %s

Having one of armv7/armv8l is sufficient.

We should use the fewest RUN lines to ensure coverage. As is, spawning 8 clang 
processes is too expensive.



Comment at: clang/test/Driver/arm-float-abi-runtime-path.c:14
+// RUN:-resource-dir=%S/Inputs/arm_float_abi_runtime_path 2>&1 | 
FileCheck -check-prefix=ARM %s
+// RUN: %clang %s -target armv7-unknown-linux-gnueabi -print-runtime-dir \
+// RUN:-resource-dir=%S/Inputs/arm_float_abi_runtime_path 2>&1 | 
FileCheck -check-prefix=ARM %s

Having one of armv7/armv8l is sufficient.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110142

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


[PATCH] D110142: [clang][Driver] Correct runtime path for Arm hard float targets

2021-09-21 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Do you know why `--target=armv8l-unknown-linux-gnueabihf` picks 
`armhf-unknown-linux-gnueabihf` instead of `armv8l-unknown-linux-gnueabihf`?
(For new tests, prefer `--target=` to `-target `; space separated driver 
options are not the convention.)

The direction the Clang driver should move to is less magic. See D109727 





Comment at: clang/lib/Driver/ToolChain.cpp:492
+  llvm::Triple triple = getTriple();
+  RegisterEffectiveTriple TripleRAII(*this, triple);
+  auto arch_name = getArchNameForCompilerRTLib(*this, Args);

Add a comment similar to 

// --target=armv8l-unknown-linux-gnueabi prefers to change the machine part to 
arm{,hf}. The os part may change to gnueabi{,hf}.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110142

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


[PATCH] D109437: [PowerPC] FP compare and test XL compat builtins.

2021-09-21 Thread Kamau Bridgeman via Phabricator via cfe-commits
kamaub added inline comments.



Comment at: clang/lib/Sema/SemaChecking.cpp:3518
+// valid. The argument must be either a 'float' or a 'double'.
+bool Sema::CheckPPCTestDataClassType(CallExpr *TheCall) {
+  QualType ArgType = TheCall->getArg(0)->getType();

lei wrote:
> I don't think this need to be function in the Sema class.  It can just be a 
> static function.
This is a great suggestion, I'm wondering if the function is even needed at all 
though since the code block is quite small and only called once, having it 
inside the case statement seems more readable to me. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109437

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2021-09-21 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 373982.
ggeorgakoudis added a comment.

Rebase and update tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  clang/test/CodeGenCXX/observe-noexcept.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/declare_variant_construct_codegen_1.c
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/metadirective_device_kind_codegen.c
  clang/test/OpenMP/metadirective_device_kind_codegen.cpp
  clang/test/OpenMP/metadirective_implementation_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_for_simd_aligned_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  

[PATCH] D105765: Prepare Compiler-RT for GnuInstallDirs, matching libcxx, document all

2021-09-21 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 added inline comments.



Comment at: compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake:509
 set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
-  ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
+  ${COMPILER_RT_OUTPUT_LIBRARY_DIR}/macho_embedded)
 set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR

arphaman wrote:
> It looks like this change broke the `macho_embedded` layout for Darwin's 
> compiler-rt build, so now the clang driver isn unable to find these libraries.
> 
> I will commit a change that uses `COMPILER_RT_OUTPUT_DIR` again for the 
> `macho_embedded` libraries.
Can you help me understand this better? `COMPILER_RT_OUTPUT_LIBRARY_DIR` should 
be defined to be the same thing unless target-specific directories are used, Is 
the problem in the latter case?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105765

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


[PATCH] D109951: [clang-format] Constructor initializer lists format with pp directives

2021-09-21 Thread Josh Learn via Phabricator via cfe-commits
guitard0g updated this revision to Diff 373977.
guitard0g added a comment.

Add test case for space between directives.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109951

Files:
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -19268,6 +19268,78 @@
Style);
 }
 
+TEST_F(FormatTest, ConstructorInitializersWithPreprocessorDirective) {
+  FormatStyle Style = getLLVMStyle();
+  Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma;
+  Style.ConstructorInitializerIndentWidth = 4;
+  verifyFormat("SomeClass::Constructor()\n"
+   ": a{a}\n"
+   ", b{b} {}",
+   Style);
+  verifyFormat("SomeClass::Constructor()\n"
+   ": a{a}\n"
+   "#if CONDITION\n"
+   ", b{b}\n"
+   "#endif\n"
+   "{\n}",
+   Style);
+  Style.ConstructorInitializerIndentWidth = 2;
+  verifyFormat("SomeClass::Constructor()\n"
+   "#if CONDITION\n"
+   "  : a{a}\n"
+   "#endif\n"
+   "  , b{b}\n"
+   "  , c{c} {\n}",
+   Style);
+  Style.ConstructorInitializerIndentWidth = 0;
+  verifyFormat("SomeClass::Constructor()\n"
+   ": a{a}\n"
+   "#ifdef CONDITION\n"
+   ", b{b}\n"
+   "#else\n"
+   ", c{c}\n"
+   "#endif\n"
+   ", d{d} {\n}",
+   Style);
+  Style.ConstructorInitializerIndentWidth = 4;
+  verifyFormat("SomeClass::Constructor()\n"
+   ": a{a}\n"
+   "#if WINDOWS\n"
+   "#if DEBUG\n"
+   ", b{0}\n"
+   "#else\n"
+   ", b{1}\n"
+   "#endif\n"
+   "#else\n"
+   "#if DEBUG\n"
+   ", b{2}\n"
+   "#else\n"
+   ", b{3}\n"
+   "#endif\n"
+   "#endif\n"
+   "{\n}",
+   Style);
+  verifyFormat("SomeClass::Constructor()\n"
+   ": a{a}\n"
+   "#if WINDOWS\n"
+   ", b{0}\n"
+   "#if DEBUG\n"
+   ", c{0}\n"
+   "#else\n"
+   ", c{1}\n"
+   "#endif\n"
+   "#else\n"
+   "#if DEBUG\n"
+   ", c{2}\n"
+   "#else\n"
+   ", c{3}\n"
+   "#endif\n"
+   ", b{1}\n"
+   "#endif\n"
+   "{\n}",
+   Style);
+}
+
 TEST_F(FormatTest, Destructors) {
   verifyFormat("void F(int ) { i.~int(); }");
   verifyFormat("void F(int ) { i->~int(); }");
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -489,6 +489,17 @@
 if (Style.Language == FormatStyle::LK_Proto) {
   ProbablyBracedList = NextTok->isOneOf(tok::comma, tok::r_square);
 } else {
+  // Skip NextTok over preprocessor lines, otherwise we may not
+  // properly diagnose the block as a braced intializer
+  // if the comma separator appears after the pp directive.
+  while (NextTok->is(tok::hash)) {
+ScopedMacroState MacroState(*Line, Tokens, NextTok);
+do {
+  NextTok = Tokens->getNextToken();
+  ++ReadTokens;
+} while (NextTok->isNot(tok::eof));
+  }
+
   // Using OriginalColumn to distinguish between ObjC methods and
   // binary operators is a bit hacky.
   bool NextIsObjCMethod = NextTok->isOneOf(tok::plus, tok::minus) &&
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110185: [OpenCL] Reuse C++ for OpenCL 1.0 address space tests for version 2021

2021-09-21 Thread Justas Janickas via Phabricator via cfe-commits
Topotuna created this revision.
Topotuna added a reviewer: Anastasia.
Herald added subscribers: ldrumm, yaxunl.
Topotuna requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Adds `RUN` lines in C++ for OpenCL address space tests to cover
version 2021. With all optional core features enabled by default,
C++ for OpenCL 2021 is expected to behave exactly the same way as
C++ for OpenCL 1.0. Therefore, no adjustments were needed in test
code itself.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110185

Files:
  clang/test/CodeGenOpenCLCXX/address-space-castoperators.cpp
  clang/test/CodeGenOpenCLCXX/address-space-deduction.clcpp
  clang/test/CodeGenOpenCLCXX/address-space-deduction2.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-conversion.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-derived-base.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-new-delete.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-of-this.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-operators.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-references.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-with-class.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace_cast.clcpp

Index: clang/test/CodeGenOpenCLCXX/addrspace_cast.clcpp
===
--- clang/test/CodeGenOpenCLCXX/addrspace_cast.clcpp
+++ clang/test/CodeGenOpenCLCXX/addrspace_cast.clcpp
@@ -1,4 +1,5 @@
-//RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s
+//RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir -emit-llvm -O0 -o - | FileCheck %s
+//RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir -emit-llvm -O0 -o - | FileCheck %s
 
 //CHECK-LABEL: define{{.*}} spir_func void @_Z3barPU3AS1i
 void bar(global int *gl) {
Index: clang/test/CodeGenOpenCLCXX/addrspace-with-class.clcpp
===
--- clang/test/CodeGenOpenCLCXX/addrspace-with-class.clcpp
+++ clang/test/CodeGenOpenCLCXX/addrspace-with-class.clcpp
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s
-// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s --check-prefix=CHECK-DEFINITIONS
+// RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s --check-prefix=CHECK-DEFINITIONS
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s --check-prefix=CHECK-DEFINITIONS
 
 // This test ensures the proper address spaces and address space cast are used
 // for constructors, member functions and destructors.
Index: clang/test/CodeGenOpenCLCXX/addrspace-references.clcpp
===
--- clang/test/CodeGenOpenCLCXX/addrspace-references.clcpp
+++ clang/test/CodeGenOpenCLCXX/addrspace-references.clcpp
@@ -1,4 +1,5 @@
-//RUN: %clang_cc1 %s -triple spir -emit-llvm -o - -O0 | FileCheck %s
+//RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir -emit-llvm -o - -O0 | FileCheck %s
+//RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir -emit-llvm -o - -O0 | FileCheck %s
 
 typedef short short2 __attribute__((ext_vector_type(2)));
 
Index: clang/test/CodeGenOpenCLCXX/addrspace-operators.clcpp
===
--- clang/test/CodeGenOpenCLCXX/addrspace-operators.clcpp
+++ clang/test/CodeGenOpenCLCXX/addrspace-operators.clcpp
@@ -1,4 +1,5 @@
-//RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s
+//RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir -emit-llvm -O0 -o - | FileCheck %s
+//RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir -emit-llvm -O0 -o - | FileCheck %s
 
 enum E {
   a,
Index: clang/test/CodeGenOpenCLCXX/addrspace-of-this.clcpp
===
--- clang/test/CodeGenOpenCLCXX/addrspace-of-this.clcpp
+++ clang/test/CodeGenOpenCLCXX/addrspace-of-this.clcpp
@@ -1,6 +1,9 @@
-// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -pedantic -verify -O0 -o - -DDECL | FileCheck %s --check-prefixes="COMMON,EXPL"
-// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -pedantic -verify -O0 -o - -DDECL -DUSE_DEFLT | FileCheck %s --check-prefixes="COMMON,IMPL"
-// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -pedantic -verify -O0 -o - | FileCheck %s --check-prefixes="COMMON,IMPL"
+// RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -emit-llvm -pedantic -verify -O0 -o - -DDECL | FileCheck %s --check-prefixes="COMMON,EXPL"
+// RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -emit-llvm -pedantic -verify -O0 -o - -DDECL -DUSE_DEFLT | FileCheck %s 

[PATCH] D110184: [OpenCL] Constructor address space test adjusted for C++ for OpenCL 2021

2021-09-21 Thread Justas Janickas via Phabricator via cfe-commits
Topotuna created this revision.
Topotuna added a reviewer: Anastasia.
Herald added subscribers: ldrumm, yaxunl.
Topotuna requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Reuses C++ for OpenCL constructor address space test so that it
supports optional generic address spaces in version 2021.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110184

Files:
  clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp


Index: clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp
===
--- clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp
+++ clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -O0 -triple spir-unknown-unknown | 
FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++1.0 -DGENERIC -emit-llvm -o - -O0 -triple 
spir-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -DGENERIC -emit-llvm -o - -O0 -triple 
spir-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++2021 
-cl-ext=-__opencl_c_generic_address_space,-__opencl_c_pipes -emit-llvm -o - -O0 
-triple spir-unknown-unknown | FileCheck %s
 
 // CHECK: %struct.X = type { i32 }
 
@@ -11,8 +13,10 @@
   int x;
 
   // Local variables are handled in local_addrspace_init.clcpp
-  X() /*__generic*/ : x(0) {}
+  X() /*__generic or __private*/ : x(0) {}
+#if defined(GENERIC)
   X() __private : x(0) {}
+#endif
   X() __global : x(0) {}
   constexpr X() __constant : x(0) {}
   constexpr X(int x) __constant : x(x) {}


Index: clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp
===
--- clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp
+++ clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -O0 -triple spir-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++1.0 -DGENERIC -emit-llvm -o - -O0 -triple spir-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -DGENERIC -emit-llvm -o - -O0 -triple spir-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -cl-ext=-__opencl_c_generic_address_space,-__opencl_c_pipes -emit-llvm -o - -O0 -triple spir-unknown-unknown | FileCheck %s
 
 // CHECK: %struct.X = type { i32 }
 
@@ -11,8 +13,10 @@
   int x;
 
   // Local variables are handled in local_addrspace_init.clcpp
-  X() /*__generic*/ : x(0) {}
+  X() /*__generic or __private*/ : x(0) {}
+#if defined(GENERIC)
   X() __private : x(0) {}
+#endif
   X() __global : x(0) {}
   constexpr X() __constant : x(0) {}
   constexpr X(int x) __constant : x(x) {}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108621: [HIPSPV] Add CUDA->SPIR-V address space mapping

2021-09-21 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments.



Comment at: clang/lib/Basic/Targets/SPIR.h:59
+// translation). This mapping is enabled when the language mode is HIP.
+1, // cuda_device
+// cuda_constant pointer can be casted to default/"flat" pointer, but in

bader wrote:
> Anastasia wrote:
> > linjamaki wrote:
> > > bader wrote:
> > > > keryell wrote:
> > > > > Anastasia wrote:
> > > > > > bader wrote:
> > > > > > > Anastasia wrote:
> > > > > > > > I am slightly confused as in the LLVM project those address 
> > > > > > > > spaces are for SPIR not SPIR-V though. It is however used 
> > > > > > > > outside of LLVM project by some tools like SPIRV-LLVM 
> > > > > > > > Translator as a path to SPIR-V, but it has only been done as a 
> > > > > > > > workaround since we had no SPIR-V support in the LLVM project 
> > > > > > > > yet. And if we are adding it let's do it clean to avoid/resolve 
> > > > > > > > any confusion.
> > > > > > > > 
> > > > > > > > I think we need to keep both because some vendors do target/use 
> > > > > > > > SPIR but not SPIR-V.
> > > > > > > > 
> > > > > > > > So if you are interested in SPIR-V and not SPIR you should 
> > > > > > > > probably add a new target that will make things cleaner.
> > > > > > > > I think we need to keep both because some vendors do target/use 
> > > > > > > > SPIR but not SPIR-V.
> > > > > > > 
> > > > > > > @Anastasia, could you elaborate more on the difference between 
> > > > > > > SPIR and SPIR-V?
> > > > > > > I would like to understand what these terms mean in the context 
> > > > > > > of LLVM project.
> > > > > > Their conceptual differences are just that they are two different 
> > > > > > intermediate formats.
> > > > > > 
> > > > > > The important thing to highlight is that it is not impossible that 
> > > > > > some vendors use SPIR (without using SPIR-V) even despite the fact 
> > > > > > it has been discontinued by Khronos. 
> > > > > > 
> > > > > > Nobody has deprecated or discontinued SPIR in the LLVM project yet.
> > > > > > Their conceptual differences are just that they are two different 
> > > > > > intermediate formats.
> > > > > > 
> > > > > > The important thing to highlight is that it is not impossible that 
> > > > > > some vendors use SPIR (without using SPIR-V) even despite the fact 
> > > > > > it has been discontinued by Khronos. 
> > > > > > 
> > > > > > Nobody has deprecated or discontinued SPIR in the LLVM project yet.
> > > > > 
> > > > > All the official Xilinx OpenCL stack is based on legacy SPIR (encoded 
> > > > > in LLVM 6.x IR but this is another story) and I suspect this is the 
> > > > > case for other companies.
> > > > > So, do not deprecate or discontinue, please. :-)
> > > > > The important thing to highlight is that it is not impossible that 
> > > > > some vendors use SPIR (without using SPIR-V) even despite the fact it 
> > > > > has been discontinued by Khronos.
> > > > > Nobody has deprecated or discontinued SPIR in the LLVM project yet.
> > > > 
> > > > Strictly speaking `SPIR` is not defined as an intermediate language. 
> > > > Khronos defines `SPIR-1.2` and `SPIR-2.0` formats which are based on 
> > > > LLVM 3.2 and LLVM 3.4 version (https://www.khronos.org/spir/). There is 
> > > > no definition of SPIR format based on current version of LLVM IR. 
> > > > Another note is that metadata and intrinsics emitted for OpenCL with 
> > > > clang-14 doesn't follow neither `SPIR-1.2` nor `SPIR-2.0`.
> > > > 
> > > > I always think of LLVM IR as leaving thing that is subject to change by 
> > > > LLVM community, so tools working with LLVM IR must adjust to the 
> > > > particular version (e.g. release version like LLVM 13 or ToT). We apply 
> > > > this logic to SPIRV-LLVM-Translator tool and update it according to 
> > > > LLVM format changes (e.g. kernel argument information defined in 
> > > > Khronos spec must be named metadata whereas clang emits function 
> > > > metadata).
> > > > 
> > > > > I am slightly confused as in the LLVM project those address spaces 
> > > > > are for SPIR not SPIR-V though.
> > > > [skip]
> > > > > Their conceptual differences are just that they are two different 
> > > > > intermediate formats.
> > > > 
> > > > If this is the only difference, I don't think it a good idea to create 
> > > > another LLVM target to separate SPIR and SPIR-V. From my point of view 
> > > > it creates logic ambiguity and code duplication with no additional 
> > > > value. @Anastasia, what problems do you see if we continue treating 
> > > > LLVM IR with spir* target triple as LLVM IR representation of SPIR-V 
> > > > format?
> > > The state of SPIR 1.2/2.0 in Clang seems to be that the SPIR target has 
> > > transformed to mean “SPIR 1.2/2.0 derivative”, but that does not still 
> > > make it SPIR-V, which is not based on LLVM IR. When one is targeting 
> > > spir* there is ambiguity on whether one is aiming to produce the 
> > > old-SPIR-derivative or SPIR-V. 

[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

2021-09-21 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

In D103938#3012940 , @ychen wrote:

> @uabelho @gulfem  Thanks for the remainder. I could not reproduce the issue 
> with my Ubuntu box. Could you please attach a reproducer?

Never mind, I think I need "-Werror" to reproduce these.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103938

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


[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

2021-09-21 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

@uabelho @gulfem  Thanks for the remainder. I could not reproduce the issue 
with my Ubuntu box. Could you please attach a reproducer?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103938

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


[clang] 8c68bd4 - [OpenMP][NFC] Add declare variant and metadirective to support page

2021-09-21 Thread via cfe-commits

Author: cchen
Date: 2021-09-21T11:28:13-05:00
New Revision: 8c68bd480f3d8a5bf6087f47837d320f9d6dba2d

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

LOG: [OpenMP][NFC] Add declare variant and metadirective to support page

Added: 


Modified: 
clang/docs/OpenMPSupport.rst

Removed: 




diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 23de4b5f0c2d4..0e3cd25e59e3c 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -235,7 +235,7 @@ implementation.
 
+--+--+--+---+
 | misc extension   | library shutdown (omp_pause_resource[_all])   
   | :none:`unclaimed parts`  | D55078  
  |
 
+--+--+--+---+
-| misc extension   | metadirectives
   | :part:`worked on`| 
  |
+| misc extension   | metadirectives
   | :part:`worked on`| D91944  
  |
 
+--+--+--+---+
 | misc extension   | conditional modifier for lastprivate clause   
   | :good:`done` | 
  |
 
+--+--+--+---+
@@ -243,7 +243,7 @@ implementation.
 
+--+--+--+---+
 | misc extension   | depobj directive and depobj dependency kind   
   | :good:`done` | 
  |
 
+--+--+--+---+
-| misc extension   | user-defined function variants
   | :part:`worked on`| D67294, D64095, D71847, D71830  
  |
+| misc extension   | user-defined function variants
   | :part:`worked on`| D67294, D64095, D71847, D71830, 
D109635   |
 
+--+--+--+---+
 | misc extension   | pointer/reference to pointer based array 
reductions  | :none:`unclaimed`|
   |
 
+--+--+--+---+



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


[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

2021-09-21 Thread Gulfem Savrun Yeniceri via Phabricator via cfe-commits
gulfem added a comment.

We also started seeing similar `libc++` test failures in our Fuchsia builds:
https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8835548361443044001/+/u/clang/test/stdout

  Failed Tests (89):
libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp
libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp
libc++ :: 
std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_result_type.pass.cpp
libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_sseq.pass.cpp
libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/default.pass.cpp
libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp
libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp
libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/io.pass.cpp
libc++ :: 
std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_result_type.pass.cpp
libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_sseq.pass.cpp
libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp
libc++ :: 
std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
libc++ :: 
std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
libc++ :: 
std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
libc++ :: 
std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp
libc++ :: 
std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
libc++ :: 
std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
libc++ :: 
std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp
libc++ :: 
std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp
libc++ :: 
std/numerics/rand/rand.eng/rand.eng.lcong/ctor_result_type.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.lcong/result_type.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/ctor_result_type.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/default.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/eval.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/io.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/result_type.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/seed_result_type.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/seed_sseq.pass.cpp
libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp
libc++ :: std/numerics/rand/rand.predef/mt19937_64.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.cons/default.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.hash/enabled_hash.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/all.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/any.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/count.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/flip_all.pass.cpp
libc++ :: 
std/utilities/template.bitset/bitset.members/flip_one.out_of_range.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/index.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/index_const.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/left_shift.pass.cpp
libc++ :: 
std/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/none.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/not_all.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/reset_all.pass.cpp
   

[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

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

In D103938#3012910 , @gulfem wrote:

> We also started seeing similar `libc++` test failures in our Fuchsia builds:
> https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8835548361443044001/+/u/clang/test/stdout
>
>   Failed Tests (89):
> libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp
> libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_result_type.pass.cpp
> libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_sseq.pass.cpp
> libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/default.pass.cpp
> libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp
> libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp
> libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/io.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_result_type.pass.cpp
> libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_sseq.pass.cpp
> libc++ :: std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.eng/rand.eng.lcong/ctor_result_type.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.lcong/result_type.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.eng/rand.eng.mers/ctor_result_type.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/default.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/eval.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/io.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/result_type.pass.cpp
> libc++ :: 
> std/numerics/rand/rand.eng/rand.eng.mers/seed_result_type.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/seed_sseq.pass.cpp
> libc++ :: std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp
> libc++ :: std/numerics/rand/rand.predef/mt19937_64.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.cons/default.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.hash/enabled_hash.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.members/all.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.members/any.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.members/count.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.members/flip_all.pass.cpp
> libc++ :: 
> std/utilities/template.bitset/bitset.members/flip_one.out_of_range.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.members/index.pass.cpp
> libc++ :: 
> std/utilities/template.bitset/bitset.members/index_const.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.members/left_shift.pass.cpp
> libc++ :: 
> std/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.members/none.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.members/not_all.pass.cpp
> libc++ :: std/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp
> libc++ :: 

[clang] 73a8bcd - Revert "Diagnose -Wunused-value based on CFG reachability"

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

Author: Aaron Ballman
Date: 2021-09-21T12:25:13-04:00
New Revision: 73a8bcd78921d38130fc42c90fd75d47b05b063d

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

LOG: Revert "Diagnose -Wunused-value based on CFG reachability"

This reverts commit 63e0d038fc20c894a3d541effa1bc2b1fdea37b9.

It causes test failures:

http://lab.llvm.org:8011/#/builders/119/builds/5612
https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8835548361443044001/+/u/clang/test/stdout

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaStmt.cpp
clang/test/Analysis/dead-stores.c
clang/test/CXX/basic/basic.link/p8.cpp
clang/test/CXX/drs/dr14xx.cpp
clang/test/CXX/drs/dr20xx.cpp
clang/test/CXX/drs/dr7xx.cpp

clang/test/CXX/temp/temp.constr/temp.constr.constr/partial-specializations.cpp
clang/test/CodeCompletion/pragma-macro-token-caching.c
clang/test/Frontend/fixed_point_crash.c
clang/test/PCH/cxx-explicit-specifier.cpp
clang/test/Parser/cxx-ambig-decl-expr.cpp
clang/test/Parser/cxx0x-ambig.cpp
clang/test/Parser/cxx1z-init-statement.cpp
clang/test/Parser/objc-messaging-1.m
clang/test/Parser/objc-try-catch-1.m
clang/test/Parser/objcxx11-attributes.mm
clang/test/Sema/const-eval.c
clang/test/Sema/exprs.c
clang/test/Sema/i-c-e.c
clang/test/Sema/sizeless-1.c
clang/test/Sema/switch-1.c
clang/test/Sema/vla-2.c
clang/test/Sema/warn-type-safety.c
clang/test/Sema/warn-unused-value.c
clang/test/SemaCXX/attr-annotate.cpp
clang/test/SemaCXX/builtin-constant-p.cpp
clang/test/SemaCXX/constant-expression-cxx2a.cpp
clang/test/SemaCXX/constant-expression.cpp
clang/test/SemaCXX/expression-traits.cpp
clang/test/SemaCXX/matrix-type-operators.cpp
clang/test/SemaCXX/overloaded-operator.cpp
clang/test/SemaCXX/sizeless-1.cpp
clang/test/SemaCXX/vector.cpp
clang/test/SemaCXX/warn-comma-operator.cpp
clang/test/SemaCXX/warn-unused-value.cpp
clang/test/SemaTemplate/derived.cpp
clang/test/SemaTemplate/lambda-capture-pack.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 530e8cf2e9725..3cadd986b8ae4 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -8565,9 +8565,6 @@ def err_typecheck_choose_expr_requires_constant : Error<
   "'__builtin_choose_expr' requires a constant expression">;
 def warn_unused_expr : Warning<"expression result unused">,
   InGroup;
-def warn_unused_comma_left_operand : Warning<
-  "left operand of comma operator has no effect">,
-  InGroup;
 def warn_unused_voidptr : Warning<
   "expression result unused; should this cast be to 'void'?">,
   InGroup;

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index fc0b6919bd50b..93d5558b8267c 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -4912,7 +4912,7 @@ class Sema final {
 
   /// DiagnoseUnusedExprResult - If the statement passed in is an expression
   /// whose result is unused, warn.
-  void DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID);
+  void DiagnoseUnusedExprResult(const Stmt *S);
   void DiagnoseUnusedNestedTypedefs(const RecordDecl *D);
   void DiagnoseUnusedDecl(const NamedDecl *ND);
 
@@ -5118,16 +5118,6 @@ class Sema final {
   /// conversion.
   ExprResult tryConvertExprToType(Expr *E, QualType Ty);
 
-  /// Conditionally issue a diagnostic based on the statement's reachability
-  /// analysis evaluation context.
-  ///
-  /// \param Statement If Statement is non-null, delay reporting the
-  /// diagnostic until the function body is parsed, and then do a basic
-  /// reachability analysis to determine if the statement is reachable.
-  /// If it is unreachable, the diagnostic will not be emitted.
-  bool DiagIfReachable(SourceLocation Loc, ArrayRef Stmts,
-   const PartialDiagnostic );
-
   /// Conditionally issue a diagnostic based on the current
   /// evaluation context.
   ///

diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 83ff35b056e2e..7991e4c5e8b0a 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -28,7 +28,6 @@
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/Builtins.h"
-#include "clang/Basic/DiagnosticSema.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
@@ -13372,7 +13371,7 @@ static QualType CheckCommaOperands(Sema 

  1   2   >