[PATCH] D107946: [X86] Reverse *_set_ph and *_setr_ph 's set order.

2021-08-12 Thread Freddy, Ye via Phabricator via cfe-commits
FreddyYe updated this revision to Diff 365923.
FreddyYe added a comment.

address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107946

Files:
  clang/lib/Headers/avx512fp16intrin.h
  clang/lib/Headers/avx512vlfp16intrin.h


Index: clang/lib/Headers/avx512vlfp16intrin.h
===
--- clang/lib/Headers/avx512vlfp16intrin.h
+++ clang/lib/Headers/avx512vlfp16intrin.h
@@ -48,7 +48,7 @@
 static __inline __m128h __DEFAULT_FN_ATTRS128
 _mm_set_ph(_Float16 __h1, _Float16 __h2, _Float16 __h3, _Float16 __h4,
_Float16 __h5, _Float16 __h6, _Float16 __h7, _Float16 __h8) {
-  return (__m128h)(__v8hf){__h1, __h2, __h3, __h4, __h5, __h6, __h7, __h8};
+  return (__m128h)(__v8hf){__h8, __h7, __h6, __h5, __h4, __h3, __h2, __h1};
 }
 
 static __inline __m256h __DEFAULT_FN_ATTRS256
@@ -56,19 +56,18 @@
   _Float16 __h5, _Float16 __h6, _Float16 __h7, _Float16 __h8,
   _Float16 __h9, _Float16 __h10, _Float16 __h11, _Float16 __h12,
   _Float16 __h13, _Float16 __h14, _Float16 __h15, _Float16 __h16) {
-  return (__m256h)(__v16hf){__h1,  __h2,  __h3,  __h4,  __h5,  __h6,
-__h7,  __h8,  __h9,  __h10, __h11, __h12,
-__h13, __h14, __h15, __h16};
+  return (__m256h)(__v16hf){__h16, __h15, __h14, __h13, __h12, __h11,
+__h10, __h9,  __h8,  __h7,  __h6,  __h5,
+__h4,  __h3,  __h2,  __h1};
 }
 
-#define _mm_setr_ph(__h1, __h2, __h3, __h4, __h5, __h6, __h7, __h8)
\
-  _mm_set_ph((__h8), (__h7), (__h6), (__h5), (__h4), (__h3), (__h2), (__h1))
+#define _mm_setr_ph(h1, h2, h3, h4, h5, h6, h7, h8)
\
+  _mm_set_ph((h8), (h7), (h6), (h5), (h4), (h3), (h2), (h1))
 
-#define _mm256_setr_ph(__h1, __h2, __h3, __h4, __h5, __h6, __h7, __h8, __h9,   
\
-   __h10, __h11, __h12, __h13, __h14, __h15, __h16)
\
-  _mm256_set_ph((__h16), (__h15), (__h14), (__h13), (__h12), (__h11), (__h10), 
\
-(__h9), (__h8), (__h7), (__h6), (__h5), (__h4), (__h3),
\
-(__h2), (__h1))
+#define _mm256_setr_ph(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, 
\
+   h14, h15, h16)  
\
+  _mm256_set_ph((h16), (h15), (h14), (h13), (h12), (h11), (h10), (h9), (h8),   
\
+(h7), (h6), (h5), (h4), (h3), (h2), (h1))
 
 static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_abs_ph(__m256h __A) {
   return (__m256h)_mm256_and_epi32(_mm256_set1_epi32(0x7FFF7FFF), 
(__m256i)__A);
Index: clang/lib/Headers/avx512fp16intrin.h
===
--- clang/lib/Headers/avx512fp16intrin.h
+++ clang/lib/Headers/avx512fp16intrin.h
@@ -82,22 +82,20 @@
   _Float16 __h21, _Float16 __h22, _Float16 __h23, _Float16 __h24,
   _Float16 __h25, _Float16 __h26, _Float16 __h27, _Float16 __h28,
   _Float16 __h29, _Float16 __h30, _Float16 __h31, _Float16 __h32) {
-  return (__m512h)(__v32hf){__h1,  __h2,  __h3,  __h4,  __h5,  __h6,  __h7,
-__h8,  __h9,  __h10, __h11, __h12, __h13, __h14,
-__h15, __h16, __h17, __h18, __h19, __h20, __h21,
-__h22, __h23, __h24, __h25, __h26, __h27, __h28,
-__h29, __h30, __h31, __h32};
-}
-
-#define _mm512_setr_ph(__h1, __h2, __h3, __h4, __h5, __h6, __h7, __h8, __h9,   
\
-   __h10, __h11, __h12, __h13, __h14, __h15, __h16, __h17, 
\
-   __h18, __h19, __h20, __h21, __h22, __h23, __h24, __h25, 
\
-   __h26, __h27, __h28, __h29, __h30, __h31, __h32)
\
-  _mm512_set_ph((__h32), (__h31), (__h30), (__h29), (__h28), (__h27), (__h26), 
\
-(__h25), (__h24), (__h23), (__h22), (__h21), (__h20), (__h19), 
\
-(__h18), (__h17), (__h16), (__h15), (__h14), (__h13), (__h12), 
\
-(__h11), (__h10), (__h9), (__h8), (__h7), (__h6), (__h5),  
\
-(__h4), (__h3), (__h2), (__h1))
+  return (__m512h)(__v32hf){__h32, __h31, __h30, __h29, __h28, __h27, __h26,
+__h25, __h24, __h23, __h22, __h21, __h20, __h19,
+__h18, __h17, __h16, __h15, __h14, __h13, __h12,
+__h11, __h10, __h9,  __h8,  __h7,  __h6,  __h5,
+__h4,  __h3,  __h2,  __h1};
+}
+
+#define _mm512_setr_ph(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, 
\
+   h14, h15, h16, h17, h18, h19, h20, h21, h22, h23, h24,  
\
+   h25, h26, h27, h28, h29, h30, h31, h32) 
\
+  _mm512_set_ph((h32), (h31), (h30), (h29), (h28), (h27), (h26), (h25), (h24), 
\
+ 

[PATCH] D107946: [X86] Reverse *_set_ph and *_setr_ph 's set order.

2021-08-12 Thread Freddy, Ye via Phabricator via cfe-commits
FreddyYe marked an inline comment as done.
FreddyYe added a comment.

THX for review.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107946

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


[PATCH] D107703: [AST][clangd] Expose documentation of Attrs on hover.

2021-08-12 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision.
kadircet added a comment.

thanks, LG from my side as well, just a couple of clarification questions 
regarding tablegen.




Comment at: clang-tools-extra/clangd/unittests/HoverTests.cpp:2389
+ HI.Documentation = Attr::getDocumentation(attr::NonNull).str();
+ ASSERT_THAT(HI.Documentation, testing::HasSubstr("parameters"));
}},

nit: maybe `ASSERT_FALSE(HI.Documentation.empty())` ? (I actually think the 
test in AST/AttrTest is enough and we can drop this assertion).



Comment at: clang/utils/TableGen/ClangAttrEmitter.cpp:4237
+  static const llvm::StringRef AttrDoc[] = {
+  #define ATTR(NAME) AttrDoc_##NAME,
+  #include "clang/Basic/AttrList.inc"

i am not well-versed in tablegen, so sorry if i am being dense here, butt what 
happens to the attributes we skipped above (e.g. the ones without a `ASTNode` 
flag)?

Maybe we should be emitting a `... AttrDoc_X[] = "";` for all attributes, no 
matter what?



Comment at: clang/utils/TableGen/ClangAttrEmitter.cpp:4231
+  // Only look at the first documentation if there are several.
+  // (As of now, only one attribute has multiple documentation entries).
+  break;

not sure if this comment will stay useful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107703

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


[PATCH] D107950: [clang-format] improve distinction of K&R function definitions vs attributes

2021-08-12 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir created this revision.
krasimir requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

After
https://github.com/llvm/llvm-project/commit/9da70ab3d43c79116f80fc06aa7cf517374ce42c
we saw a few regressions around trailing attribute definitions and in
typedefs (examples in the added test cases). There's some tension
distinguishing K&R definitions from attributes at the parser level,
where we have to decide if we need to put the type of the K&R definition
on a new unwrapped line before we have access to the rest of the line,
so we're scanning backwards and looking for a pattern like f(a, b). But
this type of pattern could also be an attribute macro, or the whole
declaration could be a typedef itself. I updated the code to check for a
typedef at the beginning of the line and to not consider raw identifiers
as possible first K&R declaration (but treated as an attribute macro
instead). This is not 100% correct heuristic, but I think it should be
reasonably good in practice, where we'll:

- likely be in some very C-ish code when using K&R style (e.g., stuff that uses 
`struct name a;` instead of `name a;`
- likely be in some very C++-ish code when using attributes
- unlikely mix up the two in the same declaration.

Ideally, we should only decide to add the unwrapped line before the K&R
declaration after we've scanned the rest of the line an noticed the
variable declarations and the semicolon, but the way the parser is
organized I don't see a good way to do this in the current parser, which
only has good context for the previously visited tokens. I also tried
not emitting an unwrapped line there and trying to resolve the situation
later in the token annotator and the continuation indenter, and that
approach seems promising, but I couldn't make it to work without
messing up a bunch of other cases in unit tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107950

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


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8247,14 +8247,25 @@
"  return a + b < c;\n"
"};",
Style);
-  // The return breaking style doesn't affect object definitions with
-  // attribute-like macros.
+
+  // The return breaking style doesn't affect:
+  // * function and object definitions with attribute-like macros
   verifyFormat("Tttt ppp\n"
"ABSL_GUARDED_BY(mutex) = {};",
getGoogleStyleWithColumns(40));
   verifyFormat("Tttt ppp\n"
"ABSL_GUARDED_BY(mutex);  // comment",
getGoogleStyleWithColumns(40));
+  verifyFormat("Tttt ppp\n"
+   "ABSL_GUARDED_BY(mutex1)\n"
+   "ABSL_GUARDED_BY(mutex2);",
+   getGoogleStyleWithColumns(40));
+  verifyFormat("Tt f(int a, int b)\n"
+   "ABSL_GUARDED_BY(mutex1)\n"
+   "ABSL_GUARDED_BY(mutex2);",
+   getGoogleStyleWithColumns(40));
+  // * typedefs
+  verifyFormat("typedef ATTR(X) char x;", getGoogleStyle());
 
   Style = getGNUStyle();
 
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -14,6 +14,7 @@
 
 #include "UnwrappedLineParser.h"
 #include "FormatToken.h"
+#include "clang/Basic/TokenKinds.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
@@ -1007,7 +1008,7 @@
 
   if (!Tok->isOneOf(tok::kw_int, tok::kw_char, tok::kw_float, tok::kw_double,
 tok::kw_struct, tok::kw_union, tok::kw_long, tok::kw_short,
-tok::kw_unsigned, tok::kw_register, tok::identifier))
+tok::kw_unsigned, tok::kw_register))
 return false;
 
   Tok = Tok->Previous;
@@ -1378,7 +1379,8 @@
 break;
   if (Previous->Previous && Previous->Previous->is(tok::at))
 break;
-  if (isC78ParameterDecl(FormatTok)) {
+  if (!Line->Tokens.begin()->Tok->is(tok::kw_typedef) &&
+  isC78ParameterDecl(FormatTok)) {
 addUnwrappedLine();
 return;
   }


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8247,14 +8247,25 @@
"  return a + b < c;\n"
"};",
Style);
-  // The return breaking style doesn't affect object definitions with
-  // attribute-like macros.
+
+  // The return breaking style doesn't affect:
+  

[PATCH] D107950: [clang-format] improve distinction of K&R function definitions vs attributes

2021-08-12 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

Thanks for doing this, it LGTM. I personally think tok::identifier tends to be 
just too general, its hard to use it correctly in the rules especially in the 
presence of macros.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107950

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


[clang] 6c14688 - [X86] Reverse *_set_ph and *_setr_ph 's set order.

2021-08-12 Thread Freddy Ye via cfe-commits

Author: Freddy Ye
Date: 2021-08-12T16:27:04+08:00
New Revision: 6c1468854d70091ec9b53f97ff33e4a09d95443a

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

LOG: [X86] Reverse *_set_ph and *_setr_ph 's set order.

Reviewed By: pengfei

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

Added: 


Modified: 
clang/lib/Headers/avx512fp16intrin.h
clang/lib/Headers/avx512vlfp16intrin.h

Removed: 




diff  --git a/clang/lib/Headers/avx512fp16intrin.h 
b/clang/lib/Headers/avx512fp16intrin.h
index 80192b96bef7..926033e20152 100644
--- a/clang/lib/Headers/avx512fp16intrin.h
+++ b/clang/lib/Headers/avx512fp16intrin.h
@@ -82,22 +82,20 @@ _mm512_set_ph(_Float16 __h1, _Float16 __h2, _Float16 __h3, 
_Float16 __h4,
   _Float16 __h21, _Float16 __h22, _Float16 __h23, _Float16 __h24,
   _Float16 __h25, _Float16 __h26, _Float16 __h27, _Float16 __h28,
   _Float16 __h29, _Float16 __h30, _Float16 __h31, _Float16 __h32) {
-  return (__m512h)(__v32hf){__h1,  __h2,  __h3,  __h4,  __h5,  __h6,  __h7,
-__h8,  __h9,  __h10, __h11, __h12, __h13, __h14,
-__h15, __h16, __h17, __h18, __h19, __h20, __h21,
-__h22, __h23, __h24, __h25, __h26, __h27, __h28,
-__h29, __h30, __h31, __h32};
-}
-
-#define _mm512_setr_ph(__h1, __h2, __h3, __h4, __h5, __h6, __h7, __h8, __h9,   
\
-   __h10, __h11, __h12, __h13, __h14, __h15, __h16, __h17, 
\
-   __h18, __h19, __h20, __h21, __h22, __h23, __h24, __h25, 
\
-   __h26, __h27, __h28, __h29, __h30, __h31, __h32)
\
-  _mm512_set_ph((__h32), (__h31), (__h30), (__h29), (__h28), (__h27), (__h26), 
\
-(__h25), (__h24), (__h23), (__h22), (__h21), (__h20), (__h19), 
\
-(__h18), (__h17), (__h16), (__h15), (__h14), (__h13), (__h12), 
\
-(__h11), (__h10), (__h9), (__h8), (__h7), (__h6), (__h5),  
\
-(__h4), (__h3), (__h2), (__h1))
+  return (__m512h)(__v32hf){__h32, __h31, __h30, __h29, __h28, __h27, __h26,
+__h25, __h24, __h23, __h22, __h21, __h20, __h19,
+__h18, __h17, __h16, __h15, __h14, __h13, __h12,
+__h11, __h10, __h9,  __h8,  __h7,  __h6,  __h5,
+__h4,  __h3,  __h2,  __h1};
+}
+
+#define _mm512_setr_ph(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, 
\
+   h14, h15, h16, h17, h18, h19, h20, h21, h22, h23, h24,  
\
+   h25, h26, h27, h28, h29, h30, h31, h32) 
\
+  _mm512_set_ph((h32), (h31), (h30), (h29), (h28), (h27), (h26), (h25), (h24), 
\
+(h23), (h22), (h21), (h20), (h19), (h18), (h17), (h16), (h15), 
\
+(h14), (h13), (h12), (h11), (h10), (h9), (h8), (h7), (h6), 
\
+(h5), (h4), (h3), (h2), (h1))
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_castph_ps(__m128h __a) {
   return (__m128)__a;

diff  --git a/clang/lib/Headers/avx512vlfp16intrin.h 
b/clang/lib/Headers/avx512vlfp16intrin.h
index 6bd97bac1f50..cda54bcc8351 100644
--- a/clang/lib/Headers/avx512vlfp16intrin.h
+++ b/clang/lib/Headers/avx512vlfp16intrin.h
@@ -48,7 +48,7 @@ static __inline __m256h __DEFAULT_FN_ATTRS256 
_mm256_set1_ph(_Float16 __h) {
 static __inline __m128h __DEFAULT_FN_ATTRS128
 _mm_set_ph(_Float16 __h1, _Float16 __h2, _Float16 __h3, _Float16 __h4,
_Float16 __h5, _Float16 __h6, _Float16 __h7, _Float16 __h8) {
-  return (__m128h)(__v8hf){__h1, __h2, __h3, __h4, __h5, __h6, __h7, __h8};
+  return (__m128h)(__v8hf){__h8, __h7, __h6, __h5, __h4, __h3, __h2, __h1};
 }
 
 static __inline __m256h __DEFAULT_FN_ATTRS256
@@ -56,19 +56,18 @@ _mm256_set_ph(_Float16 __h1, _Float16 __h2, _Float16 __h3, 
_Float16 __h4,
   _Float16 __h5, _Float16 __h6, _Float16 __h7, _Float16 __h8,
   _Float16 __h9, _Float16 __h10, _Float16 __h11, _Float16 __h12,
   _Float16 __h13, _Float16 __h14, _Float16 __h15, _Float16 __h16) {
-  return (__m256h)(__v16hf){__h1,  __h2,  __h3,  __h4,  __h5,  __h6,
-__h7,  __h8,  __h9,  __h10, __h11, __h12,
-__h13, __h14, __h15, __h16};
+  return (__m256h)(__v16hf){__h16, __h15, __h14, __h13, __h12, __h11,
+__h10, __h9,  __h8,  __h7,  __h6,  __h5,
+__h4,  __h3,  __h2,  __h1};
 }
 
-#define _mm_setr_ph(__h1, __h2, __h3, __h4, __h5, __h6, __h7, __h8)
\
-  _mm_set_ph((__h8), (__h7), (__h6), (__h5), (__h4), (__h3), (__h2), (__h1))
+#define _mm_setr_ph(h1, h2, h3, h4, h5, h6, h7, h8)
\
+  _m

[PATCH] D107946: [X86] Reverse *_set_ph and *_setr_ph 's set order.

2021-08-12 Thread Freddy, Ye via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6c1468854d70: [X86] Reverse *_set_ph and *_setr_ph 's 
set order. (authored by FreddyYe).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107946

Files:
  clang/lib/Headers/avx512fp16intrin.h
  clang/lib/Headers/avx512vlfp16intrin.h


Index: clang/lib/Headers/avx512vlfp16intrin.h
===
--- clang/lib/Headers/avx512vlfp16intrin.h
+++ clang/lib/Headers/avx512vlfp16intrin.h
@@ -48,7 +48,7 @@
 static __inline __m128h __DEFAULT_FN_ATTRS128
 _mm_set_ph(_Float16 __h1, _Float16 __h2, _Float16 __h3, _Float16 __h4,
_Float16 __h5, _Float16 __h6, _Float16 __h7, _Float16 __h8) {
-  return (__m128h)(__v8hf){__h1, __h2, __h3, __h4, __h5, __h6, __h7, __h8};
+  return (__m128h)(__v8hf){__h8, __h7, __h6, __h5, __h4, __h3, __h2, __h1};
 }
 
 static __inline __m256h __DEFAULT_FN_ATTRS256
@@ -56,19 +56,18 @@
   _Float16 __h5, _Float16 __h6, _Float16 __h7, _Float16 __h8,
   _Float16 __h9, _Float16 __h10, _Float16 __h11, _Float16 __h12,
   _Float16 __h13, _Float16 __h14, _Float16 __h15, _Float16 __h16) {
-  return (__m256h)(__v16hf){__h1,  __h2,  __h3,  __h4,  __h5,  __h6,
-__h7,  __h8,  __h9,  __h10, __h11, __h12,
-__h13, __h14, __h15, __h16};
+  return (__m256h)(__v16hf){__h16, __h15, __h14, __h13, __h12, __h11,
+__h10, __h9,  __h8,  __h7,  __h6,  __h5,
+__h4,  __h3,  __h2,  __h1};
 }
 
-#define _mm_setr_ph(__h1, __h2, __h3, __h4, __h5, __h6, __h7, __h8)
\
-  _mm_set_ph((__h8), (__h7), (__h6), (__h5), (__h4), (__h3), (__h2), (__h1))
+#define _mm_setr_ph(h1, h2, h3, h4, h5, h6, h7, h8)
\
+  _mm_set_ph((h8), (h7), (h6), (h5), (h4), (h3), (h2), (h1))
 
-#define _mm256_setr_ph(__h1, __h2, __h3, __h4, __h5, __h6, __h7, __h8, __h9,   
\
-   __h10, __h11, __h12, __h13, __h14, __h15, __h16)
\
-  _mm256_set_ph((__h16), (__h15), (__h14), (__h13), (__h12), (__h11), (__h10), 
\
-(__h9), (__h8), (__h7), (__h6), (__h5), (__h4), (__h3),
\
-(__h2), (__h1))
+#define _mm256_setr_ph(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, 
\
+   h14, h15, h16)  
\
+  _mm256_set_ph((h16), (h15), (h14), (h13), (h12), (h11), (h10), (h9), (h8),   
\
+(h7), (h6), (h5), (h4), (h3), (h2), (h1))
 
 static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_abs_ph(__m256h __A) {
   return (__m256h)_mm256_and_epi32(_mm256_set1_epi32(0x7FFF7FFF), 
(__m256i)__A);
Index: clang/lib/Headers/avx512fp16intrin.h
===
--- clang/lib/Headers/avx512fp16intrin.h
+++ clang/lib/Headers/avx512fp16intrin.h
@@ -82,22 +82,20 @@
   _Float16 __h21, _Float16 __h22, _Float16 __h23, _Float16 __h24,
   _Float16 __h25, _Float16 __h26, _Float16 __h27, _Float16 __h28,
   _Float16 __h29, _Float16 __h30, _Float16 __h31, _Float16 __h32) {
-  return (__m512h)(__v32hf){__h1,  __h2,  __h3,  __h4,  __h5,  __h6,  __h7,
-__h8,  __h9,  __h10, __h11, __h12, __h13, __h14,
-__h15, __h16, __h17, __h18, __h19, __h20, __h21,
-__h22, __h23, __h24, __h25, __h26, __h27, __h28,
-__h29, __h30, __h31, __h32};
-}
-
-#define _mm512_setr_ph(__h1, __h2, __h3, __h4, __h5, __h6, __h7, __h8, __h9,   
\
-   __h10, __h11, __h12, __h13, __h14, __h15, __h16, __h17, 
\
-   __h18, __h19, __h20, __h21, __h22, __h23, __h24, __h25, 
\
-   __h26, __h27, __h28, __h29, __h30, __h31, __h32)
\
-  _mm512_set_ph((__h32), (__h31), (__h30), (__h29), (__h28), (__h27), (__h26), 
\
-(__h25), (__h24), (__h23), (__h22), (__h21), (__h20), (__h19), 
\
-(__h18), (__h17), (__h16), (__h15), (__h14), (__h13), (__h12), 
\
-(__h11), (__h10), (__h9), (__h8), (__h7), (__h6), (__h5),  
\
-(__h4), (__h3), (__h2), (__h1))
+  return (__m512h)(__v32hf){__h32, __h31, __h30, __h29, __h28, __h27, __h26,
+__h25, __h24, __h23, __h22, __h21, __h20, __h19,
+__h18, __h17, __h16, __h15, __h14, __h13, __h12,
+__h11, __h10, __h9,  __h8,  __h7,  __h6,  __h5,
+__h4,  __h3,  __h2,  __h1};
+}
+
+#define _mm512_setr_ph(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, 
\
+   h14, h15, h16, h17, h18, h19, h20, h21, h22, h23, h24,  
\
+   h25, h26, 

[clang] 4593492 - [clang-format] improve distinction of K&R function definitions vs attributes

2021-08-12 Thread Krasimir Georgiev via cfe-commits

Author: Krasimir Georgiev
Date: 2021-08-12T10:29:06+02:00
New Revision: 45934922fa88b7542c8bcd86889d062fb78efdda

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

LOG: [clang-format] improve distinction of K&R function definitions vs 
attributes

After
https://github.com/llvm/llvm-project/commit/9da70ab3d43c79116f80fc06aa7cf517374ce42c
we saw a few regressions around trailing attribute definitions and in
typedefs (examples in the added test cases). There's some tension
distinguishing K&R definitions from attributes at the parser level,
where we have to decide if we need to put the type of the K&R definition
on a new unwrapped line before we have access to the rest of the line,
so we're scanning backwards and looking for a pattern like f(a, b). But
this type of pattern could also be an attribute macro, or the whole
declaration could be a typedef itself. I updated the code to check for a
typedef at the beginning of the line and to not consider raw identifiers
as possible first K&R declaration (but treated as an attribute macro
instead). This is not 100% correct heuristic, but I think it should be
reasonably good in practice, where we'll:
  * likely be in some very C-ish code when using K&R style (e.g., stuff
that uses `struct name a;` instead of `name a;`
  * likely be in some very C++-ish code when using attributes
  * unlikely mix up the two in the same declaration.

Ideally, we should only decide to add the unwrapped line before the K&R
declaration after we've scanned the rest of the line an noticed the
variable declarations and the semicolon, but the way the parser is
organized I don't see a good way to do this in the current parser, which
only has good context for the previously visited tokens. I also tried
not emitting an unwrapped line there and trying to resolve the situation
later in the token annotator and the continuation indenter, and that
approach seems promising, but I couldn't make it to work without
messing up a bunch of other cases in unit tests.

Reviewed By: MyDeveloperDay

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

Added: 


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

Removed: 




diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index d6b1ebb1239d..0c4cacab5050 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -14,6 +14,7 @@
 
 #include "UnwrappedLineParser.h"
 #include "FormatToken.h"
+#include "clang/Basic/TokenKinds.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
@@ -1007,7 +1008,7 @@ static bool isC78ParameterDecl(const FormatToken *Tok) {
 
   if (!Tok->isOneOf(tok::kw_int, tok::kw_char, tok::kw_float, tok::kw_double,
 tok::kw_struct, tok::kw_union, tok::kw_long, tok::kw_short,
-tok::kw_unsigned, tok::kw_register, tok::identifier))
+tok::kw_unsigned, tok::kw_register))
 return false;
 
   Tok = Tok->Previous;
@@ -1378,7 +1379,8 @@ void UnwrappedLineParser::parseStructuralElement(bool 
IsTopLevel) {
 break;
   if (Previous->Previous && Previous->Previous->is(tok::at))
 break;
-  if (isC78ParameterDecl(FormatTok)) {
+  if (!Line->Tokens.begin()->Tok->is(tok::kw_typedef) &&
+  isC78ParameterDecl(FormatTok)) {
 addUnwrappedLine();
 return;
   }

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 670788caac00..1283aa67b337 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -8247,14 +8247,25 @@ TEST_F(FormatTest, ReturnTypeBreakingStyle) {
"  return a + b < c;\n"
"};",
Style);
-  // The return breaking style doesn't affect object definitions with
-  // attribute-like macros.
+
+  // The return breaking style doesn't affect:
+  // * function and object definitions with attribute-like macros
   verifyFormat("Tttt ppp\n"
"ABSL_GUARDED_BY(mutex) = {};",
getGoogleStyleWithColumns(40));
   verifyFormat("Tttt ppp\n"
"ABSL_GUARDED_BY(mutex);  // comment",
getGoogleStyleWithColumns(40));
+  verifyFormat("Tttt ppp\n"
+   "ABSL_GUARDED_BY(mutex1)\n"
+   "ABSL_GUARDED_BY(mutex2);",
+   getGoogleStyleWithColumns(40));
+  verifyFormat("Tt f(int a, int b)\n"
+   "ABSL_GUARDED_BY(mutex1)\n"
+   "ABSL_GUARDED_BY(mutex2);",
+   

[PATCH] D107950: [clang-format] improve distinction of K&R function definitions vs attributes

2021-08-12 Thread Krasimir Georgiev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG45934922fa88: [clang-format] improve distinction of K&R 
function definitions vs attributes (authored by krasimir).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107950

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


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8247,14 +8247,25 @@
"  return a + b < c;\n"
"};",
Style);
-  // The return breaking style doesn't affect object definitions with
-  // attribute-like macros.
+
+  // The return breaking style doesn't affect:
+  // * function and object definitions with attribute-like macros
   verifyFormat("Tttt ppp\n"
"ABSL_GUARDED_BY(mutex) = {};",
getGoogleStyleWithColumns(40));
   verifyFormat("Tttt ppp\n"
"ABSL_GUARDED_BY(mutex);  // comment",
getGoogleStyleWithColumns(40));
+  verifyFormat("Tttt ppp\n"
+   "ABSL_GUARDED_BY(mutex1)\n"
+   "ABSL_GUARDED_BY(mutex2);",
+   getGoogleStyleWithColumns(40));
+  verifyFormat("Tt f(int a, int b)\n"
+   "ABSL_GUARDED_BY(mutex1)\n"
+   "ABSL_GUARDED_BY(mutex2);",
+   getGoogleStyleWithColumns(40));
+  // * typedefs
+  verifyFormat("typedef ATTR(X) char x;", getGoogleStyle());
 
   Style = getGNUStyle();
 
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -14,6 +14,7 @@
 
 #include "UnwrappedLineParser.h"
 #include "FormatToken.h"
+#include "clang/Basic/TokenKinds.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
@@ -1007,7 +1008,7 @@
 
   if (!Tok->isOneOf(tok::kw_int, tok::kw_char, tok::kw_float, tok::kw_double,
 tok::kw_struct, tok::kw_union, tok::kw_long, tok::kw_short,
-tok::kw_unsigned, tok::kw_register, tok::identifier))
+tok::kw_unsigned, tok::kw_register))
 return false;
 
   Tok = Tok->Previous;
@@ -1378,7 +1379,8 @@
 break;
   if (Previous->Previous && Previous->Previous->is(tok::at))
 break;
-  if (isC78ParameterDecl(FormatTok)) {
+  if (!Line->Tokens.begin()->Tok->is(tok::kw_typedef) &&
+  isC78ParameterDecl(FormatTok)) {
 addUnwrappedLine();
 return;
   }


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8247,14 +8247,25 @@
"  return a + b < c;\n"
"};",
Style);
-  // The return breaking style doesn't affect object definitions with
-  // attribute-like macros.
+
+  // The return breaking style doesn't affect:
+  // * function and object definitions with attribute-like macros
   verifyFormat("Tttt ppp\n"
"ABSL_GUARDED_BY(mutex) = {};",
getGoogleStyleWithColumns(40));
   verifyFormat("Tttt ppp\n"
"ABSL_GUARDED_BY(mutex);  // comment",
getGoogleStyleWithColumns(40));
+  verifyFormat("Tttt ppp\n"
+   "ABSL_GUARDED_BY(mutex1)\n"
+   "ABSL_GUARDED_BY(mutex2);",
+   getGoogleStyleWithColumns(40));
+  verifyFormat("Tt f(int a, int b)\n"
+   "ABSL_GUARDED_BY(mutex1)\n"
+   "ABSL_GUARDED_BY(mutex2);",
+   getGoogleStyleWithColumns(40));
+  // * typedefs
+  verifyFormat("typedef ATTR(X) char x;", getGoogleStyle());
 
   Style = getGNUStyle();
 
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -14,6 +14,7 @@
 
 #include "UnwrappedLineParser.h"
 #include "FormatToken.h"
+#include "clang/Basic/TokenKinds.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
@@ -1007,7 +1008,7 @@
 
   if (!Tok->isOneOf(tok::kw_int, tok::kw_char, tok::kw_float, tok::kw_double,
 tok::kw_struct, tok::kw_union, tok::kw_long, tok::kw_short,
-tok::kw_unsigned, tok::kw_register, tok::identifier))
+tok::kw_

[clang-tools-extra] 39bbbc2 - [clang-tidy][docs] Remove the entry about 'cppcoreguidelines-init-variables' from the release notes

2021-08-12 Thread via cfe-commits

Author: Whisperity
Date: 2021-08-12T10:41:46+02:00
New Revision: 39bbbc2c2a2442f1a612fac27efc8a5cb77fe61a

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

LOG: [clang-tidy][docs] Remove the entry about 
'cppcoreguidelines-init-variables' from the release notes

The patch in http://reviews.llvm.org/D106431 landed in commit
4a097efe7784767b7d12ffcb8f2b22b9f4d045e2 to the main branch.
However, this patch was also backported to upcoming release 13.0.0 in
commit 8dcdfc0de84f60b5b4af97ac5b357881af55bc6e, which makes this entry
in the release notes **NOT** a new thing for the purposes of 14.0.0.

Added: 


Modified: 
clang-tools-extra/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index ae96b2bcf868..afa685d1fbdd 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -78,12 +78,6 @@ New check aliases
 Changes in existing checks
 ^^
 
-- Improved 
:doc:`cppcoreguidelines-init-variables`
 check.
-
-  Removed generating fixes for enums because the code generated was broken, 
trying to initialize the enum from an integer.
-
-  The check now also warns for uninitialized scoped enums.
-
 Removed checks
 ^^
 



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


[PATCH] D107952: [AMDGPU][OpenMP] Use llvm-link to link ocml libraries

2021-08-12 Thread Pushpinder Singh via Phabricator via cfe-commits
pdhaliwal created this revision.
pdhaliwal added reviewers: ronlieb, JonChesterfield.
Herald added subscribers: kerbowa, guansong, t-tye, tpr, dstuttard, yaxunl, 
nhaehnle, jvesely, kzhuravl.
pdhaliwal requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1, wdng.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

This fixes the 'unused linker option: -lm' warning when compiling
program with -c.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107952

Files:
  clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
  clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
  clang/test/Driver/amdgpu-openmp-toolchain.c

Index: clang/test/Driver/amdgpu-openmp-toolchain.c
===
--- clang/test/Driver/amdgpu-openmp-toolchain.c
+++ clang/test/Driver/amdgpu-openmp-toolchain.c
@@ -76,4 +76,5 @@
 // CHECK-EMIT-LLVM-IR: clang{{.*}}"-cc1"{{.*}}"-triple" "amdgcn-amd-amdhsa"{{.*}}"-emit-llvm"
 
 // RUN: env LIBRARY_PATH=%S/Inputs/hip_dev_lib %clang -### -target x86_64-pc-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -lm --rocm-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode %s 2>&1 | FileCheck %s --check-prefix=CHECK-LIB-DEVICE
-// CHECK-LIB-DEVICE: clang{{.*}}"-cc1"{{.*}}"-triple" "amdgcn-amd-amdhsa"{{.*}}"-mlink-builtin-bitcode"{{.*}}libomptarget-amdgcn-gfx803.bc"{{.*}}"-mlink-builtin-bitcode"{{.*}}ocml.bc" "-mlink-builtin-bitcode"{{.*}}ockl.bc" "-mlink-builtin-bitcode"{{.*}}oclc_daz_opt_on.bc" "-mlink-builtin-bitcode"{{.*}}oclc_unsafe_math_off.bc" "-mlink-builtin-bitcode"{{.*}}oclc_finite_only_off.bc" "-mlink-builtin-bitcode"{{.*}}oclc_correctly_rounded_sqrt_on.bc" "-mlink-builtin-bitcode"{{.*}}oclc_wavefrontsize64_on.bc" "-mlink-builtin-bitcode"{{.*}}oclc_isa_version_803.bc"
+// CHECK-LIB-DEVICE: {{.*}}llvm-link{{.*}}ocml.bc"{{.*}}ockl.bc"{{.*}}oclc_daz_opt_on.bc"{{.*}}oclc_unsafe_math_off.bc"{{.*}}oclc_finite_only_off.bc"{{.*}}oclc_correctly_rounded_sqrt_on.bc"{{.*}}oclc_wavefrontsize64_on.bc"{{.*}}oclc_isa_version_803.bc"
+// "llvm-link" "/tmp/amdgpu-openmp-toolchain-e9dcd9.bc" "/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/ocml.bc" "/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/ockl.bc" "/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_daz_opt_on.bc" "/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_unsafe_math_off.bc" "/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_finite_only_off.bc" "/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc" "/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_wavefrontsize64_on.bc" "/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_isa_version_803.bc" "-o" "/tmp/amdgpu-openmp-toolchain-e9dcd9-gfx803-linked-4095ab.bc"
Index: clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
===
--- clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
+++ clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
@@ -16,6 +16,10 @@
 namespace clang {
 namespace driver {
 
+namespace toolchains {
+class AMDGPUOpenMPToolChain;
+}
+
 namespace tools {
 
 namespace AMDGCN {
@@ -35,11 +39,11 @@
 
 private:
   /// \return llvm-link output file name.
-  const char *constructLLVMLinkCommand(Compilation &C, const JobAction &JA,
-   const InputInfoList &Inputs,
-   const llvm::opt::ArgList &Args,
-   llvm::StringRef SubArchName,
-   llvm::StringRef OutputFilePrefix) const;
+  const char *constructLLVMLinkCommand(
+  const toolchains::AMDGPUOpenMPToolChain &AMDGPUOpenMPTC, Compilation &C,
+  const JobAction &JA, const InputInfoList &Inputs,
+  const llvm::opt::ArgList &Args, llvm::StringRef SubArchName,
+  llvm::StringRef OutputFilePrefix) const;
 
   /// \return llc output file name.
   const char *constructLlcCommand(Compilation &C, const JobAction &JA,
Index: clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
===
--- clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+++ clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
@@ -86,14 +86,34 @@
 } // namespace
 
 const char *AMDGCN::OpenMPLinker::constructLLVMLinkCommand(
-Compilation &C, const JobAction &JA, const InputInfoList &Inputs,
-const ArgList &Args, StringRef SubArchName,
-StringRef OutputFilePrefix) const {
+const toolchains::AMDGPUOpenMPToolChain &AMDGPUOpenMPTC, Compilation &C,
+const JobAction &JA, const InputInfoList &Inputs, const ArgList &Args,
+StringRef SubArchName, StringRef OutputFilePrefix) const {
 

[PATCH] D105168: [RISCV] Unify the arch string parsing logic to RISCVISAInfo.

2021-08-12 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng added inline comments.



Comment at: llvm/lib/Support/RISCVISAInfo.cpp:41
+static const RISCVSupportedExtensionInfo SupportedExtensionInfos[] = {
+{"i", RISCVExtensionVersion{2, 0}}, {"e", RISCVExtensionVersion{1, 9}},
+{"m", RISCVExtensionVersion{2, 0}}, {"a", RISCVExtensionVersion{2, 0}},

jrtc27 wrote:
> I'd keep these all one per line
Although it's format by clang-format, but I like one per line too, let me 
manually update that.



Comment at: llvm/lib/Support/RISCVISAInfo.cpp:107
+struct FindByName {
+  FindByName(StringRef Ext) : Ext(Ext){};
+  StringRef Ext;

jrtc27 wrote:
> 
It's format by clang-format, but either is fine to me :P



Comment at: llvm/lib/Support/RISCVISAInfo.cpp:378
+llvm::find_if(ExtensionInfos, FindByName(ExtName));
+if (ExtensionInfoIterator == ExtensionInfos.end())
+  continue;

jrtc27 wrote:
> No error?..
Not all features is related to extension, like `relax` or `save-restore`, so 
here we just ignore, but add few comment here seem better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105168

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


[PATCH] D105168: [RISCV] Unify the arch string parsing logic to RISCVISAInfo.

2021-08-12 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng updated this revision to Diff 365941.
kito-cheng added a comment.

Changes:

- Rename class, strip the `Info`:
  - `RISCVSupportedExtensionInfo` -> `RISCVSupportedExtension`
- Rename variables:
  - `SupportedExtensionInfos` -> `SupportedExtensions`
  - `SupportedExperimentalExtensionInfos` -> `SupportedExperimentalExtensions`
- Change return type of parseArchString to 
`llvm::Expected>`
- Address @jrtc27's comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105168

Files:
  clang/lib/Basic/Targets/RISCV.cpp
  clang/lib/Basic/Targets/RISCV.h
  clang/lib/Driver/ToolChains/Arch/RISCV.cpp
  clang/test/Driver/riscv-abi.c
  clang/test/Driver/riscv-arch.c
  llvm/include/llvm/Support/RISCVISAInfo.h
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/RISCVISAInfo.cpp
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
  llvm/test/MC/RISCV/attribute-arch.s
  llvm/test/MC/RISCV/attribute-with-insts.s
  llvm/test/MC/RISCV/invalid-attribute.s

Index: llvm/test/MC/RISCV/invalid-attribute.s
===
--- llvm/test/MC/RISCV/invalid-attribute.s
+++ llvm/test/MC/RISCV/invalid-attribute.s
@@ -7,10 +7,10 @@
 # RUN: not llvm-mc %s -triple=riscv64 -filetype=asm 2>&1 | FileCheck %s
 
 .attribute arch, "foo"
-# CHECK: [[@LINE-1]]:18: error: bad arch string foo
+# CHECK: [[@LINE-1]]:18: error: invalid arch name 'foo', string must begin with rv32{i,e,g} or rv64{i,g}
 
 .attribute arch, "rv32i2p0_y2p0"
-# CHECK: [[@LINE-1]]:18: error: bad arch string y2p0
+# CHECK: [[@LINE-1]]:18: error: invalid arch name 'rv32i2p0_y2p0', invalid standard user-level extension 'y'
 
 .attribute stack_align, "16"
 # CHECK: [[@LINE-1]]:25: error: expected numeric constant
Index: llvm/test/MC/RISCV/attribute-with-insts.s
===
--- llvm/test/MC/RISCV/attribute-with-insts.s
+++ llvm/test/MC/RISCV/attribute-with-insts.s
@@ -10,7 +10,7 @@
 # RUN:   | llvm-objdump --triple=riscv64 -d -M no-aliases - \
 # RUN:   | FileCheck -check-prefix=CHECK-INST %s
 
-.attribute arch, "rv64i2p0_m2p0_a2p0_d2p0_c2p0"
+.attribute arch, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
 
 # CHECK-INST: lr.w t0, (t1)
 lr.w t0, (t1)
Index: llvm/test/MC/RISCV/attribute-arch.s
===
--- llvm/test/MC/RISCV/attribute-arch.s
+++ llvm/test/MC/RISCV/attribute-arch.s
@@ -9,9 +9,6 @@
 .attribute arch, "rv32i2"
 # CHECK: attribute  5, "rv32i2p0"
 
-.attribute arch, "rv32i2p"
-# CHECK: attribute  5, "rv32i2p0"
-
 .attribute arch, "rv32i2p0"
 # CHECK: attribute  5, "rv32i2p0"
 
@@ -33,14 +30,14 @@
 .attribute arch, "rv32ima2p0_fdc"
 # CHECK: attribute  5, "rv32i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
 
-.attribute arch, "rv32ima2p_fdc"
+.attribute arch, "rv32ima2p0_fdc"
 # CHECK: attribute  5, "rv32i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
 
 .attribute arch, "rv32ib"
 # CHECK: attribute  5, "rv32i2p0_b0p93_zba0p93_zbb0p93_zbc0p93_zbe0p93_zbf0p93_zbm0p93_zbp0p93_zbr0p93_zbs0p93_zbt0p93"
 
 .attribute arch, "rv32iv"
-# CHECK: attribute  5, "rv32i2p0_v0p10"
+# CHECK: attribute  5, "rv32i2p0_v0p10_zvlsseg0p10"
 
 .attribute arch, "rv32izba"
 # CHECK: attribute  5, "rv32i2p0_zba0p93"
Index: llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
===
--- llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
+++ llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
@@ -11,9 +11,11 @@
 //===--===//
 
 #include "RISCVTargetStreamer.h"
+#include "RISCVBaseInfo.h"
 #include "RISCVMCTargetDesc.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/RISCVAttributes.h"
+#include "llvm/Support/RISCVISAInfo.h"
 
 using namespace llvm;
 
@@ -43,57 +45,13 @@
   else
 emitAttribute(RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_16);
 
-  std::string Arch = "rv32";
-  if (STI.hasFeature(RISCV::Feature64Bit))
-Arch = "rv64";
-  if (STI.hasFeature(RISCV::FeatureRV32E))
-Arch += "e1p9";
-  else
-Arch += "i2p0";
-  if (STI.hasFeature(RISCV::FeatureStdExtM))
-Arch += "_m2p0";
-  if (STI.hasFeature(RISCV::FeatureStdExtA))
-Arch += "_a2p0";
-  if (STI.hasFeature(RISCV::FeatureStdExtF))
-Arch += "_f2p0";
-  if (STI.hasFeature(RISCV::FeatureStdExtD))
-Arch += "_d2p0";
-  if (STI.hasFeature(RISCV::FeatureStdExtC))
-Arch += "_c2p0";
-  if (STI.hasFeature(RISCV::FeatureStdExtB))
-Arch += "_b0p93";
-  if (STI.hasFeature(RISCV::FeatureStdExtV))
-Arch += "_v0p10";
-  if (STI.hasFeature(RISCV::FeatureExtZfh))
-Arch += "_zfh0p1";
-  if (STI.hasFeature(RISCV::FeatureExtZba))
-

[PATCH] D97803: [clangd] Overload bundles are only deprecated if each overloads is.

2021-08-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev accepted this revision.
kbobyrev added a comment.
This revision is now accepted and ready to land.

I see, thank you very much for the explanation!




Comment at: clang-tools-extra/clangd/CodeComplete.cpp:410
+if (Completion.Deprecated) {
+  Completion.Deprecated =
+  (C.SemaResult &&

sammccall wrote:
> kbobyrev wrote:
> > The comment you added says "cleared" which means this should probably be 
> > `|=` rather than `=`, right?
> > 
> > Also, I this looks longer but probably more readable at least for me.
> > 
> > Also, the sources might be `SemaResult`, `IndexResult` or 
> > `IdentifierResult`, right? :( Otherwise could've been 
> > `Completion.Deprecated |= C.SemaResult ? C.SemaResult->Availability == 
> > CXAvailability_Deprecated : C.IndexResult->Flags & Symbol::Deprecated;`
> > The comment you added says "cleared" which means this should probably be |= 
> > rather than =, right?
> 
> No, `Deprecated` *starts out true* and gets set to false (cleared) if we see 
> any non-deprecated entry. (computes AND)
> 
> Your version assumes it starts out false and sets it if we see any deprecated 
> entry. (computes OR).
> 
> I agree the OR version reads better - it's wrong though :-)
Ahh, okay, makes sense, thank you!

Nit: I think the version I suggested (with fixes `|=` vs `=`) is somewhat 
easier to read and doesn't take much more space.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97803

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


[clang] a1ef81d - [Matrix] Overload stride arg in matrix.columnwise.load/store.

2021-08-12 Thread Florian Hahn via cfe-commits

Author: Florian Hahn
Date: 2021-08-12T10:45:25+01:00
New Revision: a1ef81de35a4bac6d3b22e9d7186d880124d7a55

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

LOG: [Matrix] Overload stride arg in matrix.columnwise.load/store.

This patch adjusts the intrinsics definition of
llvm.matrix.column.major.load and llvm.matrix.column.major.store to
allow overloading the type of the stride. The bitwidth of the stride is
used to perform the offset computation.

This fixes a crash when using __builtin_matrix_column_major_load or
__builtin_matrix_column_major_store on 32 bit platforms. The stride argument
of the builtins are defined as `size_t`, which is 32 bits wide on 32 bit
platforms.

Note that we still perform offset computations with 64 bit width on 32
bit platforms for accesses that do not take a user-specified stride.
This can be fixed separately.

Fixes PR51304.

Reviewed By: erichkeane

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

Added: 


Modified: 
clang/test/CodeGen/matrix-type-builtins.c
clang/test/CodeGenCXX/matrix-type-builtins.cpp
clang/test/CodeGenObjC/matrix-type-builtins.m
llvm/docs/LangRef.rst
llvm/include/llvm/IR/Intrinsics.td
llvm/include/llvm/IR/MatrixBuilder.h
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-double.ll
llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-double.ll
llvm/test/Verifier/matrix-intrinsics.ll

Removed: 




diff  --git a/clang/test/CodeGen/matrix-type-builtins.c 
b/clang/test/CodeGen/matrix-type-builtins.c
index 67f5c78196878..ec0be85b7151e 100644
--- a/clang/test/CodeGen/matrix-type-builtins.c
+++ b/clang/test/CodeGen/matrix-type-builtins.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm 
-disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm 
-disable-llvm-passes -o - | FileCheck --check-prefixes=COMMON,CHECK64 %s
+// RUN: %clang_cc1 -fenable-matrix -triple i386-apple-darwin %s -emit-llvm 
-disable-llvm-passes -o - | FileCheck --check-prefixes=COMMON,CHECK32 %s
 
 // Also check we do not crash when running some middle-end passes. Most
 // importantly this includes the IR verifier, to ensure we emit valid IR.
@@ -15,30 +16,33 @@ typedef unsigned ux1x6_t __attribute__((matrix_type(1, 6)));
 typedef unsigned ux6x1_t __attribute__((matrix_type(6, 1)));
 
 void transpose_double_5x5(dx5x5_t *a) {
-  // CHECK-LABEL: define{{.*}} void @transpose_double_5x5(
-  // CHECK:[[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, 
align 8
-  // CHECK-NEXT:   [[TRANS:%.*]] = call <25 x double> 
@llvm.matrix.transpose.v25f64(<25 x double> [[A]], i32 5, i32 5)
-  // CHECK-NEXT:   [[AT_ADDR:%.*]] = bitcast [25 x double]* %a_t to <25 x 
double>*
-  // CHECK-NEXT:   store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], 
align 8
+  // COMMON-LABEL: define{{.*}} void @transpose_double_5x5(
+  // CHECK32:   [[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, 
align 4
+  // CHECK64:   [[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, 
align 8
+  // COMMON-NEXT:   [[TRANS:%.*]] = call <25 x double> 
@llvm.matrix.transpose.v25f64(<25 x double> [[A]], i32 5, i32 5)
+  // COMMON-NEXT:   [[AT_ADDR:%.*]] = bitcast [25 x double]* %a_t to <25 x 
double>*
+  // CHECK32-NEXT:  store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], 
align 4
+  // CHECK64-NEXT:  store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], 
align 8
+
   dx5x5_t a_t = __builtin_matrix_transpose(*a);
 }
 
 void transpose_float_3x2(fx3x2_t *a) {
-  // CHECK-LABEL: define{{.*}} void @transpose_float_3x2(
-  // CHECK:[[A:%.*]] = load <6 x float>, <6 x float>* {{.*}}, align 4
-  // CHECK-NEXT:   [[TRANS:%.*]] = call <6 x float> 
@llvm.matrix.transpose.v6f32(<6 x float> [[A]], i32 3, i32 2)
-  // CHECK-NEXT:   [[AT_ADDR:%.*]] = bitcast [6 x float]* %a_t to <6 x float>*
-  // CHECK-NEXT:   store <6 x float> [[TRANS]], <6 x float>* [[AT_ADDR]], 
align 4
+  // COMMON-LABEL: define{{.*}} void @transpose_float_3x2(
+  // COMMON:[[A:%.*]] = load <6 x float>, <6 x float>* {{.*}}, align 4
+  // COMMON-NEXT:   [[TRANS:%.*]] = call <6 x float> 
@llvm.matrix.transpose.v6f32(<6 x float> [[A]], i32 3, i32 2)
+  // COMMON-NEXT:   [[AT_ADDR:%.*]] = bitcast [6 x float]* %a_t to <6 x float>*
+  // COMMON-NEXT:   store <6 x float> [[TRANS]], <6 x float>* [[AT_ADDR]], 
align 4
 
   fx2x3_t a_t = __builtin_matrix_transpose(*a);
 }
 
 void transpose_int_20x4(ix20x4_t *a) {
-  // CHECK-LABEL: define{{.*}} void @transpose_int_20x4(
-  // CHECK: [[A:%.*]] = load <80 x i32>, <80 x i32>* {{.*}}, align 4
-  // CHECK-NEXT:[[TRANS:%.*]] = call <80 x 

[PATCH] D107349: [Matrix] Overload stride arg in matrix.columnwise.load/store.

2021-08-12 Thread Florian Hahn via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa1ef81de35a4: [Matrix] Overload stride arg in 
matrix.columnwise.load/store. (authored by fhahn).

Changed prior to commit:
  https://reviews.llvm.org/D107349?vs=363723&id=365949#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107349

Files:
  clang/test/CodeGen/matrix-type-builtins.c
  clang/test/CodeGenCXX/matrix-type-builtins.cpp
  clang/test/CodeGenObjC/matrix-type-builtins.m
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/Intrinsics.td
  llvm/include/llvm/IR/MatrixBuilder.h
  llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
  llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-double.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-double.ll
  llvm/test/Verifier/matrix-intrinsics.ll

Index: llvm/test/Verifier/matrix-intrinsics.ll
===
--- llvm/test/Verifier/matrix-intrinsics.ll
+++ llvm/test/Verifier/matrix-intrinsics.ll
@@ -39,11 +39,11 @@
 ; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
 ; CHECK-NEXT: immarg operand has non-immediate parameter
 ; CHECK-NEXT: i32 %arg
-; CHECK-NEXT:   %result.3 = call <6 x float> @llvm.matrix.column.major.load.v6f32(float* %n, i64 2, i1 true, i32 3, i32 %arg)
-  %result.0 = call <4 x float> @llvm.matrix.column.major.load.v4f32(float* %m, i64 0, i1 false, i32 0, i32 0)
-  %result.1 = call <4 x float> @llvm.matrix.column.major.load.v4f32(float* %m, i64 2, i1 false, i32 1, i32 2)
-  %result.2 = call <6 x float> @llvm.matrix.column.major.load.v6f32(float* %n, i64 2, i1 true, i32 3, i32 3)
-  %result.3 = call <6 x float> @llvm.matrix.column.major.load.v6f32(float* %n, i64 2, i1 true, i32 3, i32 %arg)
+; CHECK-NEXT:   %result.3 = call <6 x float> @llvm.matrix.column.major.load.v6f32.i64(float* %n, i64 2, i1 true, i32 3, i32 %arg)
+  %result.0 = call <4 x float> @llvm.matrix.column.major.load.v4f32.i64(float* %m, i64 0, i1 false, i32 0, i32 0)
+  %result.1 = call <4 x float> @llvm.matrix.column.major.load.v4f32.i64(float* %m, i64 2, i1 false, i32 1, i32 2)
+  %result.2 = call <6 x float> @llvm.matrix.column.major.load.v6f32.i64(float* %n, i64 2, i1 true, i32 3, i32 3)
+  %result.3 = call <6 x float> @llvm.matrix.column.major.load.v6f32.i64(float* %n, i64 2, i1 true, i32 3, i32 %arg)
   ret <4 x float> %result.1
 }
 
@@ -52,10 +52,10 @@
 ; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
 ; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
 ; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
-  call void @llvm.matrix.column.major.store.v4f32(<4 x float> zeroinitializer, float* %m, i64 0, i1 false, i32 0, i32 0)
-  call void @llvm.matrix.column.major.store.v4f32(<4 x float> zeroinitializer, float* %m, i64 2, i1 false, i32 1, i32 2)
-  call void @llvm.matrix.column.major.store.v6f32(<6 x float> zeroinitializer, float* %n, i64 2, i1 false, i32 3, i32 3)
-  call void @llvm.matrix.column.major.store.v6f32(<6 x float> zeroinitializer, float* %n, i64 %arg, i1 false, i32 3, i32 3)
+  call void @llvm.matrix.column.major.store.v4f32.i64(<4 x float> zeroinitializer, float* %m, i64 0, i1 false, i32 0, i32 0)
+  call void @llvm.matrix.column.major.store.v4f32.i64(<4 x float> zeroinitializer, float* %m, i64 2, i1 false, i32 1, i32 2)
+  call void @llvm.matrix.column.major.store.v6f32.i64(<6 x float> zeroinitializer, float* %n, i64 2, i1 false, i32 3, i32 3)
+  call void @llvm.matrix.column.major.store.v6f32.i64(<6 x float> zeroinitializer, float* %n, i64 %arg, i1 false, i32 3, i32 3)
   ret void
 }
 
@@ -94,18 +94,18 @@
 ; CHECK-NEXT: Intrinsic has incorrect argument type!
 ; CHECK-NEXT: <4 x float> (i32*, i64, i1, i32, i32)* @llvm.matrix.column.major.load.v4f32.pi32
 ; CHECK-NEXT: Intrinsic has incorrect argument type!
-; CHECK-NEXT: <4 x i32> (float*, i64, i1, i32, i32)* @llvm.matrix.column.major.load.v4i32
+; CHECK-NEXT: <4 x i32> (float*, i64, i1, i32, i32)* @llvm.matrix.column.major.load.v4i32.i64
 ;
   %result.0 = call <4 x float> @llvm.matrix.column.major.load.v4f32.pi32(i32* %m, i64 2, i1 false, i32 2, i32 2)
-  %result.1 = call <4 x i32> @llvm.matrix.column.major.load.v4i32(float* %n, i64 2, i1 false, i32 2, i32 2)
+  %result.1 = call <4 x i32> @llvm.matrix.column.major.load.v4i32.i64(float* %n, i64 2, i1 false, i32 2, i32 2)
   ret <4 x float> %result.0
 }
 
 define void @column.major_store_mixed_types(float* %m, i32* %n, i64 %arg) {
 ;
-; CHECK-NEXT: Intrinsic has incorrect argument type! 
+; CHECK-NEXT: Intrinsic has incorrect argument type!
 ; CHECK-NEXT: void (<4 x i32>, float*, i64, i1, i32, i32)* @llvm.matrix.column.major.store.v4i32.vi32
-; CHECK-NEXT: Intrinsic has incorrect argument type! 
+; CHECK-NEXT: Intrinsic has incorrect argument typ

[PATCH] D107349: [Matrix] Overload stride arg in matrix.columnwise.load/store.

2021-08-12 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

In D107349#2922208 , @erichkeane 
wrote:

> This looks fine to me, and seems to fix my problem, thanks!  I didn't spot 
> anything obvious,and proof-read the LangRef and think it is all fine, but am 
> not really the expert here, so please don't commit without the others having 
> a day or two to comment.

Thanks! I landed the change as there have not been any further comments in a 
while.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107349

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


[clang] 5ed9e5c - [clang] [MinGW] Consider the per-target libc++ include directory too

2021-08-12 Thread Martin Storsjö via cfe-commits

Author: Martin Storsjö
Date: 2021-08-12T13:27:09+03:00
New Revision: 5ed9e5c2c0ee9a77ed4a2a5bd817b03acf78fbac

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

LOG: [clang] [MinGW] Consider the per-target libc++ include directory too

The existing logic for per-target libc++ include directories only
seem to exist for the Gnu and Fuchsia drivers, added in
ea12d779bc238c387511fe7462020f4ecf4a8246 / D89013.

This is less generic than the corresponding case in the Gnu driver,
but matches the existing level of genericity in the MinGW driver
(and others too).

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

Added: 

clang/test/Driver/Inputs/mingw_clang_tree/mingw32/include/i686-unknown-windows-gnu/c++/v1/.keep

Modified: 
clang/lib/Driver/ToolChains/MinGW.cpp
clang/test/Driver/mingw.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/MinGW.cpp 
b/clang/lib/Driver/ToolChains/MinGW.cpp
index 7ba729f36bd87..1aaa941498322 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -588,12 +588,18 @@ void toolchains::MinGW::AddClangCXXStdlibIncludeArgs(
   StringRef Slash = llvm::sys::path::get_separator();
 
   switch (GetCXXStdlibType(DriverArgs)) {
-  case ToolChain::CST_Libcxx:
+  case ToolChain::CST_Libcxx: {
+std::string TargetDir = (Base + "include" + Slash + getTripleString() +
+ Slash + "c++" + Slash + "v1")
+.str();
+if (getDriver().getVFS().exists(TargetDir))
+  addSystemInclude(DriverArgs, CC1Args, TargetDir);
 addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" +
   Slash + "c++" + Slash + "v1");
 addSystemInclude(DriverArgs, CC1Args,
  Base + "include" + Slash + "c++" + Slash + "v1");
 break;
+  }
 
   case ToolChain::CST_Libstdcxx:
 llvm::SmallVector, 4> CppIncludeBases;

diff  --git 
a/clang/test/Driver/Inputs/mingw_clang_tree/mingw32/include/i686-unknown-windows-gnu/c++/v1/.keep
 
b/clang/test/Driver/Inputs/mingw_clang_tree/mingw32/include/i686-unknown-windows-gnu/c++/v1/.keep
new file mode 100644
index 0..e69de29bb2d1d

diff  --git a/clang/test/Driver/mingw.cpp b/clang/test/Driver/mingw.cpp
index 83b61ba7d33f0..4d573f0f2125c 100644
--- a/clang/test/Driver/mingw.cpp
+++ b/clang/test/Driver/mingw.cpp
@@ -4,6 +4,7 @@
 
 
 // RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s
+// CHECK_MINGW_CLANG_TREE_LIBCXX: 
"[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|}}include{{/|}}i686-unknown-windows-gnu{{/|}}c++{{/|}}v1"
 // CHECK_MINGW_CLANG_TREE_LIBCXX: 
"[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}v1"
 
 



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


[PATCH] D107893: [clang] [MinGW] Consider the per-target libc++ include directory too

2021-08-12 Thread Martin Storsjö via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5ed9e5c2c0ee: [clang] [MinGW] Consider the per-target libc++ 
include directory too (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D107893?vs=365720&id=365953#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107893

Files:
  clang/lib/Driver/ToolChains/MinGW.cpp
  
clang/test/Driver/Inputs/mingw_clang_tree/mingw32/include/i686-unknown-windows-gnu/c++/v1/.keep
  clang/test/Driver/mingw.cpp


Index: clang/test/Driver/mingw.cpp
===
--- clang/test/Driver/mingw.cpp
+++ clang/test/Driver/mingw.cpp
@@ -4,6 +4,7 @@
 
 
 // RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s
+// CHECK_MINGW_CLANG_TREE_LIBCXX: 
"[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|}}include{{/|}}i686-unknown-windows-gnu{{/|}}c++{{/|}}v1"
 // CHECK_MINGW_CLANG_TREE_LIBCXX: 
"[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}v1"
 
 
Index: clang/lib/Driver/ToolChains/MinGW.cpp
===
--- clang/lib/Driver/ToolChains/MinGW.cpp
+++ clang/lib/Driver/ToolChains/MinGW.cpp
@@ -588,12 +588,18 @@
   StringRef Slash = llvm::sys::path::get_separator();
 
   switch (GetCXXStdlibType(DriverArgs)) {
-  case ToolChain::CST_Libcxx:
+  case ToolChain::CST_Libcxx: {
+std::string TargetDir = (Base + "include" + Slash + getTripleString() +
+ Slash + "c++" + Slash + "v1")
+.str();
+if (getDriver().getVFS().exists(TargetDir))
+  addSystemInclude(DriverArgs, CC1Args, TargetDir);
 addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" +
   Slash + "c++" + Slash + "v1");
 addSystemInclude(DriverArgs, CC1Args,
  Base + "include" + Slash + "c++" + Slash + "v1");
 break;
+  }
 
   case ToolChain::CST_Libstdcxx:
 llvm::SmallVector, 4> CppIncludeBases;


Index: clang/test/Driver/mingw.cpp
===
--- clang/test/Driver/mingw.cpp
+++ clang/test/Driver/mingw.cpp
@@ -4,6 +4,7 @@
 
 
 // RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s
+// CHECK_MINGW_CLANG_TREE_LIBCXX: "[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|}}include{{/|}}i686-unknown-windows-gnu{{/|}}c++{{/|}}v1"
 // CHECK_MINGW_CLANG_TREE_LIBCXX: "[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}v1"
 
 
Index: clang/lib/Driver/ToolChains/MinGW.cpp
===
--- clang/lib/Driver/ToolChains/MinGW.cpp
+++ clang/lib/Driver/ToolChains/MinGW.cpp
@@ -588,12 +588,18 @@
   StringRef Slash = llvm::sys::path::get_separator();
 
   switch (GetCXXStdlibType(DriverArgs)) {
-  case ToolChain::CST_Libcxx:
+  case ToolChain::CST_Libcxx: {
+std::string TargetDir = (Base + "include" + Slash + getTripleString() +
+ Slash + "c++" + Slash + "v1")
+.str();
+if (getDriver().getVFS().exists(TargetDir))
+  addSystemInclude(DriverArgs, CC1Args, TargetDir);
 addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" +
   Slash + "c++" + Slash + "v1");
 addSystemInclude(DriverArgs, CC1Args,
  Base + "include" + Slash + "c++" + Slash + "v1");
 break;
+  }
 
   case ToolChain::CST_Libstdcxx:
 llvm::SmallVector, 4> CppIncludeBases;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D97753: [clang-tidy] Add a check for enforcing minimum length for variable names

2021-08-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D97753#2940414 , @0x8000- wrote:

> @aaron.ballman - thank you for the review; please submit on my behalf.

Happy to do so, which name and email address would you like me to use for patch 
attribution?


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

https://reviews.llvm.org/D97753

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


[clang] f52fc59 - [flang][driver] Add support for Frontend Plugins

2021-08-12 Thread Andrzej Warzynski via cfe-commits

Author: Stuart Ellis
Date: 2021-08-12T11:42:16+01:00
New Revision: f52fc591fa34a8c85577108358b3b36c42b6d364

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

LOG: [flang][driver] Add support for Frontend Plugins

Introducing a plugin API and a simple HelloWorld Plugin example.
This patch adds the `-load` and `-plugin` flags to frontend driver and
the code around using custom frontend actions from within a plugin
shared library object.

It also adds to the Driver-help test to check the help option with the
updated driver flags.

Additionally, the patch creates a plugin-example test to check the
HelloWorld plugin example runs correctly. As part of this, a new CMake
flag (`FLANG_BUILD_EXAMPLES`) is added to allow the example to be built
and for the test to run.

This Plugin API has only been tested on Linux.

Reviewed By: awarzynski

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

Added: 
flang/examples/HelloWorld/CMakeLists.txt
flang/examples/HelloWorld/HelloWorldPlugin.cpp
flang/include/flang/Frontend/FrontendPluginRegistry.h
flang/test/Driver/plugin-example.f90

Modified: 
clang/include/clang/Driver/Options.td
flang/CMakeLists.txt
flang/examples/CMakeLists.txt
flang/include/flang/Frontend/FrontendActions.h
flang/include/flang/Frontend/FrontendOptions.h
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Frontend/FrontendAction.cpp
flang/lib/Frontend/FrontendActions.cpp
flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
flang/test/CMakeLists.txt
flang/test/Driver/driver-help.f90
flang/test/lit.cfg.py
flang/test/lit.site.cfg.py.in
flang/tools/flang-driver/CMakeLists.txt

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 7525795bf9d3c..a91114f76ff07 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5266,10 +5266,6 @@ def enable_noundef_analysis : Flag<["-"], 
"enable-noundef-analysis">, Group,
   HelpText<"Discard value names in LLVM IR">,
   MarshallingInfoFlag>;
-def load : Separate<["-"], "load">, MetaVarName<"">,
-  HelpText<"Load the named plugin (dynamic shared object)">;
-def plugin : Separate<["-"], "plugin">, MetaVarName<"">,
-  HelpText<"Use the named plugin action instead of the default action (use 
\"help\" to list available options)">;
 def plugin_arg : JoinedAndSeparate<["-"], "plugin-arg-">,
 MetaVarName<" ">,
 HelpText<"Pass  to plugin ">;
@@ -5836,6 +5832,12 @@ def init_only : Flag<["-"], "init-only">,
   HelpText<"Only execute frontend initialization">;
 
 } // let Group = Action_Group
+
+def load : Separate<["-"], "load">, MetaVarName<"">,
+  HelpText<"Load the named plugin (dynamic shared object)">;
+def plugin : Separate<["-"], "plugin">, MetaVarName<"">,
+  HelpText<"Use the named plugin action instead of the default action (use 
\"help\" to list available options)">;
+
 } // let Flags = [CC1Option, FC1Option, NoDriverOption]
 
 
//===--===//

diff  --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index fc85f44513163..cf6055075c383 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -390,6 +390,8 @@ if (FLANG_BUILD_TOOLS)
   add_subdirectory(tools)
 endif()
 add_subdirectory(runtime)
+
+option(FLANG_BUILD_EXAMPLES "Build Flang example programs by default." OFF)
 add_subdirectory(examples)
 
 if (FLANG_INCLUDE_TESTS)

diff  --git a/flang/examples/CMakeLists.txt b/flang/examples/CMakeLists.txt
index 3ca9feddf33e9..c4ef3bf20d4b0 100644
--- a/flang/examples/CMakeLists.txt
+++ b/flang/examples/CMakeLists.txt
@@ -1,3 +1,7 @@
+if(NOT FLANG_BUILD_EXAMPLES)
+  set(EXCLUDE_FROM_ALL ON)
+endif()
+
 # This test is not run by default as it requires input.
 add_executable(external-hello-world
   external-hello.cpp
@@ -6,3 +10,5 @@ add_executable(external-hello-world
 target_link_libraries(external-hello-world
   FortranRuntime
 )
+
+add_subdirectory(HelloWorld)

diff  --git a/flang/examples/HelloWorld/CMakeLists.txt 
b/flang/examples/HelloWorld/CMakeLists.txt
new file mode 100644
index 0..8552284c80529
--- /dev/null
+++ b/flang/examples/HelloWorld/CMakeLists.txt
@@ -0,0 +1,7 @@
+# TODO: Note that this is currently only available on Linux.
+# On Windows, we would also have to specify e.g. `PLUGIN_TOOL`.
+add_llvm_library(
+flangHelloWorldPlugin
+MODULE
+HelloWorldPlugin.cpp
+)

diff  --git a/flang/examples/HelloWorld/HelloWorldPlugin.cpp 
b/flang/examples/HelloWorld/HelloWorldPlugin.cpp
new file mode 100644
index 0..11100384aed9f
--- /dev/null
+++ b/flang/examples/HelloWorld/HelloWorldPlugin.cpp
@@ -0,0 +1,25 @@
+//===-- HelloWorldPlugin.cpp 
---

[PATCH] D106137: [flang][driver] Add support for Frontend Plugins

2021-08-12 Thread Andrzej Warzynski via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf52fc591fa34: [flang][driver] Add support for Frontend 
Plugins (authored by stuartellis, committed by awarzynski).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106137

Files:
  clang/include/clang/Driver/Options.td
  flang/CMakeLists.txt
  flang/examples/CMakeLists.txt
  flang/examples/HelloWorld/CMakeLists.txt
  flang/examples/HelloWorld/HelloWorldPlugin.cpp
  flang/include/flang/Frontend/FrontendActions.h
  flang/include/flang/Frontend/FrontendOptions.h
  flang/include/flang/Frontend/FrontendPluginRegistry.h
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/lib/Frontend/FrontendAction.cpp
  flang/lib/Frontend/FrontendActions.cpp
  flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
  flang/test/CMakeLists.txt
  flang/test/Driver/driver-help.f90
  flang/test/Driver/plugin-example.f90
  flang/test/lit.cfg.py
  flang/test/lit.site.cfg.py.in
  flang/tools/flang-driver/CMakeLists.txt

Index: flang/tools/flang-driver/CMakeLists.txt
===
--- flang/tools/flang-driver/CMakeLists.txt
+++ flang/tools/flang-driver/CMakeLists.txt
@@ -27,4 +27,11 @@
   clangBasic
 )
 
+option(FLANG_PLUGIN_SUPPORT "Build Flang with plugin support." ON)
+
+# Enable support for plugins, which need access to symbols from flang-new
+if(FLANG_PLUGIN_SUPPORT)
+  export_executable_symbols_for_plugins(flang-new)
+endif()
+
 install(TARGETS flang-new DESTINATION bin)
Index: flang/test/lit.site.cfg.py.in
===
--- flang/test/lit.site.cfg.py.in
+++ flang/test/lit.site.cfg.py.in
@@ -3,6 +3,8 @@
 import sys
 
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+config.llvm_shlib_dir = path(r"@SHLIBDIR@")
+config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@"
 config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
 config.flang_obj_root = "@FLANG_BINARY_DIR@"
 config.flang_src_dir = "@FLANG_SOURCE_DIR@"
@@ -10,8 +12,10 @@
 config.flang_intrinsic_modules_dir = "@FLANG_INTRINSIC_MODULES_DIR@"
 config.flang_llvm_tools_dir = "@CMAKE_BINARY_DIR@/bin"
 config.flang_lib_dir = "@CMAKE_BINARY_DIR@/lib"
+config.flang_examples = @FLANG_BUILD_EXAMPLES@
 config.python_executable = "@PYTHON_EXECUTABLE@"
 config.flang_standalone_build = @FLANG_STANDALONE_BUILD@
+config.has_plugins = @LLVM_ENABLE_PLUGINS@
 config.cc = "@CMAKE_C_COMPILER@"
 
 # Support substitution of the tools_dir with user parameters. This is
@@ -19,6 +23,7 @@
 try:
 config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
 config.flang_tools_dir = config.flang_tools_dir % lit_config.params
+config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
 except KeyError:
 e = sys.exc_info()[1]
 key, = e.args
Index: flang/test/lit.cfg.py
===
--- flang/test/lit.cfg.py
+++ flang/test/lit.cfg.py
@@ -30,6 +30,8 @@
'.CUF', '.f18', '.F18', '.fir', '.f03', '.F03', '.f08', '.F08']
 
 config.substitutions.append(('%PATH%', config.environment['PATH']))
+config.substitutions.append(('%llvmshlibdir', config.llvm_shlib_dir))
+config.substitutions.append(('%pluginext', config.llvm_plugin_ext))
 
 llvm_config.use_default_substitutions()
 
@@ -42,6 +44,14 @@
 # config.
 config.available_features.add('new-flang-driver')
 
+# If the flang examples are built, add examples to the config
+if config.flang_examples:
+config.available_features.add('examples')
+
+# Plugins (loadable modules)
+if config.has_plugins:
+config.available_features.add('plugins')
+
 # test_source_root: The root path where tests are located.
 config.test_source_root = os.path.dirname(__file__)
 
Index: flang/test/Driver/plugin-example.f90
===
--- /dev/null
+++ flang/test/Driver/plugin-example.f90
@@ -0,0 +1,11 @@
+! Check that loading and running the Hello World plugin example results in the correct print statement
+! Also check that when a plugin name isn't found, the error diagnostic is correct
+! This requires that the examples are built (FLANG_BUILD_EXAMPLES=ON)
+
+! REQUIRES: new-flang-driver, plugins, examples, shell
+
+! RUN: %flang_fc1 -load %llvmshlibdir/flangHelloWorldPlugin%pluginext -plugin -hello-world %s 2>&1 | FileCheck %s
+! CHECK: Hello World from your new Flang plugin
+
+! RUN: not %flang_fc1 -load %llvmshlibdir/flangHelloWorldPlugin%pluginext -plugin -wrong-name %s 2>&1 | FileCheck %s --check-prefix=ERROR
+! ERROR: error: unable to find plugin '-wrong-name'
Index: flang/test/Driver/driver-help.f90
===
--- flang/test/Driver/driver-help.f90
+++ flang/test/Driver/driver-help.f90
@@ -123,11 +123,13 @@
 ! HELP-FC1-NEXT: -help  Display av

[PATCH] D106509: [OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2)

2021-08-12 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/include/clang/Driver/Options.td:2382-2385
+def fopenmp_extensions : Flag<["-"], "fopenmp-extensions">, Group,
+ Flags<[CC1Option, NoArgumentUnused]>;
+def fno_openmp_extensions : Flag<["-"], "fno-openmp-extensions">, 
Group,
+Flags<[NoArgumentUnused]>;

Use marshalling, if possible



Comment at: clang/lib/Basic/OpenMPKinds.cpp:64
+  return OMPC_MAP_MODIFIER_unknown;
+if (!LangOpts.OpenMPExtensions && Type == OMPC_MAP_MODIFIER_ompx_hold)
   return OMPC_MAP_MODIFIER_unknown;

I would enable this since OpenMP 5.2, since in 5.2 `ompx_` is officially 
allowed extension format.


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

https://reviews.llvm.org/D106509

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


[PATCH] D107703: [AST][clangd] Expose documentation of Attrs on hover.

2021-08-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/unittests/AST/AttrTest.cpp:19
+TEST(Attr, Doc) {
+  EXPECT_THAT(Attr::getDocumentation(attr::Used),
+  testing::HasSubstr("The compiler must emit the definition even "

It seems this is failing the premerge CI -- I think you need a call to `.str()` 
in here to convert the `StringRef` to a `std::string`?



Comment at: clang/utils/TableGen/ClangAttrEmitter.cpp:4237
+  static const llvm::StringRef AttrDoc[] = {
+  #define ATTR(NAME) AttrDoc_##NAME,
+  #include "clang/Basic/AttrList.inc"

kadircet wrote:
> i am not well-versed in tablegen, so sorry if i am being dense here, butt 
> what happens to the attributes we skipped above (e.g. the ones without a 
> `ASTNode` flag)?
> 
> Maybe we should be emitting a `... AttrDoc_X[] = "";` for all attributes, no 
> matter what?
The ones without an AST node don't get an `attr::Kind` enumeration generated 
for them, so I believe this interface is safe.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107703

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


[PATCH] D102478: [Matrix] Emit assumption that matrix indices are valid.

2021-08-12 Thread Florian Hahn via Phabricator via cfe-commits
fhahn updated this revision to Diff 365959.
fhahn added a comment.

rebased after latest changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102478

Files:
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/test/CodeGen/matrix-type-operators.c
  clang/test/CodeGenCXX/matrix-type-operators.cpp
  clang/test/CodeGenObjC/matrix-type-operators.m
  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
@@ -231,9 +231,23 @@
: (IsUnsigned ? B.CreateUDiv(LHS, RHS) : B.CreateSDiv(LHS, RHS));
   }
 
-  /// Extracts the element at (\p RowIdx, \p ColumnIdx) from \p Matrix.
-  Value *CreateExtractElement(Value *Matrix, Value *RowIdx, Value *ColumnIdx,
-  unsigned NumRows, Twine const &Name = "") {
+  /// Create an assumption that \p Idx is less than \p NumElements.
+  void CreateIndexAssumption(Value *Idx, unsigned NumElements,
+ Twine const &Name = "") {
+
+Value *NumElts =
+B.getIntN(Idx->getType()->getScalarSizeInBits(), NumElements);
+auto *Cmp = B.CreateICmpULT(Idx, NumElts);
+if (auto *ConstCond = dyn_cast(Cmp))
+  assert(ConstCond->isOne() && "Index must be valid!");
+else
+  B.CreateAssumption(Cmp);
+  }
+
+  /// Compute the index to access the element at (\p RowIdx, \p ColumnIdx) from
+  /// a matrix with \p NumRows embedded in a vector.
+  Value *CreateIndex(Value *RowIdx, Value *ColumnIdx, unsigned NumRows,
+ Twine const &Name = "") {
 
 unsigned MaxWidth = std::max(RowIdx->getType()->getScalarSizeInBits(),
  ColumnIdx->getType()->getScalarSizeInBits());
@@ -241,9 +255,7 @@
 RowIdx = B.CreateZExt(RowIdx, IntTy);
 ColumnIdx = B.CreateZExt(ColumnIdx, IntTy);
 Value *NumRowsV = B.getIntN(MaxWidth, NumRows);
-return B.CreateExtractElement(
-Matrix, B.CreateAdd(B.CreateMul(ColumnIdx, NumRowsV), RowIdx),
-"matext");
+return B.CreateAdd(B.CreateMul(ColumnIdx, NumRowsV), RowIdx);
   }
 };
 
Index: clang/test/CodeGenObjC/matrix-type-operators.m
===
--- clang/test/CodeGenObjC/matrix-type-operators.m
+++ clang/test/CodeGenObjC/matrix-type-operators.m
@@ -22,9 +22,9 @@
 // CHECK-NEXT:[[IV2_PTR:%.*]] = bitcast %0* [[IV2]] to i8*
 // CHECK-NEXT:[[CALL1:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* [[IV2_PTR]], i8* [[SEL2]])
 // CHECK-NEXT:[[CONV2:%.*]] = sext i32 [[CALL1]] to i64
-// CHECK-NEXT:[[MAT:%.*]] = load <16 x double>, <16 x double>* {{.*}} align 8
 // CHECK-NEXT:[[IDX1:%.*]] = mul i64 [[CONV2]], 4
 // CHECK-NEXT:[[IDX2:%.*]] = add i64 [[IDX1]], [[CONV]]
+// CHECK-NEXT:[[MAT:%.*]] = load <16 x double>, <16 x double>* {{.*}} align 8
 // CHECK-NEXT:[[MATEXT:%.*]] = extractelement <16 x double> [[MAT]], i64 [[IDX2]]
 // CHECK-NEXT:ret double [[MATEXT]]
 //
@@ -49,12 +49,12 @@
 // CHECK-NEXT:[[IV2_PTR:%.*]] = bitcast %0* [[IV2]] to i8*
 // CHECK-NEXT:[[CALL1:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* [[IV2_PTR]], i8* [[SEL2]])
 // CHECK-NEXT:[[CONV2:%.*]] = sext i32 [[CALL1]] to i64
+// CHECK-NEXT:[[IDX1:%.*]] = mul i64 [[CONV2]], 4
+// CHECK-NEXT:[[IDX2:%.*]] = add i64 [[IDX1]], [[CONV]]
 // CHECK-NEXT:[[M:%.*]] = load %1*, %1** %m.addr, align 8
 // CHECK-NEXT:[[SEL3:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_, align 8, !invariant.load !7
 // CHECK-NEXT:[[M_PTR:%.*]] = bitcast %1* [[M]] to i8*
 // CHECK-NEXT:[[MAT:%.*]] = call <16 x double> bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to <16 x double> (i8*, i8*)*)(i8* [[M_PTR]], i8* [[SEL3]])
-// CHECK-NEXT:[[IDX1:%.*]] = mul i64 [[CONV2]], 4
-// CHECK-NEXT:[[IDX2:%.*]] = add i64 [[IDX1]], [[CONV]]
 // CHECK-NEXT:[[MATEXT:%.*]] = extractelement <16 x double> [[MAT]], i64 [[IDX2]]
 // CHECK-NEXT:ret double [[MATEXT]]
 //
Index: clang/test/CodeGenCXX/matrix-type-operators.cpp
===
--- clang/test/CodeGenCXX/matrix-type-operators.cpp
+++ clang/test/CodeGenCXX/matrix-type-operators.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - -std=c++11 | FileCheck %s
+// RUN: %clang_cc1 -O0 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - -std=c++11 | FileCheck %s
+// RUN: %clang_cc1 -O1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - -std=c++11 | FileCheck --check-prefixes=CHECK,OPT %s
 
 typedef double dx5x5_t __attribute__((matrix_type(5, 5)));
 using fx2x3_t = fl

[PATCH] D106614: [Clang] add btf_tag attribute

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

LGTM, thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106614

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


[PATCH] D107717: [LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project

2021-08-12 Thread Alf via Phabricator via cfe-commits
gAlfonso-bit updated this revision to Diff 365802.
gAlfonso-bit added a comment.

Rebased


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

https://reviews.llvm.org/D107717

Files:
  clang/CMakeLists.txt
  clang/lib/Basic/CMakeLists.txt
  compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake
  flang/CMakeLists.txt
  libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
  libunwind/CMakeLists.txt
  lld/CMakeLists.txt
  lld/Common/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/source/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/include/llvm/Support/CMakeLists.txt
  runtimes/CMakeLists.txt

Index: runtimes/CMakeLists.txt
===
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -65,7 +65,7 @@
 
 # This variable makes sure that e.g. llvm-lit is found.
 set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR})
-set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules)
+set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
 
 # This variable is used by individual runtimes to locate LLVM files.
 set(LLVM_PATH ${LLVM_BUILD_MAIN_SRC_DIR})
Index: llvm/include/llvm/Support/CMakeLists.txt
===
--- llvm/include/llvm/Support/CMakeLists.txt
+++ llvm/include/llvm/Support/CMakeLists.txt
@@ -3,7 +3,7 @@
 # The VC revision include that we want to generate.
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSRevision.h")
 
-set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
+set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
 
 if(LLVM_APPEND_VC_REV)
   set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -295,8 +295,8 @@
 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include ) # --includedir
 set(LLVM_BINARY_DIR   ${CMAKE_CURRENT_BINARY_DIR}  ) # --prefix
 
-# Note: LLVM_CMAKE_PATH does not include generated files
-set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules)
+# Note: LLVM_CMAKE_DIR does not include generated files
+set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
 set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
 set(LLVM_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
 
Index: lldb/source/CMakeLists.txt
===
--- lldb/source/CMakeLists.txt
+++ lldb/source/CMakeLists.txt
@@ -8,7 +8,7 @@
 find_first_existing_vc_file("${LLDB_SOURCE_DIR}" lldb_vc)
 
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
-set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
+set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
 
 if(lldb_vc AND LLVM_APPEND_VC_REV)
   set(lldb_source_dir ${LLDB_SOURCE_DIR})
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -3,8 +3,8 @@
 find_package(LLVM REQUIRED CONFIG HINTS ${LLVM_DIR} NO_CMAKE_FIND_ROOT_PATH)
 find_package(Clang REQUIRED CONFIG HINTS ${Clang_DIR} ${LLVM_DIR}/../clang NO_CMAKE_FIND_ROOT_PATH)
 
-# We set LLVM_CMAKE_PATH so that GetSVN.cmake is found correctly when building SVNVersion.inc
-set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake modules")
+# We set LLVM_CMAKE_DIR so that GetSVN.cmake is found correctly when building SVNVersion.inc
+set(LLVM_CMAKE_DIR ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake modules")
 
 set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
Index: lld/Common/CMakeLists.txt
===
--- lld/Common/CMakeLists.txt
+++ lld/Common/CMakeLists.txt
@@ -8,7 +8,7 @@
 find_first_existing_vc_file("${LLD_SOURCE_DIR}" lld_vc)
 
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
-set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
+set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
 
 if(lld_vc AND LLVM_APPEND_VC_REV)
   set(lld_source_dir ${LLD_SOURCE_DIR})
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -27,7 +27,7 @@
 
   list(GET LLVM_CONFIG_OUTPUT 0 OBJ_ROOT)
   list(GET LLVM_CONFIG_OUTPUT 1 MAIN_INCLUDE_DIR)
-  list(GET LLVM_CONFIG_OUTPUT 2 LLVM_CMAKE_PATH)
+  list(GET LLVM_CONFIG_OUTPUT 2 LLVM_CMAKE_DIR)
   list(GET LLVM_CONFIG_OUTPUT 3 MAIN_SRC_DIR)
 
   set(LLVM_OBJ_ROOT ${OBJ_ROOT} CACHE PATH "path to LLVM build tree")
@@ -35,14 +35,14 @@
   set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to

[PATCH] D106891: [AMDGPU] [Remarks] Emit optimization remarks for FP atomics

2021-08-12 Thread Anshil Gandhi via Phabricator via cfe-commits
gandhi21299 updated this revision to Diff 365855.
gandhi21299 added a comment.

- eliminated unsafe hardware remarks in SIISelLowering.cpp
- updated cas loop remark and corresponding tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106891

Files:
  clang/test/CodeGenCUDA/fp-atomics-optremarks.cu
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/CodeGen/AtomicExpandPass.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
  llvm/lib/Target/AMDGPU/SIISelLowering.cpp
  llvm/lib/Target/AMDGPU/SIISelLowering.h
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.h
  llvm/test/CodeGen/AMDGPU/fp-atomics-remarks-gfx90a.ll
  llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
  llvm/test/CodeGen/X86/O0-pipeline.ll
  llvm/test/CodeGen/X86/opt-pipeline.ll

Index: llvm/test/CodeGen/X86/opt-pipeline.ll
===
--- llvm/test/CodeGen/X86/opt-pipeline.ll
+++ llvm/test/CodeGen/X86/opt-pipeline.ll
@@ -16,15 +16,20 @@
 ; CHECK-NEXT: Target Pass Configuration
 ; CHECK-NEXT: Machine Module Information
 ; CHECK-NEXT: Target Transform Information
+; CHECK-NEXT: Profile summary info
 ; CHECK-NEXT: Type-Based Alias Analysis
 ; CHECK-NEXT: Scoped NoAlias Alias Analysis
 ; CHECK-NEXT: Assumption Cache Tracker
-; CHECK-NEXT: Profile summary info
 ; CHECK-NEXT: Create Garbage Collector Module Metadata
 ; CHECK-NEXT: Machine Branch Probability Analysis
 ; CHECK-NEXT:   ModulePass Manager
 ; CHECK-NEXT: Pre-ISel Intrinsic Lowering
 ; CHECK-NEXT: FunctionPass Manager
+; CHECK-NEXT:   Dominator Tree Construction
+; CHECK-NEXT:   Natural Loop Information
+; CHECK-NEXT:   Lazy Branch Probability Analysis
+; CHECK-NEXT:   Lazy Block Frequency Analysis
+; CHECK-NEXT:   Optimization Remark Emitter
 ; CHECK-NEXT:   Expand Atomic instructions
 ; CHECK-NEXT:   Lower AMX intrinsics
 ; CHECK-NEXT:   Lower AMX type for load/store
Index: llvm/test/CodeGen/X86/O0-pipeline.ll
===
--- llvm/test/CodeGen/X86/O0-pipeline.ll
+++ llvm/test/CodeGen/X86/O0-pipeline.ll
@@ -10,13 +10,18 @@
 ; CHECK-NEXT: Target Pass Configuration
 ; CHECK-NEXT: Machine Module Information
 ; CHECK-NEXT: Target Transform Information
+; CHECK-NEXT: Profile summary info
 ; CHECK-NEXT: Create Garbage Collector Module Metadata
 ; CHECK-NEXT: Assumption Cache Tracker
-; CHECK-NEXT: Profile summary info
 ; CHECK-NEXT: Machine Branch Probability Analysis
 ; CHECK-NEXT:   ModulePass Manager
 ; CHECK-NEXT: Pre-ISel Intrinsic Lowering
 ; CHECK-NEXT: FunctionPass Manager
+; CHECK-NEXT:   Dominator Tree Construction
+; CHECK-NEXT:   Natural Loop Information
+; CHECK-NEXT:   Lazy Branch Probability Analysis
+; CHECK-NEXT:   Lazy Block Frequency Analysis
+; CHECK-NEXT:   Optimization Remark Emitter
 ; CHECK-NEXT:   Expand Atomic instructions
 ; CHECK-NEXT:   Lower AMX intrinsics
 ; CHECK-NEXT:   Lower AMX type for load/store
Index: llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
===
--- llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
+++ llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
@@ -44,6 +44,11 @@
 ; GCN-O0-NEXT:Lower OpenCL enqueued blocks
 ; GCN-O0-NEXT:Lower uses of LDS variables from non-kernel functions
 ; GCN-O0-NEXT:FunctionPass Manager
+; GCN-O0-NEXT:  Dominator Tree Construction
+; GCN-O0-NEXT:  Natural Loop Information
+; GCN-O0-NEXT:  Lazy Branch Probability Analysis
+; GCN-O0-NEXT:  Lazy Block Frequency Analysis
+; GCN-O0-NEXT:  Optimization Remark Emitter
 ; GCN-O0-NEXT:  Expand Atomic instructions
 ; GCN-O0-NEXT:  Lower constant intrinsics
 ; GCN-O0-NEXT:  Remove unreachable blocks from the CFG
@@ -180,6 +185,11 @@
 ; GCN-O1-NEXT:Lower uses of LDS variables from non-kernel functions
 ; GCN-O1-NEXT:FunctionPass Manager
 ; GCN-O1-NEXT:  Infer address spaces
+; GCN-O1-NEXT:  Dominator Tree Construction
+; GCN-O1-NEXT:  Natural Loop Information
+; GCN-O1-NEXT:  Lazy Branch Probability Analysis
+; GCN-O1-NEXT:  Lazy Block Frequency Analysis
+; GCN-O1-NEXT:  Optimization Remark Emitter
 ; GCN-O1-NEXT:  Expand Atomic instructions
 ; GCN-O1-NEXT:  AMDGPU Promote Alloca
 ; GCN-O1-NEXT:  Dominator Tree Construction
@@ -431,6 +441,11 @@
 ; GCN-O1-OPTS-NEXT:Lower uses of LDS variables from non-kernel functions
 ; GCN-O1-OPTS-NEXT:FunctionPass Manager
 ; GCN-O1-OPTS-NEXT:  Infer address spaces
+; GCN-O1-OPTS-NEXT:  Dominator Tree Construction
+; GCN-O1-OPTS-NEXT:  Natural Loop Information
+; GCN-O1-OPTS-NEXT:  Lazy Branch Probability Analysis
+; GCN-O1-OPTS-NEXT:  Lazy Block Frequency Analysis
+; GCN-O1-OPTS-NEXT:  Optimization Remark Emitter
 ; GCN-O1-OPTS-NEXT:  Expa

[PATCH] D106891: [AMDGPU] [Remarks] Emit optimization remarks for FP atomics

2021-08-12 Thread Anshil Gandhi via Phabricator via cfe-commits
gandhi21299 updated this revision to Diff 365859.
gandhi21299 added a comment.

removed AMDGPU check


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106891

Files:
  clang/test/CodeGenCUDA/fp-atomics-optremarks.cu
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/CodeGen/AtomicExpandPass.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
  llvm/lib/Target/AMDGPU/SIISelLowering.cpp
  llvm/lib/Target/AMDGPU/SIISelLowering.h
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.h
  llvm/test/CodeGen/AMDGPU/fp-atomics-remarks-gfx90a.ll
  llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
  llvm/test/CodeGen/X86/O0-pipeline.ll
  llvm/test/CodeGen/X86/opt-pipeline.ll

Index: llvm/test/CodeGen/X86/opt-pipeline.ll
===
--- llvm/test/CodeGen/X86/opt-pipeline.ll
+++ llvm/test/CodeGen/X86/opt-pipeline.ll
@@ -16,15 +16,20 @@
 ; CHECK-NEXT: Target Pass Configuration
 ; CHECK-NEXT: Machine Module Information
 ; CHECK-NEXT: Target Transform Information
+; CHECK-NEXT: Profile summary info
 ; CHECK-NEXT: Type-Based Alias Analysis
 ; CHECK-NEXT: Scoped NoAlias Alias Analysis
 ; CHECK-NEXT: Assumption Cache Tracker
-; CHECK-NEXT: Profile summary info
 ; CHECK-NEXT: Create Garbage Collector Module Metadata
 ; CHECK-NEXT: Machine Branch Probability Analysis
 ; CHECK-NEXT:   ModulePass Manager
 ; CHECK-NEXT: Pre-ISel Intrinsic Lowering
 ; CHECK-NEXT: FunctionPass Manager
+; CHECK-NEXT:   Dominator Tree Construction
+; CHECK-NEXT:   Natural Loop Information
+; CHECK-NEXT:   Lazy Branch Probability Analysis
+; CHECK-NEXT:   Lazy Block Frequency Analysis
+; CHECK-NEXT:   Optimization Remark Emitter
 ; CHECK-NEXT:   Expand Atomic instructions
 ; CHECK-NEXT:   Lower AMX intrinsics
 ; CHECK-NEXT:   Lower AMX type for load/store
Index: llvm/test/CodeGen/X86/O0-pipeline.ll
===
--- llvm/test/CodeGen/X86/O0-pipeline.ll
+++ llvm/test/CodeGen/X86/O0-pipeline.ll
@@ -10,13 +10,18 @@
 ; CHECK-NEXT: Target Pass Configuration
 ; CHECK-NEXT: Machine Module Information
 ; CHECK-NEXT: Target Transform Information
+; CHECK-NEXT: Profile summary info
 ; CHECK-NEXT: Create Garbage Collector Module Metadata
 ; CHECK-NEXT: Assumption Cache Tracker
-; CHECK-NEXT: Profile summary info
 ; CHECK-NEXT: Machine Branch Probability Analysis
 ; CHECK-NEXT:   ModulePass Manager
 ; CHECK-NEXT: Pre-ISel Intrinsic Lowering
 ; CHECK-NEXT: FunctionPass Manager
+; CHECK-NEXT:   Dominator Tree Construction
+; CHECK-NEXT:   Natural Loop Information
+; CHECK-NEXT:   Lazy Branch Probability Analysis
+; CHECK-NEXT:   Lazy Block Frequency Analysis
+; CHECK-NEXT:   Optimization Remark Emitter
 ; CHECK-NEXT:   Expand Atomic instructions
 ; CHECK-NEXT:   Lower AMX intrinsics
 ; CHECK-NEXT:   Lower AMX type for load/store
Index: llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
===
--- llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
+++ llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
@@ -44,6 +44,11 @@
 ; GCN-O0-NEXT:Lower OpenCL enqueued blocks
 ; GCN-O0-NEXT:Lower uses of LDS variables from non-kernel functions
 ; GCN-O0-NEXT:FunctionPass Manager
+; GCN-O0-NEXT:  Dominator Tree Construction
+; GCN-O0-NEXT:  Natural Loop Information
+; GCN-O0-NEXT:  Lazy Branch Probability Analysis
+; GCN-O0-NEXT:  Lazy Block Frequency Analysis
+; GCN-O0-NEXT:  Optimization Remark Emitter
 ; GCN-O0-NEXT:  Expand Atomic instructions
 ; GCN-O0-NEXT:  Lower constant intrinsics
 ; GCN-O0-NEXT:  Remove unreachable blocks from the CFG
@@ -180,6 +185,11 @@
 ; GCN-O1-NEXT:Lower uses of LDS variables from non-kernel functions
 ; GCN-O1-NEXT:FunctionPass Manager
 ; GCN-O1-NEXT:  Infer address spaces
+; GCN-O1-NEXT:  Dominator Tree Construction
+; GCN-O1-NEXT:  Natural Loop Information
+; GCN-O1-NEXT:  Lazy Branch Probability Analysis
+; GCN-O1-NEXT:  Lazy Block Frequency Analysis
+; GCN-O1-NEXT:  Optimization Remark Emitter
 ; GCN-O1-NEXT:  Expand Atomic instructions
 ; GCN-O1-NEXT:  AMDGPU Promote Alloca
 ; GCN-O1-NEXT:  Dominator Tree Construction
@@ -431,6 +441,11 @@
 ; GCN-O1-OPTS-NEXT:Lower uses of LDS variables from non-kernel functions
 ; GCN-O1-OPTS-NEXT:FunctionPass Manager
 ; GCN-O1-OPTS-NEXT:  Infer address spaces
+; GCN-O1-OPTS-NEXT:  Dominator Tree Construction
+; GCN-O1-OPTS-NEXT:  Natural Loop Information
+; GCN-O1-OPTS-NEXT:  Lazy Branch Probability Analysis
+; GCN-O1-OPTS-NEXT:  Lazy Block Frequency Analysis
+; GCN-O1-OPTS-NEXT:  Optimization Remark Emitter
 ; GCN-O1-OPTS-NEXT:  Expand Atomic instructions
 ; GCN-O1-OPTS-NEXT:  AMDGPU Promote Alloca
 ; GCN-O1-OPTS-NE

[PATCH] D106891: [AMDGPU] [Remarks] Emit optimization remarks for FP atomics

2021-08-12 Thread Stanislav Mekhanoshin via Phabricator via cfe-commits
rampitec added a comment.

In D106891#2940411 , @gandhi21299 
wrote:

> - eliminated unsafe hardware remarks in SIISelLowering.cpp

Most of this patch is not needed now. You do not need to pass ORE to targets, 
it is a part of the next patch.




Comment at: clang/test/CodeGenCUDA/fp-atomics-optremarks.cu:10
+
+// GFX90A-CAS: A compare and swap loop was generated for an atomic operation 
at system memory scope
+// GFX90A-CAS-LABEL: _Z14atomic_add_casPf

Need tests for all scopes.



Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:587
+OptimizationRemark Remark) {
+  ORE->emit([&]() { return Remark; });
+  return Kind;

I do not see why do you need this function and all its arguments now. You can 
just call ORE->emit() directly.



Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:631
+"at "
+ << (AI->getSyncScopeID() ? "system" : "single thread")
+ << " memory scope");

That does not help with target defined scope names, such as our "one-as" for 
example.



Comment at: llvm/test/CodeGen/AMDGPU/fp-atomics-remarks-gfx90a.ll:4
+
+; GFX90A-CAS: A compare and swap loop was generated for an atomic operation at 
system memory scope
+; GFX90A-CAS-LABEL: _Z14atomic_add_casPf:

You need to write tests for all scopes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106891

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


[PATCH] D106891: [AMDGPU] [Remarks] Emit optimization remarks for FP atomics

2021-08-12 Thread Stanislav Mekhanoshin via Phabricator via cfe-commits
rampitec added a comment.

You also need to retitle it now, it is not about AMDGPU and not about FP.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106891

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


[PATCH] D106891: [AMDGPU] [Remarks] Emit optimization remarks for FP atomics

2021-08-12 Thread Stanislav Mekhanoshin via Phabricator via cfe-commits
rampitec added inline comments.



Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:629
+  Remark << "A compare and swap loop was generated for an atomic "
+"operation "
+"at "

Need to name the operation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106891

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


[PATCH] D107952: [AMDGPU][OpenMP] Use llvm-link to link ocml libraries

2021-08-12 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

This is semantically different to using mlink-builtin-bitcode with clang. The 
former internalizes all the symbols after they are introduced, using llvm-link 
does not. I'm not immediately sure whether that is a problem - the symbols in 
rocm device libs should all be `__prefixed` - but it's potentially bad for code 
size.

Suggest we fix the test case and leave restoring internalize for a later patch, 
thoughts?




Comment at: clang/test/Driver/amdgpu-openmp-toolchain.c:80
+// CHECK-LIB-DEVICE: 
{{.*}}llvm-link{{.*}}ocml.bc"{{.*}}ockl.bc"{{.*}}oclc_daz_opt_on.bc"{{.*}}oclc_unsafe_math_off.bc"{{.*}}oclc_finite_only_off.bc"{{.*}}oclc_correctly_rounded_sqrt_on.bc"{{.*}}oclc_wavefrontsize64_on.bc"{{.*}}oclc_isa_version_803.bc"
+// "llvm-link" "/tmp/amdgpu-openmp-toolchain-e9dcd9.bc" 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/ocml.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/ockl.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_daz_opt_on.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_unsafe_math_off.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_finite_only_off.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_wavefrontsize64_on.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_isa_version_803.bc"
 "-o" "/tmp/amdgpu-openmp-toolchain-e9dcd9-gfx803-linked-4095ab.bc"

This will fail on machines with a different directory layout, perhaps copy the 
`{{.*}}` pattern from above


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107952

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


[PATCH] D107952: [AMDGPU][OpenMP] Use llvm-link to link ocml libraries

2021-08-12 Thread Pushpinder Singh via Phabricator via cfe-commits
pdhaliwal updated this revision to Diff 365965.
pdhaliwal added a comment.

Remove redundant test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107952

Files:
  clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
  clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
  clang/test/Driver/amdgpu-openmp-toolchain.c

Index: clang/test/Driver/amdgpu-openmp-toolchain.c
===
--- clang/test/Driver/amdgpu-openmp-toolchain.c
+++ clang/test/Driver/amdgpu-openmp-toolchain.c
@@ -76,4 +76,4 @@
 // CHECK-EMIT-LLVM-IR: clang{{.*}}"-cc1"{{.*}}"-triple" "amdgcn-amd-amdhsa"{{.*}}"-emit-llvm"
 
 // RUN: env LIBRARY_PATH=%S/Inputs/hip_dev_lib %clang -### -target x86_64-pc-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -lm --rocm-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode %s 2>&1 | FileCheck %s --check-prefix=CHECK-LIB-DEVICE
-// CHECK-LIB-DEVICE: clang{{.*}}"-cc1"{{.*}}"-triple" "amdgcn-amd-amdhsa"{{.*}}"-mlink-builtin-bitcode"{{.*}}libomptarget-amdgcn-gfx803.bc"{{.*}}"-mlink-builtin-bitcode"{{.*}}ocml.bc" "-mlink-builtin-bitcode"{{.*}}ockl.bc" "-mlink-builtin-bitcode"{{.*}}oclc_daz_opt_on.bc" "-mlink-builtin-bitcode"{{.*}}oclc_unsafe_math_off.bc" "-mlink-builtin-bitcode"{{.*}}oclc_finite_only_off.bc" "-mlink-builtin-bitcode"{{.*}}oclc_correctly_rounded_sqrt_on.bc" "-mlink-builtin-bitcode"{{.*}}oclc_wavefrontsize64_on.bc" "-mlink-builtin-bitcode"{{.*}}oclc_isa_version_803.bc"
+// CHECK-LIB-DEVICE: {{.*}}llvm-link{{.*}}ocml.bc"{{.*}}ockl.bc"{{.*}}oclc_daz_opt_on.bc"{{.*}}oclc_unsafe_math_off.bc"{{.*}}oclc_finite_only_off.bc"{{.*}}oclc_correctly_rounded_sqrt_on.bc"{{.*}}oclc_wavefrontsize64_on.bc"{{.*}}oclc_isa_version_803.bc"
Index: clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
===
--- clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
+++ clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
@@ -16,6 +16,10 @@
 namespace clang {
 namespace driver {
 
+namespace toolchains {
+class AMDGPUOpenMPToolChain;
+}
+
 namespace tools {
 
 namespace AMDGCN {
@@ -35,11 +39,11 @@
 
 private:
   /// \return llvm-link output file name.
-  const char *constructLLVMLinkCommand(Compilation &C, const JobAction &JA,
-   const InputInfoList &Inputs,
-   const llvm::opt::ArgList &Args,
-   llvm::StringRef SubArchName,
-   llvm::StringRef OutputFilePrefix) const;
+  const char *constructLLVMLinkCommand(
+  const toolchains::AMDGPUOpenMPToolChain &AMDGPUOpenMPTC, Compilation &C,
+  const JobAction &JA, const InputInfoList &Inputs,
+  const llvm::opt::ArgList &Args, llvm::StringRef SubArchName,
+  llvm::StringRef OutputFilePrefix) const;
 
   /// \return llc output file name.
   const char *constructLlcCommand(Compilation &C, const JobAction &JA,
Index: clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
===
--- clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+++ clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
@@ -86,14 +86,34 @@
 } // namespace
 
 const char *AMDGCN::OpenMPLinker::constructLLVMLinkCommand(
-Compilation &C, const JobAction &JA, const InputInfoList &Inputs,
-const ArgList &Args, StringRef SubArchName,
-StringRef OutputFilePrefix) const {
+const toolchains::AMDGPUOpenMPToolChain &AMDGPUOpenMPTC, Compilation &C,
+const JobAction &JA, const InputInfoList &Inputs, const ArgList &Args,
+StringRef SubArchName, StringRef OutputFilePrefix) const {
   ArgStringList CmdArgs;
 
   for (const auto &II : Inputs)
 if (II.isFilename())
   CmdArgs.push_back(II.getFilename());
+
+  if (Args.hasArg(options::OPT_l)) {
+auto Lm = Args.getAllArgValues(options::OPT_l);
+bool HasLibm = false;
+for (auto &Lib : Lm) {
+  if (Lib == "m") {
+HasLibm = true;
+break;
+  }
+}
+
+if (HasLibm) {
+  SmallVector BCLibs =
+  AMDGPUOpenMPTC.getCommonDeviceLibNames(Args, SubArchName.str());
+  llvm::for_each(BCLibs, [&](StringRef BCFile) {
+CmdArgs.push_back(Args.MakeArgString(BCFile));
+  });
+}
+  }
+
   // Add an intermediate output file.
   CmdArgs.push_back("-o");
   const char *OutputFileName =
@@ -182,8 +202,8 @@
   assert(Prefix.length() && "no linker inputs are files ");
 
   // Each command outputs different files.
-  const char *LLVMLinkCommand =
-  constructLLVMLinkCommand(C, JA, Inputs, Args, GPUArch, Prefix);
+  const char *LLVMLinkCommand = constructLLVMLinkCommand(
+  AMDGPUOpenMPTC, C, JA, Inputs, Args, GPUArch, Prefix);
 
   // Produce readable assembly if save-temps is enabled.
   if (C.getDriver().isSaveTempsEnabled())
@@ -234,27 +254,6 @@
 
   addOpenMPDeviceRTL(getDriver(), DriverArgs, CC1Args, Bitc

[PATCH] D107641: [clang-tidy] fix duplicate '{}' in cppcoreguidelines-pro-type-member-init

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

LGTM, thank you!


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

https://reviews.llvm.org/D107641

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


[PATCH] D107952: [AMDGPU][OpenMP] Use llvm-link to link ocml libraries

2021-08-12 Thread Pushpinder Singh via Phabricator via cfe-commits
pdhaliwal added inline comments.



Comment at: clang/test/Driver/amdgpu-openmp-toolchain.c:80
+// CHECK-LIB-DEVICE: 
{{.*}}llvm-link{{.*}}ocml.bc"{{.*}}ockl.bc"{{.*}}oclc_daz_opt_on.bc"{{.*}}oclc_unsafe_math_off.bc"{{.*}}oclc_finite_only_off.bc"{{.*}}oclc_correctly_rounded_sqrt_on.bc"{{.*}}oclc_wavefrontsize64_on.bc"{{.*}}oclc_isa_version_803.bc"
+// "llvm-link" "/tmp/amdgpu-openmp-toolchain-e9dcd9.bc" 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/ocml.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/ockl.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_daz_opt_on.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_unsafe_math_off.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_finite_only_off.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_wavefrontsize64_on.bc"
 
"/home/prince/source/repos/llvm-project/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_isa_version_803.bc"
 "-o" "/tmp/amdgpu-openmp-toolchain-e9dcd9-gfx803-linked-4095ab.bc"

JonChesterfield wrote:
> This will fail on machines with a different directory layout, perhaps copy 
> the `{{.*}}` pattern from above
This was accidently put up as a comment to check the actual 'CHECK' line.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107952

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


[PATCH] D107952: [AMDGPU][OpenMP] Use llvm-link to link ocml libraries

2021-08-12 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield accepted this revision.
JonChesterfield added a comment.
This revision is now accepted and ready to land.

LG, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107952

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


[PATCH] D106876: Remove non-affecting module maps from PCM files.

2021-08-12 Thread Ilya Kuteev via Phabricator via cfe-commits
ilyakuteev updated this revision to Diff 365968.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106876

Files:
  clang/include/clang/Lex/HeaderSearch.h
  clang/include/clang/Serialization/ASTWriter.h
  clang/lib/Serialization/ASTWriter.cpp

Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -149,6 +149,72 @@
 
 namespace {
 
+std::string ModuleMapFilePathForModule(const ModuleMap &Map,
+   Module *GivenModule) {
+  if (!GivenModule->PresumedModuleMapFile.empty()) {
+return GivenModule->PresumedModuleMapFile;
+  }
+  auto *ModuleMapFile = Map.getModuleMapFileForUniquing(GivenModule);
+  if (!ModuleMapFile) {
+return std::string();
+  }
+  return std::string(ModuleMapFile->getName());
+}
+
+std::set GetAllModulemaps(const HeaderSearch &HS,
+   Module *RootModule) {
+  std::set ModuleMaps{};
+  std::set ProcessedModules;
+  std::set ModulesToProcess{RootModule};
+
+  SmallVector FilesByUID;
+  HS.getFileMgr().GetUniqueIDMapping(FilesByUID);
+
+  if (FilesByUID.size() > HS.header_file_size())
+FilesByUID.resize(HS.header_file_size());
+
+  for (unsigned UID = 0, LastUID = FilesByUID.size(); UID != LastUID; ++UID) {
+const FileEntry *File = FilesByUID[UID];
+if (!File)
+  continue;
+
+const HeaderFileInfo *HFI =
+HS.getExistingFileInfo(File, /*WantExternal*/false);
+if (!HFI || (HFI->isModuleHeader && !HFI->isCompilingModuleHeader))
+  continue;
+
+const auto KH = HS.findModuleForHeader(File, /*AllowTextual*/true);
+if (!KH.getModule())
+  continue;
+
+ModulesToProcess.insert(KH.getModule());
+  }
+
+  while (!ModulesToProcess.empty()) {
+auto CurrentModule = ModulesToProcess.begin();
+ProcessedModules.insert(*CurrentModule);
+
+const std::string CurrentModuleMapFile =
+ModuleMapFilePathForModule(HS.getModuleMap(), *CurrentModule);
+if (CurrentModuleMapFile.empty()) {
+  ModulesToProcess.erase(CurrentModule);
+  continue;
+}
+
+ModuleMaps.insert(CurrentModuleMapFile);
+
+for (auto *ImportedModule : (*CurrentModule)->Imports) {
+  if (!ImportedModule ||
+  ProcessedModules.find(ImportedModule) != ProcessedModules.end()) {
+continue;
+  }
+  ModulesToProcess.insert(ImportedModule);
+}
+ModulesToProcess.erase(CurrentModule);
+  }
+  return ModuleMaps;
+}
+
 class ASTTypeWriter {
   ASTWriter &Writer;
   ASTWriter::RecordData Record;
@@ -1396,9 +1462,16 @@
 Stream.EmitRecordWithBlob(AbbrevCode, Record, origDir);
   }
 
+  std::set AffectingModulemaps;
+  if (WritingModule) {
+AffectingModulemaps = GetAllModulemaps(
+PP.getHeaderSearchInfo(),
+WritingModule);
+  }
+
   WriteInputFiles(Context.SourceMgr,
   PP.getHeaderSearchInfo().getHeaderSearchOpts(),
-  PP.getLangOpts().Modules);
+  AffectingModulemaps);
   Stream.ExitBlock();
 }
 
@@ -1418,7 +1491,7 @@
 
 void ASTWriter::WriteInputFiles(SourceManager &SourceMgr,
 HeaderSearchOptions &HSOpts,
-bool Modules) {
+std::set &AffectingModuleMaps) {
   using namespace llvm;
 
   Stream.EnterSubblock(INPUT_FILES_BLOCK_ID, 4);
@@ -1458,6 +1531,15 @@
 if (!Cache->OrigEntry)
   continue;
 
+if (isModuleMap(File.getFileCharacteristic()) &&
+!isSystem(File.getFileCharacteristic()) &&
+!AffectingModuleMaps.empty() &&
+AffectingModuleMaps.find(std::string(Cache->OrigEntry->getName())) ==
+AffectingModuleMaps.end()) {
+  // Do not emit modulemaps that do not affect current module.
+  continue;
+}
+
 InputFileEntry Entry;
 Entry.File = Cache->OrigEntry;
 Entry.IsSystemFile = isSystem(File.getFileCharacteristic());
@@ -1971,11 +2053,15 @@
 Record.push_back(SLoc->getOffset() - 2);
 if (SLoc->isFile()) {
   const SrcMgr::FileInfo &File = SLoc->getFile();
+  const SrcMgr::ContentCache *Content = &File.getContentCache();
+  if (Content->OrigEntry && InputFileIDs[Content->OrigEntry] == 0) {
+// Do not emit files that were not listed as inputs.
+continue;
+  }
   AddSourceLocation(File.getIncludeLoc(), Record);
   Record.push_back(File.getFileCharacteristic()); // FIXME: stable encoding
   Record.push_back(File.hasLineDirectives());
 
-  const SrcMgr::ContentCache *Content = &File.getContentCache();
   bool EmitBlob = false;
   if (Content->OrigEntry) {
 assert(Content->OrigEntry == Content->ContentsEntry &&
Index: clang/include/clang/Serialization/ASTWriter.h
===
--- clang/inclu

[PATCH] D107349: [Matrix] Overload stride arg in matrix.columnwise.load/store.

2021-08-12 Thread Adrian Kuegel via Phabricator via cfe-commits
akuegel added a comment.

It seems this patch caused a test failure in MLIR:
test/Target/LLVMIR/llvm-intrinsics.mlir


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107349

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


[PATCH] D106876: Remove non-affecting module maps from PCM files.

2021-08-12 Thread Ilya Kuteev via Phabricator via cfe-commits
ilyakuteev updated this revision to Diff 365969.

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

https://reviews.llvm.org/D106876

Files:
  clang/include/clang/Serialization/ASTWriter.h
  clang/lib/Serialization/ASTWriter.cpp

Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -149,6 +149,72 @@
 
 namespace {
 
+std::string ModuleMapFilePathForModule(const ModuleMap &Map,
+   Module *GivenModule) {
+  if (!GivenModule->PresumedModuleMapFile.empty()) {
+return GivenModule->PresumedModuleMapFile;
+  }
+  auto *ModuleMapFile = Map.getModuleMapFileForUniquing(GivenModule);
+  if (!ModuleMapFile) {
+return std::string();
+  }
+  return std::string(ModuleMapFile->getName());
+}
+
+std::set GetAllModulemaps(const HeaderSearch &HS,
+   Module *RootModule) {
+  std::set ModuleMaps{};
+  std::set ProcessedModules;
+  std::set ModulesToProcess{RootModule};
+
+  SmallVector FilesByUID;
+  HS.getFileMgr().GetUniqueIDMapping(FilesByUID);
+
+  if (FilesByUID.size() > HS.header_file_size())
+FilesByUID.resize(HS.header_file_size());
+
+  for (unsigned UID = 0, LastUID = FilesByUID.size(); UID != LastUID; ++UID) {
+const FileEntry *File = FilesByUID[UID];
+if (!File)
+  continue;
+
+const HeaderFileInfo *HFI =
+HS.getExistingFileInfo(File, /*WantExternal*/false);
+if (!HFI || (HFI->isModuleHeader && !HFI->isCompilingModuleHeader))
+  continue;
+
+const auto KH = HS.findModuleForHeader(File, /*AllowTextual*/true);
+if (!KH.getModule())
+  continue;
+
+ModulesToProcess.insert(KH.getModule());
+  }
+
+  while (!ModulesToProcess.empty()) {
+auto CurrentModule = ModulesToProcess.begin();
+ProcessedModules.insert(*CurrentModule);
+
+const std::string CurrentModuleMapFile =
+ModuleMapFilePathForModule(HS.getModuleMap(), *CurrentModule);
+if (CurrentModuleMapFile.empty()) {
+  ModulesToProcess.erase(CurrentModule);
+  continue;
+}
+
+ModuleMaps.insert(CurrentModuleMapFile);
+
+for (auto *ImportedModule : (*CurrentModule)->Imports) {
+  if (!ImportedModule ||
+  ProcessedModules.find(ImportedModule) != ProcessedModules.end()) {
+continue;
+  }
+  ModulesToProcess.insert(ImportedModule);
+}
+ModulesToProcess.erase(CurrentModule);
+  }
+  return ModuleMaps;
+}
+
 class ASTTypeWriter {
   ASTWriter &Writer;
   ASTWriter::RecordData Record;
@@ -1396,9 +1462,16 @@
 Stream.EmitRecordWithBlob(AbbrevCode, Record, origDir);
   }
 
+  std::set AffectingModulemaps;
+  if (WritingModule) {
+AffectingModulemaps = GetAllModulemaps(
+PP.getHeaderSearchInfo(),
+WritingModule);
+  }
+
   WriteInputFiles(Context.SourceMgr,
   PP.getHeaderSearchInfo().getHeaderSearchOpts(),
-  PP.getLangOpts().Modules);
+  AffectingModulemaps);
   Stream.ExitBlock();
 }
 
@@ -1418,7 +1491,7 @@
 
 void ASTWriter::WriteInputFiles(SourceManager &SourceMgr,
 HeaderSearchOptions &HSOpts,
-bool Modules) {
+std::set &AffectingModuleMaps) {
   using namespace llvm;
 
   Stream.EnterSubblock(INPUT_FILES_BLOCK_ID, 4);
@@ -1458,6 +1531,15 @@
 if (!Cache->OrigEntry)
   continue;
 
+if (isModuleMap(File.getFileCharacteristic()) &&
+!isSystem(File.getFileCharacteristic()) &&
+!AffectingModuleMaps.empty() &&
+AffectingModuleMaps.find(std::string(Cache->OrigEntry->getName())) ==
+AffectingModuleMaps.end()) {
+  // Do not emit modulemaps that do not affect current module.
+  continue;
+}
+
 InputFileEntry Entry;
 Entry.File = Cache->OrigEntry;
 Entry.IsSystemFile = isSystem(File.getFileCharacteristic());
@@ -1971,11 +2053,15 @@
 Record.push_back(SLoc->getOffset() - 2);
 if (SLoc->isFile()) {
   const SrcMgr::FileInfo &File = SLoc->getFile();
+  const SrcMgr::ContentCache *Content = &File.getContentCache();
+  if (Content->OrigEntry && InputFileIDs[Content->OrigEntry] == 0) {
+// Do not emit files that were not listed as inputs.
+continue;
+  }
   AddSourceLocation(File.getIncludeLoc(), Record);
   Record.push_back(File.getFileCharacteristic()); // FIXME: stable encoding
   Record.push_back(File.hasLineDirectives());
 
-  const SrcMgr::ContentCache *Content = &File.getContentCache();
   bool EmitBlob = false;
   if (Content->OrigEntry) {
 assert(Content->OrigEntry == Content->ContentsEntry &&
Index: clang/include/clang/Serialization/ASTWriter.h
===
--- clang/include/clang/Serialization/ASTWriter.h
+++ clang/include/clang/Serialization/ASTWrit

[PATCH] D106876: Remove non-affecting module maps from PCM files.

2021-08-12 Thread Ilya Kuteev via Phabricator via cfe-commits
ilyakuteev added a comment.

Added modules for headers known to HeadersSearch, including textual ones.


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

https://reviews.llvm.org/D106876

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


[PATCH] D106876: Remove non-affecting module maps from PCM files.

2021-08-12 Thread Ilya Kuteev via Phabricator via cfe-commits
ilyakuteev added a comment.

@rsmith Can you please check is this a correct way to add headers known to 
preprocessor? (Lines 173-191)


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

https://reviews.llvm.org/D106876

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


[clang] 28c0479 - Revert "[Matrix] Overload stride arg in matrix.columnwise.load/store."

2021-08-12 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2021-08-12T11:57:19Z
New Revision: 28c04794df74ad3c38155a244729d1f8d57b9400

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

LOG: Revert "[Matrix] Overload stride arg in matrix.columnwise.load/store."

This reverts commit a1ef81de35a4bac6d3b22e9d7186d880124d7a55.

Broke the MLIR buildbot.

Added: 


Modified: 
clang/test/CodeGen/matrix-type-builtins.c
clang/test/CodeGenCXX/matrix-type-builtins.cpp
clang/test/CodeGenObjC/matrix-type-builtins.m
llvm/docs/LangRef.rst
llvm/include/llvm/IR/Intrinsics.td
llvm/include/llvm/IR/MatrixBuilder.h
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-double.ll
llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-double.ll
llvm/test/Verifier/matrix-intrinsics.ll

Removed: 




diff  --git a/clang/test/CodeGen/matrix-type-builtins.c 
b/clang/test/CodeGen/matrix-type-builtins.c
index ec0be85b7151e..67f5c78196878 100644
--- a/clang/test/CodeGen/matrix-type-builtins.c
+++ b/clang/test/CodeGen/matrix-type-builtins.c
@@ -1,5 +1,4 @@
-// RUN: %clang_cc1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm 
-disable-llvm-passes -o - | FileCheck --check-prefixes=COMMON,CHECK64 %s
-// RUN: %clang_cc1 -fenable-matrix -triple i386-apple-darwin %s -emit-llvm 
-disable-llvm-passes -o - | FileCheck --check-prefixes=COMMON,CHECK32 %s
+// RUN: %clang_cc1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm 
-disable-llvm-passes -o - | FileCheck %s
 
 // Also check we do not crash when running some middle-end passes. Most
 // importantly this includes the IR verifier, to ensure we emit valid IR.
@@ -16,33 +15,30 @@ typedef unsigned ux1x6_t __attribute__((matrix_type(1, 6)));
 typedef unsigned ux6x1_t __attribute__((matrix_type(6, 1)));
 
 void transpose_double_5x5(dx5x5_t *a) {
-  // COMMON-LABEL: define{{.*}} void @transpose_double_5x5(
-  // CHECK32:   [[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, 
align 4
-  // CHECK64:   [[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, 
align 8
-  // COMMON-NEXT:   [[TRANS:%.*]] = call <25 x double> 
@llvm.matrix.transpose.v25f64(<25 x double> [[A]], i32 5, i32 5)
-  // COMMON-NEXT:   [[AT_ADDR:%.*]] = bitcast [25 x double]* %a_t to <25 x 
double>*
-  // CHECK32-NEXT:  store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], 
align 4
-  // CHECK64-NEXT:  store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], 
align 8
-
+  // CHECK-LABEL: define{{.*}} void @transpose_double_5x5(
+  // CHECK:[[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, 
align 8
+  // CHECK-NEXT:   [[TRANS:%.*]] = call <25 x double> 
@llvm.matrix.transpose.v25f64(<25 x double> [[A]], i32 5, i32 5)
+  // CHECK-NEXT:   [[AT_ADDR:%.*]] = bitcast [25 x double]* %a_t to <25 x 
double>*
+  // CHECK-NEXT:   store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], 
align 8
   dx5x5_t a_t = __builtin_matrix_transpose(*a);
 }
 
 void transpose_float_3x2(fx3x2_t *a) {
-  // COMMON-LABEL: define{{.*}} void @transpose_float_3x2(
-  // COMMON:[[A:%.*]] = load <6 x float>, <6 x float>* {{.*}}, align 4
-  // COMMON-NEXT:   [[TRANS:%.*]] = call <6 x float> 
@llvm.matrix.transpose.v6f32(<6 x float> [[A]], i32 3, i32 2)
-  // COMMON-NEXT:   [[AT_ADDR:%.*]] = bitcast [6 x float]* %a_t to <6 x float>*
-  // COMMON-NEXT:   store <6 x float> [[TRANS]], <6 x float>* [[AT_ADDR]], 
align 4
+  // CHECK-LABEL: define{{.*}} void @transpose_float_3x2(
+  // CHECK:[[A:%.*]] = load <6 x float>, <6 x float>* {{.*}}, align 4
+  // CHECK-NEXT:   [[TRANS:%.*]] = call <6 x float> 
@llvm.matrix.transpose.v6f32(<6 x float> [[A]], i32 3, i32 2)
+  // CHECK-NEXT:   [[AT_ADDR:%.*]] = bitcast [6 x float]* %a_t to <6 x float>*
+  // CHECK-NEXT:   store <6 x float> [[TRANS]], <6 x float>* [[AT_ADDR]], 
align 4
 
   fx2x3_t a_t = __builtin_matrix_transpose(*a);
 }
 
 void transpose_int_20x4(ix20x4_t *a) {
-  // COMMON-LABEL: define{{.*}} void @transpose_int_20x4(
-  // COMMON: [[A:%.*]] = load <80 x i32>, <80 x i32>* {{.*}}, align 4
-  // COMMON-NEXT:[[TRANS:%.*]] = call <80 x i32> 
@llvm.matrix.transpose.v80i32(<80 x i32> [[A]], i32 20, i32 4)
-  // COMMON-NEXT:[[AT_ADDR:%.*]] = bitcast [80 x i32]* %a_t to <80 x i32>*
-  // COMMON-NEXT:store <80 x i32> [[TRANS]], <80 x i32>* [[AT_ADDR]], 
align 4
+  // CHECK-LABEL: define{{.*}} void @transpose_int_20x4(
+  // CHECK: [[A:%.*]] = load <80 x i32>, <80 x i32>* {{.*}}, align 4
+  // CHECK-NEXT:[[TRANS:%.*]] = call <80 x i32> 
@llvm.matrix.transpose.v80i32(<80 x i32> [[A]], i32 20, i32 4)
+  // CHECK-NEXT:[[AT_ADDR:%.*]] = bitcast [80 x i32]* %a_t to <80 x i32>*
+  // CHECK-NEXT:store <80 x i32> [[TRANS]], <80 x i32>* [[AT_AD

[PATCH] D107349: [Matrix] Overload stride arg in matrix.columnwise.load/store.

2021-08-12 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

Revert to unbreak bots (like this one : 
https://lab.llvm.org/buildbot/#/builders/13/builds/10930 )


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107349

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


[PATCH] D107950: [clang-format] improve distinction of K&R function definitions vs attributes

2021-08-12 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment.

In D107950#2941015 , @MyDeveloperDay 
wrote:

> I personally think tok::identifier tends to be just too general

However, you can't avoid it as it's used for user-defined types:

  typedef unsigned char byte;
  
  byte *f(a)
  byte a[];
  {
return a && *a ? a + 1 : 0;
  }

I will try to come up with a solution.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107950

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


[PATCH] D107095: Implement #pragma clang header_unsafe

2021-08-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D107095#2940638 , @beanz wrote:

> +@lebedev.ri
>
> @aaron.ballman thank you for all the feedback and support!
>
> I'm not really sure where to go on the naming. I'm not attached to 
> `header_unsafe`, and totally understand the confusion. I don't really love 
> the `reserved*` wording either as it doesn't really convey meaning.

We can spitball some ideas, and interested people can chime in with their 
opinions. I don't want to hold up the functionality for overly long on 
bikeshedding the name, so if at some point it starts to feel like we should 
pick one and go with it, we can do that. Sound reasonable?

> For my other patch I like `final` because it means something similar to what 
> the `final` keyword means in C++ and other languages (i.e. don't change this 
> again).
>
> For this I also thought about variations on `restrict` to signify 
> restrictions on the macro's expansion contexts.
>
> The goal is to warn on expansions that are outside the main source file, so 
> maybe something like `restrict_header_expansion`?
>
> Very open to feedback here on making clear naming. After all naming is one of 
> the hardest problems in computer science :)

I think `restrict_header_expansion` is an improvement, but rather wordy. Maybe 
`restrict_expansion` instead? Paging @rsmith, who is often very good at naming 
questions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107095

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


[PATCH] D97753: [clang-tidy] Add a check for enforcing minimum length for variable names

2021-08-12 Thread Florin Iucha via Phabricator via cfe-commits
0x8000- added a comment.

The diff was generated with format-patch, so can be applied with "git am".

The envelope:

> commit d98d336b452876cfbc32ad1b76319912c45b646b (HEAD -> 
> readability-variable-name-length-main)
> Author: Florin Iucha 
> Date:   Mon Mar 1 00:57:01 2021 -0500
>
>   Add a checker for variable name length
>   
>   It requires regular variables and parameters names to be at least
>   three characters long, and loop variables and exception names to be at
>   least two characters long. Exceptions to these minimums can be added
>   via regular expressions.




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

https://reviews.llvm.org/D97753

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


[PATCH] D107958: [clang-format] NFC update the ClangFormatStyleOption.rst following previous change

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

clang/docs/tool/dump_format_style.py was not run as part of  D99840: 
[clang-format] Correctly attach enum braces with ShortEnums disabled 


Bring ClangFormatStyleOptions.rst back in line.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107958

Files:
  clang/docs/ClangFormatStyleOptions.rst


Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -741,8 +741,7 @@
 enum { A, B } myEnum;
 
 false:
-enum
-{
+enum {
   A,
   B
 } myEnum;


Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -741,8 +741,7 @@
 enum { A, B } myEnum;
 
 false:
-enum
-{
+enum {
   A,
   B
 } myEnum;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107450: [clang-tidy] Fix wrong and missing warnings in performance-move-const-arg

2021-08-12 Thread gehry via Phabricator via cfe-commits
Sockke marked 8 inline comments as done.
Sockke added a comment.

In D107450#2938824 , @MTC wrote:

> I think we're a bit off track,  and @Sockke wants to accomplish more than one 
> goal in the same patch. I have summarized what we are currently discussing as 
> follow shows:
>
> 1. Fix the wrong AutoFix which blocks the compilation.
> 2. Find more 'unrecommended' std::move usage and give correct warning 
> messages.
> 3. Whether template should be taken into account.
>
> In addition, I would like to mention that we need to ensure that this check 
> should be consistent with `-Wpessimizing-move`, see 
> https://reviews.llvm.org/D7633, which has done the perfect job.
>
> I suggest that this patch be divided into two patches. In the current patch, 
> fix the **wrong AutoFix**. What the current check should look like is left in 
> the second patch for discussion. @Sockke do you mind simplifying this patch 
> and only achieving the first goal?

Yes, I originally wanted to make some improvements on the premise of keeping 
the old version of the idea. As Quuxplusone said, this improvement still does 
not meet the final requirements, which may require rewriting the entire 
checker.  Any other thoughts? @Quuxplusone,@aaron.ballman,@whisperity,@alexfh


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

https://reviews.llvm.org/D107450

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


[PATCH] D107349: [Matrix] Overload stride arg in matrix.columnwise.load/store.

2021-08-12 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In D107349#2941257 , @mehdi_amini 
wrote:

> Revert to unbreak bots (like this one : 
> https://lab.llvm.org/buildbot/#/builders/13/builds/10930 )

Looks like this should be a pretty trivial test update at least.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107349

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


[PATCH] D105265: [X86] AVX512FP16 instructions enabling 3/6

2021-08-12 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke added inline comments.



Comment at: clang/lib/Headers/avx512fp16intrin.h:1748
+
+#define _mm_cvt_roundsh_i32(A, R)  
\
+  (int)__builtin_ia32_vcvtsh2si32((__v8hf)(A), (int)(R))

Does it also return i32 in x86_64 platform? We may unify the intrinsic both for 
x86 and x86_x64 to return i32.



Comment at: clang/lib/Headers/avx512fp16intrin.h:1874
+
+static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_cvtxph_ps(__m256h __A) {
+  return (__m512)__builtin_ia32_vcvtph2psx512_mask(

VCVTPH2PSX support broadcast compared to VCVTPH2PS, but for intrinsics there is 
no difference. Do we need to add the new intrinsics? Ditto for its variants.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105265

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


[PATCH] D107960: [clang][analyzer] Make ReturnPtrRange checker warn at negative index.

2021-08-12 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision.
Herald added subscribers: manas, steakhal, ASDenysPetrov, martong, gamesh411, 
dkrupp, donat.nagy, Szelethus, arphaman, mikhail.ramalho, a.sidorin, szepet, 
baloghadamsoftware, xazax.hun, whisperity.
Herald added a reviewer: Szelethus.
balazske requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The checker did not work with negative array index at return.
Specially for -1 it did not produce a bug.
`assumeInBound` may not work correct with negative values so a pre-
check is added to the checker for negative array index.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107960

Files:
  clang/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp
  clang/test/Analysis/return-ptr-range.cpp

Index: clang/test/Analysis/return-ptr-range.cpp
===
--- clang/test/Analysis/return-ptr-range.cpp
+++ clang/test/Analysis/return-ptr-range.cpp
@@ -115,3 +115,24 @@
 
 }
 
+int *test_negative_index(int I) {
+  static int arr[10]; // expected-note{{Original object declared here}}
+  // expected-note@-1{{'arr' initialized here}}
+  // expected-note@-2{{Original object declared here}}
+  // expected-note@-3{{'arr' initialized here}}
+  if (I == -1)// expected-note{{Assuming the condition is true}}
+  // expected-note@-1{{Taking true branch}}
+  // expected-note@-2{{Assuming the condition is false}}
+  // expected-note@-3{{Taking false branch}}
+return arr + I;   // expected-warning{{Returned pointer value points outside the original object}}
+  // expected-note@-1{{Returned pointer value points outside the original object}}
+  // expected-note@-2{{Original object 'arr' is an array of 10 'int' objects, returned pointer points at index -1}}
+  if (I == -2)// expected-note{{Assuming the condition is true}}
+  // expected-note@-1{{Taking true branch}}
+return arr + I;   // expected-warning{{Returned pointer value points outside the original object}}
+  // expected-note@-1{{Returned pointer value points outside the original object}}
+  // expected-note@-2{{Original object 'arr' is an array of 10 'int' objects, returned pointer points at index -2}}
+  if (I == 0)
+return arr + I;
+  return arr + I;
+}
Index: clang/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp
@@ -64,61 +64,79 @@
   if (Idx == ElementCount)
 return;
 
-  ProgramStateRef StInBound = state->assumeInBound(Idx, ElementCount, true);
-  ProgramStateRef StOutBound = state->assumeInBound(Idx, ElementCount, false);
-  if (StOutBound && !StInBound) {
-ExplodedNode *N = C.generateErrorNode(StOutBound);
-
-if (!N)
+  auto ElementCountNL = ElementCount.getAs();
+  assert(ElementCountNL && "Array size should not be a pointer");
+  auto IdxNegativeVal =
+  C.getSValBuilder()
+  .evalBinOpNN(state, BO_LT, *ElementCountNL,
+   C.getSValBuilder().makeZeroArrayIndex(),
+   C.getSValBuilder().getConditionType())
+  .castAs();
+  ProgramStateRef IdxNegative, IdxNonNegative;
+  std::tie(IdxNegative, IdxNonNegative) = state->assume(IdxNegativeVal);
+
+  ProgramStateRef StError;
+  if (IdxNegative && !IdxNonNegative) {
+StError = IdxNegative;
+  } else {
+ProgramStateRef StInBound = state->assumeInBound(Idx, ElementCount, true);
+ProgramStateRef StOutBound = state->assumeInBound(Idx, ElementCount, false);
+if (StOutBound && !StInBound)
+  StError = StOutBound;
+else
   return;
+  }
 
-// FIXME: This bug correspond to CWE-466.  Eventually we should have bug
-// types explicitly reference such exploit categories (when applicable).
-if (!BT)
-  BT.reset(new BuiltinBug(
-  this, "Buffer overflow",
-  "Returned pointer value points outside the original object "
-  "(potential buffer overflow)"));
-
-// Generate a report for this bug.
-auto Report =
-std::make_unique(*BT, BT->getDescription(), N);
-Report->addRange(RetE->getSourceRange());
-
-const auto ConcreteElementCount = ElementCount.getAs();
-const auto ConcreteIdx = Idx.getAs();
-
-const auto *DeclR = ER->getSuperRegion()->getAs();
-
-if (DeclR)
-  Report->addNote("Original object declared here",
-  {DeclR->getDecl(), C.getSourceManager()});
-
-if (ConcreteElementCount) {
-  SmallString<128> SBuf;
-  llvm::raw_svector_ostream OS(SBuf);
-  OS << "Original object ";
-  if (DeclR) {
-OS << "'";
-

[PATCH] D107961: [clang-format] Distinguish K&R C function definition and attribute

2021-08-12 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision.
owenpan added reviewers: krasimir, MyDeveloperDay.
owenpan added a project: clang-format.
owenpan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is a follow-up on https://reviews.llvm.org/D107950 which missed 
user-defined types in K&R C.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107961

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


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8247,6 +8247,13 @@
"  return a + b < c;\n"
"};",
Style);
+  verifyFormat("byte *\n" // Break here.
+   "f(a)\n"   // Break here.
+   "byte a[];\n"
+   "{\n"
+   "  return a;\n"
+   "}",
+   Style);
 
   // The return breaking style doesn't affect:
   // * function and object definitions with attribute-like macros
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -14,7 +14,6 @@
 
 #include "UnwrappedLineParser.h"
 #include "FormatToken.h"
-#include "clang/Basic/TokenKinds.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
@@ -995,6 +994,14 @@
   Keywords.kw_import, tok::kw_export);
 }
 
+// This function checks whether a token is a K&R C (aka C78) type including
+// user-defined types.
+static bool isC78Type(const FormatToken &Tok) {
+  return Tok.isOneOf(tok::kw_char, tok::kw_short, tok::kw_int, tok::kw_long,
+ tok::kw_unsigned, tok::kw_float, tok::kw_double,
+ tok::identifier);
+}
+
 // This function checks whether a token starts the first parameter declaration
 // in a K&R C (aka C78) function definition, e.g.:
 //   int f(a, b)
@@ -1003,12 +1010,7 @@
 //  return a + b;
 //   }
 static bool isC78ParameterDecl(const FormatToken *Tok) {
-  if (!Tok)
-return false;
-
-  if (!Tok->isOneOf(tok::kw_int, tok::kw_char, tok::kw_float, tok::kw_double,
-tok::kw_struct, tok::kw_union, tok::kw_long, tok::kw_short,
-tok::kw_unsigned, tok::kw_register))
+  if (!Tok || (Tok->isNot(tok::kw_register) && !isC78Type(*Tok)))
 return false;
 
   Tok = Tok->Previous;
@@ -1369,7 +1371,7 @@
 case tok::r_brace:
   addUnwrappedLine();
   return;
-case tok::l_paren:
+case tok::l_paren: {
   parseParens();
   // Break the unwrapped line if a K&R C function definition has a 
parameter
   // declaration.
@@ -1377,14 +1379,18 @@
 break;
   if (!Previous || Previous->isNot(tok::identifier))
 break;
-  if (Previous->Previous && Previous->Previous->is(tok::at))
+  const FormatToken *PrevPrev = Previous->Previous;
+  if (!PrevPrev || (!isC78Type(*PrevPrev) && PrevPrev->isNot(tok::star)))
+break;
+  const FormatToken *Next = AllTokens[Tokens->getPosition() + 1];
+  if (Next && Next->is(tok::l_paren))
 break;
-  if (!Line->Tokens.begin()->Tok->is(tok::kw_typedef) &&
-  isC78ParameterDecl(FormatTok)) {
+  if (isC78ParameterDecl(FormatTok)) {
 addUnwrappedLine();
 return;
   }
   break;
+}
 case tok::kw_operator:
   nextToken();
   if (FormatTok->isBinaryOperator())


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8247,6 +8247,13 @@
"  return a + b < c;\n"
"};",
Style);
+  verifyFormat("byte *\n" // Break here.
+   "f(a)\n"   // Break here.
+   "byte a[];\n"
+   "{\n"
+   "  return a;\n"
+   "}",
+   Style);
 
   // The return breaking style doesn't affect:
   // * function and object definitions with attribute-like macros
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -14,7 +14,6 @@
 
 #include "UnwrappedLineParser.h"
 #include "FormatToken.h"
-#include "clang/Basic/TokenKinds.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
@@ -995,6 +994,14 @@
   Keywords.kw_import, tok::kw_export);
 }
 
+// This function checks whether a token is a K&R C (aka C78) type including
+// user-defined types.
+static bool isC78Type(const FormatToken &Tok) {
+  return Tok.isOneOf(tok::kw_char, tok::kw_short, tok::kw_int,

[clang] 696ad3c - [OpenCL] Tidy up preserve_vec3 test

2021-08-12 Thread Sven van Haastregt via cfe-commits

Author: Sven van Haastregt
Date: 2021-08-12T14:51:20+01:00
New Revision: 696ad3c491a249f585ba79e0ecf80c5dc003f8f3

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

LOG: [OpenCL] Tidy up preserve_vec3 test

Add CHECK-LABELs and fix string substitution to actually match the
previous definition.

Added: 


Modified: 
clang/test/CodeGenOpenCL/preserve_vec3.cl

Removed: 




diff  --git a/clang/test/CodeGenOpenCL/preserve_vec3.cl 
b/clang/test/CodeGenOpenCL/preserve_vec3.cl
index aefb248e51f49..9260af6167e99 100644
--- a/clang/test/CodeGenOpenCL/preserve_vec3.cl
+++ b/clang/test/CodeGenOpenCL/preserve_vec3.cl
@@ -1,24 +1,27 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown 
-fpreserve-vec3-type  | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown 
-fpreserve-vec3-type | FileCheck %s
 
 typedef float float3 __attribute__((ext_vector_type(3)));
 typedef float float4 __attribute__((ext_vector_type(4)));
 
 void kernel foo(global float3 *a, global float3 *b) {
+  // CHECK-LABEL: spir_kernel void @foo
   // CHECK: %[[LOAD_A:.*]] = load <3 x float>, <3 x float> addrspace(1)* %a
   // CHECK: store <3 x float> %[[LOAD_A]], <3 x float> addrspace(1)* %b
   *b = *a;
 }
 
 void kernel float4_to_float3(global float3 *a, global float4 *b) {
+  // CHECK-LABEL: spir_kernel void @float4_to_float3
   // CHECK: %[[LOAD_A:.*]] = load <4 x float>, <4 x float> addrspace(1)* %b, 
align 16
   // CHECK: %[[ASTYPE:.*]] = shufflevector <4 x float> %[[LOAD_A]], <4 x 
float> poison, <3 x i32> 
-  // CHECK: store <3 x float> %[[ASTYPE:.*]], <3 x float> addrspace(1)* %a, 
align 16
+  // CHECK: store <3 x float> %[[ASTYPE]], <3 x float> addrspace(1)* %a, align 
16
   *a = __builtin_astype(*b, float3);
 }
 
 void kernel float3_to_float4(global float3 *a, global float4 *b) {
+  // CHECK-LABEL: spir_kernel void @float3_to_float4
   // CHECK: %[[LOAD_A:.*]] = load <3 x float>, <3 x float> addrspace(1)* %a, 
align 16
   // CHECK: %[[ASTYPE:.*]] = shufflevector <3 x float> %[[LOAD_A]], <3 x 
float> poison, <4 x i32> 
-  // CHECK: store <4 x float> %[[ASTYPE:.*]], <4 x float> addrspace(1)* %b, 
align 16
+  // CHECK: store <4 x float> %[[ASTYPE]], <4 x float> addrspace(1)* %b, align 
16
   *b = __builtin_astype(*a, float4);
 }



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


[PATCH] D107960: [clang][analyzer] Make ReturnPtrRange checker warn at negative index.

2021-08-12 Thread Balázs Benics via Phabricator via cfe-commits
steakhal requested changes to this revision.
steakhal added a comment.
This revision now requires changes to proceed.

If `assumeInBound()` behaves unexpectedly, we should probably fix that instead.
This change would workaround the issue, instead of fixing it. By fixing the 
root cause all users of `assumeInBound()` would benefit.
I recommend you to have a deeper look at the insides of `assumeInBound()` 
investigating why it behaves that way.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107960

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


[PATCH] D107450: [clang-tidy] Fix wrong and missing warnings in performance-move-const-arg

2021-08-12 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added a comment.

> I suggest that this patch be divided into two patches. In the current patch, 
> fix the wrong AutoFix. What the current check should look like is left in the 
> second patch for discussion. @Sockke do you mind simplifying this patch and 
> only achieving the first goal?

FWIW, I agree. The original "case 1" was fixing wrong behavior; the original 
"case 2" was adding a new feature. Let's see just the "case 1" bugfix (and 
regression test), and then once that's being properly handled and 
regression-tested, it'll be safer to mess around with new feature work.


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

https://reviews.llvm.org/D107450

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


[PATCH] D107963: [OpenCL] Fix as_type(vec3) invalid store creation

2021-08-12 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh created this revision.
svenvh added reviewers: Anastasia, jaykang10.
svenvh added a project: clang.
Herald added subscribers: ldrumm, yaxunl.
svenvh requested review of this revision.
Herald added a subscriber: cfe-commits.

With `-fpreserve-vec3-type` enabled, a cast was not created when
converting from a vec3 type to a non-vec3 type, even though a
conversion to vec4 was performed.  This resulted in creation of
invalid store instructions for the included test cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107963

Files:
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/test/CodeGenOpenCL/preserve_vec3.cl


Index: clang/test/CodeGenOpenCL/preserve_vec3.cl
===
--- clang/test/CodeGenOpenCL/preserve_vec3.cl
+++ clang/test/CodeGenOpenCL/preserve_vec3.cl
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown 
-fpreserve-vec3-type | FileCheck %s
 
+typedef char char3 __attribute__((ext_vector_type(3)));
+typedef short short3 __attribute__((ext_vector_type(3)));
 typedef float float3 __attribute__((ext_vector_type(3)));
 typedef float float4 __attribute__((ext_vector_type(4)));
 
@@ -25,3 +27,19 @@
   // CHECK: store <4 x float> %[[ASTYPE]], <4 x float> addrspace(1)* %b, align 
16
   *b = __builtin_astype(*a, float4);
 }
+
+void from_char3(char3 a, global int *out) {
+  // CHECK-LABEL: void @from_char3
+  // CHECK: %[[ASTYPE:.*]] = shufflevector <3 x i8> %a, <3 x i8> poison, <4 x 
i32> 
+  // CHECK: %[[OUT_BC:.*]] = bitcast i32 addrspace(1)* %out to <4 x i8> 
addrspace(1)*
+  // CHECK: store <4 x i8> %[[ASTYPE]], <4 x i8> addrspace(1)* %[[OUT_BC]]
+  *out = __builtin_astype(a, int);
+}
+
+void from_short3(short3 a, global long *out) {
+  // CHECK-LABEL: void @from_short3
+  // CHECK: %[[ASTYPE:.*]] = shufflevector <3 x i16> %a, <3 x i16> poison, <4 
x i32> 
+  // CHECK: %[[OUT_BC:.*]] = bitcast i64 addrspace(1)* %out to <4 x i16> 
addrspace(1)*
+  // CHECK: store <4 x i16> %[[ASTYPE]], <4 x i16> addrspace(1)* %[[OUT_BC]]
+  *out = __builtin_astype(a, long);
+}
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -4785,11 +4785,8 @@
   // vector to get a vec4, then a bitcast if the target type is different.
   if (NumElementsSrc == 3 && NumElementsDst != 3) {
 Src = ConvertVec3AndVec4(Builder, CGF, Src, 4);
-
-if (!CGF.CGM.getCodeGenOpts().PreserveVec3Type) {
-  Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
- DstTy);
-}
+Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
+   DstTy);
 
 Src->setName("astype");
 return Src;


Index: clang/test/CodeGenOpenCL/preserve_vec3.cl
===
--- clang/test/CodeGenOpenCL/preserve_vec3.cl
+++ clang/test/CodeGenOpenCL/preserve_vec3.cl
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown -fpreserve-vec3-type | FileCheck %s
 
+typedef char char3 __attribute__((ext_vector_type(3)));
+typedef short short3 __attribute__((ext_vector_type(3)));
 typedef float float3 __attribute__((ext_vector_type(3)));
 typedef float float4 __attribute__((ext_vector_type(4)));
 
@@ -25,3 +27,19 @@
   // CHECK: store <4 x float> %[[ASTYPE]], <4 x float> addrspace(1)* %b, align 16
   *b = __builtin_astype(*a, float4);
 }
+
+void from_char3(char3 a, global int *out) {
+  // CHECK-LABEL: void @from_char3
+  // CHECK: %[[ASTYPE:.*]] = shufflevector <3 x i8> %a, <3 x i8> poison, <4 x i32> 
+  // CHECK: %[[OUT_BC:.*]] = bitcast i32 addrspace(1)* %out to <4 x i8> addrspace(1)*
+  // CHECK: store <4 x i8> %[[ASTYPE]], <4 x i8> addrspace(1)* %[[OUT_BC]]
+  *out = __builtin_astype(a, int);
+}
+
+void from_short3(short3 a, global long *out) {
+  // CHECK-LABEL: void @from_short3
+  // CHECK: %[[ASTYPE:.*]] = shufflevector <3 x i16> %a, <3 x i16> poison, <4 x i32> 
+  // CHECK: %[[OUT_BC:.*]] = bitcast i64 addrspace(1)* %out to <4 x i16> addrspace(1)*
+  // CHECK: store <4 x i16> %[[ASTYPE]], <4 x i16> addrspace(1)* %[[OUT_BC]]
+  *out = __builtin_astype(a, long);
+}
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -4785,11 +4785,8 @@
   // vector to get a vec4, then a bitcast if the target type is different.
   if (NumElementsSrc == 3 && NumElementsDst != 3) {
 Src = ConvertVec3AndVec4(Builder, CGF, Src, 4);
-
-if (!CGF.CGM.getCodeGenOpts().PreserveVec3Type) {
-  Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
- DstTy);
-}
+Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Sr

[PATCH] D105264: [X86] AVX512FP16 instructions enabling 2/6

2021-08-12 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei updated this revision to Diff 365995.
pengfei marked an inline comment as done.
pengfei added a comment.

Address Yuanke's comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105264

Files:
  clang/include/clang/Basic/BuiltinsX86.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/avx512fp16intrin.h
  clang/lib/Headers/avx512vlfp16intrin.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/X86/avx512fp16-builtins.c
  clang/test/CodeGen/X86/avx512vlfp16-builtins.c
  llvm/include/llvm/IR/IntrinsicsX86.td
  llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86InstrAVX512.td
  llvm/lib/Target/X86/X86InstrFoldTables.cpp
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/lib/Target/X86/X86IntrinsicsInfo.h
  llvm/test/CodeGen/X86/avx512fp16-arith-intrinsics.ll
  llvm/test/CodeGen/X86/avx512fp16-arith-vl-intrinsics.ll
  llvm/test/CodeGen/X86/avx512fp16-arith.ll
  llvm/test/CodeGen/X86/avx512fp16-fmaxnum.ll
  llvm/test/CodeGen/X86/avx512fp16-fminnum.ll
  llvm/test/CodeGen/X86/avx512fp16-fold-load-binops.ll
  llvm/test/CodeGen/X86/avx512fp16-fold-xmm-zero.ll
  llvm/test/CodeGen/X86/avx512fp16-fp-logic.ll
  llvm/test/CodeGen/X86/avx512fp16-intrinsics.ll
  llvm/test/CodeGen/X86/avx512fp16-machine-combiner.ll
  llvm/test/CodeGen/X86/avx512fp16-mov.ll
  llvm/test/CodeGen/X86/avx512fp16-unsafe-fp-math.ll
  llvm/test/CodeGen/X86/fp-strict-scalar-cmp-fp16.ll
  llvm/test/CodeGen/X86/fp-strict-scalar-fp16.ll
  llvm/test/CodeGen/X86/pseudo_cmov_lower-fp16.ll
  llvm/test/CodeGen/X86/stack-folding-fp-avx512fp16.ll
  llvm/test/CodeGen/X86/stack-folding-fp-avx512fp16vl.ll
  llvm/test/CodeGen/X86/vec-strict-128-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-256-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-512-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-cmp-128-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-cmp-256-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-cmp-512-fp16.ll
  llvm/test/CodeGen/X86/vector-reduce-fmax-nnan.ll
  llvm/test/CodeGen/X86/vector-reduce-fmin-nnan.ll
  llvm/test/MC/Disassembler/X86/avx512fp16.txt
  llvm/test/MC/Disassembler/X86/avx512fp16vl.txt
  llvm/test/MC/X86/avx512fp16.s
  llvm/test/MC/X86/avx512fp16vl.s
  llvm/test/MC/X86/intel-syntax-avx512fp16.s
  llvm/test/MC/X86/intel-syntax-avx512fp16vl.s

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


[PATCH] D105264: [X86] AVX512FP16 instructions enabling 2/6

2021-08-12 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei added inline comments.



Comment at: llvm/lib/Target/X86/X86InstrFoldTables.cpp:4838
   { X86::VMULSDZrr_Intk,X86::VMULSDZrm_Intk,
TB_NO_REVERSE },
+  { X86::VMULSHZrr_Intk,X86::VMULSHZrm_Intk,
TB_NO_REVERSE },
   { X86::VMULSSZrr_Intk,X86::VMULSSZrm_Intk,
TB_NO_REVERSE },

LuoYuanke wrote:
> Is this because intrinsics always assume the arguments are passed in register?
No. Because the register size of scalar intrinsics is larger than corresponding 
memory size:
https://github.com/llvm/llvm-project/blob/main/llvm/utils/TableGen/X86FoldTablesEmitter.cpp#L493



Comment at: llvm/test/CodeGen/X86/avx512fp16-fmaxnum.ll:26
+; CHECK:   # %bb.0:
+; CHECK-NEXT:vmaxph %xmm0, %xmm1, %xmm2 # encoding: 
[0x62,0xf5,0x74,0x08,0x5f,0xd0]
+; CHECK-NEXT:vcmpunordph %xmm0, %xmm0, %k1 # encoding: 
[0x62,0xf3,0x7c,0x08,0xc2,0xc8,0x03]

LuoYuanke wrote:
> Is it legal without avx512vl?
`avx512fp16` implies `avx512vl`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105264

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


[PATCH] D107682: [AVR][clang] Improve search for avr-libc installation path

2021-08-12 Thread Ben Shi via Phabricator via cfe-commits
benshi001 updated this revision to Diff 365996.

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

https://reviews.llvm.org/D107682

Files:
  clang/lib/Driver/ToolChains/AVR.cpp
  clang/test/Driver/Inputs/basic_avr_tree_2/opt/local/avr/include/.keep
  clang/test/Driver/Inputs/basic_avr_tree_2/opt/local/avr/lib/libavr.a
  
clang/test/Driver/Inputs/basic_avr_tree_2/opt/local/lib/gcc/avr/10.3.0/libgcc.a
  clang/test/Driver/Inputs/basic_avr_tree_2/usr/avr/include/.keep
  clang/test/Driver/Inputs/basic_avr_tree_2/usr/avr/lib/libavr.a
  clang/test/Driver/avr-toolchain.c


Index: clang/test/Driver/avr-toolchain.c
===
--- clang/test/Driver/avr-toolchain.c
+++ clang/test/Driver/avr-toolchain.c
@@ -6,12 +6,24 @@
 // CHECK1-SAME: "-resource-dir" "[[RESOURCE:[^"]+]]"
 // CHECK1-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree]]"
 // CHECK1-SAME: "-internal-isystem"
-// CHECK1-SAME: {{^}} "[[SYSROOT]]/usr/lib/avr/include"
+// CHECK1-SAME: {{^}} "[[SYSROOT]]/usr/lib/gcc/avr/5.4.0/../../../avr/include"
 // CHECK1-NOT:  "-L
 // CHECK1:  avr-ld"
 // CHECK1-SAME: "-o" "a.out"
 // CHECK1-SAME: {{^}} "--gc-sections"
 
+// RUN: %clang %s -### -target avr --sysroot 
%S/Inputs/basic_avr_tree_2/opt/local -S 2>&1 | FileCheck --check-prefix=CHECK2 
%s
+// CHECK2: clang{{.*}} "-cc1" "-triple" "avr"
+// CHECK2-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree_2/opt/local]]"
+// CHECK2-SAME: "-internal-isystem"
+// CHECK2-SAME: {{^}} "[[SYSROOT]]/lib/gcc/avr/10.3.0/../../../../avr/include"
+
+// RUN: %clang %s -### -target avr --sysroot %S/Inputs/basic_avr_tree_2 -S 
2>&1 | FileCheck --check-prefix=CHECK3 %s
+// CHECK3: clang{{.*}} "-cc1" "-triple" "avr"
+// CHECK3-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree_2]]"
+// CHECK3-SAME: "-internal-isystem"
+// CHECK3-SAME: {{^}} "[[SYSROOT]]/usr/avr/include"
+
 // RUN: %clang %s -### -target avr 2>&1 | FileCheck -check-prefix=CC1 %s
 // CC1: clang{{.*}} "-cc1" "-triple" "avr" {{.*}} "-fno-use-init-array"
 
Index: clang/lib/Driver/ToolChains/AVR.cpp
===
--- clang/lib/Driver/ToolChains/AVR.cpp
+++ clang/lib/Driver/ToolChains/AVR.cpp
@@ -453,11 +453,21 @@
 }
 
 llvm::Optional AVRToolChain::findAVRLibcInstallation() const {
+  // Search avr-libc installation according to avr-gcc installation.
+  std::string GCCParent(GCCInstallation.getParentLibPath());
+  std::string Path(GCCParent + "/avr");
+  if (llvm::sys::fs::is_directory(Path))
+return Path;
+  Path = GCCParent + "/../avr";
+  if (llvm::sys::fs::is_directory(Path))
+return Path;
+
+  // Search avr-libc installation from possible locations, and return the first
+  // one that exists, if there is no avr-gcc installed.
   for (StringRef PossiblePath : PossibleAVRLibcLocations) {
 std::string Path = getDriver().SysRoot + PossiblePath.str();
-// Return the first avr-libc installation that exists.
 if (llvm::sys::fs::is_directory(Path))
-  return Optional(Path);
+  return Path;
   }
 
   return llvm::None;


Index: clang/test/Driver/avr-toolchain.c
===
--- clang/test/Driver/avr-toolchain.c
+++ clang/test/Driver/avr-toolchain.c
@@ -6,12 +6,24 @@
 // CHECK1-SAME: "-resource-dir" "[[RESOURCE:[^"]+]]"
 // CHECK1-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree]]"
 // CHECK1-SAME: "-internal-isystem"
-// CHECK1-SAME: {{^}} "[[SYSROOT]]/usr/lib/avr/include"
+// CHECK1-SAME: {{^}} "[[SYSROOT]]/usr/lib/gcc/avr/5.4.0/../../../avr/include"
 // CHECK1-NOT:  "-L
 // CHECK1:  avr-ld"
 // CHECK1-SAME: "-o" "a.out"
 // CHECK1-SAME: {{^}} "--gc-sections"
 
+// RUN: %clang %s -### -target avr --sysroot %S/Inputs/basic_avr_tree_2/opt/local -S 2>&1 | FileCheck --check-prefix=CHECK2 %s
+// CHECK2: clang{{.*}} "-cc1" "-triple" "avr"
+// CHECK2-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree_2/opt/local]]"
+// CHECK2-SAME: "-internal-isystem"
+// CHECK2-SAME: {{^}} "[[SYSROOT]]/lib/gcc/avr/10.3.0/../../../../avr/include"
+
+// RUN: %clang %s -### -target avr --sysroot %S/Inputs/basic_avr_tree_2 -S 2>&1 | FileCheck --check-prefix=CHECK3 %s
+// CHECK3: clang{{.*}} "-cc1" "-triple" "avr"
+// CHECK3-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree_2]]"
+// CHECK3-SAME: "-internal-isystem"
+// CHECK3-SAME: {{^}} "[[SYSROOT]]/usr/avr/include"
+
 // RUN: %clang %s -### -target avr 2>&1 | FileCheck -check-prefix=CC1 %s
 // CC1: clang{{.*}} "-cc1" "-triple" "avr" {{.*}} "-fno-use-init-array"
 
Index: clang/lib/Driver/ToolChains/AVR.cpp
===
--- clang/lib/Driver/ToolChains/AVR.cpp
+++ clang/lib/Driver/ToolChains/AVR.cpp
@@ -453,11 +453,21 @@
 }
 
 llvm::Optional AVRToolChain::findAVRLibcInstallation() const {
+  // Search avr-libc installation according to avr-gcc installation.
+  std::string GCCParent(GCCInstallation.getParentLibPath());
+  std::string Path(GCCP

[PATCH] D107682: [AVR][clang] Improve search for avr-libc installation path

2021-08-12 Thread Ben Shi via Phabricator via cfe-commits
benshi001 added a comment.

In D107682#2936040 , @MaskRay wrote:

> Seems a new RUN line is needed. If having too many mock trees are 
> inconvenient, consider `clang/unittests/Driver/ToolChainTest.cpp`

I am not familiar with the way in `clang/unittests/Driver/ToolChainTest.cpp`, I 
always use clang command line than libcall. Though I have created a new test 
`TEST(ToolChainTest, VFSAVRInstallation)` by imitating the existing 
`TEST(ToolChainTest, VFSGCCInstallation)`, it did not work as I expected. So I 
created a new mock tree `basic_avr_tree_2`.

And the tests in avr-toolchain.cc should cover all three possible cases

1. find avr-libc at AVR-GCC/../../../avr (the case `--check-prefix=CHECK1`)
2. find avr-libc at AVR-GCC/../../../../avr (the case `--check-prefix=CHECK2`)
3. there is not avr-gcc and find avr-libc at SYSROOT/usr/avr (the case 
`--check-prefix=CHECK3`)


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

https://reviews.llvm.org/D107682

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


[PATCH] D107682: [AVR][clang] Improve search for avr-libc installation path

2021-08-12 Thread Ben Shi via Phabricator via cfe-commits
benshi001 added a comment.

The file/directory structure in basic_avr_tree_2/opt/local is the same as 
mhjacobson's machine.

  Here's what my directory tree looks like. My gcc install consists of:
  
  /opt/local/bin/avr-gcc-10.3.0
  /opt/local/lib/gcc/avr/10.3.0/libgcc.a
  /opt/local/libexec/gcc/avr/10.3.0/cc1
  And avr-libc is at:
  
  /opt/local/avr/lib/libc.a
  /opt/local/avr/include/stdio.h


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

https://reviews.llvm.org/D107682

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


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

2021-08-12 Thread Alf via Phabricator via cfe-commits
gAlfonso-bit added a comment.

Not sure about the timing of base patch, but maybe this patch is also candidate 
for llvm 13 (backport)?


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

https://reviews.llvm.org/D107775

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


[PATCH] D107646: [PowerPC] Fix the frame addresss computing return address for `__builtin_return_address`

2021-08-12 Thread Victor Huang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG99e00663d4cd: [PowerPC] Fix return address computation for 
"__builtin_return_address" (authored by NeHuang).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107646

Files:
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/test/CodeGen/PowerPC/2010-05-03-retaddr1.ll
  llvm/test/CodeGen/PowerPC/retaddr_multi_levels.ll

Index: llvm/test/CodeGen/PowerPC/retaddr_multi_levels.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/retaddr_multi_levels.ll
@@ -0,0 +1,140 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux \
+; RUN:   -mcpu=pwr8 | FileCheck %s -check-prefix=CHECK-64B-LE
+; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux \
+; RUN:   -mcpu=pwr7 | FileCheck %s -check-prefix=CHECK-64B-BE
+; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-aix \
+; RUN:   -mcpu=pwr7 | FileCheck %s -check-prefix=CHECK-64B-BE
+; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-unknown-aix \
+; RUN:   -mcpu=pwr7 | FileCheck %s -check-prefix=CHECK-32B-BE
+
+declare i8* @llvm.returnaddress(i32) nounwind readnone
+
+define i8* @test0() nounwind readnone {
+; CHECK-64B-LE-LABEL: test0:
+; CHECK-64B-LE:   # %bb.0: # %entry
+; CHECK-64B-LE-NEXT:mflr 0
+; CHECK-64B-LE-NEXT:std 0, 16(1)
+; CHECK-64B-LE-NEXT:stdu 1, -32(1)
+; CHECK-64B-LE-NEXT:ld 3, 48(1)
+; CHECK-64B-LE-NEXT:addi 1, 1, 32
+; CHECK-64B-LE-NEXT:ld 0, 16(1)
+; CHECK-64B-LE-NEXT:mtlr 0
+; CHECK-64B-LE-NEXT:blr
+;
+; CHECK-64B-BE-LABEL: test0:
+; CHECK-64B-BE:   # %bb.0: # %entry
+; CHECK-64B-BE-NEXT:mflr 0
+; CHECK-64B-BE-NEXT:std 0, 16(1)
+; CHECK-64B-BE-NEXT:stdu 1, -48(1)
+; CHECK-64B-BE-NEXT:ld 3, 64(1)
+; CHECK-64B-BE-NEXT:addi 1, 1, 48
+; CHECK-64B-BE-NEXT:ld 0, 16(1)
+; CHECK-64B-BE-NEXT:mtlr 0
+; CHECK-64B-BE-NEXT:blr
+;
+; CHECK-32B-BE-LABEL: test0:
+; CHECK-32B-BE:   # %bb.0: # %entry
+; CHECK-32B-BE-NEXT:mflr 0
+; CHECK-32B-BE-NEXT:stw 0, 8(1)
+; CHECK-32B-BE-NEXT:stwu 1, -32(1)
+; CHECK-32B-BE-NEXT:lwz 3, 40(1)
+; CHECK-32B-BE-NEXT:addi 1, 1, 32
+; CHECK-32B-BE-NEXT:lwz 0, 8(1)
+; CHECK-32B-BE-NEXT:mtlr 0
+; CHECK-32B-BE-NEXT:blr
+entry:
+  %0 = tail call i8* @llvm.returnaddress(i32 0);
+  ret i8* %0
+}
+
+define i8* @test1() nounwind readnone {
+; CHECK-64B-LE-LABEL: test1:
+; CHECK-64B-LE:   # %bb.0: # %entry
+; CHECK-64B-LE-NEXT:mflr 0
+; CHECK-64B-LE-NEXT:std 0, 16(1)
+; CHECK-64B-LE-NEXT:stdu 1, -32(1)
+; CHECK-64B-LE-NEXT:ld 3, 0(1)
+; CHECK-64B-LE-NEXT:ld 3, 0(3)
+; CHECK-64B-LE-NEXT:ld 3, 16(3)
+; CHECK-64B-LE-NEXT:addi 1, 1, 32
+; CHECK-64B-LE-NEXT:ld 0, 16(1)
+; CHECK-64B-LE-NEXT:mtlr 0
+; CHECK-64B-LE-NEXT:blr
+;
+; CHECK-64B-BE-LABEL: test1:
+; CHECK-64B-BE:   # %bb.0: # %entry
+; CHECK-64B-BE-NEXT:mflr 0
+; CHECK-64B-BE-NEXT:std 0, 16(1)
+; CHECK-64B-BE-NEXT:stdu 1, -48(1)
+; CHECK-64B-BE-NEXT:ld 3, 0(1)
+; CHECK-64B-BE-NEXT:ld 3, 0(3)
+; CHECK-64B-BE-NEXT:ld 3, 16(3)
+; CHECK-64B-BE-NEXT:addi 1, 1, 48
+; CHECK-64B-BE-NEXT:ld 0, 16(1)
+; CHECK-64B-BE-NEXT:mtlr 0
+; CHECK-64B-BE-NEXT:blr
+;
+; CHECK-32B-BE-LABEL: test1:
+; CHECK-32B-BE:   # %bb.0: # %entry
+; CHECK-32B-BE-NEXT:mflr 0
+; CHECK-32B-BE-NEXT:stw 0, 8(1)
+; CHECK-32B-BE-NEXT:stwu 1, -32(1)
+; CHECK-32B-BE-NEXT:lwz 3, 0(1)
+; CHECK-32B-BE-NEXT:lwz 3, 0(3)
+; CHECK-32B-BE-NEXT:lwz 3, 8(3)
+; CHECK-32B-BE-NEXT:addi 1, 1, 32
+; CHECK-32B-BE-NEXT:lwz 0, 8(1)
+; CHECK-32B-BE-NEXT:mtlr 0
+; CHECK-32B-BE-NEXT:blr
+entry:
+  %0 = tail call i8* @llvm.returnaddress(i32 1);
+  ret i8* %0
+}
+
+define i8* @test2() nounwind readnone {
+; CHECK-64B-LE-LABEL: test2:
+; CHECK-64B-LE:   # %bb.0: # %entry
+; CHECK-64B-LE-NEXT:mflr 0
+; CHECK-64B-LE-NEXT:std 0, 16(1)
+; CHECK-64B-LE-NEXT:stdu 1, -32(1)
+; CHECK-64B-LE-NEXT:ld 3, 0(1)
+; CHECK-64B-LE-NEXT:ld 3, 0(3)
+; CHECK-64B-LE-NEXT:ld 3, 0(3)
+; CHECK-64B-LE-NEXT:ld 3, 16(3)
+; CHECK-64B-LE-NEXT:addi 1, 1, 32
+; CHECK-64B-LE-NEXT:ld 0, 16(1)
+; CHECK-64B-LE-NEXT:mtlr 0
+; CHECK-64B-LE-NEXT:blr
+;
+; CHECK-64B-BE-LABEL: test2:
+; CHECK-64B-BE:   # %bb.0: # %entry
+; CHECK-64B-BE-NEXT:mflr 0
+; CHECK-64B-BE-NEXT:std 0, 16(1)
+; CHECK-64B-BE-NEXT:stdu 1, -48(1)
+; CHECK-64B-BE-NEXT:ld 3, 0(1)
+; CHECK-64B-BE-NEXT:ld 3, 0(3)
+; CHECK-64B-BE-NEXT:ld 3, 0(3)
+; CHECK-64B-BE-NEXT:ld 3, 16(3)
+; CHECK-64B-BE-NEXT:addi 1, 1, 48
+; CHECK-64B-BE-NEXT:ld 0, 16(1)
+; CHECK-64B-BE-NEXT:mtlr 0
+; CHECK-64B-BE-NEXT:blr
+;
+; CHECK-32B-BE-LABEL: test2:
+; CHE

[PATCH] D106277: [SVE] Remove the interface for getMaxVScale in favour of the IR attributes

2021-08-12 Thread Dylan Fleming via Phabricator via cfe-commits
DylanFleming-arm updated this revision to Diff 366001.
DylanFleming-arm added a comment.

Added checks for MaxVScale > 0
Changed getMaxNumElemenets() to take Function* instead of Instruction*
Fixed clang-tidy warning

I haven't included a test for vscale_range(2, 0) here, as one was added in the 
meantime in commit fe6ae81 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106277

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AArch64.h
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/test/CodeGen/arm-sve-vector-bits-vscale-range.c
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Analysis/CostModel/AArch64/sve-gather.ll
  llvm/test/Analysis/CostModel/AArch64/sve-scatter.ll
  llvm/test/Transforms/LoopVectorize/AArch64/first-order-recurrence.ll
  llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
  llvm/test/Transforms/LoopVectorize/AArch64/scalable-vectorization.ll
  llvm/test/Transforms/LoopVectorize/AArch64/scalable-vf-hint.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-cond-inv-loads.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-gather-scatter.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-inv-store.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-large-strides.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-strict-fadd-cost.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-phi.ll

Index: llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-phi.ll
===
--- llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-phi.ll
+++ llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-phi.ll
@@ -12,7 +12,7 @@
 ; that we can use gather instructions with the correct offsets, taking
 ; vscale into account.
 
-define void @widen_ptr_phi_unrolled(i32* noalias nocapture %a, i32* noalias nocapture %b, i32* nocapture readonly %c, i64 %n) {
+define void @widen_ptr_phi_unrolled(i32* noalias nocapture %a, i32* noalias nocapture %b, i32* nocapture readonly %c, i64 %n) #0 {
 ; CHECK-LABEL: @widen_ptr_phi_unrolled(
 ; CHECK:   vector.body:
 ; CHECK-NEXT:[[POINTER_PHI:%.*]] = phi i32* [ %c, %vector.ph ], [ %[[PTR_IND:.*]], %vector.body ]
@@ -122,7 +122,7 @@
 ; because it is stored to memory.
 ;
 
-define i32 @pointer_iv_mixed(i32* noalias %a, i32** noalias %b, i64 %n) {
+define i32 @pointer_iv_mixed(i32* noalias %a, i32** noalias %b, i64 %n) #0 {
 ; CHECK-LABEL: @pointer_iv_mixed(
 ; CHECK: vector.body
 ; CHECK:   %[[IDX:.*]] = phi i64 [ 0, %vector.ph ], [ %{{.*}}, %vector.body ]
@@ -170,7 +170,7 @@
   ret i32 %tmp5
 }
 
-
+attributes #0 = { vscale_range(0, 16) }
 !0 = distinct !{!0, !1, !2, !3, !4, !5}
 !1 = !{!"llvm.loop.mustprogress"}
 !2 = !{!"llvm.loop.vectorize.width", i32 4}
Index: llvm/test/Transforms/LoopVectorize/AArch64/sve-strict-fadd-cost.ll
===
--- llvm/test/Transforms/LoopVectorize/AArch64/sve-strict-fadd-cost.ll
+++ llvm/test/Transforms/LoopVectorize/AArch64/sve-strict-fadd-cost.ll
@@ -49,7 +49,7 @@
   ret double %add
 }
 
-attributes #0 = { "target-features"="+sve" }
+attributes #0 = { "target-features"="+sve" vscale_range(0, 16) }
 
 !0 = distinct !{!0, !1}
 !1 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}
Index: llvm/test/Transforms/LoopVectorize/AArch64/sve-large-strides.ll
===
--- llvm/test/Transforms/LoopVectorize/AArch64/sve-large-strides.ll
+++ llvm/test/Transforms/LoopVectorize/AArch64/sve-large-strides.ll
@@ -1,6 +1,6 @@
 ; RUN: opt -mtriple aarch64-linux-gnu -mattr=+sve -loop-vectorize -scalable-vectorization=on -dce -instcombine -S <%s | FileCheck %s
 
-define void @stride7_i32(i32* noalias nocapture %dst, i64 %n) {
+define void @stride7_i32(i32* noalias nocapture %dst, i64 %n) #0 {
 ; CHECK-LABEL: @stride7_i32(
 ; CHECK:  vector.body
 ; CHECK:%[[VEC_IND:.*]] = phi  [ %{{.*}}, %vector.ph ], [ %{{.*}}, %vector.body ]
@@ -27,7 +27,7 @@
   ret void
 }
 
-define void @stride7_f64(double* noalias nocapture %dst, i64 %n) {
+define void @stride7_f64(double* noalias nocapture %dst, i64 %n) #0 {
 ; CHECK-LABEL: @stride7_f64(
 ; CHECK:  vector.body
 ; CHECK:%[[VEC_IND:.*]] = phi  [ %{{.*}}, %vector.ph ], [ %{{.*}}, %vector.body ]
@@ -55,7 +55,7 @@
 }
 
 
-define void @cond_stride7_f64(double* noalias nocapture %dst, i64* noalias nocapture readonly %cond, i64 %n) {
+define void @cond_stride7_f64(double* noalias nocapture %dst, i64* noalias nocapture readonly %cond, i64 %n) #0 {
 ; CHECK-LABEL: @cond_stride7_f64(
 ; CHECK:  vector.body
 ; CHECK:%[[MASK:.*]] = icmp ne 
@@ -90,7 +90,7 @@
   

[PATCH] D107719: [Clang][AST][NFC] Resolve FIXME: Remove unused QualType ElementType member from the ASTContext class.

2021-08-12 Thread Alf via Phabricator via cfe-commits
gAlfonso-bit added a comment.

Not sure about the timing of base patch, but maybe this patch is also candidate 
for llvm 13 (backport)?


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

https://reviews.llvm.org/D107719

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


[PATCH] D107961: [clang-format] Distinguish K&R C function definition and attribute

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



Comment at: clang/lib/Format/UnwrappedLineParser.cpp:17
 #include "FormatToken.h"
-#include "clang/Basic/TokenKinds.h"
 #include "llvm/ADT/STLExtras.h"

Why is this not needed anymore?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107961

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


[clang-tools-extra] d2c5cbc - Add a check for enforcing minimum length for variable names

2021-08-12 Thread Aaron Ballman via cfe-commits

Author: Florin Iucha
Date: 2021-08-12T11:31:26-04:00
New Revision: d2c5cbc3a856c2f8bbda05540fa761bb94ba32f6

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

LOG: Add a check for enforcing minimum length for variable names

Add a check for enforcing minimum length for variable names. A default
minimum length of three characters is applied to regular variables
(including function parameters). Loop counters and exception variables
have a minimum of two characters. Additionally, the 'i', 'j' and 'k'
are accepted as legacy values.

All three sizes, as well as the list of accepted legacy loop counter
names are configurable.

Added: 
clang-tools-extra/clang-tidy/readability/IdentifierLengthCheck.cpp
clang-tools-extra/clang-tidy/readability/IdentifierLengthCheck.h
clang-tools-extra/docs/clang-tidy/checks/readability-identifier-length.rst
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-length.cpp

Modified: 
clang-tools-extra/clang-tidy/readability/CMakeLists.txt
clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/list.rst

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
index 0d35991d24799..78256d6f73251 100644
--- a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
@@ -13,6 +13,7 @@ add_clang_library(clangTidyReadabilityModule
   ElseAfterReturnCheck.cpp
   FunctionCognitiveComplexityCheck.cpp
   FunctionSizeCheck.cpp
+  IdentifierLengthCheck.cpp
   IdentifierNamingCheck.cpp
   ImplicitBoolConversionCheck.cpp
   InconsistentDeclarationParameterNameCheck.cpp

diff  --git 
a/clang-tools-extra/clang-tidy/readability/IdentifierLengthCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/IdentifierLengthCheck.cpp
new file mode 100644
index 0..1fd8624fcf4b2
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierLengthCheck.cpp
@@ -0,0 +1,156 @@
+//===--- IdentifierLengthCheck.cpp - clang-tidy
+//-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "IdentifierLengthCheck.h"
+#include "../utils/OptionsUtils.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace readability {
+
+const unsigned DefaultMinimumVariableNameLength = 3;
+const unsigned DefaultMinimumLoopCounterNameLength = 2;
+const unsigned DefaultMinimumExceptionNameLength = 2;
+const unsigned DefaultMinimumParameterNameLength = 3;
+const char DefaultIgnoredLoopCounterNames[] = "^[ijk_]$";
+const char DefaultIgnoredVariableNames[] = "";
+const char DefaultIgnoredExceptionVariableNames[] = "^[e]$";
+const char DefaultIgnoredParameterNames[] = "^[n]$";
+
+const char ErrorMessage[] =
+"%select{variable|exception variable|loop variable|"
+"parameter}0 name %1 is too short, expected at least %2 characters";
+
+IdentifierLengthCheck::IdentifierLengthCheck(StringRef Name,
+ ClangTidyContext *Context)
+: ClangTidyCheck(Name, Context),
+  MinimumVariableNameLength(Options.get("MinimumVariableNameLength",
+DefaultMinimumVariableNameLength)),
+  MinimumLoopCounterNameLength(Options.get(
+  "MinimumLoopCounterNameLength", 
DefaultMinimumLoopCounterNameLength)),
+  MinimumExceptionNameLength(Options.get(
+  "MinimumExceptionNameLength", DefaultMinimumExceptionNameLength)),
+  MinimumParameterNameLength(Options.get(
+  "MinimumParameterNameLength", DefaultMinimumParameterNameLength)),
+  IgnoredVariableNamesInput(
+  Options.get("IgnoredVariableNames", DefaultIgnoredVariableNames)),
+  IgnoredVariableNames(IgnoredVariableNamesInput),
+  IgnoredLoopCounterNamesInput(Options.get("IgnoredLoopCounterNames",
+   
DefaultIgnoredLoopCounterNames)),
+  IgnoredLoopCounterNames(IgnoredLoopCounterNamesInput),
+  IgnoredExceptionVariableNamesInput(
+  Options.get("IgnoredExceptionVariableNames",
+  DefaultIgnoredExceptionVariableNames)),
+  IgnoredExceptionVariableNames(IgnoredExceptionVariableNamesInput),
+  IgnoredParameterNamesInput(
+  Options.get("IgnoredParameterNames", Defau

[PATCH] D97753: [clang-tidy] Add a check for enforcing minimum length for variable names

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

In D97753#2941277 , @0x8000- wrote:

> The diff was generated with format-patch, so can be applied with "git am".
>
> The envelope:
>
>> commit d98d336b452876cfbc32ad1b76319912c45b646b (HEAD -> 
>> readability-variable-name-length-main)
>> Author: Florin Iucha 
>> Date:   Mon Mar 1 00:57:01 2021 -0500

Thanks! When I go to download the diff from Phab, it drops the envelope so all 
I have is the diff. :-)

I've commit on your behalf in d2c5cbc3a856c2f8bbda05540fa761bb94ba32f6 



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

https://reviews.llvm.org/D97753

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


[PATCH] D106137: [flang][driver] Add support for Frontend Plugins

2021-08-12 Thread David Spickett via Phabricator via cfe-commits
DavidSpickett added a comment.

This has broken cmake config on the out of tree flang bot:
https://lab.llvm.org/buildbot/#/builders/175/builds/2026

(with perhaps the least helpful cmake error I've ever seen)

Not personally familiar with what "out of tree" means for flang but you should 
be able to pull the steps from the buildbot UI. (perhaps your change assumes 
it's "in tree")


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106137

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


[clang] ccb5b9b - [CSSPGO] Allow the use of debug-info-for-profiling and pseudo-probe-for-profiling together

2021-08-12 Thread Hongtao Yu via cfe-commits

Author: Hongtao Yu
Date: 2021-08-12T08:52:49-07:00
New Revision: ccb5b9bbfb5cef1aa2982481894f30c8f81d5253

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

LOG: [CSSPGO] Allow the use of debug-info-for-profiling and 
pseudo-probe-for-profiling together

Previoulsy debug-info-for-profiling and pseudo-probe-for-profiling are mutual 
exclusive because they compete the dwarf discrimnator for callsites on the IR. 
This changes allows to use the two switches together. The side effect is that 
callsite discriminators will be taken by pseudo probe, while discriminators for 
other instructions are still available for AutoFDO use. This is less than 
ideal, however, it still allows us a chance to smoothly transition from AutoFDO 
to CSSPGO, by collecting both profiles from a CSSPGO binary.

Reviewed By: wenlei, wmi

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

Added: 
llvm/test/Transforms/SampleProfile/pseudo-probe-discriminator.ll

Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp
clang/test/Driver/pseudo-probe.c
llvm/include/llvm/Passes/PassBuilder.h
llvm/tools/opt/NewPMDriver.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index ceeae94e56678..e19e1222f702e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3892,12 +3892,6 @@ static void renderDebugOptions(const ToolChain &TC, 
const Driver &D,
ArgStringList &CmdArgs,
codegenoptions::DebugInfoKind &DebugInfoKind,
DwarfFissionKind &DwarfFission) {
-  // These two forms of profiling info can't be used together.
-  if (const Arg *A1 = 
Args.getLastArg(options::OPT_fpseudo_probe_for_profiling))
-if (const Arg *A2 = 
Args.getLastArg(options::OPT_fdebug_info_for_profiling))
-  D.Diag(diag::err_drv_argument_not_allowed_with)
-  << A1->getAsString(Args) << A2->getAsString(Args);
-
   if (Args.hasFlag(options::OPT_fdebug_info_for_profiling,
options::OPT_fno_debug_info_for_profiling, false) &&
   checkDebugInfoOption(

diff  --git a/clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp 
b/clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp
index 0a66818b23be3..421195db83408 100644
--- a/clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp
+++ b/clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp
@@ -14,8 +14,11 @@
 // RUN: echo > %t.proftext
 // RUN: llvm-profdata merge %t.proftext -o %t.profdata
 // RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager 
-O1 -fprofile-instrument-use-path=%t.profdata -fdebug-info-for-profiling %s -o 
- 2>&1 | FileCheck %s --check-prefix=DISCR
+// RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager 
-O1 -fdebug-info-for-profiling -fpseudo-probe-for-profiling %s -o - 2>&1 | 
FileCheck %s --check-prefix=PROBE
 
 // NODISCR-NOT: Running pass: AddDiscriminatorsPass
 // DISCR:   Running pass: AddDiscriminatorsPass on {{.*}}
+// PROBE:   Running pass: AddDiscriminatorsPass on {{.*}}
+// PROBE:   Running pass: SampleProfileProbePass on {{.*}}
 
 void foo() {}

diff  --git a/clang/test/Driver/pseudo-probe.c 
b/clang/test/Driver/pseudo-probe.c
index 79b23df557a6c..76c4364e609d0 100644
--- a/clang/test/Driver/pseudo-probe.c
+++ b/clang/test/Driver/pseudo-probe.c
@@ -1,13 +1,13 @@
 // RUN: %clang -### -fpseudo-probe-for-profiling %s 2>&1 | FileCheck %s 
--check-prefix=YESPROBE
 // RUN: %clang -### -fno-pseudo-probe-for-profiling %s 2>&1 | FileCheck %s 
--check-prefix=NOPROBE
-// RUN: %clang -### -fpseudo-probe-for-profiling -fdebug-info-for-profiling %s 
2>&1 | FileCheck %s --check-prefix=CONFLICT
+// RUN: %clang -### -fpseudo-probe-for-profiling -fdebug-info-for-profiling %s 
2>&1 | FileCheck %s --check-prefix=YESPROBE --check-prefix=YESDEBUG  
 // RUN: %clang -### -fpseudo-probe-for-profiling 
-funique-internal-linkage-names %s 2>&1 | FileCheck %s --check-prefix=YESPROBE
 // RUN: %clang -### -fpseudo-probe-for-profiling 
-fno-unique-internal-linkage-names %s 2>&1 | FileCheck %s --check-prefix=NONAME
 
+// YESDEBUG: -fdebug-info-for-profiling
 // YESPROBE: -fpseudo-probe-for-profiling
 // YESPROBE: -funique-internal-linkage-names
 // NOPROBE-NOT: -fpseudo-probe-for-profiling
 // NOPROBE-NOT: -funique-internal-linkage-names
 // NONAME: -fpseudo-probe-for-profiling
 // NONAME-NOT: -funique-internal-linkage-names
-// CONFLICT: invalid argument

diff  --git a/llvm/include/llvm/Passes/PassBuilder.h 
b/llvm/include/llvm/Passes/PassBuilder.h
index 35f791f9c2609..9ab7bd4664f59 100644
--- a/llvm/include/llvm/Passes/PassBuilder.h
+++ b/llvm/include/llvm/Passes/Pass

[PATCH] D107876: [CSSPGO] Allow the use of debug-info-for-profiling and pseudo-probe-for-profiling together

2021-08-12 Thread Hongtao Yu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGccb5b9bbfb5c: [CSSPGO] Allow the use of 
debug-info-for-profiling and pseudo-probe-for… (authored by hoy).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107876

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp
  clang/test/Driver/pseudo-probe.c
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/test/Transforms/SampleProfile/pseudo-probe-discriminator.ll
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -259,12 +259,9 @@
PGOOptions::SampleUse);
 break;
   case NoPGO:
-if (DebugInfoForProfiling)
+if (DebugInfoForProfiling || PseudoProbeForProfiling)
   P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
- true);
-else if (PseudoProbeForProfiling)
-  P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
- false, true);
+ DebugInfoForProfiling, PseudoProbeForProfiling);
 else
   P = None;
   }
Index: llvm/test/Transforms/SampleProfile/pseudo-probe-discriminator.ll
===
--- /dev/null
+++ llvm/test/Transforms/SampleProfile/pseudo-probe-discriminator.ll
@@ -0,0 +1,71 @@
+; RUN: opt < %s -passes='default' -new-pm-debug-info-for-profiling -S | FileCheck %s --check-prefix=DEBUG
+; RUN: opt < %s -passes='default' -new-pm-debug-info-for-profiling -new-pm-pseudo-probe-for-profiling -S | FileCheck %s --check-prefix=PROBE
+; RUN: opt < %s -passes='thinlto-pre-link' -new-pm-debug-info-for-profiling -new-pm-pseudo-probe-for-profiling -S | FileCheck %s --check-prefix=PROBE
+
+
+@a = dso_local global i32 0, align 4
+
+; Function Attrs: uwtable
+define void @_Z3foov(i32 %x) #0 !dbg !4 {
+bb0:
+  %cmp = icmp eq i32 %x, 0, !dbg !10
+  br i1 %cmp, label %bb1, label %bb2
+
+bb1:
+; DEBUG:  call void @_Z3barv(), !dbg ![[CALL1:[0-9]+]]
+; PROBE:  call void @_Z3barv(), !dbg ![[CALL1:[0-9]+]]
+  call void @_Z3barv(), !dbg !10
+; DEBUG:  call void @_Z3barv(), !dbg ![[CALL2:[0-9]+]]
+; PROBE:  call void @_Z3barv(), !dbg ![[CALL2:[0-9]+]]
+  call void @_Z3barv(), !dbg !11
+  ret void, !dbg !13
+
+bb2:
+; DEBUG:  store i32 8, i32* @a, align 4, !dbg ![[INST:[0-9]+]]
+; PROBE:  store i32 8, i32* @a, align 4, !dbg ![[INST:[0-9]+]]
+  store i32 8, i32* @a, align 4, !dbg !12
+  br label %bb3
+
+bb3:
+  ret void, !dbg !12
+}
+
+declare void @_Z3barv() #1
+declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) nounwind argmemonly
+declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) nounwind argmemonly
+
+attributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!7, !8}
+!llvm.ident = !{!9}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 250915) (llvm/trunk 251830)", isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)
+!1 = !DIFile(filename: "c.cc", directory: "/tmp")
+!2 = !{}
+!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
+!5 = !DISubroutineType(types: !6)
+!6 = !{null}
+!7 = !{i32 2, !"Dwarf Version", i32 4}
+!8 = !{i32 2, !"Debug Info Version", i32 3}
+!9 = !{!"clang version 3.8.0 (trunk 250915) (llvm/trunk 251830)"}
+!10 = !DILocation(line: 4, column: 3, scope: !4)
+!11 = !DILocation(line: 4, column: 9, scope: !4)
+!12 = !DILocation(line: 4, column: 15, scope: !4)
+!13 = !DILocation(line: 5, column: 1, scope: !4)
+
+; DEBUG: ![[CALL1]] = !DILocation(line: 4, column: 3, scope: ![[CALL1BLOCK:[0-9]+]])
+; DEBUG: ![[CALL1BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 2)
+; DEBUG: ![[CALL2]] = !DILocation(line: 4, column: 9, scope: ![[CALL2BLOCK:[0-9]+]])
+; DEBUG: ![[CALL2BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 8)
+; DEBUG: ![[INST]] = !DILocation(line: 4, column: 15, scope: ![[INSTBLOCK:[0-9]+]])
+; DEBUG: ![[INSTBLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 4)
+
+   

[PATCH] D106137: [flang][driver] Add support for Frontend Plugins

2021-08-12 Thread Andrzej Warzynski via Phabricator via cfe-commits
awarzynski added a comment.

In D106137#2941616 , @DavidSpickett 
wrote:

> This has broken cmake config on the out of tree flang bot:
> https://lab.llvm.org/buildbot/#/builders/175/builds/2026
>
> (with perhaps the least helpful cmake error I've ever seen)
>
> Not personally familiar with what "out of tree" means for flang but you 
> should be able to pull the steps from the buildbot UI. (perhaps your change 
> assumes it's "in tree")

Thank you David, I've been able to reproduce this locally. I hope to submit a 
workaround shortly. This is failing because out-of-tree SHLIBDIR 
 
is not defined.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106137

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


[PATCH] D104285: [analyzer][AST] Retrieve value by direct index from list initialization of constant array declaration.

2021-08-12 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 366009.
ASDenysPetrov added a comment.

Changed according to comments.


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

https://reviews.llvm.org/D104285

Files:
  clang/include/clang/AST/Expr.h
  clang/include/clang/AST/Type.h
  clang/lib/AST/Expr.cpp
  clang/lib/AST/Type.cpp
  clang/lib/StaticAnalyzer/Core/RegionStore.cpp
  clang/test/Analysis/initialization.cpp

Index: clang/test/Analysis/initialization.cpp
===
--- clang/test/Analysis/initialization.cpp
+++ clang/test/Analysis/initialization.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++14 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.builtin,debug.ExprInspection -verify %s
+// RUN: %clang_cc1 -std=c++14 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.uninitialized.Assign,core.builtin,debug.ExprInspection,core.uninitialized.UndefReturn -verify %s
 
 void clang_analyzer_eval(int);
 
@@ -18,3 +18,114 @@
   // FIXME: Should recognize that it is 0.
   clang_analyzer_eval(arr[i][0]); // expected-warning{{UNKNOWN}}
 }
+
+void direct_index1() {
+  int const arr[2][2][3] = {};
+  int const *ptr = (int const *)arr;
+  clang_analyzer_eval(ptr[0] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[1] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[2] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[3] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[4] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[5] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[6] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[7] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[8] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[9] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[10] == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[11] == 0); // expected-warning{{TRUE}}
+}
+
+void direct_index2() {
+  int const arr[2][2][3] = {{{1, 2, 3}, {4, 5, 6}}, {{7, 8, 9}, {10, 11, 12}}};
+  int const *ptr = arr[0][0];
+  clang_analyzer_eval(ptr[0] == 1);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[1] == 2);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[2] == 3);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[3] == 4);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[4] == 5);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[5] == 6);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[6] == 7);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[7] == 8);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[8] == 9);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[9] == 10);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[10] == 11); // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[11] == 12); // expected-warning{{TRUE}}
+}
+
+void direct_index3() {
+  int const arr[2][2][3] = {{{}, {}}, {{}, {}}};
+  int const *ptr = &(arr[0][0][0]);
+  clang_analyzer_eval(ptr[0] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[1] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[2] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[3] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[4] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[5] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[6] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[7] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[8] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[9] == 0);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[10] == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[11] == 0); // expected-warning{{TRUE}}
+}
+
+void direct_index4() {
+  int const arr[2][2][3] = {{{1, 2}, {}}, {{7, 8}, {10, 11, 12}}};
+  int const *ptr = (int const *)arr[0];
+  clang_analyzer_eval(ptr[0] == 1);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[1] == 2);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[2] == 0);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[3] == 0);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[4] == 0);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[5] == 0);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[6] == 7);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[7] == 8);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[8] == 0);   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[9] == 10);  // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[10] == 11); // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[11] == 12); // expected-warning{{TRUE}}
+}
+
+void direct_index5() {
+  int arr[2][2][3] = {{{1, 2}}, {{7}}};
+  int *ptr = (int *)arr;
+  clang_analyzer_eval(ptr[0] == 1);  // expected-warning{{TRUE}}
+  clang_analyzer_e

[clang-tools-extra] a49ca19 - Speculatively fix the build bots.

2021-08-12 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2021-08-12T11:56:17-04:00
New Revision: a49ca198bad91b7696b54b3ca65585b92305b386

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

LOG: Speculatively fix the build bots.

This is a fix for commit d2c5cbc3a856c2f8bbda05540fa761bb94ba32f6

Added: 


Modified: 
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-length.cpp

Removed: 




diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-length.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-length.cpp
index b9e2e756dd78c..40fd1c5c7a2da 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-length.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-length.cpp
@@ -1,7 +1,7 @@
 // RUN: %check_clang_tidy %s readability-identifier-length %t \
 // RUN: -config='{CheckOptions: \
 // RUN:  [{key: readability-identifier-length.IgnoredVariableNames, value: 
"^[xy]$"}]}' \
-// RUN: --
+// RUN: -- -fexceptions
 
 struct myexcept {
   int val;



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


[PATCH] D106891: [AMDGPU] [Remarks] Emit optimization remarks for atomics generating CAS loop

2021-08-12 Thread Anshil Gandhi via Phabricator via cfe-commits
gandhi21299 marked 2 inline comments as done.
gandhi21299 added inline comments.



Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:631
+"at "
+ << (AI->getSyncScopeID() ? "system" : "single thread")
+ << " memory scope");

rampitec wrote:
> That does not help with target defined scope names, such as our "one-as" for 
> example.
How can I get target defined scope names?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106891

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


[PATCH] D107971: [openmp] Annotate tmp variables with omp_thread_mem_alloc

2021-08-12 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield created this revision.
JonChesterfield added reviewers: arsenm, jdoerfert.
Herald added subscribers: guansong, yaxunl.
JonChesterfield requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1, wdng.
Herald added a project: clang.

Fixes miscompile of calls into ocml. Bug 51445.

The stack variable `double __tmp` is moved to dynamically allocated shared
memory by CGOpenMPRuntimeGPU. This is usually fine, but when the variable
is passed to a function that is explicitly annotated address_space(5) then
allocating the variable off-stack leads to a miscompile in the back end,
which cannot decide to move the variable back to the stack from shared.

This could be fixed by removing the AS(5) annotation from the math library
or by explicitly marking the variables as thread_mem_alloc. The cast to
AS(5) is still a no-op once IR is reached.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107971

Files:
  clang/lib/Headers/__clang_hip_math.h

Index: clang/lib/Headers/__clang_hip_math.h
===
--- clang/lib/Headers/__clang_hip_math.h
+++ clang/lib/Headers/__clang_hip_math.h
@@ -19,6 +19,9 @@
 #endif
 #include 
 #include 
+#ifdef __OPENMP_AMDGCN__
+#include 
+#endif
 #endif // !defined(__HIPCC_RTC__)
 
 #pragma push_macro("__DEVICE__")
@@ -258,6 +261,9 @@
 __DEVICE__
 float frexpf(float __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_frexp_f32(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -343,6 +349,9 @@
 __DEVICE__
 float modff(float __x, float *__iptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_modf_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
   *__iptr = __tmp;
@@ -423,6 +432,9 @@
 __DEVICE__
 float remquof(float __x, float __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r = __ocml_remquo_f32(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -479,6 +491,9 @@
 __DEVICE__
 void sincosf(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr =
   __ocml_sincos_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
   *__cosptr = __tmp;
@@ -487,6 +502,9 @@
 __DEVICE__
 void sincospif(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincospi_f32(
   __x, (__attribute__((address_space(5))) float *)&__tmp);
   *__cosptr = __tmp;
@@ -799,6 +817,9 @@
 __DEVICE__
 double frexp(double __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_frexp_f64(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -883,6 +904,9 @@
 __DEVICE__
 double modf(double __x, double *__iptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_modf_f64(__x, (__attribute__((address_space(5))) double *)&__tmp);
   *__iptr = __tmp;
@@ -971,6 +995,9 @@
 __DEVICE__
 double remquo(double __x, double __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r = __ocml_remquo_f64(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -1029,6 +1056,9 @@
 __DEVICE__
 void sincos(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincos_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;
@@ -1037,6 +1067,9 @@
 __DEVICE__
 void sincospi(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincospi_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107971: [openmp] Annotate tmp variables with omp_thread_mem_alloc

2021-08-12 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added reviewers: ye-luo, yaxunl.
JonChesterfield added a subscriber: ye-luo.
JonChesterfield added a comment.

@ye-luo this fixes the modf and sincos test cases from 
https://github.com/ye-luo/openmp-target


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107971

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


[PATCH] D107717: [LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project

2021-08-12 Thread Alf via Phabricator via cfe-commits
gAlfonso-bit updated this revision to Diff 366014.
gAlfonso-bit added a comment.

Rebased


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

https://reviews.llvm.org/D107717

Files:
  clang/CMakeLists.txt
  clang/lib/Basic/CMakeLists.txt
  compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake
  flang/CMakeLists.txt
  libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
  libunwind/CMakeLists.txt
  lld/CMakeLists.txt
  lld/Common/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/source/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/include/llvm/Support/CMakeLists.txt
  runtimes/CMakeLists.txt

Index: runtimes/CMakeLists.txt
===
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -65,7 +65,7 @@
 
 # This variable makes sure that e.g. llvm-lit is found.
 set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR})
-set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules)
+set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
 
 # This variable is used by individual runtimes to locate LLVM files.
 set(LLVM_PATH ${LLVM_BUILD_MAIN_SRC_DIR})
Index: llvm/include/llvm/Support/CMakeLists.txt
===
--- llvm/include/llvm/Support/CMakeLists.txt
+++ llvm/include/llvm/Support/CMakeLists.txt
@@ -3,7 +3,7 @@
 # The VC revision include that we want to generate.
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSRevision.h")
 
-set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
+set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
 
 if(LLVM_APPEND_VC_REV)
   set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -295,8 +295,8 @@
 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include ) # --includedir
 set(LLVM_BINARY_DIR   ${CMAKE_CURRENT_BINARY_DIR}  ) # --prefix
 
-# Note: LLVM_CMAKE_PATH does not include generated files
-set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules)
+# Note: LLVM_CMAKE_DIR does not include generated files
+set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
 set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
 set(LLVM_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
 
Index: lldb/source/CMakeLists.txt
===
--- lldb/source/CMakeLists.txt
+++ lldb/source/CMakeLists.txt
@@ -8,7 +8,7 @@
 find_first_existing_vc_file("${LLDB_SOURCE_DIR}" lldb_vc)
 
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
-set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
+set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
 
 if(lldb_vc AND LLVM_APPEND_VC_REV)
   set(lldb_source_dir ${LLDB_SOURCE_DIR})
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -3,8 +3,8 @@
 find_package(LLVM REQUIRED CONFIG HINTS ${LLVM_DIR} NO_CMAKE_FIND_ROOT_PATH)
 find_package(Clang REQUIRED CONFIG HINTS ${Clang_DIR} ${LLVM_DIR}/../clang NO_CMAKE_FIND_ROOT_PATH)
 
-# We set LLVM_CMAKE_PATH so that GetSVN.cmake is found correctly when building SVNVersion.inc
-set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake modules")
+# We set LLVM_CMAKE_DIR so that GetSVN.cmake is found correctly when building SVNVersion.inc
+set(LLVM_CMAKE_DIR ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake modules")
 
 set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
Index: lld/Common/CMakeLists.txt
===
--- lld/Common/CMakeLists.txt
+++ lld/Common/CMakeLists.txt
@@ -8,7 +8,7 @@
 find_first_existing_vc_file("${LLD_SOURCE_DIR}" lld_vc)
 
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
-set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
+set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
 
 if(lld_vc AND LLVM_APPEND_VC_REV)
   set(lld_source_dir ${LLD_SOURCE_DIR})
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -27,7 +27,7 @@
 
   list(GET LLVM_CONFIG_OUTPUT 0 OBJ_ROOT)
   list(GET LLVM_CONFIG_OUTPUT 1 MAIN_INCLUDE_DIR)
-  list(GET LLVM_CONFIG_OUTPUT 2 LLVM_CMAKE_PATH)
+  list(GET LLVM_CONFIG_OUTPUT 2 LLVM_CMAKE_DIR)
   list(GET LLVM_CONFIG_OUTPUT 3 MAIN_SRC_DIR)
 
   set(LLVM_OBJ_ROOT ${OBJ_ROOT} CACHE PATH "path to LLVM build tree")
@@ -35,14 +35,14 @@
   set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to

[PATCH] D106891: [AMDGPU] [Remarks] Emit optimization remarks for atomics generating CAS loop

2021-08-12 Thread Stanislav Mekhanoshin via Phabricator via cfe-commits
rampitec added inline comments.



Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:631
+"at "
+ << (AI->getSyncScopeID() ? "system" : "single thread")
+ << " memory scope");

gandhi21299 wrote:
> rampitec wrote:
> > That does not help with target defined scope names, such as our "one-as" 
> > for example.
> How can I get target defined scope names?
It is right on the instruction:
  %result = atomicrmw fadd float addrspace(1)* %ptr, float 4.0 
syncscope("one-as") seq_cst



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106891

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


[PATCH] D106891: [AMDGPU] [Remarks] Emit optimization remarks for atomics generating CAS loop

2021-08-12 Thread Anshil Gandhi via Phabricator via cfe-commits
gandhi21299 added inline comments.



Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:631
+"at "
+ << (AI->getSyncScopeID() ? "system" : "single thread")
+ << " memory scope");

rampitec wrote:
> gandhi21299 wrote:
> > rampitec wrote:
> > > That does not help with target defined scope names, such as our "one-as" 
> > > for example.
> > How can I get target defined scope names?
> It is right on the instruction:
>   %result = atomicrmw fadd float addrspace(1)* %ptr, float 4.0 
> syncscope("one-as") seq_cst
> 
Sorry, I meant from the LLVM API.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106891

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


[PATCH] D107971: [openmp] Annotate tmp variables with omp_thread_mem_alloc

2021-08-12 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

Assuming this causes us to generate an `alloc as(5)` for `__tmp`, LG


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107971

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


[PATCH] D107971: [openmp] Annotate tmp variables with omp_thread_mem_alloc

2021-08-12 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

In D107971#2941666 , @jdoerfert wrote:

> Assuming this causes us to generate an `alloc as(5)` for `__tmp`, LG

Yes, with the running example and this patch we get the perfect:

  %__tmp = alloca double, align 8, addrspace(5)
  %call = call double @__ocml_sincos_f64(double %__x, double addrspace(5)* 
%__tmp)

Before, we get:

  %__tmp = call fastcc i8* @__kmpc_alloc_shared()
  %__tmp_on_stack = bitcast i8* %__tmp to double*
  %__tmp_on_stack.ascast = addrspacecast double* %__tmp_on_stack to double 
addrspace(5)*
  %call = call double @__ocml_sincos_f64(double %__x, double addrspace(5)* 
%__tmp_on_stack.ascast)

which interacts badly with the addrspace(5) annotation on the ocml function


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107971

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


[clang] b611354 - [openmp] Annotate tmp variables with omp_thread_mem_alloc

2021-08-12 Thread Jon Chesterfield via cfe-commits

Author: Jon Chesterfield
Date: 2021-08-12T17:30:22+01:00
New Revision: b6113548c9217fb8a6d0e9ac5bef5584c1aa614d

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

LOG: [openmp] Annotate tmp variables with omp_thread_mem_alloc

Fixes miscompile of calls into ocml. Bug 51445.

The stack variable `double __tmp` is moved to dynamically allocated shared
memory by CGOpenMPRuntimeGPU. This is usually fine, but when the variable
is passed to a function that is explicitly annotated address_space(5) then
allocating the variable off-stack leads to a miscompile in the back end,
which cannot decide to move the variable back to the stack from shared.

This could be fixed by removing the AS(5) annotation from the math library
or by explicitly marking the variables as thread_mem_alloc. The cast to
AS(5) is still a no-op once IR is reached.

Reviewed By: jdoerfert

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

Added: 


Modified: 
clang/lib/Headers/__clang_hip_math.h

Removed: 




diff  --git a/clang/lib/Headers/__clang_hip_math.h 
b/clang/lib/Headers/__clang_hip_math.h
index 9effaa18d3e8..ef7e087b832c 100644
--- a/clang/lib/Headers/__clang_hip_math.h
+++ b/clang/lib/Headers/__clang_hip_math.h
@@ -19,6 +19,9 @@
 #endif
 #include 
 #include 
+#ifdef __OPENMP_AMDGCN__
+#include 
+#endif
 #endif // !defined(__HIPCC_RTC__)
 
 #pragma push_macro("__DEVICE__")
@@ -258,6 +261,9 @@ float fmodf(float __x, float __y) { return 
__ocml_fmod_f32(__x, __y); }
 __DEVICE__
 float frexpf(float __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_frexp_f32(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -343,6 +349,9 @@ long int lroundf(float __x) { return __ocml_round_f32(__x); 
}
 __DEVICE__
 float modff(float __x, float *__iptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_modf_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
   *__iptr = __tmp;
@@ -423,6 +432,9 @@ float remainderf(float __x, float __y) {
 __DEVICE__
 float remquof(float __x, float __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r = __ocml_remquo_f32(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -479,6 +491,9 @@ __RETURN_TYPE __signbitf(float __x) { return 
__ocml_signbit_f32(__x); }
 __DEVICE__
 void sincosf(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr =
   __ocml_sincos_f32(__x, (__attribute__((address_space(5))) float 
*)&__tmp);
   *__cosptr = __tmp;
@@ -487,6 +502,9 @@ void sincosf(float __x, float *__sinptr, float *__cosptr) {
 __DEVICE__
 void sincospif(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincospi_f32(
   __x, (__attribute__((address_space(5))) float *)&__tmp);
   *__cosptr = __tmp;
@@ -799,6 +817,9 @@ double fmod(double __x, double __y) { return 
__ocml_fmod_f64(__x, __y); }
 __DEVICE__
 double frexp(double __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_frexp_f64(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -883,6 +904,9 @@ long int lround(double __x) { return __ocml_round_f64(__x); 
}
 __DEVICE__
 double modf(double __x, double *__iptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_modf_f64(__x, (__attribute__((address_space(5))) double *)&__tmp);
   *__iptr = __tmp;
@@ -971,6 +995,9 @@ double remainder(double __x, double __y) {
 __DEVICE__
 double remquo(double __x, double __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r = __ocml_remquo_f64(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -1029,6 +1056,9 @@ double sin(double __x) { return __ocml_sin_f64(__x); }
 __DEVICE__
 void sincos(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincos_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;
@@ -1037,6 +1067,9 @@ void sincos(double __x,

[PATCH] D107971: [openmp] Annotate tmp variables with omp_thread_mem_alloc

2021-08-12 Thread Jon Chesterfield via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb6113548c921: [openmp] Annotate tmp variables with 
omp_thread_mem_alloc (authored by JonChesterfield).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107971

Files:
  clang/lib/Headers/__clang_hip_math.h

Index: clang/lib/Headers/__clang_hip_math.h
===
--- clang/lib/Headers/__clang_hip_math.h
+++ clang/lib/Headers/__clang_hip_math.h
@@ -19,6 +19,9 @@
 #endif
 #include 
 #include 
+#ifdef __OPENMP_AMDGCN__
+#include 
+#endif
 #endif // !defined(__HIPCC_RTC__)
 
 #pragma push_macro("__DEVICE__")
@@ -258,6 +261,9 @@
 __DEVICE__
 float frexpf(float __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_frexp_f32(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -343,6 +349,9 @@
 __DEVICE__
 float modff(float __x, float *__iptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_modf_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
   *__iptr = __tmp;
@@ -423,6 +432,9 @@
 __DEVICE__
 float remquof(float __x, float __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r = __ocml_remquo_f32(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -479,6 +491,9 @@
 __DEVICE__
 void sincosf(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr =
   __ocml_sincos_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
   *__cosptr = __tmp;
@@ -487,6 +502,9 @@
 __DEVICE__
 void sincospif(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincospi_f32(
   __x, (__attribute__((address_space(5))) float *)&__tmp);
   *__cosptr = __tmp;
@@ -799,6 +817,9 @@
 __DEVICE__
 double frexp(double __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_frexp_f64(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -883,6 +904,9 @@
 __DEVICE__
 double modf(double __x, double *__iptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_modf_f64(__x, (__attribute__((address_space(5))) double *)&__tmp);
   *__iptr = __tmp;
@@ -971,6 +995,9 @@
 __DEVICE__
 double remquo(double __x, double __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r = __ocml_remquo_f64(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -1029,6 +1056,9 @@
 __DEVICE__
 void sincos(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincos_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;
@@ -1037,6 +1067,9 @@
 __DEVICE__
 void sincospi(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincospi_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107836: [Attributes]: refactor to expose ParsedAttrInfo::acceptsLangOpts. NFC

2021-08-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/include/clang/Sema/ParsedAttr.h:96
+  /// Check if this attribute is allowed by the language we are compiling.
+  virtual bool acceptsLangOpts(const LangOptions &LO) const { return true; }
+

Plugin attributes inherit from `ParsedAttrInfo`, not `ParsedAttr`, so one 
downside to this change is that plugin authors no longer have a way to diagnose 
language options with a custom diagnostic; all they can get is "attribute 
ignored".

Perhaps another approach is to add an output parameter so the overrider can 
signify whether the language options are valid or not (because it's plausible 
that the plugin wants to diagnose the language options but they're still valid 
enough that the attribute should be accepted)?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107836

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


[PATCH] D106891: [AMDGPU] [Remarks] Emit optimization remarks for atomics generating CAS loop

2021-08-12 Thread Stanislav Mekhanoshin via Phabricator via cfe-commits
rampitec added inline comments.



Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:631
+"at "
+ << (AI->getSyncScopeID() ? "system" : "single thread")
+ << " memory scope");

gandhi21299 wrote:
> rampitec wrote:
> > gandhi21299 wrote:
> > > rampitec wrote:
> > > > That does not help with target defined scope names, such as our 
> > > > "one-as" for example.
> > > How can I get target defined scope names?
> > It is right on the instruction:
> >   %result = atomicrmw fadd float addrspace(1)* %ptr, float 4.0 
> > syncscope("one-as") seq_cst
> > 
> Sorry, I meant from the LLVM API.
LLVMContext::getSyncScopeNames()


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106891

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


[PATCH] D106509: [OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2)

2021-08-12 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny added inline comments.



Comment at: clang/lib/Basic/OpenMPKinds.cpp:64
+  return OMPC_MAP_MODIFIER_unknown;
+if (!LangOpts.OpenMPExtensions && Type == OMPC_MAP_MODIFIER_ompx_hold)
   return OMPC_MAP_MODIFIER_unknown;

ABataev wrote:
> I would enable this since OpenMP 5.2, since in 5.2 `ompx_` is officially 
> allowed extension format.
Do you mean both `-fopenmp-version=52` and `-fopenmp-extensions` should be 
required to enable `ompx_hold`?

Or do you mean only `-fopenmp-version=52` should be required to enable 
`ompx_hold`, and we can drop the `-fopenmp-extensions` implementation?


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

https://reviews.llvm.org/D106509

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


[PATCH] D107971: [openmp] Annotate tmp variables with omp_thread_mem_alloc

2021-08-12 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Failed a CI job that builds an openmp test in an environment without omp.h, 
will revert.

Thoughts on fixing? Putting the omp allocator definition in this header is 
likely to collide with a real omp.h. Fairly clean fix is to move the 
definitions into the deviceRTL. Tempting fix is to add a minimal omp.h to the 
test dir


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107971

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


[PATCH] D106509: [OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2)

2021-08-12 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/Basic/OpenMPKinds.cpp:64
+  return OMPC_MAP_MODIFIER_unknown;
+if (!LangOpts.OpenMPExtensions && Type == OMPC_MAP_MODIFIER_ompx_hold)
   return OMPC_MAP_MODIFIER_unknown;

jdenny wrote:
> ABataev wrote:
> > I would enable this since OpenMP 5.2, since in 5.2 `ompx_` is officially 
> > allowed extension format.
> Do you mean both `-fopenmp-version=52` and `-fopenmp-extensions` should be 
> required to enable `ompx_hold`?
> 
> Or do you mean only `-fopenmp-version=52` should be required to enable 
> `ompx_hold`, and we can drop the `-fopenmp-extensions` implementation?
Second option. Actually, we can enable it if either `-fopenmp-version=52` or 
`-fopenmp-extensions` is used, depends if we want to add a switch for 
non-standard OpenMP extensions. If OpenMP 5.2 is on, we can just ignore 
`-f[no]-openmp-extensions`. Thoughts?


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

https://reviews.llvm.org/D106509

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


[clang] 6a8e512 - Revert "[openmp] Annotate tmp variables with omp_thread_mem_alloc"

2021-08-12 Thread Jon Chesterfield via cfe-commits

Author: Jon Chesterfield
Date: 2021-08-12T17:44:36+01:00
New Revision: 6a8e5120abacdfe0f05c9670782e59e2b729a318

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

LOG: Revert "[openmp] Annotate tmp variables with omp_thread_mem_alloc"

This reverts commit b6113548c9217fb8a6d0e9ac5bef5584c1aa614d.

Added: 


Modified: 
clang/lib/Headers/__clang_hip_math.h

Removed: 




diff  --git a/clang/lib/Headers/__clang_hip_math.h 
b/clang/lib/Headers/__clang_hip_math.h
index ef7e087b832c..9effaa18d3e8 100644
--- a/clang/lib/Headers/__clang_hip_math.h
+++ b/clang/lib/Headers/__clang_hip_math.h
@@ -19,9 +19,6 @@
 #endif
 #include 
 #include 
-#ifdef __OPENMP_AMDGCN__
-#include 
-#endif
 #endif // !defined(__HIPCC_RTC__)
 
 #pragma push_macro("__DEVICE__")
@@ -261,9 +258,6 @@ float fmodf(float __x, float __y) { return 
__ocml_fmod_f32(__x, __y); }
 __DEVICE__
 float frexpf(float __x, int *__nptr) {
   int __tmp;
-#ifdef __OPENMP_AMDGCN__
-#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
-#endif
   float __r =
   __ocml_frexp_f32(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -349,9 +343,6 @@ long int lroundf(float __x) { return __ocml_round_f32(__x); 
}
 __DEVICE__
 float modff(float __x, float *__iptr) {
   float __tmp;
-#ifdef __OPENMP_AMDGCN__
-#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
-#endif
   float __r =
   __ocml_modf_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
   *__iptr = __tmp;
@@ -432,9 +423,6 @@ float remainderf(float __x, float __y) {
 __DEVICE__
 float remquof(float __x, float __y, int *__quo) {
   int __tmp;
-#ifdef __OPENMP_AMDGCN__
-#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
-#endif
   float __r = __ocml_remquo_f32(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -491,9 +479,6 @@ __RETURN_TYPE __signbitf(float __x) { return 
__ocml_signbit_f32(__x); }
 __DEVICE__
 void sincosf(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
-#ifdef __OPENMP_AMDGCN__
-#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
-#endif
   *__sinptr =
   __ocml_sincos_f32(__x, (__attribute__((address_space(5))) float 
*)&__tmp);
   *__cosptr = __tmp;
@@ -502,9 +487,6 @@ void sincosf(float __x, float *__sinptr, float *__cosptr) {
 __DEVICE__
 void sincospif(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
-#ifdef __OPENMP_AMDGCN__
-#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
-#endif
   *__sinptr = __ocml_sincospi_f32(
   __x, (__attribute__((address_space(5))) float *)&__tmp);
   *__cosptr = __tmp;
@@ -817,9 +799,6 @@ double fmod(double __x, double __y) { return 
__ocml_fmod_f64(__x, __y); }
 __DEVICE__
 double frexp(double __x, int *__nptr) {
   int __tmp;
-#ifdef __OPENMP_AMDGCN__
-#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
-#endif
   double __r =
   __ocml_frexp_f64(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -904,9 +883,6 @@ long int lround(double __x) { return __ocml_round_f64(__x); 
}
 __DEVICE__
 double modf(double __x, double *__iptr) {
   double __tmp;
-#ifdef __OPENMP_AMDGCN__
-#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
-#endif
   double __r =
   __ocml_modf_f64(__x, (__attribute__((address_space(5))) double *)&__tmp);
   *__iptr = __tmp;
@@ -995,9 +971,6 @@ double remainder(double __x, double __y) {
 __DEVICE__
 double remquo(double __x, double __y, int *__quo) {
   int __tmp;
-#ifdef __OPENMP_AMDGCN__
-#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
-#endif
   double __r = __ocml_remquo_f64(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -1056,9 +1029,6 @@ double sin(double __x) { return __ocml_sin_f64(__x); }
 __DEVICE__
 void sincos(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
-#ifdef __OPENMP_AMDGCN__
-#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
-#endif
   *__sinptr = __ocml_sincos_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;
@@ -1067,9 +1037,6 @@ void sincos(double __x, double *__sinptr, double 
*__cosptr) {
 __DEVICE__
 void sincospi(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
-#ifdef __OPENMP_AMDGCN__
-#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
-#endif
   *__sinptr = __ocml_sincospi_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;



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


[PATCH] D107836: [Attributes]: refactor to expose ParsedAttrInfo::acceptsLangOpts. NFC

2021-08-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments.



Comment at: clang/include/clang/Sema/ParsedAttr.h:96
+  /// Check if this attribute is allowed by the language we are compiling.
+  virtual bool acceptsLangOpts(const LangOptions &LO) const { return true; }
+

aaron.ballman wrote:
> Plugin attributes inherit from `ParsedAttrInfo`, not `ParsedAttr`, so one 
> downside to this change is that plugin authors no longer have a way to 
> diagnose language options with a custom diagnostic; all they can get is 
> "attribute ignored".
> 
> Perhaps another approach is to add an output parameter so the overrider can 
> signify whether the language options are valid or not (because it's plausible 
> that the plugin wants to diagnose the language options but they're still 
> valid enough that the attribute should be accepted)?
> 
> Plugin attributes inherit from ParsedAttrInfo, not ParsedAttr, so one 
> downside to this change is that plugin authors no longer have a way to 
> diagnose language options with a custom diagnostic; all they can get is 
> "attribute ignored".

This is less flexible, indeed. What's not clear to me is:
 - do we know of any real plugins where the ability to use a custom diagnostic 
here is important? Hypothetical flexibility may not be worth keeping.
 - if custom diagnostics are needed, can they be emitted when the attribute is 
handled instead?
 - why we'd need this flexibility for LangOpts but not Target (existsInTarget)

> Perhaps another approach is to add an output parameter so the overrider can 
> signify whether the language options are valid or not (because it's plausible 
> that the plugin wants to diagnose the language options but they're still 
> valid enough that the attribute should be accepted)?

diagLangOpts already returns bool.

The blocking issue with the diagLangOpts signature for code-completion purposes 
isn't actually the diagnostics (completion suppresses them), it's rather that 
you have to construct a ParsedAttr  in order to emit them, which isn't easy to 
do "out of thin air".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107836

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


[clang] 6171f84 - [RISCV] Use getNaturalPointeeTypeAlignment to get alignment for stores created for vector builtins.

2021-08-12 Thread Craig Topper via cfe-commits

Author: Craig Topper
Date: 2021-08-12T10:05:27-07:00
New Revision: 6171f84942ce2136b464ac0e8e620c6908f64cc6

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

LOG: [RISCV] Use getNaturalPointeeTypeAlignment to get alignment for stores 
created for vector builtins.

Instead of using scalar size divided by 8 for segment loads, get
the alignment from clang's type system.

Make vleff match for consistency.

Also replace uses of getPointerElementType() which will be removed as part of 
the OpaquePtr changes.

Reviewed By: HsiangKai

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

Added: 


Modified: 
clang/include/clang/Basic/riscv_vector.td

Removed: 




diff  --git a/clang/include/clang/Basic/riscv_vector.td 
b/clang/include/clang/Basic/riscv_vector.td
index ebe32860882a4..fc8e56f0333a1 100644
--- a/clang/include/clang/Basic/riscv_vector.td
+++ b/clang/include/clang/Basic/riscv_vector.td
@@ -602,7 +602,7 @@ multiclass RVVVLEFFBuiltin types> {
 llvm::Value *V = Builder.CreateExtractValue(LoadValue, {0});
 // Store new_vl.
 clang::CharUnits Align =
-CGM.getNaturalTypeAlignment(getContext().getSizeType());
+CGM.getNaturalPointeeTypeAlignment(E->getArg(1)->getType());
 Builder.CreateStore(Builder.CreateExtractValue(LoadValue, {1}),
 Address(NewVL, Align));
 return V;
@@ -621,7 +621,7 @@ multiclass RVVVLEFFBuiltin types> {
 llvm::Value *V = Builder.CreateExtractValue(LoadValue, {0});
 // Store new_vl.
 clang::CharUnits Align =
-CGM.getNaturalTypeAlignment(getContext().getSizeType());
+CGM.getNaturalPointeeTypeAlignment(E->getArg(3)->getType());
 Builder.CreateStore(Builder.CreateExtractValue(LoadValue, {1}),
 Address(NewVL, Align));
 return V;
@@ -805,14 +805,14 @@ multiclass RVVUnitStridedSegLoad {
 ManualCodegen = [{
 {
   // builtin: (val0 address, val1 address, ..., ptr, vl)
-  IntrinsicTypes = {Ops[0]->getType()->getPointerElementType(),
+  IntrinsicTypes = {ConvertType(E->getArg(0)->getType()->getPointeeType()),
 Ops[NF + 1]->getType()};
   // intrinsic: (ptr, vl)
   llvm::Value *Operands[] = {Ops[NF], Ops[NF + 1]};
   llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
   llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
-  clang::CharUnits Align = CharUnits::fromQuantity(
- IntrinsicTypes[0]->getScalarSizeInBits() / 8);
+  clang::CharUnits Align =
+  CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
   llvm::Value *V;
   for (unsigned I = 0; I < NF; ++I) {
 V = Builder.CreateStore(Builder.CreateExtractValue(LoadValue, {I}),
@@ -825,7 +825,7 @@ multiclass RVVUnitStridedSegLoad {
 {
   // builtin: (val0 address, ..., mask, maskedoff0, ..., ptr, vl)
   // intrinsic: (maskedoff0, ..., ptr, mask, vl)
-  IntrinsicTypes = {Ops[0]->getType()->getPointerElementType(),
+  IntrinsicTypes = {ConvertType(E->getArg(0)->getType()->getPointeeType()),
 Ops[2 * NF + 2]->getType()};
   SmallVector Operands;
   for (unsigned I = 0; I < NF; ++I)
@@ -836,8 +836,8 @@ multiclass RVVUnitStridedSegLoad {
   assert(Operands.size() == NF + 3);
   llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
   llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
-  clang::CharUnits Align = CharUnits::fromQuantity(
- IntrinsicTypes[0]->getScalarSizeInBits() / 8);
+  clang::CharUnits Align =
+  CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
   llvm::Value *V;
   for (unsigned I = 0; I < NF; ++I) {
 V = Builder.CreateStore(Builder.CreateExtractValue(LoadValue, {I}),
@@ -875,15 +875,15 @@ multiclass RVVUnitStridedSegLoadFF {
 ManualCodegen = [{
 {
   // builtin: (val0 address, val1 address, ..., ptr, new_vl, vl)
-  IntrinsicTypes = {Ops[0]->getType()->getPointerElementType(),
+  IntrinsicTypes = {ConvertType(E->getArg(0)->getType()->getPointeeType()),
 Ops[NF + 2]->getType()};
   // intrinsic: (ptr, vl)
   llvm::Value *Operands[] = {Ops[NF], Ops[NF + 2]};
   Value *NewVL = Ops[NF + 1];
   llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
   llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
-  clang::CharUnits Align = CharUnits::fromQuantity(
- IntrinsicTypes[0]->getScalarSizeInBits() / 8);
+  clang::CharUnits Align =
+  CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());

[clang] f66ba5f - [Sema] Fix -Wparentheses warning from gcc. NFC

2021-08-12 Thread Craig Topper via cfe-commits

Author: Craig Topper
Date: 2021-08-12T10:05:27-07:00
New Revision: f66ba5fcef19ff03532d993ac4af1362a89b833f

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

LOG: [Sema] Fix -Wparentheses warning from gcc. NFC

Added: 


Modified: 
clang/lib/Sema/SemaDeclCXX.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 38f21c8ec47c9..a00a72982bac8 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -4437,9 +4437,9 @@ Sema::BuildDelegatingInitializer(TypeSourceInfo *TInfo, 
Expr *Init,
   ExprResult DelegationInit = InitSeq.Perform(*this, DelegationEntity, Kind,
   Args, nullptr);
   if (!DelegationInit.isInvalid()) {
-assert(DelegationInit.get()->containsErrors() ||
-   cast(DelegationInit.get())->getConstructor() &&
-   "Delegating constructor with no target?");
+assert((DelegationInit.get()->containsErrors() ||
+cast(DelegationInit.get())->getConstructor()) &&
+   "Delegating constructor with no target?");
 
 // C++11 [class.base.init]p7:
 //   The initialization of each base and member constitutes a



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


[PATCH] D106738: [RISCV] Use getNaturalPointeeTypeAlignment to get alignment for stores created for vector builtins.

2021-08-12 Thread Craig Topper via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6171f84942ce: [RISCV] Use getNaturalPointeeTypeAlignment to 
get alignment for stores created… (authored by craig.topper).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106738

Files:
  clang/include/clang/Basic/riscv_vector.td

Index: clang/include/clang/Basic/riscv_vector.td
===
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -602,7 +602,7 @@
 llvm::Value *V = Builder.CreateExtractValue(LoadValue, {0});
 // Store new_vl.
 clang::CharUnits Align =
-CGM.getNaturalTypeAlignment(getContext().getSizeType());
+CGM.getNaturalPointeeTypeAlignment(E->getArg(1)->getType());
 Builder.CreateStore(Builder.CreateExtractValue(LoadValue, {1}),
 Address(NewVL, Align));
 return V;
@@ -621,7 +621,7 @@
 llvm::Value *V = Builder.CreateExtractValue(LoadValue, {0});
 // Store new_vl.
 clang::CharUnits Align =
-CGM.getNaturalTypeAlignment(getContext().getSizeType());
+CGM.getNaturalPointeeTypeAlignment(E->getArg(3)->getType());
 Builder.CreateStore(Builder.CreateExtractValue(LoadValue, {1}),
 Address(NewVL, Align));
 return V;
@@ -805,14 +805,14 @@
 ManualCodegen = [{
 {
   // builtin: (val0 address, val1 address, ..., ptr, vl)
-  IntrinsicTypes = {Ops[0]->getType()->getPointerElementType(),
+  IntrinsicTypes = {ConvertType(E->getArg(0)->getType()->getPointeeType()),
 Ops[NF + 1]->getType()};
   // intrinsic: (ptr, vl)
   llvm::Value *Operands[] = {Ops[NF], Ops[NF + 1]};
   llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
   llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
-  clang::CharUnits Align = CharUnits::fromQuantity(
- IntrinsicTypes[0]->getScalarSizeInBits() / 8);
+  clang::CharUnits Align =
+  CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
   llvm::Value *V;
   for (unsigned I = 0; I < NF; ++I) {
 V = Builder.CreateStore(Builder.CreateExtractValue(LoadValue, {I}),
@@ -825,7 +825,7 @@
 {
   // builtin: (val0 address, ..., mask, maskedoff0, ..., ptr, vl)
   // intrinsic: (maskedoff0, ..., ptr, mask, vl)
-  IntrinsicTypes = {Ops[0]->getType()->getPointerElementType(),
+  IntrinsicTypes = {ConvertType(E->getArg(0)->getType()->getPointeeType()),
 Ops[2 * NF + 2]->getType()};
   SmallVector Operands;
   for (unsigned I = 0; I < NF; ++I)
@@ -836,8 +836,8 @@
   assert(Operands.size() == NF + 3);
   llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
   llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
-  clang::CharUnits Align = CharUnits::fromQuantity(
- IntrinsicTypes[0]->getScalarSizeInBits() / 8);
+  clang::CharUnits Align =
+  CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
   llvm::Value *V;
   for (unsigned I = 0; I < NF; ++I) {
 V = Builder.CreateStore(Builder.CreateExtractValue(LoadValue, {I}),
@@ -875,15 +875,15 @@
 ManualCodegen = [{
 {
   // builtin: (val0 address, val1 address, ..., ptr, new_vl, vl)
-  IntrinsicTypes = {Ops[0]->getType()->getPointerElementType(),
+  IntrinsicTypes = {ConvertType(E->getArg(0)->getType()->getPointeeType()),
 Ops[NF + 2]->getType()};
   // intrinsic: (ptr, vl)
   llvm::Value *Operands[] = {Ops[NF], Ops[NF + 2]};
   Value *NewVL = Ops[NF + 1];
   llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
   llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
-  clang::CharUnits Align = CharUnits::fromQuantity(
- IntrinsicTypes[0]->getScalarSizeInBits() / 8);
+  clang::CharUnits Align =
+  CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
   for (unsigned I = 0; I < NF; ++I) {
 Builder.CreateStore(Builder.CreateExtractValue(LoadValue, {I}),
 Address(Ops[I], Align));
@@ -897,7 +897,7 @@
 {
   // builtin: (val0 address, ..., mask, maskedoff0, ..., ptr, new_vl, vl)
   // intrinsic: (maskedoff0, ..., ptr, mask, vl)
-  IntrinsicTypes = {Ops[0]->getType()->getPointerElementType(),
+  IntrinsicTypes = {ConvertType(E->getArg(0)->getType()->getPointeeType()),
 Ops[2 * NF + 3]->getType()};
   SmallVector Operands;
   for (unsigned I = 0; I < NF; ++I)
@@ -909,8 +909,8 @@
   assert(Operands.size() == NF + 3);
   llvm::F

[PATCH] D104344: [modules] Track how headers are included by different modules.

2021-08-12 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

Ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104344

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


[PATCH] D107836: [Attributes]: refactor to expose ParsedAttrInfo::acceptsLangOpts. NFC

2021-08-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a subscriber: john.brawn.
aaron.ballman added inline comments.



Comment at: clang/include/clang/Sema/ParsedAttr.h:96
+  /// Check if this attribute is allowed by the language we are compiling.
+  virtual bool acceptsLangOpts(const LangOptions &LO) const { return true; }
+

sammccall wrote:
> aaron.ballman wrote:
> > Plugin attributes inherit from `ParsedAttrInfo`, not `ParsedAttr`, so one 
> > downside to this change is that plugin authors no longer have a way to 
> > diagnose language options with a custom diagnostic; all they can get is 
> > "attribute ignored".
> > 
> > Perhaps another approach is to add an output parameter so the overrider can 
> > signify whether the language options are valid or not (because it's 
> > plausible that the plugin wants to diagnose the language options but 
> > they're still valid enough that the attribute should be accepted)?
> > 
> > Plugin attributes inherit from ParsedAttrInfo, not ParsedAttr, so one 
> > downside to this change is that plugin authors no longer have a way to 
> > diagnose language options with a custom diagnostic; all they can get is 
> > "attribute ignored".
> 
> This is less flexible, indeed. What's not clear to me is:
>  - do we know of any real plugins where the ability to use a custom 
> diagnostic here is important? Hypothetical flexibility may not be worth 
> keeping.
>  - if custom diagnostics are needed, can they be emitted when the attribute 
> is handled instead?
>  - why we'd need this flexibility for LangOpts but not Target (existsInTarget)
> 
> > Perhaps another approach is to add an output parameter so the overrider can 
> > signify whether the language options are valid or not (because it's 
> > plausible that the plugin wants to diagnose the language options but 
> > they're still valid enough that the attribute should be accepted)?
> 
> diagLangOpts already returns bool.
> 
> The blocking issue with the diagLangOpts signature for code-completion 
> purposes isn't actually the diagnostics (completion suppresses them), it's 
> rather that you have to construct a ParsedAttr  in order to emit them, which 
> isn't easy to do "out of thin air".
> do we know of any real plugins where the ability to use a custom diagnostic 
> here is important? Hypothetical flexibility may not be worth keeping.

We don't know how plugins are being used and we have to assume Hryum's Law 
bites us just as much as anyone else. I'm fine potentially breaking plugins so 
long as we're still leaving them with the ability to do what they were 
previously doing. However, @john.brawn (the attribute plugin author) might know 
more here on the usage front.

> if custom diagnostics are needed, can they be emitted when the attribute is 
> handled instead?

Good question! I think that might work -- they get access to `Sema` and so they 
can check the language options and produce diagnostics from there. It might 
mean slight behavioral changes (if we used to bail early on a lang opt 
mismatch, it means we might get different diagnostics by the delay until the 
attribute is handled), but I think those are reasonable.

> why we'd need this flexibility for LangOpts but not Target (existsInTarget)

Targets are a bit different -- you're in one target and that's it (so you 
either support the attribute for that target or not), but language options can 
have interactions between them (attribute may require something like CUDA to be 
enabled and it may also require some other CUDA-specific option to be enabled, 
and it wants to produce a nice diagnostic about that rather than just saying 
the attribute is ignored).

> The blocking issue with the diagLangOpts signature for code-completion 
> purposes isn't actually the diagnostics (completion suppresses them), it's 
> rather that you have to construct a ParsedAttr in order to emit them, which 
> isn't easy to do "out of thin air".

Ahh, I had missed that.

Given that the user can still do custom diagnostics when handling the attribute 
itself, I think this change is reasonable as-is. However, I think you should 
add a mention to the release notes that 1) the interface changed for plugin 
authors, and 2) the new approach to custom diagnostics for language options is 
to diagnose them when handling the attribute.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107836

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


[PATCH] D106509: [OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2)

2021-08-12 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny added inline comments.



Comment at: clang/lib/Basic/OpenMPKinds.cpp:64
+  return OMPC_MAP_MODIFIER_unknown;
+if (!LangOpts.OpenMPExtensions && Type == OMPC_MAP_MODIFIER_ompx_hold)
   return OMPC_MAP_MODIFIER_unknown;

ABataev wrote:
> jdenny wrote:
> > ABataev wrote:
> > > I would enable this since OpenMP 5.2, since in 5.2 `ompx_` is officially 
> > > allowed extension format.
> > Do you mean both `-fopenmp-version=52` and `-fopenmp-extensions` should be 
> > required to enable `ompx_hold`?
> > 
> > Or do you mean only `-fopenmp-version=52` should be required to enable 
> > `ompx_hold`, and we can drop the `-fopenmp-extensions` implementation?
> Second option. Actually, we can enable it if either `-fopenmp-version=52` or 
> `-fopenmp-extensions` is used, depends if we want to add a switch for 
> non-standard OpenMP extensions. If OpenMP 5.2 is on, we can just ignore 
> `-f[no]-openmp-extensions`. Thoughts?
Consider that, if `-fopenmp-version=52` is sufficient to enable all extensions 
using the `ompx_` prefix, then all such extensions will be enabled by default 
once OpenMP 5.2 is the default.  At that point, won't it be strange that 
standard OpenMP 5.3 or 6.0 features will be disabled by default while some 
features appearing in no standard will be enabled by default?

By that logic, it seems `-fopenmp-version=52` shouldn't be sufficient to enable 
extensions.  However, it seems overkill to have to specify both 
`-fopenmp-version=52` and `-fopenmp-extensions`.  I think `-fopenmp-extensions` 
is a clear enough request to enable the `ompx_` prefix regardless of the OpenMP 
version.


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

https://reviews.llvm.org/D106509

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


[PATCH] D106509: [OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2)

2021-08-12 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/Basic/OpenMPKinds.cpp:64
+  return OMPC_MAP_MODIFIER_unknown;
+if (!LangOpts.OpenMPExtensions && Type == OMPC_MAP_MODIFIER_ompx_hold)
   return OMPC_MAP_MODIFIER_unknown;

jdenny wrote:
> ABataev wrote:
> > jdenny wrote:
> > > ABataev wrote:
> > > > I would enable this since OpenMP 5.2, since in 5.2 `ompx_` is 
> > > > officially allowed extension format.
> > > Do you mean both `-fopenmp-version=52` and `-fopenmp-extensions` should 
> > > be required to enable `ompx_hold`?
> > > 
> > > Or do you mean only `-fopenmp-version=52` should be required to enable 
> > > `ompx_hold`, and we can drop the `-fopenmp-extensions` implementation?
> > Second option. Actually, we can enable it if either `-fopenmp-version=52` 
> > or `-fopenmp-extensions` is used, depends if we want to add a switch for 
> > non-standard OpenMP extensions. If OpenMP 5.2 is on, we can just ignore 
> > `-f[no]-openmp-extensions`. Thoughts?
> Consider that, if `-fopenmp-version=52` is sufficient to enable all 
> extensions using the `ompx_` prefix, then all such extensions will be enabled 
> by default once OpenMP 5.2 is the default.  At that point, won't it be 
> strange that standard OpenMP 5.3 or 6.0 features will be disabled by default 
> while some features appearing in no standard will be enabled by default?
> 
> By that logic, it seems `-fopenmp-version=52` shouldn't be sufficient to 
> enable extensions.  However, it seems overkill to have to specify both 
> `-fopenmp-version=52` and `-fopenmp-extensions`.  I think 
> `-fopenmp-extensions` is a clear enough request to enable the `ompx_` prefix 
> regardless of the OpenMP version.
Ok, let's move with `-fopenmp-extensions`


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

https://reviews.llvm.org/D106509

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


[clang] f999312 - Recommit "[Matrix] Overload stride arg in matrix.columnwise.load/store."

2021-08-12 Thread Florian Hahn via cfe-commits

Author: Florian Hahn
Date: 2021-08-12T18:31:57+01:00
New Revision: f999312872b811b550533640b92ecb234cf5c642

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

LOG: Recommit "[Matrix] Overload stride arg in matrix.columnwise.load/store."

This reverts the revert 28c04794df74ad3c38155a244729d1f8d57b9400.

The failing MLIR test that caused the revert should be fixed  in this
version.

Also includes a PPC test fix previously in 1f87c7c478a6.

Added: 


Modified: 
clang/test/CodeGen/matrix-type-builtins.c
clang/test/CodeGenCXX/matrix-type-builtins.cpp
clang/test/CodeGenObjC/matrix-type-builtins.m
llvm/docs/LangRef.rst
llvm/include/llvm/IR/Intrinsics.td
llvm/include/llvm/IR/MatrixBuilder.h
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
llvm/test/Analysis/CostModel/PowerPC/matrix.ll
llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-double.ll
llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-double.ll
llvm/test/Verifier/matrix-intrinsics.ll
mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir

Removed: 




diff  --git a/clang/test/CodeGen/matrix-type-builtins.c 
b/clang/test/CodeGen/matrix-type-builtins.c
index 67f5c78196878..ec0be85b7151e 100644
--- a/clang/test/CodeGen/matrix-type-builtins.c
+++ b/clang/test/CodeGen/matrix-type-builtins.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm 
-disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm 
-disable-llvm-passes -o - | FileCheck --check-prefixes=COMMON,CHECK64 %s
+// RUN: %clang_cc1 -fenable-matrix -triple i386-apple-darwin %s -emit-llvm 
-disable-llvm-passes -o - | FileCheck --check-prefixes=COMMON,CHECK32 %s
 
 // Also check we do not crash when running some middle-end passes. Most
 // importantly this includes the IR verifier, to ensure we emit valid IR.
@@ -15,30 +16,33 @@ typedef unsigned ux1x6_t __attribute__((matrix_type(1, 6)));
 typedef unsigned ux6x1_t __attribute__((matrix_type(6, 1)));
 
 void transpose_double_5x5(dx5x5_t *a) {
-  // CHECK-LABEL: define{{.*}} void @transpose_double_5x5(
-  // CHECK:[[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, 
align 8
-  // CHECK-NEXT:   [[TRANS:%.*]] = call <25 x double> 
@llvm.matrix.transpose.v25f64(<25 x double> [[A]], i32 5, i32 5)
-  // CHECK-NEXT:   [[AT_ADDR:%.*]] = bitcast [25 x double]* %a_t to <25 x 
double>*
-  // CHECK-NEXT:   store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], 
align 8
+  // COMMON-LABEL: define{{.*}} void @transpose_double_5x5(
+  // CHECK32:   [[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, 
align 4
+  // CHECK64:   [[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, 
align 8
+  // COMMON-NEXT:   [[TRANS:%.*]] = call <25 x double> 
@llvm.matrix.transpose.v25f64(<25 x double> [[A]], i32 5, i32 5)
+  // COMMON-NEXT:   [[AT_ADDR:%.*]] = bitcast [25 x double]* %a_t to <25 x 
double>*
+  // CHECK32-NEXT:  store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], 
align 4
+  // CHECK64-NEXT:  store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], 
align 8
+
   dx5x5_t a_t = __builtin_matrix_transpose(*a);
 }
 
 void transpose_float_3x2(fx3x2_t *a) {
-  // CHECK-LABEL: define{{.*}} void @transpose_float_3x2(
-  // CHECK:[[A:%.*]] = load <6 x float>, <6 x float>* {{.*}}, align 4
-  // CHECK-NEXT:   [[TRANS:%.*]] = call <6 x float> 
@llvm.matrix.transpose.v6f32(<6 x float> [[A]], i32 3, i32 2)
-  // CHECK-NEXT:   [[AT_ADDR:%.*]] = bitcast [6 x float]* %a_t to <6 x float>*
-  // CHECK-NEXT:   store <6 x float> [[TRANS]], <6 x float>* [[AT_ADDR]], 
align 4
+  // COMMON-LABEL: define{{.*}} void @transpose_float_3x2(
+  // COMMON:[[A:%.*]] = load <6 x float>, <6 x float>* {{.*}}, align 4
+  // COMMON-NEXT:   [[TRANS:%.*]] = call <6 x float> 
@llvm.matrix.transpose.v6f32(<6 x float> [[A]], i32 3, i32 2)
+  // COMMON-NEXT:   [[AT_ADDR:%.*]] = bitcast [6 x float]* %a_t to <6 x float>*
+  // COMMON-NEXT:   store <6 x float> [[TRANS]], <6 x float>* [[AT_ADDR]], 
align 4
 
   fx2x3_t a_t = __builtin_matrix_transpose(*a);
 }
 
 void transpose_int_20x4(ix20x4_t *a) {
-  // CHECK-LABEL: define{{.*}} void @transpose_int_20x4(
-  // CHECK: [[A:%.*]] = load <80 x i32>, <80 x i32>* {{.*}}, align 4
-  // CHECK-NEXT:[[TRANS:%.*]] = call <80 x i32> 
@llvm.matrix.transpose.v80i32(<80 x i32> [[A]], i32 20, i32 4)
-  // CHECK-NEXT:[[AT_ADDR:%.*]] = bitcast [80 x i32]* %a_t to <80 x i32>*
-  // CHECK-NEXT:store <80 x i32> [[TRANS]], <80 x i32>* [[AT_ADDR]], align 
4
+  // COMMON-LABEL: define{{.*}} void @transpose_int_20x4(
+  // COMMON: [[A:%.*]] = load <80 x i32>, <80 x i32>* {{.*}}, align 4
+  // COMMON-NEXT:[[TRANS:%.*]] = cal

  1   2   3   >