[PATCH] D80237: [hip] Ensure pointer in struct argument has proper `addrspacecast`.

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Okay.  Can you explain why we need to coerce in the first place, though?  
Especially if the representation is the same, why is your target-lowering 
requiring parameters to be coerced to involve pointers in a different address 
space?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80237



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


[PATCH] D80237: [hip] Ensure pointer in struct argument has proper `addrspacecast`.

2020-05-22 Thread Michael Liao via Phabricator via cfe-commits
hliao added a comment.

In D80237#2051918 , @rjmccall wrote:

> In D80237#2051909 , @hliao wrote:
>
> > In D80237#2051887 , @rjmccall 
> > wrote:
> >
> > > `addrspacecast` might be a real conversion.  I feel like this is really 
> > > going well beyond what argument coercion should be expected to do, and we 
> > > need to step back and re-evaluate how we're doing this.
> >
> >
> > `addrspacecast` *must* be a no-op in terms of argument coercion.
>
>
> So what does this mean exactly?  If the ABI lowering uses argument coercion 
> in a way that changes address spaces, it must ensure that the representations 
> are different?  So it's always *legal* to just do a memcpy here, we're just 
> trying really hard to not do so.


If `addrspacecast` is used, the target must ensure that `addrspacecast` would 
NOT change the representation to use argument coercion. Yeah, it's always safe 
to memcpy or load/store directly but, without target specific knowledge, 
SROA/GVN won't create a no-op `addrspacecast` to help address space inferring 
pass. SROA/GVN only generates the pair of `ptr2int`/`int2ptr` to ensure the 
presentation is the same. Unfortunately, address space inferring doesn't 
understand that without target specific knowledge as well. That leaves the 
address space information won't be propagated to final IR. We need a trigger to 
enable that. That's why we need to add `addrspacecast` for a simple type 
argument in line 1314 - 1321. In this patch, we need to traverse the struct and 
add proper `addrspacecast`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80237



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


[PATCH] D80251: [X86] Update some av512 shift intrinsics to use "unsigned int" parameter instead of int to match Intel documentaiton

2020-05-22 Thread Craig Topper via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1b02db52b79e: [X86] Update some av512 shift intrinsics to 
use unsigned int parameter… (authored by craig.topper).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80251

Files:
  clang/lib/Headers/avx512bwintrin.h
  clang/lib/Headers/avx512fintrin.h
  clang/lib/Headers/avx512vlbwintrin.h
  clang/lib/Headers/avx512vlintrin.h
  clang/test/CodeGen/avx512bw-builtins.c
  clang/test/CodeGen/avx512f-builtins.c
  clang/test/CodeGen/avx512vl-builtins.c
  clang/test/CodeGen/avx512vlbw-builtins.c

Index: clang/test/CodeGen/avx512vlbw-builtins.c
===
--- clang/test/CodeGen/avx512vlbw-builtins.c
+++ clang/test/CodeGen/avx512vlbw-builtins.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -fexperimental-new-pass-manager -triple=x86_64-apple-darwin -target-feature +avx512bw -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
-// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -fexperimental-new-pass-manager -triple=x86_64-apple-darwin -target-feature +avx512bw -target-feature +avx512vl -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -fexperimental-new-pass-manager -triple=x86_64-apple-darwin -target-feature +avx512bw -target-feature +avx512vl -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -fexperimental-new-pass-manager -triple=x86_64-apple-darwin -target-feature +avx512bw -target-feature +avx512vl -fno-signed-char -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s
 
 #include 
 
@@ -2199,7 +2199,7 @@
   return _mm_mask_slli_epi16(__W, __U, __A, 5); 
 }
 
-__m128i test_mm_mask_slli_epi16_2(__m128i __W, __mmask8 __U, __m128i __A, int __B) {
+__m128i test_mm_mask_slli_epi16_2(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm_mask_slli_epi16_2
   // CHECK: @llvm.x86.sse2.pslli.w
   // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
@@ -2213,7 +2213,7 @@
   return _mm_maskz_slli_epi16(__U, __A, 5); 
 }
 
-__m128i test_mm_maskz_slli_epi16_2(__mmask8 __U, __m128i __A, int __B) {
+__m128i test_mm_maskz_slli_epi16_2(__mmask8 __U, __m128i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm_maskz_slli_epi16_2
   // CHECK: @llvm.x86.sse2.pslli.w
   // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
@@ -2227,7 +2227,7 @@
   return _mm256_mask_slli_epi16(__W, __U, __A, 5); 
 }
 
-__m256i test_mm256_mask_slli_epi16_2(__m256i __W, __mmask16 __U, __m256i __A, int __B) {
+__m256i test_mm256_mask_slli_epi16_2(__m256i __W, __mmask16 __U, __m256i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm256_mask_slli_epi16_2
   // CHECK: @llvm.x86.avx2.pslli.w
   // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
@@ -2241,7 +2241,7 @@
   return _mm256_maskz_slli_epi16(__U, __A, 5); 
 }
 
-__m256i test_mm256_maskz_slli_epi16_2(__mmask16 __U, __m256i __A, int __B) {
+__m256i test_mm256_maskz_slli_epi16_2(__mmask16 __U, __m256i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm256_maskz_slli_epi16_2
   // CHECK: @llvm.x86.avx2.pslli.w
   // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
@@ -2447,7 +2447,7 @@
   return _mm_mask_srai_epi16(__W, __U, __A, 5); 
 }
 
-__m128i test_mm_mask_srai_epi16_2(__m128i __W, __mmask8 __U, __m128i __A, int __B) {
+__m128i test_mm_mask_srai_epi16_2(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm_mask_srai_epi16_2
   // CHECK: @llvm.x86.sse2.psrai.w
   // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
@@ -2461,7 +2461,7 @@
   return _mm_maskz_srai_epi16(__U, __A, 5); 
 }
 
-__m128i test_mm_maskz_srai_epi16_2(__mmask8 __U, __m128i __A, int __B) {
+__m128i test_mm_maskz_srai_epi16_2(__mmask8 __U, __m128i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm_maskz_srai_epi16_2
   // CHECK: @llvm.x86.sse2.psrai.w
   // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
@@ -2475,7 +2475,7 @@
   return _mm256_mask_srai_epi16(__W, __U, __A, 5); 
 }
 
-__m256i test_mm256_mask_srai_epi16_2(__m256i __W, __mmask16 __U, __m256i __A, int __B) {
+__m256i test_mm256_mask_srai_epi16_2(__m256i __W, __mmask16 __U, __m256i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm256_mask_srai_epi16_2
   // CHECK: @llvm.x86.avx2.psrai.w
   // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
@@ -2489,7 +2489,7 @@
   return _mm256_maskz_srai_epi16(__U, __A, 5); 
 }
 
-__m256i test_mm256_maskz_srai_epi16_2(__mmask16 __U, __m256i __A, int __B) {
+__m256i test_mm256_maskz_srai_epi16_2(__mmask16 __U, __m256i 

[clang] 1b02db5 - [X86] Update some av512 shift intrinsics to use "unsigned int" parameter instead of int to match Intel documentation

2020-05-22 Thread Craig Topper via cfe-commits

Author: Craig Topper
Date: 2020-05-22T20:12:57-07:00
New Revision: 1b02db52b79e01f038775f59193a49850a34184d

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

LOG: [X86] Update some av512 shift intrinsics to use "unsigned int" parameter 
instead of int to match Intel documentation

There are 65 that take a scalar shift amount. Intel documentation shows 60 of 
them taking unsigned int. There are 5 versions of srli_epi16 that use int, the 
512-bit maskz and 128/256 mask/maskz.

Fixes PR45931

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

Added: 


Modified: 
clang/lib/Headers/avx512bwintrin.h
clang/lib/Headers/avx512fintrin.h
clang/lib/Headers/avx512vlbwintrin.h
clang/lib/Headers/avx512vlintrin.h
clang/test/CodeGen/avx512bw-builtins.c
clang/test/CodeGen/avx512f-builtins.c
clang/test/CodeGen/avx512vl-builtins.c
clang/test/CodeGen/avx512vlbw-builtins.c

Removed: 




diff  --git a/clang/lib/Headers/avx512bwintrin.h 
b/clang/lib/Headers/avx512bwintrin.h
index 376558407683..4281a33d375c 100644
--- a/clang/lib/Headers/avx512bwintrin.h
+++ b/clang/lib/Headers/avx512bwintrin.h
@@ -1504,13 +1504,14 @@ _mm512_maskz_sll_epi16(__mmask32 __U, __m512i __A, 
__m128i __B)
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS512
-_mm512_slli_epi16(__m512i __A, int __B)
+_mm512_slli_epi16(__m512i __A, unsigned int __B)
 {
   return (__m512i)__builtin_ia32_psllwi512((__v32hi)__A, __B);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS512
-_mm512_mask_slli_epi16(__m512i __W, __mmask32 __U, __m512i __A, int __B)
+_mm512_mask_slli_epi16(__m512i __W, __mmask32 __U, __m512i __A,
+   unsigned int __B)
 {
   return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
  (__v32hi)_mm512_slli_epi16(__A, __B),
@@ -1518,7 +1519,7 @@ _mm512_mask_slli_epi16(__m512i __W, __mmask32 __U, 
__m512i __A, int __B)
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS512
-_mm512_maskz_slli_epi16(__mmask32 __U, __m512i __A, int __B)
+_mm512_maskz_slli_epi16(__mmask32 __U, __m512i __A, unsigned int __B)
 {
   return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
  (__v32hi)_mm512_slli_epi16(__A, __B),
@@ -1595,13 +1596,14 @@ _mm512_maskz_sra_epi16(__mmask32 __U, __m512i __A, 
__m128i __B)
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS512
-_mm512_srai_epi16(__m512i __A, int __B)
+_mm512_srai_epi16(__m512i __A, unsigned int __B)
 {
   return (__m512i)__builtin_ia32_psrawi512((__v32hi)__A, __B);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS512
-_mm512_mask_srai_epi16(__m512i __W, __mmask32 __U, __m512i __A, int __B)
+_mm512_mask_srai_epi16(__m512i __W, __mmask32 __U, __m512i __A,
+   unsigned int __B)
 {
   return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
  (__v32hi)_mm512_srai_epi16(__A, __B),
@@ -1609,7 +1611,7 @@ _mm512_mask_srai_epi16(__m512i __W, __mmask32 __U, 
__m512i __A, int __B)
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS512
-_mm512_maskz_srai_epi16(__mmask32 __U, __m512i __A, int __B)
+_mm512_maskz_srai_epi16(__mmask32 __U, __m512i __A, unsigned int __B)
 {
   return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
  (__v32hi)_mm512_srai_epi16(__A, __B),
@@ -1639,13 +1641,14 @@ _mm512_maskz_srl_epi16(__mmask32 __U, __m512i __A, 
__m128i __B)
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS512
-_mm512_srli_epi16(__m512i __A, int __B)
+_mm512_srli_epi16(__m512i __A, unsigned int __B)
 {
   return (__m512i)__builtin_ia32_psrlwi512((__v32hi)__A, __B);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS512
-_mm512_mask_srli_epi16(__m512i __W, __mmask32 __U, __m512i __A, int __B)
+_mm512_mask_srli_epi16(__m512i __W, __mmask32 __U, __m512i __A,
+   unsigned int __B)
 {
   return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
  (__v32hi)_mm512_srli_epi16(__A, __B),

diff  --git a/clang/lib/Headers/avx512fintrin.h 
b/clang/lib/Headers/avx512fintrin.h
index 7465da379bdd..fa22ef3fdd18 100644
--- a/clang/lib/Headers/avx512fintrin.h
+++ b/clang/lib/Headers/avx512fintrin.h
@@ -5111,13 +5111,14 @@ _mm512_maskz_rolv_epi64 (__mmask8 __U, __m512i __A, 
__m512i __B)
   (__v8di)_mm512_setzero_si512())
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS512
-_mm512_slli_epi32(__m512i __A, int __B)
+_mm512_slli_epi32(__m512i __A, unsigned int __B)
 {
   return (__m512i)__builtin_ia32_pslldi512((__v16si)__A, __B);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS512
-_mm512_mask_slli_epi32(__m512i __W, __mmask16 __U, __m512i __A, int __B)
+_mm512_mask_slli_epi32(__m512i __W, 

[PATCH] D77491: [Sema] Introduce BuiltinAttr, per-declaration builtin-ness

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/Sema/SemaDecl.cpp:8880
+  }
+}
+

tambre wrote:
> rjmccall wrote:
> > Hmm.  I'm concerned about not doing any sort of semantic compatibility 
> > check here before we assign the function special semantics.  Have we really 
> > never done those in C++?
> > 
> > If not, I wonder if we can reasonably make an implicit declaration but just 
> > make it hidden from lookup.
> Currently there's no semantic compatibility checking for builtin 
> redeclarations. There is for initial declarations though.
> 
> I've added this checking by splitting the actual builtin declaration creation 
> off from `LazilyCreateBuiltin` into `CreateBuiltin` and checking if the 
> current declaration is compatible with what the builtin's would be.
> This results in stronger typechecking than before for builtin declarations, 
> so some incompatible declarations are no longer marked as builtin. See 
> `cxx1z-noexcept-function-type.cpp` for an example.
That makes sense to me in principle.  I'm definitely concerned about `noexcept` 
differences causing C library functions to not be treated as builtins, though; 
that seems stricter than we want.  How reasonable is it to weaken this?



Comment at: clang/test/Sema/warn-fortify-source.c:20
 void *memcpy(void *dst, const void *src, size_t c);
 static void *memcpy(void *dst __attribute__((pass_object_size(1))), const void 
*src, size_t c) __attribute__((overloadable)) __asm__("merp");
 static void *memcpy(void *const dst __attribute__((pass_object_size(1))), 
const void *src, size_t c) __attribute__((overloadable)) {

tambre wrote:
> Not quite sure what to do here. These were previously recognized as builtins 
> due to their name despite being incompatible and thus had fortify checking 
> similar to the real `memcpy`.
> 
> Maybe:
> 1. Introduce a generic version of `ArmBuiltinAliasAttr`.
> 2. Something like `FormatAttr`.
That's interesting.  It definitely seems wrong to apply builtin logic to a 
function that doesn't have a compatible low-level signature.  My inclination is 
to disable builtin checking here, but to notify the contributors so that they 
can figure out an appropriate response.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77491



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


[PATCH] D80417: Fix Darwin 'constinit thread_local' variables.

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4145
+  // referenced directly, without calling the thread-wrapper, so the linkage
+  // must not be changed.
+  //

hubert.reinterpretcast wrote:
> rjmccall wrote:
> > Is this a good idea?  It seems to be making `constinit` part of the 
> > interface of a declaration, when it seems like it should strictly part of 
> > the implementation.
> @rsmith, fyi. My understanding is that `constinit` is as much part of the 
> interface as `__thread` or `_Thread_local`.
Oh, heh.  My impression had been an informal one, that it was purely a matter 
of enforcing static initialization, but I see that the committee did indeed 
sneak in the thread-local optimization.  I guess all it means is that you can 
never take away `constinit` from an extern declaration once you've added it if 
you need a stable ABI.

Anyway, nevermind.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80417



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


[PATCH] D80237: [hip] Ensure pointer in struct argument has proper `addrspacecast`.

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In D80237#2051909 , @hliao wrote:

> In D80237#2051887 , @rjmccall wrote:
>
> > `addrspacecast` might be a real conversion.  I feel like this is really 
> > going well beyond what argument coercion should be expected to do, and we 
> > need to step back and re-evaluate how we're doing this.
>
>
> `addrspacecast` *must* be a no-op in terms of argument coercion.


So what does this mean exactly?  If the ABI lowering uses argument coercion in 
a way that changes address spaces, it must ensure that the representations are 
different?  So it's always *legal* to just do a memcpy here, we're just trying 
really hard to not do so.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80237



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


[PATCH] D80461: HIP: Try to deal with more llvm package layouts

2020-05-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks.


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

https://reviews.llvm.org/D80461



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


[PATCH] D80237: [hip] Ensure pointer in struct argument has proper `addrspacecast`.

2020-05-22 Thread Michael Liao via Phabricator via cfe-commits
hliao marked an inline comment as done.
hliao added a comment.

In D80237#2051887 , @rjmccall wrote:

> `addrspacecast` might be a real conversion.  I feel like this is really going 
> well beyond what argument coercion should be expected to do, and we need to 
> step back and re-evaluate how we're doing this.


`addrspacecast` *must* be a no-op in terms of argument coercion. As we change 
the parameter type but cannot control how an argument is prepared, coercion 
should only change how we interpret them instead of how we encode them. If the 
target chooses to add an `addrspacecast`, it must ensure that's a no-op. In 
AMDGPU, global pointers have the same encoding as their corresponding generic 
pointers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80237



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


[PATCH] D76793: [Matrix] Implement + and - operators for MatrixType.

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/Sema/SemaExpr.cpp:11989
+  else
+return false;
+

I would suggest checking some preconditions and then just calling 
`PrepareScalarCast`.

You should allow implicit conversions from class types, which somewhat 
surprisingly I'm not sure we have a convenient method for, but which you can 
find workable code for in `ConvertForConditional` in SemaExprCXX.cpp.  Test 
case is `struct DoubleWrapper { operator double(); };`, and you should test 
using that even when the element type isn't a double.

In SemaOverload, you should add builtin candidates for these operators if one 
operand or the other is a matrix type.  Basically:

1. Collect matrix types in `AddTypesConvertedFrom`
2. For each matrix type `M` on the LHS, add candidates for `(M, M) -> M` and 
`(M, E) -> M`, and then analogously on the RHS.  Although you might need to 
avoid adding redundant candidates if the same type shows up on both sides.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76793



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


[PATCH] D80417: Fix Darwin 'constinit thread_local' variables.

2020-05-22 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added subscribers: rsmith, hubert.reinterpretcast.
hubert.reinterpretcast added inline comments.



Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4145
+  // referenced directly, without calling the thread-wrapper, so the linkage
+  // must not be changed.
+  //

rjmccall wrote:
> Is this a good idea?  It seems to be making `constinit` part of the interface 
> of a declaration, when it seems like it should strictly part of the 
> implementation.
@rsmith, fyi. My understanding is that `constinit` is as much part of the 
interface as `__thread` or `_Thread_local`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80417



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


[PATCH] D80374: [Clang] Enable KF and KC mode for [_Complex] __float128

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Would you mind separating these two patches?  They don't seem have any 
interdependencies.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80374



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


[PATCH] D80417: Fix Darwin 'constinit thread_local' variables.

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4145
+  // referenced directly, without calling the thread-wrapper, so the linkage
+  // must not be changed.
+  //

Is this a good idea?  It seems to be making `constinit` part of the interface 
of a declaration, when it seems like it should strictly part of the 
implementation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80417



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


[PATCH] D80237: [hip] Ensure pointer in struct argument has proper `addrspacecast`.

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

`addrspacecast` might be a real conversion.  I feel like this is really going 
well beyond what argument coercion should be expected to do, and we need to 
step back and re-evaluate how we're doing this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80237



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


[PATCH] D80463: Debug Info: Mark os_log helper functions as artificial

2020-05-22 Thread Vedant Kumar via Phabricator via cfe-commits
vsk accepted this revision.
vsk added a comment.
This revision is now accepted and ready to land.

Thanks, lgtm!


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

https://reviews.llvm.org/D80463



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


[PATCH] D73037: Add a way to set traversal mode in clang-query

2020-05-22 Thread Stephen Kelly via Phabricator via cfe-commits
steveire updated this revision to Diff 265826.
steveire added a comment.

Update


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73037

Files:
  clang-tools-extra/clang-query/Query.cpp
  clang-tools-extra/clang-query/Query.h
  clang-tools-extra/clang-query/QueryParser.cpp
  clang-tools-extra/clang-query/QueryParser.h
  clang-tools-extra/clang-query/QuerySession.h
  clang-tools-extra/unittests/clang-query/QueryParserTest.cpp

Index: clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
===
--- clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
+++ clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
@@ -110,6 +110,18 @@
   ASSERT_TRUE(isa >(Q));
   EXPECT_EQ(::BindRoot, cast >(Q)->Var);
   EXPECT_EQ(true, cast >(Q)->Value);
+
+  Q = parse("set traversal AsIs");
+  ASSERT_TRUE(isa>(Q));
+  EXPECT_EQ(::TK,
+cast>(Q)->Var);
+  EXPECT_EQ(ast_type_traits::TK_AsIs,
+cast>(Q)->Value);
+
+  Q = parse("set traversal NotATraversal");
+  ASSERT_TRUE(isa(Q));
+  EXPECT_EQ("expected traversal kind, got 'NotATraversal'",
+cast(Q)->ErrStr);
 }
 
 TEST_F(QueryParserTest, Match) {
@@ -197,6 +209,11 @@
   EXPECT_EQ("utput ", Comps[0].TypedText);
   EXPECT_EQ("output", Comps[0].DisplayText);
 
+  Comps = QueryParser::complete("set t", 5, QS);
+  ASSERT_EQ(1u, Comps.size());
+  EXPECT_EQ("raversal ", Comps[0].TypedText);
+  EXPECT_EQ("traversal", Comps[0].DisplayText);
+
   Comps = QueryParser::complete("enable ", 7, QS);
   ASSERT_EQ(1u, Comps.size());
   EXPECT_EQ("output ", Comps[0].TypedText);
@@ -214,6 +231,16 @@
   EXPECT_EQ("dump ", Comps[3].TypedText);
   EXPECT_EQ("dump", Comps[3].DisplayText);
 
+  Comps = QueryParser::complete("set traversal ", 14, QS);
+  ASSERT_EQ(3u, Comps.size());
+
+  EXPECT_EQ("AsIs ", Comps[0].TypedText);
+  EXPECT_EQ("AsIs", Comps[0].DisplayText);
+  EXPECT_EQ("IgnoreImplicitCastsAndParentheses ", Comps[1].TypedText);
+  EXPECT_EQ("IgnoreImplicitCastsAndParentheses", Comps[1].DisplayText);
+  EXPECT_EQ("IgnoreUnlessSpelledInSource ", Comps[2].TypedText);
+  EXPECT_EQ("IgnoreUnlessSpelledInSource", Comps[2].DisplayText);
+
   Comps = QueryParser::complete("match while", 11, QS);
   ASSERT_EQ(1u, Comps.size());
   EXPECT_EQ("Stmt(", Comps[0].TypedText);
Index: clang-tools-extra/clang-query/QuerySession.h
===
--- clang-tools-extra/clang-query/QuerySession.h
+++ clang-tools-extra/clang-query/QuerySession.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_QUERY_QUERY_SESSION_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_QUERY_QUERY_SESSION_H
 
+#include "clang/AST/ASTTypeTraits.h"
 #include "clang/ASTMatchers/Dynamic/VariantValue.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringMap.h"
@@ -25,7 +26,7 @@
   QuerySession(llvm::ArrayRef> ASTs)
   : ASTs(ASTs), PrintOutput(false), DiagOutput(true),
 DetailedASTOutput(false), BindRoot(true), PrintMatcher(false),
-Terminate(false) {}
+Terminate(false), TK(ast_type_traits::TK_IgnoreUnlessSpelledInSource) {}
 
   llvm::ArrayRef> ASTs;
 
@@ -36,6 +37,8 @@
   bool BindRoot;
   bool PrintMatcher;
   bool Terminate;
+
+  ast_type_traits::TraversalKind TK;
   llvm::StringMap NamedValues;
 };
 
Index: clang-tools-extra/clang-query/QueryParser.h
===
--- clang-tools-extra/clang-query/QueryParser.h
+++ clang-tools-extra/clang-query/QueryParser.h
@@ -43,6 +43,8 @@
   template  struct LexOrCompleteWord;
 
   QueryRef parseSetBool(bool QuerySession::*Var);
+  QueryRef
+  parseSetTraversalKind(ast_type_traits::TraversalKind QuerySession::*Var);
   template  QueryRef parseSetOutputKind();
   QueryRef completeMatcherExpression();
 
Index: clang-tools-extra/clang-query/QueryParser.cpp
===
--- clang-tools-extra/clang-query/QueryParser.cpp
+++ clang-tools-extra/clang-query/QueryParser.cpp
@@ -128,6 +128,24 @@
   llvm_unreachable("Invalid output kind");
 }
 
+QueryRef QueryParser::parseSetTraversalKind(
+ast_type_traits::TraversalKind QuerySession::*Var) {
+  StringRef ValStr;
+  unsigned Value =
+  LexOrCompleteWord(this, ValStr)
+  .Case("AsIs", ast_type_traits::TK_AsIs)
+  .Case("IgnoreImplicitCastsAndParentheses",
+ast_type_traits::TK_IgnoreImplicitCastsAndParentheses)
+  .Case("IgnoreUnlessSpelledInSource",
+ast_type_traits::TK_IgnoreUnlessSpelledInSource)
+  .Default(~0u);
+  if (Value == ~0u) {
+return new InvalidQuery("expected traversal kind, got '" + ValStr + "'");
+  }
+  return new SetQuery(
+  Var, static_cast(Value));
+}
+
 QueryRef QueryParser::endQuery(QueryRef Q) {
   StringRef Extra = Line;
   StringRef ExtraTrimmed = Extra.drop_while(
@@ -171,7 

[PATCH] D72534: Change default traversal in AST Matchers to ignore invisible nodes

2020-05-22 Thread Stephen Kelly via Phabricator via cfe-commits
steveire updated this revision to Diff 265827.
steveire added a comment.

Touch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72534

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/ParentMapContext.h


Index: clang/include/clang/AST/ParentMapContext.h
===
--- clang/include/clang/AST/ParentMapContext.h
+++ clang/include/clang/AST/ParentMapContext.h
@@ -67,7 +67,7 @@
 private:
   ASTContext 
   class ParentMap;
-  TraversalKind Traversal = TK_AsIs;
+  TraversalKind Traversal = TK_IgnoreUnlessSpelledInSource;
   std::unique_ptr Parents;
 };
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -246,7 +246,14 @@
 AST Matchers
 
 
-- ...
+- Traversal in AST Matchers was simplified to use the
+  ``TK_IgnoreUnlessSpelledInSource`` mode by default, instead of ``TK_AsIs``.
+  This means that many uses of the ``ignoringImplicit()`` and similar matchers
+  is no longer necessary.  Clients of AST Matchers which wish to match on
+  implicit AST nodes can wrap their matcher in ``traverse(TK_AsIs, ...)`` or
+  use ``TraversalKindScope`` if appropriate.  The ``clang-query`` tool also
+  uses ``IgnoreUnlessSpelledInSource`` by default.  The mode can be changed
+  using ``set traversal AsIs`` in the ``clang-query`` environment.
 
 clang-format
 


Index: clang/include/clang/AST/ParentMapContext.h
===
--- clang/include/clang/AST/ParentMapContext.h
+++ clang/include/clang/AST/ParentMapContext.h
@@ -67,7 +67,7 @@
 private:
   ASTContext 
   class ParentMap;
-  TraversalKind Traversal = TK_AsIs;
+  TraversalKind Traversal = TK_IgnoreUnlessSpelledInSource;
   std::unique_ptr Parents;
 };
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -246,7 +246,14 @@
 AST Matchers
 
 
-- ...
+- Traversal in AST Matchers was simplified to use the
+  ``TK_IgnoreUnlessSpelledInSource`` mode by default, instead of ``TK_AsIs``.
+  This means that many uses of the ``ignoringImplicit()`` and similar matchers
+  is no longer necessary.  Clients of AST Matchers which wish to match on
+  implicit AST nodes can wrap their matcher in ``traverse(TK_AsIs, ...)`` or
+  use ``TraversalKindScope`` if appropriate.  The ``clang-query`` tool also
+  uses ``IgnoreUnlessSpelledInSource`` by default.  The mode can be changed
+  using ``set traversal AsIs`` in the ``clang-query`` environment.
 
 clang-format
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80463: Debug Info: Mark os_log helper functions as artificial

2020-05-22 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl created this revision.
aprantl added reviewers: vsk, ahatanak, JDevlieghere, friss.
aprantl added a project: debug-info.
Herald added a subscriber: dexonsmith.
aprantl edited the summary of this revision.

The os_log helper functions are linkonce_odr and supposed to be uniqued across 
TUs, so attachine a DW_AT_decl_line on it is highly misleading. By setting the 
function decl to implicit, CGDebugInfo properly marks the functions as 
artificial and uses a default file / line 0 location for the function.

rdar://problem/63450824


https://reviews.llvm.org/D80463

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/debug-info-oslog.c


Index: clang/test/CodeGen/debug-info-oslog.c
===
--- /dev/null
+++ clang/test/CodeGen/debug-info-oslog.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple x86_64-darwin-apple -debug-info-kind=limited \
+// RUN:   %s -emit-llvm -o -  | FileCheck %s
+void test_builtin_os_log(void *buf, int i, const char *data) {
+  __builtin_os_log_format(buf, "%d", i);
+}
+
+// CHECK: define linkonce_odr {{.*}}@__os_log_helper_1_0_1_4_0(
+// CHECK-SAME:   !dbg ![[OS_LOG_HELPER:[0-9]+]]
+
+// This helper is going to be uniqued, so it should not have a line
+// number between file and type.
+
+// CHECK: distinct !DISubprogram(name: "__os_log_helper_1_0_1_4_0",
+// CHECK-SAME:   file: !{{[0-9+]}}, type
+// CHECK-SAME:   flags: DIFlagArtificial
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -1271,6 +1271,8 @@
   FunctionDecl *FD = FunctionDecl::Create(
   Ctx, Ctx.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), 
II,
   FuncionTy, nullptr, SC_PrivateExtern, false, false);
+  // Avoid generating debug location info for the function.
+  FD->setImplicit();
 
   StartFunction(FD, ReturnTy, Fn, FI, Args);
 


Index: clang/test/CodeGen/debug-info-oslog.c
===
--- /dev/null
+++ clang/test/CodeGen/debug-info-oslog.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple x86_64-darwin-apple -debug-info-kind=limited \
+// RUN:   %s -emit-llvm -o -  | FileCheck %s
+void test_builtin_os_log(void *buf, int i, const char *data) {
+  __builtin_os_log_format(buf, "%d", i);
+}
+
+// CHECK: define linkonce_odr {{.*}}@__os_log_helper_1_0_1_4_0(
+// CHECK-SAME:   !dbg ![[OS_LOG_HELPER:[0-9]+]]
+
+// This helper is going to be uniqued, so it should not have a line
+// number between file and type.
+
+// CHECK: distinct !DISubprogram(name: "__os_log_helper_1_0_1_4_0",
+// CHECK-SAME:   file: !{{[0-9+]}}, type
+// CHECK-SAME:   flags: DIFlagArtificial
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -1271,6 +1271,8 @@
   FunctionDecl *FD = FunctionDecl::Create(
   Ctx, Ctx.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), II,
   FuncionTy, nullptr, SC_PrivateExtern, false, false);
+  // Avoid generating debug location info for the function.
+  FD->setImplicit();
 
   StartFunction(FD, ReturnTy, Fn, FI, Args);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80464: [CUDA] Missing __syncthreads intrinsic in __clang_cuda_device_functions.h

2020-05-22 Thread Boris Staletic via Phabricator via cfe-commits
bstaletic created this revision.
bstaletic added a reviewer: aprantl.
Herald added subscribers: cfe-commits, yaxunl.
Herald added a project: clang.

Seems like the `__syncthreads` is missing from the 
`clang/lib/Headers/__clang_cuda_device_functions.h` file. To be honest, I don't 
know much about CUDA. This issue was noticed by a YouCompleteMe user who then 
made a pull request:

https://github.com/ycm-core/ycmd/pull/1438

I did not create any tests, because a similar patch did not include tests:

https://reviews.llvm.org/D43602


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80464

Files:
  clang/lib/Headers/__clang_cuda_device_functions.h


Index: clang/lib/Headers/__clang_cuda_device_functions.h
===
--- clang/lib/Headers/__clang_cuda_device_functions.h
+++ clang/lib/Headers/__clang_cuda_device_functions.h
@@ -519,6 +519,7 @@
   return __nv_fast_sincosf(__a, __s, __c);
 }
 __DEVICE__ float __sinf(float __a) { return __nv_fast_sinf(__a); }
+__DEVICE__ int __syncthreads(void) { return __nvvm_bar0(); }
 __DEVICE__ int __syncthreads_and(int __a) { return __nvvm_bar0_and(__a); }
 __DEVICE__ int __syncthreads_count(int __a) { return __nvvm_bar0_popc(__a); }
 __DEVICE__ int __syncthreads_or(int __a) { return __nvvm_bar0_or(__a); }


Index: clang/lib/Headers/__clang_cuda_device_functions.h
===
--- clang/lib/Headers/__clang_cuda_device_functions.h
+++ clang/lib/Headers/__clang_cuda_device_functions.h
@@ -519,6 +519,7 @@
   return __nv_fast_sincosf(__a, __s, __c);
 }
 __DEVICE__ float __sinf(float __a) { return __nv_fast_sinf(__a); }
+__DEVICE__ int __syncthreads(void) { return __nvvm_bar0(); }
 __DEVICE__ int __syncthreads_and(int __a) { return __nvvm_bar0_and(__a); }
 __DEVICE__ int __syncthreads_count(int __a) { return __nvvm_bar0_popc(__a); }
 __DEVICE__ int __syncthreads_or(int __a) { return __nvvm_bar0_or(__a); }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80462: Fix floating point math function attributes definition.

2020-05-22 Thread Michele Scandale via Phabricator via cfe-commits
michele.scandale created this revision.
michele.scandale added reviewers: rjmccall, mibintc.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

With the support for changing the state of floating point optimizations
within a code block, we need to make sure that the function attributes
related to floating point math optimization are set in a conservative
way w.r.t. the body of the function to prevent illegal transformations
in the backends where such attributes are consumed.

Depends on D80315 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80462

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGen/fp-function-attrs.cpp

Index: clang/test/CodeGen/fp-function-attrs.cpp
===
--- /dev/null
+++ clang/test/CodeGen/fp-function-attrs.cpp
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -ffast-math -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s
+
+float test_default(float a, float b, float c) {
+  float tmp = a;
+  tmp += b;
+  tmp += c;
+  return tmp;
+}
+
+// CHECK: define float @_Z12test_defaultfff(float %a, float %b, float %c) [[FAST_ATTRS:#[0-9]+]]
+// CHECK: fadd fast float {{%.+}}, {{%.+}}
+// CHECK: fadd fast float {{%.+}}, {{%.+}}
+
+float test_precise_on_pragma(float a, float b, float c) {
+  float tmp = a;
+  {
+#pragma float_control(precise, on)
+tmp += b;
+  }
+  tmp += c;
+  return tmp;
+}
+
+// CHECK: define float @_Z22test_precise_on_pragmafff(float %a, float %b, float %c) [[PRECISE_ATTRS:#[0-9]+]]
+// CHECK: fadd float {{%.+}}, {{%.+}}
+// CHECK: fadd fast float {{%.+}}, {{%.+}}
+
+float test_reassociate_off_pragma(float a, float b, float c) {
+  float tmp = a;
+  {
+#pragma clang fp reassociate(off)
+tmp += b;
+  }
+  tmp += c;
+  return tmp;
+}
+
+// CHECK: define float @_Z27test_reassociate_off_pragmafff(float %a, float %b, float %c) [[NOREASSOC_ATTRS:#[0-9]+]]
+// CHECK: fadd nnan ninf nsz arcp contract afn float {{%.+}}, {{%.+}}
+// CHECK: fadd fast float {{%.+}}, {{%.+}}
+
+// CHECK: attributes [[FAST_ATTRS]] = { {{.*}}"no-infs-fp-math"="true" {{.*}}"no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" {{.*}}"unsafe-fp-math"="true"{{.*}} }
+// CHECK: attributes [[PRECISE_ATTRS]] = { {{.*}}"no-infs-fp-math"="false" {{.*}}"no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" {{.*}}"unsafe-fp-math"="false"{{.*}} }
+// CHECK: attributes [[NOREASSOC_ATTRS]] = { {{.*}}"no-infs-fp-math"="true" {{.*}}"no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" {{.*}}"unsafe-fp-math"="false"{{.*}} }
Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -675,6 +675,20 @@
 return DominatingValue::save(*this, value);
   }
 
+  class CGFPOptionsRAII : public CGBuilderTy::FastMathFlagGuard {
+  public:
+CGFPOptionsRAII(CodeGenFunction , FPOptions FPFeatures);
+~CGFPOptionsRAII() = default;
+  };
+
+  /// State for the floating point function attributes. At the end of the
+  /// codegen of a function they will have the strictest configuration required
+  /// by the statements in the function itself.
+  bool FnAttrNoInfsFPMath;
+  bool FnAttrNoNaNsFPMath;
+  bool FnAttrNoSignedZerosFPMath;
+  bool FnAttrUnsafeFPMath;
+
 public:
   /// ObjCEHValueStack - Stack of Objective-C exception values, used for
   /// rethrows.
Index: clang/lib/CodeGen/CodeGenFunction.cpp
===
--- clang/lib/CodeGen/CodeGenFunction.cpp
+++ clang/lib/CodeGen/CodeGenFunction.cpp
@@ -73,6 +73,11 @@
 
   SetFastMathFlags(FPOptions(CGM.getLangOpts()));
   SetFPModel();
+
+  FnAttrNoInfsFPMath = CGM.getLangOpts().NoHonorInfs;
+  FnAttrNoNaNsFPMath = CGM.getLangOpts().NoHonorNaNs;
+  FnAttrNoSignedZerosFPMath = CGM.getLangOpts().NoSignedZero;
+  FnAttrUnsafeFPMath = CGM.getLangOpts().UnsafeFPMath;
 }
 
 CodeGenFunction::~CodeGenFunction() {
@@ -132,6 +137,32 @@
   Builder.setFastMathFlags(FMF);
 }
 
+CodeGenFunction::CGFPOptionsRAII::CGFPOptionsRAII(CodeGenFunction ,
+  FPOptions FPFeatures)
+: CGBuilderTy::FastMathFlagGuard(CGF.Builder) {
+  auto NewRoundingBehavior = FPFeatures.getRoundingMode();
+  CGF.Builder.setDefaultConstrainedRounding(NewRoundingBehavior);
+  auto NewExceptionBehavior =
+  ToConstrainedExceptMD(FPFeatures.getExceptionMode());
+  CGF.Builder.setDefaultConstrainedExcept(NewExceptionBehavior);
+
+  CGF.SetFastMathFlags(FPFeatures);
+
+  assert((CGF.CurFuncDecl == nullptr || CGF.Builder.getIsFPConstrained() ||
+  isa(CGF.CurFuncDecl) ||
+  isa(CGF.CurFuncDecl) ||
+  (NewExceptionBehavior == 

[PATCH] D80369: [DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'

2020-05-22 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D80369#2051681 , @aprantl wrote:

> In D80369#2051278 , @dblaikie wrote:
>
> > @aprantl can you check here? I've attached two IR files for the 
> > ModuleDebugInfo.m test, before/after ('x' is before), stripped of the 
> > metadata numbers to make diffing easier - but I think you can still follow 
> > what's connected to what with reasonable guesswork. The point is these two 
> > function declarations end up in the retainedTypes list, and since the 
> > function declarations are emitted, so are the types used in their 
> > parameters, etc - but those types aren't reachable from anywhere else in 
> > the debug info metadata, so they won't be emitted into the final object 
> > file so far as I can see (because nothing looks at the function 
> > declarations in retainedTypes - only types).
> >
> > F11980002: x.ll 
> >
> > F11980001: y.ll 
>
>
> These two files are for the C++ test, not the Objective-C one. Is the 
> Objective-C case similar?


Haven't looked.

> If there is no explicit CHECK line for the types anchored by the function 
> calls, removing them is fine. However, for ObjC there is explicit code in 
> `clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp` 
> `DebugTypeVisitor::VisitFunctionDecl()` to emit the Objective-C methods. I do 
> want to keep this functionality; it's needed for debugging Swift code with 
> ObjC interoperability.

How does this data get used for Swift code and ObjC interoperability? At the 
moment I see no use of this IR metadata in LLVM. Does ObjC/Swift interop use 
the DI IR over in the Swift compiler? Got a link to the code there?

> I would be fine with manually adding everything created by this particular 
> visitor to the retained types if that makes the separation easier.




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

https://reviews.llvm.org/D80369



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


[clang] 64356b6 - Add missing unit test

2020-05-22 Thread Stephen Kelly via cfe-commits

Author: Stephen Kelly
Date: 2020-05-23T01:29:39+01:00
New Revision: 64356b6d94eac13780cc36ea12053d61a027561e

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

LOG: Add missing unit test

Added: 


Modified: 
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Removed: 




diff  --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp 
b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index 8fcaeac9cb5e..e8b0a312d0a3 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -1830,6 +1830,43 @@ void stringConstruct()
   hasDescendant(cxxOperatorCallExpr(
   isAssignmentOperator(),
   hasArgument(1, 
stringLiteral(;
+
+  Code = R"cpp(
+
+struct C1 {};
+struct C2 { operator C1(); };
+
+void conversionOperator()
+{
+C2* c2;
+C1 c1 = (*c2);
+}
+
+)cpp";
+  EXPECT_TRUE(matches(
+  Code,
+  traverse(
+  TK_AsIs,
+  functionDecl(
+  hasName("conversionOperator"),
+  hasDescendant(
+  varDecl(
+  hasName("c1"),
+  hasInitializer(
+  ignoringImplicit(cxxConstructExpr(hasArgument(
+  0, ignoringImplicit(
+ 
cxxMemberCallExpr(onImplicitObjectArgument(
+ ignoringParenImpCasts(unaryOperator(
+ hasOperatorName("*")))
+  .bind("c1"));
+
+  EXPECT_TRUE(matches(
+  Code,
+  traverse(TK_IgnoreUnlessSpelledInSource,
+   functionDecl(hasName("conversionOperator"),
+hasDescendant(varDecl(
+hasName("c1"), hasInitializer(unaryOperator(
+   
hasOperatorName("*");
 }
 
 template 



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


[clang] 3a1f0c6 - Fix mistake made while rebasing

2020-05-22 Thread Stephen Kelly via cfe-commits

Author: Stephen Kelly
Date: 2020-05-23T01:26:30+01:00
New Revision: 3a1f0c6bd1e09b6fd081ad83bb67228de83ac9b4

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

LOG: Fix mistake made while rebasing

Added: 


Modified: 
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Removed: 




diff  --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp 
b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index 648e73c4bf57..8fcaeac9cb5e 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -1823,13 +1823,13 @@ void stringConstruct()
   hasDescendant(varDecl(
   hasName("s"),
   hasInitializer(stringLiteral(;
-  EXPECT_TRUE(matches(
-  Code,
-  traverse(TK_IgnoreUnlessSpelledInSource,
-   functionDecl(hasName("conversionOperator"),
-hasDescendant(varDecl(
-hasName("c1"), hasInitializer(unaryOperator(
-   
hasOperatorName("*");
+
+  EXPECT_TRUE(
+  matches(Code, traverse(TK_IgnoreUnlessSpelledInSource,
+ functionDecl(hasName("stringConstruct"),
+  hasDescendant(cxxOperatorCallExpr(
+  isAssignmentOperator(),
+  hasArgument(1, 
stringLiteral(;
 }
 
 template 



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 265818.
stevewan added a comment.

Update check prefix based on comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -175,3 +175,21 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib" 
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-CXX-ARG-ORDER %s
+
+// CHECK-LD32-CXX-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-CXX-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-CXX-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-CXX-ARG-ORDER: "-b32"
+// CHECK-LD32-CXX-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-CXX-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList 
,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -175,3 +175,21 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib" 
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-CXX-ARG-ORDER %s
+
+// CHECK-LD32-CXX-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-CXX-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-CXX-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-CXX-ARG-ORDER: "-b32"
+// CHECK-LD32-CXX-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-CXX-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList ,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
___
cfe-commits mailing list

[PATCH] D80344: [Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC -EHa) - Part 1

2020-05-22 Thread Ten Tzen via Phabricator via cfe-commits
tentzen updated this revision to Diff 265819.
tentzen removed a reviewer: lebedev.ri.
tentzen added a comment.

fixed tidy warnings


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80344

Files:
  clang/include/clang/AST/Stmt.h
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CGCleanup.cpp
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGException.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/JumpDiagnostics.cpp
  clang/test/CodeGen/windows-seh-EHa-CppCatchDotDotDot.cpp
  clang/test/CodeGen/windows-seh-EHa-CppDtors01.cpp
  clang/test/CodeGen/windows-seh-EHa-TryInFinally.cpp
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/IR/Verifier.cpp

Index: llvm/lib/IR/Verifier.cpp
===
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -4223,6 +4223,10 @@
   Assert(
   !F->isIntrinsic() || isa(I) ||
   F->getIntrinsicID() == Intrinsic::donothing ||
+  F->getIntrinsicID() == Intrinsic::seh_try_begin ||
+  F->getIntrinsicID() == Intrinsic::seh_try_end ||
+  F->getIntrinsicID() == Intrinsic::eha_scope_begin ||
+  F->getIntrinsicID() == Intrinsic::eha_scope_end ||
   F->getIntrinsicID() == Intrinsic::coro_resume ||
   F->getIntrinsicID() == Intrinsic::coro_destroy ||
   F->getIntrinsicID() == Intrinsic::experimental_patchpoint_void ||
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -2789,6 +2789,10 @@
   llvm_unreachable("Cannot invoke this intrinsic");
 case Intrinsic::donothing:
   // Ignore invokes to @llvm.donothing: jump directly to the next BB.
+case Intrinsic::seh_try_begin:
+case Intrinsic::eha_scope_begin:
+case Intrinsic::seh_try_end:
+case Intrinsic::eha_scope_end:
   break;
 case Intrinsic::experimental_patchpoint_void:
 case Intrinsic::experimental_patchpoint_i64:
@@ -6583,6 +6587,10 @@
   lowerCallToExternalSymbol(I, FunctionName);
 return;
   case Intrinsic::donothing:
+  case Intrinsic::seh_try_begin:
+  case Intrinsic::eha_scope_begin:
+  case Intrinsic::seh_try_end:
+  case Intrinsic::eha_scope_end:
 // ignore
 return;
   case Intrinsic::experimental_stackmap:
Index: llvm/include/llvm/IR/Intrinsics.td
===
--- llvm/include/llvm/IR/Intrinsics.td
+++ llvm/include/llvm/IR/Intrinsics.td
@@ -456,6 +456,16 @@
  [llvm_ptr_ty, llvm_ptr_ty],
  [IntrNoMem]>;
 
+// To mark the beginning/end of a try-scope for Windows SEH -EHa
+//  calls/invokes to these intrinsics are placed to model control flows
+//caused by HW exceptions under option -EHa.
+//  calls/invokes to these intrinsics will be discarded during a codegen pass
+//   after EH tables are generated
+def int_seh_try_begin : Intrinsic<[], [], [IntrReadMem, IntrWriteMem, IntrWillReturn]>;
+def int_seh_try_end : Intrinsic<[], [], [IntrReadMem, IntrWriteMem, IntrWillReturn]>;
+def int_eha_scope_begin : Intrinsic<[], [], [IntrNoMem]>;
+def int_eha_scope_end : Intrinsic<[], [], [IntrNoMem]>;
+
 // Note: we treat stacksave/stackrestore as writemem because we don't otherwise
 // model their dependencies on allocas.
 def int_stacksave : Intrinsic<[llvm_ptr_ty]>,
Index: clang/test/CodeGen/windows-seh-EHa-TryInFinally.cpp
===
--- /dev/null
+++ clang/test/CodeGen/windows-seh-EHa-TryInFinally.cpp
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -triple x86_64-windows -feh-asynch -fcxx-exceptions -fexceptions -fms-extensions -x c++ -Wno-implicit-function-declaration -S -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: invoke void @llvm.seh.try.begin()
+// CHECK: invoke void @llvm.seh.try.begin()
+// CHECK: %[[src:[0-9-]+]] = load volatile i32, i32* %i
+// CHECK-NEXT: i32 %[[src]]
+// CHECK: invoke void @llvm.seh.try.end()
+// CHECK: invoke void @llvm.seh.try.end()
+
+// CHECK: define internal void @"?fin$0@0@main@@"(i8 %abnormal_termination
+// CHECK: invoke void @llvm.seh.try.begin()
+// CHECK: invoke void @llvm.seh.try.end()
+
+// *
+// Abstract: Test __Try in __finally under SEH -EHa option
+void printf(...);
+int volatile *NullPtr = 0;
+int main() {
+  for (int i = 0; i < 3; i++) {
+printf(" --- Test _Try in _finally 

[PATCH] D80344: [Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC -EHa) - Part 1

2020-05-22 Thread Ten Tzen via Phabricator via cfe-commits
tentzen added a comment.

> It may be helpful (even for the reviewers) to first specify their behavior,
>  instead of writing that after-the-fact "backwardly" based on the 
> implementation.

For reviewers, the purpose of those intrinsic are described in Summary section:

- Two intrinsic are created to track CPP object scopes; eha_scope_begin() and 
eha_scope_end(). _scope_begin() is immediately added after ctor() is called and 
EHStack is pushed. So it must be an invoke, not a call. With that it's also 
guaranteed an EH-cleanup-pad is created regardless whether there exists a call 
in this scope. _scope_end is added before dtor(). These two intrinsics make the 
computation of Block-State possible in downstream code gen pass, even in the 
presence of ctor/dtor inlining.
- Two intrinsic, seh_try_begin() and seh_try_end(), are added for C-code to 
mark _try boundary and to prevent from exceptions being moved across _try 
boundary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80344



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


[PATCH] D80454: [Clang][test] fix tests when using external assembler

2020-05-22 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

In D80454#2051637 , @aganea wrote:

> LGTM.
>
> Are you planning on adding another patch for the change that you've sent 
> initially? Ideally, I'd like to relax a bit that constraint in `Driver.cpp`, 
> as in D74447 , but that requires first to 
> disable `-disable-free` to ensure we exit cleanly, at least when runing the 
> tests (a bit like the `LLD_IN_TEST` env var).


Oh, that's not my plan. I think the motivation of D74447 
 makes great sense.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80454



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


[PATCH] D80461: HIP: Try to deal with more llvm package layouts

2020-05-22 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added reviewers: yaxunl, scchan.
Herald added subscribers: kerbowa, nhaehnle, wdng, jvesely.

The various HIP builds are all inconsistent.

  

The default llvm install goes to ${INSTALL_PREFIX}/bin/clang, but the
rocm packaging scripts move this under
${INSTALL_PREFIX}/llvm/bin/clang. Some other builds further pollute 
this with ${INSTALL_PREFIX}/bin/x86_64/clang. These should really be
consolidated, but try to handle them for now.


https://reviews.llvm.org/D80461

Files:
  clang/lib/Driver/ToolChains/AMDGPU.cpp


Index: clang/lib/Driver/ToolChains/AMDGPU.cpp
===
--- clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -107,11 +107,18 @@
 // the Windows-esque layout the ROCm packages use with the host 
architecture
 // subdirectory of bin.
 
+// Strip off directory (usually bin)
 StringRef ParentDir = llvm::sys::path::parent_path(InstallDir);
-if (ParentDir == HostTriple.getArchName())
+StringRef ParentName = llvm::sys::path::filename(ParentDir);
+
+// Some builds use bin/{host arch}, so go up again.
+if (ParentName == "bin") {
   ParentDir = llvm::sys::path::parent_path(ParentDir);
+  ParentName = llvm::sys::path::filename(ParentDir);
+}
 
-if (ParentDir == "bin") {
+if (ParentName == "llvm") {
+  // Some versions of the rocm llvm package install to /opt/rocm/llvm/bin
   Candidates.emplace_back(llvm::sys::path::parent_path(ParentDir).str(),
   /*StrictChecking=*/true);
 }


Index: clang/lib/Driver/ToolChains/AMDGPU.cpp
===
--- clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -107,11 +107,18 @@
 // the Windows-esque layout the ROCm packages use with the host architecture
 // subdirectory of bin.
 
+// Strip off directory (usually bin)
 StringRef ParentDir = llvm::sys::path::parent_path(InstallDir);
-if (ParentDir == HostTriple.getArchName())
+StringRef ParentName = llvm::sys::path::filename(ParentDir);
+
+// Some builds use bin/{host arch}, so go up again.
+if (ParentName == "bin") {
   ParentDir = llvm::sys::path::parent_path(ParentDir);
+  ParentName = llvm::sys::path::filename(ParentDir);
+}
 
-if (ParentDir == "bin") {
+if (ParentName == "llvm") {
+  // Some versions of the rocm llvm package install to /opt/rocm/llvm/bin
   Candidates.emplace_back(llvm::sys::path::parent_path(ParentDir).str(),
   /*StrictChecking=*/true);
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

2020-05-22 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

In D74447#1872211 , @thakis wrote:

> I'd think that everyone debugging clang always passes a single TU to it, so 
> I'm not sure debuggability does much here :)
>
> The `-disable-free` code has never been used in normal compilations, so we 
> didn't have to worry about this path. This patch here brings us to 3 modes 
> (in-process cc1 with and without disable-free, out-of-process cc1). My 
> suggestion keeps us to two modes (in-process cc1, out-of-process cc1).


What is the downside of 3 modes except maintaining one more mode in the future?


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

https://reviews.llvm.org/D74447



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


[clang] 26ac5a3 - Fix ignoring traversal of intermediate parens

2020-05-22 Thread Stephen Kelly via cfe-commits

Author: Stephen Kelly
Date: 2020-05-23T01:04:44+01:00
New Revision: 26ac5a34bae7cb5b65e0580b317d4559af847ddb

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

LOG: Fix ignoring traversal of intermediate parens

Added: 


Modified: 
clang/lib/AST/Expr.cpp
clang/unittests/AST/ASTTraverserTest.cpp
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Removed: 




diff  --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 7b1badf133f9..f173c2408866 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -2925,7 +2925,16 @@ Expr *Expr::IgnoreUnlessSpelledInSource() {
 }
 
 if (auto *C = dyn_cast(E)) {
-  Expr *ExprNode = C->getImplicitObjectArgument()->IgnoreParenImpCasts();
+  Expr *ExprNode = C->getImplicitObjectArgument();
+  if (ExprNode->getSourceRange() == SR) {
+E = ExprNode;
+continue;
+  }
+  if (auto *PE = dyn_cast(ExprNode)) {
+E = PE;
+continue;
+  }
+  ExprNode = ExprNode->IgnoreParenImpCasts();
   if (ExprNode->getSourceRange() == SR)
 E = ExprNode;
 }

diff  --git a/clang/unittests/AST/ASTTraverserTest.cpp 
b/clang/unittests/AST/ASTTraverserTest.cpp
index 9a951c7bec5e..f56a49bf8e51 100644
--- a/clang/unittests/AST/ASTTraverserTest.cpp
+++ b/clang/unittests/AST/ASTTraverserTest.cpp
@@ -273,6 +273,15 @@ void stringConstruct()
 s = "bar";
 }
 
+struct C1 {};
+struct C2 { operator C1(); };
+
+void conversionOperator()
+{
+C2* c2;
+C1 c1 = (*c2);
+}
+
 )cpp");
 
   {
@@ -319,6 +328,37 @@ FunctionDecl 'stringConstruct'
 |-DeclRefExpr 'operator='
 |-DeclRefExpr 's'
 `-StringLiteral
+)cpp");
+  }
+
+  {
+auto FN = ast_matchers::match(
+functionDecl(hasName("conversionOperator"),
+ hasDescendant(varDecl(hasName("c1")).bind("var"))),
+AST->getASTContext());
+EXPECT_EQ(FN.size(), 1u);
+
+EXPECT_EQ(dumpASTString(TK_AsIs, FN[0].getNodeAs("var")),
+  R"cpp(
+VarDecl 'c1'
+`-ExprWithCleanups
+  `-CXXConstructExpr
+`-MaterializeTemporaryExpr
+  `-ImplicitCastExpr
+`-CXXMemberCallExpr
+  `-MemberExpr
+`-ParenExpr
+  `-UnaryOperator
+`-ImplicitCastExpr
+  `-DeclRefExpr 'c2'
+)cpp");
+
+EXPECT_EQ(dumpASTString(TK_IgnoreUnlessSpelledInSource,
+FN[0].getNodeAs("var")),
+  R"cpp(
+VarDecl 'c1'
+`-UnaryOperator
+  `-DeclRefExpr 'c2'
 )cpp");
   }
 }

diff  --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp 
b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index b4b7e2b43cf7..648e73c4bf57 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -1823,12 +1823,13 @@ void stringConstruct()
   hasDescendant(varDecl(
   hasName("s"),
   hasInitializer(stringLiteral(;
-  EXPECT_TRUE(
-  matches(Code, traverse(TK_IgnoreUnlessSpelledInSource,
- functionDecl(hasName("stringConstruct"),
-  hasDescendant(cxxOperatorCallExpr(
-  isAssignmentOperator(),
-  hasArgument(1, 
stringLiteral(;
+  EXPECT_TRUE(matches(
+  Code,
+  traverse(TK_IgnoreUnlessSpelledInSource,
+   functionDecl(hasName("conversionOperator"),
+hasDescendant(varDecl(
+hasName("c1"), hasInitializer(unaryOperator(
+   
hasOperatorName("*");
 }
 
 template 



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


[clang] aa5d2d2 - Traverse-ignore invisible CXXConstructExprs with default args

2020-05-22 Thread Stephen Kelly via cfe-commits

Author: Stephen Kelly
Date: 2020-05-23T01:04:44+01:00
New Revision: aa5d2d22485470365cc8f7016c1be672a273c2fe

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

LOG: Traverse-ignore invisible CXXConstructExprs with default args

Added: 


Modified: 
clang/lib/AST/Expr.cpp
clang/unittests/AST/ASTTraverserTest.cpp
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Removed: 




diff  --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 468540ddf06f..7b1badf133f9 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -2915,7 +2915,9 @@ Expr *Expr::IgnoreUnlessSpelledInSource() {
 auto SR = E->getSourceRange();
 
 if (auto *C = dyn_cast(E)) {
-  if (C->getNumArgs() == 1) {
+  auto NumArgs = C->getNumArgs();
+  if (NumArgs == 1 ||
+  (NumArgs > 1 && isa(C->getArg(1 {
 Expr *A = C->getArg(0);
 if (A->getSourceRange() == SR || !isa(C))
   E = A;

diff  --git a/clang/unittests/AST/ASTTraverserTest.cpp 
b/clang/unittests/AST/ASTTraverserTest.cpp
index 4ecb02325d6a..9a951c7bec5e 100644
--- a/clang/unittests/AST/ASTTraverserTest.cpp
+++ b/clang/unittests/AST/ASTTraverserTest.cpp
@@ -258,6 +258,71 @@ TemplateArgument
 19u);
 }
 
+TEST(Traverse, IgnoreUnlessSpelledInSourceVars) {
+
+  auto AST = buildASTFromCode(R"cpp(
+
+struct String
+{
+String(const char*, int = -1) {}
+};
+
+void stringConstruct()
+{
+String s = "foo";
+s = "bar";
+}
+
+)cpp");
+
+  {
+auto FN =
+
ast_matchers::match(functionDecl(hasName("stringConstruct")).bind("fn"),
+AST->getASTContext());
+EXPECT_EQ(FN.size(), 1u);
+
+EXPECT_EQ(dumpASTString(TK_AsIs, FN[0].getNodeAs("fn")),
+  R"cpp(
+FunctionDecl 'stringConstruct'
+`-CompoundStmt
+  |-DeclStmt
+  | `-VarDecl 's'
+  |   `-ExprWithCleanups
+  | `-CXXConstructExpr
+  |   `-MaterializeTemporaryExpr
+  | `-ImplicitCastExpr
+  |   `-CXXConstructExpr
+  | |-ImplicitCastExpr
+  | | `-StringLiteral
+  | `-CXXDefaultArgExpr
+  `-ExprWithCleanups
+`-CXXOperatorCallExpr
+  |-ImplicitCastExpr
+  | `-DeclRefExpr 'operator='
+  |-DeclRefExpr 's'
+  `-MaterializeTemporaryExpr
+`-CXXConstructExpr
+  |-ImplicitCastExpr
+  | `-StringLiteral
+  `-CXXDefaultArgExpr
+)cpp");
+
+EXPECT_EQ(dumpASTString(TK_IgnoreUnlessSpelledInSource,
+FN[0].getNodeAs("fn")),
+  R"cpp(
+FunctionDecl 'stringConstruct'
+`-CompoundStmt
+  |-DeclStmt
+  | `-VarDecl 's'
+  |   `-StringLiteral
+  `-CXXOperatorCallExpr
+|-DeclRefExpr 'operator='
+|-DeclRefExpr 's'
+`-StringLiteral
+)cpp");
+  }
+}
+
 TEST(Traverse, IgnoreUnlessSpelledInSourceStructs) {
   auto AST = buildASTFromCode(R"cpp(
 

diff  --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp 
b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index 2a36d7a64efd..b4b7e2b43cf7 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -1780,6 +1780,55 @@ const char *SomeString{"str"};
   EXPECT_TRUE(
   matches(Code, traverse(TK_IgnoreUnlessSpelledInSource,
  stringLiteral(hasParent(initListExpr());
+
+  Code = R"cpp(
+struct String
+{
+String(const char*, int = -1) {}
+};
+
+void stringConstruct()
+{
+String s = "foo";
+s = "bar";
+}
+)cpp";
+  EXPECT_TRUE(matches(
+  Code,
+  traverse(
+  TK_AsIs,
+  functionDecl(
+  hasName("stringConstruct"),
+  hasDescendant(varDecl(
+  hasName("s"),
+  hasInitializer(ignoringImplicit(cxxConstructExpr(hasArgument(
+  0, ignoringImplicit(cxxConstructExpr(hasArgument(
+ 0, ignoringImplicit(stringLiteral()));
+
+  EXPECT_TRUE(matches(
+  Code,
+  traverse(
+  TK_AsIs,
+  functionDecl(hasName("stringConstruct"),
+   hasDescendant(cxxOperatorCallExpr(
+   isAssignmentOperator(),
+   hasArgument(1, ignoringImplicit(
+cxxConstructExpr(hasArgument(
+   0, ignoringImplicit(stringLiteral())
+   ));
+
+  EXPECT_TRUE(matches(
+  Code, traverse(TK_IgnoreUnlessSpelledInSource,
+ functionDecl(hasName("stringConstruct"),
+  hasDescendant(varDecl(
+  hasName("s"),
+  hasInitializer(stringLiteral(;
+  

[clang] 8d62eba - Add some explicit use of TK_AsIs

2020-05-22 Thread Stephen Kelly via cfe-commits

Author: Stephen Kelly
Date: 2020-05-23T01:04:44+01:00
New Revision: 8d62eba1053a4156032e5333ce0b1c6d33ca8ec5

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

LOG: Add some explicit use of TK_AsIs

Added: 


Modified: 
clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp
clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp
clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp 
b/clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp
index c17a43c73f95..d179e6cb7c75 100644
--- a/clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp
+++ b/clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp
@@ -104,9 +104,11 @@ findMembersUsedInInitExpr(const CXXCtorInitializer 
*Initializer,
   // for those accesses Sema::PerformObjectMemberConversion always inserts an
   // UncheckedDerivedToBase ImplicitCastExpr between the this expr and the
   // object expression
-  auto FoundExprs =
-  match(findAll(memberExpr(hasObjectExpression(cxxThisExpr())).bind("ME")),
-*Initializer->getInit(), Context);
+  auto FoundExprs = match(
+  traverse(
+  TK_AsIs,
+  findAll(memberExpr(hasObjectExpression(cxxThisExpr())).bind("ME"))),
+  *Initializer->getInit(), Context);
   for (BoundNodes  : FoundExprs)
 if (auto *MemExpr = BN.getNodeAs("ME"))
   if (auto *FD = dyn_cast(MemExpr->getMemberDecl()))

diff  --git 
a/clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
index df69254ead26..abeca596d056 100644
--- a/clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
@@ -338,7 +338,7 @@ void NumberObjectConversionChecker::checkASTCodeBody(const 
Decl *D,
   MatchFinder F;
   Callback CB(this, BR, AM.getAnalysisDeclContext(D));
 
-  F.addMatcher(stmt(forEachDescendant(FinalM)), );
+  F.addMatcher(traverse(TK_AsIs, stmt(forEachDescendant(FinalM))), );
   F.match(*D->getBody(), AM.getASTContext());
 }
 

diff  --git a/clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp
index 8eee4df473e8..25d87f4acfc9 100644
--- a/clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp
@@ -86,8 +86,9 @@ auto matchSortWithPointers() -> decltype(decl()) {
   )))
   ;
 
-  auto PointerSortM = stmt(callExpr(allOf(SortFuncM, IteratesPointerEltsM))
-  ).bind(WarnAtNode);
+  auto PointerSortM = traverse(
+  TK_AsIs,
+  stmt(callExpr(allOf(SortFuncM, IteratesPointerEltsM))).bind(WarnAtNode));
 
   return decl(forEachDescendant(PointerSortM));
 }

diff  --git a/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp 
b/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
index 0d3a2d4ce776..f5e324a3b158 100644
--- a/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
+++ b/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
@@ -226,7 +226,7 @@ TEST(ParserTest, FullParserTest) {
   Parser::parseMatcherExpression(Code, nullptr, nullptr, ));
   EXPECT_EQ("", Error.toStringFull());
   Matcher MCastStmt =
-  implicitIntBooleanCast->unconditionalConvertTo();
+  traverse(TK_AsIs, 
implicitIntBooleanCast->unconditionalConvertTo());
   EXPECT_TRUE(matches("bool X = 1;", MCastStmt));
   EXPECT_FALSE(matches("bool X = true;", MCastStmt));
 



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


[PATCH] D80344: [Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC -EHa) - Part 1

2020-05-22 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri resigned from this revision.
lebedev.ri added a comment.

In D80344#2051697 , @tentzen wrote:

> In D80344#2051127 , @lebedev.ri 
> wrote:
>
> > This should likely be at least 3 patches: llvm middle-end, llvm codegen, 
> > clang.
> >  Langref changes missing for new intrinsics.
> >  Please post all patches with full context (`-U9`)
>
>
> I was thinking to update docs/ExceptionHandling.rst after this patch is 
> accepted.  Do you think this types of intrinsic should be described in 
> Langref?
>  thanks,


It may be helpful (even for the reviewers) to first specify their behavior,
instead of writing that after-the-fact "backwardly" based on the implementation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80344



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast accepted this revision.
hubert.reinterpretcast added a comment.
This revision is now accepted and ready to land.

Thanks. LGTM with minor nit.

In D80415#2051772 , @stevewan wrote:

> I'm planning to post an NFC patch after this to fix the formatting for 
> existing cases in 'aix-ld.c' so that everything is consistent.


I'm not sure how NFC it is, but I would suggest removing the `-o %t.o` from the 
other cases as well.




Comment at: clang/test/Driver/aix-ld.c:184
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+

Minor nit: Maybe the prefix should be `CHECK-LD32-CXX-ARG-ORDER`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan added a comment.

I'm planning to post an NFC patch after this to fix the formatting for existing 
cases in 'aix-ld.c' so that everything is consistent.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[PATCH] D80344: [Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC -EHa) - Part 1

2020-05-22 Thread Ten Tzen via Phabricator via cfe-commits
tentzen updated this revision to Diff 265812.
tentzen retitled this revision from "[Windows SEH]: HARDWARE EXCEPTION HANDLING 
(MSVC option -EHa)" to "[Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC -EHa) 
- Part 1".
tentzen edited the summary of this revision.
tentzen added a reviewer: lebedev.ri.
tentzen added a comment.

Per Roman Lebedev's feedback, divide the patch into Clang and LLVM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80344

Files:
  clang/include/clang/AST/Stmt.h
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CGCleanup.cpp
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGException.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/JumpDiagnostics.cpp
  clang/test/CodeGen/windows-seh-EHa-CppCatchDotDotDot.cpp
  clang/test/CodeGen/windows-seh-EHa-CppDtors01.cpp
  clang/test/CodeGen/windows-seh-EHa-TryInFinally.cpp
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/IR/Verifier.cpp

Index: llvm/lib/IR/Verifier.cpp
===
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -4223,6 +4223,10 @@
   Assert(
   !F->isIntrinsic() || isa(I) ||
   F->getIntrinsicID() == Intrinsic::donothing ||
+  F->getIntrinsicID() == Intrinsic::seh_try_begin ||
+  F->getIntrinsicID() == Intrinsic::seh_try_end ||
+  F->getIntrinsicID() == Intrinsic::eha_scope_begin ||
+  F->getIntrinsicID() == Intrinsic::eha_scope_end ||
   F->getIntrinsicID() == Intrinsic::coro_resume ||
   F->getIntrinsicID() == Intrinsic::coro_destroy ||
   F->getIntrinsicID() == Intrinsic::experimental_patchpoint_void ||
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -2789,6 +2789,10 @@
   llvm_unreachable("Cannot invoke this intrinsic");
 case Intrinsic::donothing:
   // Ignore invokes to @llvm.donothing: jump directly to the next BB.
+case Intrinsic::seh_try_begin:
+case Intrinsic::eha_scope_begin:
+case Intrinsic::seh_try_end:
+case Intrinsic::eha_scope_end:
   break;
 case Intrinsic::experimental_patchpoint_void:
 case Intrinsic::experimental_patchpoint_i64:
@@ -6583,6 +6587,10 @@
   lowerCallToExternalSymbol(I, FunctionName);
 return;
   case Intrinsic::donothing:
+  case Intrinsic::seh_try_begin:
+  case Intrinsic::eha_scope_begin:
+  case Intrinsic::seh_try_end:
+  case Intrinsic::eha_scope_end:
 // ignore
 return;
   case Intrinsic::experimental_stackmap:
Index: llvm/include/llvm/IR/Intrinsics.td
===
--- llvm/include/llvm/IR/Intrinsics.td
+++ llvm/include/llvm/IR/Intrinsics.td
@@ -456,6 +456,16 @@
  [llvm_ptr_ty, llvm_ptr_ty],
  [IntrNoMem]>;
 
+// To mark the beginning/end of a try-scope for Windows SEH -EHa
+//  calls/invokes to these intrinsics are placed to model control flows
+//caused by HW exceptions under option -EHa.
+//  calls/invokes to these intrinsics will be discarded during a codegen pass
+//   after EH tables are generated
+def int_seh_try_begin : Intrinsic<[], [], [IntrReadMem, IntrWriteMem, IntrWillReturn]>;
+def int_seh_try_end : Intrinsic<[], [], [IntrReadMem, IntrWriteMem, IntrWillReturn]>;
+def int_eha_scope_begin : Intrinsic<[], [], [IntrNoMem]>;
+def int_eha_scope_end : Intrinsic<[], [], [IntrNoMem]>;
+
 // Note: we treat stacksave/stackrestore as writemem because we don't otherwise
 // model their dependencies on allocas.
 def int_stacksave : Intrinsic<[llvm_ptr_ty]>,
Index: clang/test/CodeGen/windows-seh-EHa-TryInFinally.cpp
===
--- /dev/null
+++ clang/test/CodeGen/windows-seh-EHa-TryInFinally.cpp
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -triple x86_64-windows -feh-asynch -fcxx-exceptions -fexceptions -fms-extensions -x c++ -Wno-implicit-function-declaration -S -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: invoke void @llvm.seh.try.begin()
+// CHECK: invoke void @llvm.seh.try.begin()
+// CHECK: %[[src:[0-9-]+]] = load volatile i32, i32* %i
+// CHECK-NEXT: i32 %[[src]]
+// CHECK: invoke void @llvm.seh.try.end()
+// CHECK: invoke void @llvm.seh.try.end()
+
+// CHECK: define internal void @"?fin$0@0@main@@"(i8 %abnormal_termination
+// CHECK: invoke void @llvm.seh.try.begin()
+// CHECK: invoke void @llvm.seh.try.end()
+
+// 

[PATCH] D47092: downgrade strong type info names to weak_odr linkage

2020-05-22 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

Oh, you're right, sorry, the suggestion was to make asan instrumentation 
introduce the alias, not the frontend.  In which case you'd want that fix plus 
D46665 , I think: external linkage optimizes 
better.


Repository:
  rC Clang

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

https://reviews.llvm.org/D47092



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


[PATCH] D79945: [Sema] Comparison of pointers to complete and incomplete types

2020-05-22 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

Any thoughts on "this diagnostic needs to be restricted to C99 or earlier"?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79945



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 265813.
stevewan added a comment.

Incorporate the test case into 'aix-ld.c'.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -175,3 +175,21 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib" 
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList 
,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -175,3 +175,21 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib" 
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList ,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79945: [Sema] Comparison of pointers to complete and incomplete types

2020-05-22 Thread Benson Chu via Phabricator via cfe-commits
pestctrl updated this revision to Diff 265807.
pestctrl added a comment.

Changed error to warning, only emit during a relational operation


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79945

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Sema/compare.c


Index: clang/test/Sema/compare.c
===
--- clang/test/Sema/compare.c
+++ clang/test/Sema/compare.c
@@ -405,3 +405,12 @@
   if (x == y) x = y; // no warning
   if (y == x) y = x; // no warning
 }
+
+int incomplete[]; // expected-warning {{tentative array definition assumed to 
have one element}}
+int complete[5];
+
+void test13() {
+  if ( < ) { // expected-error {{ordered comparison of 
complete and incomplete pointers}}
+return;
+  }
+}
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -11422,11 +11422,21 @@
 // C99 6.5.9p2 and C99 6.5.8p2
 if (Context.typesAreCompatible(LCanPointeeTy.getUnqualifiedType(),
RCanPointeeTy.getUnqualifiedType())) {
-  // Valid unless a relational comparison of function pointers
-  if (IsRelational && LCanPointeeTy->isFunctionType()) {
-Diag(Loc, diag::ext_typecheck_ordered_comparison_of_function_pointers)
-  << LHSType << RHSType << LHS.get()->getSourceRange()
-  << RHS.get()->getSourceRange();
+  if (IsRelational) {
+// Pointers both need to point to complete or incomplete types
+if (LCanPointeeTy->isIncompleteType() !=
+RCanPointeeTy->isIncompleteType()) {
+  Diag(Loc,
+   diag::ext_typecheck_comparison_of_complete_and_incomplete_types)
+  << LHSType << RHSType << LHS.get()->getSourceRange()
+  << RHS.get()->getSourceRange();
+}
+if (LCanPointeeTy->isFunctionType()) {
+  // Valid unless a relational comparison of function pointers
+  Diag(Loc, 
diag::ext_typecheck_ordered_comparison_of_function_pointers)
+  << LHSType << RHSType << LHS.get()->getSourceRange()
+  << RHS.get()->getSourceRange();
+}
   }
 } else if (!IsRelational &&
(LCanPointeeTy->isVoidType() || RCanPointeeTy->isVoidType())) {
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -6441,6 +6441,8 @@
   "ordered comparison between pointer and zero (%0 and %1)">;
 def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
   "three-way comparison between pointer and zero">;
+def ext_typecheck_comparison_of_complete_and_incomplete_types : ExtWarn<
+  "ordered comparison of complete and incomplete pointers (%0 and %1)">;
 def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
   "ordered comparison of function pointers (%0 and %1)">,
   InGroup>;


Index: clang/test/Sema/compare.c
===
--- clang/test/Sema/compare.c
+++ clang/test/Sema/compare.c
@@ -405,3 +405,12 @@
   if (x == y) x = y; // no warning
   if (y == x) y = x; // no warning
 }
+
+int incomplete[]; // expected-warning {{tentative array definition assumed to have one element}}
+int complete[5];
+
+void test13() {
+  if ( < ) { // expected-error {{ordered comparison of complete and incomplete pointers}}
+return;
+  }
+}
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -11422,11 +11422,21 @@
 // C99 6.5.9p2 and C99 6.5.8p2
 if (Context.typesAreCompatible(LCanPointeeTy.getUnqualifiedType(),
RCanPointeeTy.getUnqualifiedType())) {
-  // Valid unless a relational comparison of function pointers
-  if (IsRelational && LCanPointeeTy->isFunctionType()) {
-Diag(Loc, diag::ext_typecheck_ordered_comparison_of_function_pointers)
-  << LHSType << RHSType << LHS.get()->getSourceRange()
-  << RHS.get()->getSourceRange();
+  if (IsRelational) {
+// Pointers both need to point to complete or incomplete types
+if (LCanPointeeTy->isIncompleteType() !=
+RCanPointeeTy->isIncompleteType()) {
+  Diag(Loc,
+   diag::ext_typecheck_comparison_of_complete_and_incomplete_types)
+  << LHSType << RHSType << LHS.get()->getSourceRange()
+  << RHS.get()->getSourceRange();
+}
+if (LCanPointeeTy->isFunctionType()) {
+  // Valid unless a relational comparison of function pointers
+  Diag(Loc, 

[PATCH] D80344: [Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC option -EHa)

2020-05-22 Thread Ten Tzen via Phabricator via cfe-commits
tentzen marked 3 inline comments as done.
tentzen added a comment.

In D80344#2051127 , @lebedev.ri wrote:

> This should likely be at least 3 patches: llvm middle-end, llvm codegen, 
> clang.
>  Langref changes missing for new intrinsics.
>  Please post all patches with full context (`-U9`)


OK, makes sense. I will separate it to at least two patches, one Clang and one 
LLVM CodeGen as there is not much change in middle-end & Opt.
thank you for pointing out missing the change in Langref.rst.  I was thinking 
to update docs/ExceptionHandling.rst after this patch is accepted.  Do you 
think this types of intrinsic should be described in Langref?
thanks,


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80344



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


[PATCH] D79945: [Sema] Comparison of pointers to complete and incomplete types

2020-05-22 Thread Benson Chu via Phabricator via cfe-commits
pestctrl added a comment.

Hey @efriedma, thanks again for the comments.

Yes, you were correct in that this message should only be emitted for 
relational comparisons.

Regarding having the warning off by default, I did want to point out that GCC 
enables this warning by default: https://c.godbolt.org/z/W_NgYA.

Do you still think that the warning be off by default? I am OK with either.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79945



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


[PATCH] D79675: [OpenMP][OMPBuilder] Adding Privatization Requirements to OMPIRBuilder

2020-05-22 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim marked 2 inline comments as done.
fghanim added a comment.

I am going to omit parts of the quote, because who wants to look at a wall of 
test - readability is important ;)

In D79675#2051079 , @jdoerfert wrote:

> In D79675#2047154 , @fghanim wrote:
>
> > Until the OMPBuilder becomes the way to CG OMP IR, we will always be 
> > playing catch-up. All the OMPKinds def.s are very copy/paste-able one or 
> > two-liners and very easy to move. However, the actual code to CG the IR is 
> > not.
>
>
> That is not true, with the other patch we require all new code gen 
> functionality to list the runtime functions in OMPKinds.def.


That is not what I said, and FWIW I don't disagree.

> This is not about number of lines. Don't take my word for it, ask the 
> community if you want. We want the smallest logical and testable patches 
> possible, unrelated to the size. (FWIW, 300 lines is not nothing either.)

Number of lines has some correlation with readability, and readability is a 
factor.

> The time spend arguing is more than splitting would have taken in the first 
> place.

In my defense, I have long build times as a result of frequent updates. ;)
As for this one, I am doing it out of work hours :p

> Conceptual parts:
> 
> - Target dependent types (which we can initialize w/o the frontend based on 
> the datalayout)
> - Insert point changes (which seem to be unsued in this patch)
> - The create functions

This is the current state of the patch, not what it was before it was gutted by 
various updates. Back then it was a "the smallest logical and testable patches 
possible, unrelated to the size". it was `createXXX` methods along with all 
related types and run time calls. FWIW, it was modeled after D70109 
 , which -I can only assume- fit yours and the 
community's criteria? ;)

> With D80222  we don't need the first. If you 
> think the way it's done in there is for some reason less good, please say so, 
> otherwise I fail to see why we would not go ahead with that one and rebase 
> this on top.

I'll suggest something below. I want to be done with this patch.

>> However, What wasted everyone's time my friend, is removing integral parts 
>> to this patch which has two other feature patches depend on it, which meant 
>> I needed to build and rebuild to make sure things still work. it would have 
>> been way easier to make D79739  modify and 
>> build on the typing in this one as I suggested there, and in retrospect, is 
>> something I should've pushed harder for. Anyways, let's move on. :D
> 
> I don't think this is true, even if, this is not how this works. The only way 
> to make fast progress is small patches. I give you almost instant feedback on 
> you patches but the more is included in one, the more revision we have to go 
> through. Unrelated problems stall parts we depend on.
> 
> Maybe your setup needs tweaking or you should bundle changes in smaller patch 
> from the beginning to avoid this, either way, the guidelines are clear:
>  https://llvm.org/docs/CodeReview.html

The only reason I brought my setup and long build times up is to indicate to 
you to please be mindful of my time with your comments. per the guidelines: 
"Aim to Make Efficient Use of **Everyone’s** Time" - emphasis is mine

Let me recap what happened for your benefit and to see if the guidelines were 
followed: (all of this can be verified - it is a matter of record, not an 
opinion)

- I upload the patch on 9th.
- On the 11th, You ask me to make the `void*` and macro changes.
- Also on the 11th, patch D79739  was created 
and included many of the things I had, and was using `ptr8*` in place of 
`void*` - i.e. **had no definition for `void*`**. You also ask the author of 
that patch to make the same macro changes. You don't tell me someone else is 
working on it or anything.
- On the 12th, I respond to some items and start working on implementing the 
things I didn't comment on as part of new patch update. - I am still unaware 
others are working on things that were asked of me
- On the 13th, you told me about patch D79739  
, and that they implemented the `void*` macros you asked me to do - at which 
point I had them implemented and verified, but not uploaded
- Also, on the 13th, you tell the author of that patch, that the 
**target-typing issues will be handled by me**. I ask you if I should drop the 
duplicate def.s between this and the other patch. and when you didn't respond 
to that, I drop them because it makes more sense to have these things as part 
of D79739 
- On the 14th, I uploaded a patch with these changes, and I keep 
target-specific types and Def.s that weren't in that patch - we exchange 
comments, and you ask me to change 

[PATCH] D80369: [DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'

2020-05-22 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added a comment.

In D80369#2051278 , @dblaikie wrote:

> @aprantl can you check here? I've attached two IR files for the 
> ModuleDebugInfo.m test, before/after ('x' is before), stripped of the 
> metadata numbers to make diffing easier - but I think you can still follow 
> what's connected to what with reasonable guesswork. The point is these two 
> function declarations end up in the retainedTypes list, and since the 
> function declarations are emitted, so are the types used in their parameters, 
> etc - but those types aren't reachable from anywhere else in the debug info 
> metadata, so they won't be emitted into the final object file so far as I can 
> see (because nothing looks at the function declarations in retainedTypes - 
> only types).
>
> F11980002: x.ll 
>
> F11980001: y.ll 


These two files are for the C++ test, not the Objective-C one. Is the 
Objective-C case similar?
If there is no explicit CHECK line for the types anchored by the function 
calls, removing them is fine. However, for ObjC there is explicit code in 
`clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp` 
`DebugTypeVisitor::VisitFunctionDecl()` to emit the Objective-C methods. I do 
want to keep this functionality; it's needed for debugging Swift code with ObjC 
interoperability. I would be fine with manually adding everything created by 
this particular visitor to the retained types if that makes the separation 
easier.


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

https://reviews.llvm.org/D80369



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


[PATCH] D80454: [Clang][test] fix tests when using external assembler

2020-05-22 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

In D80454#2051668 , @MaskRay wrote:

> In D80454#2051527 , @ychen wrote:
>
> > In D80454#2051524 , @aganea wrote:
> >
> > > Could you please attach a test to demonstrate the issue?
> >
> >
> > When a toolchain is not using integrated-as, the test would fail because 
> > using external assember would increase job counts. Most toolchains in tree 
> > use integrated-as, but we still support external assembler. So this is just 
> > making it explicit.
>
>
> This point deserves a comment in the test.


Will do.

> @ychen What is your LLVM_DEFAULT_TARGET_TRIPLE?

All I could say is that it is not a in-tree toolchain and it uses external 
assembler.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80454



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


[PATCH] D80440: [OpenCL] Prevent fused mul and add by default

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

I think "the default value is on" is meant to imply that contraction is allowed 
by default, not that you can write the pragma without an `on-off-switch` and it 
means "on".

FWIW, that would be consistent with C, which also enables contraction by 
default.


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

https://reviews.llvm.org/D80440



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


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

2020-05-22 Thread Stephen Kelly via Phabricator via cfe-commits
steveire added a comment.

In D69764#2050538 , @MyDeveloperDay 
wrote:

> In D69764#2050226 , @steveire wrote:
>
> > I like the approach of using clang-format to implement this. It's much 
> > faster than a `clang-tidy` approach.
> >
> > The broader C++ community has already chosen `East`/`West` and it has 
> > momentum. If you choose `Left`/`Right` now, you will get pressure to add 
> > `East`/`West` in the future, which means we'll have the synonyms we want to 
> > avoid.
> >
> > The broader C++ community already has understanding of `East`/`West`. 
> > Trying to change that now should be out of scope for this patch. This patch 
> > should use `East`/`West`.
> >
> > I ran this on a large codebase and discovered some problems with this 
> > patch. Given this `.clang-format` file:
>
>
> Thank you for this feedback @steveire, to be honest I agree, I didn't want to 
> waste time arguing about the naming for now so simply gave in. Supporting 
> multiple words from the outset also felt wrong, maybe we can spin around 
> later towards the end of the review if there is more of a concencus on naming 
> being the other way.


It seems to be only Aaron who is against East/West. And his objection doesn't 
seem to be considerate of the broader consensus. I'm sure it's no problem to 
use those names.

> Thank you also for the failure scenarios I will add them as tests as I try to 
> improve this further.
> 
> I think there was a suggestion that somehow this should cover all forms of 
> identifier ordering but I actually think that is going to be incredibly 
> complex especially if that configuration was completely dynamic and supported 
> custom types and macros
> 
> For now let me pursue fixes for the cases you have identified.

Great, here's a few more which don't currently get converted :) :

  void autofn() {
  const auto i = 0;
  const auto& ir = i;
  const auto* ip = 
  }


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

https://reviews.llvm.org/D69764



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


[PATCH] D80454: [Clang][test] fix tests when using external assembler

2020-05-22 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D80454#2051527 , @ychen wrote:

> In D80454#2051524 , @aganea wrote:
>
> > Could you please attach a test to demonstrate the issue?
>
>
> When a toolchain is not using integrated-as, the test would fail because 
> using external assember would increase job counts. Most toolchains in tree 
> use integrated-as, but we still support external assembler. So this is just 
> making it explicit.


This point deserves a comment in the test.

@ychen What is your LLVM_DEFAULT_TARGET_TRIPLE?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80454



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/test/Driver/aix-ld.cpp:2
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \

stevewan wrote:
> hubert.reinterpretcast wrote:
> > I am wondering if it makes sense to put this into `aix-ld.c`. It helps to 
> > demonstrate that the link step behaviour is not determined by the source 
> > file name.
> > 
> > For example, in `hexagon-toolchain-elf.c`:
> > ```
> > 182 // RUN: %clangxx -### -target hexagon-unknown-elf \
> > 183 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
> > 184 // RUN:   -mcpu=hexagonv60 \
> > 185 // RUN:   %s 2>&1 \
> > 186 // RUN:   | FileCheck -check-prefix=CHECK031 %s
> > ```
> Yes, it makes sense to show that, and that was my original design. I moved 
> this to a separate file to avoid getting a warning because of the inherited 
> `CHECK-LD32-ARG-ORDER-NOT: warning:`. I'm now thinking of two ways to 
> incorporate this into `aix-ld.c`,
> 1. Simply remove the warning check like what's done in the example you've 
> showed.
> 2. Change the line `CHECK-LD32-ARG-ORDER-NOT: warning:` into something like,
> 
> ```
> // CHECK-LD32-ARG-ORDER-NOT: warning:
> // CHECK-LD32-ARG-ORDER: warning: treating 'c' input as 'c++' when in C++ 
> mode, this behavior is deprecated [-Wdeprecated]
> // CHECK-LD32-ARG-ORDER-NOT: warning:
> ```
> Do we have a preference for one way over another?
I think not adding something extra is better than adding something extra that's 
not particularly relevant. The intended behaviour for what we're testing is the 
same even if the deprecated behaviour is finally actually removed (and maybe 
with the removal of or a change to the warning message).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked 3 inline comments as done.
stevewan added inline comments.



Comment at: clang/test/Driver/aix-ld.cpp:2
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \

hubert.reinterpretcast wrote:
> I am wondering if it makes sense to put this into `aix-ld.c`. It helps to 
> demonstrate that the link step behaviour is not determined by the source file 
> name.
> 
> For example, in `hexagon-toolchain-elf.c`:
> ```
> 182 // RUN: %clangxx -### -target hexagon-unknown-elf \
> 183 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
> 184 // RUN:   -mcpu=hexagonv60 \
> 185 // RUN:   %s 2>&1 \
> 186 // RUN:   | FileCheck -check-prefix=CHECK031 %s
> ```
Yes, it makes sense to show that, and that was my original design. I moved this 
to a separate file to avoid getting a warning because of the inherited 
`CHECK-LD32-ARG-ORDER-NOT: warning:`. I'm now thinking of two ways to 
incorporate this into `aix-ld.c`,
1. Simply remove the warning check like what's done in the example you've 
showed.
2. Change the line `CHECK-LD32-ARG-ORDER-NOT: warning:` into something like,

```
// CHECK-LD32-ARG-ORDER-NOT: warning:
// CHECK-LD32-ARG-ORDER: warning: treating 'c' input as 'c++' when in C++ 
mode, this behavior is deprecated [-Wdeprecated]
// CHECK-LD32-ARG-ORDER-NOT: warning:
```
Do we have a preference for one way over another?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[PATCH] D80454: [Clang][test] fix tests when using external assembler

2020-05-22 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea accepted this revision.
aganea added a comment.
This revision is now accepted and ready to land.

LGTM.

Are you planning on adding another patch for the change that you've sent 
initially? Ideally, I'd like to relax a bit that constraint in `Driver.cpp`, as 
in D74447 , but that requires first to disable 
`-disable-free` to ensure we exit cleanly, at least when runing the tests (a 
bit like the `LLD_IN_TEST` env var).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80454



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


[PATCH] D76791: [Matrix] Implement matrix index expressions ([][]).

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/include/clang/AST/Expr.h:2648
+/// MatrixSubscriptExpr - Matrix subscript expression for the MatrixType
+/// extension.
+class MatrixSubscriptExpr : public Expr {

Oh, that's interesting.  So you've changed this to flatten the component 
expressions?  I think that might be inconsistent with our usual 
source-preservation goals unless you intend to restrict the intermediate base 
expression to be an immediate subscript.  That is, this is okay if you're going 
to require the user to write `matrix[i][j]` and forbid `(matrix[i])[j]`, but if 
you intend to allow the latter, you should preserve that structure here.  You 
can do that while still providing this API; you just have to implement 
`getBase()` etc. by looking through parens, and you should have an accessor 
which returns the syntactic base expression.

What expression node do you use for the intermediate subscript expression?  You 
should talk about this in the doc comment.



Comment at: clang/include/clang/Basic/Specifiers.h:159
+
+/// A single matrix element of a matrix.
+OK_MatrixElement

redundancy



Comment at: clang/include/clang/Sema/Sema.h:4907
+  ExprResult ActOnMatrixSubscriptExpr(Scope *S, Expr *Base, Expr *RowIdx,
+  Expr *ColumnIdx, SourceLocation RBLoc);
+

It'd be more conventional to call it `BuildMatrixSubscriptExpr`.  You can do 
all the semantic checks here and make `ActOnArraySubscriptExpr` handle the 
syntactic checks.  This is all assuming that you intend to impose the syntactic 
restriction discussed above.



Comment at: clang/lib/AST/ItaniumMangle.cpp:4238
+  case Expr::MatrixSubscriptExprClass:
+llvm_unreachable("matrix subscript expressions not supported yet");
+

This is simple, you should just mangle them syntactically.  `'ixix'   `.  Test case is

```
using double4x4 = double __attribute__((matrix_type(4,4)));

template 
auto matrix_subscript(double4x4 m, R r, C c) -> decltype(m[r][c]) {}

double test_matrix_subscript(double 4x4 m) { return m[3][2]; }
```



Comment at: clang/lib/Sema/SemaExpr.cpp:4556
+  if (base->getType()->isMatrixType())
+return ActOnMatrixSubscriptExpr(S, base, idx, nullptr, rbLoc);
+

You're not handling the case of a parenthesized MatrixSubscriptExpr.  If that 
should be an error, that's a reasonable language rule, but it should probably 
be a better error than whatever you'll get by default.

And you might be specifically and problematically avoiding an error because of 
the special treatment of `IncompleteMatrixIdx` below.  I'd just pull that up 
here and emit an error.

Doing this before the C++2a comma-index check is intentional?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76791



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


[PATCH] D80425: Fix LLVM/Clang builds with mingw toolchain

2020-05-22 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added inline comments.



Comment at: clang/tools/libclang/CMakeLists.txt:71
+  list(APPEND LIBS ${CMAKE_DL_LIBS})
 endif()
 

mati865 wrote:
> thieta wrote:
> > mstorsjo wrote:
> > > If you say this is the same way it's done elsewhere, then sure - although 
> > > I have no idea about what the issue is, why I haven't run into it, etc. 
> > > Normally you wouldn't have a `libdl` on mingw right? What's the concrete 
> > > issue you're running into, and in which conditions would one run into it?
> > The problem here is that on my system `find_library()` picks up libdl in 
> > `/usr/lib` and then tries to link to it and gives me an error about it. 
> > `HAVE_LIBDL` comes from `config-ix.cmake` where it's checked if we are on 
> > windows or not: 
> > https://github.com/llvm/llvm-project/blob/216833b32befd14079130a3b857906f4e301179c/llvm/cmake/config-ix.cmake#L101
> > 
> > So this is how other places uses `CMAKE_DL_LIBS` like here: 
> > https://github.com/llvm/llvm-project/blob/7aaff8fd2da2812a2b3cbc8a41af29774b10a7d6/llvm/lib/Support/CMakeLists.txt#L13
> I also had this issue in MSYS2 but used `-DCMAKE_SYSTEM_IGNORE_PATH=/usr/lib` 
> to get around it.
> MSYS2 has Cygwin like (so UNIX like) environment in `/usr/` and 
> `/mingw{32,64}` for Mingw-w64.
Ah, I see.

I build with `-DCMAKE_FIND_ROOT_PATH=$CROSS_ROOT` 
`-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER` 
`-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY` 
`-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY` - but yeah, this fix probably is 
nice to have in any case.



Comment at: llvm/cmake/modules/AddLLVM.cmake:1898
+  if(CMAKE_HOST_UNIX AND NOT MINGW)
 set(LLVM_LINK_OR_COPY create_symlink)
   else()

thieta wrote:
> mstorsjo wrote:
> > What's the practical issue you're trying to fix with this one here? If 
> > `CMAKE_HOST_UNIX`, i.e. when cross compiling, it does work fine to create 
> > symlinks (saving a bit of disk space and bandwidth). Then when transferring 
> > the built products to an actual windows system, they're converted into 
> > copies at some point (e.g. when zipping up the results).
> The problem I tried to fix here was to avoid creating symlinks since the 
> binaries under mingw is always going to be executed on windows - so yeah I 
> could remove the symlinks and redo them as copies later - but I thought it 
> might be better to just do it directly from the build system so that you can 
> build on wsl and use it from the same dir from the windows host.
> 
> But yeah I am not married to this change - I think it's not to vital.
Oh, right, WSL - although - I just tested that, symlinking an exe to another 
name in WSL, and executing it in cmd.exe, and it seemed to work as well.

In any case, not totally opposed, but shouldn't it be `if(CMAKE_HOST_UNIX AND 
NOT WIN32)` in that case, i.e. building on a unix host, and not building for a 
win32 target? And in that case, it should be split out to a separate review 
with a much wider audience with more of the windows stakeholders involved.



Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:967
CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
-  elseif(LINKER_IS_LLD_LINK)
+  elseif(LINKER_IS_LLD_LINK AND NOT MINGW)
 append("/lldltocache:${PROJECT_BINARY_DIR}/lto.cache"

mati865 wrote:
> thieta wrote:
> > mstorsjo wrote:
> > > Do you happen to know why `LINKER_IS_LLD_LINK` gets set in this case? 
> > > `ld.lld` (the ELF linker interface, which then the MinGW driver remaps 
> > > onto the COFF backend with the `lld-link` interface) certainly doesn't 
> > > take `lld-link` style options. I believe (without diving further into it) 
> > > that we shouldn't be setting this flag in this combination, but with the 
> > > option implemented, we should fit it into the case further above, 
> > > `elseif((UNIX OR MINGW) AND LLVM_USE_LINKER STREQUAL "lld")`
> > Yeah I bet that variable is set because I pass `LLVM_USE_LINKER=lld` but I 
> > haven't digged to deeply. I can rework the if statement here when we have 
> > the lld option in there.
> > Yeah I bet that variable is set because I pass LLVM_USE_LINKER=lld but I 
> > haven't digged to deeply. 
> 
> It does use `lld-link` when you use `LLVM_USE_LINKER=lld`.
> 
> The problem lies in this line:
> ```
> append("/lldltocache:${PROJECT_BINARY_DIR}/lto.cache"
> ```
> For MinGW that should read:
> ```
> append("-Wl,/lldltocache:${PROJECT_BINARY_DIR}/lto.cache"
> ```
> That's because you are passing this flag to GCC/Clang.
> For MinGW that should read:
> 
> append("-Wl,/lldltocache:${PROJECT_BINARY_DIR}/lto.cache"

We're adding this option properly in the mingw frontend, so we shouldn't do the 
hacky way of passing lld-link options via the mingw frontend by passing them as 
`/option`.

And the reason `LINKER_IS_LLD_LINK` is set seems to be this:

```
if(CMAKE_LINKER MATCHES "lld-link" OR (WIN32 AND LLVM_USE_LINKER STREQUAL 
"lld") OR LLVM_ENABLE_LLD)

[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/test/Driver/aix-ld.cpp:2
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \

I am wondering if it makes sense to put this into `aix-ld.c`. It helps to 
demonstrate that the link step behaviour is not determined by the source file 
name.

For example, in `hexagon-toolchain-elf.c`:
```
182 // RUN: %clangxx -### -target hexagon-unknown-elf \
183 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
184 // RUN:   -mcpu=hexagonv60 \
185 // RUN:   %s 2>&1 \
186 // RUN:   | FileCheck -check-prefix=CHECK031 %s
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[PATCH] D47092: downgrade strong type info names to weak_odr linkage

2020-05-22 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

In D47092#2049842 , @efriedma wrote:

> I think the preferred solution is something like 
> https://bugs.llvm.org/show_bug.cgi?id=37545#c4, which is slightly different 
> from both this patch and D46665 .


My understanding was that once the ASAN issue in PR37545 is solved (and 
https://bugs.llvm.org/show_bug.cgi?id=37545#c4 is a suggestion about how to do 
that), we can apply this change (D47092 ). Is 
that correct? If so, I can see how easy it might be to fix PR37545 in order to 
unblock this.


Repository:
  rC Clang

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

https://reviews.llvm.org/D47092



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


[PATCH] D80454: [Clang][test] fix tests when using external assembler

2020-05-22 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 265792.
ychen added a comment.

- update


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80454

Files:
  clang/test/Driver/cc1-spawnprocess.c


Index: clang/test/Driver/cc1-spawnprocess.c
===
--- clang/test/Driver/cc1-spawnprocess.c
+++ clang/test/Driver/cc1-spawnprocess.c
@@ -1,18 +1,18 @@
-// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 | FileCheck %s 
--check-prefix=YES
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 | FileCheck %s 
--check-prefix=YES
 // RUN: %clang -fno-integrated-cc1 -c -### %s 2>&1 | FileCheck %s 
--check-prefix=NO
 
 // RUN: %clang -fintegrated-cc1 -fno-integrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
-// RUN: %clang -fno-integrated-cc1 -fintegrated-cc1 -c -### %s 2>&1 \
+// RUN: %clang -fno-integrated-cc1 -fintegrated-cc1 -fintegrated-as -c -### %s 
2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 
-// RUN: %clang_cl -fintegrated-cc1 -c -### -- %s 2>&1 \
+// RUN: %clang_cl -fintegrated-cc1 -fintegrated-as -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 // RUN: %clang_cl -fno-integrated-cc1 -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
 
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fintegrated-cc1 \
-// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fno-integrated-cc1 \
 // RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
@@ -24,7 +24,7 @@
 // The following tests ensure that only one integrated-cc1 is executed.
 
 // Only one TU, one job, thus integrated-cc1 is enabled.
-// RUN: %clang -fintegrated-cc1 -c %s -### 2>&1 | FileCheck %s 
--check-prefix=YES
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c %s -### 2>&1 | FileCheck %s 
--check-prefix=YES
 
 // Only one TU, but we're linking, two jobs, thus integrated-cc1 is disabled.
 // RUN: %clang -fintegrated-cc1 %s -### 2>&1 | FileCheck %s --check-prefix=NO


Index: clang/test/Driver/cc1-spawnprocess.c
===
--- clang/test/Driver/cc1-spawnprocess.c
+++ clang/test/Driver/cc1-spawnprocess.c
@@ -1,18 +1,18 @@
-// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 | FileCheck %s --check-prefix=YES
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 | FileCheck %s --check-prefix=YES
 // RUN: %clang -fno-integrated-cc1 -c -### %s 2>&1 | FileCheck %s --check-prefix=NO
 
 // RUN: %clang -fintegrated-cc1 -fno-integrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
-// RUN: %clang -fno-integrated-cc1 -fintegrated-cc1 -c -### %s 2>&1 \
+// RUN: %clang -fno-integrated-cc1 -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 
-// RUN: %clang_cl -fintegrated-cc1 -c -### -- %s 2>&1 \
+// RUN: %clang_cl -fintegrated-cc1 -fintegrated-as -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 // RUN: %clang_cl -fno-integrated-cc1 -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
 
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fintegrated-cc1 \
-// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fno-integrated-cc1 \
 // RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
@@ -24,7 +24,7 @@
 // The following tests ensure that only one integrated-cc1 is executed.
 
 // Only one TU, one job, thus integrated-cc1 is enabled.
-// RUN: %clang -fintegrated-cc1 -c %s -### 2>&1 | FileCheck %s --check-prefix=YES
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c %s -### 2>&1 | FileCheck %s --check-prefix=YES
 
 // Only one TU, but we're linking, two jobs, thus integrated-cc1 is disabled.
 // RUN: %clang -fintegrated-cc1 %s -### 2>&1 | FileCheck %s --check-prefix=NO
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80454: [Clang][test] fix tests when using external assembler

2020-05-22 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

In D80454#2051524 , @aganea wrote:

> Could you please attach a test to demonstrate the issue?


When a toolchain is not using integrated-as, the test would fail because using 
external assember would increase job counts. Most toolchains in tree use 
integrated-as, but we still support external assembler. So this is just making 
it explicit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80454



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


[PATCH] D80454: [Clang][test] fix tests when using external assembler

2020-05-22 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 265791.
ychen added a comment.

- update


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80454

Files:
  clang/test/Driver/cc1-spawnprocess.c


Index: clang/test/Driver/cc1-spawnprocess.c
===
--- clang/test/Driver/cc1-spawnprocess.c
+++ clang/test/Driver/cc1-spawnprocess.c
@@ -1,18 +1,18 @@
-// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 | FileCheck %s 
--check-prefix=YES
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 | FileCheck %s 
--check-prefix=YES
 // RUN: %clang -fno-integrated-cc1 -c -### %s 2>&1 | FileCheck %s 
--check-prefix=NO
 
 // RUN: %clang -fintegrated-cc1 -fno-integrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
-// RUN: %clang -fno-integrated-cc1 -fintegrated-cc1 -c -### %s 2>&1 \
+// RUN: %clang -fno-integrated-cc1 -fintegrated-as -fintegrated-cc1 -c -### %s 
2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 
-// RUN: %clang_cl -fintegrated-cc1 -c -### -- %s 2>&1 \
+// RUN: %clang_cl -fintegrated-cc1 -fintegrated-as -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 // RUN: %clang_cl -fno-integrated-cc1 -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
 
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fintegrated-cc1 \
-// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fno-integrated-cc1 \
 // RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
@@ -24,7 +24,7 @@
 // The following tests ensure that only one integrated-cc1 is executed.
 
 // Only one TU, one job, thus integrated-cc1 is enabled.
-// RUN: %clang -fintegrated-cc1 -c %s -### 2>&1 | FileCheck %s 
--check-prefix=YES
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c %s -### 2>&1 | FileCheck %s 
--check-prefix=YES
 
 // Only one TU, but we're linking, two jobs, thus integrated-cc1 is disabled.
 // RUN: %clang -fintegrated-cc1 %s -### 2>&1 | FileCheck %s --check-prefix=NO


Index: clang/test/Driver/cc1-spawnprocess.c
===
--- clang/test/Driver/cc1-spawnprocess.c
+++ clang/test/Driver/cc1-spawnprocess.c
@@ -1,18 +1,18 @@
-// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 | FileCheck %s --check-prefix=YES
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 | FileCheck %s --check-prefix=YES
 // RUN: %clang -fno-integrated-cc1 -c -### %s 2>&1 | FileCheck %s --check-prefix=NO
 
 // RUN: %clang -fintegrated-cc1 -fno-integrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
-// RUN: %clang -fno-integrated-cc1 -fintegrated-cc1 -c -### %s 2>&1 \
+// RUN: %clang -fno-integrated-cc1 -fintegrated-as -fintegrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 
-// RUN: %clang_cl -fintegrated-cc1 -c -### -- %s 2>&1 \
+// RUN: %clang_cl -fintegrated-cc1 -fintegrated-as -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 // RUN: %clang_cl -fno-integrated-cc1 -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
 
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fintegrated-cc1 \
-// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fno-integrated-cc1 \
 // RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
@@ -24,7 +24,7 @@
 // The following tests ensure that only one integrated-cc1 is executed.
 
 // Only one TU, one job, thus integrated-cc1 is enabled.
-// RUN: %clang -fintegrated-cc1 -c %s -### 2>&1 | FileCheck %s --check-prefix=YES
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c %s -### 2>&1 | FileCheck %s --check-prefix=YES
 
 // Only one TU, but we're linking, two jobs, thus integrated-cc1 is disabled.
 // RUN: %clang -fintegrated-cc1 %s -### 2>&1 | FileCheck %s --check-prefix=NO
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80454: [Clang][test] fix tests when using external assembler

2020-05-22 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added a comment.

Could you please attach a test to demonstrate the issue?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80454



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


[PATCH] D80251: [X86] Update some av512 shift intrinsics to use "unsigned int" parameter instead of int to match Intel documentaiton

2020-05-22 Thread Craig Topper via Phabricator via cfe-commits
craig.topper updated this revision to Diff 265787.
craig.topper added a comment.

Add -Wsign-conversion. Fix two test issues that exposed.


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

https://reviews.llvm.org/D80251

Files:
  clang/lib/Headers/avx512bwintrin.h
  clang/lib/Headers/avx512fintrin.h
  clang/lib/Headers/avx512vlbwintrin.h
  clang/lib/Headers/avx512vlintrin.h
  clang/test/CodeGen/avx512bw-builtins.c
  clang/test/CodeGen/avx512f-builtins.c
  clang/test/CodeGen/avx512vl-builtins.c
  clang/test/CodeGen/avx512vlbw-builtins.c

Index: clang/test/CodeGen/avx512vlbw-builtins.c
===
--- clang/test/CodeGen/avx512vlbw-builtins.c
+++ clang/test/CodeGen/avx512vlbw-builtins.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -fexperimental-new-pass-manager -triple=x86_64-apple-darwin -target-feature +avx512bw -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
-// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -fexperimental-new-pass-manager -triple=x86_64-apple-darwin -target-feature +avx512bw -target-feature +avx512vl -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -fexperimental-new-pass-manager -triple=x86_64-apple-darwin -target-feature +avx512bw -target-feature +avx512vl -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -fexperimental-new-pass-manager -triple=x86_64-apple-darwin -target-feature +avx512bw -target-feature +avx512vl -fno-signed-char -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s
 
 #include 
 
@@ -2199,7 +2199,7 @@
   return _mm_mask_slli_epi16(__W, __U, __A, 5); 
 }
 
-__m128i test_mm_mask_slli_epi16_2(__m128i __W, __mmask8 __U, __m128i __A, int __B) {
+__m128i test_mm_mask_slli_epi16_2(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm_mask_slli_epi16_2
   // CHECK: @llvm.x86.sse2.pslli.w
   // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
@@ -2213,7 +2213,7 @@
   return _mm_maskz_slli_epi16(__U, __A, 5); 
 }
 
-__m128i test_mm_maskz_slli_epi16_2(__mmask8 __U, __m128i __A, int __B) {
+__m128i test_mm_maskz_slli_epi16_2(__mmask8 __U, __m128i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm_maskz_slli_epi16_2
   // CHECK: @llvm.x86.sse2.pslli.w
   // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
@@ -2227,7 +2227,7 @@
   return _mm256_mask_slli_epi16(__W, __U, __A, 5); 
 }
 
-__m256i test_mm256_mask_slli_epi16_2(__m256i __W, __mmask16 __U, __m256i __A, int __B) {
+__m256i test_mm256_mask_slli_epi16_2(__m256i __W, __mmask16 __U, __m256i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm256_mask_slli_epi16_2
   // CHECK: @llvm.x86.avx2.pslli.w
   // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
@@ -2241,7 +2241,7 @@
   return _mm256_maskz_slli_epi16(__U, __A, 5); 
 }
 
-__m256i test_mm256_maskz_slli_epi16_2(__mmask16 __U, __m256i __A, int __B) {
+__m256i test_mm256_maskz_slli_epi16_2(__mmask16 __U, __m256i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm256_maskz_slli_epi16_2
   // CHECK: @llvm.x86.avx2.pslli.w
   // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
@@ -2447,7 +2447,7 @@
   return _mm_mask_srai_epi16(__W, __U, __A, 5); 
 }
 
-__m128i test_mm_mask_srai_epi16_2(__m128i __W, __mmask8 __U, __m128i __A, int __B) {
+__m128i test_mm_mask_srai_epi16_2(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm_mask_srai_epi16_2
   // CHECK: @llvm.x86.sse2.psrai.w
   // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
@@ -2461,7 +2461,7 @@
   return _mm_maskz_srai_epi16(__U, __A, 5); 
 }
 
-__m128i test_mm_maskz_srai_epi16_2(__mmask8 __U, __m128i __A, int __B) {
+__m128i test_mm_maskz_srai_epi16_2(__mmask8 __U, __m128i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm_maskz_srai_epi16_2
   // CHECK: @llvm.x86.sse2.psrai.w
   // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
@@ -2475,7 +2475,7 @@
   return _mm256_mask_srai_epi16(__W, __U, __A, 5); 
 }
 
-__m256i test_mm256_mask_srai_epi16_2(__m256i __W, __mmask16 __U, __m256i __A, int __B) {
+__m256i test_mm256_mask_srai_epi16_2(__m256i __W, __mmask16 __U, __m256i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm256_mask_srai_epi16_2
   // CHECK: @llvm.x86.avx2.psrai.w
   // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
@@ -2489,7 +2489,7 @@
   return _mm256_maskz_srai_epi16(__U, __A, 5); 
 }
 
-__m256i test_mm256_maskz_srai_epi16_2(__mmask16 __U, __m256i __A, int __B) {
+__m256i test_mm256_maskz_srai_epi16_2(__mmask16 __U, __m256i __A, unsigned int __B) {
   // CHECK-LABEL: @test_mm256_maskz_srai_epi16_2
   // CHECK: @llvm.x86.avx2.psrai.w
   // CHECK: select <16 x 

[PATCH] D80294: Add support for vmsumudm

2020-05-22 Thread Kamau Bridgeman via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa28e9f120860: [PowerPC] Add support for vmsumudm (authored 
by saghir, committed by kamaub).

Changed prior to commit:
  https://reviews.llvm.org/D80294?vs=265332=265790#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80294

Files:
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/P9InstrResources.td
  llvm/lib/Target/PowerPC/PPCInstrAltivec.td
  llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-vmx.txt
  llvm/test/MC/PowerPC/ppc64-encoding-vmx.s


Index: llvm/test/MC/PowerPC/ppc64-encoding-vmx.s
===
--- llvm/test/MC/PowerPC/ppc64-encoding-vmx.s
+++ llvm/test/MC/PowerPC/ppc64-encoding-vmx.s
@@ -366,6 +366,9 @@
 # CHECK-BE: vmsumuhm 2, 3, 4, 5 # encoding: [0x10,0x43,0x21,0x66]
 # CHECK-LE: vmsumuhm 2, 3, 4, 5 # encoding: [0x66,0x21,0x43,0x10]
 vmsumuhm 2, 3, 4, 5
+# CHECK-BE: vmsumudm 2, 3, 4, 5 # encoding: [0x10,0x43,0x21,0x63]
+# CHECK-LE: vmsumudm 2, 3, 4, 5 # encoding: [0x63,0x21,0x43,0x10]
+vmsumudm 2, 3, 4, 5
 # CHECK-BE: vmsumuhs 2, 3, 4, 5 # encoding: [0x10,0x43,0x21,0x67]
 # CHECK-LE: vmsumuhs 2, 3, 4, 5 # encoding: [0x67,0x21,0x43,0x10]
 vmsumuhs 2, 3, 4, 5
Index: llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-vmx.txt
===
--- llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-vmx.txt
+++ llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-vmx.txt
@@ -333,6 +333,9 @@
 # CHECK: vmsumuhm 2, 3, 4, 5 
 0x10 0x43 0x21 0x66
 
+# CHECK: vmsumudm 2, 3, 4, 5
+0x10 0x43 0x21 0x63
+
 # CHECK: vmsumuhs 2, 3, 4, 5 
 0x10 0x43 0x21 0x67
 
Index: llvm/lib/Target/PowerPC/PPCInstrAltivec.td
===
--- llvm/lib/Target/PowerPC/PPCInstrAltivec.td
+++ llvm/lib/Target/PowerPC/PPCInstrAltivec.td
@@ -1362,6 +1362,10 @@
 def HasP9Altivec : Predicate<"PPCSubTarget->hasP9Altivec()">;
 let Predicates = [HasP9Altivec] in {
 
+// Vector Multiply-Sum
+def VMSUMUDM : VA1a_Int_Ty3<35, "vmsumudm", int_ppc_altivec_vmsumudm,
+v1i128, v2i64, v1i128>;
+
 // i8 element comparisons.
 def VCMPNEB   : VCMP   <  7, "vcmpneb $vD, $vA, $vB"  , v16i8>;
 def VCMPNEB_rec  : VCMPo  <  7, "vcmpneb. $vD, $vA, $vB" , v16i8>;
Index: llvm/lib/Target/PowerPC/P9InstrResources.td
===
--- llvm/lib/Target/PowerPC/P9InstrResources.td
+++ llvm/lib/Target/PowerPC/P9InstrResources.td
@@ -373,6 +373,7 @@
 VMSUMSHS,
 VMSUMUBM,
 VMSUMUHM,
+VMSUMUDM,
 VMSUMUHS,
 VMULESB,
 VMULESH,
Index: llvm/include/llvm/IR/IntrinsicsPowerPC.td
===
--- llvm/include/llvm/IR/IntrinsicsPowerPC.td
+++ llvm/include/llvm/IR/IntrinsicsPowerPC.td
@@ -495,6 +495,9 @@
   def int_ppc_altivec_vmsumuhm : GCCBuiltin<"__builtin_altivec_vmsumuhm">,
 Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
llvm_v4i32_ty], [IntrNoMem]>;
+  def int_ppc_altivec_vmsumudm : GCCBuiltin<"__builtin_altivec_vmsumudm">,
+Intrinsic<[llvm_v1i128_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
+   llvm_v1i128_ty], [IntrNoMem]>;
   def int_ppc_altivec_vmsumuhs : GCCBuiltin<"__builtin_altivec_vmsumuhs">,
 Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
llvm_v4i32_ty], [IntrNoMem]>;


Index: llvm/test/MC/PowerPC/ppc64-encoding-vmx.s
===
--- llvm/test/MC/PowerPC/ppc64-encoding-vmx.s
+++ llvm/test/MC/PowerPC/ppc64-encoding-vmx.s
@@ -366,6 +366,9 @@
 # CHECK-BE: vmsumuhm 2, 3, 4, 5 # encoding: [0x10,0x43,0x21,0x66]
 # CHECK-LE: vmsumuhm 2, 3, 4, 5 # encoding: [0x66,0x21,0x43,0x10]
 vmsumuhm 2, 3, 4, 5
+# CHECK-BE: vmsumudm 2, 3, 4, 5 # encoding: [0x10,0x43,0x21,0x63]
+# CHECK-LE: vmsumudm 2, 3, 4, 5 # encoding: [0x63,0x21,0x43,0x10]
+vmsumudm 2, 3, 4, 5
 # CHECK-BE: vmsumuhs 2, 3, 4, 5 # encoding: [0x10,0x43,0x21,0x67]
 # CHECK-LE: vmsumuhs 2, 3, 4, 5 # encoding: [0x67,0x21,0x43,0x10]
 vmsumuhs 2, 3, 4, 5
Index: llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-vmx.txt
===
--- llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-vmx.txt
+++ llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-vmx.txt
@@ -333,6 +333,9 @@
 # CHECK: vmsumuhm 2, 3, 4, 5 
 0x10 0x43 0x21 0x66
 
+# CHECK: vmsumudm 2, 3, 4, 5
+0x10 0x43 0x21 0x63
+
 # CHECK: vmsumuhs 2, 3, 4, 5 
 0x10 0x43 0x21 0x67
 

[PATCH] D75591: [OpenMP] Add firstprivate as a default data-sharing attribute to clang

2020-05-22 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel updated this revision to Diff 265788.
atmnpatel added a comment.
Herald added a subscriber: sstefan1.

Updated tests and includes changes made by @ABataev.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75591

Files:
  clang-tools-extra/docs/clang-tidy/checks/openmp-use-default-none.rst
  clang-tools-extra/test/clang-tidy/checkers/openmp-use-default-none.cpp
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/lib/ASTMatchers/Dynamic/Registry.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/distribute_parallel_for_default_messages.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/driver.c
  clang/test/OpenMP/parallel_default_messages.cpp
  clang/test/OpenMP/parallel_for_default_messages.cpp
  clang/test/OpenMP/parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_default_messages.cpp
  clang/test/OpenMP/parallel_sections_default_messages.cpp
  clang/test/OpenMP/target_parallel_default_messages.cpp
  clang/test/OpenMP/target_parallel_for_default_messages.cpp
  clang/test/OpenMP/target_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/target_teams_default_messages.cpp
  clang/test/OpenMP/target_teams_distribute_default_messages.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_default_messages.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/task_default_messages.cpp
  clang/test/OpenMP/task_messages.cpp
  clang/test/OpenMP/teams_default_messages.cpp
  clang/test/OpenMP/teams_distribute_default_messages.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_default_messages.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/teams_distribute_simd_default_messages.cpp
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersTest.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def

Index: llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
===
--- llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -537,6 +537,7 @@
 
 __OMP_DEFAULT_KIND(none)
 __OMP_DEFAULT_KIND(shared)
+__OMP_DEFAULT_KIND(firstprivate)
 __OMP_DEFAULT_KIND(unknown)
 
 #undef __OMP_DEFAULT_KIND
Index: clang/unittests/ASTMatchers/ASTMatchersTest.h
===
--- clang/unittests/ASTMatchers/ASTMatchersTest.h
+++ clang/unittests/ASTMatchers/ASTMatchersTest.h
@@ -314,6 +314,20 @@
   return matchesConditionally(Code, AMatcher, false, "-fopenmp=libomp");
 }
 
+template 
+testing::AssertionResult matchesWithOpenMP51(const std::string ,
+ const T ) {
+  return matchesConditionally(Code, AMatcher, true,
+  {"-fopenmp=libomp", "-fopenmp-version=51"});
+}
+
+template 
+testing::AssertionResult notMatchesWithOpenMP51(const std::string ,
+const T ) {
+  return matchesConditionally(Code, AMatcher, false,
+  {"-fopenmp=libomp", "-fopenmp-version=51"});
+}
+
 template 
 testing::AssertionResult
 matchAndVerifyResultConditionally(const std::string , const T ,
Index: clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -1860,11 +1860,18 @@
   EXPECT_TRUE(matchesWithOpenMP(Source3, Matcher));
 
   const std::string Source4 = R"(
+void x() {
+#pragma omp parallel default(firstprivate)
+;
+})";
+  EXPECT_TRUE(matchesWithOpenMP51(Source4, Matcher));
+
+  const std::string Source5 = R"(
 void x(int x) {
 #pragma omp parallel num_threads(x)
 ;
 })";
-  EXPECT_TRUE(notMatchesWithOpenMP(Source4, Matcher));
+  EXPECT_TRUE(notMatchesWithOpenMP(Source5, Matcher));
 }
 
 TEST(MatchFinderAPI, matchesDynamic) {
Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -2830,11 +2830,18 @@
   EXPECT_TRUE(matchesWithOpenMP(Source3, Matcher));
 
   const std::string Source4 = R"(
+void x() {
+#pragma omp parallel default(firstprivate)
+;
+})";
+  EXPECT_TRUE(matchesWithOpenMP51(Source4, Matcher));
+
+  const std::string Source5 = R"(
 void x(int x) {
 #pragma omp parallel num_threads(x)
 ;
 })";
-  EXPECT_TRUE(matchesWithOpenMP(Source4, 

[PATCH] D80454: [Clang] fix limiting -fintegrated-cc1 to only one TU

2020-05-22 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen planned changes to this revision.
ychen added a comment.

This may not be complete.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80454



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


[PATCH] D80454: [Clang] fix limiting -fintegrated-cc1 to only one TU

2020-05-22 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen created this revision.
ychen added a reviewer: aganea.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
ychen planned changes to this revision.
ychen added a comment.

This may not be complete.


For D74490 . For cases like where external 
assembler is used, counting the
job number is not exactly right.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80454

Files:
  clang/lib/Driver/Driver.cpp


Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -3763,7 +3763,8 @@
   }
 
   // If we have more than one job, then disable integrated-cc1 for now.
-  if (C.getJobs().size() > 1)
+  if (std::count_if(C.getActions().begin(), C.getActions().end(),
+[](Action *A) { return isa(A); }) > 1)
 for (auto  : C.getJobs())
   J.InProcess = false;
 


Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -3763,7 +3763,8 @@
   }
 
   // If we have more than one job, then disable integrated-cc1 for now.
-  if (C.getJobs().size() > 1)
+  if (std::count_if(C.getActions().begin(), C.getActions().end(),
+[](Action *A) { return isa(A); }) > 1)
 for (auto  : C.getJobs())
   J.InProcess = false;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 265781.
stevewan added a comment.

Address furthur comments on the test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.cpp


Index: clang/test/Driver/aix-ld.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-ld.cpp
@@ -0,0 +1,18 @@
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER-NOT: warning:
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList 
,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 


Index: clang/test/Driver/aix-ld.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-ld.cpp
@@ -0,0 +1,18 @@
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER-NOT: warning:
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList ,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80428: [clang] Optimize SourceManager::getFileIDLocal [WIP]

2020-05-22 Thread Marco Elver via Phabricator via cfe-commits
melver updated this revision to Diff 265780.
melver retitled this revision from "[clang] Optimize getFileIDLocal [WIP]" to 
"[clang] Optimize SourceManager::getFileIDLocal [WIP]".
melver edited the summary of this revision.
melver added a comment.

Improve code-gen further -- another ~5%.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80428

Files:
  clang/include/clang/Basic/SourceManager.h
  clang/lib/Basic/SourceManager.cpp


Index: clang/lib/Basic/SourceManager.cpp
===
--- clang/lib/Basic/SourceManager.cpp
+++ clang/lib/Basic/SourceManager.cpp
@@ -885,7 +885,7 @@
 bool Invalid = false;
 unsigned MiddleIndex = (GreaterIndex-LessIndex)/2+LessIndex;
 unsigned MidOffset = getLocalSLocEntry(MiddleIndex, ).getOffset();
-if (Invalid)
+if (LLVM_UNLIKELY(Invalid))
   return FileID::get(0);
 
 ++NumProbes;
@@ -896,13 +896,15 @@
   GreaterIndex = MiddleIndex;
   continue;
 }
+// Otherwise, move the low-side up to the middle index. Used in next
+// iteration if !isOffsetInFileID() below.
+LessIndex = MiddleIndex;
 
 // If the middle index contains the value, succeed and return.
 // FIXME: This could be made faster by using a function that's aware of
 // being in the local area.
-if (isOffsetInFileID(FileID::get(MiddleIndex), SLocOffset)) {
-  FileID Res = FileID::get(MiddleIndex);
-
+FileID Res = FileID::get(MiddleIndex);
+if (LLVM_UNLIKELY(isOffsetInFileID(Res, SLocOffset))) {
   // If this isn't a macro expansion, remember it.  We have good locality
   // across FileID lookups.
   if (!LocalSLocEntryTable[MiddleIndex].isExpansion())
@@ -910,9 +912,6 @@
   NumBinaryProbes += NumProbes;
   return Res;
 }
-
-// Otherwise, move the low-side up to the middle index.
-LessIndex = MiddleIndex;
   }
 }
 
Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -439,8 +439,8 @@
   /// SourceManager keeps an array of these objects, and they are uniquely
   /// identified by the FileID datatype.
   class SLocEntry {
-unsigned Offset : 31;
-unsigned IsExpansion : 1;
+unsigned Offset;
+bool IsExpansion;
 union {
   FileInfo File;
   ExpansionInfo Expansion;
@@ -465,7 +465,6 @@
 }
 
 static SLocEntry get(unsigned Offset, const FileInfo ) {
-  assert(!(Offset & (1u << 31)) && "Offset is too large");
   SLocEntry E;
   E.Offset = Offset;
   E.IsExpansion = false;
@@ -474,7 +473,6 @@
 }
 
 static SLocEntry get(unsigned Offset, const ExpansionInfo ) {
-  assert(!(Offset & (1u << 31)) && "Offset is too large");
   SLocEntry E;
   E.Offset = Offset;
   E.IsExpansion = true;


Index: clang/lib/Basic/SourceManager.cpp
===
--- clang/lib/Basic/SourceManager.cpp
+++ clang/lib/Basic/SourceManager.cpp
@@ -885,7 +885,7 @@
 bool Invalid = false;
 unsigned MiddleIndex = (GreaterIndex-LessIndex)/2+LessIndex;
 unsigned MidOffset = getLocalSLocEntry(MiddleIndex, ).getOffset();
-if (Invalid)
+if (LLVM_UNLIKELY(Invalid))
   return FileID::get(0);
 
 ++NumProbes;
@@ -896,13 +896,15 @@
   GreaterIndex = MiddleIndex;
   continue;
 }
+// Otherwise, move the low-side up to the middle index. Used in next
+// iteration if !isOffsetInFileID() below.
+LessIndex = MiddleIndex;
 
 // If the middle index contains the value, succeed and return.
 // FIXME: This could be made faster by using a function that's aware of
 // being in the local area.
-if (isOffsetInFileID(FileID::get(MiddleIndex), SLocOffset)) {
-  FileID Res = FileID::get(MiddleIndex);
-
+FileID Res = FileID::get(MiddleIndex);
+if (LLVM_UNLIKELY(isOffsetInFileID(Res, SLocOffset))) {
   // If this isn't a macro expansion, remember it.  We have good locality
   // across FileID lookups.
   if (!LocalSLocEntryTable[MiddleIndex].isExpansion())
@@ -910,9 +912,6 @@
   NumBinaryProbes += NumProbes;
   return Res;
 }
-
-// Otherwise, move the low-side up to the middle index.
-LessIndex = MiddleIndex;
   }
 }
 
Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -439,8 +439,8 @@
   /// SourceManager keeps an array of these objects, and they are uniquely
   /// identified by the FileID datatype.
   class SLocEntry {
-unsigned Offset : 31;
-unsigned IsExpansion : 1;
+unsigned Offset;
+bool IsExpansion;
 union {
   FileInfo File;
   ExpansionInfo Expansion;
@@ -465,7 

[PATCH] D80295: [Sema] Diagnose more cases of static data members in local or unnamed classes

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Thanks, looks great.




Comment at: clang/lib/Sema/SemaDecl.cpp:6904
 << Name << RD->getTagKind();
   Invalid = true;
+} else if (RD->isLocalClass()) {

john.brawn wrote:
> rjmccall wrote:
> > john.brawn wrote:
> > > rjmccall wrote:
> > > > This diagnostic actually ignores the tag kind that passed down to it, 
> > > > which should be fixed.  Also, you should pass in the tag kind for the 
> > > > actual anonymous class you found.
> > > > 
> > > > While I'm looking at this code: `isLocalClass` is mis-designed and 
> > > > doesn't work for any of our non-`FunctionDecl` local contexts.  This 
> > > > check should be `if (RD->getParentFunctionOrMethod())`.
> > > > This diagnostic actually ignores the tag kind that passed down to it, 
> > > > which should be fixed. Also, you should pass in the tag kind for the 
> > > > actual anonymous class you found.
> > > 
> > > Will do.
> > > 
> > > > While I'm looking at this code: isLocalClass is mis-designed and 
> > > > doesn't work for any of our non-FunctionDecl local contexts. This check 
> > > > should be if (RD->getParentFunctionOrMethod()).
> > > 
> > > CXXMethodDecl has FunctionDecl as a parent class, so isLocalClass will 
> > > find and return a CXXMethodDecl. Checking it on
> > > 
> > > ```
> > > class Example {
> > >   void method() {
> > > class X {
> > >   static int x;
> > > };
> > >   }
> > > };
> > > ```
> > > I get the error as expected. Do you have an example where it doesn't work?
> > > Will do.
> > 
> > You need to also update the diagnostic to actually care about this.
> > 
> > >  Do you have an example where it doesn't work?
> > 
> > All of the standard C/C++ local contexts are FunctionDecls, but "blocks", 
> > ObjC methods, and OpenMP captured statements aren't.  The simplest example 
> > would be (under `-fblocks`):
> > 
> > ```
> > void test() {
> >   ^{
> > class X {
> >   static int x;
> > };
> >   }();
> > }
> > ```
> > You need to also update the diagnostic to actually care about this.
> 
> It looks like it already does? E.g. in the tests added to 
> anonymous-struct.cpp where the error is "anonymous struct" or "anonymous 
> class" depending on if it's an anonymous class or struct.
Oh, sorry, I just misread the diagnostic.


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

https://reviews.llvm.org/D80295



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


[PATCH] D80295: [Sema] Diagnose more cases of static data members in local or unnamed classes

2020-05-22 Thread John Brawn via Phabricator via cfe-commits
john.brawn marked an inline comment as done.
john.brawn added inline comments.



Comment at: clang/lib/Sema/SemaDecl.cpp:6904
 << Name << RD->getTagKind();
   Invalid = true;
+} else if (RD->isLocalClass()) {

rjmccall wrote:
> john.brawn wrote:
> > rjmccall wrote:
> > > This diagnostic actually ignores the tag kind that passed down to it, 
> > > which should be fixed.  Also, you should pass in the tag kind for the 
> > > actual anonymous class you found.
> > > 
> > > While I'm looking at this code: `isLocalClass` is mis-designed and 
> > > doesn't work for any of our non-`FunctionDecl` local contexts.  This 
> > > check should be `if (RD->getParentFunctionOrMethod())`.
> > > This diagnostic actually ignores the tag kind that passed down to it, 
> > > which should be fixed. Also, you should pass in the tag kind for the 
> > > actual anonymous class you found.
> > 
> > Will do.
> > 
> > > While I'm looking at this code: isLocalClass is mis-designed and doesn't 
> > > work for any of our non-FunctionDecl local contexts. This check should be 
> > > if (RD->getParentFunctionOrMethod()).
> > 
> > CXXMethodDecl has FunctionDecl as a parent class, so isLocalClass will find 
> > and return a CXXMethodDecl. Checking it on
> > 
> > ```
> > class Example {
> >   void method() {
> > class X {
> >   static int x;
> > };
> >   }
> > };
> > ```
> > I get the error as expected. Do you have an example where it doesn't work?
> > Will do.
> 
> You need to also update the diagnostic to actually care about this.
> 
> >  Do you have an example where it doesn't work?
> 
> All of the standard C/C++ local contexts are FunctionDecls, but "blocks", 
> ObjC methods, and OpenMP captured statements aren't.  The simplest example 
> would be (under `-fblocks`):
> 
> ```
> void test() {
>   ^{
> class X {
>   static int x;
> };
>   }();
> }
> ```
> You need to also update the diagnostic to actually care about this.

It looks like it already does? E.g. in the tests added to anonymous-struct.cpp 
where the error is "anonymous struct" or "anonymous class" depending on if it's 
an anonymous class or struct.


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

https://reviews.llvm.org/D80295



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


[PATCH] D80295: [Sema] Diagnose more cases of static data members in local or unnamed classes

2020-05-22 Thread John Brawn via Phabricator via cfe-commits
john.brawn updated this revision to Diff 265779.
john.brawn retitled this revision from "[Sema] Diagnose static data members in 
classes nested in unnamed classes" to "[Sema] Diagnose more cases of static 
data members in local or unnamed classes".
john.brawn edited the summary of this revision.
john.brawn added a comment.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

Detect more kinds of local class.


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

https://reviews.llvm.org/D80295

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/OpenMP/for_loop_messages.cpp
  clang/test/SemaCXX/anonymous-struct.cpp
  clang/test/SemaCXX/blocks.cpp

Index: clang/test/SemaCXX/blocks.cpp
===
--- clang/test/SemaCXX/blocks.cpp
+++ clang/test/SemaCXX/blocks.cpp
@@ -153,3 +153,16 @@
   auto some_block = ^{ (void)s; };
 }
 }
+
+void static_data_member() {
+  auto block = ^{
+class X {
+  static int x; // expected-error {{static data member 'x' not allowed in local class 'X'}}
+};
+class Y {
+  struct Z {
+static int z; // expected-error {{static data member 'z' not allowed in local struct 'Z'}}
+  };
+};
+  };
+}
Index: clang/test/SemaCXX/anonymous-struct.cpp
===
--- clang/test/SemaCXX/anonymous-struct.cpp
+++ clang/test/SemaCXX/anonymous-struct.cpp
@@ -153,3 +153,21 @@
   const Empty E;
 } C;
 } // namespace ImplicitDecls
+
+struct {
+  static int x; // expected-error {{static data member 'x' not allowed in anonymous struct}}
+} static_member_1;
+
+class {
+  struct A {
+static int x; // expected-error {{static data member 'x' not allowed in anonymous class}}
+  } x;
+} static_member_2;
+
+union {
+  struct A {
+struct B {
+  static int x; // expected-error {{static data member 'x' not allowed in anonymous union}}
+} x;
+  } x;
+} static_member_3;
Index: clang/test/OpenMP/for_loop_messages.cpp
===
--- clang/test/OpenMP/for_loop_messages.cpp
+++ clang/test/OpenMP/for_loop_messages.cpp
@@ -831,3 +831,13 @@
   for (int i = 0; i < 16; ++i)
 ;
 }
+
+void test_static_data_member() {
+#pragma omp parallel
+#pragma omp for
+  for (int i = 0; i < 16; ++i) {
+class X {
+  static int x; // expected-error {{static data member 'x' not allowed in local class 'X'}}
+};
+  }
+}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -6885,18 +6885,34 @@
 
 if (SC == SC_Static && CurContext->isRecord()) {
   if (const CXXRecordDecl *RD = dyn_cast(DC)) {
-// C++ [class.static.data]p2:
-//   A static data member shall not be a direct member of an unnamed
-//   or local class
-// FIXME: or of a (possibly indirectly) nested class thereof.
-if (RD->isLocalClass()) {
+// Walk up the enclosing DeclContexts to check for any that are
+// incompatible with static data members.
+const DeclContext *FunctionOrMethod = nullptr;
+const CXXRecordDecl *AnonStruct = nullptr;
+for (DeclContext *Ctxt = DC; Ctxt; Ctxt = Ctxt->getParent()) {
+  if (Ctxt->isFunctionOrMethod()) {
+FunctionOrMethod = Ctxt;
+break;
+  }
+  const CXXRecordDecl *ParentDecl = dyn_cast(Ctxt);
+  if (ParentDecl && !ParentDecl->getDeclName()) {
+AnonStruct = ParentDecl;
+break;
+  }
+}
+if (FunctionOrMethod) {
+  // C++ [class.static.data]p5: A local class shall not have static data
+  // members.
   Diag(D.getIdentifierLoc(),
diag::err_static_data_member_not_allowed_in_local_class)
 << Name << RD->getDeclName() << RD->getTagKind();
-} else if (!RD->getDeclName()) {
+} else if (AnonStruct) {
+  // C++ [class.static.data]p4: Unnamed classes and classes contained
+  // directly or indirectly within unnamed classes shall not contain
+  // static data members.
   Diag(D.getIdentifierLoc(),
diag::err_static_data_member_not_allowed_in_anon_struct)
-<< Name << RD->getTagKind();
+<< Name << AnonStruct->getTagKind();
   Invalid = true;
 } else if (RD->isUnion()) {
   // C++98 [class.union]p1: If a union contains a static data member,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76510: [analyzer] Change the default output type to PD_TEXT_MINIMAL in the frontend, error if an output loc is missing for PathDiagConsumers that need it

2020-05-22 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus reopened this revision.
Szelethus added a comment.
This revision is now accepted and ready to land.

Reverted in rG429f03089951d62fb370026905c87f1f25cf220f 
 because 
its late and this is a breaking change to scan-build.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76510



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/test/Driver/aix-ld.cpp:18
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-ARG-ORDER: "-lc"

The main point of the test being that `-bnocdtors` from the user is not 
overriden by the implied `-bcdtors:all:0:s`, I think we should drop these last 
two lines and add a `CHECK-LD32-ARG-ORDER-NOT` against `-bcdtors:all:0:s`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[clang] 429f030 - Revert "[analyzer] Change the default output type to PD_TEXT_MINIMAL in the frontend, error if an output loc is missing for PathDiagConsumers that need it"

2020-05-22 Thread Kirstóf Umann via cfe-commits

Author: Kirstóf Umann
Date: 2020-05-22T20:18:16+02:00
New Revision: 429f03089951d62fb370026905c87f1f25cf220f

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

LOG: Revert "[analyzer] Change the default output type to PD_TEXT_MINIMAL in 
the frontend, error if an output loc is missing for PathDiagConsumers that need 
it"

This reverts commit fe1a3a7e8c8be33968b9a768666489823dabab10.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Removed: 
clang/test/Analysis/output_types.cpp



diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index fdca8532ab53..d010a7dfb2de 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -358,9 +358,6 @@ def err_analyzer_checker_option_invalid_input : Error<
   "invalid input for checker option '%0', that expects %1">;
 def err_analyzer_checker_incompatible_analyzer_option : Error<
   "checker cannot be enabled with analyzer option '%0' == %1">;
-def err_analyzer_missing_output_loc : Error<
-  "analyzer output type '%0' requires an output %1 to be specified with "
-  "-o ">;
 
 def err_drv_invalid_hvx_length : Error<
   "-mhvx-length is not supported without a -mhvx/-mhvx= flag">;

diff  --git a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h 
b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
index 373caa30bbc9..d2df24a6e21b 100644
--- a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -206,7 +206,7 @@ class AnalyzerOptions : public 
RefCountedBase {
   ConfigTable Config;
   AnalysisStores AnalysisStoreOpt = RegionStoreModel;
   AnalysisConstraints AnalysisConstraintsOpt = RangeConstraintsModel;
-  AnalysisDiagClients AnalysisDiagOpt = PD_TEXT_MINIMAL;
+  AnalysisDiagClients AnalysisDiagOpt = PD_HTML;
   AnalysisPurgeMode AnalysisPurgeOpt = PurgeStmt;
 
   std::string AnalyzeSpecificFunction;

diff  --git a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp 
b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
index 8ce3aa2e081e..184fdcfb3d4b 100644
--- a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -21,7 +21,6 @@
 #include "clang/Lex/Lexer.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/Token.h"
-#include "clang/Driver/DriverDiagnostic.h"
 #include "clang/Rewrite/Core/HTMLRewrite.h"
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
@@ -138,14 +137,18 @@ void ento::createHTMLDiagnosticConsumer(
 const std::string , const Preprocessor ,
 const cross_tu::CrossTranslationUnitContext ) {
 
-  if (OutputDir.empty()) {
-PP.getDiagnostics().Report(diag::err_analyzer_missing_output_loc)
-  << "html" << "directory";
+  // FIXME: HTML is currently our default output type, but if the output
+  // directory isn't specified, it acts like if it was in the minimal text
+  // output mode. This doesn't make much sense, we should have the minimal text
+  // as our default. In the case of backward compatibility concerns, this could
+  // be preserved with -analyzer-config-compatibility-mode=true.
+  createTextMinimalPathDiagnosticConsumer(AnalyzerOpts, C, OutputDir, PP, CTU);
+
+  // TODO: Emit an error here.
+  if (OutputDir.empty())
 return;
-  }
 
   C.push_back(new HTMLDiagnostics(AnalyzerOpts, OutputDir, PP, true));
-  createTextMinimalPathDiagnosticConsumer(AnalyzerOpts, C, OutputDir, PP, CTU);
 }
 
 void ento::createHTMLSingleFileDiagnosticConsumer(
@@ -153,11 +156,9 @@ void ento::createHTMLSingleFileDiagnosticConsumer(
 const std::string , const Preprocessor ,
 const cross_tu::CrossTranslationUnitContext ) {
 
-  if (OutputDir.empty()) {
-PP.getDiagnostics().Report(diag::err_analyzer_missing_output_loc)
-  << "html-single-file" << "directory";
+  // TODO: Emit an error here.
+  if (OutputDir.empty())
 return;
-  }
 
   C.push_back(new HTMLDiagnostics(AnalyzerOpts, OutputDir, PP, false));
   createTextMinimalPathDiagnosticConsumer(AnalyzerOpts, C, OutputDir, PP, CTU);
@@ -167,13 +168,6 @@ void ento::createPlistHTMLDiagnosticConsumer(
 AnalyzerOptions , PathDiagnosticConsumers ,
 const std::string , const Preprocessor ,
 const cross_tu::CrossTranslationUnitContext ) {
-
-  if (prefix.empty()) {
-

[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/test/Driver/aix-ld.cpp:9
+// CHECK-LD32-ARG-ORDER-NOT: warning:
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"

I am not sure I've seen this used in conjunction with `%clangxx`.
`"{{.*}}clang{{.*}}"` seems appropriate based on existing usage.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[PATCH] D76510: [analyzer] Change the default output type to PD_TEXT_MINIMAL in the frontend, error if an output loc is missing for PathDiagConsumers that need it

2020-05-22 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

This isn't so bad as far as news go, considering you saved a lot of work for me 
in terms of reproducing this! I'll look into it, thanks! I admit to not use 
`scan-build` much. :^)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76510



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


[PATCH] D79526: [CUDA][HIP] Workaround for resolving host device function against wrong-sided function

2020-05-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D79526#2042680 , @tra wrote:

> Reduced test case:
>
>   struct a {
> __attribute__((device)) a(short);
> __attribute__((device)) operator unsigned() const;
> __attribute__((device)) operator int() const;
>   };
>   struct b {
> a d;
>   };
>   void f(b g) { b e = g; }
>
>
> Failure:
>
>   $ bin/clang++ -x cuda aten.cc -fsyntax-only  
> --cuda-path=$HOME/local/cuda-10.1 --cuda-device-only --cuda-gpu-arch=sm_60 
> -stdlib=libc++ -std=c++17 -ferror-limit=1
>  
>   aten.cc:6:8: error: conversion from 'const a' to 'short' is ambiguous
>   struct b {
>  ^
>   aten.cc:9:21: note: in implicit copy constructor for 'b' first required here
>   void f(b g) { b e = g; }
>   ^
>   aten.cc:3:27: note: candidate function
> __attribute__((device)) operator unsigned() const;
> ^
>   aten.cc:4:27: note: candidate function
> __attribute__((device)) operator int() const;
> ^
>   aten.cc:2:34: note: passing argument to parameter here
> __attribute__((device)) a(short);
>^
>   1 error generated when compiling for sm_60.
>
>
> The same code compiles fine in C++ and I would expect it to work on device 
> side the same way.


a and b both have an implicit HD copy ctor. In device compilation, copy ctor of 
b is calling copy ctor of a. There are two candidates: implicit HD copy ctor of 
a, and device ctor a(short).

In my previous fix, I made H and implicit HD candidate equal, however I forgot 
about the relation between D candidate and HD candidate. I incorrectly made D 
favored over HD and H. This caused inferior device candidate a(short) chosen 
over copy ctor of a.

I have a fix for this https://reviews.llvm.org/D80450


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79526



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


[PATCH] D80450: [CUDA][HIP] Fix implicit HD function resolution

2020-05-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: tra.

When implicit HD function calls a function in device compilation,
if one candidate is an implicit HD function, current solution rule is:

D wins over HD and H
HD and H are equal

this caused regression when there is an otherwise worse D candidate

This patch changes that to

D, HD and H are all equal

The rationale is that we already know for host compilation there is already
a valid candidate in HD and H candidates that will not cause error. Allowing
HD and H gives us a fall back candidate that will not cause error. If D wins,
that means D has to be a better match otherwise, therefore D should also
be a valid candidate that will not cause error. In this way, we can guarantee
no regression.


https://reviews.llvm.org/D80450

Files:
  clang/lib/Sema/SemaOverload.cpp
  clang/test/SemaCUDA/function-overload.cu


Index: clang/test/SemaCUDA/function-overload.cu
===
--- clang/test/SemaCUDA/function-overload.cu
+++ clang/test/SemaCUDA/function-overload.cu
@@ -541,3 +541,51 @@
   }
 };
 }
+
+// Implicit HD candidate competes with device candidate.
+// a and b have implicit HD copy ctor. In copy ctor of b, ctor of a is 
resolved.
+// copy ctor of a should win over a(short), otherwise there will be ambiguity
+// due to conversion operator.
+namespace TestImplicitHDWithD {
+  struct a {
+__attribute__((device)) a(short);
+__attribute__((device)) operator unsigned() const;
+__attribute__((device)) operator int() const;
+  };
+  struct b {
+a d;
+  };
+  void f(b g) { b e = g; }
+}
+
+// Implicit HD candidate competes with host candidate.
+// a and b have implicit HD copy ctor. In copy ctor of b, ctor of a is 
resolved.
+// copy ctor of a should win over a(short), otherwise there will be ambiguity
+// due to conversion operator.
+namespace TestImplicitHDWithH {
+  struct a {
+a(short);
+__attribute__((device)) operator unsigned() const;
+__attribute__((device)) operator int() const;
+  };
+  struct b {
+a d;
+  };
+  void f(b g) { b e = g; }
+}
+
+// Implicit HD candidate comptes with HD candidate.
+// a and b have implicit HD copy ctor. In copy ctor of b, ctor of a is 
resolved.
+// copy ctor of a should win over a(short), otherwise there will be ambiguity
+// due to conversion operator.
+namespace TestImplicitHDWithHD {
+  struct a {
+__attribute__((host,device)) a(short);
+__attribute__((device)) operator unsigned() const;
+__attribute__((device)) operator int() const;
+  };
+  struct b {
+a d;
+  };
+  void f(b g) { b e = g; }
+}
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -9534,7 +9534,7 @@
   auto EmitThreshold =
   (S.getLangOpts().CUDAIsDevice && IsCallerImplicitHD &&
(IsCand1ImplicitHD || IsCand2ImplicitHD))
-  ? Sema::CFP_HostDevice
+  ? Sema::CFP_Never
   : Sema::CFP_WrongSide;
   auto Cand1Emittable = P1 > EmitThreshold;
   auto Cand2Emittable = P2 > EmitThreshold;


Index: clang/test/SemaCUDA/function-overload.cu
===
--- clang/test/SemaCUDA/function-overload.cu
+++ clang/test/SemaCUDA/function-overload.cu
@@ -541,3 +541,51 @@
   }
 };
 }
+
+// Implicit HD candidate competes with device candidate.
+// a and b have implicit HD copy ctor. In copy ctor of b, ctor of a is resolved.
+// copy ctor of a should win over a(short), otherwise there will be ambiguity
+// due to conversion operator.
+namespace TestImplicitHDWithD {
+  struct a {
+__attribute__((device)) a(short);
+__attribute__((device)) operator unsigned() const;
+__attribute__((device)) operator int() const;
+  };
+  struct b {
+a d;
+  };
+  void f(b g) { b e = g; }
+}
+
+// Implicit HD candidate competes with host candidate.
+// a and b have implicit HD copy ctor. In copy ctor of b, ctor of a is resolved.
+// copy ctor of a should win over a(short), otherwise there will be ambiguity
+// due to conversion operator.
+namespace TestImplicitHDWithH {
+  struct a {
+a(short);
+__attribute__((device)) operator unsigned() const;
+__attribute__((device)) operator int() const;
+  };
+  struct b {
+a d;
+  };
+  void f(b g) { b e = g; }
+}
+
+// Implicit HD candidate comptes with HD candidate.
+// a and b have implicit HD copy ctor. In copy ctor of b, ctor of a is resolved.
+// copy ctor of a should win over a(short), otherwise there will be ambiguity
+// due to conversion operator.
+namespace TestImplicitHDWithHD {
+  struct a {
+__attribute__((host,device)) a(short);
+__attribute__((device)) operator unsigned() const;
+__attribute__((device)) operator int() const;
+  };
+  struct b {
+a d;
+  };
+  void f(b g) { b e = g; }
+}
Index: clang/lib/Sema/SemaOverload.cpp

[PATCH] D80126: Add documentation URL records to the .dia format and expose them via libclang

2020-05-22 Thread Jan Korous via Phabricator via cfe-commits
jkorous added inline comments.



Comment at: clang/lib/Frontend/SerializedDiagnosticReader.cpp:323
+  // A documentation URL has an ID and path size.
+  if (Record.size() != 2)
+return SDError::MalformedDiagnosticRecord;

owenv wrote:
> owenv wrote:
> > jkorous wrote:
> > > I am just wondering what happens with the ID. Shouldn't we pass it too?
> > I think the ID should be `Record[0]` in the call t 
> > visitDocumentationURLRecord below. I based this on the handling of category 
> > records.
> Sorry, I don't know how to reply without marking this as done
Got it!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80126



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


[PATCH] D71739: [AssumeBundles] Use operand bundles to encode alignment assumptions

2020-05-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

> there is any IR legality restriction about what combination or number of 
> bundles can be present in an assume. however there is restrictions about 
> argument of a given bundle.
>  having a single "align" bundle is just how the front-end used assume bundles 
> for its alignment assumptions.

Hmm.  It does seem to be true that operand bundles don't inherently enforce 
that the names are unique on a callsite; the verifier just has an ever-growing 
list of bundles that it does that for specially.  That feels weird to me, but 
alright.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71739



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 265765.
stevewan added a comment.

Address comments and fix windows compatibility issues with the test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.cpp


Index: clang/test/Driver/aix-ld.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-ld.cpp
@@ -0,0 +1,19 @@
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER-NOT: warning:
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-ARG-ORDER: "-lc"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList 
,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 


Index: clang/test/Driver/aix-ld.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-ld.cpp
@@ -0,0 +1,19 @@
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER-NOT: warning:
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-ARG-ORDER: "-lc"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList ,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79710: [clang][BFloat] add create/set/get/dup intrinsics

2020-05-22 Thread Ties Stuij via Phabricator via cfe-commits
stuij updated this revision to Diff 265764.
stuij added a comment.

moving 'CartesianProductWith' to more apt patch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79710

Files:
  clang/include/clang/Basic/arm_neon.td
  clang/include/clang/Basic/arm_neon_incl.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aarch64-bf16-getset-intrinsics.c

Index: clang/test/CodeGen/aarch64-bf16-getset-intrinsics.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-bf16-getset-intrinsics.c
@@ -0,0 +1,120 @@
+// RUN: %clang_cc1 -triple aarch64-arm-none-eabi -target-feature +neon -target-feature +bf16 \
+// RUN:  -O2 -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK64
+// RUN: %clang_cc1 -triple armv8.6a-arm-none-eabi -target-feature +neon -target-feature +bf16 -mfloat-abi hard \
+// RUN:  -O2 -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK32
+
+#include 
+
+bfloat16x4_t test_vcreate_bf16(uint64_t a) {
+  return vcreate_bf16(a);
+}
+// CHECK-LABEL: test_vcreate_bf16
+// CHECK64: %0 = bitcast i64 %a to <4 x bfloat>
+// CHECK32: %0 = bitcast i64 %a to <4 x bfloat>
+
+bfloat16x4_t test_vdup_n_bf16(bfloat16_t v) {
+  return vdup_n_bf16(v);
+}
+// CHECK-LABEL: test_vdup_n_bf16
+// CHECK64: %vecinit.i = insertelement <4 x bfloat> undef, bfloat %v, i32 0
+// CHECK32: %vecinit.i = insertelement <4 x bfloat> undef, bfloat %v, i32 0
+// CHECK: %vecinit{{.*}} = shufflevector <4 x bfloat> %vecinit.i, <4 x bfloat> undef, <4 x i32> zeroinitializer
+
+bfloat16x8_t test_vdupq_n_bf16(bfloat16_t v) {
+  return vdupq_n_bf16(v);
+}
+// CHECK-LABEL: test_vdupq_n_bf16
+// CHECK64: %vecinit.i = insertelement <8 x bfloat> undef, bfloat %v, i32 0
+// CHECK32: %vecinit.i = insertelement <8 x bfloat> undef, bfloat %v, i32 0
+// CHECK:   %vecinit{{.*}} = shufflevector <8 x bfloat> %vecinit.i, <8 x bfloat> undef, <8 x i32> zeroinitializer
+
+bfloat16x4_t test_vdup_lane_bf16(bfloat16x4_t v) {
+  return vdup_lane_bf16(v, 1);
+}
+// CHECK-LABEL: test_vdup_lane_bf16
+// CHECK64: %lane = shufflevector <4 x bfloat> %v, <4 x bfloat> undef, <4 x i32> 
+// CHECK32: %lane = shufflevector <4 x bfloat> %v, <4 x bfloat> undef, <4 x i32> 
+
+bfloat16x8_t test_vdupq_lane_bf16(bfloat16x4_t v) {
+  return vdupq_lane_bf16(v, 1);
+}
+// CHECK-LABEL: test_vdupq_lane_bf16
+// CHECK64: %lane = shufflevector <4 x bfloat> %v, <4 x bfloat> undef, <8 x i32> 
+// CHECK32: %lane = shufflevector <4 x bfloat> %v, <4 x bfloat> undef, <8 x i32> 
+
+bfloat16x4_t test_vdup_laneq_bf16(bfloat16x8_t v) {
+  return vdup_laneq_bf16(v, 7);
+}
+// CHECK-LABEL: test_vdup_laneq_bf16
+// CHECK64: %lane = shufflevector <8 x bfloat> %v, <8 x bfloat> undef, <4 x i32> 
+// CHECK32: %lane = shufflevector <8 x bfloat> %v, <8 x bfloat> undef, <4 x i32> 
+
+bfloat16x8_t test_vdupq_laneq_bf16(bfloat16x8_t v) {
+  return vdupq_laneq_bf16(v, 7);
+}
+// CHECK-LABEL: test_vdupq_laneq_bf16
+// CHECK64: %lane = shufflevector <8 x bfloat> %v, <8 x bfloat> undef, <8 x i32> 
+// CHECK32: %lane = shufflevector <8 x bfloat> %v, <8 x bfloat> undef, <8 x i32> 
+
+bfloat16x8_t test_vcombine_bf16(bfloat16x4_t low, bfloat16x4_t high) {
+  return vcombine_bf16(low, high);
+}
+// CHECK-LABEL: test_vcombine_bf16
+// CHECK64: %shuffle.i = shufflevector <4 x bfloat> %low, <4 x bfloat> %high, <8 x i32> 
+// CHECK32: %shuffle.i = shufflevector <4 x bfloat> %low, <4 x bfloat> %high, <8 x i32> 
+
+bfloat16x4_t test_vget_high_bf16(bfloat16x8_t a) {
+  return vget_high_bf16(a);
+}
+// CHECK-LABEL: test_vget_high_bf16
+// CHECK64: %shuffle.i = shufflevector <8 x bfloat> %a, <8 x bfloat> undef, <4 x i32> 
+// CHECK32: %shuffle.i = shufflevector <8 x bfloat> %a, <8 x bfloat> undef, <4 x i32> 
+
+bfloat16x4_t test_vget_low_bf16(bfloat16x8_t a) {
+  return vget_low_bf16(a);
+}
+// CHECK-LABEL: test_vget_low_bf16
+// CHECK64: %shuffle.i = shufflevector <8 x bfloat> %a, <8 x bfloat> undef, <4 x i32> 
+// CHECK32: %shuffle.i = shufflevector <8 x bfloat> %a, <8 x bfloat> undef, <4 x i32> 
+
+bfloat16_t test_vget_lane_bf16(bfloat16x4_t v) {
+  return vget_lane_bf16(v, 1);
+}
+// CHECK-LABEL: test_vget_lane_bf16
+// CHECK64: %vget_lane = extractelement <4 x bfloat> %v, i32 1
+// CHECK32: %vget_lane = extractelement <4 x bfloat> %v, i32 1
+
+bfloat16_t test_vgetq_lane_bf16(bfloat16x8_t v) {
+  return vgetq_lane_bf16(v, 7);
+}
+// CHECK-LABEL: test_vgetq_lane_bf16
+// CHECK64: %vgetq_lane = extractelement <8 x bfloat> %v, i32 7
+// CHECK32: %vget_lane = extractelement <8 x bfloat> %v, i32 7
+
+bfloat16x4_t test_vset_lane_bf16(bfloat16_t a, bfloat16x4_t v) {
+  return vset_lane_bf16(a, v, 1);
+}
+// CHECK-LABEL: test_vset_lane_bf16
+// CHECK64: %vset_lane = insertelement <4 x bfloat> %v, bfloat %a, i32 1
+// CHECK32: %vset_lane = insertelement <4 x bfloat> %v, bfloat %a, i32 1
+
+bfloat16x8_t test_vsetq_lane_bf16(bfloat16_t a, bfloat16x8_t v) {
+  return 

[PATCH] D76510: [analyzer] Change the default output type to PD_TEXT_MINIMAL in the frontend, error if an output loc is missing for PathDiagConsumers that need it

2020-05-22 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment.

Hi @Szelethus , it looks like I am a bearer of bad news again :(
This patch seems to crash `scan-build` on pretty much every project that I 
tested.

One way to reproduce:

  git clone https://github.com/postgres/postgres.git
  cd postgres/
  scan-build -plist-html -o ./out ./configure 

Output:

  scan-build: Using 
'/Users/vsavchenko/source/llvm-project/build/Release/bin/clang-11' for static 
analysis
  checking build system type... x86_64-apple-darwin19.4.0
  checking host system type... x86_64-apple-darwin19.4.0
  checking which template to use... darwin
  checking whether NLS is wanted... no
  checking for default port number... 5432
  checking for block size... 8kB
  checking for segment size... 1GB
  checking for WAL block size... 8kB
  checking whether the C compiler works... no
  configure: error: in `/Users/vsavchenko/source/postgres':
  configure: error: C compiler cannot create executables
  See `config.log' for more details
  scan-build: Analysis run complete.
  scan-build: Analysis results (plist files) deposited in 
'/Users/vsavchenko/source/postgres/out/2020-05-22-194935-27687-1'
  scan-build: Removing directory 
'/Users/vsavchenko/source/postgres/out/2020-05-22-194935-27687-1' because it 
contains no reports.
  scan-build: No bugs found.

config.log will contain something similar to this:

  configure:3987: checking whether the C compiler works
  configure:4009: 
/Users/vsavchenko/source/llvm-project/build/Release/bin/../libexec/ccc-analyzer 
   conftest.c  >&5
  error: analyzer output type 'html' requires an output directory to be 
specified with -o 
  1 error generated.
  Use of uninitialized value $HtmlDir in concatenation (.) or string at 
/Users/vsavchenko/source/llvm-project/build/Release/bin/../libexec/ccc-analyzer 
line 149, <$fh> line 2.
  mkdir /failures: Read-only file system at 
/Users/vsavchenko/source/llvm-project/build/Release/bin/../libexec/ccc-analyzer 
line 150.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76510



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


[PATCH] D76083: [clang-tidy] Expand the list of functions in bugprone-unused-return-value

2020-05-22 Thread Joe Ranieri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe4bb3e25e440: [clang-tidy] Expand the list of functions in 
bugprone-unused-return-value (authored by jranieri-grammatech).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76083

Files:
  clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp


Index: clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
===
--- clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
+++ clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
@@ -43,7 +43,90 @@
"::std::unique;"
"::std::unique_ptr::release;"
"::std::basic_string::empty;"
-   "::std::vector::empty")) {}
+   "::std::vector::empty;"
+   "::std::back_inserter;"
+   "::std::distance;"
+   "::std::find;"
+   "::std::find_if;"
+   "::std::inserter;"
+   "::std::lower_bound;"
+   "::std::make_pair;"
+   "::std::map::count;"
+   "::std::map::find;"
+   "::std::map::lower_bound;"
+   "::std::multimap::equal_range;"
+   "::std::multimap::upper_bound;"
+   "::std::set::count;"
+   "::std::set::find;"
+   "::std::setfill;"
+   "::std::setprecision;"
+   "::std::setw;"
+   "::std::upper_bound;"
+   "::std::vector::at;"
+   // C standard library
+   "::bsearch;"
+   "::ferror;"
+   "::feof;"
+   "::isalnum;"
+   "::isalpha;"
+   "::isblank;"
+   "::iscntrl;"
+   "::isdigit;"
+   "::isgraph;"
+   "::islower;"
+   "::isprint;"
+   "::ispunct;"
+   "::isspace;"
+   "::isupper;"
+   "::iswalnum;"
+   "::iswprint;"
+   "::iswspace;"
+   "::isxdigit;"
+   "::memchr;"
+   "::memcmp;"
+   "::strcmp;"
+   "::strcoll;"
+   "::strncmp;"
+   "::strpbrk;"
+   "::strrchr;"
+   "::strspn;"
+   "::strstr;"
+   "::wcscmp;"
+   // POSIX
+   "::access;"
+   "::bind;"
+   "::connect;"
+   "::difftime;"
+   "::dlsym;"
+   "::fnmatch;"
+   "::getaddrinfo;"
+   "::getopt;"
+   "::htonl;"
+   "::htons;"
+   "::iconv_open;"
+   "::inet_addr;"
+   "::isascii;"
+   "::isatty;"
+   "::mmap;"
+   "::newlocale;"
+   "::openat;"
+   "::pathconf;"
+   "::pthread_equal;"
+   "::pthread_getspecific;"
+   "::pthread_mutex_trylock;"
+   "::readdir;"
+   "::readlink;"
+   "::recvmsg;"
+   "::regexec;"
+   "::scandir;"
+   "::semget;"
+   

[PATCH] D80369: [DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'

2020-05-22 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D80369#2050962 , @djtodoro wrote:

> In D80369#2050022 , @dblaikie wrote:
>
> > In D80369#2048932 , @djtodoro 
> > wrote:
> >
> > > Still have test failing:
> > >
> > >   Clang :: Modules/DebugInfoTransitiveImport.m
> > >   Clang :: Modules/ModuleDebugInfo.cpp
> > >   Clang :: Modules/ModuleDebugInfo.m
> > >   
> > >
> > > I haven't looked into the failures, but I guess something Objective-C++ 
> > > related should be handled with some additional work here.
> >
> >
> > These look like over-constrained/accidental tests. At least the 
> > ModuleDEbugInfo.m test - the type being tested for won't be emitted, 
> > because the type itself isn't in the retained types list nor is it 
> > reachable from any other metadata that is going to be emitted.
> >
> > I think it'd probably be good to clean these tests up - and leave it to 
> > @aprantl to look into if this has exposed other bugs - but the bugs are 
> > already there, and this IR/debug info metadata isn't working around the 
> > bugs, since the IR is going unused anyway.
>
>
> Looks like ObjC expects the declarations within retained types  (based on 
> some tests failures), so I left it as is (I think @aprantl can help us with 
> that).
>  Therefore, this patch will remove the declarations only in the case of call 
> site debug info for now.


Yeah, that's what I was trying to say - I think the tests expect that, but I 
don't see any code path that uses that debug info metadata - I think the test 
is overconstrained/accidentally testing for this behavior.

I think the right thing to do is to change these tests to test the new behavior 
(the behavior of the first version of this patch) - and if some use 
arises/someone can demonstrate a codepath that's using this data, it can be 
added back in.

@aprantl can you check here? I've attached two IR files for the 
ModuleDebugInfo.m test, before/after ('x' is before), stripped of the metadata 
numbers to make diffing easier - but I think you can still follow what's 
connected to what with reasonable guesswork. The point is these two function 
declarations end up in the retainedTypes list, and since the function 
declarations are emitted, so are the types used in their parameters, etc - but 
those types aren't reachable from anywhere else in the debug info metadata, so 
they won't be emitted into the final object file so far as I can see (because 
nothing looks at the function declarations in retainedTypes - only types).

F11980002: x.ll 

F11980001: y.ll 


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

https://reviews.llvm.org/D80369



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


[clang-tools-extra] e4bb3e2 - [clang-tidy] Expand the list of functions in bugprone-unused-return-value

2020-05-22 Thread Joe Ranieri via cfe-commits

Author: Joe Ranieri
Date: 2020-05-22T12:57:58-04:00
New Revision: e4bb3e25e4400151133fd3737f4842f2aeda1c1b

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

LOG: [clang-tidy] Expand the list of functions in bugprone-unused-return-value

This change adds common C, C++, and POSIX functions to the clang-tidy unused 
return value checker.

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

Added: 


Modified: 
clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
index c3efb08d4213..d49fd63f005d 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
@@ -43,7 +43,90 @@ 
UnusedReturnValueCheck::UnusedReturnValueCheck(llvm::StringRef Name,
"::std::unique;"
"::std::unique_ptr::release;"
"::std::basic_string::empty;"
-   "::std::vector::empty")) {}
+   "::std::vector::empty;"
+   "::std::back_inserter;"
+   "::std::distance;"
+   "::std::find;"
+   "::std::find_if;"
+   "::std::inserter;"
+   "::std::lower_bound;"
+   "::std::make_pair;"
+   "::std::map::count;"
+   "::std::map::find;"
+   "::std::map::lower_bound;"
+   "::std::multimap::equal_range;"
+   "::std::multimap::upper_bound;"
+   "::std::set::count;"
+   "::std::set::find;"
+   "::std::setfill;"
+   "::std::setprecision;"
+   "::std::setw;"
+   "::std::upper_bound;"
+   "::std::vector::at;"
+   // C standard library
+   "::bsearch;"
+   "::ferror;"
+   "::feof;"
+   "::isalnum;"
+   "::isalpha;"
+   "::isblank;"
+   "::iscntrl;"
+   "::isdigit;"
+   "::isgraph;"
+   "::islower;"
+   "::isprint;"
+   "::ispunct;"
+   "::isspace;"
+   "::isupper;"
+   "::iswalnum;"
+   "::iswprint;"
+   "::iswspace;"
+   "::isxdigit;"
+   "::memchr;"
+   "::memcmp;"
+   "::strcmp;"
+   "::strcoll;"
+   "::strncmp;"
+   "::strpbrk;"
+   "::strrchr;"
+   "::strspn;"
+   "::strstr;"
+   "::wcscmp;"
+   // POSIX
+   "::access;"
+   "::bind;"
+   "::connect;"
+   "::
diff time;"
+   "::dlsym;"
+   "::fnmatch;"
+   "::getaddrinfo;"
+   "::getopt;"
+   "::htonl;"
+   "::htons;"
+   "::iconv_open;"
+   "::inet_addr;"
+   "::isascii;"
+   "::isatty;"
+   "::mmap;"
+   "::newlocale;"
+   "::openat;"
+   "::pathconf;"
+   "::pthread_equal;"
+   

[PATCH] D80443: [analyzer] SATestBuild.py: Fix hang when one of the tasks fails

2020-05-22 Thread Valeriy Savchenko via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa5b2503a8ab4: [analyzer] SATestBuild.py: Fix hang when one 
of the tasks fails (authored by vsavchenko).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80443

Files:
  clang/utils/analyzer/SATestBuild.py


Index: clang/utils/analyzer/SATestBuild.py
===
--- clang/utils/analyzer/SATestBuild.py
+++ clang/utils/analyzer/SATestBuild.py
@@ -633,7 +633,7 @@
 
 self.tasks_queue.task_done()
 
-except CalledProcessError:
+except BaseException:
 self.failure_flag.set()
 raise
 


Index: clang/utils/analyzer/SATestBuild.py
===
--- clang/utils/analyzer/SATestBuild.py
+++ clang/utils/analyzer/SATestBuild.py
@@ -633,7 +633,7 @@
 
 self.tasks_queue.task_done()
 
-except CalledProcessError:
+except BaseException:
 self.failure_flag.set()
 raise
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80443: [analyzer] SATestBuild.py: Fix hang when one of the tasks fails

2020-05-22 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Not unreasonable!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80443



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


[clang] a5b2503 - [analyzer] SATestBuild.py: Fix hang when one of the tasks fails

2020-05-22 Thread Valeriy Savchenko via cfe-commits

Author: Valeriy Savchenko
Date: 2020-05-22T19:15:00+03:00
New Revision: a5b2503a8ab4fb21345fa9e2316530cdfaec1a60

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

LOG: [analyzer] SATestBuild.py: Fix hang when one of the tasks fails

Summary:
Tasks can crash with many different exceptions including SystemExit.
Bare except still causes a warning, so let's use BaseException instead.

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

Added: 


Modified: 
clang/utils/analyzer/SATestBuild.py

Removed: 




diff  --git a/clang/utils/analyzer/SATestBuild.py 
b/clang/utils/analyzer/SATestBuild.py
index 39fa7ece4362..e2fe6a95138b 100755
--- a/clang/utils/analyzer/SATestBuild.py
+++ b/clang/utils/analyzer/SATestBuild.py
@@ -633,7 +633,7 @@ def run(self):
 
 self.tasks_queue.task_done()
 
-except CalledProcessError:
+except BaseException:
 self.failure_flag.set()
 raise
 



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


[PATCH] D76077: [ARM] Add __bf16 as new Bfloat16 C Type

2020-05-22 Thread Ties Stuij via Phabricator via cfe-commits
stuij updated this revision to Diff 265753.
stuij marked an inline comment as done.
stuij added a comment.

no explicit float-abi cmdline arg should default to softfp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76077

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang-c/Index.h
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/BuiltinTypes.def
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/Specifiers.h
  clang/include/clang/Basic/TargetBuiltins.h
  clang/include/clang/Basic/TargetInfo.h
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Sema/DeclSpec.h
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/AST/MicrosoftMangle.cpp
  clang/lib/AST/NSAPI.cpp
  clang/lib/AST/PrintfFormatString.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypeLoc.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AArch64.h
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/Basic/Targets/ARM.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenTypeCache.h
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Format/FormatToken.cpp
  clang/lib/Index/USRGeneration.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Parse/ParseTentative.cpp
  clang/lib/Sema/DeclSpec.cpp
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Serialization/ASTCommon.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/test/CodeGen/arm-bf16-params-returns.c
  clang/test/CodeGen/arm-mangle-16bit-float.cpp
  clang/test/Sema/arm-bf16-forbidden-ops.c
  clang/test/Sema/arm-bf16-forbidden-ops.cpp
  clang/test/Sema/arm-bfloat.cpp
  clang/tools/libclang/CXType.cpp

Index: clang/tools/libclang/CXType.cpp
===
--- clang/tools/libclang/CXType.cpp
+++ clang/tools/libclang/CXType.cpp
@@ -608,6 +608,7 @@
 TKIND(Elaborated);
 TKIND(Pipe);
 TKIND(Attributed);
+TKIND(BFloat16);
 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) TKIND(Id);
 #include "clang/Basic/OpenCLImageTypes.def"
 #undef IMAGE_TYPE
Index: clang/test/Sema/arm-bfloat.cpp
===
--- /dev/null
+++ clang/test/Sema/arm-bfloat.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 \
+// RUN: -triple aarch64-arm-none-eabi -target-cpu cortex-a75 \
+// RUN: -target-feature +bf16 -target-feature +neon %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 \
+// RUN: -triple arm-arm-none-eabi -target-cpu cortex-a53 \
+// RUN: -target-feature +bf16 -target-feature +neon %s
+
+void test(bool b) {
+  __bf16 bf16;
+
+  bf16 + bf16; // expected-error {{invalid operands to binary expression ('__bf16' and '__bf16')}}
+  bf16 - bf16; // expected-error {{invalid operands to binary expression ('__bf16' and '__bf16')}}
+  bf16 * bf16; // expected-error {{invalid operands to binary expression ('__bf16' and '__bf16')}}
+  bf16 / bf16; // expected-error {{invalid operands to binary expression ('__bf16' and '__bf16')}}
+
+  __fp16 fp16;
+
+  bf16 + fp16; // expected-error {{invalid operands to binary expression ('__bf16' and '__fp16')}}
+  fp16 + bf16; // expected-error {{invalid operands to binary expression ('__fp16' and '__bf16')}}
+  bf16 - fp16; // expected-error {{invalid operands to binary expression ('__bf16' and '__fp16')}}
+  fp16 - bf16; // expected-error {{invalid operands to binary expression ('__fp16' and '__bf16')}}
+  bf16 * fp16; // expected-error {{invalid operands to binary expression ('__bf16' and '__fp16')}}
+  fp16 * bf16; // expected-error {{invalid operands to binary expression ('__fp16' and '__bf16')}}
+  bf16 / fp16; // expected-error {{invalid operands to binary expression ('__bf16' and '__fp16')}}
+  fp16 / bf16; // expected-error {{invalid operands to binary expression ('__fp16' and '__bf16')}}
+  bf16 = fp16; // expected-error {{assigning to '__bf16' from incompatible type '__fp16'}}
+  fp16 = bf16; // expected-error {{assigning to '__fp16' from incompatible type '__bf16'}}
+  bf16 + (b ? fp16 : bf16); // expected-error {{incompatible operand types ('__fp16' and '__bf16')}}
+}
Index: clang/test/Sema/arm-bf16-forbidden-ops.cpp
===
--- /dev/null
+++ clang/test/Sema/arm-bf16-forbidden-ops.cpp
@@ -0,0 +1,71 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -triple aarch64 

[PATCH] D80222: Replace Clang's createRuntimeFunction with the definitions in OMPKinds.def

2020-05-22 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim added inline comments.



Comment at: llvm/include/llvm/Frontend/OpenMP/OMPKinds.def:244
 
-// TODO: Replace this with the real size_t type
-#define __OMP_SIZE_TYPE(NAME) OMP_TYPE(NAME, Type::getInt64Ty(Ctx))
+#define __OMP_SIZE_TYPE(NAME) OMP_TYPE(NAME, 
M.getDataLayout().getIntPtrType(Ctx))
 __OMP_SIZE_TYPE(SizeTy)

jhuber6 wrote:
> fghanim wrote:
> > jdoerfert wrote:
> > > jhuber6 wrote:
> > > > I'm just directly getting the SizeTy from the Module, I'm not sure if 
> > > > this is a permanent solution.
> > > I actually think this is fine. Less burden on the frontends also. 
> > > @fghanim looks good?
> > Agreed. But to avoid conflict with patch D79675, let this change go in a 
> > separate patch after that. This way, we can also do some clean ups related 
> > to this, and add `Int8PtrPtr`, `Int8PtrPtrPtr`, and any other typing 
> > issues, without delaying patch D79675 any further - I am done with that 
> > patch, and made my final changes a couple of days ago.
> > 
> > Nit: Also, I saw below that some formatting was done. Wouldn't it be better 
> > if formatting/comments related to changes in D79739, are handled as part of 
> > that patch?
> Doesn't this patch already support Int8PtrPtrPtr? It's the same thing as a 
> VoidPtrPtrPtr which I have defined above here.
You are correct. But think of it in the same way we have voidptr and int8ptr, 
even though they are the same.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80222



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


[PATCH] D80443: [analyzer] SATestBuild.py: Fix hang when one of the tasks fails

2020-05-22 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko created this revision.
vsavchenko added a reviewer: NoQ.
Herald added subscribers: cfe-commits, ASDenysPetrov, Charusso, dkrupp, 
donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, 
xazax.hun.
Herald added a project: clang.

Tasks can crash with many different exceptions including SystemExit.
Bare except still causes a warning, so let's use BaseException instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80443

Files:
  clang/utils/analyzer/SATestBuild.py


Index: clang/utils/analyzer/SATestBuild.py
===
--- clang/utils/analyzer/SATestBuild.py
+++ clang/utils/analyzer/SATestBuild.py
@@ -633,7 +633,7 @@
 
 self.tasks_queue.task_done()
 
-except CalledProcessError:
+except BaseException:
 self.failure_flag.set()
 raise
 


Index: clang/utils/analyzer/SATestBuild.py
===
--- clang/utils/analyzer/SATestBuild.py
+++ clang/utils/analyzer/SATestBuild.py
@@ -633,7 +633,7 @@
 
 self.tasks_queue.task_done()
 
-except CalledProcessError:
+except BaseException:
 self.failure_flag.set()
 raise
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80412: Summary: [Lexer] Fix invalid suffix diagnostic for fixed-point literals

2020-05-22 Thread Arthi via Phabricator via cfe-commits
nagart updated this revision to Diff 265748.
nagart added a comment.

fixing lint issues


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80412

Files:
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Lex/LiteralSupport.h
  clang/lib/Lex/LiteralSupport.cpp
  clang/test/Frontend/fixed_point_errors.c


Index: clang/test/Frontend/fixed_point_errors.c
===
--- clang/test/Frontend/fixed_point_errors.c
+++ clang/test/Frontend/fixed_point_errors.c
@@ -137,15 +137,15 @@
 _Sat longaccum_t td_sat_long_accum; // expected-error{{'_Sat' 
specifier is only valid on '_Fract' or '_Accum', not 'type-name'}}
 
 /* Bad suffixes  */
-_Accum fk = 1.0fk;// expected-error{{invalid suffix 'fk' on integer 
constant}}
-_Accum kk = 1.0kk;// expected-error{{invalid suffix 'kk' on integer 
constant}}
-_Accum rk = 1.0rk;// expected-error{{invalid suffix 'rk' on integer 
constant}}
-_Accum rk = 1.0rr;// expected-error{{invalid suffix 'rr' on integer 
constant}}
-_Accum qk = 1.0qr;// expected-error{{invalid suffix 'qr' on integer 
constant}}
+_Accum fk = 1.0fk; // expected-error{{invalid suffix 'fk' on fixed-point 
constant}}
+_Accum kk = 1.0kk; // expected-error{{invalid suffix 'kk' on fixed-point 
constant}}
+_Accum rk = 1.0rk; // expected-error{{invalid suffix 'rk' on fixed-point 
constant}}
+_Accum rk = 1.0rr; // expected-error{{invalid suffix 'rr' on fixed-point 
constant}}
+_Accum qk = 1.0qr; // expected-error{{invalid suffix 'qr' on fixed-point 
constant}}
 
 /* Using wrong exponent notation */
-_Accum dec_with_hex_exp1 = 0.1p10k;// expected-error{{invalid suffix 
'p10k' on integer constant}}
-_Accum dec_with_hex_exp2 = 0.1P10k;// expected-error{{invalid suffix 
'P10k' on integer constant}}
+_Accum dec_with_hex_exp1 = 0.1p10k;// expected-error{{invalid suffix 
'p10k' on fixed-point constant}}
+_Accum dec_with_hex_exp2 = 0.1P10k;// expected-error{{invalid suffix 
'P10k' on fixed-point constant}}
 _Accum hex_with_dex_exp1 = 0x0.1e10k;  // expected-error{{hexadecimal floating 
constant requires an exponent}}
 _Accum hex_with_dex_exp2 = 0x0.1E10k;  // expected-error{{hexadecimal floating 
constant requires an exponent}}
 
Index: clang/lib/Lex/LiteralSupport.cpp
===
--- clang/lib/Lex/LiteralSupport.cpp
+++ clang/lib/Lex/LiteralSupport.cpp
@@ -583,6 +583,7 @@
 
   // Parse the suffix.  At this point we can classify whether we have an FP or
   // integer constant.
+  bool isFixedPointConstant = isFixedPointLiteral();
   bool isFPConstant = isFloatingLiteral();
 
   // Loop over all of the characters of the suffix.  If we see something bad,
@@ -737,7 +738,8 @@
   // Report an error if there are any.
   PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, SuffixBegin - ThisTokBegin),
   diag::err_invalid_suffix_constant)
-  << StringRef(SuffixBegin, ThisTokEnd - SuffixBegin) << isFPConstant;
+  << StringRef(SuffixBegin, ThisTokEnd - SuffixBegin)
+  << (isFixedPointConstant ? 2 : isFPConstant);
   hadError = true;
 }
   }
Index: clang/include/clang/Lex/LiteralSupport.h
===
--- clang/include/clang/Lex/LiteralSupport.h
+++ clang/include/clang/Lex/LiteralSupport.h
@@ -71,7 +71,9 @@
   bool isFract : 1; // 1.0hr/r/lr/uhr/ur/ulr
   bool isAccum : 1; // 1.0hk/k/lk/uhk/uk/ulk
 
-  bool isFixedPointLiteral() const { return saw_fixed_point_suffix; }
+  bool isFixedPointLiteral() const {
+return (saw_period || saw_exponent) && saw_fixed_point_suffix;
+  }
 
   bool isIntegerLiteral() const {
 return !saw_period && !saw_exponent && !isFixedPointLiteral();
Index: clang/include/clang/Basic/DiagnosticLexKinds.td
===
--- clang/include/clang/Basic/DiagnosticLexKinds.td
+++ clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -175,7 +175,7 @@
 def err_invalid_digit : Error<
   "invalid digit '%0' in %select{decimal|octal|binary}1 constant">;
 def err_invalid_suffix_constant : Error<
-  "invalid suffix '%0' on %select{integer|floating}1 constant">;
+  "invalid suffix '%0' on %select{integer|floating|fixed-point}1 constant">;
 def warn_cxx11_compat_digit_separator : Warning<
   "digit separators are incompatible with C++ standards before C++14">,
   InGroup, DefaultIgnore;


Index: clang/test/Frontend/fixed_point_errors.c
===
--- clang/test/Frontend/fixed_point_errors.c
+++ clang/test/Frontend/fixed_point_errors.c
@@ -137,15 +137,15 @@
 _Sat longaccum_t td_sat_long_accum; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}}
 
 /* Bad suffixes  */
-_Accum fk = 1.0fk;// 

[PATCH] D76791: [Matrix] Implement matrix index expressions ([][]).

2020-05-22 Thread Florian Hahn via Phabricator via cfe-commits
fhahn updated this revision to Diff 265750.
fhahn added a comment.

Add clarifying comment to ActOnMatrixSubscriptExpr calls in 
ActOnArraySubscriptExpr.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76791

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/BuiltinTypes.def
  clang/include/clang/AST/ComputeDependence.h
  clang/include/clang/AST/Expr.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/Stmt.h
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/Specifiers.h
  clang/include/clang/Basic/StmtNodes.td
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ComputeDependence.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/AST/ExprClassification.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/AST/NSAPI.cpp
  clang/lib/AST/StmtPrinter.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypeLoc.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CGValue.h
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaExceptionSpec.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTCommon.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/test/CodeGen/matrix-type-operators.c
  clang/test/CodeGenCXX/matrix-type-operators.cpp
  clang/test/Sema/matrix-type-operators.c
  clang/test/SemaCXX/matrix-type-operators.cpp
  clang/tools/libclang/CXCursor.cpp
  llvm/include/llvm/IR/MatrixBuilder.h

Index: llvm/include/llvm/IR/MatrixBuilder.h
===
--- llvm/include/llvm/IR/MatrixBuilder.h
+++ llvm/include/llvm/IR/MatrixBuilder.h
@@ -155,15 +155,19 @@
 return B.CreateMul(LHS, ScalarVector);
   }
 
-  /// Extracts the element at (\p Row, \p Column) from \p Matrix.
-  Value *CreateExtractMatrix(Value *Matrix, Value *Row, Value *Column,
- unsigned NumRows, Twine const  = "") {
-
+  /// Extracts the element at (\p RowIdx, \p ColumnIdx) from \p Matrix.
+  Value *CreateExtractElement(Value *Matrix, Value *RowIdx, Value *ColumnIdx,
+  unsigned NumRows, Twine const  = "") {
+
+unsigned MaxWidth = std::max(RowIdx->getType()->getScalarSizeInBits(),
+ ColumnIdx->getType()->getScalarSizeInBits());
+Type *IntTy = IntegerType::get(RowIdx->getType()->getContext(), MaxWidth);
+RowIdx = B.CreateZExt(RowIdx, IntTy);
+ColumnIdx = B.CreateZExt(ColumnIdx, IntTy);
+Value *NumRowsV = B.getIntN(MaxWidth, NumRows);
 return B.CreateExtractElement(
-Matrix,
-B.CreateAdd(
-B.CreateMul(Column, ConstantInt::get(Column->getType(), NumRows)),
-Row));
+Matrix, B.CreateAdd(B.CreateMul(ColumnIdx, NumRowsV), RowIdx),
+"matext");
   }
 };
 
Index: clang/tools/libclang/CXCursor.cpp
===
--- clang/tools/libclang/CXCursor.cpp
+++ clang/tools/libclang/CXCursor.cpp
@@ -419,6 +419,11 @@
 K = CXCursor_ArraySubscriptExpr;
 break;
 
+  case Stmt::MatrixSubscriptExprClass:
+// TODO: add support for MatrixSubscriptExpr.
+K = CXCursor_UnexposedExpr;
+break;
+
   case Stmt::OMPArraySectionExprClass:
 K = CXCursor_OMPArraySectionExpr;
 break;
Index: clang/test/SemaCXX/matrix-type-operators.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/matrix-type-operators.cpp
@@ -0,0 +1,86 @@
+// RUN: %clang_cc1 %s -fenable-matrix -pedantic -std=c++11 -verify -triple=x86_64-apple-darwin9
+
+typedef float sx5x10_t __attribute__((matrix_type(5, 10)));
+
+sx5x10_t get_matrix();
+
+void insert(sx5x10_t a, float f) {
+  // Non integer indexes.
+  a[3][f] = 0;
+  // expected-error@-1 {{matrix column index is not an integer}}
+  a[f][9] = 0;
+  // expected-error@-1 {{matrix row index is not an integer}}
+  a[f][f] = 0;
+  // expected-error@-1 {{matrix row index is not an integer}}
+  a[0][f] = 0;
+  // expected-error@-1 {{matrix column index is not an integer}}
+
+  // Invalid element type.
+  a[3][4] = 
+  // expected-error@-1 {{assigning to 'float' from incompatible type 'float *'; remove &}}
+
+  // Indexes outside allowed dimensions.
+  a[-1][3] = 10.0;
+  // expected-error@-1 {{matrix row index is outside the allowed range [0, 5)}}
+  a[3][-1] = 10.0;
+  // expected-error@-1 {{matrix column index is outside the allowed range [0, 10)}}
+  a[3][-1u] = 10.0;
+  // expected-error@-1 {{matrix column index is outside 

[PATCH] D76791: [Matrix] Implement matrix index expressions ([][]).

2020-05-22 Thread Florian Hahn via Phabricator via cfe-commits
fhahn marked an inline comment as done.
fhahn added inline comments.



Comment at: clang/lib/AST/Expr.cpp:3859
+
+  auto *SubscriptE = dyn_cast(this);
+  return SubscriptE

rjmccall wrote:
> You need to `IgnoreParens()` here.
This code is now gone.



Comment at: clang/lib/AST/ExprConstant.cpp:7768
+  if (E->getBase()->getMatrixFromIndexExpr(Info.getLangOpts().MatrixTypes))
+return false;
+

rjmccall wrote:
> This can also occur in the other evaluators due to indexing into an r-value.
This code is not required any longer.



Comment at: clang/lib/Sema/SemaExpr.cpp:5326
+VK = VK_LValue;
+OK = OK_VectorComponent;
   } else if (RHSTy->isArrayType()) {

rjmccall wrote:
> It should have the value kind of its base.  `get_matrix_rvalue()[0][0]` is 
> still an r-value, so you shouldn't allow it to be assigned to.  Needs tests.
> 
> I'm fine with re-using `OK_VectorComponent` here, but you should (1) rename 
> it to `OK_VectorOrMatrixComponent` and (2) take the opportunity to audit the 
> places that use it to make sure they do something sensible.  I expect you'll 
> need to at least update some diagnostics about e.g. disallowing taking the 
> address of the expression.
> 
> I think you should build a new expression node instead of reusing 
> `ArraySubscriptExpr`, since basically none of the code that looks for an 
> `ArraySubscriptExpr` will do the right thing for your operation.  That will 
> also allow you to avoid the "is this actually enabled" check, since you'll 
> only see this node when your feature is enabled.  If you're feeling generous, 
> you could move vector subscripting to this new node as well and leave 
> `ArraySubscriptExpr` exclusively for the standard (or dependent) cases.
> It should have the value kind of its base.  get_matrix_rvalue()[0][0] is 
> still an r-value, so you shouldn't allow it to be assigned to. Needs tests.

added tests to Sema/matrix-type-operators.s and 
SemaCXX/matrix-type-operators.cpp.

> I'm fine with re-using OK_VectorComponent here, but you should (1) rename it 
> to OK_VectorOrMatrixComponent and (2) take the opportunity to audit the 
> places that use it to make sure they do something sensible. I expect you'll 
> need to at least update some diagnostics about e.g. disallowing taking the 
> address of the expression.

I've introduced a new OK_MatrixElement, because I don't think there is enough 
information to distinguish between vectors/matrixes where it is used. Also 
added a reinterpret_cast test.

> I think you should build a new expression node instead of reusing 
> ArraySubscriptExpr, since basically none of the code that looks for an 
> ArraySubscriptExpr will do the right thing for your operation. That will also 
> allow you to avoid the "is this actually enabled" check, since you'll only 
> see this node when your feature is enabled. If you're feeling generous, you 
> could move vector subscripting to this new node as well and leave 
> ArraySubscriptExpr exclusively for the standard (or dependent) cases.

I've added a new MatrixSubscriptExpr. That helps to simplify the code in a 
couple of places. ActOnArraySubscriptExpr calls ActOnMatrixSubscriptExpr if we 
can identify the base as matrix type or MatrixSubscriptExpr. I initially tried 
to move the ActOnMatrixSubscriptExpr call to the parse step, but that does not 
work in the presence of dependent base types I think. Until we instantiate the 
dependent types, there's no way to distinguish between 
ArraySubscriptExpr/MatrixSubscriptExpr I think and it is best to treat them as 
unanalyzed ArraySubscriptExpr until then.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76791



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/test/Driver/aix-ld.cpp:1
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and Arguemnt order.
+// // RUN: %clang++ -no-canonical-prefixes %s -### -o %t.o 2>&1 \

ZarkoCA wrote:
> s/Arguemnt/Argument/
Lowercase "argument".



Comment at: clang/test/Driver/aix-ld.cpp:2
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and Arguemnt order.
+// // RUN: %clang++ -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// // RUN: -Wl,-bnocdtors \

Let's not use a `.o` suffix for the link step output. It seems using no `-o` is 
fine for tests with `-###`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[PATCH] D80425: Fix LLVM/Clang builds with mingw toolchain

2020-05-22 Thread Mateusz Mikuła via Phabricator via cfe-commits
mati865 added inline comments.



Comment at: clang/tools/libclang/CMakeLists.txt:71
+  list(APPEND LIBS ${CMAKE_DL_LIBS})
 endif()
 

thieta wrote:
> mstorsjo wrote:
> > If you say this is the same way it's done elsewhere, then sure - although I 
> > have no idea about what the issue is, why I haven't run into it, etc. 
> > Normally you wouldn't have a `libdl` on mingw right? What's the concrete 
> > issue you're running into, and in which conditions would one run into it?
> The problem here is that on my system `find_library()` picks up libdl in 
> `/usr/lib` and then tries to link to it and gives me an error about it. 
> `HAVE_LIBDL` comes from `config-ix.cmake` where it's checked if we are on 
> windows or not: 
> https://github.com/llvm/llvm-project/blob/216833b32befd14079130a3b857906f4e301179c/llvm/cmake/config-ix.cmake#L101
> 
> So this is how other places uses `CMAKE_DL_LIBS` like here: 
> https://github.com/llvm/llvm-project/blob/7aaff8fd2da2812a2b3cbc8a41af29774b10a7d6/llvm/lib/Support/CMakeLists.txt#L13
I also had this issue in MSYS2 but used `-DCMAKE_SYSTEM_IGNORE_PATH=/usr/lib` 
to get around it.
MSYS2 has Cygwin like (so UNIX like) environment in `/usr/` and `/mingw{32,64}` 
for Mingw-w64.



Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:967
CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
-  elseif(LINKER_IS_LLD_LINK)
+  elseif(LINKER_IS_LLD_LINK AND NOT MINGW)
 append("/lldltocache:${PROJECT_BINARY_DIR}/lto.cache"

thieta wrote:
> mstorsjo wrote:
> > Do you happen to know why `LINKER_IS_LLD_LINK` gets set in this case? 
> > `ld.lld` (the ELF linker interface, which then the MinGW driver remaps onto 
> > the COFF backend with the `lld-link` interface) certainly doesn't take 
> > `lld-link` style options. I believe (without diving further into it) that 
> > we shouldn't be setting this flag in this combination, but with the option 
> > implemented, we should fit it into the case further above, `elseif((UNIX OR 
> > MINGW) AND LLVM_USE_LINKER STREQUAL "lld")`
> Yeah I bet that variable is set because I pass `LLVM_USE_LINKER=lld` but I 
> haven't digged to deeply. I can rework the if statement here when we have the 
> lld option in there.
> Yeah I bet that variable is set because I pass LLVM_USE_LINKER=lld but I 
> haven't digged to deeply. 

It does use `lld-link` when you use `LLVM_USE_LINKER=lld`.

The problem lies in this line:
```
append("/lldltocache:${PROJECT_BINARY_DIR}/lto.cache"
```
For MinGW that should read:
```
append("-Wl,/lldltocache:${PROJECT_BINARY_DIR}/lto.cache"
```
That's because you are passing this flag to GCC/Clang.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80425



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


[PATCH] D80251: [X86] Update some av512 shift intrinsics to use "unsigned int" parameter instead of int to match Intel documentaiton

2020-05-22 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon accepted this revision.
RKSimon added a comment.
This revision is now accepted and ready to land.

In D80251#2049975 , @craig.topper 
wrote:

> In D80251#2049418 , @RKSimon wrote:
>
> > Can we add -Wsign-conversion checks to the tests? That was mentioned on 
> > PR45931
>
>
> I can. Will that do anything other than show that my test_* functions were 
> updated to match the new type?


not much other than check for regressions again tbh.

otherwise, lgtm


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

https://reviews.llvm.org/D80251



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


[PATCH] D80344: [Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC option -EHa)

2020-05-22 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

This should likely be at least 3 patches: llvm middle-end, llvm codegen, clang.
Langref changes missing for new intrinsics.
Please post all patches with full context (`-U9`)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80344



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Zarko Todorovski via Phabricator via cfe-commits
ZarkoCA added inline comments.



Comment at: clang/test/Driver/aix-ld.cpp:3
+// // RUN: %clang++ -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// // RUN: -Wl,-bnocdtors \
+// // RUN: -target powerpc-ibm-aix7.1.0.0 \

formatting, align with the line above


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Zarko Todorovski via Phabricator via cfe-commits
ZarkoCA added inline comments.



Comment at: clang/test/Driver/aix-ld.cpp:1
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and Arguemnt order.
+// // RUN: %clang++ -no-canonical-prefixes %s -### -o %t.o 2>&1 \

s/Arguemnt/Argument/



Comment at: clang/test/Driver/aix-ld.cpp:7
+// // RUN:   | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+// // CHECK-LD32-ARG-ORDER-NOT: warning:
+// // CHECK-LD32-ARG-ORDER: {{.*}}clang++" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"

Add a line between the run steps and check, and can you align things 
vertically. 

Eg. 

```
CHECK-LD32-ARG-ORDER-NOT: warning:
CHECK-LD32-ARG-ORDER: {{.*}}clang++" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[PATCH] D80440: [OpenCL] Prevent fused mul and add by default

2020-05-22 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.
Anastasia added reviewers: rjmccall, arsenm.
Herald added subscribers: ebevhan, yaxunl, wdng.

Currently, clang will generate fused operation `fmuladd` for expressions like 
`a*b+c`. However, I can't find anything in the spec that explains this 
behavior. But clang was doing this for almost 10 years

I looked at:
**s6.13.2 **where it details fp conract pragma:

  // on-off-switch is one of ON, OFF, or DEFAULT.
  // The DEFAULT value is ON.
  #pragma OPENCL FP_CONTRACT on-off-switch

The default behavior here refers to the default value of the pragma when used 
in the source code.

**s7.4** table 38

  x * y + z
  Implemented either as a correctly rounded fma or as a multiply and an add 
both of which are correctly rounded.

This table described behavior when `-cl-unsafe-math-optimizations` flag is 
passed.

I can't find anything else that would justify allowing fused operations, 
therefore I assume this is not safe to do and can cause issues on some 
applications/targets


https://reviews.llvm.org/D80440

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGenOpenCL/relaxed-fpmath.cl
  clang/test/CodeGenOpenCL/single-precision-constant.cl


Index: clang/test/CodeGenOpenCL/single-precision-constant.cl
===
--- clang/test/CodeGenOpenCL/single-precision-constant.cl
+++ clang/test/CodeGenOpenCL/single-precision-constant.cl
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 %s -cl-single-precision-constant -emit-llvm -o - | 
FileCheck %s
 
 float fn(float f) {
-  // CHECK: tail call float @llvm.fmuladd.f32(float %f, float 2.00e+00, 
float 1.00e+00)
+  // CHECK: fmul float %f, 2.00e+00
+  // CHECK: fadd float %mul, 1.00e+00
   return f*2. + 1.;
 }
Index: clang/test/CodeGenOpenCL/relaxed-fpmath.cl
===
--- clang/test/CodeGenOpenCL/relaxed-fpmath.cl
+++ clang/test/CodeGenOpenCL/relaxed-fpmath.cl
@@ -17,7 +17,8 @@
 }
 
 float fused_mad(float a, float b, float c) {
-  // NORMAL: tail call float @llvm.fmuladd.f32(float %a, float %b, float %c)
+  // NORMAL: fmul float
+  // NORMAL: fadd float
   // FAST: fmul fast float
   // FAST: fadd fast float
   // MAD: fmul contract float
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2322,7 +2322,6 @@
 Opts.AltiVec = 0;
 Opts.ZVector = 0;
 Opts.setLaxVectorConversions(LangOptions::LaxVectorConversionKind::None);
-Opts.setDefaultFPContractMode(LangOptions::FPM_On);
 Opts.NativeHalfType = 1;
 Opts.NativeHalfArgsAndReturns = 1;
 Opts.OpenCLCPlusPlus = Opts.CPlusPlus;


Index: clang/test/CodeGenOpenCL/single-precision-constant.cl
===
--- clang/test/CodeGenOpenCL/single-precision-constant.cl
+++ clang/test/CodeGenOpenCL/single-precision-constant.cl
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 %s -cl-single-precision-constant -emit-llvm -o - | FileCheck %s
 
 float fn(float f) {
-  // CHECK: tail call float @llvm.fmuladd.f32(float %f, float 2.00e+00, float 1.00e+00)
+  // CHECK: fmul float %f, 2.00e+00
+  // CHECK: fadd float %mul, 1.00e+00
   return f*2. + 1.;
 }
Index: clang/test/CodeGenOpenCL/relaxed-fpmath.cl
===
--- clang/test/CodeGenOpenCL/relaxed-fpmath.cl
+++ clang/test/CodeGenOpenCL/relaxed-fpmath.cl
@@ -17,7 +17,8 @@
 }
 
 float fused_mad(float a, float b, float c) {
-  // NORMAL: tail call float @llvm.fmuladd.f32(float %a, float %b, float %c)
+  // NORMAL: fmul float
+  // NORMAL: fadd float
   // FAST: fmul fast float
   // FAST: fadd fast float
   // MAD: fmul contract float
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2322,7 +2322,6 @@
 Opts.AltiVec = 0;
 Opts.ZVector = 0;
 Opts.setLaxVectorConversions(LangOptions::LaxVectorConversionKind::None);
-Opts.setDefaultFPContractMode(LangOptions::FPM_On);
 Opts.NativeHalfType = 1;
 Opts.NativeHalfArgsAndReturns = 1;
 Opts.OpenCLCPlusPlus = Opts.CPlusPlus;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >