r271176 - [X86] Simplify alignr builtin support by recognizing that NumLaneElts is always 16. NFC

2016-05-29 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sun May 29 02:06:02 2016
New Revision: 271176

URL: http://llvm.org/viewvc/llvm-project?rev=271176&view=rev
Log:
[X86] Simplify alignr builtin support by recognizing that NumLaneElts is always 
16. NFC

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=271176&r1=271175&r2=271176&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Sun May 29 02:06:02 2016
@@ -6524,29 +6524,27 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 unsigned NumElts =
   cast(Ops[0]->getType())->getNumElements();
 assert(NumElts % 16 == 0);
-unsigned NumLanes = NumElts / 16;
-unsigned NumLaneElts = NumElts / NumLanes;
 
 // If palignr is shifting the pair of vectors more than the size of two
 // lanes, emit zero.
-if (ShiftVal >= (2 * NumLaneElts))
+if (ShiftVal >= 32)
   return llvm::Constant::getNullValue(ConvertType(E->getType()));
 
 // If palignr is shifting the pair of input vectors more than one lane,
 // but less than two lanes, convert to shifting in zeroes.
-if (ShiftVal > NumLaneElts) {
-  ShiftVal -= NumLaneElts;
+if (ShiftVal > 16) {
+  ShiftVal -= 16;
   Ops[1] = Ops[0];
   Ops[0] = llvm::Constant::getNullValue(Ops[0]->getType());
 }
 
 int Indices[32];
 // 256-bit palignr operates on 128-bit lanes so we need to handle that
-for (unsigned l = 0; l != NumElts; l += NumLaneElts) {
-  for (unsigned i = 0; i != NumLaneElts; ++i) {
+for (unsigned l = 0; l != NumElts; l += 16) {
+  for (unsigned i = 0; i != 16; ++i) {
 unsigned Idx = ShiftVal + i;
-if (Idx >= NumLaneElts)
-  Idx += NumElts - NumLaneElts; // End of lane, switch operand.
+if (Idx >= 16)
+  Idx += NumElts - 16; // End of lane, switch operand.
 Indices[l + i] = Idx + l;
   }
 }


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


[PATCH] D20781: [libcxx] Add use-libunwind x86_64 builders to buildbot

2016-05-29 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added reviewers: EricWF, gribozavr, gkistanova, rengolin.
rmaprath added a subscriber: cfe-commits.
Herald added a subscriber: aemerson.

Currently, only the ARM libcxx builder seems to test libunwind 
(`-DLIBCXXABI_USE_LLVM_UNWINDER=ON` cmake option).

This patch adds two x86_64 builders to do the same. Some minor cleanups too.

http://reviews.llvm.org/D20781

Files:
  buildbot/osuosl/master/config/builders.py

Index: buildbot/osuosl/master/config/builders.py
===
--- buildbot/osuosl/master/config/builders.py
+++ buildbot/osuosl/master/config/builders.py
@@ -848,22 +848,30 @@
 
 def _get_libcxx_builders():
 return [
+# gribozavr's builders on gribozavr4 
 {'name': 'libcxx-libcxxabi-x86_64-linux-debian',
  'slavenames': ['gribozavr4'],
  'builddir': 'libcxx-libcxxabi-x86_64-linux-debian',
  'factory': LibcxxAndAbiBuilder.getLibcxxAndAbiBuilder(
  env={'CC': 'clang', 'CXX': 'clang++'}),
  'category': 'libcxx'},
 
-# x86_64 -fno-exceptions libcxx builder
 {'name': 'libcxx-libcxxabi-x86_64-linux-debian-noexceptions',
  'slavenames': ['gribozavr4'],
  'builddir': 'libcxx-libcxxabi-x86_64-linux-debian-noexceptions',
  'factory': LibcxxAndAbiBuilder.getLibcxxAndAbiBuilder(
  env={'CC': 'clang', 'CXX': 'clang++'},
  cmake_extra_opts={'LIBCXX_ENABLE_EXCEPTIONS': 'OFF'}),
  'category': 'libcxx'},
 
+{'name': 'libcxx-libcxxabi-libunwind-x86_64-linux-debian',
+ 'slavenames': ['gribozavr4'],
+ 'builddir': 'libcxx-libcxxabi-libunwind-x86_64-linux-debian',
+ 'factory': LibcxxAndAbiBuilder.getLibcxxAndAbiBuilder(
+ env={'CC': 'clang', 'CXX': 'clang++'},
+ cmake_extra_opts={'LIBCXXABI_USE_LLVM_UNWINDER': 'ON'}),
+ 'category': 'libcxx'},
+
 {'name': 'libcxx-libcxxabi-singlethreaded-x86_64-linux-debian',
  'slavenames': ['gribozavr4'],
  'builddir': 'libcxx-libcxxabi-singlethreaded-x86_64-linux-debian',
@@ -932,6 +940,15 @@
 lit_extra_opts={'std':'c++1z'}),
 'category': 'libcxx'},
 
+{'name': 'libcxx-libcxxabi-libunwind-x86_64-linux-ubuntu',
+ 'slavenames': ['ericwf-buildslave2'],
+ 'builddir' : 'libcxx-libcxxabi-libunwind-x86_64-linux-ubuntu',
+ 'factory': LibcxxAndAbiBuilder.getLibcxxAndAbiBuilder(
+env={'PATH': '/usr/local/bin:/usr/bin:/bin',
+ 'CC': 'clang', 'CXX': 'clang++'},
+cmake_extra_opts={'LIBCXXABI_USE_LLVM_UNWINDER': 'ON'}),
+'category': 'libcxx'},
+
 {'name': 'libcxx-libcxxabi-x86_64-linux-ubuntu-tsan',
  'slavenames': ['ericwf-buildslave2'],
  'builddir' : 'libcxx-libcxxabi-x86_64-linux-ubuntu-tsan',
@@ -970,7 +987,7 @@
 # FIXME: there should be a way to merge autodetected with 
user-defined linker flags
 # See: libcxxabi/test/lit.cfg
 lit_extra_opts={'link_flags': '"-lc++abi -lc -lm -lpthread 
-lunwind -ldl -L/opt/llvm/lib/clang/3.6.0/lib/linux -lclang_rt.builtins-arm"'},
-cmake_extra_opts={'LIBCXXABI_USE_LLVM_UNWINDER': 'True',
+cmake_extra_opts={'LIBCXXABI_USE_LLVM_UNWINDER': 'ON',
   'CMAKE_C_FLAGS': '-mcpu=cortex-a15',
   'CMAKE_CXX_FLAGS': '-mcpu=cortex-a15'})},
 ]


Index: buildbot/osuosl/master/config/builders.py
===
--- buildbot/osuosl/master/config/builders.py
+++ buildbot/osuosl/master/config/builders.py
@@ -848,22 +848,30 @@
 
 def _get_libcxx_builders():
 return [
+# gribozavr's builders on gribozavr4 
 {'name': 'libcxx-libcxxabi-x86_64-linux-debian',
  'slavenames': ['gribozavr4'],
  'builddir': 'libcxx-libcxxabi-x86_64-linux-debian',
  'factory': LibcxxAndAbiBuilder.getLibcxxAndAbiBuilder(
  env={'CC': 'clang', 'CXX': 'clang++'}),
  'category': 'libcxx'},
 
-# x86_64 -fno-exceptions libcxx builder
 {'name': 'libcxx-libcxxabi-x86_64-linux-debian-noexceptions',
  'slavenames': ['gribozavr4'],
  'builddir': 'libcxx-libcxxabi-x86_64-linux-debian-noexceptions',
  'factory': LibcxxAndAbiBuilder.getLibcxxAndAbiBuilder(
  env={'CC': 'clang', 'CXX': 'clang++'},
  cmake_extra_opts={'LIBCXX_ENABLE_EXCEPTIONS': 'OFF'}),
  'category': 'libcxx'},
 
+{'name': 'libcxx-libcxxabi-libunwind-x86_64-linux-debian',
+ 'slavenames': ['gribozavr4'],
+ 'builddir': 'libcxx-libcxxabi-libunwind-x86_64-linux-debian',
+ 'factory': LibcxxAndAbiBuilder.getLibcxxAndAbiBuilder(
+ env={'CC': 'clang', 'CXX': 'clang++'},
+ cmake_extra_opts={'LIBCXXABI_USE_LLVM_UNWINDER': 'ON'}),
+ 'category': 'libcxx'},
+
  

Re: [PATCH] D20781: [libcxx] Add use-libunwind x86_64 builders to buildbot

2016-05-29 Thread Dmitri Gribenko via cfe-commits
gribozavr added a comment.

LGTM.


http://reviews.llvm.org/D20781



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


Re: [PATCH] D20781: [libcxx] Add use-libunwind x86_64 builders to buildbot

2016-05-29 Thread Asiri Rathnayake via cfe-commits
rmaprath closed this revision.
rmaprath added a comment.

Thanks!

Committed as r271179.

Will be effective from the next buildmaster restart from @gkistanova.

/ Asiri


http://reviews.llvm.org/D20781



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


r271182 - Avoid unnecessary std::string copies. NFC.

2016-05-29 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Sun May 29 06:04:56 2016
New Revision: 271182

URL: http://llvm.org/viewvc/llvm-project?rev=271182&view=rev
Log:
Avoid unnecessary std::string copies. NFC.

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Tooling/Refactoring.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=271182&r1=271181&r2=271182&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sun May 29 06:04:56 2016
@@ -400,7 +400,7 @@ static void setPGOInstrumentor(CodeGenOp
 
 // Set the profile kind using fprofile-instrument-use-path.
 static void setPGOUseInstrumentor(CodeGenOptions &Opts,
-  const std::string ProfileName) {
+  const Twine &ProfileName) {
   auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName);
   // In error, return silently and let Clang PGOUse report the error message.
   if (auto E = ReaderOrErr.takeError()) {

Modified: cfe/trunk/lib/Tooling/Refactoring.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Refactoring.cpp?rev=271182&r1=271181&r2=271182&view=diff
==
--- cfe/trunk/lib/Tooling/Refactoring.cpp (original)
+++ cfe/trunk/lib/Tooling/Refactoring.cpp Sun May 29 06:04:56 2016
@@ -70,8 +70,8 @@ bool formatAndApplyAllReplacements(const
   auto FileToReplaces = groupReplacementsByFile(Replaces);
 
   bool Result = true;
-  for (auto &FileAndReplaces : FileToReplaces) {
-const std::string FilePath = FileAndReplaces.first;
+  for (const auto &FileAndReplaces : FileToReplaces) {
+const std::string &FilePath = FileAndReplaces.first;
 auto &CurReplaces = FileAndReplaces.second;
 
 const FileEntry *Entry = Files.getFile(FilePath);


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


Re: [PATCH] D20737: clang-format: [JS] fix async parsing.

2016-05-29 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D20737



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


Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-29 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.

Looks good.


http://reviews.llvm.org/D20632



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


Re: [PATCH] D20734: [clang-format] insert new #includes into correct blocks when cleaning up Replacement with cleanupAroundReplacements().

2016-05-29 Thread Daniel Jasper via cfe-commits
djasper added inline comments.


Comment at: lib/Format/Format.cpp:1411
@@ +1410,3 @@
+int getIncludePriority(const FormatStyle &Style,
+   SmallVector &CategoryRegexs,
+   StringRef IncludeName) {

But you should pass it as an ArrayRef or a SmallVectorImpl.


Comment at: lib/Format/Format.cpp:1413
@@ +1412,3 @@
+   StringRef IncludeName) {
+  for (unsigned i = 0, e = CategoryRegexs.size(); i != e; ++i) {
+if (CategoryRegexs[i].match(IncludeName)) {

nit: no braces


Comment at: lib/Format/Format.cpp:1418
@@ +1417,3 @@
+  }
+  return -1;
+}

From the docs in Format.h: "If none of the regular expressions match, INT_MAX 
is assigned". If that is true for an existing #include as well as the inserted 
one, I don't see a reason, why those should belong to the same block. So, I 
think you should return INT_MAX here and remove all the special-casing below.


Comment at: lib/Format/Format.cpp:1431
@@ +1430,3 @@
+
+  llvm::Regex IncludeRegex(
+  R"(^[\t\ ]*#[\t\ ]*include[\t\ ]*(["<][^">]*[">]))");

We already have an include regex in this file, I don't think we should have 
two. Can you pull out the string into a constant?


Comment at: lib/Format/Format.cpp:1435
@@ +1434,3 @@
+  SmallVector Matches;
+  // Create pre-compiled regular expressions for the #include categories.
+  SmallVector CategoryRegexs;

There is a lot of duplicated code between this and sortCppIncludes. Pull common 
code out into functions.


Comment at: lib/Format/Format.cpp:1454
@@ +1453,3 @@
+  // extra category (priority 0) for main include.
+  std::vector CategoryEndOffsets(MaxPriority + 1, -1);
+  bool MainIncludeFound = false;

There is no guarantee that people assign categories sequentially, I can easily 
see people assigning category "1000" or "1" to be able to add more 
categories later. I think this should be a map and I think you then also don't 
really need the vector. Also note that categories can be negative, which I 
think would break this.


Comment at: lib/Format/Format.cpp:1458
@@ +1457,3 @@
+  int Offset = 0;
+  int AfterFirstDefine = 0;
+  SmallVector Lines;

I am guessing that AfterFirstDefine is used so that we insert #includes after 
header guards. I think we should name it AfterHeaderGuard than and either make 
the behavior more strict or at least add a FIXME for it (only in header files, 
only if the #define is after an #ifndef, ...)


Comment at: lib/Format/Format.cpp:1482
@@ +1481,3 @@
+  } else {
+CategoryEndOffsets[Category] = Offset + Line.size() + 1;
+  }

I think if you assign the EndOffset of all lower categories that aren't set 
yet, that will simplify the logic below.


Comment at: lib/Format/Format.cpp:1509
@@ +1508,3 @@
+// Append the new #include after the corresponding category if the category
+// exists. Otherwise, append after the last category that has higher
+// priority than the current category. If there is no category, insert 
after

What happens if there is no category with higher priority, but there is a 
category with lower priority. Shouldn't you then insert the #include right 
before that?


Comment at: lib/Format/Format.cpp:1548
@@ +1547,3 @@
+  const FormatStyle &Style) {
+  // FIXME: support other languages.
+  if (Style.Language != FormatStyle::LanguageKind::LK_Cpp)

I think you can remove this FIXME.. Seems obvious.


Comment at: lib/Format/Format.cpp:1551
@@ +1550,3 @@
+return Replaces;
+  tooling::Replacements HeaderInsertionReplaces;
+  tooling::Replacements NewReplaces;

Why do you split out all the header insertion replacements here instead of just 
ignoring the ones that aren't header insertions in fixCppIncludeInsertions?


Comment at: lib/Format/Format.cpp:1554
@@ +1553,3 @@
+  for (const auto &R : Replaces) {
+if (R.getOffset() == -1U) {
+  HeaderInsertionReplaces.insert(R);

nit: No braces.


http://reviews.llvm.org/D20734



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


Re: [PATCH] D20737: clang-format: [JS] fix async parsing.

2016-05-29 Thread Martin Probst via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271184: clang-format: [JS] fix async parsing. (authored by 
mprobst).

Changed prior to commit:
  http://reviews.llvm.org/D20737?vs=58809&id=58915#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20737

Files:
  cfe/trunk/lib/Format/UnwrappedLineParser.cpp
  cfe/trunk/unittests/Format/FormatTestJS.cpp

Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
===
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp
@@ -1013,7 +1013,9 @@
   // Parse function literal unless 'function' is the first token in a line
   // in which case this should be treated as a free-standing function.
   if (Style.Language == FormatStyle::LK_JavaScript &&
-  FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function) &&
+  (FormatTok->is(Keywords.kw_function) ||
+   FormatTok->startsSequence(Keywords.kw_async,
+ Keywords.kw_function)) &&
   Line->Tokens.size() > 0) {
 tryToParseJSFunction();
 break;
@@ -1200,7 +1202,8 @@
 }
 
 void UnwrappedLineParser::tryToParseJSFunction() {
-  assert(FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function));
+  assert(FormatTok->is(Keywords.kw_function) ||
+ FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function));
   if (FormatTok->is(Keywords.kw_async))
 nextToken();
   // Consume "function".
@@ -1254,7 +1257,8 @@
   // replace this by using parseAssigmentExpression() inside.
   do {
 if (Style.Language == FormatStyle::LK_JavaScript) {
-  if (FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)) {
+  if (FormatTok->is(Keywords.kw_function) ||
+  FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)) {
 tryToParseJSFunction();
 continue;
   }
@@ -1352,7 +1356,8 @@
   break;
 case tok::identifier:
   if (Style.Language == FormatStyle::LK_JavaScript &&
-  FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function))
+  (FormatTok->is(Keywords.kw_function) ||
+   FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)))
 tryToParseJSFunction();
   else
 nextToken();
Index: cfe/trunk/unittests/Format/FormatTestJS.cpp
===
--- cfe/trunk/unittests/Format/FormatTestJS.cpp
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp
@@ -354,6 +354,10 @@
   verifyFormat("class X {\n"
"  async asyncMethod() { return fetch(1); }\n"
"}");
+  verifyFormat("function initialize() {\n"
+   "  // Comment.\n"
+   "  return async.then();\n"
+   "}\n");
 }
 
 TEST_F(FormatTestJS, ArrayLiterals) {


Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
===
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp
@@ -1013,7 +1013,9 @@
   // Parse function literal unless 'function' is the first token in a line
   // in which case this should be treated as a free-standing function.
   if (Style.Language == FormatStyle::LK_JavaScript &&
-  FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function) &&
+  (FormatTok->is(Keywords.kw_function) ||
+   FormatTok->startsSequence(Keywords.kw_async,
+ Keywords.kw_function)) &&
   Line->Tokens.size() > 0) {
 tryToParseJSFunction();
 break;
@@ -1200,7 +1202,8 @@
 }
 
 void UnwrappedLineParser::tryToParseJSFunction() {
-  assert(FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function));
+  assert(FormatTok->is(Keywords.kw_function) ||
+ FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function));
   if (FormatTok->is(Keywords.kw_async))
 nextToken();
   // Consume "function".
@@ -1254,7 +1257,8 @@
   // replace this by using parseAssigmentExpression() inside.
   do {
 if (Style.Language == FormatStyle::LK_JavaScript) {
-  if (FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)) {
+  if (FormatTok->is(Keywords.kw_function) ||
+  FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)) {
 tryToParseJSFunction();
 continue;
   }
@@ -1352,7 +1356,8 @@
   break;
 case tok::identifier:
   if (Style.Language == FormatStyle::LK_JavaScript &&
-  FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function))
+  (FormatTok->is(Keywords.kw_function) ||
+   FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)))
 tryToParseJSFunction();
   else
 nextToken();
Index: cfe/trunk/unittests/Format/FormatTestJS.cpp
===
--- cfe/trunk/u

r271184 - clang-format: [JS] fix async parsing.

2016-05-29 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Sun May 29 09:41:07 2016
New Revision: 271184

URL: http://llvm.org/viewvc/llvm-project?rev=271184&view=rev
Log:
clang-format: [JS] fix async parsing.

Summary:
Only treat the sequence `async function` as the start of a function expression,
as opposed to every occurrence of the token `async` (whoops).

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D20737

Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=271184&r1=271183&r2=271184&view=diff
==
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Sun May 29 09:41:07 2016
@@ -1013,7 +1013,9 @@ void UnwrappedLineParser::parseStructura
   // Parse function literal unless 'function' is the first token in a line
   // in which case this should be treated as a free-standing function.
   if (Style.Language == FormatStyle::LK_JavaScript &&
-  FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function) &&
+  (FormatTok->is(Keywords.kw_function) ||
+   FormatTok->startsSequence(Keywords.kw_async,
+ Keywords.kw_function)) &&
   Line->Tokens.size() > 0) {
 tryToParseJSFunction();
 break;
@@ -1200,7 +1202,8 @@ bool UnwrappedLineParser::tryToParseLamb
 }
 
 void UnwrappedLineParser::tryToParseJSFunction() {
-  assert(FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function));
+  assert(FormatTok->is(Keywords.kw_function) ||
+ FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function));
   if (FormatTok->is(Keywords.kw_async))
 nextToken();
   // Consume "function".
@@ -1254,7 +1257,8 @@ bool UnwrappedLineParser::parseBracedLis
   // replace this by using parseAssigmentExpression() inside.
   do {
 if (Style.Language == FormatStyle::LK_JavaScript) {
-  if (FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)) {
+  if (FormatTok->is(Keywords.kw_function) ||
+  FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)) {
 tryToParseJSFunction();
 continue;
   }
@@ -1352,7 +1356,8 @@ void UnwrappedLineParser::parseParens()
   break;
 case tok::identifier:
   if (Style.Language == FormatStyle::LK_JavaScript &&
-  FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function))
+  (FormatTok->is(Keywords.kw_function) ||
+   FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)))
 tryToParseJSFunction();
   else
 nextToken();

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=271184&r1=271183&r2=271184&view=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Sun May 29 09:41:07 2016
@@ -354,6 +354,10 @@ TEST_F(FormatTestJS, AsyncFunctions) {
   verifyFormat("class X {\n"
"  async asyncMethod() { return fetch(1); }\n"
"}");
+  verifyFormat("function initialize() {\n"
+   "  // Comment.\n"
+   "  return async.then();\n"
+   "}\n");
 }
 
 TEST_F(FormatTestJS, ArrayLiterals) {


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


r271185 - clang-format: [JS] Support shebang lines on the very first line.

2016-05-29 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Sun May 29 09:41:36 2016
New Revision: 271185

URL: http://llvm.org/viewvc/llvm-project?rev=271185&view=rev
Log:
clang-format: [JS] Support shebang lines on the very first line.

Summary:
Shebang lines (`#!/bin/blah`) can be used in JavaScript scripts to indicate
they should be run using e.g. node. This change treats # lines on the first line
as line comments.

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D20632

Modified:
cfe/trunk/lib/Format/FormatToken.h
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/FormatToken.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/FormatToken.h?rev=271185&r1=271184&r2=271185&view=diff
==
--- cfe/trunk/lib/Format/FormatToken.h (original)
+++ cfe/trunk/lib/Format/FormatToken.h Sun May 29 09:41:36 2016
@@ -145,7 +145,7 @@ struct FormatToken {
   /// \brief Whether the token text contains newlines (escaped or not).
   bool IsMultiline = false;
 
-  /// \brief Indicates that this is the first token.
+  /// \brief Indicates that this is the first token of the file.
   bool IsFirst = false;
 
   /// \brief Whether there must be a line break before this token.

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=271185&r1=271184&r2=271185&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Sun May 29 09:41:36 2016
@@ -690,10 +690,24 @@ private:
   }
 
   LineType parsePreprocessorDirective() {
+bool IsFirstToken = CurrentToken->IsFirst;
 LineType Type = LT_PreprocessorDirective;
 next();
 if (!CurrentToken)
   return Type;
+
+if (Style.Language == FormatStyle::LK_JavaScript && IsFirstToken) {
+  // JavaScript files can contain shebang lines of the form:
+  // #!/usr/bin/env node
+  // Treat these like C++ #include directives.
+  while (CurrentToken) {
+// Tokens cannot be comments here.
+CurrentToken->Type = TT_ImplicitStringLiteral;
+next();
+  }
+  return LT_ImportStatement;
+}
+
 if (CurrentToken->Tok.is(tok::numeric_constant)) {
   CurrentToken->SpacesRequiredBefore = 1;
   return Type;

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=271185&r1=271184&r2=271185&view=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Sun May 29 09:41:36 2016
@@ -1276,5 +1276,12 @@ TEST_F(FormatTestJS, RequoteStringsLeave
   verifyFormat("var x = 'foo';", LeaveQuotes);
 }
 
+TEST_F(FormatTestJS, SupportShebangLines) {
+  verifyFormat("#!/usr/bin/env node\n"
+   "var x = hello();",
+   "#!/usr/bin/env node\n"
+   "var x   =  hello();");
+}
+
 } // end namespace tooling
 } // end namespace clang


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


r271183 - clang-format: [JS] FormatToken.startsSequence/endsSequence.

2016-05-29 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Sun May 29 09:41:02 2016
New Revision: 271183

URL: http://llvm.org/viewvc/llvm-project?rev=271183&view=rev
Log:
clang-format: [JS] FormatToken.startsSequence/endsSequence.

Refactors AnnotatedLine.startsWith/endsWith by extracting the core functionality
into FormatToken.startsSequence/endsSequence. This allows checking tokens within
the pointered linked list structure with a lookahead, automatically ignoring
comments, which is useful in many places (e.g. see subsequent commit).

Modified:
cfe/trunk/lib/Format/FormatToken.h
cfe/trunk/lib/Format/TokenAnnotator.h

Modified: cfe/trunk/lib/Format/FormatToken.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/FormatToken.h?rev=271183&r1=271182&r2=271183&view=diff
==
--- cfe/trunk/lib/Format/FormatToken.h (original)
+++ cfe/trunk/lib/Format/FormatToken.h Sun May 29 09:41:02 2016
@@ -297,6 +297,20 @@ struct FormatToken {
   }
   template  bool isNot(T Kind) const { return !is(Kind); }
 
+  /// \c true if this token starts a sequence with the given tokens in order,
+  /// following the ``Next`` pointers, ignoring comments.
+  template 
+  bool startsSequence(A K1, Ts... Tokens) const {
+return startsSequenceInternal(K1, Tokens...);
+  }
+
+  /// \c true if this token ends a sequence with the given tokens in order,
+  /// following the ``Previous`` pointers, ignoring comments.
+  template 
+  bool endsSequence(A K1, Ts... Tokens) const {
+return endsSequenceInternal(K1, Tokens...);
+  }
+
   bool isStringLiteral() const { return tok::isStringLiteral(Tok.getKind()); }
 
   bool isObjCAtKeyword(tok::ObjCKeywordKind Kind) const {
@@ -429,6 +443,34 @@ private:
   // Disallow copying.
   FormatToken(const FormatToken &) = delete;
   void operator=(const FormatToken &) = delete;
+
+  template 
+  bool startsSequenceInternal(A K1, Ts... Tokens) const {
+if (is(tok::comment) && Next)
+  return Next->startsSequenceInternal(K1, Tokens...);
+return is(K1) && Next && Next->startsSequenceInternal(Tokens...);
+  }
+
+  template 
+  bool startsSequenceInternal(A K1) const {
+if (is(tok::comment) && Next)
+  return Next->startsSequenceInternal(K1);
+return is(K1);
+  }
+
+  template 
+  bool endsSequenceInternal(A K1) const {
+if (is(tok::comment) && Previous)
+  return Previous->endsSequenceInternal(K1);
+return is(K1);
+  }
+
+  template 
+  bool endsSequenceInternal(A K1, Ts... Tokens) const {
+if (is(tok::comment) && Previous)
+  return Previous->endsSequenceInternal(K1, Tokens...);
+return is(K1) && Previous && Previous->endsSequenceInternal(Tokens...);
+  }
 };
 
 class ContinuationIndenter;

Modified: cfe/trunk/lib/Format/TokenAnnotator.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.h?rev=271183&r1=271182&r2=271183&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.h (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.h Sun May 29 09:41:02 2016
@@ -83,7 +83,7 @@ public:
   /// \c true if this line starts with the given tokens in order, ignoring
   /// comments.
   template  bool startsWith(Ts... Tokens) const {
-return startsWithInternal(First, Tokens...);
+return First && First->startsSequence(Tokens...);
   }
 
   /// \c true if this line ends with the given tokens in reversed order,
@@ -91,7 +91,7 @@ public:
   /// For example, given tokens [T1, T2, T3, ...], the function returns true if
   /// this line is like "... T3 T2 T1".
   template  bool endsWith(Ts... Tokens) const {
-return endsWithInternal(Last, Tokens...);
+return Last && Last->endsSequence(Tokens...);
   }
 
   /// \c true if this line looks like a function definition instead of a
@@ -130,44 +130,6 @@ private:
   // Disallow copying.
   AnnotatedLine(const AnnotatedLine &) = delete;
   void operator=(const AnnotatedLine &) = delete;
-
-  template 
-  bool startsWithInternal(const FormatToken *Tok, A K1) const {
-// Even though we skip comments in the outer `startWithInternal` function,
-// this loop is still necessary if it is invoked by the public interface
-// `startsWith`.
-while (Tok && Tok->is(tok::comment))
-  Tok = Tok->Next;
-return Tok && Tok->is(K1);
-  }
-
-  template 
-  bool startsWithInternal(const FormatToken *Tok, A K1, Ts... Tokens) const {
-// Skip comments before calling `startsWithInternal(Tok, K1)` so that  the
-// second call to `startsWithInternal` takes the correct `Tok->Next`, which
-// should be the next token of the token checked in the first call.
-while (Tok && Tok->is(tok::comment))
-  Tok = Tok->Next;
-return Tok && startsWithInternal(Tok, K1) &&
-   startsWithInternal(Tok->Next, Tokens...);
-  }
-
-  template 
-  bool endsWithInternal(const FormatToken *Tok, A K1) const {
-// See the comments above in `startsWithInternal(

Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-29 Thread Martin Probst via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271185: clang-format: [JS] Support shebang lines on the very 
first line. (authored by mprobst).

Changed prior to commit:
  http://reviews.llvm.org/D20632?vs=58612&id=58916#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20632

Files:
  cfe/trunk/lib/Format/FormatToken.h
  cfe/trunk/lib/Format/TokenAnnotator.cpp
  cfe/trunk/unittests/Format/FormatTestJS.cpp

Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -690,10 +690,24 @@
   }
 
   LineType parsePreprocessorDirective() {
+bool IsFirstToken = CurrentToken->IsFirst;
 LineType Type = LT_PreprocessorDirective;
 next();
 if (!CurrentToken)
   return Type;
+
+if (Style.Language == FormatStyle::LK_JavaScript && IsFirstToken) {
+  // JavaScript files can contain shebang lines of the form:
+  // #!/usr/bin/env node
+  // Treat these like C++ #include directives.
+  while (CurrentToken) {
+// Tokens cannot be comments here.
+CurrentToken->Type = TT_ImplicitStringLiteral;
+next();
+  }
+  return LT_ImportStatement;
+}
+
 if (CurrentToken->Tok.is(tok::numeric_constant)) {
   CurrentToken->SpacesRequiredBefore = 1;
   return Type;
Index: cfe/trunk/lib/Format/FormatToken.h
===
--- cfe/trunk/lib/Format/FormatToken.h
+++ cfe/trunk/lib/Format/FormatToken.h
@@ -145,7 +145,7 @@
   /// \brief Whether the token text contains newlines (escaped or not).
   bool IsMultiline = false;
 
-  /// \brief Indicates that this is the first token.
+  /// \brief Indicates that this is the first token of the file.
   bool IsFirst = false;
 
   /// \brief Whether there must be a line break before this token.
Index: cfe/trunk/unittests/Format/FormatTestJS.cpp
===
--- cfe/trunk/unittests/Format/FormatTestJS.cpp
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp
@@ -1276,5 +1276,12 @@
   verifyFormat("var x = 'foo';", LeaveQuotes);
 }
 
+TEST_F(FormatTestJS, SupportShebangLines) {
+  verifyFormat("#!/usr/bin/env node\n"
+   "var x = hello();",
+   "#!/usr/bin/env node\n"
+   "var x   =  hello();");
+}
+
 } // end namespace tooling
 } // end namespace clang


Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -690,10 +690,24 @@
   }
 
   LineType parsePreprocessorDirective() {
+bool IsFirstToken = CurrentToken->IsFirst;
 LineType Type = LT_PreprocessorDirective;
 next();
 if (!CurrentToken)
   return Type;
+
+if (Style.Language == FormatStyle::LK_JavaScript && IsFirstToken) {
+  // JavaScript files can contain shebang lines of the form:
+  // #!/usr/bin/env node
+  // Treat these like C++ #include directives.
+  while (CurrentToken) {
+// Tokens cannot be comments here.
+CurrentToken->Type = TT_ImplicitStringLiteral;
+next();
+  }
+  return LT_ImportStatement;
+}
+
 if (CurrentToken->Tok.is(tok::numeric_constant)) {
   CurrentToken->SpacesRequiredBefore = 1;
   return Type;
Index: cfe/trunk/lib/Format/FormatToken.h
===
--- cfe/trunk/lib/Format/FormatToken.h
+++ cfe/trunk/lib/Format/FormatToken.h
@@ -145,7 +145,7 @@
   /// \brief Whether the token text contains newlines (escaped or not).
   bool IsMultiline = false;
 
-  /// \brief Indicates that this is the first token.
+  /// \brief Indicates that this is the first token of the file.
   bool IsFirst = false;
 
   /// \brief Whether there must be a line break before this token.
Index: cfe/trunk/unittests/Format/FormatTestJS.cpp
===
--- cfe/trunk/unittests/Format/FormatTestJS.cpp
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp
@@ -1276,5 +1276,12 @@
   verifyFormat("var x = 'foo';", LeaveQuotes);
 }
 
+TEST_F(FormatTestJS, SupportShebangLines) {
+  verifyFormat("#!/usr/bin/env node\n"
+   "var x = hello();",
+   "#!/usr/bin/env node\n"
+   "var x   =  hello();");
+}
+
 } // end namespace tooling
 } // end namespace clang
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20388: AMDGPU: Fix supported CL features

2016-05-29 Thread Jan Vesely via cfe-commits
jvesely added inline comments.


Comment at: test/Misc/r600.languageOptsOpenCL.cl:4
@@ +3,3 @@
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown 
-target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown 
-target-cpu turks -DTURKS
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown 
-target-cpu cayman

arsenm wrote:
> We should probably add builtin device macros for these
When we ran into similar problem while adding fma. We opted for feature 
macro(__HAS_FMAF__) instead of device macro. I suppose I can add __HAS_FP64__, 
but it won't have many uses since everyone checks for cl_khr_fp64.


Repository:
  rL LLVM

http://reviews.llvm.org/D20388



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


r271187 - [X86][SSE] Make unsigned integer vector types generally available

2016-05-29 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Sun May 29 13:49:08 2016
New Revision: 271187

URL: http://llvm.org/viewvc/llvm-project?rev=271187&view=rev
Log:
[X86][SSE] Make unsigned integer vector types generally available

As discussed on http://reviews.llvm.org/D20684, move the unsigned integer 
vector types used for zero extension to make them available for general use.


Modified:
cfe/trunk/lib/Headers/avx2intrin.h
cfe/trunk/lib/Headers/emmintrin.h
cfe/trunk/lib/Headers/smmintrin.h

Modified: cfe/trunk/lib/Headers/avx2intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx2intrin.h?rev=271187&r1=271186&r2=271187&view=diff
==
--- cfe/trunk/lib/Headers/avx2intrin.h (original)
+++ cfe/trunk/lib/Headers/avx2intrin.h Sun May 29 13:49:08 2016
@@ -402,42 +402,36 @@ _mm256_cvtepi32_epi64(__m128i __V)
 static __inline__ __m256i __DEFAULT_FN_ATTRS
 _mm256_cvtepu8_epi16(__m128i __V)
 {
-  typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
   return (__m256i)__builtin_convertvector((__v16qu)__V, __v16hi);
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
 _mm256_cvtepu8_epi32(__m128i __V)
 {
-  typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
   return 
(__m256i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, 
(__v16qu)__V, 0, 1, 2, 3, 4, 5, 6, 7), __v8si);
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
 _mm256_cvtepu8_epi64(__m128i __V)
 {
-  typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
   return 
(__m256i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, 
(__v16qu)__V, 0, 1, 2, 3), __v4di);
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
 _mm256_cvtepu16_epi32(__m128i __V)
 {
-  typedef unsigned short __v8hu __attribute__((__vector_size__(16)));
   return (__m256i)__builtin_convertvector((__v8hu)__V, __v8si);
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
 _mm256_cvtepu16_epi64(__m128i __V)
 {
-  typedef unsigned short __v8hu __attribute__((__vector_size__(16)));
   return (__m256i)__builtin_convertvector(__builtin_shufflevector((__v8hu)__V, 
(__v8hu)__V, 0, 1, 2, 3), __v4di);
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
 _mm256_cvtepu32_epi64(__m128i __V)
 {
-  typedef unsigned int __v4su __attribute__((__vector_size__(16)));
   return (__m256i)__builtin_convertvector((__v4su)__V, __v4di);
 }
 

Modified: cfe/trunk/lib/Headers/emmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?rev=271187&r1=271186&r2=271187&view=diff
==
--- cfe/trunk/lib/Headers/emmintrin.h (original)
+++ cfe/trunk/lib/Headers/emmintrin.h Sun May 29 13:49:08 2016
@@ -35,6 +35,12 @@ typedef long long __v2di __attribute__ (
 typedef short __v8hi __attribute__((__vector_size__(16)));
 typedef char __v16qi __attribute__((__vector_size__(16)));
 
+/* Unsigned types */
+typedef unsigned long long __v2du __attribute__ ((__vector_size__ (16)));
+typedef unsigned int __v4su __attribute__((__vector_size__(16)));
+typedef unsigned short __v8hu __attribute__((__vector_size__(16)));
+typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
+
 /* We need an explicitly signed variant for char. Note that this shouldn't
  * appear in the interface though. */
 typedef signed char __v16qs __attribute__((__vector_size__(16)));

Modified: cfe/trunk/lib/Headers/smmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/smmintrin.h?rev=271187&r1=271186&r2=271187&view=diff
==
--- cfe/trunk/lib/Headers/smmintrin.h (original)
+++ cfe/trunk/lib/Headers/smmintrin.h Sun May 29 13:49:08 2016
@@ -324,42 +324,36 @@ _mm_cvtepi32_epi64(__m128i __V)
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_cvtepu8_epi16(__m128i __V)
 {
-  typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
   return 
(__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, 
(__v16qu)__V, 0, 1, 2, 3, 4, 5, 6, 7), __v8hi);
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_cvtepu8_epi32(__m128i __V)
 {
-  typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
   return 
(__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, 
(__v16qu)__V, 0, 1, 2, 3), __v4si);
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_cvtepu8_epi64(__m128i __V)
 {
-  typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
   return 
(__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, 
(__v16qu)__V, 0, 1), __v2di);
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_cvtepu16_epi32(__m128i __V)
 {
-  typedef unsigned short __v8hu __attribute__((__vector_size__(16)));
   return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v8hu)__V, 
(__v8hu)__V, 0, 1, 2, 3), __v4si);
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTR

r271188 - Enable some accidentally dead tests and fix up the bitrot

2016-05-29 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Sun May 29 14:50:23 2016
New Revision: 271188

URL: http://llvm.org/viewvc/llvm-project?rev=271188&view=rev
Log:
Enable some accidentally dead tests and fix up the bitrot

Problem found by Nico, originally committed by me in r213213. The .test
prefix wasn't actually being run. Once that was fixed the test cases had
outdated command line syntax and IR debug info format, so updated for
those issues to get them back up and running.

Thanks Nico!

Modified:
cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp
cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test
cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test
cfe/trunk/test/lit.cfg

Modified: cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp?rev=271188&r1=271187&r2=271188&view=diff
==
--- cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp Sun May 29 
14:50:23 2016
@@ -1,5 +1,6 @@
 
-// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: 
"PR16214",{{.*}} line: [[@LINE+1]],{{.*}} isDefinition: true
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "PR16214",{{.*}} 
line: [[@LINE+2]],{{.*}}
+// CHECK-NOT: DIFlagFwdDecl
 struct PR16214 {
   int i;
 };
@@ -10,7 +11,8 @@ bar *a;
 bar b;
 
 namespace PR14467 {
-// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "foo",{{.*}} 
line: [[@LINE+1]],{{.*}} isDefinition: true
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo",{{.*}} 
line: [[@LINE+2]],{{.*}}
+// CHECK-NOT: DIFlagFwdDecl
 struct foo {
 };
 
@@ -21,7 +23,7 @@ foo *bar(foo *a) {
 }
 
 namespace test1 {
-// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "foo",{{.*}} 
line: [[@LINE+1]],{{.*}} isDefinition: true
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo",{{.*}} 
line: [[@LINE+1]],{{.*}} flags: DIFlagFwdDecl
 struct foo {
 };
 
@@ -35,7 +37,8 @@ namespace test2 {
 // FIXME: if we were a bit fancier, we could realize that the 'foo' type is 
only
 // required because of the 'bar' type which is not required at all (or might
 // only be required to be declared)
-// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "foo",{{.*}} 
line: [[@LINE+1]],{{.*}} isDefinition: true
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo",{{.*}} 
line: [[@LINE+2]],{{.*}}
+// CHECK-NOT: DIFlagFwdDecl
 struct foo {
 };
 

Modified: cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test?rev=271188&r1=271187&r2=271188&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test Sun May 29 
14:50:23 2016
@@ -1,2 +1,2 @@
-RUN: %clang_cc1 -emit-llvm -fno-standalone-debug -g -o - -load 
%llvmshlibdir/PrintFunctionNames%pluginext -add-plugin print-function-names 
%S/Inputs/debug-info-class-limited.cpp 2>&1 | FileCheck 
%S/Inputs/debug-info-class-limited.cpp
+RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -o - -load 
%llvmshlibdir/PrintFunctionNames%pluginext -add-plugin print-function-names 
%S/Inputs/debug-info-class-limited.cpp 2>&1 | FileCheck 
%S/Inputs/debug-info-class-limited.cpp
 REQUIRES: plugins, examples

Modified: cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test?rev=271188&r1=271187&r2=271188&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test Sun May 29 14:50:23 
2016
@@ -1 +1 @@
-RUN: %clang_cc1 -emit-llvm -fno-standalone-debug -g 
%S/Inputs/debug-info-class-limited.cpp -o - | FileCheck 
%S/Inputs/debug-info-class-limited.cpp
+RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited 
%S/Inputs/debug-info-class-limited.cpp -o - | FileCheck 
%S/Inputs/debug-info-class-limited.cpp

Modified: cfe/trunk/test/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=271188&r1=271187&r2=271188&view=diff
==
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Sun May 29 14:50:23 2016
@@ -44,7 +44,7 @@ else:
 config.test_format = lit.formats.ShTest(execute_external)
 
 # suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', 
'.modulemap']
+config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.l

Re: r213213 - DebugInfo: Forward HandleTagDeclRequiredDefinition through MultiplexConsumer to fix debug info emission in the presence of plugins.

2016-05-29 Thread David Blaikie via cfe-commits
Thanks for the catch!

Fixed in r271188

On Wed, May 25, 2016 at 10:28 AM, Nico Weber  wrote:

> Zombie review comment: ".test" isn't part of
> test/lit.cfg::config.suffixes, so the two .test files added in this change
> never run unless you explicitly run them (e.g. with `bin/llvm-lit
> ../llvm-rw/tools/clang/test/CodeGenCXX/*.test`).
> CodeGenCXX/debug-info-class-limited.test fails when I run it like that.
>
> (resending with cfe-commits address changed to new address)
>
> On Wed, Jul 16, 2014 at 7:52 PM, David Blaikie  wrote:
>
>> Author: dblaikie
>> Date: Wed Jul 16 18:52:46 2014
>> New Revision: 213213
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=213213&view=rev
>> Log:
>> DebugInfo: Forward HandleTagDeclRequiredDefinition through
>> MultiplexConsumer to fix debug info emission in the presence of plugins.
>>
>> When plugins are used the Multiplex(AST)Consumer is employed to dispatch
>> to both the plugin ASTConsumers and the IRGen ASTConsumer. It wasn't
>> dispatching a critical call for debug info, resulting in plugin users
>> having a negative debugging experience.
>>
>> While I'm here, forward a bunch of other missing calls through the
>> consumer that seem like they should be there.
>>
>> To test this, use the example plugin (requires plugins and examples) and
>> split the test case up so that the plugin testing can be done under that
>> requirement while the non-plugin testing will execute even in builds
>> that don't include plugin support or examples.
>>
>> Added:
>> cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp
>>   - copied, changed from r213212,
>> cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp
>> cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test
>> cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test
>> Removed:
>> cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp
>> Modified:
>> cfe/trunk/include/clang/Frontend/MultiplexConsumer.h
>> cfe/trunk/lib/Frontend/MultiplexConsumer.cpp
>>
>> Modified: cfe/trunk/include/clang/Frontend/MultiplexConsumer.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/MultiplexConsumer.h?rev=213213&r1=213212&r2=213213&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Frontend/MultiplexConsumer.h (original)
>> +++ cfe/trunk/include/clang/Frontend/MultiplexConsumer.h Wed Jul 16
>> 18:52:46 2014
>> @@ -40,8 +40,14 @@ public:
>>void HandleInterestingDecl(DeclGroupRef D) override;
>>void HandleTranslationUnit(ASTContext &Ctx) override;
>>void HandleTagDeclDefinition(TagDecl *D) override;
>> +  void HandleTagDeclRequiredDefinition(const TagDecl *D) override;
>>void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) override;
>>void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override;
>> +  void HandleImplicitImportDecl(ImportDecl *D) override;
>> +  void HandleLinkerOptionPragma(llvm::StringRef Opts) override;
>> +  void HandleDetectMismatch(llvm::StringRef Name,
>> +llvm::StringRef Value) override;
>> +  void HandleDependentLibrary(llvm::StringRef Lib) override;
>>void CompleteTentativeDefinition(VarDecl *D) override;
>>void HandleVTable(CXXRecordDecl *RD, bool DefinitionRequired) override;
>>ASTMutationListener *GetASTMutationListener() override;
>>
>> Modified: cfe/trunk/lib/Frontend/MultiplexConsumer.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/MultiplexConsumer.cpp?rev=213213&r1=213212&r2=213213&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Frontend/MultiplexConsumer.cpp (original)
>> +++ cfe/trunk/lib/Frontend/MultiplexConsumer.cpp Wed Jul 16 18:52:46 2014
>> @@ -251,6 +251,11 @@ void MultiplexConsumer::HandleTagDeclDef
>>  Consumers[i]->HandleTagDeclDefinition(D);
>>  }
>>
>> +void MultiplexConsumer::HandleTagDeclRequiredDefinition(const TagDecl
>> *D) {
>> +  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
>> +Consumers[i]->HandleTagDeclRequiredDefinition(D);
>> +}
>> +
>>  void
>> MultiplexConsumer::HandleCXXImplicitFunctionInstantiation(FunctionDecl *D){
>>for (size_t i = 0, e = Consumers.size(); i != e; ++i)
>>  Consumers[i]->HandleCXXImplicitFunctionInstantiation(D);
>> @@ -261,6 +266,26 @@ void MultiplexConsumer::HandleTopLevelDe
>>  Consumers[i]->HandleTopLevelDeclInObjCContainer(D);
>>  }
>>
>> +void MultiplexConsumer::HandleImplicitImportDecl(ImportDecl *D) {
>> +  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
>> +Consumers[i]->HandleImplicitImportDecl(D);
>> +}
>> +
>> +void MultiplexConsumer::HandleLinkerOptionPragma(llvm::StringRef Opts) {
>> +  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
>> +Consumers[i]->HandleLinkerOptionPragma(Opts);
>> +}
>> +
>> +void MultiplexConsumer::HandleDetectMismatch(llvm::StringRef Name,
>> llvm::StringRef Value) {
>> +

[PATCH] D20782: [AVX512] Emit generic masked store intrinsics directly from clang instead of using x86 specific intrinsics.

2016-05-29 Thread Craig Topper via cfe-commits
craig.topper created this revision.
craig.topper added reviewers: delena, RKSimon, AsafBadouh, igorb, m_zuckerman.
craig.topper added a subscriber: cfe-commits.

This will allow us to remove the x86 specific intrinsics from the backend.

http://reviews.llvm.org/D20782

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/avx512bw-builtins.c
  test/CodeGen/avx512f-builtins.c
  test/CodeGen/avx512vl-builtins.c
  test/CodeGen/avx512vlbw-builtins.c

Index: test/CodeGen/avx512vlbw-builtins.c
===
--- test/CodeGen/avx512vlbw-builtins.c
+++ test/CodeGen/avx512vlbw-builtins.c
@@ -2055,25 +2055,25 @@
 
 void test_mm_mask_storeu_epi16(void *__P, __mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_storeu_epi16
-  // CHECK: @llvm.x86.avx512.mask.storeu.w.128
+  // CHECK: @llvm.masked.store.v8i16(<8 x i16> %{{.*}}, <8 x i16>* %{{.*}}, i32 1, <8 x i1> %{{.*}})
   return _mm_mask_storeu_epi16(__P, __U, __A); 
 }
 
 void test_mm256_mask_storeu_epi16(void *__P, __mmask16 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_mask_storeu_epi16
-  // CHECK: @llvm.x86.avx512.mask.storeu.w.256
+  // CHECK: @llvm.masked.store.v16i16(<16 x i16> %{{.*}}, <16 x i16>* %{{.*}}, i32 1, <16 x i1> %{{.*}})
   return _mm256_mask_storeu_epi16(__P, __U, __A); 
 }
 
 void test_mm_mask_storeu_epi8(void *__P, __mmask16 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_storeu_epi8
-  // CHECK: @llvm.x86.avx512.mask.storeu.b.128
+  // CHECK: @llvm.masked.store.v16i8(<16 x i8> %{{.*}}, <16 x i8>* %{{.*}}, i32 1, <16 x i1> %{{.*}})
   return _mm_mask_storeu_epi8(__P, __U, __A); 
 }
 
 void test_mm256_mask_storeu_epi8(void *__P, __mmask32 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_mask_storeu_epi8
-  // CHECK: @llvm.x86.avx512.mask.storeu.b.256
+  // CHECK: @llvm.masked.store.v32i8(<32 x i8> %{{.*}}, <32 x i8>* %{{.*}}, i32 1, <32 x i1> %{{.*}})
   return _mm256_mask_storeu_epi8(__P, __U, __A); 
 }
 __mmask16 test_mm_test_epi8_mask(__m128i __A, __m128i __B) {
Index: test/CodeGen/avx512vl-builtins.c
===
--- test/CodeGen/avx512vl-builtins.c
+++ test/CodeGen/avx512vl-builtins.c
@@ -3935,13 +3935,13 @@
 
 void test_mm_mask_store_epi32(void *__P, __mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_store_epi32
-  // CHECK: @llvm.x86.avx512.mask.store.d.128
+  // CHECK: @llvm.masked.store.v4i32(<4 x i32> %{{.*}}, <4 x i32>* %{{.}}, i32 16, <4 x i1> %{{.*}})
   return _mm_mask_store_epi32(__P, __U, __A); 
 }
 
 void test_mm256_mask_store_epi32(void *__P, __mmask8 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_mask_store_epi32
-  // CHECK: @llvm.x86.avx512.mask.store.d.256
+  // CHECK: @llvm.masked.store.v8i32(<8 x i32> %{{.*}}, <8 x i32>* %{{.}}, i32 32, <8 x i1> %{{.*}})
   return _mm256_mask_store_epi32(__P, __U, __A); 
 }
 
@@ -4043,13 +4043,13 @@
 
 void test_mm_mask_store_epi64(void *__P, __mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_store_epi64
-  // CHECK: @llvm.x86.avx512.mask.store.q.128
+  // CHECK: @llvm.masked.store.v2i64(<2 x i64> %{{.*}}, <2 x i64>* %{{.*}}, i32 16, <2 x i1> %{{.*}})
   return _mm_mask_store_epi64(__P, __U, __A); 
 }
 
 void test_mm256_mask_store_epi64(void *__P, __mmask8 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_mask_store_epi64
-  // CHECK: @llvm.x86.avx512.mask.store.q.256
+  // CHECK: @llvm.masked.store.v4i64(<4 x i64> %{{.*}}, <4 x i64>* %{{.*}}, i32 32, <4 x i1> %{{.*}})
   return _mm256_mask_store_epi64(__P, __U, __A); 
 }
 
@@ -4343,73 +4343,73 @@
 
 void test_mm_mask_store_pd(void *__P, __mmask8 __U, __m128d __A) {
   // CHECK-LABEL: @test_mm_mask_store_pd
-  // CHECK: @llvm.x86.avx512.mask.store.pd.128
+  // CHECK: @llvm.masked.store.v2f64(<2 x double> %{{.*}}, <2 x double>* %{{.*}}, i32 16, <2 x i1> %{{.*}})
   return _mm_mask_store_pd(__P, __U, __A); 
 }
 
 void test_mm256_mask_store_pd(void *__P, __mmask8 __U, __m256d __A) {
   // CHECK-LABEL: @test_mm256_mask_store_pd
-  // CHECK: @llvm.x86.avx512.mask.store.pd.256
+  // CHECK: @llvm.masked.store.v4f64(<4 x double> %{{.*}}, <4 x double>* %{{.*}}, i32 32, <4 x i1> %{{.*}})
   return _mm256_mask_store_pd(__P, __U, __A); 
 }
 
 void test_mm_mask_store_ps(void *__P, __mmask8 __U, __m128 __A) {
   // CHECK-LABEL: @test_mm_mask_store_ps
-  // CHECK: @llvm.x86.avx512.mask.store.ps.128
+  // CHECK: @llvm.masked.store.v4f32(<4 x float> %{{.*}}, <4 x float>* %{{.*}}, i32 16, <4 x i1> %{{.*}})
   return _mm_mask_store_ps(__P, __U, __A); 
 }
 
 void test_mm256_mask_store_ps(void *__P, __mmask8 __U, __m256 __A) {
   // CHECK-LABEL: @test_mm256_mask_store_ps
-  // CHECK: @llvm.x86.avx512.mask.store.ps.256
+  // CHECK: @llvm.masked.store.v8f32(<8 x float> %{{.*}}, <8 x float>* %{{.*}}, i32 32, <8 x i1> %{{.*}})
   return _mm256_mask_store_ps(__P, __U, __A); 
 }
 
 void test_mm_mask_storeu_epi64(void *__P, __mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_storeu_epi64
-  // CHECK: @llvm.

r271191 - clang-format: Fix segfault introduced by allowing wraps after comments.

2016-05-29 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Sun May 29 17:07:22 2016
New Revision: 271191

URL: http://llvm.org/viewvc/llvm-project?rev=271191&view=rev
Log:
clang-format: Fix segfault introduced by allowing wraps after comments.

Modified:
cfe/trunk/lib/Format/ContinuationIndenter.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=271191&r1=271190&r2=271191&view=diff
==
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Sun May 29 17:07:22 2016
@@ -478,7 +478,8 @@ unsigned ContinuationIndenter::addTokenO
   //
   // is common and should be formatted like a free-standing function.
   if (Style.Language != FormatStyle::LK_JavaScript ||
-  Current.NestingLevel != 0 || !PreviousNonComment->is(tok::equal) ||
+  Current.NestingLevel != 0 || !PreviousNonComment ||
+  !PreviousNonComment->is(tok::equal) ||
   !Current.isOneOf(Keywords.kw_async, Keywords.kw_function))
 State.Stack.back().NestedBlockIndent = State.Column;
 

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=271191&r1=271190&r2=271191&view=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Sun May 29 17:07:22 2016
@@ -62,6 +62,11 @@ protected:
   }
 };
 
+TEST_F(FormatTestJS, BlockComments) {
+  verifyFormat("/* a */ aaa(\n"
+   "aaa);");
+}
+
 TEST_F(FormatTestJS, UnderstandsJavaScriptOperators) {
   verifyFormat("a == = b;");
   verifyFormat("a != = b;");


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


Re: [PATCH] D20168: [CodeGen] Handle structs directly in AMDGPUABIInfo

2016-05-29 Thread Vedran Miletić via cfe-commits
rivanvx updated this revision to Diff 58920.
rivanvx added a comment.

Updated patch. Single element structs are coerced to its element, and there are 
tests for structs of different sizes, structs of arrays, structs containing 
structs. Arrays of structs are disallowed by clang in kernels.
Non-kernel functions are not specifically handled, should they be? How to 
decide?


http://reviews.llvm.org/D20168

Files:
  lib/CodeGen/TargetInfo.cpp
  test/CodeGenOpenCL/amdgpu-abi-struct-coerce.cl

Index: test/CodeGenOpenCL/amdgpu-abi-struct-coerce.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/amdgpu-abi-struct-coerce.cl
@@ -0,0 +1,59 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK-NOT: %struct.single_element_struct_arg = type { i32 }
+typedef struct single_element_struct_arg
+{
+int i;
+} single_element_struct_arg_t;
+
+// CHECK: %struct.struct_arg = type { i32, float, i32 }
+typedef struct struct_arg
+{
+int i1;
+float f;
+int i2;
+} struct_arg_t;
+
+// CHECK: %struct.struct_of_arrays_arg = type { [2 x i32], float, [4 x i32], [3 x float], i32 }
+typedef struct struct_of_arrays_arg
+{
+int i1[2];
+float f1;
+int i2[4];
+float f2[3];
+int i3;
+} struct_of_arrays_arg_t;
+
+// CHECK: %struct.struct_of_structs_arg = type { i32, float, %struct.struct_arg, i32 }
+typedef struct struct_of_structs_arg
+{
+int i1;
+float f1;
+struct_arg_t s1;
+int i2;
+} struct_of_structs_arg_t;
+
+// CHECK-LABEL: @test_single_element_struct_arg
+// CHECK: i32 %arg1.coerce
+kernel void test_single_element_struct_arg(single_element_struct_arg_t arg1)
+{
+}
+
+// CHECK-LABEL: @test_struct_arg
+// CHECK: %struct.struct_arg %arg1.coerce
+kernel void test_struct_arg(struct_arg_t arg1)
+{
+}
+
+// CHECK-LABEL: @test_struct_of_arrays_arg
+// CHECK: %struct.struct_of_arrays_arg %arg1.coerce
+kernel void test_struct_of_arrays_arg(struct_of_arrays_arg_t arg1)
+{
+}
+
+// CHECK-LABEL: @test_struct_of_structs_arg
+// CHECK: %struct.struct_of_structs_arg %arg1.coerce
+kernel void test_struct_of_structs_arg(struct_of_structs_arg_t arg1)
+{
+}
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -6808,10 +6808,45 @@
 
 namespace {
 
+class AMDGPUABIInfo final : public DefaultABIInfo {
+public:
+  explicit AMDGPUABIInfo(CodeGen::CodeGenTypes &CGT) : DefaultABIInfo(CGT) {}
+
+private:
+  ABIArgInfo classifyArgumentType(QualType Ty) const;
+
+  void computeInfo(CGFunctionInfo &FI) const override;
+};
+
+void AMDGPUABIInfo::computeInfo(CGFunctionInfo &FI) const {
+  if (!getCXXABI().classifyReturnType(FI))
+FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+
+  for (auto &Arg : FI.arguments())
+Arg.info = classifyArgumentType(Arg.type);
+}
+
+/// \brief Classify argument of given type \p Ty.
+ABIArgInfo AMDGPUABIInfo::classifyArgumentType(QualType Ty) const {
+  llvm::StructType *StrTy = dyn_cast(CGT.ConvertType(Ty));
+  if (!StrTy) {
+return DefaultABIInfo::classifyArgumentType(Ty);
+  }
+  else if (StrTy->getNumElements() == 1) {
+// Coerce single element structs to its element.
+return ABIArgInfo::getDirect();
+  }
+
+  // If we set CanBeFlattened to true, CodeGen will expand the struct to its
+  // individual elements, which confuses the Clover OpenCL backend; therefore we
+  // have to set it to false here. Other args of getDirect() are just defaults.
+  return ABIArgInfo::getDirect(nullptr, 0, nullptr, false);
+}
+
 class AMDGPUTargetCodeGenInfo : public TargetCodeGenInfo {
 public:
   AMDGPUTargetCodeGenInfo(CodeGenTypes &CGT)
-: TargetCodeGenInfo(new DefaultABIInfo(CGT)) {}
+: TargetCodeGenInfo(new AMDGPUABIInfo(CGT)) {}
   void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
CodeGen::CodeGenModule &M) const override;
 };
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20689: [clang-tidy] Suspicious Call Argument checker

2016-05-29 Thread Varju Janos via cfe-commits
varjujan added a comment.

Yes, I did. The results from running the checker on LLVM are in the attached 
file. Sadly, I could'nt find any real mistakes but as I wrote in the summary, 
false positives can still indicate bad naming convention for some variables.

F1991684: result.txt 


http://reviews.llvm.org/D20689



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


[PATCH] D20784: [libcxx][libcxxabi] Decouple no-exceptions libcpp variant from cxa_exception.cpp and cxa_personality.cpp of libcxxabi

2016-05-29 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added reviewers: EricWF, mclow.lists.
rmaprath added a subscriber: cfe-commits.

This is a pre-requisite to address a review comment on D20677; The 
`no-exceptions` variant of libcxxabi should not be allowed to be linked against 
code that requires exceptions.

In order to do this, we need to rip off some exceptions-related symbols from 
the no-exceptions libcxxabi build. We can get rid of both `cxa_exception.cpp` 
and `cxa_personality.cpp` to meet the said requirement, but this needs a small 
surgery to the `no-exception` libcpp variant; we must `#ifdef` out the 
dependency on these two libcxxabi sources from the `exception.cpp` of libcxx.

http://reviews.llvm.org/D20784

Files:
  src/exception.cpp

Index: src/exception.cpp
===
--- src/exception.cpp
+++ src/exception.cpp
@@ -106,6 +106,9 @@
 
 int uncaught_exceptions() _NOEXCEPT
 {
+#ifdef _LIBCPP_NO_EXCEPTIONS
+return 0;
+#endif
 #if defined(__APPLE__) || defined(_LIBCPPABI_VERSION)
// on Darwin, there is a helper function so __cxa_get_globals is private
 # if _LIBCPPABI_VERSION > 1101
@@ -183,7 +186,9 @@
 exception_ptr::~exception_ptr() _NOEXCEPT
 {
 #if HAVE_DEPENDENT_EH_ABI
+#   ifndef _LIBCPP_NO_EXCEPTIONS
 __cxa_decrement_exception_refcount(__ptr_);
+#   endif
 #elif defined(__GLIBCXX__)
 reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
 #else
@@ -201,7 +206,9 @@
 : __ptr_(other.__ptr_)
 {
 #if HAVE_DEPENDENT_EH_ABI
+#   ifndef _LIBCPP_NO_EXCEPTIONS
 __cxa_increment_exception_refcount(__ptr_);
+#   endif
 #elif defined(__GLIBCXX__)
 new (reinterpret_cast(this)) __exception_ptr::exception_ptr(
 reinterpret_cast(other));
@@ -221,8 +228,10 @@
 #if HAVE_DEPENDENT_EH_ABI
 if (__ptr_ != other.__ptr_)
 {
+#   ifndef _LIBCPP_NO_EXCEPTIONS
 __cxa_increment_exception_refcount(other.__ptr_);
 __cxa_decrement_exception_refcount(__ptr_);
+#   endif
 __ptr_ = other.__ptr_;
 }
 return *this;
@@ -272,7 +281,9 @@
 // this whole function would be just:
 //return exception_ptr(__cxa_current_primary_exception());
 exception_ptr ptr;
+#ifndef _LIBCPP_NO_EXCEPTIONS
 ptr.__ptr_ = __cxa_current_primary_exception();
+#endif
 return ptr;
 #else
 #   if defined(_MSC_VER) && ! defined(__clang__)
@@ -291,7 +302,9 @@
 void rethrow_exception(exception_ptr p)
 {
 #if HAVE_DEPENDENT_EH_ABI
+#ifndef _LIBCPP_NO_EXCEPTIONS
 __cxa_rethrow_primary_exception(p.__ptr_);
+#endif
 // if p.__ptr_ is NULL, above returns so we terminate
 terminate();
 #elif defined(__GLIBCXX__)


Index: src/exception.cpp
===
--- src/exception.cpp
+++ src/exception.cpp
@@ -106,6 +106,9 @@
 
 int uncaught_exceptions() _NOEXCEPT
 {
+#ifdef _LIBCPP_NO_EXCEPTIONS
+return 0;
+#endif
 #if defined(__APPLE__) || defined(_LIBCPPABI_VERSION)
// on Darwin, there is a helper function so __cxa_get_globals is private
 # if _LIBCPPABI_VERSION > 1101
@@ -183,7 +186,9 @@
 exception_ptr::~exception_ptr() _NOEXCEPT
 {
 #if HAVE_DEPENDENT_EH_ABI
+#   ifndef _LIBCPP_NO_EXCEPTIONS
 __cxa_decrement_exception_refcount(__ptr_);
+#   endif
 #elif defined(__GLIBCXX__)
 reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
 #else
@@ -201,7 +206,9 @@
 : __ptr_(other.__ptr_)
 {
 #if HAVE_DEPENDENT_EH_ABI
+#   ifndef _LIBCPP_NO_EXCEPTIONS
 __cxa_increment_exception_refcount(__ptr_);
+#   endif
 #elif defined(__GLIBCXX__)
 new (reinterpret_cast(this)) __exception_ptr::exception_ptr(
 reinterpret_cast(other));
@@ -221,8 +228,10 @@
 #if HAVE_DEPENDENT_EH_ABI
 if (__ptr_ != other.__ptr_)
 {
+#   ifndef _LIBCPP_NO_EXCEPTIONS
 __cxa_increment_exception_refcount(other.__ptr_);
 __cxa_decrement_exception_refcount(__ptr_);
+#   endif
 __ptr_ = other.__ptr_;
 }
 return *this;
@@ -272,7 +281,9 @@
 // this whole function would be just:
 //return exception_ptr(__cxa_current_primary_exception());
 exception_ptr ptr;
+#ifndef _LIBCPP_NO_EXCEPTIONS
 ptr.__ptr_ = __cxa_current_primary_exception();
+#endif
 return ptr;
 #else
 #   if defined(_MSC_VER) && ! defined(__clang__)
@@ -291,7 +302,9 @@
 void rethrow_exception(exception_ptr p)
 {
 #if HAVE_DEPENDENT_EH_ABI
+#ifndef _LIBCPP_NO_EXCEPTIONS
 __cxa_rethrow_primary_exception(p.__ptr_);
+#endif
 // if p.__ptr_ is NULL, above returns so we terminate
 terminate();
 #elif defined(__GLIBCXX__)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-29 Thread Asiri Rathnayake via cfe-commits
rmaprath updated this revision to Diff 58927.
rmaprath added a comment.

OK, managed to solve this problem by removing `cxa_exception.cpp` and 
`cxa_personality.cpp` from the no-exceptions libcxxabi build.

In order to do this, a small patch was needed for `exception.cpp` of libcxx: 
http://reviews.llvm.org/D20784

@EricWF, @mclow.lists: WDYT?

Thanks.

/ Asiri


http://reviews.llvm.org/D20677

Files:
  CMakeLists.txt
  src/CMakeLists.txt
  src/cxa_aux_runtime.cpp
  src/cxa_handlers.cpp
  src/cxa_new_delete.cpp
  test/CMakeLists.txt
  test/backtrace_test.pass.cpp
  test/catch_array_01.pass.cpp
  test/catch_array_02.pass.cpp
  test/catch_class_01.pass.cpp
  test/catch_class_02.pass.cpp
  test/catch_class_03.pass.cpp
  test/catch_class_04.pass.cpp
  test/catch_const_pointer_nullptr.pass.cpp
  test/catch_function_01.pass.cpp
  test/catch_function_02.pass.cpp
  test/catch_in_noexcept.pass.cpp
  test/catch_member_data_pointer_01.pass.cpp
  test/catch_member_function_pointer_01.pass.cpp
  test/catch_member_pointer_nullptr.pass.cpp
  test/catch_multi_level_pointer.pass.cpp
  test/catch_pointer_nullptr.pass.cpp
  test/catch_pointer_reference.pass.cpp
  test/catch_ptr.pass.cpp
  test/catch_ptr_02.pass.cpp
  test/incomplete_type.sh.cpp
  test/inherited_exception.pass.cpp
  test/libcxxabi/test/config.py
  test/lit.site.cfg.in
  test/test_aux_runtime.pass.cpp
  test/test_aux_runtime_op_array_new.pass.cpp
  test/test_guard.pass.cpp
  test/test_vector1.pass.cpp
  test/test_vector2.pass.cpp
  test/test_vector3.pass.cpp
  test/uncaught_exceptions.pass.cpp
  test/unwind_01.pass.cpp
  test/unwind_02.pass.cpp
  test/unwind_03.pass.cpp
  test/unwind_04.pass.cpp
  test/unwind_05.pass.cpp
  test/unwind_06.pass.cpp

Index: test/unwind_06.pass.cpp
===
--- test/unwind_06.pass.cpp
+++ test/unwind_06.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_05.pass.cpp
===
--- test/unwind_05.pass.cpp
+++ test/unwind_05.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_04.pass.cpp
===
--- test/unwind_04.pass.cpp
+++ test/unwind_04.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_03.pass.cpp
===
--- test/unwind_03.pass.cpp
+++ test/unwind_03.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_02.pass.cpp
===
--- test/unwind_02.pass.cpp
+++ test/unwind_02.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 
 struct A
Index: test/unwind_01.pass.cpp
===
--- test/unwind_01.pass.cpp
+++ test/unwind_01.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 
 struct A
Index: test/uncaught_exceptions.pass.cpp
===
--- test/uncaught_exceptions.pass.cpp
+++ test/uncaught_exceptions.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/test_vector3.pass.cpp
===
--- test/test_vector3.pass.cpp
+++ test/test_vector3.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include "cxxabi.h"
 
 #include 
Index: test/test_vector2.pass.cpp
===
--- test/test_vector2.pass.cpp
+++ test/test_vector2.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include "cxxabi.h"
 
 #include 
Index: test/test_vector1.pass.cpp
===
--- test/test_vector1.pass.cpp
+++ test/test_vector1.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===-

Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-29 Thread Asiri Rathnayake via cfe-commits
rmaprath added inline comments.


Comment at: CMakeLists.txt:111
@@ -110,2 +110,3 @@
 # Define options.
+option(LIBCXXABI_ENABLE_EXCEPTIONS "Use exceptions." OFF)
 option(LIBCXXABI_ENABLE_ASSERTIONS "Enable assertions independent of build 
mode." ON)

My bad, this should be ON by default (leftover from testing).


http://reviews.llvm.org/D20677



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


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-29 Thread Asiri Rathnayake via cfe-commits
rmaprath updated this revision to Diff 58929.
rmaprath added a comment.

Fixed a few typos.


http://reviews.llvm.org/D20677

Files:
  CMakeLists.txt
  src/CMakeLists.txt
  src/cxa_aux_runtime.cpp
  src/cxa_handlers.cpp
  src/cxa_new_delete.cpp
  test/CMakeLists.txt
  test/backtrace_test.pass.cpp
  test/catch_array_01.pass.cpp
  test/catch_array_02.pass.cpp
  test/catch_class_01.pass.cpp
  test/catch_class_02.pass.cpp
  test/catch_class_03.pass.cpp
  test/catch_class_04.pass.cpp
  test/catch_const_pointer_nullptr.pass.cpp
  test/catch_function_01.pass.cpp
  test/catch_function_02.pass.cpp
  test/catch_in_noexcept.pass.cpp
  test/catch_member_data_pointer_01.pass.cpp
  test/catch_member_function_pointer_01.pass.cpp
  test/catch_member_pointer_nullptr.pass.cpp
  test/catch_multi_level_pointer.pass.cpp
  test/catch_pointer_nullptr.pass.cpp
  test/catch_pointer_reference.pass.cpp
  test/catch_ptr.pass.cpp
  test/catch_ptr_02.pass.cpp
  test/incomplete_type.sh.cpp
  test/inherited_exception.pass.cpp
  test/libcxxabi/test/config.py
  test/lit.site.cfg.in
  test/test_aux_runtime.pass.cpp
  test/test_aux_runtime_op_array_new.pass.cpp
  test/test_guard.pass.cpp
  test/test_vector1.pass.cpp
  test/test_vector2.pass.cpp
  test/test_vector3.pass.cpp
  test/uncaught_exceptions.pass.cpp
  test/unwind_01.pass.cpp
  test/unwind_02.pass.cpp
  test/unwind_03.pass.cpp
  test/unwind_04.pass.cpp
  test/unwind_05.pass.cpp
  test/unwind_06.pass.cpp

Index: test/unwind_06.pass.cpp
===
--- test/unwind_06.pass.cpp
+++ test/unwind_06.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_05.pass.cpp
===
--- test/unwind_05.pass.cpp
+++ test/unwind_05.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_04.pass.cpp
===
--- test/unwind_04.pass.cpp
+++ test/unwind_04.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_03.pass.cpp
===
--- test/unwind_03.pass.cpp
+++ test/unwind_03.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_02.pass.cpp
===
--- test/unwind_02.pass.cpp
+++ test/unwind_02.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 
 struct A
Index: test/unwind_01.pass.cpp
===
--- test/unwind_01.pass.cpp
+++ test/unwind_01.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 
 struct A
Index: test/uncaught_exceptions.pass.cpp
===
--- test/uncaught_exceptions.pass.cpp
+++ test/uncaught_exceptions.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/test_vector3.pass.cpp
===
--- test/test_vector3.pass.cpp
+++ test/test_vector3.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include "cxxabi.h"
 
 #include 
Index: test/test_vector2.pass.cpp
===
--- test/test_vector2.pass.cpp
+++ test/test_vector2.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include "cxxabi.h"
 
 #include 
Index: test/test_vector1.pass.cpp
===
--- test/test_vector1.pass.cpp
+++ test/test_vector1.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include "cxxabi.h"
 
 #include 
Index: test/test_guard.pass.cpp
===
--- test/test_guard.pass.cpp
+++ test/test_guard.pass.cpp

Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-29 Thread Asiri Rathnayake via cfe-commits
rmaprath marked an inline comment as done.
rmaprath added a comment.

http://reviews.llvm.org/D20677



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


[libcxx] r271195 - Fix bug in test allocator that incorrectly computed the allocation size

2016-05-29 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun May 29 20:31:04 2016
New Revision: 271195

URL: http://llvm.org/viewvc/llvm-project?rev=271195&view=rev
Log:
Fix bug in test allocator that incorrectly computed the allocation size

Modified:

libcxx/trunk/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_allocate_and_deallocate.pass.cpp
libcxx/trunk/test/support/test_memory_resource.hpp

Modified: 
libcxx/trunk/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_allocate_and_deallocate.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_allocate_and_deallocate.pass.cpp?rev=271195&r1=271194&r2=271195&view=diff
==
--- 
libcxx/trunk/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_allocate_and_deallocate.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_allocate_and_deallocate.pass.cpp
 Sun May 29 20:31:04 2016
@@ -34,7 +34,7 @@ void check_allocate_deallocate()
 typedef ex::resource_adaptor R1;
 const std::size_t max_align = alignof(std::max_align_t);
 
-for (std::size_t s = 0; s < 5012; ++s)
+for (std::size_t s = 1; s < 5012; ++s)
 {
 for(std::size_t align_req = 1; align_req <= (max_align * 2); align_req 
*= 2)
 {

Modified: libcxx/trunk/test/support/test_memory_resource.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_memory_resource.hpp?rev=271195&r1=271194&r2=271195&view=diff
==
--- libcxx/trunk/test/support/test_memory_resource.hpp (original)
+++ libcxx/trunk/test/support/test_memory_resource.hpp Sun May 29 20:31:04 2016
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "test_macros.h"
 
@@ -274,18 +275,18 @@ private:
 std::size_t bytes = (s + BlockSize - 1) & ~(BlockSize - 1);
 bytes += BlockSize;
 assert(bytes % BlockSize == 0);
-return bytes / BlockSize;
+return bytes;
 }
 
 static bool is_max_aligned(void* p) {
-return reinterpret_cast(p) % BlockSize == 0;
+return reinterpret_cast(p) % BlockSize == 0;
 }
 
 static bool is_min_aligned(void* p) {
 if (alignof(T) == BlockSize) {
 return is_max_aligned(p);
 } else {
-return reinterpret_cast(p) % BlockSize == alignof(T);
+return reinterpret_cast(p) % BlockSize == 
alignof(T);
 }
 }
 


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


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-05-29 Thread Xiuli PAN via cfe-commits
pxli168 accepted this revision.
pxli168 added a comment.
This revision is now accepted and ready to land.

LGTM!
Thanks!


http://reviews.llvm.org/D20444



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


Re: [PATCH] D17438: [OpenCL] Add Sema checks for atomics and implicit declaration

2016-05-29 Thread Xiuli PAN via cfe-commits
pxli168 added a comment.

Yes, I found although the khronos have make a clarify with implicit 
declarations but they sames to be useful with some program link. And I found 
some test case about link could not pass by this reason.
But how should we handle the new added spec?


http://reviews.llvm.org/D17438



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


[PATCH] D20786: Fix undefined behavior in __tree

2016-05-29 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added a reviewer: mclow.lists.
EricWF added a subscriber: cfe-commits.

This patch attempts to fix the undefined behavior in __tree by changing the 
node pointer types used throughout. The pointer types are changed for raw 
pointers in the current ABI and for fancy pointers in ABI V2 (since the fancy 
pointer types may not be ABI compatible).

The UB in `__tree` arises because tree downcasts the embedded end node and then 
deferences that pointer. Currently there are 3 node types in __tree.

* `__tree_end_node` which contains the `__left_` pointer. This node is embedded 
within the container.
* `__tree_node_base` which contains `__right_`, `__parent_` and `__is_black`. 
This node is used throughout the tree rebalancing algorithms.
* `__tree_node` which contains `__value_`.

Currently both `__tree` stores the start of the tree, `__begin_node_`, as a 
pointer to a `__tree_node`. Additionally the iterators store their position as 
a pointer to a `__tree_node`. In both of these cases the pointee can be the end 
node. This is fixed by changing them to store `__tree_end_node` pointers 
instead.

To make this change I introduced an `__iter_pointer` typedef which is defined 
to be a pointer to either `__tree_end_node` in the new ABI or `__tree_node` in 
the current one.
Both `__tree::__begin_node_` and iterator pointers are now stored as 
`__iter_pointers`.

The other situation where `__tree_end_node` is stored as a pointer to the wrong 
type is as the `__parent_` pointer within another node. Currently `__left_`, 
`__right_`, and `__parent_` are all `__tree_base_node` pointers. Since the end 
node will only be stored in `__parent_` the fix is to change `__parent_` to be 
a pointer to `__tree_end_node`.

To make this change I introduced a `__parent_pointer` typedef which is defined 
to be a pointer to either `__tree_node_base` in the new ABI or `__tree_node` in 
the current one.

Note that in the new ABI `__iter_pointer` and `__parent_pointer` are the same 
type (but not the old one). The confusion between these two types is 
unfortunate but it was the best solution I could come up with that maintains 
the ABI.

The typedef changes force a ton of explicit type casts to correct pointer types 
and to make current code compatible with both the old and new pointer typedefs. 
This is the bulk of the change and it's really messy. Unfortunately I don't 
know how to avoid it.

Please let me know what you think.





http://reviews.llvm.org/D20786

Files:
  include/__config
  include/__tree

Index: include/__tree
===
--- include/__tree
+++ include/__tree
@@ -165,21 +165,33 @@
 if (__x->__right_ != nullptr)
 return __tree_min(__x->__right_);
 while (!__tree_is_left_child(__x))
-__x = __x->__parent_;
-return __x->__parent_;
+__x = __x->__parent_unsafe();
+return __x->__parent_unsafe();
+}
+
+template 
+_NodeBasePtr
+__tree_next_iter(_NodePtr __x) _NOEXCEPT
+{
+if (__x->__right_ != nullptr)
+return static_cast<_NodeBasePtr>(__tree_min(__x->__right_));
+while (!__tree_is_left_child(__x))
+__x = __x->__parent_unsafe();
+return __x->__parent_; // decltype(__parent_) == _NodeBasePtr
 }
 
 // Returns:  pointer to the previous in-order node before __x.
 // Precondition:  __x != nullptr.
-template 
+template 
 _NodePtr
-__tree_prev(_NodePtr __x) _NOEXCEPT
+__tree_prev_iter(_NodeBasePtr __x) _NOEXCEPT
 {
 if (__x->__left_ != nullptr)
 return __tree_max(__x->__left_);
-while (__tree_is_left_child(__x))
-__x = __x->__parent_;
-return __x->__parent_;
+_NodePtr __xx = static_cast<_NodePtr>(__x);
+while (__tree_is_left_child(__xx))
+__xx = __xx->__parent_unsafe();
+return __xx->__parent_unsafe();
 }
 
 // Returns:  pointer to a node which has no children
@@ -215,14 +227,14 @@
 _NodePtr __y = __x->__right_;
 __x->__right_ = __y->__left_;
 if (__x->__right_ != nullptr)
-__x->__right_->__parent_ = __x;
+__x->__right_->__set_parent(__x);
 __y->__parent_ = __x->__parent_;
 if (__tree_is_left_child(__x))
 __x->__parent_->__left_ = __y;
 else
-__x->__parent_->__right_ = __y;
+__x->__parent_unsafe()->__right_ = __y;
 __y->__left_ = __x;
-__x->__parent_ = __y;
+__x->__set_parent(__y);
 }
 
 // Effects:  Makes __x->__left_ the subtree root with __x as its right child
@@ -235,14 +247,14 @@
 _NodePtr __y = __x->__left_;
 __x->__left_ = __y->__right_;
 if (__x->__left_ != nullptr)
-__x->__left_->__parent_ = __x;
+__x->__left_->__set_parent(__x);
 __y->__parent_ = __x->__parent_;
 if (__tree_is_left_child(__x))
 __x->__parent_->__left_ = __y;
 else
-__x->__parent_->__right_ = __y;
+__x->__parent_unsafe()->__right_ = __y;
 __y->__right_ = __x;
-__x->__parent_ = __y;
+__x->__set_parent(__y);
 

Re: [PATCH] D20786: Fix undefined behavior in __tree

2016-05-29 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 58931.
EricWF added a comment.

Fix __tree algorithm tests.


http://reviews.llvm.org/D20786

Files:
  include/__config
  include/__tree
  test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
  test/libcxx/containers/associative/tree_left_rotate.pass.cpp
  test/libcxx/containers/associative/tree_remove.pass.cpp
  test/libcxx/containers/associative/tree_right_rotate.pass.cpp

Index: test/libcxx/containers/associative/tree_right_rotate.pass.cpp
===
--- test/libcxx/containers/associative/tree_right_rotate.pass.cpp
+++ test/libcxx/containers/associative/tree_right_rotate.pass.cpp
@@ -23,6 +23,9 @@
 Node* __right_;
 Node* __parent_;
 
+Node* __parent_unsafe() const { return __parent_; }
+void __set_parent(Node* x) { __parent_ = x;}
+
 Node() : __left_(), __right_(), __parent_() {}
 };
 
Index: test/libcxx/containers/associative/tree_remove.pass.cpp
===
--- test/libcxx/containers/associative/tree_remove.pass.cpp
+++ test/libcxx/containers/associative/tree_remove.pass.cpp
@@ -24,6 +24,9 @@
 Node* __parent_;
 bool __is_black_;
 
+Node* __parent_unsafe() const { return __parent_; }
+void __set_parent(Node* x) { __parent_ = x;}
+
 Node() : __left_(), __right_(), __parent_(), __is_black_() {}
 };
 
Index: test/libcxx/containers/associative/tree_left_rotate.pass.cpp
===
--- test/libcxx/containers/associative/tree_left_rotate.pass.cpp
+++ test/libcxx/containers/associative/tree_left_rotate.pass.cpp
@@ -23,6 +23,9 @@
 Node* __right_;
 Node* __parent_;
 
+Node* __parent_unsafe() const { return __parent_; }
+void __set_parent(Node* x) { __parent_ = x;}
+
 Node() : __left_(), __right_(), __parent_() {}
 };
 
Index: test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
===
--- test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
+++ test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
@@ -24,6 +24,9 @@
 Node* __parent_;
 bool __is_black_;
 
+Node* __parent_unsafe() const { return __parent_; }
+void __set_parent(Node* x) { __parent_ = x;}
+
 Node() : __left_(), __right_(), __parent_(), __is_black_() {}
 };
 
Index: include/__tree
===
--- include/__tree
+++ include/__tree
@@ -165,21 +165,36 @@
 if (__x->__right_ != nullptr)
 return __tree_min(__x->__right_);
 while (!__tree_is_left_child(__x))
-__x = __x->__parent_;
-return __x->__parent_;
+__x = __x->__parent_unsafe();
+return __x->__parent_unsafe();
+}
+
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+_EndNodePtr
+__tree_next_iter(_NodePtr __x) _NOEXCEPT
+{
+if (__x->__right_ != nullptr)
+return static_cast<_EndNodePtr>(__tree_min(__x->__right_));
+while (!__tree_is_left_child(__x))
+__x = __x->__parent_unsafe();
+return __x->__parent_; // decltype(__parent_) == _EndNodePtr
 }
 
 // Returns:  pointer to the previous in-order node before __x.
 // Precondition:  __x != nullptr.
-template 
+// Note: __x may be the end node.
+template 
+inline _LIBCPP_INLINE_VISIBILITY
 _NodePtr
-__tree_prev(_NodePtr __x) _NOEXCEPT
+__tree_prev_iter(_EndNodePtr __x) _NOEXCEPT
 {
 if (__x->__left_ != nullptr)
 return __tree_max(__x->__left_);
-while (__tree_is_left_child(__x))
-__x = __x->__parent_;
-return __x->__parent_;
+_NodePtr __xx = static_cast<_NodePtr>(__x);
+while (__tree_is_left_child(__xx))
+__xx = __xx->__parent_unsafe();
+return __xx->__parent_unsafe();
 }
 
 // Returns:  pointer to a node which has no children
@@ -215,14 +230,14 @@
 _NodePtr __y = __x->__right_;
 __x->__right_ = __y->__left_;
 if (__x->__right_ != nullptr)
-__x->__right_->__parent_ = __x;
+__x->__right_->__set_parent(__x);
 __y->__parent_ = __x->__parent_;
 if (__tree_is_left_child(__x))
 __x->__parent_->__left_ = __y;
 else
-__x->__parent_->__right_ = __y;
+__x->__parent_unsafe()->__right_ = __y;
 __y->__left_ = __x;
-__x->__parent_ = __y;
+__x->__set_parent(__y);
 }
 
 // Effects:  Makes __x->__left_ the subtree root with __x as its right child
@@ -235,14 +250,14 @@
 _NodePtr __y = __x->__left_;
 __x->__left_ = __y->__right_;
 if (__x->__left_ != nullptr)
-__x->__left_->__parent_ = __x;
+__x->__left_->__set_parent(__x);
 __y->__parent_ = __x->__parent_;
 if (__tree_is_left_child(__x))
 __x->__parent_->__left_ = __y;
 else
-__x->__parent_->__right_ = __y;
+__x->__parent_unsafe()->__right_ = __y;
 __y->__right_ = __x;
-__x->__parent_ = __y;
+__x->__set_parent

Re: [PATCH] D20782: [AVX512] Emit generic masked store intrinsics directly from clang instead of using x86 specific intrinsics.

2016-05-29 Thread Elena Demikhovsky via cfe-commits
delena added inline comments.


Comment at: lib/CodeGen/CGBuiltin.cpp:6304
@@ +6303,3 @@
+  Indices[i] = i;
+Ops[2] = CGF.Builder.CreateShuffleVector(Ops[2], Ops[2],
+ makeArrayRef(Indices, NumElts),

What code do you receive at the end? There is no shuffle instruction in the 
architecture for mask vector.


Comment at: test/CodeGen/avx512f-builtins.c:123
@@ -122,2 +122,3 @@
   // CHECK-LABEL: @test_mm512_storeu_si512 
-  // CHECK: @llvm.x86.avx512.mask.storeu.d.512
+  // CHECK: store <16 x i32> %5, <16 x i32>* %6, align 1
+  // CHECK-NEXT: ret void

I suggest to remove %5, %6 from the test, you can put something like this:
CHECK: store <16 x i32> {{.*}}, align 1


http://reviews.llvm.org/D20782



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


Re: [PATCH] D20786: Fix undefined behavior in __tree

2016-05-29 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 58933.
EricWF added a comment.

Fix some code I broke last iteration.


http://reviews.llvm.org/D20786

Files:
  include/__config
  include/__tree
  test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
  test/libcxx/containers/associative/tree_left_rotate.pass.cpp
  test/libcxx/containers/associative/tree_remove.pass.cpp
  test/libcxx/containers/associative/tree_right_rotate.pass.cpp

Index: test/libcxx/containers/associative/tree_right_rotate.pass.cpp
===
--- test/libcxx/containers/associative/tree_right_rotate.pass.cpp
+++ test/libcxx/containers/associative/tree_right_rotate.pass.cpp
@@ -23,6 +23,9 @@
 Node* __right_;
 Node* __parent_;
 
+Node* __parent_unsafe() const { return __parent_; }
+void __set_parent(Node* x) { __parent_ = x;}
+
 Node() : __left_(), __right_(), __parent_() {}
 };
 
Index: test/libcxx/containers/associative/tree_remove.pass.cpp
===
--- test/libcxx/containers/associative/tree_remove.pass.cpp
+++ test/libcxx/containers/associative/tree_remove.pass.cpp
@@ -24,6 +24,9 @@
 Node* __parent_;
 bool __is_black_;
 
+Node* __parent_unsafe() const { return __parent_; }
+void __set_parent(Node* x) { __parent_ = x;}
+
 Node() : __left_(), __right_(), __parent_(), __is_black_() {}
 };
 
Index: test/libcxx/containers/associative/tree_left_rotate.pass.cpp
===
--- test/libcxx/containers/associative/tree_left_rotate.pass.cpp
+++ test/libcxx/containers/associative/tree_left_rotate.pass.cpp
@@ -23,6 +23,9 @@
 Node* __right_;
 Node* __parent_;
 
+Node* __parent_unsafe() const { return __parent_; }
+void __set_parent(Node* x) { __parent_ = x;}
+
 Node() : __left_(), __right_(), __parent_() {}
 };
 
Index: test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
===
--- test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
+++ test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
@@ -24,6 +24,9 @@
 Node* __parent_;
 bool __is_black_;
 
+Node* __parent_unsafe() const { return __parent_; }
+void __set_parent(Node* x) { __parent_ = x;}
+
 Node() : __left_(), __right_(), __parent_(), __is_black_() {}
 };
 
Index: include/__tree
===
--- include/__tree
+++ include/__tree
@@ -165,21 +165,36 @@
 if (__x->__right_ != nullptr)
 return __tree_min(__x->__right_);
 while (!__tree_is_left_child(__x))
-__x = __x->__parent_;
-return __x->__parent_;
+__x = __x->__parent_unsafe();
+return __x->__parent_unsafe();
+}
+
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+_EndNodePtr
+__tree_next_iter(_NodePtr __x) _NOEXCEPT
+{
+if (__x->__right_ != nullptr)
+return static_cast<_EndNodePtr>(__tree_min(__x->__right_));
+while (!__tree_is_left_child(__x))
+__x = __x->__parent_unsafe();
+return static_cast<_EndNodePtr>(__x->__parent_);
 }
 
 // Returns:  pointer to the previous in-order node before __x.
 // Precondition:  __x != nullptr.
-template 
+// Note: __x may be the end node.
+template 
+inline _LIBCPP_INLINE_VISIBILITY
 _NodePtr
-__tree_prev(_NodePtr __x) _NOEXCEPT
+__tree_prev_iter(_EndNodePtr __x) _NOEXCEPT
 {
 if (__x->__left_ != nullptr)
 return __tree_max(__x->__left_);
-while (__tree_is_left_child(__x))
-__x = __x->__parent_;
-return __x->__parent_;
+_NodePtr __xx = static_cast<_NodePtr>(__x);
+while (__tree_is_left_child(__xx))
+__xx = __xx->__parent_unsafe();
+return __xx->__parent_unsafe();
 }
 
 // Returns:  pointer to a node which has no children
@@ -215,14 +230,14 @@
 _NodePtr __y = __x->__right_;
 __x->__right_ = __y->__left_;
 if (__x->__right_ != nullptr)
-__x->__right_->__parent_ = __x;
+__x->__right_->__set_parent(__x);
 __y->__parent_ = __x->__parent_;
 if (__tree_is_left_child(__x))
 __x->__parent_->__left_ = __y;
 else
-__x->__parent_->__right_ = __y;
+__x->__parent_unsafe()->__right_ = __y;
 __y->__left_ = __x;
-__x->__parent_ = __y;
+__x->__set_parent(__y);
 }
 
 // Effects:  Makes __x->__left_ the subtree root with __x as its right child
@@ -235,14 +250,14 @@
 _NodePtr __y = __x->__left_;
 __x->__left_ = __y->__right_;
 if (__x->__left_ != nullptr)
-__x->__left_->__parent_ = __x;
+__x->__left_->__set_parent(__x);
 __y->__parent_ = __x->__parent_;
 if (__tree_is_left_child(__x))
 __x->__parent_->__left_ = __y;
 else
-__x->__parent_->__right_ = __y;
+__x->__parent_unsafe()->__right_ = __y;
 __y->__right_ = __x;
-__x->__parent_ = __y;
+__x->__set_parent(_

Re: [PATCH] D20090: [OPENCL] Fix wrongly vla error for OpenCL array.

2016-05-29 Thread Xiuli PAN via cfe-commits
pxli168 updated this revision to Diff 58932.
pxli168 added a comment.

Make all tests in OpenCL 2.0.


http://reviews.llvm.org/D20090

Files:
  lib/AST/ExprConstant.cpp
  lib/Sema/SemaType.cpp
  test/CodeGenOpenCL/vla.cl

Index: test/CodeGenOpenCL/vla.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/vla.cl
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
+
+constant int sz0 = 5;
+// CHECK: @sz0 = constant i32 5, align 4
+const global int sz1 = 16;
+// CHECK: @sz1 = constant i32 16, align 4
+const constant int sz2 = 8;
+// CHECK: @sz2 = constant i32 8, align 4
+// CHECK: @testvla.vla2 = internal global [8 x i16] undef, align 16
+
+kernel void testvla()
+{
+  int vla0[sz0];
+// CHECK: %vla0 = alloca [5 x i32], align 16
+  char vla1[sz1];
+// CHECK: %vla1 = alloca [16 x i8], align 16
+  local short vla2[sz2];
+}
Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -2063,7 +2063,8 @@
   } Diagnoser;
 
   return S.VerifyIntegerConstantExpression(ArraySize, &SizeVal, Diagnoser,
-   S.LangOpts.GNUMode).isInvalid();
+   S.LangOpts.GNUMode ||
+   S.LangOpts.OpenCL).isInvalid();
 }
 
 /// \brief Build an array type.
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -2740,7 +2740,10 @@
   } else if (VD->isConstexpr()) {
 // OK, we can read this variable.
   } else if (BaseType->isIntegralOrEnumerationType()) {
-if (!BaseType.isConstQualified()) {
+// In OpenCL if a variable is in constant address space it is a const 
value.
+if (!(BaseType.isConstQualified() ||
+  (Info.getLangOpts().OpenCL &&
+   BaseType.getAddressSpace() == LangAS::opencl_constant))) {
   if (Info.getLangOpts().CPlusPlus) {
 Info.Diag(E, diag::note_constexpr_ltor_non_const_int, 1) << VD;
 Info.Note(VD->getLocation(), diag::note_declared_at);


Index: test/CodeGenOpenCL/vla.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/vla.cl
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
+
+constant int sz0 = 5;
+// CHECK: @sz0 = constant i32 5, align 4
+const global int sz1 = 16;
+// CHECK: @sz1 = constant i32 16, align 4
+const constant int sz2 = 8;
+// CHECK: @sz2 = constant i32 8, align 4
+// CHECK: @testvla.vla2 = internal global [8 x i16] undef, align 16
+
+kernel void testvla()
+{
+  int vla0[sz0];
+// CHECK: %vla0 = alloca [5 x i32], align 16
+  char vla1[sz1];
+// CHECK: %vla1 = alloca [16 x i8], align 16
+  local short vla2[sz2];
+}
Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -2063,7 +2063,8 @@
   } Diagnoser;
 
   return S.VerifyIntegerConstantExpression(ArraySize, &SizeVal, Diagnoser,
-   S.LangOpts.GNUMode).isInvalid();
+   S.LangOpts.GNUMode ||
+   S.LangOpts.OpenCL).isInvalid();
 }
 
 /// \brief Build an array type.
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -2740,7 +2740,10 @@
   } else if (VD->isConstexpr()) {
 // OK, we can read this variable.
   } else if (BaseType->isIntegralOrEnumerationType()) {
-if (!BaseType.isConstQualified()) {
+// In OpenCL if a variable is in constant address space it is a const value.
+if (!(BaseType.isConstQualified() ||
+  (Info.getLangOpts().OpenCL &&
+   BaseType.getAddressSpace() == LangAS::opencl_constant))) {
   if (Info.getLangOpts().CPlusPlus) {
 Info.Diag(E, diag::note_constexpr_ltor_non_const_int, 1) << VD;
 Info.Note(VD->getLocation(), diag::note_declared_at);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20782: [AVX512] Emit generic masked store intrinsics directly from clang instead of using x86 specific intrinsics.

2016-05-29 Thread Craig Topper via cfe-commits
craig.topper added inline comments.


Comment at: lib/CodeGen/CGBuiltin.cpp:6304
@@ +6303,3 @@
+  Indices[i] = i;
+Ops[2] = CGF.Builder.CreateShuffleVector(Ops[2], Ops[2],
+ makeArrayRef(Indices, NumElts),

delena wrote:
> What code do you receive at the end? There is no shuffle instruction in the 
> architecture for mask vector.
That's not really a shuffle. It's an extract subvector, but the IR doesn't have 
a real instruction for that.

It's needed so we can go from i8 -> v8i1 -> v2i1/v4i1.


Comment at: test/CodeGen/avx512f-builtins.c:123
@@ -122,2 +122,3 @@
   // CHECK-LABEL: @test_mm512_storeu_si512 
-  // CHECK: @llvm.x86.avx512.mask.storeu.d.512
+  // CHECK: store <16 x i32> %5, <16 x i32>* %6, align 1
+  // CHECK-NEXT: ret void

delena wrote:
> I suggest to remove %5, %6 from the test, you can put something like this:
> CHECK: store <16 x i32> {{.*}}, align 1
I'll clean that up. I fixed most of them but looks like a missed a few.


http://reviews.llvm.org/D20782



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


Re: [PATCH] D20782: [AVX512] Emit generic masked store intrinsics directly from clang instead of using x86 specific intrinsics.

2016-05-29 Thread Elena Demikhovsky via cfe-commits
delena added inline comments.


Comment at: lib/CodeGen/CGBuiltin.cpp:6304
@@ +6303,3 @@
+  Indices[i] = i;
+Ops[2] = CGF.Builder.CreateShuffleVector(Ops[2], Ops[2],
+ makeArrayRef(Indices, NumElts),

craig.topper wrote:
> delena wrote:
> > What code do you receive at the end? There is no shuffle instruction in the 
> > architecture for mask vector.
> That's not really a shuffle. It's an extract subvector, but the IR doesn't 
> have a real instruction for that.
> 
> It's needed so we can go from i8 -> v8i1 -> v2i1/v4i1.
I understand. I just wanted to be sure that you receive only one "kmov %edi, 
%k1" at the end.


http://reviews.llvm.org/D20782



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


Re: [PATCH] D20782: [AVX512] Emit generic masked store intrinsics directly from clang instead of using x86 specific intrinsics.

2016-05-29 Thread Craig Topper via cfe-commits
craig.topper added inline comments.


Comment at: lib/CodeGen/CGBuiltin.cpp:6304
@@ +6303,3 @@
+  Indices[i] = i;
+Ops[2] = CGF.Builder.CreateShuffleVector(Ops[2], Ops[2],
+ makeArrayRef(Indices, NumElts),

delena wrote:
> craig.topper wrote:
> > delena wrote:
> > > What code do you receive at the end? There is no shuffle instruction in 
> > > the architecture for mask vector.
> > That's not really a shuffle. It's an extract subvector, but the IR doesn't 
> > have a real instruction for that.
> > 
> > It's needed so we can go from i8 -> v8i1 -> v2i1/v4i1.
> I understand. I just wanted to be sure that you receive only one "kmov %edi, 
> %k1" at the end.
Yes, only one "kmov %edi, %k1" was generated.


http://reviews.llvm.org/D20782



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


Re: [PATCH] D20782: [AVX512] Emit generic masked store intrinsics directly from clang instead of using x86 specific intrinsics.

2016-05-29 Thread Elena Demikhovsky via cfe-commits
delena accepted this revision.
delena added a comment.
This revision is now accepted and ready to land.

LGTM, After tests cleanup


http://reviews.llvm.org/D20782



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


r271198 - [OpenCL] Remove tests without triple from test/Headers/opencl-c-header.cl.

2016-05-29 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Mon May 30 01:42:48 2016
New Revision: 271198

URL: http://llvm.org/viewvc/llvm-project?rev=271198&view=rev
Log:
[OpenCL] Remove tests without triple from test/Headers/opencl-c-header.cl.

This test requires triples with Itanium C++ ABI whereas triples with MSVC 
environment uses Microsoft C++ ABI.

Modified:
cfe/trunk/test/Headers/opencl-c-header.cl

Modified: cfe/trunk/test/Headers/opencl-c-header.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/opencl-c-header.cl?rev=271198&r1=271197&r2=271198&view=diff
==
--- cfe/trunk/test/Headers/opencl-c-header.cl (original)
+++ cfe/trunk/test/Headers/opencl-c-header.cl Mon May 30 01:42:48 2016
@@ -1,7 +1,3 @@
-// RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h 
-emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h 
-emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
-// RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h 
-emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h 
-fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s


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