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

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

In D109632#3021644 , @rmaz wrote:

> @vsapsai just checking on where we are with this one. Is the current plan to 
> investigate an approach only serializing the methods declared in each module, 
> or are we good to go ahead with the set de-duplication approach? I tried 
> profiling with D110123  and with the 
> following patch:
>
>   diff --git a/clang/lib/Serialization/ASTReader.cpp 
> b/clang/lib/Serialization/ASTReader.cpp
>   index 279067a8ac8b..aaaca0aff9ab 100644
>   --- a/clang/lib/Serialization/ASTReader.cpp
>   +++ b/clang/lib/Serialization/ASTReader.cpp
>   @@ -8130,7 +8130,7 @@ namespace serialization {
>  FactoryBits = Data.FactoryBits;
>  InstanceHasMoreThanOneDecl = Data.InstanceHasMoreThanOneDecl;
>  FactoryHasMoreThanOneDecl = Data.FactoryHasMoreThanOneDecl;
>   -  return true;
>   +  return false;
>}
>
> but this was a fair bit slower than the deduplication approach, and for some 
> files would never complete, presumably stuck in an infinite loop of dependent 
> modules. Is there a way to exclude the serialization of methods from 
> dependent modules but make the method lookup more efficient somehow?

That patch looks correct, I was experimenting with exactly the same local 
change. Have you tried D110123  on your 
original build? In my testing with synthetic test case it looks as good as set 
deduplication. In its current state D110123  
isn't really representative for actual code bases because it relies on method 
lists of specific shape (all non-transitive methods coming after all transitive 
methods). You can try to add deduplication stats to see that there is less 
deduplication but it's not entirely eliminated. At least that's my 
understanding which can be flawed. Though the fact that clang didn't complete 
for some files is super strange and concerning, have no idea why is it 
happening and will need to experiment on a real-life project.

I still think it is worth to pursue writing only owned methods in 
`METHOD_POOL`. Deduplication with a DenseSet works but I still expect it to be 
more expensive than avoiding duplicates by construction. As for the next step I 
was thinking about changing `ASTMethodPoolTrait` to skip transitive methods 
during serialization and it should help with eliminating all the duplicates. 
With that change we can test and see how it works.


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] D109632: [clang] de-duplicate methods from AST files

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

In D109632#3013620 , @dexonsmith 
wrote:

> 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?

We use `ReadMethodPoolVisitor` only from `ASTReader::ReadMethodPool`. I don't 
know all the cases when it is called but it is called at least on encountering 
`@end` to handle methods declared in an interface. With the proposed change the 
behavior is the following:

- the first time we encounter a selector, we walk the entire transitive closure 
of dependencies
- when `ReadMethodPool` is called again for the same selector, we check only 
immediate dependencies but exit early and don't drill into transitive 
dependencies due to

  // If we've already searched this module file, skip it now.
  if (M.Generation <= PriorGeneration)
return true;

- when we add a new dependency and trigger `ReadMethodPool` again, we visit 
only the added dependency and its unvisited transitive dependencies. We exit 
early for already visited modules.

So from the module visiting perspective there are no regressions. I'm not super 
happy with repeated early returns for immediate dependencies but we were doing 
it already. This behavior seems to be orthogonal and we can address it 
separately if needed.


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


[clang] 37adc4f - [clang] set templates as invalid when any of the parameters are invalid

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

Author: Matheus Izvekov
Date: 2021-09-25T04:04:47+02:00
New Revision: 37adc4f957c2383a625e2e593ba1d18a25d92b91

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

LOG: [clang] set templates as invalid when any of the parameters are invalid

See PR51872 for the original repro.

This fixes a crash when converting a templated constructor into a deduction
guide, in case any of the template parameters were invalid.

Signed-off-by: Matheus Izvekov 

Reviewed By: rsmith

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

Added: 


Modified: 
clang/lib/AST/DeclTemplate.cpp
clang/test/SemaTemplate/deduction-crash.cpp

Removed: 




diff  --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index a25185067b9c5..fa73c53866490 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -165,14 +165,20 @@ unsigned TemplateParameterList::getDepth() const {
 return cast(FirstParm)->getDepth();
 }
 
-static void AdoptTemplateParameterList(TemplateParameterList *Params,
+static bool AdoptTemplateParameterList(TemplateParameterList *Params,
DeclContext *Owner) {
+  bool Invalid = false;
   for (NamedDecl *P : *Params) {
 P->setDeclContext(Owner);
 
 if (const auto *TTP = dyn_cast(P))
-  AdoptTemplateParameterList(TTP->getTemplateParameters(), Owner);
+  if (AdoptTemplateParameterList(TTP->getTemplateParameters(), Owner))
+Invalid = true;
+
+if (P->isInvalidDecl())
+  Invalid = true;
   }
+  return Invalid;
 }
 
 void TemplateParameterList::
@@ -339,14 +345,15 @@ void RedeclarableTemplateDecl::addSpecializationImpl(
 // FunctionTemplateDecl Implementation
 
//===--===//
 
-FunctionTemplateDecl *FunctionTemplateDecl::Create(ASTContext ,
-   DeclContext *DC,
-   SourceLocation L,
-   DeclarationName Name,
-   TemplateParameterList *Params,
-   NamedDecl *Decl) {
-  AdoptTemplateParameterList(Params, cast(Decl));
-  return new (C, DC) FunctionTemplateDecl(C, DC, L, Name, Params, Decl);
+FunctionTemplateDecl *
+FunctionTemplateDecl::Create(ASTContext , DeclContext *DC, SourceLocation L,
+ DeclarationName Name,
+ TemplateParameterList *Params, NamedDecl *Decl) {
+  bool Invalid = AdoptTemplateParameterList(Params, cast(Decl));
+  auto *TD = new (C, DC) FunctionTemplateDecl(C, DC, L, Name, Params, Decl);
+  if (Invalid)
+TD->setInvalidDecl();
+  return TD;
 }
 
 FunctionTemplateDecl *FunctionTemplateDecl::CreateDeserialized(ASTContext ,
@@ -438,15 +445,16 @@ void 
FunctionTemplateDecl::mergePrevDecl(FunctionTemplateDecl *Prev) {
 // ClassTemplateDecl Implementation
 
//===--===//
 
-ClassTemplateDecl *ClassTemplateDecl::Create(ASTContext ,
- DeclContext *DC,
+ClassTemplateDecl *ClassTemplateDecl::Create(ASTContext , DeclContext *DC,
  SourceLocation L,
  DeclarationName Name,
  TemplateParameterList *Params,
  NamedDecl *Decl) {
-  AdoptTemplateParameterList(Params, cast(Decl));
-
-  return new (C, DC) ClassTemplateDecl(C, DC, L, Name, Params, Decl);
+  bool Invalid = AdoptTemplateParameterList(Params, cast(Decl));
+  auto *TD = new (C, DC) ClassTemplateDecl(C, DC, L, Name, Params, Decl);
+  if (Invalid)
+TD->setInvalidDecl();
+  return TD;
 }
 
 ClassTemplateDecl *ClassTemplateDecl::CreateDeserialized(ASTContext ,
@@ -1005,8 +1013,11 @@ ConceptDecl *ConceptDecl::Create(ASTContext , 
DeclContext *DC,
  SourceLocation L, DeclarationName Name,
  TemplateParameterList *Params,
  Expr *ConstraintExpr) {
-  AdoptTemplateParameterList(Params, DC);
-  return new (C, DC) ConceptDecl(DC, L, Name, Params, ConstraintExpr);
+  bool Invalid = AdoptTemplateParameterList(Params, DC);
+  auto *TD = new (C, DC) ConceptDecl(DC, L, Name, Params, ConstraintExpr);
+  if (Invalid)
+TD->setInvalidDecl();
+  return TD;
 }
 
 ConceptDecl *ConceptDecl::CreateDeserialized(ASTContext ,
@@ -1039,7 +1050,8 @@ ClassTemplatePartialSpecializationDecl(ASTContext 
, TagKind TK,
   SpecializedTemplate, Args, PrevDecl),
   

[PATCH] D110460: [clang] set templates as invalid when any of the parameters are invalid

2021-09-24 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 rG37adc4f957c2: [clang] set templates as invalid when any of 
the parameters are invalid (authored by mizvekov).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110460

Files:
  clang/lib/AST/DeclTemplate.cpp
  clang/test/SemaTemplate/deduction-crash.cpp

Index: clang/test/SemaTemplate/deduction-crash.cpp
===
--- clang/test/SemaTemplate/deduction-crash.cpp
+++ clang/test/SemaTemplate/deduction-crash.cpp
@@ -161,3 +161,13 @@
 }
 
 }
+
+namespace PR51872_part1 {
+  template class T1 { template  T1(); };
+  // expected-error@-1 {{non-type template parameter has incomplete type 'struct U1'}}
+  // expected-note@-2  {{forward declaration of 'PR51872_part1::U1'}}
+
+  T1 t1 = 0;
+  // expected-error@-1 {{no viable constructor or deduction guide for deduction of template arguments of 'T1'}}
+  // expected-note@-6  {{candidate template ignored: could not match 'T1<>' against 'int'}}
+}
Index: clang/lib/AST/DeclTemplate.cpp
===
--- clang/lib/AST/DeclTemplate.cpp
+++ clang/lib/AST/DeclTemplate.cpp
@@ -165,14 +165,20 @@
 return cast(FirstParm)->getDepth();
 }
 
-static void AdoptTemplateParameterList(TemplateParameterList *Params,
+static bool AdoptTemplateParameterList(TemplateParameterList *Params,
DeclContext *Owner) {
+  bool Invalid = false;
   for (NamedDecl *P : *Params) {
 P->setDeclContext(Owner);
 
 if (const auto *TTP = dyn_cast(P))
-  AdoptTemplateParameterList(TTP->getTemplateParameters(), Owner);
+  if (AdoptTemplateParameterList(TTP->getTemplateParameters(), Owner))
+Invalid = true;
+
+if (P->isInvalidDecl())
+  Invalid = true;
   }
+  return Invalid;
 }
 
 void TemplateParameterList::
@@ -339,14 +345,15 @@
 // FunctionTemplateDecl Implementation
 //===--===//
 
-FunctionTemplateDecl *FunctionTemplateDecl::Create(ASTContext ,
-   DeclContext *DC,
-   SourceLocation L,
-   DeclarationName Name,
-   TemplateParameterList *Params,
-   NamedDecl *Decl) {
-  AdoptTemplateParameterList(Params, cast(Decl));
-  return new (C, DC) FunctionTemplateDecl(C, DC, L, Name, Params, Decl);
+FunctionTemplateDecl *
+FunctionTemplateDecl::Create(ASTContext , DeclContext *DC, SourceLocation L,
+ DeclarationName Name,
+ TemplateParameterList *Params, NamedDecl *Decl) {
+  bool Invalid = AdoptTemplateParameterList(Params, cast(Decl));
+  auto *TD = new (C, DC) FunctionTemplateDecl(C, DC, L, Name, Params, Decl);
+  if (Invalid)
+TD->setInvalidDecl();
+  return TD;
 }
 
 FunctionTemplateDecl *FunctionTemplateDecl::CreateDeserialized(ASTContext ,
@@ -438,15 +445,16 @@
 // ClassTemplateDecl Implementation
 //===--===//
 
-ClassTemplateDecl *ClassTemplateDecl::Create(ASTContext ,
- DeclContext *DC,
+ClassTemplateDecl *ClassTemplateDecl::Create(ASTContext , DeclContext *DC,
  SourceLocation L,
  DeclarationName Name,
  TemplateParameterList *Params,
  NamedDecl *Decl) {
-  AdoptTemplateParameterList(Params, cast(Decl));
-
-  return new (C, DC) ClassTemplateDecl(C, DC, L, Name, Params, Decl);
+  bool Invalid = AdoptTemplateParameterList(Params, cast(Decl));
+  auto *TD = new (C, DC) ClassTemplateDecl(C, DC, L, Name, Params, Decl);
+  if (Invalid)
+TD->setInvalidDecl();
+  return TD;
 }
 
 ClassTemplateDecl *ClassTemplateDecl::CreateDeserialized(ASTContext ,
@@ -1005,8 +1013,11 @@
  SourceLocation L, DeclarationName Name,
  TemplateParameterList *Params,
  Expr *ConstraintExpr) {
-  AdoptTemplateParameterList(Params, DC);
-  return new (C, DC) ConceptDecl(DC, L, Name, Params, ConstraintExpr);
+  bool Invalid = AdoptTemplateParameterList(Params, DC);
+  auto *TD = new (C, DC) ConceptDecl(DC, L, Name, Params, ConstraintExpr);
+  if (Invalid)
+TD->setInvalidDecl();
+  return TD;
 }
 
 ConceptDecl *ConceptDecl::CreateDeserialized(ASTContext ,
@@ -1039,7 +1050,8 @@
   SpecializedTemplate, Args, PrevDecl),
   

[PATCH] D110460: [clang] set templates as invalid when any of the parameters are invalid

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

See PR51872 for the original repro.

This fixes a crash when converting a templated constructor into a deduction
guide, in case any of the template parameters were invalid.

Signed-off-by: Matheus Izvekov 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110460

Files:
  clang/lib/AST/DeclTemplate.cpp
  clang/test/SemaTemplate/deduction-crash.cpp

Index: clang/test/SemaTemplate/deduction-crash.cpp
===
--- clang/test/SemaTemplate/deduction-crash.cpp
+++ clang/test/SemaTemplate/deduction-crash.cpp
@@ -161,3 +161,13 @@
 }
 
 }
+
+namespace PR51872_part1 {
+  template class T1 { template  T1(); };
+  // expected-error@-1 {{non-type template parameter has incomplete type 'struct U1'}}
+  // expected-note@-2  {{forward declaration of 'PR51872_part1::U1'}}
+
+  T1 t1 = 0;
+  // expected-error@-1 {{no viable constructor or deduction guide for deduction of template arguments of 'T1'}}
+  // expected-note@-6  {{candidate template ignored: could not match 'T1<>' against 'int'}}
+}
Index: clang/lib/AST/DeclTemplate.cpp
===
--- clang/lib/AST/DeclTemplate.cpp
+++ clang/lib/AST/DeclTemplate.cpp
@@ -165,14 +165,20 @@
 return cast(FirstParm)->getDepth();
 }
 
-static void AdoptTemplateParameterList(TemplateParameterList *Params,
+static bool AdoptTemplateParameterList(TemplateParameterList *Params,
DeclContext *Owner) {
+  bool Invalid = false;
   for (NamedDecl *P : *Params) {
 P->setDeclContext(Owner);
 
 if (const auto *TTP = dyn_cast(P))
-  AdoptTemplateParameterList(TTP->getTemplateParameters(), Owner);
+  if (AdoptTemplateParameterList(TTP->getTemplateParameters(), Owner))
+Invalid = true;
+
+if (P->isInvalidDecl())
+  Invalid = true;
   }
+  return Invalid;
 }
 
 void TemplateParameterList::
@@ -339,14 +345,15 @@
 // FunctionTemplateDecl Implementation
 //===--===//
 
-FunctionTemplateDecl *FunctionTemplateDecl::Create(ASTContext ,
-   DeclContext *DC,
-   SourceLocation L,
-   DeclarationName Name,
-   TemplateParameterList *Params,
-   NamedDecl *Decl) {
-  AdoptTemplateParameterList(Params, cast(Decl));
-  return new (C, DC) FunctionTemplateDecl(C, DC, L, Name, Params, Decl);
+FunctionTemplateDecl *
+FunctionTemplateDecl::Create(ASTContext , DeclContext *DC, SourceLocation L,
+ DeclarationName Name,
+ TemplateParameterList *Params, NamedDecl *Decl) {
+  bool Invalid = AdoptTemplateParameterList(Params, cast(Decl));
+  auto *TD = new (C, DC) FunctionTemplateDecl(C, DC, L, Name, Params, Decl);
+  if (Invalid)
+TD->setInvalidDecl();
+  return TD;
 }
 
 FunctionTemplateDecl *FunctionTemplateDecl::CreateDeserialized(ASTContext ,
@@ -438,15 +445,16 @@
 // ClassTemplateDecl Implementation
 //===--===//
 
-ClassTemplateDecl *ClassTemplateDecl::Create(ASTContext ,
- DeclContext *DC,
+ClassTemplateDecl *ClassTemplateDecl::Create(ASTContext , DeclContext *DC,
  SourceLocation L,
  DeclarationName Name,
  TemplateParameterList *Params,
  NamedDecl *Decl) {
-  AdoptTemplateParameterList(Params, cast(Decl));
-
-  return new (C, DC) ClassTemplateDecl(C, DC, L, Name, Params, Decl);
+  bool Invalid = AdoptTemplateParameterList(Params, cast(Decl));
+  auto *TD = new (C, DC) ClassTemplateDecl(C, DC, L, Name, Params, Decl);
+  if (Invalid)
+TD->setInvalidDecl();
+  return TD;
 }
 
 ClassTemplateDecl *ClassTemplateDecl::CreateDeserialized(ASTContext ,
@@ -1005,8 +1013,11 @@
  SourceLocation L, DeclarationName Name,
  TemplateParameterList *Params,
  Expr *ConstraintExpr) {
-  AdoptTemplateParameterList(Params, DC);
-  return new (C, DC) ConceptDecl(DC, L, Name, Params, ConstraintExpr);
+  bool Invalid = AdoptTemplateParameterList(Params, DC);
+  auto *TD = new (C, DC) ConceptDecl(DC, L, Name, Params, ConstraintExpr);
+  if (Invalid)
+TD->setInvalidDecl();
+  return TD;
 }
 
 ConceptDecl *ConceptDecl::CreateDeserialized(ASTContext ,
@@ -1039,7 +1050,8 @@
   SpecializedTemplate, Args, 

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

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

In D110128#3021876 , @thakis wrote:

> Note that stage 2 fails, where we're supposed to use lld. So I think this is 
> probably some compiler-rt test config problem you need to sort out, and not a 
> fundamental problem with the patch.

It looks like the `LLVM_ENABLE_LLD` option doesn't affect compiler-rt tests.


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] D110463: [CMake] Pass through CMAKE_READELF to subbuilds

2021-09-24 Thread Petr Hosek 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 rGd893692024b8: [CMake] Pass through CMAKE_READELF to 
subbuilds (authored by phosek).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110463

Files:
  clang/CMakeLists.txt
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  llvm/cmake/modules/LLVMExternalProjectUtils.cmake


Index: llvm/cmake/modules/LLVMExternalProjectUtils.cmake
===
--- llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -244,7 +244,8 @@
   -DCMAKE_NM=${CMAKE_NM}
   -DCMAKE_OBJCOPY=${CMAKE_OBJCOPY}
   -DCMAKE_OBJDUMP=${CMAKE_OBJDUMP}
-  -DCMAKE_STRIP=${CMAKE_STRIP})
+  -DCMAKE_STRIP=${CMAKE_STRIP}
+  -DCMAKE_READELF=${CMAKE_READELF})
 set(llvm_config_path ${LLVM_CONFIG_PATH})
 
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -598,6 +598,7 @@
 CMAKE_OBJCOPY
 CMAKE_OBJDUMP
 CMAKE_STRIP
+CMAKE_READELF
 CMAKE_SYSROOT
 LIBCXX_HAS_MUSL_LIBC
 PYTHON_EXECUTABLE
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -759,6 +759,7 @@
   add_dependencies(clang-bootstrap-deps llvm-objcopy llvm-strip)
   set(${CLANG_STAGE}_OBJCOPY 
-DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy)
   set(${CLANG_STAGE}_STRIP 
-DCMAKE_STRIP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-strip)
+  set(${CLANG_STAGE}_READELF 
-DCMAKE_READELF=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-readelf)
 endif()
   endif()
 


Index: llvm/cmake/modules/LLVMExternalProjectUtils.cmake
===
--- llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -244,7 +244,8 @@
   -DCMAKE_NM=${CMAKE_NM}
   -DCMAKE_OBJCOPY=${CMAKE_OBJCOPY}
   -DCMAKE_OBJDUMP=${CMAKE_OBJDUMP}
-  -DCMAKE_STRIP=${CMAKE_STRIP})
+  -DCMAKE_STRIP=${CMAKE_STRIP}
+  -DCMAKE_READELF=${CMAKE_READELF})
 set(llvm_config_path ${LLVM_CONFIG_PATH})
 
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -598,6 +598,7 @@
 CMAKE_OBJCOPY
 CMAKE_OBJDUMP
 CMAKE_STRIP
+CMAKE_READELF
 CMAKE_SYSROOT
 LIBCXX_HAS_MUSL_LIBC
 PYTHON_EXECUTABLE
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -759,6 +759,7 @@
   add_dependencies(clang-bootstrap-deps llvm-objcopy llvm-strip)
   set(${CLANG_STAGE}_OBJCOPY -DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy)
   set(${CLANG_STAGE}_STRIP -DCMAKE_STRIP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-strip)
+  set(${CLANG_STAGE}_READELF -DCMAKE_READELF=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-readelf)
 endif()
   endif()
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] d893692 - [CMake] Pass through CMAKE_READELF to subbuilds

2021-09-24 Thread Petr Hosek via cfe-commits

Author: Petr Hosek
Date: 2021-09-24T18:20:30-07:00
New Revision: d893692024b8f05c63329f9a4e5f2432380be27c

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

LOG: [CMake] Pass through CMAKE_READELF to subbuilds

This matches handling of other CMake variables.

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

Added: 


Modified: 
clang/CMakeLists.txt
compiler-rt/cmake/Modules/AddCompilerRT.cmake
llvm/cmake/modules/LLVMExternalProjectUtils.cmake

Removed: 




diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 6e18e74c6294c..f562c73af3fef 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -759,6 +759,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
   add_dependencies(clang-bootstrap-deps llvm-objcopy llvm-strip)
   set(${CLANG_STAGE}_OBJCOPY 
-DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy)
   set(${CLANG_STAGE}_STRIP 
-DCMAKE_STRIP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-strip)
+  set(${CLANG_STAGE}_READELF 
-DCMAKE_READELF=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-readelf)
 endif()
   endif()
 

diff  --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 
b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index 97d898f394b9f..8b620786730b5 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -598,6 +598,7 @@ macro(add_custom_libcxx name prefix)
 CMAKE_OBJCOPY
 CMAKE_OBJDUMP
 CMAKE_STRIP
+CMAKE_READELF
 CMAKE_SYSROOT
 LIBCXX_HAS_MUSL_LIBC
 PYTHON_EXECUTABLE

diff  --git a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake 
b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
index 61f351c98ea44..5f19098614db7 100644
--- a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -244,7 +244,8 @@ function(llvm_ExternalProject_Add name source_dir)
   -DCMAKE_NM=${CMAKE_NM}
   -DCMAKE_OBJCOPY=${CMAKE_OBJCOPY}
   -DCMAKE_OBJDUMP=${CMAKE_OBJDUMP}
-  -DCMAKE_STRIP=${CMAKE_STRIP})
+  -DCMAKE_STRIP=${CMAKE_STRIP}
+  -DCMAKE_READELF=${CMAKE_READELF})
 set(llvm_config_path ${LLVM_CONFIG_PATH})
 
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")



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


[PATCH] D110463: [CMake] Pass through CMAKE_READELF to subbuilds

2021-09-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a reviewer: leonardchan.
Herald added a subscriber: mgorny.
phosek requested review of this revision.
Herald added projects: clang, Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers, cfe-commits.

This matches handling of other CMake variables.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110463

Files:
  clang/CMakeLists.txt
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  llvm/cmake/modules/LLVMExternalProjectUtils.cmake


Index: llvm/cmake/modules/LLVMExternalProjectUtils.cmake
===
--- llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -244,7 +244,8 @@
   -DCMAKE_NM=${CMAKE_NM}
   -DCMAKE_OBJCOPY=${CMAKE_OBJCOPY}
   -DCMAKE_OBJDUMP=${CMAKE_OBJDUMP}
-  -DCMAKE_STRIP=${CMAKE_STRIP})
+  -DCMAKE_STRIP=${CMAKE_STRIP}
+  -DCMAKE_READELF=${CMAKE_READELF})
 set(llvm_config_path ${LLVM_CONFIG_PATH})
 
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -598,6 +598,7 @@
 CMAKE_OBJCOPY
 CMAKE_OBJDUMP
 CMAKE_STRIP
+CMAKE_READELF
 CMAKE_SYSROOT
 LIBCXX_HAS_MUSL_LIBC
 PYTHON_EXECUTABLE
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -759,6 +759,7 @@
   add_dependencies(clang-bootstrap-deps llvm-objcopy llvm-strip)
   set(${CLANG_STAGE}_OBJCOPY 
-DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy)
   set(${CLANG_STAGE}_STRIP 
-DCMAKE_STRIP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-strip)
+  set(${CLANG_STAGE}_READELF 
-DCMAKE_READELF=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-readelf)
 endif()
   endif()
 


Index: llvm/cmake/modules/LLVMExternalProjectUtils.cmake
===
--- llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -244,7 +244,8 @@
   -DCMAKE_NM=${CMAKE_NM}
   -DCMAKE_OBJCOPY=${CMAKE_OBJCOPY}
   -DCMAKE_OBJDUMP=${CMAKE_OBJDUMP}
-  -DCMAKE_STRIP=${CMAKE_STRIP})
+  -DCMAKE_STRIP=${CMAKE_STRIP}
+  -DCMAKE_READELF=${CMAKE_READELF})
 set(llvm_config_path ${LLVM_CONFIG_PATH})
 
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -598,6 +598,7 @@
 CMAKE_OBJCOPY
 CMAKE_OBJDUMP
 CMAKE_STRIP
+CMAKE_READELF
 CMAKE_SYSROOT
 LIBCXX_HAS_MUSL_LIBC
 PYTHON_EXECUTABLE
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -759,6 +759,7 @@
   add_dependencies(clang-bootstrap-deps llvm-objcopy llvm-strip)
   set(${CLANG_STAGE}_OBJCOPY -DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy)
   set(${CLANG_STAGE}_STRIP -DCMAKE_STRIP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-strip)
+  set(${CLANG_STAGE}_READELF -DCMAKE_READELF=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-readelf)
 endif()
   endif()
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110458: [clang] Put original flags on 'Driver args:' crash report line

2021-09-24 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: hans.
thakis requested review of this revision.

We used to put the canonical spelling of flags after alias processing
on that line. For clang-cl in particular, that meant that we put flags
on that line that the clang-cl driver doesn't even accept, and the
"Driver args:" line wasn't usable.


https://reviews.llvm.org/D110458

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/crash-report-clang-cl.c


Index: clang/test/Driver/crash-report-clang-cl.c
===
--- /dev/null
+++ clang/test/Driver/crash-report-clang-cl.c
@@ -0,0 +1,24 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+
+// RUN: env TMPDIR=%t TEMP=%t TMP=%t RC_DEBUG_OPTIONS=1   \
+// RUN: not %clang_cl -fsyntax-only /Brepro /source-charset:utf-8 \
+// RUN: -- %s 2>&1 | FileCheck %s
+// RUN: cat %t/crash-report-*.sh | FileCheck --check-prefix=CHECKSH %s
+
+// REQUIRES: crash-recovery
+
+#pragma clang __debug crash
+
+// CHECK: Preprocessed source(s) and associated run script(s) are located at:
+// CHECK-NEXT: note: diagnostic msg: {{.*}}crash-report-clang-cl-{{.*}}.c
+// CHECKSH: # Crash reproducer
+// CHECKSH-NEXT: # Driver args: {{.*}}"-fsyntax-only"
+// CHECKSH-SAME: /Brepro
+// CHECKSH-SAME: /source-charset:utf-8
+// CHECKSH-NOT: -mno-incremental-linker-compatible
+// CHECKSH-NOT: -finput-charset=utf-8
+// CHECKSH-NEXT: # Original command: {{.*$}}
+// CHECKSH-NEXT: "-cc1"
+// CHECKSH: "-main-file-name" "crash-report-clang-cl.c"
+// CHECKSH: "crash-report-{{[^ ]*}}.c"
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1216,8 +1216,11 @@
 
 static void printArgList(raw_ostream , const llvm::opt::ArgList ) {
   llvm::opt::ArgStringList ASL;
-  for (const auto *A : Args)
+  for (const auto *A : Args) {
+while (A->getAlias())
+  A = A->getAlias();
 A->render(Args, ASL);
+  }
 
   for (auto I = ASL.begin(), E = ASL.end(); I != E; ++I) {
 if (I != ASL.begin())


Index: clang/test/Driver/crash-report-clang-cl.c
===
--- /dev/null
+++ clang/test/Driver/crash-report-clang-cl.c
@@ -0,0 +1,24 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+
+// RUN: env TMPDIR=%t TEMP=%t TMP=%t RC_DEBUG_OPTIONS=1   \
+// RUN: not %clang_cl -fsyntax-only /Brepro /source-charset:utf-8 \
+// RUN: -- %s 2>&1 | FileCheck %s
+// RUN: cat %t/crash-report-*.sh | FileCheck --check-prefix=CHECKSH %s
+
+// REQUIRES: crash-recovery
+
+#pragma clang __debug crash
+
+// CHECK: Preprocessed source(s) and associated run script(s) are located at:
+// CHECK-NEXT: note: diagnostic msg: {{.*}}crash-report-clang-cl-{{.*}}.c
+// CHECKSH: # Crash reproducer
+// CHECKSH-NEXT: # Driver args: {{.*}}"-fsyntax-only"
+// CHECKSH-SAME: /Brepro
+// CHECKSH-SAME: /source-charset:utf-8
+// CHECKSH-NOT: -mno-incremental-linker-compatible
+// CHECKSH-NOT: -finput-charset=utf-8
+// CHECKSH-NEXT: # Original command: {{.*$}}
+// CHECKSH-NEXT: "-cc1"
+// CHECKSH: "-main-file-name" "crash-report-clang-cl.c"
+// CHECKSH: "crash-report-{{[^ ]*}}.c"
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1216,8 +1216,11 @@
 
 static void printArgList(raw_ostream , const llvm::opt::ArgList ) {
   llvm::opt::ArgStringList ASL;
-  for (const auto *A : Args)
+  for (const auto *A : Args) {
+while (A->getAlias())
+  A = A->getAlias();
 A->render(Args, ASL);
+  }
 
   for (auto I = ASL.begin(), E = ASL.end(); I != E; ++I) {
 if (I != ASL.begin())
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109652: [PowerPC] Restrict various P10 options to P10 only.

2021-09-24 Thread Amy Kwan via Phabricator via cfe-commits
amyk updated this revision to Diff 374990.
amyk edited the summary of this revision.
amyk added a comment.

Addressed Lei's review comments to output:

  error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'

when PC-Rel is specified pre-P10.

Also updated the comment for MMA on pre-P10 so it makes more sense and is more 
consistent with the comments I've added.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109652

Files:
  clang/lib/Basic/Targets/PPC.cpp
  clang/test/Driver/ppc-p10-features-support-check.c

Index: clang/test/Driver/ppc-p10-features-support-check.c
===
--- /dev/null
+++ clang/test/Driver/ppc-p10-features-support-check.c
@@ -0,0 +1,101 @@
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm  \
+// RUN:   -mcpu=pwr10 -mpaired-vector-memops %s -o - | FileCheck %s \
+// RUN:   --check-prefix=HASPAIRED
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm  \
+// RUN:   -mcpu=power10 -mpaired-vector-memops %s -o - | FileCheck %s \
+// RUN:   --check-prefix=HASPAIRED
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr9 -mpaired-vector-memops %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPAIRED
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr8 -mpaired-vector-memops %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPAIRED
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr7 -mpaired-vector-memops %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPAIRED
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mpaired-vector-memops %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPAIRED
+
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm  \
+// RUN:   -mcpu=pwr10 -mprefixed %s -o - | FileCheck %s \
+// RUN:   --check-prefix=HASPREFIXED
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm  \
+// RUN:   -mcpu=power10 -mprefixed %s -o - | FileCheck %s \
+// RUN:   --check-prefix=HASPREFIXED
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr9 -mprefixed %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPREFIXED
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr8 -mprefixed %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPREFIXED
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr7 -mprefixed %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPREFIXED
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mprefixed %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPREFIXED
+
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm  \
+// RUN:   -mcpu=pwr10 -mpcrel %s -o - | FileCheck %s \
+// RUN:   --check-prefix=HASPCREL
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm  \
+// RUN:   -mcpu=power10 -mpcrel %s -o - | FileCheck %s \
+// RUN:   --check-prefix=HASPCREL
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr9 -mpcrel %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPCREL
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr8 -mpcrel %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPCREL
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr7 -mpcrel %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPCREL
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mpcrel %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPCREL
+
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm  \
+// RUN:   -mcpu=pwr10 -mpcrel -mprefixed %s -o - | FileCheck %s \
+// RUN:   --check-prefix=HASPCREL-PREFIX
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm  \
+// RUN:   -mcpu=power10 -mpcrel -mprefixed %s -o - | FileCheck %s \
+// RUN:   --check-prefix=HASPCREL-PREFIX
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr9 -mpcrel -mprefixed %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPCREL-PREFIX
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr8 -mpcrel -mprefixed %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPCREL-PREFIX
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mcpu=pwr7 -mpcrel -mprefixed %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPCREL-PREFIX
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \
+// RUN:   -mpcrel -mprefixed %s 2>&1 | FileCheck %s \
+// RUN:   --check-prefix=NOPCREL-PREFIX
+
+int test_p10_features() {
+  return 0;
+}
+

[PATCH] D110455: DebugInfo: Use clang's preferred names for integer types

2021-09-24 Thread David Blaikie via Phabricator via cfe-commits
dblaikie created this revision.
dblaikie added reviewers: probinson, aprantl.
dblaikie requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This reverts c7f16ab3e3f27d944db72908c9c1b1b7366f5515 / r109694 - which
suggested this was done to improve consistency with the gdb test suite.
Possible that at the time GCC did not canonicalize integer types, and so
matching types was important for cross-compiler validity, or that it was
only a case of over-constrained test cases that printed out/tested the
exact names of integer types.

In any case neither issue seems to exist today based on my limited
testing - both gdb and lldb canonicalize integer types (in a way that
happens to match Clang's preferred naming, incidentally) and so never
print the original text name produced in the DWARF by GCC or Clang.

This canonicalization appears to be in `integer_types_same_name_p` for
GDB and in `TypeSystemClang::GetBasicTypeEnumeration` for lldb.

(I tested this with one translation unit defining 3 variables - `long`,
`long (*)()`, and `int (*)()`, and another translation unit that had
main, and a function that took `long (*)()` as a parameter - then
compiled them with mismatched compilers (either GCC+Clang, or
Clang+(Clang with this patch applied)) and no matter the combination,
despite the debug info for one CU naming the type "long int" and the
other naming it "long", both debuggers printed out the name as "long"
and were able to correctly perform overload resolution and pass the
`long int (*)()` variable to the `long (*)()` function parameter)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110455

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/aarch64-debug-sve-vector-types.c
  clang/test/CodeGen/aarch64-debug-sve-vectorx2-types.c
  clang/test/CodeGen/aarch64-debug-sve-vectorx3-types.c
  clang/test/CodeGen/aarch64-debug-sve-vectorx4-types.c
  clang/test/CodeGen/debug-info-enum.cpp
  clang/test/CodeGen/debug-info.c

Index: clang/test/CodeGen/debug-info.c
===
--- clang/test/CodeGen/debug-info.c
+++ clang/test/CodeGen/debug-info.c
@@ -58,3 +58,8 @@
 typedef unsigned long long uint64_t;
 typedef uint64_t uint64x2_t __attribute__((ext_vector_type(2)));
 uint64x2_t extvectbar[4];
+
+// CHECK-DAG: !DIBasicType(name: "long"
+// CHECK-DAG: !DIBasicType(name: "unsigned long long"
+void integral_types(long x, unsigned long long y) {
+}
Index: clang/test/CodeGen/debug-info-enum.cpp
===
--- clang/test/CodeGen/debug-info-enum.cpp
+++ clang/test/CodeGen/debug-info-enum.cpp
@@ -77,7 +77,7 @@
 // CHECK-SAME: baseType: ![[LONG:[0-9]+]]
 // CHECK-SAME: DIFlagEnumClass
 // CHECK-SAME: elements: ![[ELTS6:[0-9]+]]
-// CHECK: ![[LONG]] = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed)
+// CHECK: ![[LONG]] = !DIBasicType(name: "long long", size: 64, encoding: DW_ATE_signed)
 // CHECK: ![[ELTS6]] = !{![[A6:[0-9]+]], ![[B6:[0-9]+]]}
 // CHECK: ![[A6]] = !DIEnumerator(name: "A6", value: -9223372036854775808)
 // CHECK: ![[B6]] = !DIEnumerator(name: "B6", value: 9223372036854775807)
@@ -87,7 +87,7 @@
 // CHECK-SAME: baseType: ![[ULONG:[0-9]+]]
 // CHECK-SAME: DIFlagEnumClass
 // CHECK-SAME: elements: ![[ELTS7:[0-9]+]]
-// CHECK: ![[ULONG]] = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned)
+// CHECK: ![[ULONG]] = !DIBasicType(name: "unsigned long long", size: 64, encoding: DW_ATE_unsigned)
 // CHECK: ![[ELTS7]] = !{![[A7:[0-9]+]]}
 // CHECK: ![[A7]] = !DIEnumerator(name: "A7", value: 18446744073709551615, isUnsigned: true)
 
Index: clang/test/CodeGen/aarch64-debug-sve-vectorx4-types.c
===
--- clang/test/CodeGen/aarch64-debug-sve-vectorx4-types.c
+++ clang/test/CodeGen/aarch64-debug-sve-vectorx4-types.c
@@ -40,14 +40,14 @@
 
   // CHECK-DAG: name: "__clang_svint64x4_t",{{.*}}, baseType: ![[CT64:[0-9]+]]
   // CHECK-DAG: ![[CT64]] = !DICompositeType(tag: DW_TAG_array_type, baseType: ![[ELTTY64:[0-9]+]], flags: DIFlagVector, elements: ![[ELTS1x4_64:[0-9]+]])
-  // CHECK-DAG: ![[ELTTY64]] = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
+  // CHECK-DAG: ![[ELTTY64]] = !DIBasicType(name: "long", size: 64, encoding: DW_ATE_signed)
   // CHECK-DAG: ![[ELTS1x4_64]] = !{![[REALELTS1x4_64:[0-9]+]]}
   // CHECK-DAG: ![[REALELTS1x4_64]] = !DISubrange(lowerBound: 0, upperBound: !DIExpression(DW_OP_constu, 4, DW_OP_bregx, 46, 0, DW_OP_mul, DW_OP_constu, 1, DW_OP_minus))
   __clang_svint64x4_t s64;
 
   // CHECK-DAG: name: "__clang_svuint64x4_t",{{.*}}, baseType: ![[CT64:[0-9]+]]
   // CHECK-DAG: ![[CT64]] = !DICompositeType(tag: DW_TAG_array_type, baseType: ![[ELTTY64:[0-9]+]], flags: DIFlagVector, elements: ![[ELTS1x4_64]])
-  // CHECK-DAG: ![[ELTTY64]] = !DIBasicType(name: "long unsigned int", size: 64, 

[PATCH] D109625: [compiler-rt] Ensure required deps for tests targets are actually built

2021-09-24 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment.

Updated to exclude readelf. We also don't need any of the other tools added in 
the `NOT COMPILER_RT_STANDALONE_BUILD` case, so I just added them to 
`LIT_ONLY_TOOLS` in the `COMPILER_RT_STANDALONE_BUILD` case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109625

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


[PATCH] D109625: [compiler-rt] Ensure required deps for tests targets are actually built

2021-09-24 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 374984.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109625

Files:
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  compiler-rt/test/CMakeLists.txt


Index: compiler-rt/test/CMakeLists.txt
===
--- compiler-rt/test/CMakeLists.txt
+++ compiler-rt/test/CMakeLists.txt
@@ -1,5 +1,6 @@
 # Needed for lit support in standalone builds.
 include(AddLLVM)
+include(LLVMExternalProjectUtils)
 
 option(COMPILER_RT_TEST_STANDALONE_BUILD_LIBS
   "When set to ON and testing in a standalone build, test the runtime \
@@ -36,6 +37,21 @@
 if (WIN32)
   list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)
 endif()
+  elseif(COMPILER_RT_STANDALONE_BUILD)
+# These are tools needed for testing in a standalone/runtimes build, but we
+# don't have a corresponding CMAKE_* flag for. These will need to be 
rebuilt.
+set(LIT_ONLY_TOOLS FileCheck count not clang-resource-headers)
+foreach(dep ${LIT_ONLY_TOOLS})
+  if (NOT TARGET ${dep})
+llvm_ExternalProject_BuildCmd(build_${dep} ${dep} ${BINARY_DIR})
+add_custom_target(${dep}
+  COMMAND ${build_${dep}}
+  WORKING_DIRECTORY ${BINARY_DIR}
+  VERBATIM USES_TERMINAL)
+  endif()
+endforeach()
+
+list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS ${LIT_ONLY_TOOLS})
   endif()
   # Tests use C++ standard library headers.
   if (TARGET cxx-headers OR HAVE_LIBCXX)
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -598,6 +598,7 @@
 CMAKE_OBJCOPY
 CMAKE_OBJDUMP
 CMAKE_STRIP
+CMAKE_READELF
 CMAKE_SYSROOT
 LIBCXX_HAS_MUSL_LIBC
 PYTHON_EXECUTABLE


Index: compiler-rt/test/CMakeLists.txt
===
--- compiler-rt/test/CMakeLists.txt
+++ compiler-rt/test/CMakeLists.txt
@@ -1,5 +1,6 @@
 # Needed for lit support in standalone builds.
 include(AddLLVM)
+include(LLVMExternalProjectUtils)
 
 option(COMPILER_RT_TEST_STANDALONE_BUILD_LIBS
   "When set to ON and testing in a standalone build, test the runtime \
@@ -36,6 +37,21 @@
 if (WIN32)
   list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)
 endif()
+  elseif(COMPILER_RT_STANDALONE_BUILD)
+# These are tools needed for testing in a standalone/runtimes build, but we
+# don't have a corresponding CMAKE_* flag for. These will need to be rebuilt.
+set(LIT_ONLY_TOOLS FileCheck count not clang-resource-headers)
+foreach(dep ${LIT_ONLY_TOOLS})
+  if (NOT TARGET ${dep})
+llvm_ExternalProject_BuildCmd(build_${dep} ${dep} ${BINARY_DIR})
+add_custom_target(${dep}
+  COMMAND ${build_${dep}}
+  WORKING_DIRECTORY ${BINARY_DIR}
+  VERBATIM USES_TERMINAL)
+  endif()
+endforeach()
+
+list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS ${LIT_ONLY_TOOLS})
   endif()
   # Tests use C++ standard library headers.
   if (TARGET cxx-headers OR HAVE_LIBCXX)
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -598,6 +598,7 @@
 CMAKE_OBJCOPY
 CMAKE_OBJDUMP
 CMAKE_STRIP
+CMAKE_READELF
 CMAKE_SYSROOT
 LIBCXX_HAS_MUSL_LIBC
 PYTHON_EXECUTABLE
___
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-24 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

In D110089#3021652 , @jlebar wrote:

> Okay, I give up on the phab interface.  It's unreadable with all the existing
> comments and lint errors.

Yeah. Phabricator experience is not great.

> +// Put all functions into anonymous namespace so they have internal linkage.
>
> Say a little more?  Specifically, you want anon ns because this is device code
> and it has to work even without being linked.
>
> (Also, are you sure that plain `inline` doesn't do the right thing?  Like, we
> have lots of CUDA headers that are `inline`'ed without all being in an anon
> ns.)

We do want inlining, but the main purpose here is to avoid potential ODR for 
use with -fgpu-rdc where multiple TUs may be compiled with different versions 
of this header. Because the hash may change, we could end up with thesame Tag 
types (and fetch functions) with the same names meaning different things for 
different TUs.

> +// NOTE: the perfect hashing scheme comes with inherent self-test. If the 
> hash
> +// function has a collision for any of the texture operations, the 
> compilation
> +// will fail due to an attempt to redefine a tag with the same value. If the
> +// header compiles, then the hash function is good enough for the job.
>
> I guess if it has a self-test then that's fine.  Though is this really better
> than a series of `if` statements with strcmp?

Yes, I think somewhat obfuscated metaprogramming here wins on points, IMO.

- it's fairly well-structured, even if macros make it a bit of a pain to dig 
through.
- assumptions about the perfect hash are minimal -- it's just a 1:1 
string->integer map. If that assumption is violated we're guaranteed to get a 
compilation error when we instantiate the templates that map to the same value. 
I did test that by changing the hash function.
- strcmp() will result in 100+ comparisons. That alone will be a pain to write 
manually. In my experience, having more than a handful of nearly-identical, but 
critically different chunks of code makes the whole thing very error-prone. 
I've tried that early on before I've figured out how to parameterize templates 
by a string.
- We'll also need to use it in a function template, so the code will get 
replicated over all the instances of the signatures we'll need to impement. 
While it's probably no a showstopper, it's still additional IR we'd have to 
deal with. Adding incremental burden on all CUDA users is worse than additional 
mental burden on whoever may need to read this code (most likely me).

> I guess I am scared of this kind of thing because I did it once in ccache.  I 
> thought I was very clever and got
> a good speedup.  1 year later I found out I'd broken handling of __DATE__ and 
> __TIME__.  o.O

Being wary of making an easy-to-miss errors here, I literally did exhaustive 
testing of all variants (2972 of them) of high-level API calls provided by 
NVIDIA headers  and verified that we do end up generating identical 
instructions and their parameters.
I will add that test in the test-suite as it needs actual CUDA headers.

In D110089#3021659 , @jlebar wrote:

> Presumably as a separate commit we should add tests to the test_suite 
> repository to ensure that this at least still compiles with different 
> versions of CUDA?

That's the plan.  I've tested thhe patch manually down to CUDA-9. It will not 
work with CUDA-8 or older as they have completely different under-the hood 
implementation in CUDA headers. I'll add an include guard for the old CUDA 
versions.


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] D110452: [modules] Fix tracking ObjCInterfaceType decl when there are multiple definitions.

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

This is a clean-up before https://reviews.llvm.org/D110453




Comment at: clang/lib/AST/DeclObjC.cpp:608
-  // Make the type point at the definition, now that we have one.
-  if (TypeForDecl)
-cast(TypeForDecl)->Decl = this;

Tracking a type per decl is complementary to tracking decl per type and it 
looks potentially bug-prone. But I haven't noticed any problems with it and 
haven't tried to remove `TypeForDecl`. If anybody has any extra information on 
it, we can schedule subsequent fixes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110452

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


[PATCH] D110453: [modules] Update visibility for merged ObjCInterfaceDecl definitions.

2021-09-24 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai created this revision.
vsapsai added reviewers: bruno, bnbarham.
Herald added a subscriber: ributzka.
vsapsai requested review of this revision.
Herald added a project: clang.

We keep using the first encountered definition and need to take into
account visibility from subsequent definitions. For example, if the
first definition is hidden and the second is visible, we need to make
the first one visible too.

rdar://82263843


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110453

Files:
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/test/Modules/merge-objc-interface-visibility.m


Index: clang/test/Modules/merge-objc-interface-visibility.m
===
--- /dev/null
+++ clang/test/Modules/merge-objc-interface-visibility.m
@@ -0,0 +1,61 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m 
-DHIDDEN_FIRST=1 \
+// RUN:-fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t/modules.cache
+// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m 
-DHIDDEN_FIRST=0 \
+// RUN:-fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t/modules.cache
+
+// Test a case when Objective-C interface is imported both as hidden and as 
visible.
+
+//--- Frameworks/Foundation.framework/Headers/Foundation.h
+@interface NSObject
+@end
+
+//--- Frameworks/Foundation.framework/Modules/module.modulemap
+framework module Foundation {
+  header "Foundation.h"
+  export *
+}
+
+//--- Frameworks/Regular.framework/Headers/Regular.h
+#import 
+@interface Regular : NSObject
+@end
+
+//--- Frameworks/Regular.framework/Modules/module.modulemap
+framework module Regular {
+  header "Regular.h"
+  export *
+}
+
+//--- Frameworks/RegularHider.framework/Headers/Visible.h
+// Empty, file required to create a module.
+
+//--- Frameworks/RegularHider.framework/Headers/Hidden.h
+#import 
+@interface Regular : NSObject
+@end
+
+//--- Frameworks/RegularHider.framework/Modules/module.modulemap
+framework module RegularHider {
+  header "Visible.h"
+  export *
+
+  explicit module Hidden {
+header "Hidden.h"
+export *
+  }
+}
+
+//--- test.m
+
+#if HIDDEN_FIRST
+#import 
+#import 
+#else
+#import 
+#import 
+#endif
+
+@interface SubClass : Regular
+@end
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1181,6 +1181,7 @@
   if (DD.Definition != NewDD.Definition) {
 Reader.MergedDeclContexts.insert(
 std::make_pair(NewDD.Definition, DD.Definition));
+Reader.mergeDefinitionVisibility(DD.Definition, NewDD.Definition);
   }
 
   // FIXME: odr checking?


Index: clang/test/Modules/merge-objc-interface-visibility.m
===
--- /dev/null
+++ clang/test/Modules/merge-objc-interface-visibility.m
@@ -0,0 +1,61 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m -DHIDDEN_FIRST=1 \
+// RUN:-fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache
+// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m -DHIDDEN_FIRST=0 \
+// RUN:-fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache
+
+// Test a case when Objective-C interface is imported both as hidden and as visible.
+
+//--- Frameworks/Foundation.framework/Headers/Foundation.h
+@interface NSObject
+@end
+
+//--- Frameworks/Foundation.framework/Modules/module.modulemap
+framework module Foundation {
+  header "Foundation.h"
+  export *
+}
+
+//--- Frameworks/Regular.framework/Headers/Regular.h
+#import 
+@interface Regular : NSObject
+@end
+
+//--- Frameworks/Regular.framework/Modules/module.modulemap
+framework module Regular {
+  header "Regular.h"
+  export *
+}
+
+//--- Frameworks/RegularHider.framework/Headers/Visible.h
+// Empty, file required to create a module.
+
+//--- Frameworks/RegularHider.framework/Headers/Hidden.h
+#import 
+@interface Regular : NSObject
+@end
+
+//--- Frameworks/RegularHider.framework/Modules/module.modulemap
+framework module RegularHider {
+  header "Visible.h"
+  export *
+
+  explicit module Hidden {
+header "Hidden.h"
+export *
+  }
+}
+
+//--- test.m
+
+#if HIDDEN_FIRST
+#import 
+#import 
+#else
+#import 
+#import 
+#endif
+
+@interface SubClass : Regular
+@end
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1181,6 +1181,7 @@
   if (DD.Definition != NewDD.Definition) {
 Reader.MergedDeclContexts.insert(
 std::make_pair(NewDD.Definition, DD.Definition));
+Reader.mergeDefinitionVisibility(DD.Definition, NewDD.Definition);
   }
 

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

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

More comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110089

Files:
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/__clang_cuda_runtime_wrapper.h
  clang/lib/Headers/__clang_cuda_texture_intrinsics.h
  clang/test/Headers/Inputs/include/cuda.h
  clang/test/Headers/Inputs/include/texture_fetch_functions.h
  clang/test/Headers/texture_intrinsics.cu

Index: clang/test/Headers/texture_intrinsics.cu
===
--- /dev/null
+++ clang/test/Headers/texture_intrinsics.cu
@@ -0,0 +1,13 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: nvptx-registered-target
+//
+// RUN: %clang -std=c++11 -fsyntax-only -target x86_64-linux -nocudainc -nocudalib --cuda-gpu-arch=sm_86 --cuda-device-only -S %s
+// RUN: %clang -std=c++11 -fsyntax-only -target x86_64-linux -nocudainc -nocudalib --cuda-gpu-arch=sm_86 --cuda-host-only -S %s
+
+// Define bare minimum required for parsing the header file.
+#include "Inputs/include/cuda.h"
+
+// The header file is expected to compile w/o errors.  This ensures that texture
+// ID hash has no collisions for known texture operations, otherwise the
+// compilation would fail with an attempt to redefine a type.
+#include <__clang_cuda_texture_intrinsics.h>
Index: clang/test/Headers/Inputs/include/texture_fetch_functions.h
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/texture_fetch_functions.h
@@ -0,0 +1,2 @@
+// required for __clang_cuda_runtime_wrapper.h tests
+#pragma once
Index: clang/test/Headers/Inputs/include/cuda.h
===
--- clang/test/Headers/Inputs/include/cuda.h
+++ clang/test/Headers/Inputs/include/cuda.h
@@ -85,7 +85,6 @@
   __host__ __device__ uint4(unsigned x = 0, unsigned y = 0, unsigned z = 0, unsigned w = 0) : x(x), y(y), z(z), w(w) {}
 };
 
-
 struct longlong2 {
   long long x, y;
   __host__ __device__ longlong2(long long x = 0, long long y = 0) : x(x), y(y) {}
@@ -104,7 +103,6 @@
   __host__ __device__ ulonglong4(unsigned long long x = 0, unsigned long long y = 0, unsigned long long z = 0, unsigned long long w = 0) : x(x), y(y), z(z), w(w) {}
 };
 
-
 struct float2 {
   float x, y;
   __host__ __device__ float2(float x = 0, float y = 0) : x(x), y(y) {}
@@ -123,5 +121,27 @@
   __host__ __device__ double4(double x = 0, double y = 0, double z = 0, double w = 0) : x(x), y(y), z(z), w(w) {}
 };
 
+typedef unsigned long long cudaTextureObject_t;
+
+enum cudaTextureReadMode {
+  cudaReadModeNormalizedFloat,
+  cudaReadModeElementType
+};
+
+enum {
+  cudaTextureType1D,
+  cudaTextureType2D,
+  cudaTextureType3D,
+  cudaTextureTypeCubemap,
+  cudaTextureType1DLayered,
+  cudaTextureType2DLayered,
+  cudaTextureTypeCubemapLayered
+};
+
+struct textureReference {};
+template 
+struct __attribute__((device_builtin_texture_type)) texture
+: public textureReference {};
 
 #endif // !__NVCC__
Index: clang/lib/Headers/__clang_cuda_texture_intrinsics.h
===
--- /dev/null
+++ clang/lib/Headers/__clang_cuda_texture_intrinsics.h
@@ -0,0 +1,745 @@
+/*===--- __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
+ *
+ *===---===
+ *
+ * This header provides in-header implmentations for NVCC's built-in
+ * __nv_tex_surf_handler() which is used by CUDA's texture-related headers.  The
+ * built-in is unusual as it's actually a set of function overloads that use the
+ * first string literal argument as one of the overload parameters. We can not
+ * implement is directly with C++. Instead, we convert the string literal into a
+ * numberic value and use that to parametrize the implementations.
+ */
+#ifndef __CLANG_CUDA_TEXTURE_INTRINSICS_H__
+#define __CLANG_CUDA_TEXTURE_INTRINSICS_H__
+#ifndef __CUDA__
+#error "This file is for CUDA compilation only."
+#endif
+
+#include 
+
+// __nv_tex_surf_handler() provided by this header as a macro.
+#define __nv_tex_surf_handler(__op, __ptr, ...)\
+  ::__cuda_tex::__tex_fetch<   \
+  ::__cuda_tex::__Tag<::__cuda_tex::__tex_op_hash(__op)>>(__ptr,   \
+  __VA_ARGS__)
+
+#pragma push_macro("__ASM_OUT")
+#pragma push_macro("__ASM_OUTP")
+#pragma push_macro("__Args")
+#pragma push_macro("__ID")
+#pragma push_macro("__IDV")
+#pragma push_macro("__IMPL_2DGATHER")
+#pragma push_macro("__IMPL_ALIAS")
+#pragma 

[PATCH] D110452: [modules] Fix tracking ObjCInterfaceType decl when there are multiple definitions.

2021-09-24 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai created this revision.
vsapsai added reviewers: bruno, rsmith, arphaman.
Herald added a subscriber: ributzka.
vsapsai requested review of this revision.
Herald added a project: clang.

With the old approach we were updating `ObjCInterfaceType.Decl` to the
last encountered definition. But during loading modules
`ASTDeclReader::VisitObjCInterfaceDecl` keeps the *first* encountered
definition. So with multiple definitions imported there would be a
disagreement between expected definition in `ObjCInterfaceType.Decl` and
actual definition `ObjCInterfaceDecl::getDefinition` which can lead to
incorrect diagnostic.

Fix by not tracking definition in `ObjCInterfaceType` explicitly but by
getting it from redeclaration chain.

Partially reverted 919fc50034b44c48aae8b80283f253ec2ee17f45 keeping the
modified test case as the correct behavior is achieved in a different
way.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110452

Files:
  clang/include/clang/AST/Type.h
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/test/Modules/decldef.mm
  clang/test/Modules/interface-diagnose-missing-import.m

Index: clang/test/Modules/interface-diagnose-missing-import.m
===
--- clang/test/Modules/interface-diagnose-missing-import.m
+++ clang/test/Modules/interface-diagnose-missing-import.m
@@ -1,11 +1,11 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 %s -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F%S/Inputs/interface-diagnose-missing-import -verify
+// expected-no-diagnostics
 @interface Buggy
 @end
 
 @import Foo.Bar;
 
-@interface Buggy (MyExt) // expected-error {{definition of 'Buggy' must be imported from module 'Foo' before it is required}}
+// No diagnostic for inaccessible 'Buggy' definition because we have another definition right in this file.
+@interface Buggy (MyExt)
 @end
-
-// expected-note@Foo/RandoPriv.h:3{{definition here is not reachable}}
Index: clang/test/Modules/decldef.mm
===
--- clang/test/Modules/decldef.mm
+++ clang/test/Modules/decldef.mm
@@ -1,10 +1,12 @@
 // RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_1 -DUSE_2 -DUSE_3 -DUSE_4
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_2 -DUSE_3 -DUSE_4
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_3 -DUSE_4
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_4
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_1 -DUSE_2 -DUSE_3 -DUSE_4 -DUSE_5
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_2 -DUSE_3 -DUSE_4 -DUSE_5
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_3 -DUSE_4 -DUSE_5
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_4 -DUSE_5
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_5
 
 // expected-note@Inputs/def.h:5 0-1{{here}}
+// expected-note@Inputs/def.h:11 0-1{{here}}
 // expected-note@Inputs/def.h:16 0-1{{here}}
 // expected-note@Inputs/def-include.h:11 0-1{{here}}
 
@@ -51,11 +53,17 @@
 }
 
 void testDef() {
+#ifdef USE_4
   [def defMethod];
+  #ifndef USED
+  // expected-error@-2{{definition of 'Def' must be imported from module 'decldef.Def' before it is required}}
+  #define USED
+  #endif
+#endif
 }
 
 void testDef2() {
-#ifdef USE_4
+#ifdef USE_5
   def2->func();
   def3->func();
   #ifndef USED
Index: clang/lib/Sema/SemaLookup.cpp
===
--- clang/lib/Sema/SemaLookup.cpp
+++ clang/lib/Sema/SemaLookup.cpp
@@ -5326,11 +5326,8 @@
 return FD->getDefinition();
   if (TagDecl *TD = dyn_cast(D))
 return TD->getDefinition();
-  // The first definition for this ObjCInterfaceDecl might be in the TU
-  // and not associated with any module. Use the one we know to be complete
-  // and have just seen in a module.
   if (ObjCInterfaceDecl *ID = dyn_cast(D))
-return ID;
+return ID->getDefinition();
   if (ObjCProtocolDecl *PD = dyn_cast(D))
 return PD->getDefinition();
   if (TemplateDecl *TD = dyn_cast(D))
Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -821,6 +821,13 @@
/*isKindOf=*/false);
 }
 
+ObjCInterfaceDecl *ObjCInterfaceType::getDecl() const {
+  ObjCInterfaceDecl *Canon = 

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

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

Re-reverted for now in 6ece82e9006d16b7fba7660ce09b2c62ab8460fa 
.


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


[clang] 6ece82e - Revert "[Driver] Correctly handle static C++ standard library"

2021-09-24 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2021-09-24T18:44:53-04:00
New Revision: 6ece82e9006d16b7fba7660ce09b2c62ab8460fa

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

LOG: Revert "[Driver] Correctly handle static C++ standard library"

This reverts commit 03142c5f67788bcc1573f76732d0fccd75c6b965.
Breaks check-asan if system ld doesn't support --push-state, even
if lld was built and is used according to lit's output.
See comments on https://reviews.llvm.org/D110128

Added: 


Modified: 
clang/lib/Driver/ToolChains/Fuchsia.cpp
clang/lib/Driver/ToolChains/Gnu.cpp
clang/test/Driver/fuchsia.cpp
clang/test/Driver/linux-ld.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp 
b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index fe865229f5bbe..13db5a073 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -138,13 +138,14 @@ void fuchsia::Linker::ConstructJob(Compilation , const 
JobAction ,
 bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) 
&&
!Args.hasArg(options::OPT_static);
 CmdArgs.push_back("--push-state");
+CmdArgs.push_back("--as-needed");
 if (OnlyLibstdcxxStatic)
   CmdArgs.push_back("-Bstatic");
-else
-  CmdArgs.push_back("--as-needed");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-CmdArgs.push_back("--pop-state");
+if (OnlyLibstdcxxStatic)
+  CmdArgs.push_back("-Bdynamic");
 CmdArgs.push_back("-lm");
+CmdArgs.push_back("--pop-state");
   }
 }
 

diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 82262e58a446a..9aca45312bb0a 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -577,13 +577,11 @@ void tools::gnutools::Linker::ConstructJob(Compilation 
, const JobAction ,
 if (ToolChain.ShouldLinkCXXStdlib(Args)) {
   bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
  !Args.hasArg(options::OPT_static);
-  if (OnlyLibstdcxxStatic) {
-CmdArgs.push_back("--push-state");
+  if (OnlyLibstdcxxStatic)
 CmdArgs.push_back("-Bstatic");
-  }
   ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
   if (OnlyLibstdcxxStatic)
-CmdArgs.push_back("--pop-state");
+CmdArgs.push_back("-Bdynamic");
 }
 CmdArgs.push_back("-lm");
   }

diff  --git a/clang/test/Driver/fuchsia.cpp b/clang/test/Driver/fuchsia.cpp
index 2165f7e4f15e6..bd4c7ebeb5601 100644
--- a/clang/test/Driver/fuchsia.cpp
+++ b/clang/test/Driver/fuchsia.cpp
@@ -37,8 +37,8 @@
 // CHECK: "--push-state"
 // CHECK: "--as-needed"
 // CHECK: "-lc++"
-// CHECK: "--pop-state"
 // CHECK: "-lm"
+// CHECK: "--pop-state"
 // CHECK-X86_64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}x86_64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
 // CHECK-AARCH64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aarch64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
 // CHECK-RISCV64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}riscv64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
@@ -55,10 +55,12 @@
 // RUN: -fuse-ld=lld 2>&1 \
 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
 // CHECK-STATIC: "--push-state"
+// CHECK-STATIC: "--as-needed"
 // CHECK-STATIC: "-Bstatic"
 // CHECK-STATIC: "-lc++"
-// CHECK-STATIC: "--pop-state"
+// CHECK-STATIC: "-Bdynamic"
 // CHECK-STATIC: "-lm"
+// CHECK-STATIC: "--pop-state"
 // CHECK-STATIC: "-lc"
 
 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -nostdlib++ 
-fuse-ld=lld 2>&1 \

diff  --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
index 87be241726710..cc505588331bb 100644
--- a/clang/test/Driver/linux-ld.c
+++ b/clang/test/Driver/linux-ld.c
@@ -496,22 +496,6 @@
 // CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-GCC-VERSION1: 
"{{.*}}/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0{{/|}}crtbegin.o"
 
-// RUN: %clangxx -x c++ %s -### 2>&1 \
-// RUN: --target=x86_64-unknown-linux-gnu \
-// RUN: -stdlib=libc++ \
-// RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-SHARED %s
-// CHECK-BASIC-LIBCXX-SHARED: "-lc++"
-// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "-lm"
-// RUN: %clangxx  -x c++ %s -### 2>&1 \
-// RUN: --target=x86_64-unknown-linux-gnu \
-// RUN: -stdlib=libc++ -static-libstdc++ \
-// RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-STATIC %s
-// CHECK-BASIC-LIBCXX-STATIC: "--push-state"
-// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "-Bstatic"
-// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "-lc++"
-// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "--pop-state"
-// 

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

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

Note that stage 2 fails, where we're supposed to use lld. So I think this is 
probably some compiler-rt test config problem you need to sort out, and not a 
fundamental problem with the 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] D110128: [Driver] Correctly handle static C++ standard library

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

This breaks our packaging builders too: 
https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8835201798501639249/+/u/package_clang/stdout?format=raw


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] D108560: [clang-tidy] Add support for NOLINTBEGIN ... NOLINTEND comments to suppress clang-tidy warnings over multiple lines

2021-09-24 Thread Salman Javed via Phabricator via cfe-commits
salman-javed-nz updated this revision to Diff 374969.
salman-javed-nz added a comment.

Pre-merge build error doesn't seem related to my change, but rebasing patch 
anyway just to be sure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108560

Files:
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  
clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/error_in_include.inc
  
clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/nolint_in_include.inc
  clang-tools-extra/test/clang-tidy/infrastructure/nolint.cpp
  
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-at-eof.cpp
  
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-global-end-specific.cpp
  
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-specific-end-global.cpp
  
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-without-end.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-end-at-sof.cpp
  
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-end-without-begin.cpp
  
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp
  
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-delims.cpp
  
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-typo-in-check-name.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline.cpp

Index: clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline.cpp
===
--- clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline.cpp
+++ clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline.cpp
@@ -1,49 +1,51 @@
+// NOLINTNEXTLINE
 class A { A(int i); };
+
+class B { B(int i); };
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
 
 // NOLINTNEXTLINE
-class B { B(int i); };
+class C { C(int i); };
 
 // NOLINTNEXTLINE(for-some-other-check)
-class C { C(int i); };
+class D { D(int i); };
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
 
 // NOLINTNEXTLINE(*)
-class C1 { C1(int i); };
+class D1 { D1(int i); };
 
 // NOLINTNEXTLINE(not-closed-bracket-is-treated-as-skip-all
-class C2 { C2(int i); };
+class D2 { D2(int i); };
 
 // NOLINTNEXTLINE(google-explicit-constructor)
-class C3 { C3(int i); };
+class D3 { D3(int i); };
 
 // NOLINTNEXTLINE(some-check, google-explicit-constructor)
-class C4 { C4(int i); };
+class D4 { D4(int i); };
 
 // NOLINTNEXTLINE without-brackets-skip-all, another-check
-class C5 { C5(int i); };
-
+class D5 { D5(int i); };
 
 // NOLINTNEXTLINE
 
-class D { D(int i); };
+class E { E(int i); };
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
 
 // NOLINTNEXTLINE
 //
-class E { E(int i); };
+class F { F(int i); };
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
 
 #define MACRO(X) class X { X(int i); };
-MACRO(F)
+MACRO(G)
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: single-argument constructors must be marked explicit
 // NOLINTNEXTLINE
-MACRO(G)
+MACRO(H)
 
-#define MACRO_NOARG class H { H(int i); };
+#define MACRO_NOARG class I { I(int i); };
 // NOLINTNEXTLINE
 MACRO_NOARG
 
-// CHECK-MESSAGES: Suppressed 8 warnings (8 NOLINT)
+// CHECK-MESSAGES: Suppressed 9 warnings (9 NOLINT)
 
 // RUN: %check_clang_tidy %s google-explicit-constructor %t --
Index: clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend.cpp
@@ -0,0 +1,127 @@
+// RUN: %check_clang_tidy %s google-explicit-constructor %t -- --header-filter=.* -system-headers -- -isystem %S/Inputs/nolintbeginend
+
+class A { A(int i); };
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
+
+// NOLINTBEGIN
+class B1 { B1(int i); };
+// NOLINTEND
+
+// NOLINTBEGIN
+// NOLINTEND
+// NOLINTBEGIN
+class B2 { B2(int i); };
+// NOLINTEND
+
+// NOLINTBEGIN
+// NOLINTBEGIN
+class B3 { B3(int i); };
+// NOLINTEND
+// NOLINTEND
+
+// NOLINTBEGIN
+// NOLINTBEGIN
+// NOLINTEND
+class B4 { B4(int i); };
+// NOLINTEND
+
+// NOLINTBEGIN
+// NOLINTEND
+class B5 { B5(int i); };
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: single-argument constructors must be marked explicit
+
+// NOLINTBEGIN(google-explicit-constructor)
+class C1 { C1(int i); };
+// NOLINTEND(google-explicit-constructor)
+
+// NOLINTBEGIN(*)
+class C2 { C2(int i); };

[PATCH] D110445: [NFC] Avoid some AttrBuilder redundant initialization

2021-09-24 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment.

Wouldn't this go against 
https://llvm.org/docs/CodingStandards.html#do-not-use-static-constructors?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110445

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


[PATCH] D110422: [AIX] Enable PGO without LTO

2021-09-24 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

Using to `PrivateLinkage`, all the profc/profd for each weak symbol will be 
*local* to objects, and all kept in the csect,
so we won't have problem.

The downside is that we won't be able to discard the duplicated counters and 
profile data,
but those can not be discarded even if we keep the weak linkage,
due to the binder limitation of not discarding only part of the csect either .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D110422: [AIX] Enable PGO without LTO

2021-09-24 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

We have verified all the profile counters in SPEC , all are OK.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D109557: Adds a BreakBeforeClosingParen option

2021-09-24 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks requested changes to this revision.
HazardyKnusperkeks added a comment.
This revision now requires changes to proceed.

In D109557#3021312 , @MyDeveloperDay 
wrote:

> FYI, this is a very aggressive change, I highly recommend you run this over a 
> large code base before landing. to double check, here is one slight oddity 
> which I cannot determine if its correct or not.
>
>   void foo() {
>   if (quitelongarg != (alsolongarg - 1)) { // ABC is a very 
> long comment
> return;
>   }
>   }
>
> becomes
>
>   void foo() {
> if (quitelongarg != (alsolongarg - 1)
> ) { // ABC is a very long comment
>   return;
> }
>   }
>
>
>
>   BasedOnStyle: LLVM
>   BreakBeforeClosingParen: true
>
> That might be what you expect but I wasn't quite sure

That is at least not what is covered in the tests or documentation. I would 
think it only applies to function declarations and invocations.
So either adapt documentation and test coverage, or fix behavior (in which case 
the tests should be extended as well).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109557

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


[PATCH] D110432: [clang-format][docs] mark new clang-format configuration options based on which version they would GA

2021-09-24 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

In D110432#3021391 , @MyDeveloperDay 
wrote:

> I agree this looks better
>
> F19213646: image.png 

Full support for that. And for the whole change.




Comment at: clang/docs/tools/dump_format_style.py:237
+field_type, field_name, trailcomment, version = 
re.match(r'([<>:\w(,\s)]+)\s+(\w+)\s*(\/\*version=([0-9.]*)\*\/)*;',
   line).groups()
+option = Option(str(field_name), str(field_type), comment, version)

I think this was aligned to the opening parenthesis of match(.

If we only had an automatic formatting tool.  



Comment at: clang/include/clang/Format/Format.h:1865
   /// \endwarning
-  QualifierAlignmentStyle QualifierAlignment;
+  QualifierAlignmentStyle QualifierAlignment /*version=14.0.0*/;
 

Could we move that into the comment block?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110432

___
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-24 Thread Justin Lebar via Phabricator via cfe-commits
jlebar added a comment.

Presumably as a separate commit we should add tests to the test_suite 
repository to ensure that this at least still compiles with different versions 
of CUDA?


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] D109693: Driver: Remove major release version detection for RHEL

2021-09-24 Thread serge via Phabricator via cfe-commits
serge-sans-paille accepted this revision.
serge-sans-paille added a comment.
This revision is now accepted and ready to land.

LGTM, please reformat the code though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109693

___
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-24 Thread Justin Lebar via Phabricator via cfe-commits
jlebar accepted this revision.
jlebar added a comment.

Okay, I give up on the phab interface.  It's unreadable with all the existing
comments and lint errors.

Hope you don't mind comments this way.  I'm just going to put it all in a giant
code block so it doesn't get wrapped or whatever.

  +// __nv_tex_surf_handler() provided by this header as a macro.
  +#define __nv_tex_surf_handler(__op, __ptr, ...)  
  \
  +  
__cuda_tex::__tex_fetch<__cuda_tex::__Tag<__cuda_tex::__tex_op_hash(__op)>>( \
  +  __ptr, __VA_ARGS__)
  
  ::__cuda_tex
  
  +// Put all functions into anonymous namespace so they have internal linkage.
  
  Say a little more?  Specifically, you want anon ns because this is device code
  and it has to work even without being linked.
  
  (Also, are you sure that plain `inline` doesn't do the right thing?  Like, we
  have lots of CUDA headers that are `inline`'ed without all being in an anon
  ns.)
  
  +// First, we need a perfect hash function and a few constexpr helper 
functions
  +// for converting a string literal into a numeric value which can be used to
  +// parametrize a template. We can not use string literals for that as that 
would
  +// require C++20.
  +//
  +// The hash function was generated with 'gperf' and then manually converted 
into
  +// its constexpr equivalent.
  +//
  +// NOTE: the perfect hashing scheme comes with inherent self-test. If the 
hash
  +// function has a collision for any of the texture operations, the 
compilation
  +// will fail due to an attempt to redefine a tag with the same value. If the
  +// header compiles, then the hash function is good enough for the job.
  
  I guess if it has a self-test then that's fine.  Though is this really better
  than a series of `if` statements with strcmp?  I guess I am scared of this 
kind
  of thing because I did it once in ccache.  I thought I was very clever and got
  a good speedup.  1 year later I found out I'd broken handling of __DATE__ and
  __TIME__.  o.O




Comment at: clang/lib/Headers/__clang_cuda_texture_intrinsics.h:26
+#define __nv_tex_surf_handler(__op, __ptr, ...)
\
+  __cuda_tex::__tex_fetch<__cuda_tex::__Tag<__cuda_tex::__tex_op_hash(__op)>>( 
\
+  __ptr, __VA_ARGS__)

`::__cuda_tex` (appears twice)



Comment at: clang/lib/Headers/__clang_cuda_texture_intrinsics.h:53
+
+// Put all functions into anonymous namespace so they have internal linkage.
+namespace {

Write a little more?  This looks super-suspicious, but you need it specifically 
because these are *device* functions.


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] D110392: [clang-format] Left/Right alignment fixer can cause false positive replacements when they don't actually change anything

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



Comment at: clang/lib/Format/QualifierAlignmentFixer.cpp:95
+  if (Err)
+llvm::errs() << "Error removing no op replacements : "
+ << llvm::toString(std::move(Err)) << "\n";

The message may be confusing, but honestly I don't know what to put in either, 
since "adding non no op replacements" may be even more confusing.



Comment at: clang/unittests/Format/QualifierFixerTest.cpp:818
+  verifyFormat("static const uint32 foo[] = {0, 31};",
+   "static const uint32 foo[] = {0, 31};", Style);
+  EXPECT_EQ(ReplacementCount, 0);

Doesn't the two argument version suffice?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110392

___
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-24 Thread Richard Howell via Phabricator via cfe-commits
rmaz added a comment.

@vsapsai just checking on where we are with this one. Is the current plan to 
investigate an approach only serializing the methods declared in each module, 
or are we good to go ahead with the set de-duplication approach? I tried 
profiling with D110123  and with the 
following patch:

  diff --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
  index 279067a8ac8b..aaaca0aff9ab 100644
  --- a/clang/lib/Serialization/ASTReader.cpp
  +++ b/clang/lib/Serialization/ASTReader.cpp
  @@ -8130,7 +8130,7 @@ namespace serialization {
 FactoryBits = Data.FactoryBits;
 InstanceHasMoreThanOneDecl = Data.InstanceHasMoreThanOneDecl;
 FactoryHasMoreThanOneDecl = Data.FactoryHasMoreThanOneDecl;
  -  return true;
  +  return false;
   }

but this was a fair bit slower than the deduplication approach, and for some 
files would never complete, presumably stuck in an infinite loop of dependent 
modules. Is there a way to exclude the serialization of methods from dependent 
modules but make the method lookup more efficient somehow?


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] D110422: [AIX] Enable PGO without LTO

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

In D110422#3021572 , @jsji wrote:

> In D110422#3021535 , @MaskRay wrote:
>
>> The description is still unclear.
>>
>> Say a.o has a weak `foo, __profc_foo, __profd_foo`, b.o has a weak `foo, 
>> __profc_foo, __profd_foo`.
>> The linker picks the definitions from `a.o`. In the PGO implementation, it 
>> doesn't whether the non-discarded b.o `__profd_foo` has garbage value.
>
> We have 3 sets weak symbols here: weak_func, profc_weak_foo, profd_weak_func. 
> We can't ensure that binder always choose 3 of them from same object.

Oh, this is a serious enough bug. I am not sure working around the bug by 
switching to `PrivateLinkage` will help.
The values will be wrong as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D110422: [AIX] Enable PGO without LTO

2021-09-24 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

In D110422#3021535 , @MaskRay wrote:

> The description is still unclear.
>
> Say a.o has a weak `foo, __profc_foo, __profd_foo`, b.o has a weak `foo, 
> __profc_foo, __profd_foo`.
> The linker picks the definitions from `a.o`. In the PGO implementation, it 
> doesn't whether the non-discarded b.o `__profd_foo` has garbage value.

We have 3 sets weak symbols here: weak_func, profc_weak_foo, profd_weak_func. 
We can't ensure that binder always choose 3 of them from same object.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D36850: [ThinLTO] Add noRecurse and noUnwind thinlink function attribute propagation

2021-09-24 Thread Di Mo via Phabricator via cfe-commits
modimo added inline comments.



Comment at: clang/test/CodeGen/thinlto-funcattr-prop.ll:17
 
-; CHECK: ^2 = gv: (guid: 13959900437860518209, summaries: (function: (module: 
^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, 
live: 1, dsoLocal: 1, canAutoHide: 0), insts: 2, calls: ((callee: ^3)
-; CHECK: ^3 = gv: (guid: 14959766916849974397, summaries: (function: (module: 
^1, flags: (linkage: external, visibility: default, notEligibleToImport: 0, 
live: 1, dsoLocal: 0, canAutoHide: 0), insts: 1, funcFlags: (readNone: 0, 
readOnly: 0, noRecurse: 1, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, 
noUnwind: 1, mayThrow: 0, hasUnknownCall: 0
+;; Summary for call_extern. Note that llvm-lto2 writes out the index before 
+; CHECK-INDEX: ^2 = gv: (guid: 13959900437860518209, summaries: (function: 
(module: ^0, flags: (linkage: external, visibility: default, 
notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 0), insts: 2, calls: 
((callee: ^3)

tejohnson wrote:
> Incomplete sentence, seems to be missing the rest of the explanation about 
> when it is written.
Nice catch, sentence is now complete.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D36850

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


[PATCH] D36850: [ThinLTO] Add noRecurse and noUnwind thinlink function attribute propagation

2021-09-24 Thread Di Mo via Phabricator via cfe-commits
modimo updated this revision to Diff 374934.
modimo marked an inline comment as done.
modimo added a comment.

Complete explanation in thinlto-funcattr-prop.ll, also fix up diff to contain 
all changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D36850

Files:
  clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
  clang/test/CodeGen/thinlto-distributed-cfi.ll
  clang/test/CodeGen/thinlto-funcattr-prop.ll
  llvm/include/llvm/AsmParser/LLToken.h
  llvm/include/llvm/IR/GlobalValue.h
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/include/llvm/LTO/LTO.h
  llvm/include/llvm/Transforms/IPO/FunctionAttrs.h
  llvm/include/llvm/Transforms/IPO/FunctionImport.h
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/ModuleSummaryIndex.cpp
  llvm/lib/LTO/LTO.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/LTO/ThinLTOCodeGenerator.cpp
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/lib/Transforms/IPO/FunctionImport.cpp
  llvm/test/Assembler/thinlto-summary.ll
  llvm/test/Bitcode/thinlto-function-summary-refgraph.ll
  llvm/test/Bitcode/thinlto-type-vcalls.ll
  llvm/test/ThinLTO/X86/deadstrip.ll
  llvm/test/ThinLTO/X86/dot-dumper.ll
  llvm/test/ThinLTO/X86/dot-dumper2.ll
  llvm/test/ThinLTO/X86/funcattrs-prop-exported-internal.ll
  llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
  llvm/test/ThinLTO/X86/funcattrs-prop-undefined.ll
  llvm/test/ThinLTO/X86/funcattrs-prop-unknown.ll
  llvm/test/ThinLTO/X86/funcattrs-prop-weak.ll
  llvm/test/ThinLTO/X86/funcattrs-prop.ll
  llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
  llvm/test/ThinLTO/X86/function_entry_count.ll
  llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll

Index: llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll
===
--- llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll
+++ llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll
@@ -3,15 +3,17 @@
 ; verification error.
 ; RUN: opt -module-summary %s -o %t1.bc
 ; RUN: opt -module-summary %p/Inputs/linkonce_resolution_comdat.ll -o %t2.bc
-; RUN: llvm-lto -thinlto-action=run %t1.bc %t2.bc -exported-symbol=f -exported-symbol=g -thinlto-save-temps=%t3.
+; RUN: llvm-lto -thinlto-action=run -disable-thinlto-funcattrs=0 %t1.bc %t2.bc -exported-symbol=f -exported-symbol=g -thinlto-save-temps=%t3.
 
 ; RUN: llvm-dis %t3.0.3.imported.bc -o - | FileCheck %s --check-prefix=IMPORT1
 ; RUN: llvm-dis %t3.1.3.imported.bc -o - | FileCheck %s --check-prefix=IMPORT2
 ; Copy from first module is prevailing and converted to weak_odr, copy
 ; from second module is preempted and converted to available_externally and
 ; removed from comdat.
-; IMPORT1: define weak_odr i32 @f(i8* %0) unnamed_addr comdat($c1) {
-; IMPORT2: define available_externally i32 @f(i8* %0) unnamed_addr {
+; IMPORT1: define weak_odr i32 @f(i8* %0) unnamed_addr [[ATTR:#[0-9]+]] comdat($c1) {
+; IMPORT2: define available_externally i32 @f(i8* %0) unnamed_addr [[ATTR:#[0-9]+]] {
+
+; CHECK-DAG: attributes [[ATTR]] = { norecurse nounwind }
 
 ; RUN: llvm-nm -o - < %t1.bc.thinlto.o | FileCheck %s --check-prefix=NM1
 ; NM1: W f
Index: llvm/test/ThinLTO/X86/function_entry_count.ll
===
--- llvm/test/ThinLTO/X86/function_entry_count.ll
+++ llvm/test/ThinLTO/X86/function_entry_count.ll
@@ -2,7 +2,7 @@
 ; RUN: opt -thinlto-bc %p/Inputs/function_entry_count.ll -write-relbf-to-summary -thin-link-bitcode-file=%t2.thinlink.bc -o %t2.bc
 
 ; First perform the thin link on the normal bitcode file.
-; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps -thinlto-synthesize-entry-counts \
+; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps -disable-thinlto-funcattrs=0 -thinlto-synthesize-entry-counts \
 ; RUN: -r=%t1.bc,g, \
 ; RUN: -r=%t1.bc,f,px \
 ; RUN: -r=%t1.bc,h,px \
@@ -10,15 +10,16 @@
 ; RUN: -r=%t2.bc,g,px
 ; RUN: llvm-dis -o - %t.o.1.3.import.bc | FileCheck %s
 
-; RUN: llvm-lto -thinlto-action=run -thinlto-synthesize-entry-counts -exported-symbol=f \
+; RUN: llvm-lto -thinlto-action=run -disable-thinlto-funcattrs=0 -thinlto-synthesize-entry-counts -exported-symbol=f \
 ; RUN: -exported-symbol=g -exported-symbol=h -thinlto-save-temps=%t3. %t1.bc %t2.bc
 ; RUN: llvm-dis %t3.0.3.imported.bc -o - | FileCheck %s
 
-; CHECK: define void @h() !prof ![[PROF2:[0-9]+]]
-; CHECK: define void @f(i32{{.*}}) !prof ![[PROF1:[0-9]+]]
+; CHECK: define void @h() [[ATTR:#[0-9]+]] !prof ![[PROF2:[0-9]+]]
+; CHECK: define void @f(i32{{.*}}) [[ATTR:#[0-9]+]] !prof ![[PROF1:[0-9]+]]
 ; CHECK: define available_externally void @g() !prof ![[PROF2]]
 ; CHECK-DAG: ![[PROF1]] = !{!"synthetic_function_entry_count", i64 10}
 ; CHECK-DAG: ![[PROF2]] = 

[PATCH] D110422: [AIX] Enable PGO without LTO

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

The description is still unclear.

Say a.o has a weak `foo, __profc_foo, __profd_foo`, b.o has a weak `foo, 
__profc_foo, __profd_foo`.
The linker picks the definitions from `a.o`. In the PGO implementation, it 
doesn't whether the non-discarded b.o `__profd_foo` has garbage value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D101868: [clang-format] Adds a formatter for aligning arrays of structs

2021-09-24 Thread Fred Grim via Phabricator via cfe-commits
feg208 added a comment.

I am. I'll jump on this over the weekend. Sorry been a bit buried in my day job


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101868

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


[PATCH] D110422: [AIX] Enable PGO without LTO

2021-09-24 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

Pos_Rel __profc_weak_func notation is just the normal relocation to symbol 
__profc_weak_func.

The relocation here is to calculate the relative pointer (offset) to 
__profc__weak_func from __profd__weak__func.

In example above, the offsets value after binding will be the same for both 
instances, as the symbol __profc__weak__func will be the one that is chosen by 
binder. Let us say it is the value of first instances.

Then when we calculate the profc_weak_func pointer for 2nd instances, we get 
garbage value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D110422: [AIX] Enable PGO without LTO

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

In D110422#3021283 , @jsji wrote:

>> In other binary formats the first weak definition is selected and other weak 
>> definitions are discarded.
>> Do you mean that AIX ld doesn't pick the first weak definition?
>
> No. I think this is exactly what is causing problem here.
>
> eg: if we have two weak symbols (weak_func), and we generate the weak 
> counter/data as usual:
>
>   __llvm_prf_cnts:
>   
>   __profc_weak_func(1):
>   
>   __profc_weak_func(2):
>   
>   __llvm_prf_data:
>   
>   __profd_weak func(1):
>   
>   Pos_Rel __profc_weak_func  <=== Relocation to calculate the relative pointer
>   
>   __profd_weak_func(2):
>   
>   Pos_Rel __profc_weak_func  <=== Relocation to calculate the relative pointer
>
> The relative pointer calculation in one of the __profd_weak_fun will be wrong 
> after linking.

Can you elaborate the `Pos_Rel __profc_weak_func` notation?

Note: In other binary formats' scheme, it doesn't matter whether non-first weak 
definitions are discarded or not.
After linking, the non-first weak definitions will be unreachable anyway, so 
their internal references don't really matter.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D110216: [clang] retain type sugar in auto / template argument deduction

2021-09-24 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 374921.
mizvekov added a comment.

update print-type.cpp test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110216

Files:
  clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
  
clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp
  clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp
  clang-tools-extra/clangd/FindTarget.cpp
  clang-tools-extra/clangd/unittests/ASTTests.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang-tools-extra/clangd/unittests/InlayHintTests.cpp
  clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
  clang-tools-extra/test/clang-tidy/checkers/cert-static-object-exception.cpp
  clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-owning-memory.cpp
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/Type.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaCXXScopeSpec.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaLambda.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Sema/TreeTransform.h
  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.variadic/multi-level-substitution.cpp
  clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
  clang/test/Index/print-type.cpp
  clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
  clang/test/SemaCXX/cxx1z-decomposition.cpp
  clang/test/SemaCXX/deduced-return-type-cxx14.cpp
  clang/test/SemaCXX/friend.cpp
  clang/test/SemaCXX/recovery-expr-type.cpp
  clang/test/SemaCXX/sizeless-1.cpp
  clang/test/SemaCXX/sugared-auto.cpp
  clang/test/SemaTemplate/attributes.cpp
  clang/test/SemaTemplate/friend.cpp
  clang/test/SemaTemplate/operator-template.cpp
  clang/unittests/AST/ASTImporterTest.cpp

Index: clang/unittests/AST/ASTImporterTest.cpp
===
--- clang/unittests/AST/ASTImporterTest.cpp
+++ clang/unittests/AST/ASTImporterTest.cpp
@@ -6176,26 +6176,9 @@
   FirstDeclMatcher().match(FromTU, functionDecl());
 
   FunctionDecl *To = Import(From, Lang_CXX14);
-  EXPECT_TRUE(To);
-  EXPECT_TRUE(isa(To->getReturnType()));
-}
-
-TEST_P(ImportAutoFunctions, ReturnWithStructDeclaredInside2) {
-  Decl *FromTU = getTuDecl(
-  R"(
-  auto foo() {
-struct X {};
-return X();
-  }
-  )",
-  Lang_CXX14, "input0.cc");
-  FunctionDecl *From =
-  FirstDeclMatcher().match(FromTU, functionDecl());
-
-  // This time import the type directly.
-  QualType ToT = ImportType(From->getType(), From, Lang_CXX14);
-  const FunctionProtoType *FPT = cast(ToT);
-  EXPECT_TRUE(isa(FPT->getReturnType()));
+  // FIXME: We do not support importing these.
+  // EXPECT: error: cannot import unsupported AST node CXXRecord
+  EXPECT_FALSE(To);
 }
 
 TEST_P(ImportAutoFunctions, ReturnWithTypedefToStructDeclaredInside) {
@@ -6212,8 +6195,9 @@
   FirstDeclMatcher().match(FromTU, functionDecl());
 
   FunctionDecl *To = Import(From, Lang_CXX14);
-  EXPECT_TRUE(To);
-  EXPECT_TRUE(isa(To->getReturnType()));
+  // FIXME: We do not support importing these.
+  // EXPECT: error: cannot import unsupported AST node CXXRecord
+  EXPECT_FALSE(To);
 }
 
 TEST_P(ImportAutoFunctions, ReturnWithStructDeclaredNestedInside) {
@@ -6229,8 +6213,9 @@
   FirstDeclMatcher().match(FromTU, functionDecl());
 
   FunctionDecl *To = Import(From, Lang_CXX14);
-  EXPECT_TRUE(To);
-  EXPECT_TRUE(isa(To->getReturnType()));
+  // FIXME: We do not support importing these.
+  // EXPECT: error: cannot import unsupported AST node CXXRecord
+  EXPECT_FALSE(To);
 }
 
 TEST_P(ImportAutoFunctions, ReturnWithInternalLambdaType) {
@@ -6249,8 +6234,9 @@
   FromTU, functionDecl(hasName("f")));
 
   FunctionDecl *To = Import(From, Lang_CXX17);
-  EXPECT_TRUE(To);
-  EXPECT_TRUE(isa(To->getReturnType()));
+  // FIXME: We do not support importing these.
+  // EXPECT: error: cannot import unsupported AST node CXXRecord
+  EXPECT_FALSE(To);
 }
 
 TEST_P(ImportAutoFunctions, ReturnWithTypeInIf) {
@@ -6268,8 +6254,9 @@
   FromTU, functionDecl(hasName("f")));
 
   FunctionDecl *To = Import(From, Lang_CXX17);
-  EXPECT_TRUE(To);
-  EXPECT_TRUE(isa(To->getReturnType()));
+  // FIXME: We do not support importing these.
+  // EXPECT: error: cannot import unsupported AST node CXXRecord
+  EXPECT_FALSE(To);
 }
 
 TEST_P(ImportAutoFunctions, ReturnWithTypeInFor) {
@@ -6285,8 +6272,9 @@
   FromTU, functionDecl(hasName("f")));
 
   FunctionDecl *To = 

[PATCH] D110436: [WIP] Add %n format specifier warning

2021-09-24 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

The patch description says what the change is, but not why it is the way it is.
In particular, it might be helpful to be more verbose than just stating that 
something is unsafe.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110436

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


[PATCH] D110257: [CFE][Codegen] Do not break the contiguity of static allocas.

2021-09-24 Thread Shivam Gupta via Phabricator via cfe-commits
xgupta added a comment.

Nice work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110257

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


[PATCH] D110432: [clang-format][docs] mark new clang-format configuration options based on which version they would GA

2021-09-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

I agree this looks better

F19213646: image.png 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110432

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


[PATCH] D110432: [clang-format][docs] mark new clang-format configuration options based on which version they would GA

2021-09-24 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added a comment.

I like this. Consider only displaying the major version (e.g., `clang-format 
14` instead of `clang-format 14.0.0`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110432

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


[PATCH] D110436: [WIP] Add %n format specifier warning

2021-09-24 Thread Jayson Yan via Phabricator via cfe-commits
Jaysonyan created this revision.
Jaysonyan added reviewers: leonardchan, phosek.
Jaysonyan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This warning is to dissuade developers from using the potentially unsafe %n
format specifier. Currently this warning is surfaced under the flag 
-Wformat-n-specifier
which is enabled under the group -Wformat. The way this information is surfaced 
is pending
discussion from this RFC: 
https://lists.llvm.org/pipermail/cfe-dev/2021-September/068986.html.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110436

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaChecking.cpp
  clang/test/FixIt/format.m
  clang/test/Misc/warning-wall.c
  clang/test/Sema/format-string-percentn.c
  clang/test/Sema/format-strings-size_t.c
  clang/test/Sema/format-strings.c

Index: clang/test/Sema/format-strings.c
===
--- clang/test/Sema/format-strings.c
+++ clang/test/Sema/format-strings.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -isystem %S/Inputs %s
-// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -isystem %S/Inputs -fno-signed-char %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-format-n-specifier -Wformat-nonliteral -isystem %S/Inputs %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-format-n-specifier -Wformat-nonliteral -isystem %S/Inputs -fno-signed-char %s
 
 #include 
 #include 
@@ -644,6 +644,7 @@
   test14_bar("%", "%d", p); // expected-warning{{incomplete format specifier}}
 }
 
+#pragma GCC diagnostic ignored "-Wformat-n-specifier"
 void test_qualifiers(volatile int *vip, const int *cip,
  const volatile int *cvip) {
   printf("%n", cip); // expected-warning{{format specifies type 'int *' but the argument has type 'const int *'}}
Index: clang/test/Sema/format-strings-size_t.c
===
--- clang/test/Sema/format-strings-size_t.c
+++ clang/test/Sema/format-strings-size_t.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -Wno-format-n-specifier -fsyntax-only -verify %s
 
 int printf(char const *, ...);
 
Index: clang/test/Sema/format-string-percentn.c
===
--- /dev/null
+++ clang/test/Sema/format-string-percentn.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int printf(const char *restrict, ...);
+void percentn(volatile int *n) {
+  printf("%n", n); //expected-warning{{usage of '%n' is unsafe}}
+}
Index: clang/test/Misc/warning-wall.c
===
--- clang/test/Misc/warning-wall.c
+++ clang/test/Misc/warning-wall.c
@@ -17,6 +17,7 @@
 CHECK-NEXT:  -Wformat-y2k
 CHECK-NEXT:  -Wformat-invalid-specifier
 CHECK-NEXT:  -Wformat-insufficient-args
+CHECK-NEXT:  -Wformat-n-specifier
 CHECK-NEXT:-Wfor-loop-analysis
 CHECK-NEXT:-Wframe-address
 CHECK-NEXT:-Wimplicit
Index: clang/test/FixIt/format.m
===
--- clang/test/FixIt/format.m
+++ clang/test/FixIt/format.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -fblocks -verify %s
-// RUN: %clang_cc1 -triple %itanium_abi_triple -fdiagnostics-parseable-fixits -fblocks %s 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -Wno-format-n-specifier -fsyntax-only -fblocks -verify %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -Wno-format-n-specifier -fdiagnostics-parseable-fixits -fblocks %s 2>&1 | FileCheck %s
 
 @class NSString;
 extern void NSLog(NSString *, ...);
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -8965,6 +8965,13 @@
 return true;
   }
 
+  // %n is unsafe
+  if (CS.getKind() == ConversionSpecifier::nArg) {
+EmitFormatDiagnostic(
+  S.PDiag(diag::warn_printf_n_specifier), getLocationOfByte(CS.getStart()), /*IsStringLocation*/true,
+  getSpecifierRange(startSpecifier, specifierLen));
+  }
+
   // Only scalars are allowed for os_trace.
   if (FSType == Sema::FST_OSTrace &&
   (CS.getKind() == ConversionSpecifier::PArg ||
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9226,6 +9226,8 @@
 
 def warn_printf_insufficient_data_args : Warning<
   "more '%%' conversions than data arguments">, InGroup;
+def warn_printf_n_specifier : Warning<
+  "usage of '%%n' is unsafe">, InGroup;
 def 

Re: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple-template-names={simple, mangled}

2021-09-24 Thread David Blaikie via cfe-commits
On Thu, Sep 23, 2021 at 7:12 AM  wrote:

> Resending to cfe-commits instead of llvm-commits (doh!).
>
> > -Original Message-
> > From: Robinson, Paul
> > Sent: Thursday, September 23, 2021 10:05 AM
> > To: David Blaikie ; 'llvm-comm...@lists.llvm.org'
> > 
> > Cc: Adrian Prantl ; Jonas Devlieghere
> > 
> > Subject: RE: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple-
> > template-names={simple,mangled}
> >
> > -gsimple-template-names=mangled seems like a testing feature?
> > That would be parseable only by llvm-dwarfdump...
> > In which case it seems like it should be a -cc1 option not a
> > driver option.
>

Yep, sounds fair - done that in 8ec7d9b8f875368a5f92596332cd05059df6bbd2

> --paulr
> >
> > > -Original Message-
> > > From: cfe-commits  On Behalf Of
> > David
> > > Blaikie via cfe-commits
> > > Sent: Wednesday, September 22, 2021 2:12 PM
> > > To: cfe-commits@lists.llvm.org
> > > Subject: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple-
> > > template-names={simple,mangled}
> > >
> > >
> > > Author: David Blaikie
> > > Date: 2021-09-22T11:11:49-07:00
> > > New Revision: 38c09ea2d279eabe3602e2002f8cdfcc5380
> > >
> > > URL: https://urldefense.com/v3/__https://github.com/llvm/llvm-
> > >
> >
> project/commit/38c09ea2d279eabe3602e2002f8cdfcc5380__;!!JmoZiZGBv3RvKR
> > > Sx!sx4rLw3CFwdj-rfDEK1Ah3HnANZSLOpXYFIcie1Oiyili8LKwFHxFk-g0F7-Z2pXAg$
> > > DIFF: https://urldefense.com/v3/__https://github.com/llvm/llvm-
> > >
> >
> project/commit/38c09ea2d279eabe3602e2002f8cdfcc5380.diff__;!!JmoZiZGBv
> > > 3RvKRSx!sx4rLw3CFwdj-rfDEK1Ah3HnANZSLOpXYFIcie1Oiyili8LKwFHxFk-
> > > g0F4WQP9bxA$
> > >
> > > LOG: DebugInfo: Add (initially no-op) -gsimple-template-
> > > names={simple,mangled}
> > >
> > > This is to build the foundation of a new debug info feature to use only
> > > the base name of template as its debug info name (eg: "t1" instead of
> > > the full "t1"). The intent being that a consumer can still
> retrieve
> > > all that information from the DW_TAG_template_*_parameters.
> > >
> > > So gno-simple-template-names is business as usual/previously
> ("t1")
> > >=simple is the simplified name ("t1")
> > >=mangled is a special mode to communicate the full information, but
> > >also indicate that the name should be able to be simplified. The
> data
> > >is encoded as "_STNt1|" which will be matched with an
> > >llvm-dwarfdump --verify feature to deconstruct this name, rebuild
> the
> > >original name, and then try to rebuild the simple name via the DWARF
> > >tags - then compare the latter and the former to ensure that all the
> > >data necessary to fully rebuild the name is present.
> > >
> > > Added:
> > >
> > >
> > > Modified:
> > > clang/include/clang/Basic/CodeGenOptions.def
> > > clang/include/clang/Basic/DebugInfoOptions.h
> > > clang/include/clang/Driver/Options.td
> > > clang/lib/Driver/ToolChains/Clang.cpp
> > > clang/lib/Frontend/CompilerInvocation.cpp
> > > clang/test/Driver/debug-options.c
> > >
> > > Removed:
> > >
> > >
> > >
> > >
> >
> ##
> > > ##
> > > diff  --git a/clang/include/clang/Basic/CodeGenOptions.def
> > > b/clang/include/clang/Basic/CodeGenOptions.def
> > > index 37900bf3ead1..5d1d4f9dc58e 100644
> > > --- a/clang/include/clang/Basic/CodeGenOptions.def
> > > +++ b/clang/include/clang/Basic/CodeGenOptions.def
> > > @@ -320,6 +320,12 @@ CODEGENOPT(DebugFwdTemplateParams, 1, 0) ///<
> > Whether
> > > to emit complete
> > >   ///< template parameter
> > > descriptions in
> > >   ///< forward declarations
> > > (versus just
> > >   ///< including them in the
> > > name).
> > > +ENUM_CODEGENOPT(DebugSimpleTemplateNames,
> > > codegenoptions::DebugTemplateNamesKind, 2,
> > > codegenoptions::DebugTemplateNamesKind::Full) ///< Whether to emit
> > > template parameters
> > > +   ///< in the textual names
> of
> > > template
> > > +  ///< specializations.
> > > +  ///< Implies
> DebugFwdTemplateNames to
> > > +  ///< allow decorated names to be
> > > +  ///< reconstructed when needed.
> > >  CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize
> > use-
> > > lists.
> > >
> > >  CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-
> > program
> > >
> > > diff  --git a/clang/include/clang/Basic/DebugInfoOptions.h
> > > b/clang/include/clang/Basic/DebugInfoOptions.h
> > > index c1259d7797db..a99a2b5903d7 100644
> > > --- a/clang/include/clang/Basic/DebugInfoOptions.h
> > > +++ b/clang/include/clang/Basic/DebugInfoOptions.h
> > > @@ -54,6 +54,12 @@ enum DebugInfoKind {
> > >

[clang] 8ec7d9b - DebugInfo: Move the '=' version of -gsimple-template-names to the frontend

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

Author: David Blaikie
Date: 2021-09-24T11:18:10-07:00
New Revision: 8ec7d9b8f875368a5f92596332cd05059df6bbd2

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

LOG: DebugInfo: Move the '=' version of -gsimple-template-names to the frontend

Based on feedback from Paul Robinson on 38c09ea that the 'mangled' mode
is only useful as an LLVM-developer-internal tool in combination with
llvm-dwarfdump --verify, so demote that to a frontend-only (not driver)
option. The driver support is simply -g{no-,}simple-template-names to
switch on simple template names, without the option to use the mangled
template name scheme there.

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Driver/debug-options.c

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 28d96b1d08457..f0420702a5cc8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2970,10 +2970,9 @@ def gno_split_dwarf : Flag<["-"], "gno-split-dwarf">, 
Group;
 def gsimple_template_names : Flag<["-"], "gsimple-template-names">, 
Group;
 def gsimple_template_names_EQ
 : Joined<["-"], "gsimple-template-names=">,
-  Group,
   HelpText<"Use simple template names in DWARF, or include the full "
"template name with a modified prefix for validation">,
-  Values<"simple,mangled">, Flags<[CC1Option]>;
+  Values<"simple,mangled">, Flags<[CC1Option, NoDriverOption]>;
 def gno_simple_template_names : Flag<["-"], "gno-simple-template-names">,
 Group;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group, 
Flags<[CC1Option]>;

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index dc52190cbb377..30a80d38bf205 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1415,9 +1415,8 @@ void CompilerInvocation::GenerateCodeGenArgs(
   if (TNK != codegenoptions::DebugTemplateNamesKind::Full) {
 if (TNK == codegenoptions::DebugTemplateNamesKind::Simple)
   GenerateArg(Args, OPT_gsimple_template_names_EQ, "simple", SA);
-if (TNK == codegenoptions::DebugTemplateNamesKind::Mangled)
+else if (TNK == codegenoptions::DebugTemplateNamesKind::Mangled)
   GenerateArg(Args, OPT_gsimple_template_names_EQ, "mangled", SA);
-
   }
   // ProfileInstrumentUsePath is marshalled automatically, no need to generate
   // it or PGOUseInstrumentor.
@@ -1694,6 +1693,10 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions 
, ArgList ,
 ? llvm::DICompileUnit::DebugNameTableKind::Default
 : llvm::DICompileUnit::DebugNameTableKind::None);
   if (const Arg *A = Args.getLastArg(OPT_gsimple_template_names_EQ)) {
+StringRef Value = A->getValue();
+if (Value != "simple" && Value != "mangled")
+  Diags.Report(diag::err_drv_unsupported_option_argument)
+  << A->getOption().getName() << A->getValue();
 Opts.setDebugSimpleTemplateNames(
 StringRef(A->getValue()) == "simple"
 ? codegenoptions::DebugTemplateNamesKind::Simple

diff  --git a/clang/test/Driver/debug-options.c 
b/clang/test/Driver/debug-options.c
index 5f652cb49b71b..45a577dc7e7a2 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -437,13 +437,9 @@
 // NODIRECTORY: "-fno-dwarf-directory-asm"
 
 // RUN: %clang -### -target x86_64 -c -g -gsimple-template-names %s 2>&1 | 
FileCheck --check-prefix=SIMPLE_TEMP_NAMES %s
-// RUN: %clang -### -target x86_64 -c -g -gsimple-template-names=simple %s 
2>&1 | FileCheck --check-prefix=SIMPLE_TEMP_NAMES %s
 // SIMPLE_TEMP_NAMES: -gsimple-template-names=simple
 // SIMPLE_TEMP_NAMES: -debug-forward-template-params
-// RUN: %clang -### -target x86_64 -c -g -gsimple-template-names=mangled %s 
2>&1 | FileCheck --check-prefix=MANGLED_TEMP_NAMES %s
-// MANGLED_TEMP_NAMES: -gsimple-template-names=mangled
-// MANGLED_TEMP_NAMES: -debug-forward-template-params
+// RUN: not %clang -### -target x86_64 -c -g -gsimple-template-names=mangled 
%s 2>&1 | FileCheck --check-prefix=MANGLED_TEMP_NAMES %s
+// MANGLED_TEMP_NAMES: error: unknown argument: 
'-gsimple-template-names=mangled'
 // RUN: %clang -### -target x86_64 -c -g %s 2>&1 | FileCheck 
--check-prefix=FULL_TEMP_NAMES 
--implicit-check-not=debug-forward-template-params %s
 // FULL_TEMP_NAMES-NOT: -gsimple-template-names
-// RUN: %clang -### -target x86_64 -c -g -gsimple-template-names=other %s 2>&1 
| FileCheck --check-prefix=SIMPLE_TEMP_OTHER %s
-// SIMPLE_TEMP_OTHER: error: unsupported argument 'other' to option 
'gsimple-template-names='




[PATCH] D101868: [clang-format] Adds a formatter for aligning arrays of structs

2021-09-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

There are a number of bugs logged against this feature, are you still around to 
look into them?

https://bugs.llvm.org/show_bug.cgi?id=51926


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101868

___
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-24 Thread Anirudh Prasad via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
anirudhp marked an inline comment as done.
Closed by commit rGe09a1dc47515: [SystemZ][z/OS] Add GOFF Support to the 
DataLayout (authored by anirudhp).

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
@@ -2605,6 +2605,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
-// 

[clang] e09a1dc - [SystemZ][z/OS] Add GOFF Support to the DataLayout

2021-09-24 Thread Anirudh Prasad via cfe-commits

Author: Anirudh Prasad
Date: 2021-09-24T14:09:01-04:00
New Revision: e09a1dc47515d27ba5ca572a225208bb0d79fb3f

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

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

- This patch adds in the GOFF mangling support to the LLVM data layout string. 
A corresponding additional line has been added into the data layout section in 
the language reference documentation.
- Furthermore, this patch also sets the right data layout string for the z/OS 
target in the SystemZ backend.

Reviewed By: uweigand, Kai, abhina.sreeskantharajan, MaskRay

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

Added: 


Modified: 
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

Removed: 




diff  --git a/clang/lib/Basic/Targets/SystemZ.h 
b/clang/lib/Basic/Targets/SystemZ.h
index b749c3f75d188..d3e3ed50dd477 100644
--- a/clang/lib/Basic/Targets/SystemZ.h
+++ b/clang/lib/Basic/Targets/SystemZ.h
@@ -46,7 +46,17 @@ class LLVM_LIBRARY_VISIBILITY SystemZTargetInfo : public 
TargetInfo {
 LongDoubleFormat = ::APFloat::IEEEquad();
 DefaultAlignForAttributeAligned = 64;
 MinGlobalAlign = 16;
-resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64");
+if (Triple.isOSzOS()) {
+  // All vector types are default aligned on an 8-byte boundary, even if 
the
+  // vector facility is not available. That is 
diff erent from Linux.
+  MaxVectorAlign = 64;
+  // Compared to Linux/ELF, the data layout 
diff ers only in some details:
+  // - name mangling is GOFF
+  // - 128 bit vector types are 64 bit aligned
+  resetDataLayout(
+  "E-m:l-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64");
+} else
+  resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64");
 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
 HasStrictFP = true;
   }
@@ -129,7 +139,7 @@ class LLVM_LIBRARY_VISIBILITY SystemZTargetInfo : public 
TargetInfo {
 HasVector &= !SoftFloat;
 
 // If we use the vector ABI, vector types are 64-bit aligned.
-if (HasVector) {
+if (HasVector && !getTriple().isOSzOS()) {
   MaxVectorAlign = 64;
   resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64"
   "-v128:64-a:8:16-n32:64");

diff  --git a/clang/test/CodeGen/target-data.c 
b/clang/test/CodeGen/target-data.c
index 10f35f54b1420..0749493d788f3 100644
--- a/clang/test/CodeGen/target-data.c
+++ b/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 -target-cpu arch9 -o - -emit-llvm %s 
| \
-// RUN: FileCheck %s -check-prefix=SYSTEMZ
-// RUN: %clang_cc1 -triple s390x-unknown -target-cpu zEC12 -o - -emit-llvm %s 
| \
-// RUN: FileCheck %s -check-prefix=SYSTEMZ
-// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch10 -o - -emit-llvm %s 
| \
-// RUN: FileCheck %s -check-prefix=SYSTEMZ
 // RUN: %clang_cc1 -triple s390x-unknown -target-cpu z13 -target-feature 
+soft-float -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=SYSTEMZ
 // SYSTEMZ: target datalayout = 
"E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"
 
 // RUN: %clang_cc1 -triple s390x-unknown -target-cpu z13 -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
-// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch11 -o - -emit-llvm %s 
| \
-// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
-// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z14 -o - -emit-llvm %s | \
-// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
-// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch12 -o - -emit-llvm %s 
| \
-// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
-// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z15 -o - -emit-llvm %s | \
-// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
-// RUN: %clang_cc1 -triple 

[PATCH] D110257: [CFE][Codegen] Do not break the contiguity of static allocas.

2021-09-24 Thread Mahesha S via Phabricator via cfe-commits
hsmhsm added inline comments.



Comment at: clang/lib/CodeGen/CGExpr.cpp:103
+if (!ArraySize) {
+  auto *EBB = AllocaInsertPt->getParent();
+  auto Iter = AllocaInsertPt->getIterator();

rnk wrote:
> hsmhsm wrote:
> > jdoerfert wrote:
> > > arsenm wrote:
> > > > Why is there a special AllocaInsertPt iterator in the first place? Can 
> > > > you avoid any iteration logic by just always inserting at the block 
> > > > start?
> > > Right. The alloca insertion point is sometimes changed to a non-entry 
> > > block, and we should keep that ability.
> > > From all the use cases I know it would suffice to insert at the beginning 
> > > of the alloca insertion point block though.
> > I really do not understand this comment fully.
> > 
> > This block of code here inserts an "addressspace cast" of recently inserted 
> > alloca, not the alloca itself. Alloca is already inserted.  Please look at 
> > the start of this function. 
> > 
> > The old logic (in the left) inserts addressspace cast of recently inserted 
> > alloca immediately after recent alloca using AllocaInsertPt. As a side 
> > effect, it also makes AllocaInsertPt now point to this newly inserted 
> > addressspace cast. Hence, next alloca is inserted after this new 
> > addressspace cast, because now AllocaInsertPt is made to point this newly 
> > inserted addressspace cast.  
> > 
> > The new logic (here) fixes that by moving insertion point just beyond 
> > current AllocaInsertPt without updating AllocaInsertPt.
> > 
> > How can I insert "addressspace cast" of an alloca, at the beginning of the 
> > block even before alloca?
> > 
> > As I understand it, AllocaInsertPt is maintained to insert static allocas 
> > at the start of entry block, otherwise there is no any special reason to 
> > maintain such a special insertion point. Please look at 
> > https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CodeGenFunction.h#L378.
> > 
> > That said, I am not really sure, if I have completely misunderstood the 
> > comment above. If that is the case, then, I need better clarification here 
> > about what really is expected.
> Well, inserting at the top of the entry block would reverse the order of the 
> allocas. Currently they appear in source/IRGen order, which is nice. 
> Maintaining the order requires appending, which requires a cursor of some 
> kind.
Yes, correct. 

And I am waiting for further inputs from @yaxunl / @arsenm / @jdoerfert 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110257

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


[PATCH] D110273: [PowerPC] Fix lharx and lbarx builtin signatures

2021-09-24 Thread Albion Fung via Phabricator via cfe-commits
Conanap updated this revision to Diff 374908.
Conanap added a comment.

Fixed an old test case


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

https://reviews.llvm.org/D110273

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c


Index: clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
===
--- clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
+++ clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
@@ -24,7 +24,7 @@
   return __lharx(a);
 }
 
-char test_lbarx(volatile unsigned char *a) {
+char test_lbarx(volatile char *a) {
   // CHECK-LABEL: @test_lbarx
   // CHECK: %0 = tail call i8 asm sideeffect "lbarx $0, ${1:y}", 
"=r,*Z,~{memory}"(i8* %a)
   // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later 
CPUs
@@ -46,3 +46,18 @@
   // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later 
CPUs
   return __sthcx(a, val);
 }
+
+// extra test cases that previously caused error during usage
+int test_lharx_intret(volatile short *a) {
+  // CHECK-LABEL: @test_lharx_intret
+  // CHECK: %0 = tail call i16 asm sideeffect "lharx $0, ${1:y}", 
"=r,*Z,~{memory}"(i16* %a)
+  // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later 
CPUs
+  return __lharx(a);
+}
+
+int test_lbarx_intret(volatile char *a) {
+  // CHECK-LABEL: @test_lbarx_intret
+  // CHECK: %0 = tail call i8 asm sideeffect "lbarx $0, ${1:y}", 
"=r,*Z,~{memory}"(i8* %a)
+  // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later 
CPUs
+  return __lbarx(a);
+}
Index: clang/include/clang/Basic/BuiltinsPPC.def
===
--- clang/include/clang/Basic/BuiltinsPPC.def
+++ clang/include/clang/Basic/BuiltinsPPC.def
@@ -74,8 +74,8 @@
 BUILTIN(__builtin_ppc_fetch_and_swaplp, "ULiULiD*ULi", "")
 BUILTIN(__builtin_ppc_ldarx, "LiLiD*", "")
 BUILTIN(__builtin_ppc_lwarx, "iiD*", "")
-BUILTIN(__builtin_ppc_lharx, "isD*", "")
-BUILTIN(__builtin_ppc_lbarx, "UiUcD*", "")
+BUILTIN(__builtin_ppc_lharx, "ssD*", "")
+BUILTIN(__builtin_ppc_lbarx, "ccD*", "")
 BUILTIN(__builtin_ppc_stdcx, "iLiD*Li", "")
 BUILTIN(__builtin_ppc_stwcx, "iiD*i", "")
 BUILTIN(__builtin_ppc_sthcx, "isD*s", "")


Index: clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
===
--- clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
+++ clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
@@ -24,7 +24,7 @@
   return __lharx(a);
 }
 
-char test_lbarx(volatile unsigned char *a) {
+char test_lbarx(volatile char *a) {
   // CHECK-LABEL: @test_lbarx
   // CHECK: %0 = tail call i8 asm sideeffect "lbarx $0, ${1:y}", "=r,*Z,~{memory}"(i8* %a)
   // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later CPUs
@@ -46,3 +46,18 @@
   // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later CPUs
   return __sthcx(a, val);
 }
+
+// extra test cases that previously caused error during usage
+int test_lharx_intret(volatile short *a) {
+  // CHECK-LABEL: @test_lharx_intret
+  // CHECK: %0 = tail call i16 asm sideeffect "lharx $0, ${1:y}", "=r,*Z,~{memory}"(i16* %a)
+  // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later CPUs
+  return __lharx(a);
+}
+
+int test_lbarx_intret(volatile char *a) {
+  // CHECK-LABEL: @test_lbarx_intret
+  // CHECK: %0 = tail call i8 asm sideeffect "lbarx $0, ${1:y}", "=r,*Z,~{memory}"(i8* %a)
+  // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later CPUs
+  return __lbarx(a);
+}
Index: clang/include/clang/Basic/BuiltinsPPC.def
===
--- clang/include/clang/Basic/BuiltinsPPC.def
+++ clang/include/clang/Basic/BuiltinsPPC.def
@@ -74,8 +74,8 @@
 BUILTIN(__builtin_ppc_fetch_and_swaplp, "ULiULiD*ULi", "")
 BUILTIN(__builtin_ppc_ldarx, "LiLiD*", "")
 BUILTIN(__builtin_ppc_lwarx, "iiD*", "")
-BUILTIN(__builtin_ppc_lharx, "isD*", "")
-BUILTIN(__builtin_ppc_lbarx, "UiUcD*", "")
+BUILTIN(__builtin_ppc_lharx, "ssD*", "")
+BUILTIN(__builtin_ppc_lbarx, "ccD*", "")
 BUILTIN(__builtin_ppc_stdcx, "iLiD*Li", "")
 BUILTIN(__builtin_ppc_stwcx, "iiD*i", "")
 BUILTIN(__builtin_ppc_sthcx, "isD*s", "")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109557: Adds a BreakBeforeClosingParen option

2021-09-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

FYI, this is a very aggressive change, I highly recommend you run this over a 
large code base before landing. to double check, here is one slight oddity 
which I cannot determine if its correct or not.

  void foo() {
  if (quitelongarg != (alsolongarg - 1)) { // ABC is a very 
long comment
return;
  }
  }

becomes

  void foo() {
if (quitelongarg != (alsolongarg - 1)
) { // ABC is a very long comment
  return;
}
  }



  BasedOnStyle: LLVM
  BreakBeforeClosingParen: true

That might be what you expect but I wasn't quite sure


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109557

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


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

2021-09-24 Thread Albion Fung via Phabricator via cfe-commits
Conanap updated this revision to Diff 374906.
Conanap added a comment.

This modifies a test case introduced in this commit: 
https://github.com/llvm/llvm-project/commit/3678df5ae6618eec656ae0ea0dab3be09d73bc9a


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:xscvdpuxws v2, v2
+; CHECK-P8-NEXT:xscvdpuxws 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:xscvdpuxws v3, v2
+; CHECK-P9-NEXT:xscvdpuxws 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:xscvdpuxws v3, v2
+; CHECK-BE-NEXT:xscvdpuxws 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
===
--- llvm/test/CodeGen/PowerPC/test-vector-insert.ll
+++ llvm/test/CodeGen/PowerPC/test-vector-insert.ll
@@ -38,20 +38,16 @@
 ;
 ; CHECK-LE-P8-LABEL: test:
 ; CHECK-LE-P8:   # %bb.0: # %entry
-; CHECK-LE-P8-NEXT:xscvdpsxws f0, f1
+; CHECK-LE-P8-NEXT:xscvdpsxws v3, f1
 ; CHECK-LE-P8-NEXT:addis r3, r2, .LCPI0_0@toc@ha
 ; CHECK-LE-P8-NEXT:addi r3, r3, .LCPI0_0@toc@l
-; CHECK-LE-P8-NEXT:lvx v3, 0, r3
-; CHECK-LE-P8-NEXT:mffprwz r4, f0
-; CHECK-LE-P8-NEXT:mtvsrwz v4, r4
-; CHECK-LE-P8-NEXT:vperm v2, v4, v2, v3
+; CHECK-LE-P8-NEXT:lvx v4, 0, r3
+; CHECK-LE-P8-NEXT:vperm v2, v3, v2, v4
 ; CHECK-LE-P8-NEXT:blr
 ;
 ; CHECK-LE-P9-LABEL: test:
 ; CHECK-LE-P9:   # %bb.0: # %entry
 ; CHECK-LE-P9-NEXT:xscvdpsxws f0, f1
-; CHECK-LE-P9-NEXT:mffprwz r3, f0
-; CHECK-LE-P9-NEXT:mtfprwz f0, r3
 ; CHECK-LE-P9-NEXT:xxinsertw v2, vs0, 0
 ; CHECK-LE-P9-NEXT:blr
 ;
@@ -70,9 +66,7 @@
 ;
 ; CHECK-BE-P8-LABEL: test:
 ; CHECK-BE-P8:   # %bb.0: 

[PATCH] D109541: Increase expected line number for ExtDebugInfo.cpp

2021-09-24 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added a comment.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109541

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


[PATCH] D110422: [AIX] Enable PGO without LTO

2021-09-24 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

> In other binary formats the first weak definition is selected and other weak 
> definitions are discarded.
> Do you mean that AIX ld doesn't pick the first weak definition?

No. I think this is exactly what is causing problem here.

eg: if we have two weak symbols (weak_func), and we generate the weak 
counter/data as usual:

  __llvm_prf_cnts:
  
  __profc_weak_func(1):
  
  __profc_weak_func(2):
  
  __llvm_prf_data:
  
  __profd_weak func(1):
  
  Pos_Rel __profc_weak_func  <=== Relocation to calculate the relative pointer
  
  __profd_weak_func(2):
  
  Pos_Rel __profc_weak_func  <=== Relocation to calculate the relative pointer

The relative pointer calculation in __profd_weak_fun will be wrong after 
linking.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

___
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-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In D110128#3020468 , @nemanjai wrote:

> In D110128#3018992 , @phosek wrote:
>
>> @MaskRay Do you think we should gate the use of this feature on 
>> `-fbinutils-version=` or `-fuse-ld=lld`? It'd be nice if the owner of 
>> `clang-ppc64le-rhel` builder could update the binutils version but I'm not 
>> sure how feasible is it.
>
> We certainly don't mind updating binutils to a supported version. However, if 
> a specific version of binutils (or really any other software package) is 
> required by Clang/LLVM, that should be documented at 
> https://llvm.org/docs/GettingStarted.html#software
>
> Of course, if our bot has a version of binutils that is older than the one 
> listed there currently, we will be sure to update it ASAP.
>
> But of course, as @MaskRay pointed out, this may not be an issue.

Thanks for reaching out @nemanjai, I assume you're responsible for this 
builder? Do you know what version of Binutils is currently installed on that 
machine? Is newer version available for RHEL 7?

We don't specify Binutils version on https://llvm.org/docs/GettingStarted.html 
but I think we should. We need to determine that baseline first though. It 
looks like 2.25 roughly corresponds to GCC 5.1 which is the minimum requirement 
for the compiler.


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] D110386: [clangd] Refactor IncludeStructure: use File (unsigned) for most computations

2021-09-24 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

Just nits left really.

In D110386#3020890 , @tschuett wrote:

> Do you want to wrap the `unsigned` in a struct to make it slightly safer, but 
> more complicated to use?

I like this idea, though it's probably not a huge deal either way.
(I marginally prefer `enum class HeaderID : unsigned {};` over a struct, but 
it's basically the same thing)




Comment at: clang-tools-extra/clangd/CodeComplete.cpp:1382
   llvm::StringMap ProxSources;
-  for (auto  : Includes.includeDepth(
-   SM.getFileEntryForID(SM.getMainFileID())->getName())) {
-auto  = ProxSources[Entry.getKey()];
-Source.Cost = Entry.getValue() * ProxOpts.IncludeCost;
-// Symbols near our transitive includes are good, but only consider
-// things in the same directory or below it. Otherwise there can be
-// many false positives.
-if (Entry.getValue() > 0)
-  Source.MaxUpTraversals = 1;
+  auto IncludeStructureID =
+  Includes.getID(SM.getFileEntryForID(SM.getMainFileID()));

this isn't the ID of the include structure, it's the ID of the main file



Comment at: clang-tools-extra/clangd/CodeComplete.cpp:1383
+  auto IncludeStructureID =
+  Includes.getID(SM.getFileEntryForID(SM.getMainFileID()));
+  if (IncludeStructureID) {

IncludeStructure is mutable here, I think it'd be safe to getOrCreate here.

Alternatively, make this infallible having IncludeStructure record the HeaderID 
for the main file in its constructor, and just use Includes.Root here.

Either way, I'd rather not deal with `Expected<>` error handling at runtime if 
we can define this error away.



Comment at: clang-tools-extra/clangd/Headers.h:116
 public:
-  std::vector MainFileIncludes;
+  // Identifying files in a way that persists from preamble build to subsequent
+  // builds is surprisingly hard. FileID is unavailable in 
InclusionDirective(),

As mentioned offline, this is an implementation comment, but it doesn't say 
*what the HeaderID is*.

Suggest something like:
```
HeaderID identifies file in the include graph.
It corresponds to a FileEntry rather than a FileID, but stays stable across 
preamble & main file builds.
```

I'd move this impl comment back down to the private StringMap, but it could 
also follow the description.



Comment at: clang-tools-extra/clangd/Headers.h:119
+  // and RealPathName and UniqueID are not preserved in the preamble.
+  // We use the FileEntry::Name, which is stable, interned into a "file index".
+  // HeaderID is mapping the FileEntry::Name to the internal representation:

comment still refers to "file index" as if it were introducing a term we use 
elsewhere



Comment at: clang-tools-extra/clangd/Headers.h:125
+
+  llvm::Expected getID(const FileEntry *Entry) const;
+  HeaderID getOrCreateID(const FileEntry *Entry);

I think this can be Optional rather than Expected - much more lightweight.



Comment at: clang-tools-extra/clangd/Headers.h:129
+  StringRef getRealPath(HeaderID ID) const {
+return ID < RealPathNames.size() ? RealPathNames[ID] : StringRef();
+  }

this should be an assertion (or just leave that up to the vector) - passing an 
out-of-range HeaderID is invalid



Comment at: clang-tools-extra/clangd/Headers.h:138
   // Root --> 0, #included file --> 1, etc.
   // Root is clang's name for a file, which may not be absolute.
+  // Usually it should be

comment is out of date



Comment at: clang-tools-extra/clangd/Headers.h:140
+  // Usually it should be
+  // getFile(SM.getFileEntryForID(SM.getMainFileID())->getName()).
+  llvm::DenseMap includeDepth(HeaderID Root) const;

getName() is not right here.
(Hopefully the example will fit on the "Usually" line when fixed?)




Comment at: clang-tools-extra/clangd/Headers.h:144
+  // This updates IncludeChildren, but not MainFileIncludes.
+  void recordInclude(HeaderID Including, HeaderID Included);
+

we don't need this method if IncludeChildren is exposed, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110386

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


[PATCH] D110431: Explicitly specify -fintegrated-as to clang/test/Driver/compilation_database.c test case.

2021-09-24 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM (without the integrated assembler there will be an assembler invocation in 
the compilation database that actually produces the `.o` instead of the clang 
invocation we are looking for)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110431

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


[PATCH] D110432: [clang-format][docs] mark new clang-format configuration options based on which version they would GA

2021-09-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

This is just a very rough idea, feel free to pull it apart.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110432

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


[PATCH] D110432: [clang-format][docs] mark new clang-format configuration options based on which version they would GA

2021-09-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: HazardyKnusperkeks, curdeius, krasimir.
MyDeveloperDay added projects: clang, clang-format.
MyDeveloperDay requested review of this revision.

Sometimes I see people unsure about which versions they can use in clang-format 
because https://clang.llvm.org/docs/ClangFormatStyleOptions.html points to the 
latest and greatest versions.

The reality is this says its version 13.0, but actually anything we add now, 
will not be in 13.0 GA but instead 14.0 GA (as 13.0 has already been branched 
(perhaps really the trunk should get relabelled as soon as the branch is made)

How about we introduce some nomenclature to the Format.h so that we can mark 
which options in the documentation were introduced for which version? If this 
seems appealing I'm happing to start going back over the older releases and 
marking the versions for each option.

F19212632: image.png 

F19212564: image.png 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110432

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/docs/tools/dump_format_style.py
  clang/include/clang/Format/Format.h

Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -1862,7 +1862,7 @@
   /// \warning
   ///  ``QualifierAlignment`` COULD lead to incorrect code generation.
   /// \endwarning
-  QualifierAlignmentStyle QualifierAlignment;
+  QualifierAlignmentStyle QualifierAlignment /*version=14.0.0*/;
 
   /// The Order in which the qualifiers appear.
   /// Order is a an array can contain any of the following
@@ -1882,7 +1882,7 @@
   /// \code{.yaml}
   ///   QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile' ]
   /// \endcode
-  std::vector QualifierOrder;
+  std::vector QualifierOrder /*version=14.0.0*/;
 
   /// Different ways to break inheritance list.
   enum BreakInheritanceListStyle : unsigned char {
Index: clang/docs/tools/dump_format_style.py
===
--- clang/docs/tools/dump_format_style.py
+++ clang/docs/tools/dump_format_style.py
@@ -87,15 +87,20 @@
   return indent + s
 
 class Option(object):
-  def __init__(self, name, type, comment):
+  def __init__(self, name, type, comment, version):
 self.name = name
 self.type = type
 self.comment = comment.strip()
 self.enum = None
 self.nested_struct = None
+self.version = version
 
   def __str__(self):
-s = '**%s** (``%s``)\n%s' % (self.name, to_yaml_type(self.type),
+if self.version:
+  s = '**%s** (``%s``) :versionbadge:`clang-format %s`\n%s' % (self.name, to_yaml_type(self.type), self.version,
+ doxygen2rst(indent(self.comment, 2)))
+else:
+  s = '**%s** (``%s``)\n%s' % (self.name, to_yaml_type(self.type),
  doxygen2rst(indent(self.comment, 2)))
 if self.enum and self.enum.values:
   s += indent('\n\nPossible values:\n\n%s\n' % self.enum, 2)
@@ -173,6 +178,14 @@
   if endcode_match:
 return ''
 
+  match = re.match(r'^/// \\version$', line)
+  if match:
+return '\n.. badge:: \n\n'
+
+  endversion_match = re.match(r'^/// +\\endversion$', line)
+  if endversion_match:
+return ''
+
   match = re.match(r'^/// \\warning$', line)
   if match:
 return '\n.. warning:: \n\n'
@@ -220,9 +233,9 @@
 nested_struct = NestedStruct(name, comment)
   elif line.endswith(';'):
 state = State.InStruct
-field_type, field_name = re.match(r'([<>:\w(,\s)]+)\s+(\w+);',
+field_type, field_name, trailcomment, version = re.match(r'([<>:\w(,\s)]+)\s+(\w+)\s*(\/\*version=([0-9.]*)\*\/)*;',
   line).groups()
-option = Option(str(field_name), str(field_type), comment)
+option = Option(str(field_name), str(field_type), comment, version)
 options.append(option)
   else:
 raise Exception('Invalid format, expected comment, field or enum')
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -1,3 +1,11 @@
+.. raw:: html
+
+  
+.versionbadge { background-color: #1c913d; height: 20px; display: inline-block; width: 130px; text-align: center; border-radius: 5px; color: #FF; font-family="Verdana,Geneva,DejaVu Sans,sans-serif" }
+  
+
+.. role:: versionbadge
+
 ==
 Clang-Format Style Options
 ==
@@ -3225,7 +3233,7 @@
 
 
 
-**QualifierAlignment** (``QualifierAlignmentStyle``)
+**QualifierAlignment** (``QualifierAlignmentStyle``) :versionbadge:`clang-format 14.0.0`
   Different ways to arrange const/volatile qualifiers.
 
   

[clang] e8e2edd - Fix test from 8dd42f, capitalization in test

2021-09-24 Thread Erich Keane via cfe-commits

Author: Erich Keane
Date: 2021-09-24T10:24:32-07:00
New Revision: e8e2edd8ca88f8b0a7dba141349b2aa83284f3af

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

LOG: Fix test from 8dd42f, capitalization in test

Added: 


Modified: 
clang/test/CXX/drs/dr17xx.cpp

Removed: 




diff  --git a/clang/test/CXX/drs/dr17xx.cpp b/clang/test/CXX/drs/dr17xx.cpp
index 42303c83ae3c..c8648908ebda 100644
--- a/clang/test/CXX/drs/dr17xx.cpp
+++ b/clang/test/CXX/drs/dr17xx.cpp
@@ -129,7 +129,7 @@ namespace dr1778 { // dr1778: 9
 namespace dr1762 { // dr1762: 14
 #if __cplusplus >= 201103L
   float operator ""_E(const char *);
-  // expected-error@+2 {{invalid suffix on literal; c++11 requires a space 
between literal and identifier}}
+  // expected-error@+2 {{invalid suffix on literal; C++11 requires a space 
between literal and identifier}}
   // expected-warning@+1 {{user-defined literal suffixes not starting with '_' 
are reserved; no literal will invoke this operator}}
   float operator ""E(const char *);
 #endif



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


[clang] 77d200a - Add test for DR1307, which we have already implemented.

2021-09-24 Thread Erich Keane via cfe-commits

Author: Erich Keane
Date: 2021-09-24T10:24:32-07:00
New Revision: 77d200a546136c2855063613ff4bca1f682fb23a

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

LOG: Add test for DR1307, which we have already implemented.

Also regenerated cxx_dr_status.html

Added: 


Modified: 
clang/test/CXX/drs/dr13xx.cpp
clang/www/cxx_dr_status.html

Removed: 




diff  --git a/clang/test/CXX/drs/dr13xx.cpp b/clang/test/CXX/drs/dr13xx.cpp
index 2373a3967ddc..cf7091a533b5 100644
--- a/clang/test/CXX/drs/dr13xx.cpp
+++ b/clang/test/CXX/drs/dr13xx.cpp
@@ -324,7 +324,7 @@ namespace dr1388 { // dr1388: 4
   template void g(T..., int); // expected-note 1+{{candidate}} 
expected-error 0-1{{C++11}}
   template void h(T..., A); // expected-note 
1+{{candidate}} expected-error 0-1{{C++11}}
 
-  void test_f() { 
+  void test_f() {
 f(0); // ok, trailing parameter pack deduced to empty
 f(0, 0); // expected-error {{no matching}}
 f(0);
@@ -448,3 +448,15 @@ namespace dr1399 { // dr1399: dup 1388
 f(0, 0, 0); // expected-error {{no match}}
   }
 }
+
+namespace dr1307 { // dr1307: 14
+#if __cplusplus >= 201103L
+void f(int const (&)[2]);
+void f(int const (&)[3]);
+
+void caller() {
+  // This should not be ambiguous, the 2nd overload is better.
+  f({1, 2, 3});
+}
+#endif // __cplusplus >= 201103L
+} // namespace dr1307

diff  --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 510c0d59203d..462b335f7801 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -7656,7 +7656,7 @@ C++ defect report implementation 
status
 https://wg21.link/cwg1307;>1307
 C++14
 Overload resolution based on size of array initializer-list
-Unknown
+Clang 14
   
   
 https://wg21.link/cwg1308;>1308



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


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

2021-09-24 Thread Saiyedul Islam via Phabricator via cfe-commits
saiislam updated this revision to Diff 374897.
saiislam marked an inline comment as done.
saiislam added a comment.

Added nvptx test cases, simplified amdgpu test case, modified commit message.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105191

Files:
  clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/test/Driver/Inputs/openmp_static_device_link/libFatArchive.a
  clang/test/Driver/fat_archive_amdgpu.cpp
  clang/test/Driver/fat_archive_nvptx.cpp
  clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp

Index: clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
===
--- clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -180,6 +180,28 @@
   }
 };
 
+static StringRef getDeviceFileExtension(StringRef Device) {
+  if (Device.contains("gfx"))
+return ".bc";
+  if (Device.contains("sm_"))
+return ".cubin";
+
+  WithColor::warning() << "Could not determine extension for archive"
+  "members, using \".o\"\n";
+  return ".o";
+}
+
+static std::string getDeviceLibraryFileName(StringRef BundleFileName,
+StringRef Device) {
+  StringRef LibName = sys::path::stem(BundleFileName);
+  StringRef Extension = getDeviceFileExtension(Device);
+
+  std::string Result;
+  Result += LibName;
+  Result += Extension;
+  return Result;
+}
+
 /// Generic file handler interface.
 class FileHandler {
 public:
@@ -1229,7 +1251,9 @@
   BundledObjectFileName.assign(BundledObjectFile);
   auto OutputBundleName =
   Twine(llvm::sys::path::stem(BundledObjectFileName) + "-" +
-CodeObject)
+CodeObject +
+getDeviceLibraryFileName(BundledObjectFileName,
+ CodeObjectInfo.GPUArch))
   .str();
   // Replace ':' in optional target feature list with '_' to ensure
   // cross-platform validity.
Index: clang/test/Driver/fat_archive_nvptx.cpp
===
--- /dev/null
+++ clang/test/Driver/fat_archive_nvptx.cpp
@@ -0,0 +1,81 @@
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: nvptx-registered-target
+
+// See the steps to create a fat archive are given at the end of the file.
+
+// Given a FatArchive, clang-offload-bundler should be called to create a
+// device specific archive, which should be passed to clang-nvlink-wrapper.
+// RUN: %clang -O2 -### -fopenmp -fopenmp-targets=nvptx64 %s -L%S/Inputs/hip_dev_lib -lFatArchive 2>&1 | FileCheck %s
+// CHECK: clang{{.*}}"-cc1"{{.*}}"-triple" "nvptx64"{{.*}}"-target-cpu" "[[GPU:sm_[0-9]+]]"{{.*}}"-o" "[[HOSTBC:.*.s]]" "-x" "c++"{{.*}}.cpp
+// CHECK: clang-offload-bundler" "-unbundle" "-type=a" "-inputs={{.*}}/Inputs/hip_dev_lib/libFatArchive.a" "-targets=openmp-nvptx64-[[GPU]]" "-outputs=[[DEVICESPECIFICARCHIVE:.*.a]]" "-allow-missing-bundles"
+// CHECK: clang-nvlink-wrapper{{.*}}"-o" "{{.*}}.out" "-arch" "[[GPU]]" "{{.*}}[[DEVICESPECIFICARCHIVE]]"
+// CHECK: ld"{{.*}}" "-L{{.*}}/Inputs/hip_dev_lib" "{{.*}} "-lFatArchive" "{{.*}}" "-lomp{{.*}}-lomptarget"
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+
+#define N 10
+
+#pragma omp declare target
+// Functions defined in Fat Archive.
+extern "C" void func_present(float *, float *, unsigned);
+
+#ifdef MISSING
+// Function not defined in the fat archive.
+extern "C" void func_missing(float *, float *, unsigned);
+#endif
+
+#pragma omp end declare target
+
+int main() {
+  float in[N], out[N], sum = 0;
+  unsigned i;
+
+#pragma omp parallel for
+  for (i = 0; i < N; ++i) {
+in[i] = i;
+  }
+
+  func_present(in, out, N); // Returns out[i] = a[i] * 0
+
+#ifdef MISSING
+  func_missing(in, out, N); // Should throw an error here
+#endif
+
+#pragma omp parallel for reduction(+ \
+   : sum)
+  for (i = 0; i < N; ++i)
+sum += out[i];
+
+  if (!sum)
+return 0;
+  return sum;
+}
+
+#endif
+
+/***
+   Steps to create Fat Archive (libFatArchive.a)
+
+* File: func_1.c ***
+void func_present(float* in, float* out, unsigned n){
+  unsigned i;
+  #pragma omp target teams distribute parallel for map(to: in[0:n]) map(from: out[0:n])
+  for(i=0; i&1 | FileCheck %s
+// CHECK: clang{{.*}}"-cc1"{{.*}}"-triple" "amdgcn-amd-amdhsa"{{.*}}"-emit-llvm-bc"{{.*}}"-target-cpu" "[[GPU:gfx[0-9]+]]"{{.*}}"-o" "[[HOSTBC:.*.bc]]" "-x" "c++"{{.*}}.cpp
+// CHECK: clang-offload-bundler" "-unbundle" 

[PATCH] D110422: [AIX] Enable PGO without LTO

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

> we can NOT guarantee that the relocations get resolved to the intended weak 
> symbol, so we can not ensure the correctness of the relative CounterPtr, so 
> we have to use private linkage for counter and data symbols.

In other binary formats the first weak definition is selected and other weak 
definitions are discarded.
Do you mean that AIX ld doesn't pick the first weak definition?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D110304: [HIP] Fix linking of asanrt.bc

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



Comment at: clang/lib/Driver/ToolChains/HIP.cpp:413
   } else
-BCLibs.push_back(AsanRTL.str());
+BCLibs.push_back({AsanRTL.str(), false});
 }

tra wrote:
> Nit: I'd add `/*ShouldInternalize=*/`
will do when committing


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

https://reviews.llvm.org/D110304

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


[PATCH] D108370: [clang-tidy] Fix wrong FixIt about union in cppcoreguidelines-pro-type-member-init

2021-09-24 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

In D108370#3020793 , @Sockke wrote:

> In D108370#3017800 , @aaron.ballman 
> wrote:
>
>> LGTM!
>
> Thanks for your review! I don't have commit access, here is my information:
> Name: liuke
> Email: liuke.ge...@bytedance.com

Thanks! I've commit on your behalf in e4902480f1e2f12f73c2b504e3d717536653dd7b 
.


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

https://reviews.llvm.org/D108370

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


[clang-tools-extra] e490248 - Fix wrong FixIt about union in cppcoreguidelines-pro-type-member-init

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

Author: liuke
Date: 2021-09-24T13:15:21-04:00
New Revision: e4902480f1e2f12f73c2b504e3d717536653dd7b

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

LOG: Fix wrong FixIt about union in cppcoreguidelines-pro-type-member-init

At most one variant member of a union may have a default member
initializer. The case of anonymous records with multiple levels of
nesting like the following also needs to meet this rule. The original
logic is to horizontally obtain all the member variables in a record
that need to be initialized and then filter to the variables that need
to be fixed. Obviously, it is impossible to correctly initialize the
desired variables according to the nesting relationship.

See Example 3 in class.union

union U {
  U() {}
  int x;  // int x{};
  union {
int k;  // int k{};  <==  wrong fix
  };
  union {
int z;  // int z{};  <== wrong fix
int y;
  };
};

Added: 


Modified: 
clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp

clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp 
b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
index a191598415217..0c220e865ff48 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -44,6 +44,23 @@ void forEachField(const RecordDecl , const T , 
Func &) {
   }
 }
 
+template 
+void forEachFieldWithFilter(const RecordDecl , const T ,
+bool , Func &) {
+  for (const FieldDecl *F : Fields) {
+if (F->isAnonymousStructOrUnion()) {
+  if (const CXXRecordDecl *R = F->getType()->getAsCXXRecordDecl()) {
+AnyMemberHasInitPerUnion = false;
+forEachFieldWithFilter(*R, R->fields(), AnyMemberHasInitPerUnion, Fn);
+  }
+} else {
+  Fn(F);
+}
+if (Record.isUnion() && AnyMemberHasInitPerUnion)
+  break;
+  }
+}
+
 void removeFieldsInitializedInBody(
 const Stmt , ASTContext ,
 SmallPtrSetImpl ) {
@@ -461,8 +478,9 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
   // Collect all fields but only suggest a fix for the first member of unions,
   // as initializing more than one union member is an error.
   SmallPtrSet FieldsToFix;
-  SmallPtrSet UnionsSeen;
-  forEachField(ClassDecl, OrderedFields, [&](const FieldDecl *F) {
+  bool AnyMemberHasInitPerUnion = false;
+  forEachFieldWithFilter(ClassDecl, ClassDecl.fields(),
+ AnyMemberHasInitPerUnion, [&](const FieldDecl *F) {
 if (!FieldsToInit.count(F))
   return;
 // Don't suggest fixes for enums because we don't know a good default.
@@ -471,8 +489,8 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
 if (F->getType()->isEnumeralType() ||
 (!getLangOpts().CPlusPlus20 && F->isBitField()))
   return;
-if (!F->getParent()->isUnion() || UnionsSeen.insert(F->getParent()).second)
-  FieldsToFix.insert(F);
+FieldsToFix.insert(F);
+AnyMemberHasInitPerUnion = true;
   });
   if (FieldsToFix.empty())
 return;

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp
index 8cab4fd755752..677f3a100a16f 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp
@@ -516,3 +516,39 @@ struct PositiveDefaultConstructorOutOfDecl {
 
 PositiveDefaultConstructorOutOfDecl::PositiveDefaultConstructorOutOfDecl() = 
default;
 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: constructor does not initialize 
these fields: F
+
+union U1 {
+  U1() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: union constructor should 
initialize one of these fields: X, K, Z, Y
+  int X;
+  // CHECK-FIXES: int X{};
+  union {
+int K;
+// CHECK-FIXES-NOT: int K{};
+  };
+  union {
+int Z;
+// CHECK-FIXES-NOT: int Z{};
+int Y;
+// CHECK-FIXES-NOT: int Y{};
+  };
+};
+
+union U2 {
+  U2() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: union constructor should 
initialize one of these fields: B, C, A
+  struct {
+int B;
+// CHECK-FIXES: int B{};
+union {
+  struct {
+PositiveMultipleConstructors Value;
+// CHECK-FIXES-NOT: PositiveMultipleConstructors Value{};
+  };
+  int C;
+  // CHECK-FIXES: int C{};
+};
+  };
+  int A;
+  // CHECK-FIXES-NOT: int A{};
+};



___

[PATCH] D110431: Explicitly specify -fintegrated-as to clang/test/Driver/compilation_database.c test case.

2021-09-24 Thread Amy Kwan via Phabricator via cfe-commits
amyk created this revision.
amyk added reviewers: hubert.reinterpretcast, daltenty, sammccall.
amyk added a project: clang.
amyk requested review of this revision.

It appears that this test assumes that the toolchain utilizes the integrated 
assembler by default, 
since the expected output in the CHECKs are `compilation_database.o`.

However, this test fails on AIX as AIX does not utilize the integrated 
assembler. On AIX, the output
instead is of the form `/tmp/compilation_database-*.s`. Thus, this patch 
explicitly adds the 
`-fintegrated-as` option to match the assumption that the integrated assembler 
is used by default.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110431

Files:
  clang/test/Driver/compilation_database.c


Index: clang/test/Driver/compilation_database.c
===
--- clang/test/Driver/compilation_database.c
+++ clang/test/Driver/compilation_database.c
@@ -1,9 +1,9 @@
 // RUN: mkdir -p %t.workdir && cd %t.workdir
-// RUN: %clang -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - 
-no-canonical-prefixes 2>&1 | FileCheck %s
+// RUN: %clang -fintegrated-as -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s 
-Wall -MJ - -no-canonical-prefixes 2>&1 | FileCheck %s
 // RUN: not %clang -c -x c %s -MJ %s/non-existant -no-canonical-prefixes 2>&1 
| FileCheck --check-prefix=ERROR %s
 
-// CHECK: { "directory": "{{[^"]*}}workdir",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
-// CHECK: { "directory": "{{.*}}",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
+// CHECK: { "directory": "{{[^"]*}}workdir",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", 
"[[SRC]]", "-fintegrated-as", "--sysroot=somewhere", "-c", "-Wall",{{.*}} 
"--target={{[^"]+}}"]},
+// CHECK: { "directory": "{{.*}}",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", 
"[[SRC]]", "-fintegrated-as", "--sysroot=somewhere", "-c", "-Wall",{{.*}} 
"--target={{[^"]+}}"]},
 // ERROR: error: compilation database '{{.*}}/non-existant' could not be 
opened:
 
 int main(void) {


Index: clang/test/Driver/compilation_database.c
===
--- clang/test/Driver/compilation_database.c
+++ clang/test/Driver/compilation_database.c
@@ -1,9 +1,9 @@
 // RUN: mkdir -p %t.workdir && cd %t.workdir
-// RUN: %clang -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - -no-canonical-prefixes 2>&1 | FileCheck %s
+// RUN: %clang -fintegrated-as -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - -no-canonical-prefixes 2>&1 | FileCheck %s
 // RUN: not %clang -c -x c %s -MJ %s/non-existant -no-canonical-prefixes 2>&1 | FileCheck --check-prefix=ERROR %s
 
-// CHECK: { "directory": "{{[^"]*}}workdir",  "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", "[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
-// CHECK: { "directory": "{{.*}}",  "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", "[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
+// CHECK: { "directory": "{{[^"]*}}workdir",  "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", "[[SRC]]", "-fintegrated-as", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
+// CHECK: { "directory": "{{.*}}",  "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", "[[SRC]]", "-fintegrated-as", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
 // ERROR: error: compilation database '{{.*}}/non-existant' could not be opened:
 
 int main(void) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110429: [OpenMP] Introduce a new worksharing RTL function for distribute

2021-09-24 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, tianshilei1992.
Herald added subscribers: guansong, yaxunl.
jhuber6 requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, sstefan1.
Herald added projects: clang, LLVM.

This patch adds a new RTL function for worksharing. Currently we use
`__kmpc_for_static_init` for both the `distribute` and `parallel`
portion of the loop clause. This patch replaces the `distribute` portion
with a new runtime call `__kmpc_distribute_static_init`. Currently this
will be used exactly the same way, but will make it easier in the future
to fine-tune the distribute and parallel portion of the loop.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110429

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_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_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_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/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.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_target_teams_distribute_simd_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_collapse_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_collapse_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_private_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_proc_bind_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_private_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_reduction_codegen.cpp
  clang/test/OpenMP/teams_distribute_codegen.cpp
  clang/test/OpenMP/teams_distribute_collapse_codegen.cpp
  clang/test/OpenMP/teams_distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/teams_distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_collapse_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_copyin_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_dist_schedule_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp
  

[PATCH] D110422: [AIX] Enable PGO without LTO

2021-09-24 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added inline comments.



Comment at: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp:869
+  // symbol, so we can not ensure the correctness of the relative CounterPtr, 
so
+  // we have to use private linkage for counter and data symbols.
+  if (TT.isOSBinFormatXCOFF()) {

jsji wrote:
> MaskRay wrote:
> > Then you can just keep the existing weak symbols.
> > 
> > The weak symbols will not be selected due to linker semantics.
> Not sure what you meant? 
To be clear, keeping the weak linkage is causing issues in our test, and we 
investigate the problem , together with AIX binder owner, and it is the 
limitation in binder support that we can't ensure the relocation getting 
resolved to the intended weak symbol. So this is what we can do right now for 
enabling PGO.

We may be able to lift it this limitation later if binder get updated and do 
what we want, but this is limitation for now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D108823: [PowerPC] Mark splat immediate instructions as rematerializable

2021-09-24 Thread Victor Huang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6e1aaf18af6c: [PowerPC] Mark splat immediate instructions as 
rematerializable (authored by NeHuang).

Changed prior to commit:
  https://reviews.llvm.org/D108823?vs=369101=374892#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108823

Files:
  llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
  llvm/lib/Target/PowerPC/PPCInstrPrefix.td
  llvm/test/CodeGen/PowerPC/constant-pool.ll
  llvm/test/CodeGen/PowerPC/p10-spill-crun.ll
  llvm/test/CodeGen/PowerPC/p10-splatImm.ll

Index: llvm/test/CodeGen/PowerPC/p10-splatImm.ll
===
--- llvm/test/CodeGen/PowerPC/p10-splatImm.ll
+++ llvm/test/CodeGen/PowerPC/p10-splatImm.ll
@@ -249,7 +249,6 @@
 ; CHECK-LABEL: testFloatScalar:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:xxspltidp vs1, 1135290941
-; CHECK-NEXT:# kill: def $f1 killed $f1 killed $vsl1
 ; CHECK-NEXT:blr
 
 entry:
@@ -270,7 +269,6 @@
 ; CHECK-LABEL: testDoubleRepresentableScalar:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:xxspltidp vs1, 1135290941
-; CHECK-NEXT:# kill: def $f1 killed $f1 killed $vsl1
 ; CHECK-NEXT:blr
 
 entry:
Index: llvm/test/CodeGen/PowerPC/p10-spill-crun.ll
===
--- llvm/test/CodeGen/PowerPC/p10-spill-crun.ll
+++ llvm/test/CodeGen/PowerPC/p10-spill-crun.ll
@@ -35,8 +35,7 @@
 
 define dso_local void @P10_Spill_CR_UN(%2* %arg, %1* %arg1, i32 %arg2) local_unnamed_addr {
 ; CHECK-LABEL: P10_Spill_CR_UN:
-; CHECK: .localentry P10_Spill_CR_UN, 1
-; CHECK-NEXT:  # %bb.0: # %bb
+; CHECK:   # %bb.0: # %bb
 ; CHECK-NEXT:mflr r0
 ; CHECK-NEXT:mfcr r12
 ; CHECK-NEXT:std r0, 16(r1)
@@ -146,19 +145,19 @@
 ; CHECK-NEXT:# implicit-def: $r3
 ; CHECK-NEXT:  .LBB0_15: # %bb50
 ; CHECK-NEXT:li r4, 0
-; CHECK-NEXT:xxspltidp vs3, -1082130432
 ; CHECK-NEXT:extsh r9, r3
 ; CHECK-NEXT:extsw r6, r28
 ; CHECK-NEXT:li r5, 0
+; CHECK-NEXT:xxspltidp vs3, -1082130432
+; CHECK-NEXT:xxspltidp vs4, -1082130432
 ; CHECK-NEXT:std r30, 104(r1)
 ; CHECK-NEXT:std r29, 96(r1)
 ; CHECK-NEXT:li r7, 0
 ; CHECK-NEXT:li r8, 0
 ; CHECK-NEXT:li r10, 0
-; CHECK-NEXT:fmr f4, f3
-; CHECK-NEXT:xxlxor f1, f1, f1
 ; CHECK-NEXT:std r4, 152(r1)
 ; CHECK-NEXT:li r4, -1
+; CHECK-NEXT:xxlxor f1, f1, f1
 ; CHECK-NEXT:std r4, 112(r1)
 ; CHECK-NEXT:li r4, 1024
 ; CHECK-NEXT:bl call_4@notoc
@@ -304,19 +303,19 @@
 ; CHECK-BE-NEXT:# implicit-def: $r3
 ; CHECK-BE-NEXT:  .LBB0_15: # %bb50
 ; CHECK-BE-NEXT:li r4, 0
-; CHECK-BE-NEXT:xxspltidp vs3, -1082130432
 ; CHECK-BE-NEXT:extsh r9, r3
 ; CHECK-BE-NEXT:extsw r6, r28
 ; CHECK-BE-NEXT:li r5, 0
+; CHECK-BE-NEXT:xxspltidp vs3, -1082130432
+; CHECK-BE-NEXT:xxspltidp vs4, -1082130432
 ; CHECK-BE-NEXT:std r30, 120(r1)
 ; CHECK-BE-NEXT:std r29, 112(r1)
 ; CHECK-BE-NEXT:li r7, 0
 ; CHECK-BE-NEXT:li r8, 0
 ; CHECK-BE-NEXT:li r10, 0
-; CHECK-BE-NEXT:fmr f4, f3
-; CHECK-BE-NEXT:xxlxor f1, f1, f1
 ; CHECK-BE-NEXT:std r4, 168(r1)
 ; CHECK-BE-NEXT:li r4, -1
+; CHECK-BE-NEXT:xxlxor f1, f1, f1
 ; CHECK-BE-NEXT:std r4, 128(r1)
 ; CHECK-BE-NEXT:li r4, 1024
 ; CHECK-BE-NEXT:bl call_4
Index: llvm/test/CodeGen/PowerPC/constant-pool.ll
===
--- llvm/test/CodeGen/PowerPC/constant-pool.ll
+++ llvm/test/CodeGen/PowerPC/constant-pool.ll
@@ -364,15 +364,15 @@
 ; CHECK-NEXT:.cfi_def_cfa_offset 48
 ; CHECK-NEXT:.cfi_offset lr, 16
 ; CHECK-NEXT:.cfi_offset v31, -16
+; CHECK-NEXT:xxlxor f4, f4, f4
+; CHECK-NEXT:xxsplti32dx vs3, 0, 1074935889
 ; CHECK-NEXT:stxv vs63, 32(r1) # 16-byte Folded Spill
 ; CHECK-NEXT:xxsplti32dx vs63, 0, 1074935889
-; CHECK-NEXT:xxlxor f4, f4, f4
-; CHECK-NEXT:xxlor vs3, vs63, vs63
 ; CHECK-NEXT:xxsplti32dx vs3, 1, -343597384
 ; CHECK-NEXT:# kill: def $f3 killed $f3 killed $vsl3
 ; CHECK-NEXT:bl __gcc_qadd@notoc
-; CHECK-NEXT:xxlor vs3, vs63, vs63
 ; CHECK-NEXT:xxlxor f4, f4, f4
+; CHECK-NEXT:xxsplti32dx vs3, 0, 1074935889
 ; CHECK-NEXT:xxsplti32dx vs3, 1, -1719329096
 ; CHECK-NEXT:# kill: def $f3 killed $f3 killed $vsl3
 ; CHECK-NEXT:bl __gcc_qadd@notoc
Index: llvm/lib/Target/PowerPC/PPCInstrPrefix.td
===
--- llvm/lib/Target/PowerPC/PPCInstrPrefix.td
+++ llvm/lib/Target/PowerPC/PPCInstrPrefix.td
@@ -1854,15 +1854,6 @@
 }
 
 let Predicates = [PrefixInstrs] in {
-  def XXSPLTIW : 8RR_DForm_IMM32_XT6<32, 3, (outs vsrc:$XT),
- (ins i32imm:$IMM32),
- "xxspltiw $XT, $IMM32", IIC_VecGeneral,
- 

[PATCH] D110428: [AIX] Define WCHAR_T_TYPE as unsigned short on AIX for wchar.c test case.

2021-09-24 Thread Amy Kwan via Phabricator via cfe-commits
amyk created this revision.
amyk added reviewers: hubert.reinterpretcast, daltenty, thakis.
amyk added projects: clang, PowerPC.
amyk requested review of this revision.

The default wchar type is different on AIX vs. Linux. When this test is run on 
AIX,
WCHAR_T_TYPE ends up being set to `int`. This is incorrect as the default
wchar type on AIX is actually `unsigned short`, and setting the type 
incorrectly 
causes the expected errors to not be found.

This patch sets the type correctly (to `unsigned short`) for AIX.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110428

Files:
  clang/test/Sema/wchar.c


Index: clang/test/Sema/wchar.c
===
--- clang/test/Sema/wchar.c
+++ clang/test/Sema/wchar.c
@@ -4,7 +4,8 @@
 typedef __WCHAR_TYPE__ wchar_t;
 
 #if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
- || defined(_M_X64) || defined(__ORBIS__) || defined(SHORT_WCHAR)
+ || defined(_M_X64) || defined(__ORBIS__) || defined(SHORT_WCHAR) \
+ || defined(_AIX)
   #define WCHAR_T_TYPE unsigned short
 #elif defined(__aarch64__)
   // See AArch64TargetInfo constructor -- unsigned on non-darwin non-OpenBSD 
non-NetBSD.


Index: clang/test/Sema/wchar.c
===
--- clang/test/Sema/wchar.c
+++ clang/test/Sema/wchar.c
@@ -4,7 +4,8 @@
 typedef __WCHAR_TYPE__ wchar_t;
 
 #if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
- || defined(_M_X64) || defined(__ORBIS__) || defined(SHORT_WCHAR)
+ || defined(_M_X64) || defined(__ORBIS__) || defined(SHORT_WCHAR) \
+ || defined(_AIX)
   #define WCHAR_T_TYPE unsigned short
 #elif defined(__aarch64__)
   // See AArch64TargetInfo constructor -- unsigned on non-darwin non-OpenBSD non-NetBSD.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110421: Write test for CWG1772/CWG1779, mark them 'done', and update cxx_dr_status.html

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

LGTM aside from some nits, thank you!




Comment at: clang/test/CXX/drs/dr17xx.cpp:75
   // Direct-list-initialization of a non-class object
-  
   int a{0};

Unintentional whitespace changes can be backed out. ;-)



Comment at: clang/test/CXX/drs/dr17xx.cpp:132
+  float operator ""_E(const char *);
+  // expected-error@+2{{invalid suffix on literal; c++11 requires a space 
between literal and identifier}}
+  // expected-warning@+1 {{user-defined literal suffixes not starting with '_' 
are reserved; no literal will invoke this operator}}





Comment at: clang/www/make_cxx_dr_status:95
 
-latest_release = 11
+latest_release = 13
 

Errr, 13 isn't quite out the door yet (we've branched for it, but not released 
it). However, I don't think it's an issue to bump the value right now (IIUC, 
we're releasing Very Soon Now anyway).


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

https://reviews.llvm.org/D110421

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


[PATCH] D110304: [HIP] Fix linking of asanrt.bc

2021-09-24 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision.
tra added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/Driver/ToolChains/HIP.cpp:413
   } else
-BCLibs.push_back(AsanRTL.str());
+BCLibs.push_back({AsanRTL.str(), false});
 }

Nit: I'd add `/*ShouldInternalize=*/`


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

https://reviews.llvm.org/D110304

___
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-24 Thread Quinn Pham via Phabricator via cfe-commits
quinnp updated this revision to Diff 374891.
quinnp added a comment.

Rebase with main.


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/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,50 @@
 }
 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) {
+case Intrinsic::ppc_compare_exp_lt:
+  Pred = PPC::PRED_LT;
+  break;
+case Intrinsic::ppc_compare_exp_gt:
+  Pred = PPC::PRED_GT;
+  break;
+case Intrinsic::ppc_compare_exp_eq:
+  Pred = PPC::PRED_EQ;
+  break;
+case Intrinsic::ppc_compare_exp_uo:
+  Pred = PPC::PRED_UN;
+  break;
+}
+return SDValue(
+

[PATCH] D109599: [PowerPC][MMA] Allow MMA builtin types in pre-P10 compilation units

2021-09-24 Thread Victor Huang via Phabricator via cfe-commits
NeHuang added inline comments.



Comment at: clang/test/Sema/ppc-mma-builtins.c:1
+// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu pwr10 \
+// RUN:   -target-feature -mma -fsyntax-only %s -verify

can you please add  `// REQUIRES: powerpc-registered-target`  for the ppc 
specific test?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109599

___
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-24 Thread Quinn Pham via Phabricator via cfe-commits
quinnp updated this revision to Diff 374888.
quinnp added a comment.

Addressing nit in SemaChecking.


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/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,50 @@
 }
 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) {
+case Intrinsic::ppc_compare_exp_lt:
+  Pred = PPC::PRED_LT;
+  break;
+case Intrinsic::ppc_compare_exp_gt:
+  Pred = PPC::PRED_GT;
+  break;
+case Intrinsic::ppc_compare_exp_eq:
+  Pred = PPC::PRED_EQ;
+  break;
+case Intrinsic::ppc_compare_exp_uo:
+  Pred = PPC::PRED_UN;
+  break;
+}
+return 

[PATCH] D43002: [CodeView] Emit S_OBJNAME record

2021-09-24 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added inline comments.



Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:752
 
+static void unescapeSlashes(SmallVectorImpl ) {
+  auto Read = Str.begin();

rnk wrote:
> aganea wrote:
> > rnk wrote:
> > > This isn't unescaping them, it's just canonicalizing double slashes to 
> > > one slash, right? Would `llvm::sys::native` suffice?
> > `llvm::sys::path::native()` doesn't remove consecutive (back)slashes. I 
> > think @zturner's main intent was when debugging in Visual Studio with 
> > arguments from LIT tests, they sometimes contain double backslashes.
> I see. I think "unescape" shouldn't be in the name, this isn't about escape 
> characters, it's about cleaning up or canonicalizing the path.
I removed this function. Now using `sys::path::remove_dots` which removes the 
consecutive slashes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D43002

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


[PATCH] D43002: [CodeView] Emit S_OBJNAME record

2021-09-24 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea updated this revision to Diff 374884.
aganea marked 5 inline comments as done.
aganea edited reviewers, added: akhuang; removed: zturner, gratianlup.
aganea edited subscribers, added: zturner, gratianlup; removed: aganea.
aganea added a comment.
Herald added subscribers: dang, mgorny.

As suggested by @rnk


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D43002

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Job.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CMakeLists.txt
  clang/test/CodeGenCXX/debug-info-objname.cpp
  llvm/include/llvm/LTO/LTO.h
  llvm/include/llvm/Support/ToolOutputFile.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
  llvm/lib/LTO/Caching.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/test/DebugInfo/COFF/globals.ll
  llvm/test/DebugInfo/COFF/multifunction.ll
  llvm/test/DebugInfo/COFF/pr28747.ll
  llvm/test/DebugInfo/COFF/simple.ll
  llvm/test/DebugInfo/COFF/vframe-fpo.ll
  llvm/test/MC/AArch64/coff-debug.ll
  llvm/test/MC/ARM/coff-debugging-secrel.ll
  llvm/test/MC/COFF/cv-compiler-info.ll
  llvm/tools/llc/llc.cpp
  llvm/tools/llvm-lto2/llvm-lto2.cpp

Index: llvm/tools/llvm-lto2/llvm-lto2.cpp
===
--- llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -369,7 +369,7 @@
 std::error_code EC;
 auto S = std::make_unique(Path, EC, sys::fs::OF_None);
 check(EC, Path);
-return std::make_unique(std::move(S));
+return std::make_unique(std::move(S), Path);
   };
 
   auto AddBuffer = [&](size_t Task, std::unique_ptr MB) {
Index: llvm/tools/llc/llc.cpp
===
--- llvm/tools/llc/llc.cpp
+++ llvm/tools/llc/llc.cpp
@@ -576,6 +576,9 @@
   GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]);
   if (!Out) return 1;
 
+  // Ensure the filename is passed down to CodeViewDebug.
+  Target->Options.ObjectFilenameForDebug = Out->outputFilename();
+
   std::unique_ptr DwoOut;
   if (!SplitDwarfOutputFile.empty()) {
 std::error_code EC;
Index: llvm/test/MC/COFF/cv-compiler-info.ll
===
--- llvm/test/MC/COFF/cv-compiler-info.ll
+++ llvm/test/MC/COFF/cv-compiler-info.ll
@@ -1,4 +1,6 @@
-; RUN: llc -mtriple i686-pc-windows-msvc < %s | FileCheck %s
+; RUN: llc -mtriple i686-pc-windows-msvc < %s | FileCheck %s --check-prefixes=CHECK,STDOUT
+; RUN: llc -mtriple i686-pc-windows-msvc < %s -o %t
+; RUN: FileCheck %s --input-file=%t --check-prefixes=CHECK,FILE
 ; ModuleID = 'D:\src\scopes\foo.cpp'
 source_filename = "D:\5Csrc\5Cscopes\5Cfoo.cpp"
 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
@@ -20,19 +22,23 @@
 ; One .debug$S section should contain an S_COMPILE3 record that identifies the
 ; source language and the version of the compiler based on the DICompileUnit.
 ; CHECK: 	.section	.debug$S,"dr"
+; CHECK:.short  4353# Record kind: S_OBJNAME
+; CHECK-NEXT:   .long   0   # Signature
+; STDOUT-NEXT:  .byte   0   # Object name
+; FILE-NEXT:.asciz	"{{.*}}{{|/}}cv-compiler-info.ll.tmp" # Object name
 ; CHECK: 		.short	4412  # Record kind: S_COMPILE3
-; CHECK: 		.long	1   # Flags and language
-; CHECK: 		.short	7 # CPUType
-; CHECK: 		.short	4 # Frontend version
-; CHECK: 		.short	0
-; CHECK: 		.short	0
-; CHECK: 		.short	0
-; CHECK: 		.short	[[BACKEND_VERSION:[0-9]+]]  # Backend version
-; CHECK: 		.short	0
-; CHECK: 		.short	0
-; CHECK: 		.short	0
-; CHECK: 		.asciz	"clang version 4.0.0 "  # Null-terminated compiler version string
-; CHECK-NOT: .short	4412  # Record kind: S_COMPILE3
+; CHECK-NEXT:   .long	1   # Flags and language
+; CHECK-NEXT: 	.short	7 # CPUType
+; CHECK-NEXT: 	.short	4 # Frontend version
+; CHECK-NEXT: 	.short	0
+; CHECK-NEXT: 	.short	0
+; CHECK-NEXT: 	.short	0
+; CHECK-NEXT: 	.short	[[BACKEND_VERSION:[0-9]+]]  # Backend version
+; CHECK-NEXT: 	.short	0
+; CHECK-NEXT: 	.short	0
+; CHECK-NEXT: 	.short	0
+; CHECK-NEXT: 	.asciz	"clang version 4.0.0 "  # Null-terminated compiler version string
+; CHECK-NOT:.short	4412  # Record kind: S_COMPILE3
 !1 = !DIFile(filename: "D:\5Csrc\5Cscopes\5Cfoo.cpp", directory: "D:\5Csrc\5Cscopes\5Cclang")
 !2 = !{}
 !7 = !{i32 2, !"CodeView", i32 1}
Index: llvm/test/MC/ARM/coff-debugging-secrel.ll
===
--- llvm/test/MC/ARM/coff-debugging-secrel.ll
+++ llvm/test/MC/ARM/coff-debugging-secrel.ll
@@ -42,10 

[PATCH] D110422: [AIX] Enable PGO without LTO

2021-09-24 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added inline comments.



Comment at: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp:869
+  // symbol, so we can not ensure the correctness of the relative CounterPtr, 
so
+  // we have to use private linkage for counter and data symbols.
+  if (TT.isOSBinFormatXCOFF()) {

MaskRay wrote:
> Then you can just keep the existing weak symbols.
> 
> The weak symbols will not be selected due to linker semantics.
Not sure what you meant? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D106959: [PowerPC] swdiv builtins for XL compatibility

2021-09-24 Thread Victor Huang via Phabricator via cfe-commits
NeHuang added a comment.

Do we already have a backend test case for `fdiv` emitting a software estimate 
when `-Ofast` is used?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106959

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


[PATCH] D110422: [AIX] Enable PGO without LTO

2021-09-24 Thread Jinsong Ji via Phabricator via cfe-commits
jsji updated this revision to Diff 374879.
jsji added a comment.

Address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/unsupported-option.c
  clang/test/Profile/cxx-templates.cpp
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
  llvm/test/Instrumentation/InstrProfiling/profiling.ll

Index: llvm/test/Instrumentation/InstrProfiling/profiling.ll
===
--- llvm/test/Instrumentation/InstrProfiling/profiling.ll
+++ llvm/test/Instrumentation/InstrProfiling/profiling.ll
@@ -45,8 +45,8 @@
 ; MACHO: @__profd_foo_weak = weak hidden global
 ; COFF: @__profc_foo_weak = weak hidden global
 ; COFF: @__profd_foo_weak = private global
-; XCOFF: @__profc_foo_weak = weak hidden global
-; XCOFF: @__profd_foo_weak = weak hidden global
+; XCOFF: @__profc_foo_weak = private global
+; XCOFF: @__profd_foo_weak = private global
 define weak void @foo_weak() {
   call void @llvm.instrprof.increment(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__profn_foo_weak, i32 0, i32 0), i64 0, i32 1, i32 0)
   ret void
@@ -71,8 +71,8 @@
 ; MACHO: @__profd_foo_inline = linkonce_odr hidden global
 ; COFF: @__profc_foo_inline = linkonce_odr hidden global{{.*}} section ".lprfc$M", align 8
 ; COFF: @__profd_foo_inline = private global{{.*}} section ".lprfd$M", align 8
-; XCOFF: @__profc_foo_inline = linkonce_odr hidden global
-; XCOFF: @__profd_foo_inline = linkonce_odr hidden global
+; XCOFF: @__profc_foo_inline = private global
+; XCOFF: @__profd_foo_inline = private global
 define linkonce_odr void @foo_inline() {
   call void @llvm.instrprof.increment(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__profn_foo_inline, i32 0, i32 0), i64 0, i32 1, i32 0)
   ret void
@@ -84,8 +84,8 @@
 ; MACHO: @__profd_foo_extern = linkonce_odr hidden global
 ; COFF: @__profc_foo_extern = linkonce_odr hidden global {{.*}}section ".lprfc$M", comdat, align 8
 ; COFF: @__profd_foo_extern = private global {{.*}}section ".lprfd$M", comdat($__profc_foo_extern), align 8
-; XCOFF: @__profc_foo_extern = linkonce_odr hidden global
-; XCOFF: @__profd_foo_extern = linkonce_odr hidden global
+; XCOFF: @__profc_foo_extern = private global
+; XCOFF: @__profd_foo_extern = private global
 define available_externally void @foo_extern() {
   call void @llvm.instrprof.increment(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__profn_foo_extern, i32 0, i32 0), i64 0, i32 1, i32 0)
   ret void
Index: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
===
--- llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -862,6 +862,15 @@
   GlobalValue::LinkageTypes Linkage = NamePtr->getLinkage();
   GlobalValue::VisibilityTypes Visibility = NamePtr->getVisibility();
 
+  // Due to the current limitation of binder, the duplicate weak symbols in the
+  // same csect won't be discarded. When there are duplicate weak symbols,
+  // we can NOT guarantee that the relocations get resolved to the intended weak
+  // symbol, so we can not ensure the correctness of the relative CounterPtr, so
+  // we have to use private linkage for counter and data symbols.
+  if (TT.isOSBinFormatXCOFF()) {
+Linkage = GlobalValue::PrivateLinkage;
+Visibility = GlobalValue::DefaultVisibility;
+  }
   // Move the name variable to the right section. Place them in a COMDAT group
   // if the associated function is a COMDAT. This will make sure that only one
   // copy of counters of the COMDAT function will be emitted after linking. Keep
@@ -971,6 +980,17 @@
 Linkage = GlobalValue::PrivateLinkage;
 Visibility = GlobalValue::DefaultVisibility;
   }
+
+  // Due to the current limitation of binder, the duplicate weak symbols in the
+  // same csect won't be discarded. When there are duplicate weak symbols,
+  // we can NOT guarantee that the relocations get resolved to the intended weak
+  // symbol, so we can not ensure the correctness of the relative CounterPtr, so
+  // we have to use private linkage for counter and data symbols.
+  if (TT.isOSBinFormatXCOFF()) {
+Linkage = GlobalValue::PrivateLinkage;
+Visibility = GlobalValue::DefaultVisibility;
+  }
+
   auto *Data =
   new GlobalVariable(*M, DataTy, false, Linkage, nullptr, DataVarName);
   // Reference the counter variable with a label difference (link-time
Index: clang/test/Profile/cxx-templates.cpp
===
--- clang/test/Profile/cxx-templates.cpp
+++ clang/test/Profile/cxx-templates.cpp
@@ -10,8 +10,10 @@
 // RUN: FileCheck --input-file=%tuse -check-prefix=T0USE -check-prefix=ALL %s
 // RUN: FileCheck --input-file=%tuse -check-prefix=T100USE -check-prefix=ALL 

[PATCH] D110422: [AIX] Enable PGO without LTO

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



Comment at: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp:978
   if (NS == 0 && !(DataReferencedByCode && NeedComdat && !Renamed) &&
-  (TT.isOSBinFormatELF() ||
+  (TT.isOSBinFormatELF() || TT.isOSBinFormatXCOFF() ||
(!DataReferencedByCode && TT.isOSBinFormatCOFF( {

This place is for binary formats which can properly GC metadata sections. If 
XCOFF can't, it shouldn't be added here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D110422: [AIX] Enable PGO without LTO

2021-09-24 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay requested changes to this revision.
MaskRay added inline comments.
This revision now requires changes to proceed.



Comment at: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp:869
+  // symbol, so we can not ensure the correctness of the relative CounterPtr, 
so
+  // we have to use private linkage for counter and data symbols.
+  if (TT.isOSBinFormatXCOFF()) {

Then you can just keep the existing weak symbols.

The weak symbols will not be selected due to linker semantics.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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


[PATCH] D110257: [CFE][Codegen] Do not break the contiguity of static allocas.

2021-09-24 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: clang/lib/CodeGen/CGExpr.cpp:103
+if (!ArraySize) {
+  auto *EBB = AllocaInsertPt->getParent();
+  auto Iter = AllocaInsertPt->getIterator();

hsmhsm wrote:
> jdoerfert wrote:
> > arsenm wrote:
> > > Why is there a special AllocaInsertPt iterator in the first place? Can 
> > > you avoid any iteration logic by just always inserting at the block start?
> > Right. The alloca insertion point is sometimes changed to a non-entry 
> > block, and we should keep that ability.
> > From all the use cases I know it would suffice to insert at the beginning 
> > of the alloca insertion point block though.
> I really do not understand this comment fully.
> 
> This block of code here inserts an "addressspace cast" of recently inserted 
> alloca, not the alloca itself. Alloca is already inserted.  Please look at 
> the start of this function. 
> 
> The old logic (in the left) inserts addressspace cast of recently inserted 
> alloca immediately after recent alloca using AllocaInsertPt. As a side 
> effect, it also makes AllocaInsertPt now point to this newly inserted 
> addressspace cast. Hence, next alloca is inserted after this new addressspace 
> cast, because now AllocaInsertPt is made to point this newly inserted 
> addressspace cast.  
> 
> The new logic (here) fixes that by moving insertion point just beyond current 
> AllocaInsertPt without updating AllocaInsertPt.
> 
> How can I insert "addressspace cast" of an alloca, at the beginning of the 
> block even before alloca?
> 
> As I understand it, AllocaInsertPt is maintained to insert static allocas at 
> the start of entry block, otherwise there is no any special reason to 
> maintain such a special insertion point. Please look at 
> https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CodeGenFunction.h#L378.
> 
> That said, I am not really sure, if I have completely misunderstood the 
> comment above. If that is the case, then, I need better clarification here 
> about what really is expected.
Well, inserting at the top of the entry block would reverse the order of the 
allocas. Currently they appear in source/IRGen order, which is nice. 
Maintaining the order requires appending, which requires a cursor of some kind.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110257

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


[PATCH] D109780: [PowerPC] Add range check for vec_genpcvm builtins

2021-09-24 Thread Quinn Pham 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 rG3b0240e6c89d: [PowerPC] Add range check for vec_genpcvm 
builtins (authored by quinnp).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109780

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


Index: clang/test/CodeGen/builtins-ppc-p10vector-error.c
===
--- clang/test/CodeGen/builtins-ppc-p10vector-error.c
+++ clang/test/CodeGen/builtins-ppc-p10vector-error.c
@@ -30,3 +30,19 @@
 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]}}
 }
+
+vector unsigned char test_xxgenpcvbm(void) {
+  return vec_genpcvm(vuca, -1); // expected-error 1+ {{argument value -1 is 
outside the valid range [0, 3]}}
+}
+
+vector unsigned short test_xxgenpcvhm(void) {
+  return vec_genpcvm(vusa, -1); // expected-error 1+ {{argument value -1 is 
outside the valid range [0, 3]}}
+}
+
+vector unsigned int test_xxgenpcvwm(void) {
+  return vec_genpcvm(vuia, 4); // expected-error 1+ {{argument value 4 is 
outside the valid range [0, 3]}}
+}
+
+vector unsigned long long test_xxgenpcvdm(void) {
+  return vec_genpcvm(vulla, 4); // expected-error 1+ {{argument value 4 is 
outside the valid range [0, 3]}}
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -3485,6 +3485,11 @@
   case PPC::BI__builtin_darn_32:
 return SemaFeatureCheck(*this, TheCall, "isa-v30-instructions",
 diag::err_ppc_builtin_only_on_arch, "9");
+  case PPC::BI__builtin_vsx_xxgenpcvbm:
+  case PPC::BI__builtin_vsx_xxgenpcvhm:
+  case PPC::BI__builtin_vsx_xxgenpcvwm:
+  case PPC::BI__builtin_vsx_xxgenpcvdm:
+return SemaBuiltinConstantArgRange(TheCall, 1, 0, 3);
 #define CUSTOM_BUILTIN(Name, Intr, Types, Acc) \
   case PPC::BI__builtin_##Name: \
 return SemaBuiltinPPCMMACall(TheCall, Types);


Index: clang/test/CodeGen/builtins-ppc-p10vector-error.c
===
--- clang/test/CodeGen/builtins-ppc-p10vector-error.c
+++ clang/test/CodeGen/builtins-ppc-p10vector-error.c
@@ -30,3 +30,19 @@
 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]}}
 }
+
+vector unsigned char test_xxgenpcvbm(void) {
+  return vec_genpcvm(vuca, -1); // expected-error 1+ {{argument value -1 is outside the valid range [0, 3]}}
+}
+
+vector unsigned short test_xxgenpcvhm(void) {
+  return vec_genpcvm(vusa, -1); // expected-error 1+ {{argument value -1 is outside the valid range [0, 3]}}
+}
+
+vector unsigned int test_xxgenpcvwm(void) {
+  return vec_genpcvm(vuia, 4); // expected-error 1+ {{argument value 4 is outside the valid range [0, 3]}}
+}
+
+vector unsigned long long test_xxgenpcvdm(void) {
+  return vec_genpcvm(vulla, 4); // expected-error 1+ {{argument value 4 is outside the valid range [0, 3]}}
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -3485,6 +3485,11 @@
   case PPC::BI__builtin_darn_32:
 return SemaFeatureCheck(*this, TheCall, "isa-v30-instructions",
 diag::err_ppc_builtin_only_on_arch, "9");
+  case PPC::BI__builtin_vsx_xxgenpcvbm:
+  case PPC::BI__builtin_vsx_xxgenpcvhm:
+  case PPC::BI__builtin_vsx_xxgenpcvwm:
+  case PPC::BI__builtin_vsx_xxgenpcvdm:
+return SemaBuiltinConstantArgRange(TheCall, 1, 0, 3);
 #define CUSTOM_BUILTIN(Name, Intr, Types, Acc) \
   case PPC::BI__builtin_##Name: \
 return SemaBuiltinPPCMMACall(TheCall, Types);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 3b0240e - [PowerPC] Add range check for vec_genpcvm builtins

2021-09-24 Thread Quinn Pham via cfe-commits

Author: Quinn Pham
Date: 2021-09-24T11:15:44-05:00
New Revision: 3b0240e6c89d9201430ee83b09fe7c94256e8838

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

LOG: [PowerPC] Add range check for vec_genpcvm builtins

This patch adds range checking for some Power10 altivec builtins. Range
checking is done in SemaChecking.

Reviewed By: #powerpc, lei, Conanap

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

Added: 


Modified: 
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGen/builtins-ppc-p10vector-error.c

Removed: 




diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 0310e10f93704..c3c653f6889ed 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3485,6 +3485,11 @@ bool Sema::CheckPPCBuiltinFunctionCall(const TargetInfo 
, unsigned BuiltinID,
   case PPC::BI__builtin_darn_32:
 return SemaFeatureCheck(*this, TheCall, "isa-v30-instructions",
 diag::err_ppc_builtin_only_on_arch, "9");
+  case PPC::BI__builtin_vsx_xxgenpcvbm:
+  case PPC::BI__builtin_vsx_xxgenpcvhm:
+  case PPC::BI__builtin_vsx_xxgenpcvwm:
+  case PPC::BI__builtin_vsx_xxgenpcvdm:
+return SemaBuiltinConstantArgRange(TheCall, 1, 0, 3);
 #define CUSTOM_BUILTIN(Name, Intr, Types, Acc) \
   case PPC::BI__builtin_##Name: \
 return SemaBuiltinPPCMMACall(TheCall, Types);

diff  --git a/clang/test/CodeGen/builtins-ppc-p10vector-error.c 
b/clang/test/CodeGen/builtins-ppc-p10vector-error.c
index e509c5a82c5b0..27d24e3d441c0 100644
--- a/clang/test/CodeGen/builtins-ppc-p10vector-error.c
+++ b/clang/test/CodeGen/builtins-ppc-p10vector-error.c
@@ -30,3 +30,19 @@ unsigned long long test_vec_cntm_ui(void) {
 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]}}
 }
+
+vector unsigned char test_xxgenpcvbm(void) {
+  return vec_genpcvm(vuca, -1); // expected-error 1+ {{argument value -1 is 
outside the valid range [0, 3]}}
+}
+
+vector unsigned short test_xxgenpcvhm(void) {
+  return vec_genpcvm(vusa, -1); // expected-error 1+ {{argument value -1 is 
outside the valid range [0, 3]}}
+}
+
+vector unsigned int test_xxgenpcvwm(void) {
+  return vec_genpcvm(vuia, 4); // expected-error 1+ {{argument value 4 is 
outside the valid range [0, 3]}}
+}
+
+vector unsigned long long test_xxgenpcvdm(void) {
+  return vec_genpcvm(vulla, 4); // expected-error 1+ {{argument value 4 is 
outside the valid range [0, 3]}}
+}



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


[PATCH] D110273: [PowerPC] Fix lharx and lbarx builtin signatures

2021-09-24 Thread Victor Huang via Phabricator via cfe-commits
NeHuang added inline comments.



Comment at: clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c:27
 
 char test_lbarx(volatile unsigned char *a) {
   // CHECK-LABEL: @test_lbarx

Do you also need to update the input argument type here as well to match the 
changes in `BuiltinsPPC.def`?


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

https://reviews.llvm.org/D110273

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


[PATCH] D110304: [HIP] Fix linking of asanrt.bc

2021-09-24 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 374868.
yaxunl marked an inline comment as done.
yaxunl edited the summary of this revision.
yaxunl added a comment.

Revised by Artem's comments


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

https://reviews.llvm.org/D110304

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/lib/Driver/ToolChains/HIP.h
  clang/test/CodeGenCUDA/Inputs/amdgpu-asanrtl.ll
  clang/test/CodeGenCUDA/amdgpu-asan.cu
  clang/test/Driver/hip-sanitize-options.hip

Index: clang/test/Driver/hip-sanitize-options.hip
===
--- clang/test/Driver/hip-sanitize-options.hip
+++ clang/test/Driver/hip-sanitize-options.hip
@@ -34,7 +34,7 @@
 // CHECK-NOT: {{"[^"]*lld(\.exe){0,1}".* ".*hip.bc"}}
 // CHECK: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}}
 
-// NORDC: {{"[^"]*clang[^"]*".* "-emit-obj".* "-fcuda-is-device".* "-fsanitize=address".*}} "-o" "[[OUT:[^"]*.o]]"
+// NORDC: {{"[^"]*clang[^"]*".* "-emit-obj".* "-fcuda-is-device".* "-mlink-bitcode-file" ".*asanrtl.bc".* "-mlink-builtin-bitcode" ".*hip.bc".* "-fsanitize=address".*}} "-o" "[[OUT:[^"]*.o]]"
 // NORDC: {{"[^"]*lld(\.exe){0,1}".*}} "[[OUT]]" {{".*asanrtl.bc" ".*hip.bc"}}
 // NORDC: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}}
 
Index: clang/test/CodeGenCUDA/amdgpu-asan.cu
===
--- clang/test/CodeGenCUDA/amdgpu-asan.cu
+++ clang/test/CodeGenCUDA/amdgpu-asan.cu
@@ -1,6 +1,20 @@
+// Create a sample address sanitizer bitcode library.
+
+// RUN: %clang_cc1 -x ir -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm-bc \
+// RUN:   -disable-llvm-passes -o %t.asanrtl.bc %S/Inputs/amdgpu-asanrtl.ll
+
+// Check sanitizer runtime library functions survive
+// optimizations without being removed or parameters altered.
+
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
+// RUN:   -fcuda-is-device -target-cpu gfx906 -fsanitize=address \
+// RUN:   -mlink-bitcode-file %t.asanrtl.bc -x hip \
+// RUN:   | FileCheck -check-prefix=ASAN %s
+
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
 // RUN:   -fcuda-is-device -target-cpu gfx906 -fsanitize=address \
-// RUN:   -x hip | FileCheck -check-prefix=ASAN %s
+// RUN:   -O3 -mlink-bitcode-file %t.asanrtl.bc -x hip \
+// RUN:   | FileCheck -check-prefix=ASAN %s
 
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
 // RUN:   -fcuda-is-device -target-cpu gfx906 -x hip \
@@ -8,8 +22,10 @@
 
 // REQUIRES: amdgpu-registered-target
 
-// ASAN-DAG: declare void @__amdgpu_device_library_preserve_asan_functions()
+// ASAN-DAG: define weak void @__amdgpu_device_library_preserve_asan_functions()
 // ASAN-DAG: @__amdgpu_device_library_preserve_asan_functions_ptr = weak addrspace(1) constant void ()* @__amdgpu_device_library_preserve_asan_functions
 // ASAN-DAG: @llvm.compiler.used = {{.*}}@__amdgpu_device_library_preserve_asan_functions_ptr
+// ASAN-DAG: define weak void @__asan_report_load1(i64 %{{.*}})
 
-// CHECK-NOT: @__amdgpu_device_library_preserve_asan_functions_ptr
+// CHECK-NOT: @__amdgpu_device_library_preserve_asan_functions
+// CHECK-NOT: @__asan_report_load1
Index: clang/test/CodeGenCUDA/Inputs/amdgpu-asanrtl.ll
===
--- /dev/null
+++ clang/test/CodeGenCUDA/Inputs/amdgpu-asanrtl.ll
@@ -0,0 +1,13 @@
+; Sample code for amdgpu address sanitizer runtime.
+
+; Note the runtime functions need to have weak linkage and default
+; visibility, otherwise they may be internalized and removed by GlobalOptPass.
+
+define weak void @__amdgpu_device_library_preserve_asan_functions() {
+  tail call void @__asan_report_load1(i64 0)
+  ret void
+}
+
+define weak void @__asan_report_load1(i64 %0) {
+  ret void
+}
Index: clang/lib/Driver/ToolChains/HIP.h
===
--- clang/lib/Driver/ToolChains/HIP.h
+++ clang/lib/Driver/ToolChains/HIP.h
@@ -83,7 +83,7 @@
llvm::opt::ArgStringList ) const override;
   void AddHIPIncludeArgs(const llvm::opt::ArgList ,
  llvm::opt::ArgStringList ) const override;
-  llvm::SmallVector
+  llvm::SmallVector
   getHIPDeviceLibs(const llvm::opt::ArgList ) const override;
 
   SanitizerMask getSupportedSanitizers() const override;
Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -88,8 +88,8 @@
 
   if (Args.hasFlag(options::OPT_fgpu_sanitize, options::OPT_fno_gpu_sanitize,
false))
-llvm::for_each(TC.getHIPDeviceLibs(Args), [&](StringRef BCFile) {
-  LldArgs.push_back(Args.MakeArgString(BCFile));
+

[PATCH] D110257: [CFE][Codegen] Do not break the contiguity of static allocas.

2021-09-24 Thread Mahesha S via Phabricator via cfe-commits
hsmhsm updated this revision to Diff 374869.
hsmhsm added a comment.

Remove "!llvm.access.group" metadata from check lines in test files.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110257

Files:
  clang/lib/CodeGen/CGExpr.cpp
  clang/test/CodeGenCUDA/builtins-amdgcn.cu
  clang/test/CodeGenCXX/amdgcn-automatic-variable.cpp
  clang/test/CodeGenCXX/amdgcn-func-arg.cpp
  clang/test/CodeGenCXX/builtin-amdgcn-atomic-inc-dec.cpp
  clang/test/CodeGenCXX/vla.cpp
  clang/test/CodeGenSYCL/address-space-deduction.cpp
  clang/test/OpenMP/amdgcn_target_init_temp_alloca.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_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_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_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/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/target_codegen_global_capture.cpp
  clang/test/OpenMP/target_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/target_parallel_if_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/task_codegen.c
  clang/test/OpenMP/teams_distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/vla_crash.c

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


[PATCH] D110304: [HIP] Fix linking of asanrt.bc

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



Comment at: clang/include/clang/Driver/ToolChain.h:116-117
 
+  // Enums corresponding to clang options for linking bitcode, i.e.,
+  // -mlink-builtin-bitcode or -mlink-bitcode-file
+  enum BitCodeLinkOpt {

tra wrote:
> It appears that what we dealing with here is an on/off switch for whether we 
> want to internalize symbols.
> 
> Perhaps it should be implemented as such. 
> getHIPDeviceLibs() will set the bool flag indicating *what* we want to do 
> with the library and then the toolchain-specific code will decide *how* to 
> make it happen. Currently it translates into specific linking option, but it 
> may be something else. getHIPDeviceLibs does not need to know that.
> 
> The code will remain essentially the same, it's mostly the naming exercise.
> 
> 
will do


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

https://reviews.llvm.org/D110304

___
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-24 Thread Fraser Cormack via Phabricator via cfe-commits
frasercrmck added a comment.

In D93298#3014160 , @jrtc27 wrote:

> 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.

Do we know if it's possible to teach TableGen how to do that? This extension 
seems like a good reason to implement such a feature as the duplication really 
is unfortunate.

I thought that `MCOperandInfo` may be an issue but there's already dynamic 
lookup there to support `isLookupPtrRegClass`.


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] D110422: [AIX] Enable PGO without LTO

2021-09-24 Thread Jinsong Ji via Phabricator via cfe-commits
jsji updated this revision to Diff 374867.
jsji added a comment.

Restore the limitation of sample profiling.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/unsupported-option.c
  clang/test/Profile/cxx-templates.cpp
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
  llvm/test/Instrumentation/InstrProfiling/profiling.ll

Index: llvm/test/Instrumentation/InstrProfiling/profiling.ll
===
--- llvm/test/Instrumentation/InstrProfiling/profiling.ll
+++ llvm/test/Instrumentation/InstrProfiling/profiling.ll
@@ -45,8 +45,8 @@
 ; MACHO: @__profd_foo_weak = weak hidden global
 ; COFF: @__profc_foo_weak = weak hidden global
 ; COFF: @__profd_foo_weak = private global
-; XCOFF: @__profc_foo_weak = weak hidden global
-; XCOFF: @__profd_foo_weak = weak hidden global
+; XCOFF: @__profc_foo_weak = private global
+; XCOFF: @__profd_foo_weak = private global
 define weak void @foo_weak() {
   call void @llvm.instrprof.increment(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__profn_foo_weak, i32 0, i32 0), i64 0, i32 1, i32 0)
   ret void
@@ -71,8 +71,8 @@
 ; MACHO: @__profd_foo_inline = linkonce_odr hidden global
 ; COFF: @__profc_foo_inline = linkonce_odr hidden global{{.*}} section ".lprfc$M", align 8
 ; COFF: @__profd_foo_inline = private global{{.*}} section ".lprfd$M", align 8
-; XCOFF: @__profc_foo_inline = linkonce_odr hidden global
-; XCOFF: @__profd_foo_inline = linkonce_odr hidden global
+; XCOFF: @__profc_foo_inline = private global
+; XCOFF: @__profd_foo_inline = private global
 define linkonce_odr void @foo_inline() {
   call void @llvm.instrprof.increment(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__profn_foo_inline, i32 0, i32 0), i64 0, i32 1, i32 0)
   ret void
@@ -84,8 +84,8 @@
 ; MACHO: @__profd_foo_extern = linkonce_odr hidden global
 ; COFF: @__profc_foo_extern = linkonce_odr hidden global {{.*}}section ".lprfc$M", comdat, align 8
 ; COFF: @__profd_foo_extern = private global {{.*}}section ".lprfd$M", comdat($__profc_foo_extern), align 8
-; XCOFF: @__profc_foo_extern = linkonce_odr hidden global
-; XCOFF: @__profd_foo_extern = linkonce_odr hidden global
+; XCOFF: @__profc_foo_extern = private global
+; XCOFF: @__profd_foo_extern = private global
 define available_externally void @foo_extern() {
   call void @llvm.instrprof.increment(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__profn_foo_extern, i32 0, i32 0), i64 0, i32 1, i32 0)
   ret void
Index: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
===
--- llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -862,6 +862,15 @@
   GlobalValue::LinkageTypes Linkage = NamePtr->getLinkage();
   GlobalValue::VisibilityTypes Visibility = NamePtr->getVisibility();
 
+  // Due to the current limitation of binder, the duplicate weak symbols in the
+  // same csect won't be discarded. When there are duplicate weak symbols,
+  // we can NOT guarantee that the relocations get resolved to the intended weak
+  // symbol, so we can not ensure the correctness of the relative CounterPtr, so
+  // we have to use private linkage for counter and data symbols.
+  if (TT.isOSBinFormatXCOFF()) {
+Linkage = GlobalValue::PrivateLinkage;
+Visibility = GlobalValue::DefaultVisibility;
+  }
   // Move the name variable to the right section. Place them in a COMDAT group
   // if the associated function is a COMDAT. This will make sure that only one
   // copy of counters of the COMDAT function will be emitted after linking. Keep
@@ -966,7 +975,7 @@
   // that other copies must have the same CFG and cannot have value profiling.
   // If no hash suffix, other profd copies may be referenced by code.
   if (NS == 0 && !(DataReferencedByCode && NeedComdat && !Renamed) &&
-  (TT.isOSBinFormatELF() ||
+  (TT.isOSBinFormatELF() || TT.isOSBinFormatXCOFF() ||
(!DataReferencedByCode && TT.isOSBinFormatCOFF( {
 Linkage = GlobalValue::PrivateLinkage;
 Visibility = GlobalValue::DefaultVisibility;
Index: clang/test/Profile/cxx-templates.cpp
===
--- clang/test/Profile/cxx-templates.cpp
+++ clang/test/Profile/cxx-templates.cpp
@@ -10,8 +10,10 @@
 // RUN: FileCheck --input-file=%tuse -check-prefix=T0USE -check-prefix=ALL %s
 // RUN: FileCheck --input-file=%tuse -check-prefix=T100USE -check-prefix=ALL %s
 
-// T0GEN: @[[T0C:__profc__Z4loopILj0EEvv]] = linkonce_odr {{(hidden|dso_local)}} global [2 x i64] zeroinitializer
-// T100GEN: @[[T100C:__profc__Z4loopILj100EEvv]] = linkonce_odr {{(hidden|dso_local)}} global [2 x i64] zeroinitializer
+// The linkage can be target dependent, so accept 

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

2021-09-24 Thread Lei Huang via Phabricator via cfe-commits
lei accepted this revision as: lei.
lei added a comment.

LGTM
Pleases address nit on commit.




Comment at: clang/lib/Sema/SemaChecking.cpp:3495-3496
+ArgType != QualType(Context.DoubleTy)) {
+  Diag(TheCall->getBeginLoc(), diag::err_ppc_invalid_test_data_class_type);
+  return true;
+}

nit: I think these 2 stmts can just be merged into `return Diag();` and 
brace removed.


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] D110386: [clangd] Refactor IncludeStructure: use File (unsigned) for most computations

2021-09-24 Thread Thorsten via Phabricator via cfe-commits
tschuett added a comment.

Do you want to wrap the `unsigned` in a struct to make it slightly safer, but 
more complicated to use?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110386

___
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-24 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVRegisterInfo.td:219
+def GPR32Pairs : RegisterTuples<[gpr32_pair_lo, gpr32_pair_hi],
+[(add X0,  X2,  X4,  X6,
+  X8,  X10, X12, X14,

jrtc27 wrote:
> Won't the order affect register allocation? Technically not an issue for this 
> MC patch but the correct thing should be committed so there's no churn when 
> adding codegen.
> 
> That or don't reuse this in the register class below and instead manually 
> list the pairs in the class.
You didn't need to manually list them all here...



Comment at: llvm/lib/Target/RISCV/RISCVRegisterInfo.td:228
+
+def GPR32Pair : RegisterClass<"RISCV", [untyped], 64, (add GPR32Pairs)> {
+  let Size = 64;

Jim wrote:
> jrtc27 wrote:
> > Why is this untyped?
> GPR32Pair has untyped type. 
> In code generation, It captures some operation with i64 type supported by 
> Zpsoperand to untyped during legalization. 
> In my mind, untyped is used to be represented special type don't need any 
> legalization.
> I refer to ARMRegisterInfo.td that defines GPRPair with untyped.
So, presumably it can't be i64 because that would then make i64 a legal type? 
Maybe that's fine, maybe it's not, but alternatively it could be typed as v2i32 
here (can include v4i16 and v8i8 too) and cast if/when needed. Craig maybe you 
have thoughts on this? But untyped always feels like laziness to me that 
results in TableGen being unable to help you when it comes to type checking, 
with rare exceptions.


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


  1   2   >