Re: [PATCH] D20352: Add XRay flags to Clang

2016-07-05 Thread Dean Michael Berris via cfe-commits
dberris updated this revision to Diff 62720.
dberris added a comment.

Rebase harder.


http://reviews.llvm.org/D20352

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/xray-attributes-supported.cpp
  test/Sema/xray-always-instrument-attr.c
  test/Sema/xray-always-instrument-attr.cpp

Index: test/Sema/xray-always-instrument-attr.cpp
===
--- /dev/null
+++ test/Sema/xray-always-instrument-attr.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -std=c++11 -x c++
+void foo [[clang::xray_always_instrument]] ();
+
+struct [[clang::xray_always_instrument]] a { int x; }; // expected-warning {{'xray_always_instrument' attribute only applies to functions and methods}}
+
+class b {
+ void c [[clang::xray_always_instrument]] ();
+};
+
+void baz [[clang::xray_always_instrument("not-supported")]] (); // expected-error {{'xray_always_instrument' attribute takes no arguments}}
Index: test/Sema/xray-always-instrument-attr.c
===
--- /dev/null
+++ test/Sema/xray-always-instrument-attr.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -std=c11
+void foo() __attribute__((xray_always_instrument));
+
+struct __attribute__((xray_always_instrument)) a { int x; }; // expected-warning {{'xray_always_instrument' attribute only applies to functions and methods}}
+
+void bar() __attribute__((xray_always_instrument("not-supported"))); // expected-error {{'xray_always_instrument' attribute takes no arguments}}
Index: test/CodeGen/xray-attributes-supported.cpp
===
--- /dev/null
+++ test/CodeGen/xray-attributes-supported.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - -triple x86_64-unknown-linux-gnu | FileCheck %s
+
+// Make sure that the LLVM attribute for XRay-annotated functions do show up.
+[[clang::xray_always_instrument]] void foo() {
+// CHECK: define void @_Z3foov() #0
+};
+
+[[clang::xray_never_instrument]] void bar() {
+// CHECK: define void @_Z3barv() #1
+};
+
+// CHECK: #0 = {{.*}}"function-instrument"="xray-always"
+// CHECK: #1 = {{.*}}"function-instrument"="xray-never"
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -5909,10 +5909,13 @@
   case AttributeList::AT_TypeTagForDatatype:
 handleTypeTagForDatatypeAttr(S, D, Attr);
 break;
-
   case AttributeList::AT_RenderScriptKernel:
 handleSimpleAttribute(S, D, Attr);
 break;
+  // XRay attributes.
+  case AttributeList::AT_XRayInstrument:
+handleSimpleAttribute(S, D, Attr);
+break;
   }
 }
 
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -686,6 +686,9 @@
   }
 
   Opts.InstrumentFunctions = Args.hasArg(OPT_finstrument_functions);
+  Opts.XRayInstrumentFunctions = Args.hasArg(OPT_fxray_instrument);
+  Opts.XRayInstructionThreshold =
+  getLastArgIntValue(Args, OPT_fxray_instruction_threshold_, 200, Diags);
   Opts.InstrumentForProfiling = Args.hasArg(OPT_pg);
   Opts.EmitOpenCLArgMetadata = Args.hasArg(OPT_cl_kernel_arg_info);
   Opts.CompressDebugSections = Args.hasArg(OPT_compress_debug_sections);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3181,6 +3181,28 @@
   return !StaticRuntimes.empty();
 }
 
+static bool addXRayRuntime(const ToolChain &TC, const ArgList &Args,
+   ArgStringList &CmdArgs) {
+  if (Args.hasArg(options::OPT_fxray_instrument,
+  options::OPT_fnoxray_instrument, false)) {
+CmdArgs.push_back("-whole-archive");
+CmdArgs.push_back(TC.getCompilerRTArgString(Args, "xray", false));
+CmdArgs.push_back("-no-whole-archive");
+return true;
+  }
+  return false;
+}
+
+static void linkXRayRuntimeDeps(const ToolChain &TC, ArgStringList &CmdArgs) {
+  CmdArgs.push_back("--no-as-needed");
+  CmdArgs.push_back("-lpthread");
+  CmdArgs.push_back("-lrt");
+  CmdArgs.push_back("-lm");
+  CmdArgs.push_back("-latomic");
+  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD)
+CmdArgs.push_back("-ldl");
+}
+
 static bool areOptimizationsEnabled(const ArgList &Args) {
   // Find the last -O arg and see if it is non-zero.
   if (Arg *A = Args.getLastArg(options::OPT_O_Group))
@@ -4582,6 +4604,16 @@
 
   Args.AddAllArgs(CmdArgs, options::OPT_finstrument_functions);
 
+  if (Args.hasArg(options::OPT_fxray_i

[PATCH] D21983: Add C++ dependencies to xray runtime

2016-07-05 Thread Dean Michael Berris via cfe-commits
dberris created this revision.
dberris added reviewers: echristo, rnk, aaron.ballman.
dberris added a subscriber: cfe-commits.
dberris added dependencies: D20352: Add XRay flags to Clang, D21982: WIP: 
Implement a per-thread inmemory log.
Herald added a subscriber: mehdi_amini.

Depends on D21982 which implements the in-memory logging implementation of the
XRay runtime. These additional changes also depends on D20352 which adds the
bulk of XRay flags/dependencies when using the `-fxray-instrument` flag from
Clang.

http://reviews.llvm.org/D21983

Files:
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3193,12 +3193,17 @@
   return false;
 }
 
-static void linkXRayRuntimeDeps(const ToolChain &TC, ArgStringList &CmdArgs) {
+static void linkXRayRuntimeDeps(const ToolChain &TC, const ArgList &Args,
+ArgStringList &CmdArgs) {
   CmdArgs.push_back("--no-as-needed");
   CmdArgs.push_back("-lpthread");
   CmdArgs.push_back("-lrt");
   CmdArgs.push_back("-lm");
   CmdArgs.push_back("-latomic");
+  if (TC.GetCXXStdlibType(Args) == ToolChain::CST_Libcxx)
+CmdArgs.push_back("-lc++");
+  else
+CmdArgs.push_back("-lstdc++");
   if (TC.getTriple().getOS() != llvm::Triple::FreeBSD)
 CmdArgs.push_back("-ldl");
 }
@@ -9441,7 +9446,7 @@
 linkSanitizerRuntimeDeps(ToolChain, CmdArgs);
 
   if (NeedsXRayDeps)
-linkXRayRuntimeDeps(ToolChain, CmdArgs);
+linkXRayRuntimeDeps(ToolChain, Args, CmdArgs);
 
   bool WantPthread = Args.hasArg(options::OPT_pthread) ||
  Args.hasArg(options::OPT_pthreads);


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3193,12 +3193,17 @@
   return false;
 }
 
-static void linkXRayRuntimeDeps(const ToolChain &TC, ArgStringList &CmdArgs) {
+static void linkXRayRuntimeDeps(const ToolChain &TC, const ArgList &Args,
+ArgStringList &CmdArgs) {
   CmdArgs.push_back("--no-as-needed");
   CmdArgs.push_back("-lpthread");
   CmdArgs.push_back("-lrt");
   CmdArgs.push_back("-lm");
   CmdArgs.push_back("-latomic");
+  if (TC.GetCXXStdlibType(Args) == ToolChain::CST_Libcxx)
+CmdArgs.push_back("-lc++");
+  else
+CmdArgs.push_back("-lstdc++");
   if (TC.getTriple().getOS() != llvm::Triple::FreeBSD)
 CmdArgs.push_back("-ldl");
 }
@@ -9441,7 +9446,7 @@
 linkSanitizerRuntimeDeps(ToolChain, CmdArgs);
 
   if (NeedsXRayDeps)
-linkXRayRuntimeDeps(ToolChain, CmdArgs);
+linkXRayRuntimeDeps(ToolChain, Args, CmdArgs);
 
   bool WantPthread = Args.hasArg(options::OPT_pthread) ||
  Args.hasArg(options::OPT_pthreads);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21766: [codeview][clang] Added support for unnamed bitfield type.

2016-07-05 Thread Amjad Aboud via cfe-commits
aaboud abandoned this revision.
aaboud added a comment.

Different implementation was committed at http://reviews.llvm.org/rL274201.


http://reviews.llvm.org/D21766



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


r274531 - [ASTMatchers] New forEachOverriden matcher.

2016-07-05 Thread Clement Courbet via cfe-commits
Author: courbet
Date: Tue Jul  5 02:49:31 2016
New Revision: 274531

URL: http://llvm.org/viewvc/llvm-project?rev=274531&view=rev
Log:
[ASTMatchers] New forEachOverriden matcher.

Matches methods overridden by the given method.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=274531&r1=274530&r2=274531&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Tue Jul  5 02:49:31 2016
@@ -3994,6 +3994,30 @@ matcher, or is a pointer to a type that
 
 
 
+MatcherCXXMethodDecl>forEachOverriddenMatcherCXXMethodDecl>
 InnerMatcher
+Matches each 
method overriden by the given method. This matcher may
+produce multiple matches.
+
+Given
+  class A { virtual void f(); };
+  class B : public A { void f(); };
+  class C : public B { void f(); };
+cxxMethodDecl(ofClass(hasName("C")),
+  forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
+  matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
+  that B::f is not overridden by C::f).
+
+The check can produce multiple matches in case of multiple inheritance, e.g.
+  class A1 { virtual void f(); };
+  class A2 { virtual void f(); };
+  class C : public A1, public A2 { void f(); };
+cxxMethodDecl(ofClass(hasName("C")),
+  forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
+  matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
+  once with "b" binding "A2::f" and "d" binding "C::f".
+
+
+
 MatcherCXXMethodDecl>ofClassMatcherCXXRecordDecl>
 InnerMatcher
 Matches the class 
declaration that the given method declaration
 belongs to.

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=274531&r1=274530&r2=274531&view=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Tue Jul  5 02:49:31 2016
@@ -825,6 +825,9 @@ public:
   overridden_methods_end(const CXXMethodDecl *Method) const;
 
   unsigned overridden_methods_size(const CXXMethodDecl *Method) const;
+  typedef llvm::iterator_range
+  overridden_method_range;
+  overridden_method_range overridden_methods(const CXXMethodDecl *Method) 
const;
 
   /// \brief Note that the given C++ \p Method overrides the given \p
   /// Overridden method.

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=274531&r1=274530&r2=274531&view=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Tue Jul  5 02:49:31 2016
@@ -16,6 +16,7 @@
 #ifndef LLVM_CLANG_AST_DECLCXX_H
 #define LLVM_CLANG_AST_DECLCXX_H
 
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTUnresolvedSet.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"
@@ -1829,6 +1830,8 @@ public:
   method_iterator begin_overridden_methods() const;
   method_iterator end_overridden_methods() const;
   unsigned size_overridden_methods() const;
+  typedef ASTContext::overridden_method_range overridden_method_range;
+  overridden_method_range overridden_methods() const;
 
   /// Returns the parent of this method declaration, which
   /// is the class in which this method is defined.

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=274531&r1=274530&r2=274531&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue Jul  5 02:49:31 2016
@@ -3809,6 +3809,47 @@ AST_MATCHER_P(CXXMethodDecl, ofClass,
   InnerMatcher.matches(*Parent, Finder, Builder));
 }
 
+/// \brief Matches each method overriden by the given method. This matcher may
+/// produce multiple matches.
+///
+/// Given
+/// \code
+///   class A { virtual void f(); };
+///   class B : public A { void f(); };
+///   class C : public B { void f(); };
+/// 

RE: r274110 - [AVX512] Zero extend cmp intrinsic return value.

2016-07-05 Thread Demikhovsky, Elena via cfe-commits
Most of AVX-512 intrinsics were not supported in 3.8 version and added between 
3.8 and 3.9.
In this case, when a BE intrinsic was introduced between releases, it can be 
removed, right?

Anyway, we’d better keep the BE intrinsic inside than maintain it in the 
autoupgrade.

> Also should we change the AutoUpgrade code for the cmp intrinsics in the 
> backend to also use zero instead of undef?
This pass was initially designed in order to keep backward compatibility and 
not for optimizations, right?

-   Elena

From: Craig Topper [mailto:craig.top...@gmail.com]
Sent: Tuesday, July 05, 2016 09:39
To: Demikhovsky, Elena 
Cc: Breger, Igor ; Eric Christopher via cfe-commits 
; LLVM Commits (llvm-comm...@lists.llvm.org) 

Subject: Re: r274110 - [AVX512] Zero extend cmp intrinsic return value.

Unfortunately the policy is such that the current version of LLVM must be able 
to read a bitcode or IR text file generated by any released version of 
LLVM/clang from 3.0 till now. This is why the AutoUpgrade.cpp file exists and 
it keeps growing and its only going to get worse.

Hopefully with the discussion about the version number for the release after 
3.9 we end up with a time based compatibility policy. This will allow us to 
remove the auto upgrade code over time, but it will take many years before we 
can remove auto upgrade being added now.

On Monday, July 4, 2016, Demikhovsky, Elena 
mailto:elena.demikhov...@intel.com>> wrote:
I think that AVX-512 intrinsic handled in Clang should be removed from 
AutoUpgrade.
If we decide to replace a call to llvm-backend intrinsic with generating LLVM 
IR directly from clang, we can remove llvm-backend intrinsic at all.
Otherwise we’ll need to duplicate support in FE and BE for all AVX-512 
intrinsics.

-   Elena

From: Craig Topper 
[mailto:craig.top...@gmail.com]
Sent: Monday, July 04, 2016 21:53
To: Breger, Igor 
>
Cc: Eric Christopher via cfe-commits 
>;
 Demikhovsky, Elena 
>
Subject: Re: r274110 - [AVX512] Zero extend cmp intrinsic return value.

We have to keep the autoupgrade code due to the requirement that we need to be 
able to load bitcode files from previous versions of llvm. Though the intrinsic 
autograde code is starting to become large.

~Craig

On Mon, Jul 4, 2016 at 2:55 AM, Breger, Igor 
> 
wrote:
Thanks for working on this!

Regards,
Igor

From: Craig Topper 
[mailto:craig.top...@gmail.com]
Sent: Monday, July 04, 2016 10:20
To: Breger, Igor
Cc: Eric Christopher via cfe-commits; Demikhovsky, Elena; Ouriel, Boaz
Subject: Re: r274110 - [AVX512] Zero extend cmp intrinsic return value.

I've modified the indices we use for the zero vector in r274484. This gives 
better codegen as it now looks like a concat to the backend. So now we just end 
up emitting unnecessary kshiftlw/kshiftrw pairs instead of converting to a 
wider vector op and back.

~Craig

On Sun, Jul 3, 2016 at 1:32 PM, Craig Topper 
>
 wrote:
Also should we change the AutoUpgrade code for the cmp intrinsics in the 
backend to also use zero instead of undef?

~Craig

On Sun, Jul 3, 2016 at 12:11 AM, Breger, Igor 
> 
wrote:
Hello Craig,
Thanks a lot for pointing it out to me.  I familiar with this problem,  we are 
planning  to improve CodeGen to handle with this case in near future.

Regards,
Igor

From: Craig Topper 
[mailto:craig.top...@gmail.com]
Sent: Saturday, July 02, 2016 08:46
To: Breger, Igor; Eric Christopher via cfe-commits
Subject: Re: r274110 - [AVX512] Zero extend cmp intrinsic return value.

This change codgens to something really awful now. Can you take a look?

.section__TEXT,__text,regular,pure_instructions
.section__TEXT,__literal8,8byte_literals
.p2align   3
LCPI0_0:
.quad   -1
.section__TEXT,__const
.p2align   6
LCPI0_1:
.quad   0
.quad   1
.quad   2
.quad   3
.quad   8
.quad   8
.quad   8
.quad   8
.section__TEXT,__text,regular,pure_instructions
.globl   _test_mm_cmpeq_epu32_mask
.p2align   4, 0x90
_test_mm_cmpeq_epu32_mask:
vpcmpeqd   %xmm1, %xmm0, %k1
vpbroadcastq   LCPI0_0(%rip), %zmm0 {%k1} {z}
vpxord %zmm1, %zmm1, %zmm1
vmovdqa64 LCPI0_1(%rip), %zmm2
vpermt2q %zmm1, %zmm2, %zmm0
vpsllq   $63, %zmm0, %zmm0
vptestmq %zmm0, %zmm0, %k0
kmovw%k0, %eax
retq

~Craig

On Wed, Jun 29, 2016 at 1:14 AM, Igor Breger via cfe-commits 
>
 wrote:
Author: ibreger
Date: Wed Jun 29 03:14:17 2016
New Revision: 274110

URL: http://llvm.org/viewvc/llvm-project?rev=274110&view=rev
Log:
[AVX512]  Zero extend cmp intrinsic return value.

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

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

r274532 - [Clang][BuiltIn][AVX512] adding _mm{|256|512}_mask_cvt{s|us|}epi16_storeu_epi8 intrinsics

2016-07-05 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Tue Jul  5 03:08:01 2016
New Revision: 274532

URL: http://llvm.org/viewvc/llvm-project?rev=274532&view=rev
Log:
[Clang][BuiltIn][AVX512] adding _mm{|256|512}_mask_cvt{s|us|}epi16_storeu_epi8 
intrinsics

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

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512bwintrin.h
cfe/trunk/lib/Headers/avx512vlbwintrin.h
cfe/trunk/test/CodeGen/avx512bw-builtins.c
cfe/trunk/test/CodeGen/avx512vlbw-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=274532&r1=274531&r2=274532&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Tue Jul  5 03:08:01 2016
@@ -1945,6 +1945,7 @@ TARGET_BUILTIN(__builtin_ia32_pbroadcast
 TARGET_BUILTIN(__builtin_ia32_pbroadcastw128_gpr_mask, 
"V8ssV8sUc","","avx512bw,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb512_mask, "V16cV16iV16cUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb512mem_mask, "vV16c*V16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_pmovswb512mem_mask, "vV32c*V32sUi","","avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovsdw512_mask, "V16sV16iV16sUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovsdw512mem_mask, "vV16s*V16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovsqb512_mask, "V16cV8LLiV16cUc","","avx512f")
@@ -1955,8 +1956,10 @@ TARGET_BUILTIN(__builtin_ia32_pmovsqw512
 TARGET_BUILTIN(__builtin_ia32_pmovsqw512mem_mask, "vV8s*V8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb128_mask, "V16cV4iV16cUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb128mem_mask, "vV16c*V4iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pmovswb128mem_mask, 
"vV16c*V8sUc","","avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb256_mask, "V16cV8iV16cUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb256mem_mask, "vV16c*V8iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pmovswb256mem_mask, 
"vV16c*V16sUs","","avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovsdw128_mask, "V8sV4iV8sUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovsdw128mem_mask, "vV8s*V4iUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovsdw256_mask, "V8sV8iV8sUc","","avx512vl")
@@ -1975,6 +1978,7 @@ TARGET_BUILTIN(__builtin_ia32_pmovsqw256
 TARGET_BUILTIN(__builtin_ia32_pmovsqw256mem_mask, "vV8s*V4LLiUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb512_mask, "V16cV16iV16cUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb512mem_mask, "vV16c*V16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_pmovuswb512mem_mask, 
"vV32c*V32sUi","","avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovusdw512_mask, "V16sV16iV16sUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovusdw512mem_mask, "vV16s*V16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovusqb512_mask, "V16cV8LLiV16cUc","","avx512f")
@@ -1985,8 +1989,10 @@ TARGET_BUILTIN(__builtin_ia32_pmovusqw51
 TARGET_BUILTIN(__builtin_ia32_pmovusqw512mem_mask, "vV8s*V8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb128_mask, "V16cV4iV16cUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb128mem_mask, "vV16c*V4iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pmovuswb128mem_mask, 
"vV16c*V8sUc","","avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb256_mask, "V16cV8iV16cUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb256mem_mask, "vV16c*V8iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pmovuswb256mem_mask, 
"vV16c*V16sUs","","avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovusdw128_mask, "V8sV4iV8sUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovusdw128mem_mask, "vV8s*V4iUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovusdw256_mask, "V8sV8iV8sUc","","avx512vl")
@@ -2005,6 +2011,7 @@ TARGET_BUILTIN(__builtin_ia32_pmovusqw25
 TARGET_BUILTIN(__builtin_ia32_pmovusqw256mem_mask, 
"vV8s*V4LLiUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovdb512_mask, "V16cV16iV16cUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovdb512mem_mask, "vV16c*V16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_pmovwb512mem_mask, "vV32c*V32sUi","","avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovdw512_mask, "V16sV16iV16sUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovdw512mem_mask, "vV16s*V16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovqb512_mask, "V16cV8LLiV16cUc","","avx512f")
@@ -2014,9 +2021,11 @@ TARGET_BUILTIN(__builtin_ia32_pmovqd512m
 TARGET_BUILTIN(__builtin_ia32_pmovqw512_mask, "V8sV8LLiV8sUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovqw512mem_mask, "vV8s*V8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovdb128_mask, "V16cV4iV16cUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pmovwb128mem_mask, 
"vV16c*V8sUc","","avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovdb1

Re: [PATCH] D21729: [Clang][BuiltIn][AVX512] adding _mm{|256|512}_mask_cvt{s|us|}epi16_storeu_epi8 intrinsics

2016-07-05 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274532: [Clang][BuiltIn][AVX512] adding… (authored by 
mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D21729?vs=61892&id=62723#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21729

Files:
  cfe/trunk/include/clang/Basic/BuiltinsX86.def
  cfe/trunk/lib/Headers/avx512bwintrin.h
  cfe/trunk/lib/Headers/avx512vlbwintrin.h
  cfe/trunk/test/CodeGen/avx512bw-builtins.c
  cfe/trunk/test/CodeGen/avx512vlbw-builtins.c

Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def
@@ -1945,6 +1945,7 @@
 TARGET_BUILTIN(__builtin_ia32_pbroadcastw128_gpr_mask, "V8ssV8sUc","","avx512bw,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb512_mask, "V16cV16iV16cUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb512mem_mask, "vV16c*V16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_pmovswb512mem_mask, "vV32c*V32sUi","","avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovsdw512_mask, "V16sV16iV16sUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovsdw512mem_mask, "vV16s*V16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovsqb512_mask, "V16cV8LLiV16cUc","","avx512f")
@@ -1955,8 +1956,10 @@
 TARGET_BUILTIN(__builtin_ia32_pmovsqw512mem_mask, "vV8s*V8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb128_mask, "V16cV4iV16cUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb128mem_mask, "vV16c*V4iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pmovswb128mem_mask, "vV16c*V8sUc","","avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb256_mask, "V16cV8iV16cUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovsdb256mem_mask, "vV16c*V8iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pmovswb256mem_mask, "vV16c*V16sUs","","avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovsdw128_mask, "V8sV4iV8sUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovsdw128mem_mask, "vV8s*V4iUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovsdw256_mask, "V8sV8iV8sUc","","avx512vl")
@@ -1975,6 +1978,7 @@
 TARGET_BUILTIN(__builtin_ia32_pmovsqw256mem_mask, "vV8s*V4LLiUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb512_mask, "V16cV16iV16cUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb512mem_mask, "vV16c*V16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_pmovuswb512mem_mask, "vV32c*V32sUi","","avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovusdw512_mask, "V16sV16iV16sUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovusdw512mem_mask, "vV16s*V16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovusqb512_mask, "V16cV8LLiV16cUc","","avx512f")
@@ -1985,8 +1989,10 @@
 TARGET_BUILTIN(__builtin_ia32_pmovusqw512mem_mask, "vV8s*V8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb128_mask, "V16cV4iV16cUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb128mem_mask, "vV16c*V4iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pmovuswb128mem_mask, "vV16c*V8sUc","","avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb256_mask, "V16cV8iV16cUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovusdb256mem_mask, "vV16c*V8iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pmovuswb256mem_mask, "vV16c*V16sUs","","avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovusdw128_mask, "V8sV4iV8sUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovusdw128mem_mask, "vV8s*V4iUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovusdw256_mask, "V8sV8iV8sUc","","avx512vl")
@@ -2005,6 +2011,7 @@
 TARGET_BUILTIN(__builtin_ia32_pmovusqw256mem_mask, "vV8s*V4LLiUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovdb512_mask, "V16cV16iV16cUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovdb512mem_mask, "vV16c*V16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_pmovwb512mem_mask, "vV32c*V32sUi","","avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovdw512_mask, "V16sV16iV16sUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovdw512mem_mask, "vV16s*V16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovqb512_mask, "V16cV8LLiV16cUc","","avx512f")
@@ -2014,9 +2021,11 @@
 TARGET_BUILTIN(__builtin_ia32_pmovqw512_mask, "V8sV8LLiV8sUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovqw512mem_mask, "vV8s*V8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmovdb128_mask, "V16cV4iV16cUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pmovwb128mem_mask, "vV16c*V8sUc","","avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovdb128mem_mask, "vV16c*V4iUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovdb256_mask, "V16cV8iV16cUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovdb256mem_mask, "vV16c*V8iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pmovwb256mem_mask, "vV16c*V16sUs","","avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmovdw128_mask, "V8sV4iV8sUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmovdw128mem_mask, "vV8s*V4iUc","","avx

Re: [PATCH] D21505: [Clang][AVX512][Intrinsics]Adding intrinsics for mov{ss|sd} instruction set

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


Comment at: lib/Headers/avx512fintrin.h:4518
@@ -4493,1 +4517,3 @@
 
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_mask_store_ss (float * __W, __mmask8 __U, __m128 __A)

this intrinsic should  be void.


Comment at: test/CodeGen/avx512f-builtins.c:248
@@ +247,3 @@
+  // CHECK:  store float {{.*}}, float* {{.*}}
+  // CHECK: load <4 x float>, <4 x float>* {{.*}}
+  return _mm_mask_store_ss (__W, __U, __A);

Why do you see load here?


http://reviews.llvm.org/D21505



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


Re: [PATCH] D21973: [AVX512] add float/double abs intrinsics

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


Comment at: ../tunkClang/tools/clang/test/CodeGen/avx512f-builtins.c:1413-1414
@@ -1412,3 +1412,4 @@
   // CHECK-LABEL: @test_mm512_mask_and_epi32
-  // CHECK: @llvm.x86.avx512.mask.pand.d.512
+  // CHECK: and <16 x i32> 
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_mask_and_epi32(__src, __k,__a, __b);

The right thing to do here:

// CHECK: %[[MASK:.*]] = bitcast
// CHECK: %[[AND_RES:.*]] = and <16 x i32>
// CHECK:  select <16 x i1> %[[MASK]], <16 x i32>%[[AND_RES]]

Up to you. 


Repository:
  rL LLVM

http://reviews.llvm.org/D21973



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


[PATCH] D21988: [AVX512] minor fix in sqrt{ss|sd} intrinsics arguments

2016-07-05 Thread Asaf Badouh via cfe-commits
AsafBadouh created this revision.
AsafBadouh added reviewers: m_zuckerman, guyblank, delena.
AsafBadouh added a subscriber: cfe-commits.
AsafBadouh set the repository for this revision to rL LLVM.

Repository:
  rL LLVM

http://reviews.llvm.org/D21988

Files:
  ../llvm/tools/clang/lib/Headers/avx512fintrin.h

Index: ../llvm/tools/clang/lib/Headers/avx512fintrin.h
===
--- ../llvm/tools/clang/lib/Headers/avx512fintrin.h
+++ ../llvm/tools/clang/lib/Headers/avx512fintrin.h
@@ -7208,62 +7208,62 @@
 (__mmask16)(U)); })
 
 #define _mm_sqrt_round_sd(A, B, R) __extension__ ({ \
-  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(B), \
-(__v2df)(__m128d)(A), \
+  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(A), \
+(__v2df)(__m128d)(B), \
 (__v2df)_mm_setzero_pd(), \
 (__mmask8)-1, (int)(R)); })
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
 _mm_mask_sqrt_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B)
 {
- return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __B,
- (__v2df) __A,
+ return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __A,
+ (__v2df) __B,
 (__v2df) __W,
 (__mmask8) __U,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 #define _mm_mask_sqrt_round_sd(W, U, A, B, R) __extension__ ({ \
-  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(B), \
-(__v2df)(__m128d)(A), \
+  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(A), \
+(__v2df)(__m128d)(B), \
 (__v2df)(__m128d)(W), \
 (__mmask8)(U), (int)(R)); })
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
 _mm_maskz_sqrt_sd (__mmask8 __U, __m128d __A, __m128d __B)
 {
- return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __B,
- (__v2df) __A,
+ return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __A,
+ (__v2df) __B,
 (__v2df) _mm_setzero_pd (),
 (__mmask8) __U,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 #define _mm_maskz_sqrt_round_sd(U, A, B, R) __extension__ ({ \
-  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(B), \
-(__v2df)(__m128d)(A), \
+  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(A), \
+(__v2df)(__m128d)(B), \
 (__v2df)_mm_setzero_pd(), \
 (__mmask8)(U), (int)(R)); })
 
 #define _mm_sqrt_round_ss(A, B, R) __extension__ ({ \
-  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(B), \
-   (__v4sf)(__m128)(A), \
+  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(A), \
+   (__v4sf)(__m128)(B), \
(__v4sf)_mm_setzero_ps(), \
(__mmask8)-1, (int)(R)); })
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_mask_sqrt_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
 {
- return (__m128) __builtin_ia32_sqrtss_round_mask ( (__v4sf) __B,
- (__v4sf) __A,
+ return (__m128) __builtin_ia32_sqrtss_round_mask ( (__v4sf) __A,
+ (__v4sf) __B,
 (__v4sf) __W,
 (__mmask8) __U,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 #define _mm_mask_sqrt_round_ss(W, U, A, B, R) __extension__ ({ \
-  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(B), \
-   (__v4sf)(__m128)(A), \
+  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(A), \
+   (__v4sf)(__m128)(B), \
(__v4sf)(__m128)(W), (__mmask8)(U), 
\
(int)(R)); })
 
@@ -7278,8 +7278,8 @@
 }
 
 #define _mm_maskz_sqrt_round_ss(U, A, B, R) __extension__ ({ \
-  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(B), \
-   (__v4sf)(__m128)(A), \
+  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(A), \
+   (__v4sf)(__m128)(B), \
(__v4sf)_mm_setzero_ps(), \
(__mmask8)(U), (int)(R)); })
 


Index: ../llvm/tools/clang/lib/Headers/avx512fintrin.h
===
--- ../llvm/tools/clang/lib/Headers/avx512fi

Re: [PATCH] D21973: [AVX512] add float/double abs intrinsics

2016-07-05 Thread Asaf Badouh via cfe-commits
AsafBadouh added inline comments.


Comment at: ../tunkClang/tools/clang/test/CodeGen/avx512f-builtins.c:1413-1414
@@ -1412,3 +1412,4 @@
   // CHECK-LABEL: @test_mm512_mask_and_epi32
-  // CHECK: @llvm.x86.avx512.mask.pand.d.512
+  // CHECK: and <16 x i32> 
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_mask_and_epi32(__src, __k,__a, __b);

delena wrote:
> The right thing to do here:
> 
> // CHECK: %[[MASK:.*]] = bitcast
> // CHECK: %[[AND_RES:.*]] = and <16 x i32>
> // CHECK:  select <16 x i1> %[[MASK]], <16 x i32>%[[AND_RES]]
> 
> Up to you. 
will do,
thanks for the review!


Repository:
  rL LLVM

http://reviews.llvm.org/D21973



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


r274539 - ntrinsics _mm256_permutexvar_epi64 doesn't accept three parameters as specify bellow.

2016-07-05 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Tue Jul  5 06:30:31 2016
New Revision: 274539

URL: http://llvm.org/viewvc/llvm-project?rev=274539&view=rev
Log:
ntrinsics _mm256_permutexvar_epi64 doesn't accept three parameters as specify 
bellow.
I deleted the extra mask parameter.

__m256i _mm256_permutexvar_epi64 (__m256i idx, __m256i a)
#include "immintrin.h"
Instruction: vpermq
CPUID Flags: AVX512VL + AVX512F
Description
Shuffle 64-bit integers in a across lanes using the corresponding index in idx, 
and store the results in dst.
Operation
FOR j := 0 to 3
  i := j*64
id := idx[i+1:i]*64
  dst[i+63:i] := a[id+63:id]
  ENDFOR
  dst[MAX:256] := 0
  dst[MAX:256] := 0
  
(From: Intel intrinsics guide)

Modified:
cfe/trunk/lib/Headers/avx512vlintrin.h

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=274539&r1=274538&r2=274539&view=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlintrin.h Tue Jul  5 06:30:31 2016
@@ -8870,7 +8870,7 @@ _mm256_maskz_permutexvar_epi64 (__mmask8
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
-_mm256_permutexvar_epi64 (__mmask8 __M, __m256i __X, __m256i __Y)
+_mm256_permutexvar_epi64 ( __m256i __X, __m256i __Y)
 {
   return (__m256i) __builtin_ia32_permvardi256_mask ((__v4di) __Y,
  (__v4di) __X,


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


r274540 - [OpenCL] An implementation of device side enqueue (DSE) from OpenCL v2.0 s6.13.17.

2016-07-05 Thread Anastasia Stulova via cfe-commits
Author: stulova
Date: Tue Jul  5 06:31:24 2016
New Revision: 274540

URL: http://llvm.org/viewvc/llvm-project?rev=274540&view=rev
Log:
[OpenCL] An implementation of device side enqueue (DSE) from OpenCL v2.0 
s6.13.17.

- Added new Builtins: enqueue_kernel, get_kernel_work_group_size
and get_kernel_preferred_work_group_size_multiple.

These Builtins use custom check to diagnose parameters of the passed Blocks
i. e. variable number of 'local void*' type params, and check different
overloads specified in Table 6.31 of OpenCL v2.0.

- IR is generated as an internal library call for each OpenCL Builtin,
reusing ObjC Block implementation.

Review: http://reviews.llvm.org/D20249


Added:
cfe/trunk/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl
Modified:
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/Basic/Builtins.def
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/opencl-c.h
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=274540&r1=274539&r2=274540&view=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Tue Jul  5 06:31:24 2016
@@ -1898,6 +1898,11 @@ public:
   /// This should never be used when type qualifiers are meaningful.
   const Type *getArrayElementTypeNoTypeQual() const;
 
+  /// If this is a pointer type, return the pointee type.
+  /// If this is an array type, return the array element type.
+  /// This should never be used when type qualifiers are meaningful.
+  const Type *getPointeeOrArrayElementType() const;
+
   /// If this is a pointer, ObjC object pointer, or block
   /// pointer, this returns the respective pointee.
   QualType getPointeeType() const;
@@ -5771,6 +5776,15 @@ inline const Type *Type::getBaseElementT
   return type;
 }
 
+inline const Type *Type::getPointeeOrArrayElementType() const {
+  const Type *type = this;
+  if (type->isAnyPointerType())
+return type->getPointeeType().getTypePtr();
+  else if (type->isArrayType())
+return type->getBaseElementTypeUnsafe();
+  return type;
+}
+
 /// Insertion operator for diagnostics.  This allows sending QualType's into a
 /// diagnostic with <<.
 inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=274540&r1=274539&r2=274540&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Tue Jul  5 06:31:24 2016
@@ -1306,6 +1306,12 @@ LANGBUILTIN(work_group_commit_write_pipe
 LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC20_LANG)
 LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC20_LANG)
 
+// OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
+// Custom builtin check allows to perform special check of passed block 
arguments.
+LANGBUILTIN(enqueue_kernel, "i.", "tn", OCLC20_LANG)
+LANGBUILTIN(get_kernel_work_group_size, "i.", "tn", OCLC20_LANG)
+LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "i.", "tn", 
OCLC20_LANG)
+
 // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
 LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG)
 LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG)

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=274540&r1=274539&r2=274540&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jul  5 06:31:24 
2016
@@ -7944,6 +7944,20 @@ def err_opencl_builtin_to_addr_arg_num :
   "invalid number of arguments to function: %0">;
 def err_opencl_builtin_to_addr_invalid_arg : Error<
   "invalid argument %0 to function: %1, expecting a generic pointer argument">;
+
+// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
+def err_opencl_enqueue_kernel_incorrect_args : Error<
+  "illegal call to enqueue_kernel, incorrect argument types">;
+def err_opencl_enqueue_kernel_expected_type : Error<
+  "illegal call to enqueue_kernel, expected %0 argument type">;
+def err_opencl_enqueue_kernel_local_size_args : Error<
+  "mismatch in number of block parameters and local size arguments passed">;
+def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
+  "local memory sizes need to be specified as uint">;
+def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
+  "blocks used in device side enqueue are expected to ha

r274541 - [AVX512] minor fix in sqrt{ss|sd} intrinsics arguments

2016-07-05 Thread Asaf Badouh via cfe-commits
Author: abadouh
Date: Tue Jul  5 06:36:21 2016
New Revision: 274541

URL: http://llvm.org/viewvc/llvm-project?rev=274541&view=rev
Log:
[AVX512] minor fix in sqrt{ss|sd} intrinsics arguments

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


Modified:
cfe/trunk/lib/Headers/avx512fintrin.h

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=274541&r1=274540&r2=274541&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Tue Jul  5 06:36:21 2016
@@ -7208,62 +7208,62 @@ _mm_maskz_scalef_ss (__mmask8 __U, __m12
 (__mmask16)(U)); })
 
 #define _mm_sqrt_round_sd(A, B, R) __extension__ ({ \
-  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(B), \
-(__v2df)(__m128d)(A), \
+  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(A), \
+(__v2df)(__m128d)(B), \
 (__v2df)_mm_setzero_pd(), \
 (__mmask8)-1, (int)(R)); })
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
 _mm_mask_sqrt_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B)
 {
- return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __B,
- (__v2df) __A,
+ return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __A,
+ (__v2df) __B,
 (__v2df) __W,
 (__mmask8) __U,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 #define _mm_mask_sqrt_round_sd(W, U, A, B, R) __extension__ ({ \
-  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(B), \
-(__v2df)(__m128d)(A), \
+  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(A), \
+(__v2df)(__m128d)(B), \
 (__v2df)(__m128d)(W), \
 (__mmask8)(U), (int)(R)); })
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
 _mm_maskz_sqrt_sd (__mmask8 __U, __m128d __A, __m128d __B)
 {
- return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __B,
- (__v2df) __A,
+ return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __A,
+ (__v2df) __B,
 (__v2df) _mm_setzero_pd (),
 (__mmask8) __U,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 #define _mm_maskz_sqrt_round_sd(U, A, B, R) __extension__ ({ \
-  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(B), \
-(__v2df)(__m128d)(A), \
+  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(A), \
+(__v2df)(__m128d)(B), \
 (__v2df)_mm_setzero_pd(), \
 (__mmask8)(U), (int)(R)); })
 
 #define _mm_sqrt_round_ss(A, B, R) __extension__ ({ \
-  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(B), \
-   (__v4sf)(__m128)(A), \
+  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(A), \
+   (__v4sf)(__m128)(B), \
(__v4sf)_mm_setzero_ps(), \
(__mmask8)-1, (int)(R)); })
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_mask_sqrt_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
 {
- return (__m128) __builtin_ia32_sqrtss_round_mask ( (__v4sf) __B,
- (__v4sf) __A,
+ return (__m128) __builtin_ia32_sqrtss_round_mask ( (__v4sf) __A,
+ (__v4sf) __B,
 (__v4sf) __W,
 (__mmask8) __U,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 #define _mm_mask_sqrt_round_ss(W, U, A, B, R) __extension__ ({ \
-  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(B), \
-   (__v4sf)(__m128)(A), \
+  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(A), \
+   (__v4sf)(__m128)(B), \
(__v4sf)(__m128)(W), (__mmask8)(U), 
\
(int)(R)); })
 
@@ -7278,8 +7278,8 @@ _mm_maskz_sqrt_ss (__mmask8 __U, __m128
 }
 
 #define _mm_maskz_sqrt_round_ss(U, A, B, R) __extension__ ({ \
-  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(B), \
-   (__v4sf)(__m128)(A), \
+  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(A), \
+   (__v4sf)(__m128)(B), \
(__v4sf)_mm_setzero_ps(), \
 

Re: [PATCH] D21988: [AVX512] minor fix in sqrt{ss|sd} intrinsics arguments

2016-07-05 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274541: [AVX512] minor fix in sqrt{ss|sd} intrinsics 
arguments (authored by abadouh).

Changed prior to commit:
  http://reviews.llvm.org/D21988?vs=62734&id=62735#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21988

Files:
  cfe/trunk/lib/Headers/avx512fintrin.h

Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -7208,62 +7208,62 @@
 (__mmask16)(U)); })
 
 #define _mm_sqrt_round_sd(A, B, R) __extension__ ({ \
-  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(B), \
-(__v2df)(__m128d)(A), \
+  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(A), \
+(__v2df)(__m128d)(B), \
 (__v2df)_mm_setzero_pd(), \
 (__mmask8)-1, (int)(R)); })
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
 _mm_mask_sqrt_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B)
 {
- return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __B,
- (__v2df) __A,
+ return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __A,
+ (__v2df) __B,
 (__v2df) __W,
 (__mmask8) __U,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 #define _mm_mask_sqrt_round_sd(W, U, A, B, R) __extension__ ({ \
-  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(B), \
-(__v2df)(__m128d)(A), \
+  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(A), \
+(__v2df)(__m128d)(B), \
 (__v2df)(__m128d)(W), \
 (__mmask8)(U), (int)(R)); })
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
 _mm_maskz_sqrt_sd (__mmask8 __U, __m128d __A, __m128d __B)
 {
- return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __B,
- (__v2df) __A,
+ return (__m128d) __builtin_ia32_sqrtsd_round_mask ( (__v2df) __A,
+ (__v2df) __B,
 (__v2df) _mm_setzero_pd (),
 (__mmask8) __U,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 #define _mm_maskz_sqrt_round_sd(U, A, B, R) __extension__ ({ \
-  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(B), \
-(__v2df)(__m128d)(A), \
+  (__m128d)__builtin_ia32_sqrtsd_round_mask((__v2df)(__m128d)(A), \
+(__v2df)(__m128d)(B), \
 (__v2df)_mm_setzero_pd(), \
 (__mmask8)(U), (int)(R)); })
 
 #define _mm_sqrt_round_ss(A, B, R) __extension__ ({ \
-  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(B), \
-   (__v4sf)(__m128)(A), \
+  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(A), \
+   (__v4sf)(__m128)(B), \
(__v4sf)_mm_setzero_ps(), \
(__mmask8)-1, (int)(R)); })
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_mask_sqrt_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
 {
- return (__m128) __builtin_ia32_sqrtss_round_mask ( (__v4sf) __B,
- (__v4sf) __A,
+ return (__m128) __builtin_ia32_sqrtss_round_mask ( (__v4sf) __A,
+ (__v4sf) __B,
 (__v4sf) __W,
 (__mmask8) __U,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 #define _mm_mask_sqrt_round_ss(W, U, A, B, R) __extension__ ({ \
-  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(B), \
-   (__v4sf)(__m128)(A), \
+  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(A), \
+   (__v4sf)(__m128)(B), \
(__v4sf)(__m128)(W), (__mmask8)(U), 
\
(int)(R)); })
 
@@ -7278,8 +7278,8 @@
 }
 
 #define _mm_maskz_sqrt_round_ss(U, A, B, R) __extension__ ({ \
-  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(B), \
-   (__v4sf)(__m128)(A), \
+  (__m128)__builtin_ia32_sqrtss_round_mask((__v4sf)(__m128)(A), \
+   (__v4sf)(__m128)(B), \
(__v4sf)_mm_setzero_ps(), \
(__mmask8)(U), (int)(R)); })
 


Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx5

[PATCH] D21989: [OpenCL] Improve diagnostics of OpenCL types

2016-07-05 Thread Anastasia Stulova via cfe-commits
Anastasia created this revision.
Anastasia added reviewers: bader, yaxunl.
Anastasia added a subscriber: cfe-commits.

This change:
1. Changes diagnostics for Blocks to be implicitly const qualified OpenCL v2.0 
s6.12.5.
2. Adds and unifies diagnostics of some OpenCL special types: blocks, images, 
samplers, pipes. These types are intended for use with the OpenCL builtin 
function only and, therefore, most regular uses are not allowed including 
assignments, arithmetic operations, pointer dereferencing, etc...

http://reviews.llvm.org/D21989

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaType.cpp
  test/SemaOpenCL/invalid-block.cl
  test/SemaOpenCL/invalid-image.cl
  test/SemaOpenCL/invalid-pipes-cl2.0.cl
  test/SemaOpenCL/sampler_t.cl

Index: test/SemaOpenCL/sampler_t.cl
===
--- test/SemaOpenCL/sampler_t.cl
+++ test/SemaOpenCL/sampler_t.cl
@@ -18,3 +18,12 @@
 }
 
 void bad(sampler_t*); // expected-error {{pointer to type 'sampler_t' is invalid in OpenCL}}
+
+void bar(){
+  sampler_t smp1 = 7;
+  sampler_t smp2 = 2;
+  smp1=smp2; //expected-error{{invalid operands to binary expression ('sampler_t' and 'sampler_t')}}
+  smp1+1; //expected-error{{invalid operands to binary expression ('sampler_t' and 'int')}}
+  &smp1; //expected-error{{invalid argument type 'sampler_t' to unary expression}}
+  *smp2; //expected-error{{invalid argument type 'sampler_t' to unary expression}}
+}
Index: test/SemaOpenCL/invalid-pipes-cl2.0.cl
===
--- test/SemaOpenCL/invalid-pipes-cl2.0.cl
+++ test/SemaOpenCL/invalid-pipes-cl2.0.cl
@@ -7,5 +7,13 @@
 void test3(int pipe p){// expected-error {{cannot combine with previous 'int' declaration specifier}}
 }
 void test4() {
-  pipe int p; // expected-error {{type 'pipe int' can only be used as a function parameter}}
+  pipe int p; // expected-error {{type 'pipe int' can only be used as a function parameter}}gedit test.cl
+  //TODO: fix parsing of this pipe int (*p);
+}
+
+void test5(pipe int p){
+  p+p; // expected-error{{invalid operands to binary expression ('pipe int' and 'pipe int')}}
+  p=p; // expected-error{{invalid operands to binary expression ('pipe int' and 'pipe int')}}
+  &p; // expected-error{{invalid argument type 'pipe int' to unary expression}}
+  *p; // expected-error{{invalid argument type 'pipe int' to unary expression}}
 }
Index: test/SemaOpenCL/invalid-image.cl
===
--- test/SemaOpenCL/invalid-image.cl
+++ test/SemaOpenCL/invalid-image.cl
@@ -5,4 +5,8 @@
 void test2(image1d_t i) {
   image1d_t ti;// expected-error {{type '__read_only image1d_t' can only be used as a function parameter}}
   image1d_t ai[] = {i, i}; // expected-error {{array of '__read_only image1d_t' type is invalid in OpenCL}}
+  i=i; //expected-error{{invalid operands to binary expression ('__read_only image1d_t' and '__read_only image1d_t')}}
+  i+1; //expected-error{{invalid operands to binary expression ('__read_only image1d_t' and 'int')}}
+  &i; //expected-error{{invalid argument type '__read_only image1d_t' to unary expression}}
+  *i; //expected-error{{invalid argument type '__read_only image1d_t' to unary expression}}
 }
Index: test/SemaOpenCL/invalid-block.cl
===
--- test/SemaOpenCL/invalid-block.cl
+++ test/SemaOpenCL/invalid-block.cl
@@ -1,49 +1,53 @@
 // RUN: %clang_cc1 -verify -fblocks -cl-std=CL2.0 %s
 
 // OpenCL v2.0 s6.12.5
-
+void f0(int (^const bl)());
 // All blocks declarations must be const qualified and initialized.
 void f1() {
-  int (^bl1)() = ^() {return 1;}; // expected-error{{invalid block variable declaration - must be const qualified}}
-  int (^const bl2)(); // expected-error{{invalid block variable declaration - must be initialized}}
-  int (^const bl3)() = ^(){return 1;};
+  int (^bl1)() = ^() {return 1;};
+  int (^const bl2)() = ^(){return 1;};
+  f0(bl1);
+  f0(bl2);
+  bl1 = bl2; // expected-error{{invalid operands to binary expression ('int (^const)()' and 'int (^const)()')}}
+  int (^const bl3)(); // expected-error{{invalid block variable declaration - must be initialized}}
 }
 
 // A block with extern storage class is not allowed.
-extern int (^const bl)() = ^(){return 1;}; // expected-error{{invalid block variable declaration - using 'extern' storage class is disallowed}}
+extern int (^bl)() = ^(){return 1;}; // expected-error{{invalid block variable declaration - using 'extern' storage class is disallowed}}
 void f2() {
-  extern int (^const bl)() = ^(){return 1;}; // expected-error{{invalid block variable declaration - using 'extern' storage class is disallowed}}
+  extern int (^bl)() = ^(){return 1;}; // expected-error{{invalid block variable declaration - using 'extern' storage class is disallowed}}
 }
 
 // A block cannot 

Re: [PATCH] D21989: [OpenCL] Improve diagnostics of OpenCL types

2016-07-05 Thread Alexey Bader via cfe-commits
bader accepted this revision.
bader added a comment.
This revision is now accepted and ready to land.

LGTM.
A few minor style comments.



Comment at: lib/Sema/SemaExpr.cpp:10806-10807
@@ -10816,4 +10805,4 @@
 // the ATOMIC_VAR_INIT macro.
 if (LHSExpr->getType()->isAtomicType() ||
 RHSExpr->getType()->isAtomicType()) {
   SourceRange SR(LHSExpr->getLocStart(), RHSExpr->getLocEnd());

Please, refactor this code to use LHSTy & RHSTy.


Comment at: lib/Sema/SemaType.cpp:3832
@@ -3829,1 +3831,3 @@
+if (LangOpts.OpenCL)
+  DeclType.Cls.TypeQuals|=DeclSpec::TQ_const;
 T = S.BuildQualifiedType(T, DeclType.Loc, DeclType.Cls.TypeQuals);

Please, add spaces around |=.


Comment at: test/SemaOpenCL/invalid-pipes-cl2.0.cl:10
@@ -9,2 +9,3 @@
 void test4() {
-  pipe int p; // expected-error {{type 'pipe int' can only be used as a 
function parameter}}
+  pipe int p; // expected-error {{type 'pipe int' can only be used as a 
function parameter}}gedit test.cl
+  //TODO: fix parsing of this pipe int (*p);

Please, remove 'gedit test.cl' at the end of the line.


Comment at: test/SemaOpenCL/sampler_t.cl:22
@@ +21,3 @@
+
+void bar(){
+  sampler_t smp1 = 7;

Please, add space before {.


http://reviews.llvm.org/D21989



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


Re: [PATCH] D17990: [clang-tidy] minor improvements in modernise-deprecated-headers check

2016-07-05 Thread Kirill Bobyrev via cfe-commits
omtcyf0 marked 2 inline comments as done.


Comment at: docs/clang-tidy/checks/modernize-deprecated-headers.rst:45
@@ +44,3 @@
+
+These checks don't have effect in C++:
+

At least that's what cppreference tells me.


http://reviews.llvm.org/D17990



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


RE: r274220 - AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.

2016-07-05 Thread Haustov, Nikolay via cfe-commits
It does because CC_OpenCLKernel case now uses CGM member.

Nikolay


From: Tom Stellard [t...@stellard.net]
Sent: Tuesday, July 05, 2016 3:47 AM
To: Haustov, Nikolay
Cc: cfe-commits@lists.llvm.org
Subject: Re: r274220 - AMDGPU: Set amdgpu_kernel calling convention for OpenCL 
kernels.

On Thu, Jun 30, 2016 at 09:06:34AM -, Nikolay Haustov via cfe-commits wrote:
> Author: nhaustov
> Date: Thu Jun 30 04:06:33 2016
> New Revision: 274220
>
> URL: http://llvm.org/viewvc/llvm-project?rev=274220&view=rev
> Log:
> AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.

> -static unsigned ClangCallConvToLLVMCallConv(CallingConv CC) {
> +unsigned CodeGenTypes::ClangCallConvToLLVMCallConv(CallingConv CC) {

Was this change left over from a previous version of the patch?  This
patch doesn't seem to require that this be a member function.

-Tom

>switch (CC) {
>default: return llvm::CallingConv::C;
>case CC_X86StdCall: return llvm::CallingConv::X86_StdCall;
> @@ -57,7 +58,7 @@ static unsigned ClangCallConvToLLVMCallC
>// TODO: Add support for __vectorcall to LLVM.
>case CC_X86VectorCall: return llvm::CallingConv::X86_VectorCall;
>case CC_SpirFunction: return llvm::CallingConv::SPIR_FUNC;
> -  case CC_SpirKernel: return llvm::CallingConv::SPIR_KERNEL;
> +  case CC_OpenCLKernel: return 
> CGM.getTargetCodeGenInfo().getOpenCLKernelCallingConv();
>case CC_PreserveMost: return llvm::CallingConv::PreserveMost;
>case CC_PreserveAll: return llvm::CallingConv::PreserveAll;
>case CC_Swift: return llvm::CallingConv::Swift;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17990: [clang-tidy] minor improvements in modernise-deprecated-headers check

2016-07-05 Thread Kirill Bobyrev via cfe-commits
omtcyf0 updated this revision to Diff 62701.
omtcyf0 added a comment.

How it looks better now.


http://reviews.llvm.org/D17990

Files:
  clang-tidy/modernize/DeprecatedHeadersCheck.cpp
  docs/clang-tidy/checks/modernize-deprecated-headers.rst
  test/clang-tidy/modernize-deprecated-headers-cxx03.cpp
  test/clang-tidy/modernize-deprecated-headers-cxx11.cpp

Index: test/clang-tidy/modernize-deprecated-headers-cxx11.cpp
===
--- test/clang-tidy/modernize-deprecated-headers-cxx11.cpp
+++ test/clang-tidy/modernize-deprecated-headers-cxx11.cpp
@@ -7,15 +7,12 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -27,49 +24,53 @@
 #include 
 #include 
 
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'ccomplex' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'fenv.h'; consider using 'cfenv' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'inttypes.h'; consider using 'cinttypes' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'iso646.h'; consider using 'ciso646' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdalign.h'; consider using 'cstdalign' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdbool.h'; consider using 'cstdbool' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'tgmath.h'; consider using 'ctgmath' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'uchar.h'; consider using 'cuchar' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead
-// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead
+// Headers that have no effect in C++; remove them
+#include 
+#include 
+#include 
+
+// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'complex' instead
+// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead
+// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead
+// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'fenv.h'; consider using 'cfenv' instead
+// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'float.h'; cons

r274542 - [X86][AVX512F] add float/double abs intrinsics

2016-07-05 Thread Asaf Badouh via cfe-commits
Author: abadouh
Date: Tue Jul  5 07:24:14 2016
New Revision: 274542

URL: http://llvm.org/viewvc/llvm-project?rev=274542&view=rev
Log:
[X86][AVX512F]  add float/double abs intrinsics
add abs intrinsics that use native LLVM-IR.
change _mm512_mask[z]_and_epi{32|64} to use select intrinsic

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

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=274542&r1=274541&r2=274542&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Tue Jul  5 07:24:14 2016
@@ -515,19 +515,16 @@ _mm512_and_epi32(__m512i __a, __m512i __
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_mask_and_epi32(__m512i __src, __mmask16 __k, __m512i __a, __m512i __b)
 {
-  return (__m512i) __builtin_ia32_pandd512_mask((__v16si) __a,
-  (__v16si) __b,
-  (__v16si) __src,
-  (__mmask16) __k);
+  return (__m512i) __builtin_ia32_selectd_512 ((__mmask16) __k,
+(__v16si) _mm512_and_epi32(__a, __b),
+(__v16si) __src);
 }
+
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_maskz_and_epi32(__mmask16 __k, __m512i __a, __m512i __b)
 {
-  return (__m512i) __builtin_ia32_pandd512_mask((__v16si) __a,
-  (__v16si) __b,
-  (__v16si)
-  _mm512_setzero_si512 (),
-  (__mmask16) __k);
+  return (__m512i) _mm512_mask_and_epi32(_mm512_setzero_si512 (), 
+ __k, __a, __b);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
@@ -539,19 +536,16 @@ _mm512_and_epi64(__m512i __a, __m512i __
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_mask_and_epi64(__m512i __src, __mmask8 __k, __m512i __a, __m512i __b)
 {
-  return (__m512i) __builtin_ia32_pandq512_mask ((__v8di) __a,
-  (__v8di) __b,
-  (__v8di) __src,
-  (__mmask8) __k);
+return (__m512i) __builtin_ia32_selectq_512 ((__mmask8) __k,
+(__v8di) _mm512_and_epi64(__a, __b),
+(__v8di) __src);
 }
+
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_maskz_and_epi64(__mmask8 __k, __m512i __a, __m512i __b)
 {
-  return (__m512i) __builtin_ia32_pandq512_mask ((__v8di) __a,
-  (__v8di) __b,
-  (__v8di)
-  _mm512_setzero_si512 (),
-  (__mmask8) __k);
+  return (__m512i) _mm512_mask_and_epi64((__v8di)_mm512_setzero_si512 (), 
+ __k, __a, __b);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
@@ -9539,6 +9533,30 @@ _mm512_set_ps (float __A, float __B, flo
   _mm512_set_ps((e15),(e14),(e13),(e12),(e11),(e10),(e9),(e8),(e7),(e6),(e5), \
 (e4),(e3),(e2),(e1),(e0))
 
+static __inline__ __m512 __DEFAULT_FN_ATTRS
+_mm512_abs_ps(__m512 A)
+{
+  return (__m512)_mm512_and_epi32(_mm512_set1_epi32(0x7FFF),(__m512i)A) ;
+}
+
+static __inline__ __m512 __DEFAULT_FN_ATTRS
+_mm512_mask_abs_ps(__m512 W, __mmask16 K, __m512 A)
+{
+  return (__m512)_mm512_mask_and_epi32((__m512i)W, K, 
_mm512_set1_epi32(0x7FFF),(__m512i)A) ;
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_abs_pd(__m512d A)
+{
+  return 
(__m512d)_mm512_and_epi64(_mm512_set1_epi64(0x7FFF),(__v8di)A) ;
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_mask_abs_pd(__m512d W, __mmask8 K, __m512d A)
+{
+  return (__m512d)_mm512_mask_and_epi64((__v8di)W, K, 
_mm512_set1_epi64(0x7FFF),(__v8di)A);
+}
+
 #undef __DEFAULT_FN_ATTRS
 
 #endif // __AVX512FINTRIN_H

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=274542&r1=274541&r2=274542&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Tue Jul  5 07:24:14 2016
@@ -1410,25 +1410,33 @@ __mmask8 test_mm512_mask_cmp_epu64_mask(
 
 __m512i test_mm512_mask_and_epi32(__m512i __src,__mmask16 __k, __m512i __a, 
__m512i __b) {
   // CHECK-LABEL: @test_mm512_mask_and_epi32
-  // CHECK: @llvm.x86.avx512.mask.pand.d.512
+  // CHECK: and <16 x i32> 
+  // CHECK: %[[MASK:.*]] = bitcast i16 %{{.*}} to <16 x i1>
+  // CHECK: select <16 x i1> %[[MASK]], <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_mask_and_epi32(__src, __k,__a, __b);
 }
 
 __m512i test_mm512_maskz_and_epi32(__mmask16 __k, __m512i __a, __m512i __b) {
   // CHECK-LABEL: @test_mm512_maskz_and_epi32
-  // CHECK: @llvm.x86.avx512.mask.pand.d.512
+  // CHECK: and <16 x i32> 
+  // CHECK: %[[MASK:.*]] = bitcast i16 %{{.*}} to <16 x i1>
+  // CHECK: select <16 x i1> %[[MASK]], <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
  

Re: [PATCH] D21973: [AVX512] add float/double abs intrinsics

2016-07-05 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274542: [X86][AVX512F]  add float/double abs intrinsics 
(authored by abadouh).

Changed prior to commit:
  http://reviews.llvm.org/D21973?vs=62679&id=62737#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21973

Files:
  cfe/trunk/lib/Headers/avx512fintrin.h
  cfe/trunk/test/CodeGen/avx512f-builtins.c

Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -515,19 +515,16 @@
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_mask_and_epi32(__m512i __src, __mmask16 __k, __m512i __a, __m512i __b)
 {
-  return (__m512i) __builtin_ia32_pandd512_mask((__v16si) __a,
-  (__v16si) __b,
-  (__v16si) __src,
-  (__mmask16) __k);
+  return (__m512i) __builtin_ia32_selectd_512 ((__mmask16) __k,
+(__v16si) _mm512_and_epi32(__a, __b),
+(__v16si) __src);
 }
+
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_maskz_and_epi32(__mmask16 __k, __m512i __a, __m512i __b)
 {
-  return (__m512i) __builtin_ia32_pandd512_mask((__v16si) __a,
-  (__v16si) __b,
-  (__v16si)
-  _mm512_setzero_si512 (),
-  (__mmask16) __k);
+  return (__m512i) _mm512_mask_and_epi32(_mm512_setzero_si512 (), 
+ __k, __a, __b);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
@@ -539,19 +536,16 @@
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_mask_and_epi64(__m512i __src, __mmask8 __k, __m512i __a, __m512i __b)
 {
-  return (__m512i) __builtin_ia32_pandq512_mask ((__v8di) __a,
-  (__v8di) __b,
-  (__v8di) __src,
-  (__mmask8) __k);
+return (__m512i) __builtin_ia32_selectq_512 ((__mmask8) __k,
+(__v8di) _mm512_and_epi64(__a, __b),
+(__v8di) __src);
 }
+
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_maskz_and_epi64(__mmask8 __k, __m512i __a, __m512i __b)
 {
-  return (__m512i) __builtin_ia32_pandq512_mask ((__v8di) __a,
-  (__v8di) __b,
-  (__v8di)
-  _mm512_setzero_si512 (),
-  (__mmask8) __k);
+  return (__m512i) _mm512_mask_and_epi64((__v8di)_mm512_setzero_si512 (), 
+ __k, __a, __b);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
@@ -9539,6 +9533,30 @@
   _mm512_set_ps((e15),(e14),(e13),(e12),(e11),(e10),(e9),(e8),(e7),(e6),(e5), \
 (e4),(e3),(e2),(e1),(e0))
 
+static __inline__ __m512 __DEFAULT_FN_ATTRS
+_mm512_abs_ps(__m512 A)
+{
+  return (__m512)_mm512_and_epi32(_mm512_set1_epi32(0x7FFF),(__m512i)A) ;
+}
+
+static __inline__ __m512 __DEFAULT_FN_ATTRS
+_mm512_mask_abs_ps(__m512 W, __mmask16 K, __m512 A)
+{
+  return (__m512)_mm512_mask_and_epi32((__m512i)W, K, _mm512_set1_epi32(0x7FFF),(__m512i)A) ;
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_abs_pd(__m512d A)
+{
+  return (__m512d)_mm512_and_epi64(_mm512_set1_epi64(0x7FFF),(__v8di)A) ;
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_mask_abs_pd(__m512d W, __mmask8 K, __m512d A)
+{
+  return (__m512d)_mm512_mask_and_epi64((__v8di)W, K, _mm512_set1_epi64(0x7FFF),(__v8di)A);
+}
+
 #undef __DEFAULT_FN_ATTRS
 
 #endif // __AVX512FINTRIN_H
Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -1410,25 +1410,33 @@
 
 __m512i test_mm512_mask_and_epi32(__m512i __src,__mmask16 __k, __m512i __a, __m512i __b) {
   // CHECK-LABEL: @test_mm512_mask_and_epi32
-  // CHECK: @llvm.x86.avx512.mask.pand.d.512
+  // CHECK: and <16 x i32> 
+  // CHECK: %[[MASK:.*]] = bitcast i16 %{{.*}} to <16 x i1>
+  // CHECK: select <16 x i1> %[[MASK]], <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_mask_and_epi32(__src, __k,__a, __b);
 }
 
 __m512i test_mm512_maskz_and_epi32(__mmask16 __k, __m512i __a, __m512i __b) {
   // CHECK-LABEL: @test_mm512_maskz_and_epi32
-  // CHECK: @llvm.x86.avx512.mask.pand.d.512
+  // CHECK: and <16 x i32> 
+  // CHECK: %[[MASK:.*]] = bitcast i16 %{{.*}} to <16 x i1>
+  // CHECK: select <16 x i1> %[[MASK]], <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_maskz_and_epi32(__k,__a, __b);
 }
 
 __m512i test_mm512_mask_and_epi64(__m512i __src,__mmask8 __k, __m512i __a, __m512i __b) {
   // CHECK-LABEL: @test_mm512_mask_and_epi64
-  // CHECK: @llvm.x86.avx512.mask.pand.q.512
+  // CHECK: %[[AND_RES:.*]] = and <8 x i64>
+  // CHECK: %[[MASK:.*]] = bitcast i8 %{{.*}} to <8 x i1>
+  // CHECK: select <8 x i1> %[[MASK]], <8 x i64> %[[AND_RES]], <8 x i64> %{{.*}}
   return _mm512_mask_and_epi64(__src, __k,__a, __b);
 }
 
 __m512i test_mm512_maskz_and_epi64(__mmask8 __k, __m512i __a, __m512i __b) {

[PATCH] D21991: [libunwind][ARM] Improve unwinder stack usage - Make WMMX support optional

2016-07-05 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added reviewers: jroelofs, bcraig.
rmaprath added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

These registers are only available on a limited set of ARM targets (those based 
on XScale). Other targets should not have to pay the cost of these.

This patch shaves off about ~300 bytes of stack usage and ~1KB of code-size.

http://reviews.llvm.org/D21991

Files:
  CMakeLists.txt
  include/__libunwind_config.h
  src/Registers.hpp
  src/Unwind-EHABI.cpp
  src/UnwindRegistersRestore.S
  src/UnwindRegistersSave.S

Index: src/UnwindRegistersSave.S
===
--- src/UnwindRegistersSave.S
+++ src/UnwindRegistersSave.S
@@ -378,6 +378,8 @@
   vstmia r0, {d16-d31}
   JMP(lr)
 
+#if defined(_LIBUNWIND_ARM_WMMX)
+
 @
 @ static void libunwind::Registers_arm::saveiWMMX(unw_fpreg_t* values)
 @
@@ -422,6 +424,8 @@
 #endif
   JMP(lr)
 
+#endif
+
 #elif defined(__or1k__)
 
 #
Index: src/UnwindRegistersRestore.S
===
--- src/UnwindRegistersRestore.S
+++ src/UnwindRegistersRestore.S
@@ -383,6 +383,8 @@
   vldmia r0, {d16-d31}
   JMP(lr)
 
+#if defined(_LIBUNWIND_ARM_WMMX)
+
 @
 @ static void libunwind::Registers_arm::restoreiWMMX(unw_fpreg_t* values)
 @
@@ -427,6 +429,8 @@
 #endif
   JMP(lr)
 
+#endif
+
 #elif defined(__or1k__)
 
 DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind14Registers_or1k6jumptoEv)
Index: src/Unwind-EHABI.cpp
===
--- src/Unwind-EHABI.cpp
+++ src/Unwind-EHABI.cpp
@@ -351,6 +351,7 @@
 }
 case 0xc0: {
   switch (byte) {
+#if defined(_LIBUNWIND_ARM_WMMX)
 case 0xc0:
 case 0xc1:
 case 0xc2:
@@ -378,6 +379,7 @@
   _Unwind_VRS_Pop(context, _UVRSC_WMMXC, v, _UVRSD_DOUBLE);
   break;
 }
+#endif
 case 0xc8:
 case 0xc9: {
   uint8_t v = getByte(data, offset++);
@@ -771,13 +773,6 @@
  *(unw_word_t *)valuep) == UNW_ESUCCESS
  ? _UVRSR_OK
  : _UVRSR_FAILED;
-case _UVRSC_WMMXC:
-  if (representation != _UVRSD_UINT32 || regno > 3)
-return _UVRSR_FAILED;
-  return unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno),
- *(unw_word_t *)valuep) == UNW_ESUCCESS
- ? _UVRSR_OK
- : _UVRSR_FAILED;
 case _UVRSC_VFP:
   if (representation != _UVRSD_VFPX && representation != _UVRSD_DOUBLE)
 return _UVRSR_FAILED;
@@ -794,13 +789,22 @@
*(unw_fpreg_t *)valuep) == UNW_ESUCCESS
  ? _UVRSR_OK
  : _UVRSR_FAILED;
+#if defined(_LIBUNWIND_ARM_WMMX)
+case _UVRSC_WMMXC:
+  if (representation != _UVRSD_UINT32 || regno > 3)
+return _UVRSR_FAILED;
+  return unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno),
+ *(unw_word_t *)valuep) == UNW_ESUCCESS
+ ? _UVRSR_OK
+ : _UVRSR_FAILED;
 case _UVRSC_WMMXD:
   if (representation != _UVRSD_DOUBLE || regno > 31)
 return _UVRSR_FAILED;
   return unw_set_fpreg(cursor, (unw_regnum_t)(UNW_ARM_WR0 + regno),
*(unw_fpreg_t *)valuep) == UNW_ESUCCESS
  ? _UVRSR_OK
  : _UVRSR_FAILED;
+#endif
   }
   _LIBUNWIND_ABORT("unsupported register class");
 }
@@ -819,13 +823,6 @@
  (unw_word_t *)valuep) == UNW_ESUCCESS
  ? _UVRSR_OK
  : _UVRSR_FAILED;
-case _UVRSC_WMMXC:
-  if (representation != _UVRSD_UINT32 || regno > 3)
-return _UVRSR_FAILED;
-  return unw_get_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno),
- (unw_word_t *)valuep) == UNW_ESUCCESS
- ? _UVRSR_OK
- : _UVRSR_FAILED;
 case _UVRSC_VFP:
   if (representation != _UVRSD_VFPX && representation != _UVRSD_DOUBLE)
 return _UVRSR_FAILED;
@@ -842,13 +839,22 @@
(unw_fpreg_t *)valuep) == UNW_ESUCCESS
  ? _UVRSR_OK
  : _UVRSR_FAILED;
+#if defined(_LIBUNWIND_ARM_WMMX)
+case _UVRSC_WMMXC:
+  if (representation != _UVRSD_UINT32 || regno > 3)
+return _UVRSR_FAILED;
+  return unw_get_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno),
+ (unw_word_t *)valuep) == UNW_ESUCCESS
+ ? _UVRSR_OK
+ : _UVRSR_FAILED;
 case _UVRSC_WMMXD:
   if (representation != _UVRSD_DOUBLE || regno > 31)
 return _UVRSR_FAILED;
   return unw_get_fpreg(cursor, (unw_regnum_t)(UNW_ARM_WR0 + regno),
(unw_fpreg_t *)valuep) == UNW_ESUCCESS
  ? _UVRSR_OK
  : _UVRSR_FAILED;
+#endif
   }
   _LIBUNWIND_ABORT("unsuppor

Re: [PATCH] D21176: Mark invalid RecordDecls as completed.

2016-07-05 Thread Erik Verbruggen via cfe-commits
erikjv added a comment.

ping?


http://reviews.llvm.org/D21176



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


Re: [PATCH] D15926: Do not print certain warnings when input is a header.

2016-07-05 Thread Erik Verbruggen via cfe-commits
erikjv added a comment.

ping?


http://reviews.llvm.org/D15926



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


r274544 - [X86][AVX512] Converted the VBROADCAST intrinsics to generic IR

2016-07-05 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Tue Jul  5 07:59:33 2016
New Revision: 274544

URL: http://llvm.org/viewvc/llvm-project?rev=274544&view=rev
Log:
[X86][AVX512] Converted the VBROADCAST intrinsics to generic IR

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

Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=274544&r1=274543&r2=274544&view=diff
==
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Tue Jul  5 07:59:33 2016
@@ -2266,25 +2266,28 @@ _mm512_movm_epi16 (__mmask32 __A)
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_broadcastb_epi8 (__m128i __A)
 {
-  return (__m512i) __builtin_ia32_pbroadcastb512_mask ((__v16qi) __A,
-   (__v64qi) _mm512_setzero_si512(),
-   (__mmask64) -1);
+  return (__m512i)__builtin_shufflevector((__v16qi) __A,
+  (__v16qi)_mm_undefined_si128(),
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_mask_broadcastb_epi8 (__m512i __O, __mmask64 __M, __m128i __A)
 {
-  return (__m512i) __builtin_ia32_pbroadcastb512_mask ((__v16qi) __A,
-   (__v64qi) __O,
-   __M);
+  return (__m512i)__builtin_ia32_selectb_512(__M,
+ (__v64qi) 
_mm512_broadcastb_epi8(__A),
+ (__v64qi) __O);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_maskz_broadcastb_epi8 (__mmask64 __M, __m128i __A)
 {
-  return (__m512i) __builtin_ia32_pbroadcastb512_mask ((__v16qi) __A,
-   (__v64qi) _mm512_setzero_qi(),
-   __M);
+  return (__m512i)__builtin_ia32_selectb_512(__M,
+ (__v64qi) 
_mm512_broadcastb_epi8(__A),
+ (__v64qi) _mm512_setzero_si512());
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
@@ -2306,25 +2309,26 @@ _mm512_maskz_set1_epi16 (__mmask32 __M,
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_broadcastw_epi16 (__m128i __A)
 {
-  return (__m512i) __builtin_ia32_pbroadcastw512_mask ((__v8hi) __A,
-   (__v32hi) _mm512_setzero_si512(),
-   (__mmask32) -1);
+  return (__m512i)__builtin_shufflevector((__v8hi) __A,
+  (__v8hi)_mm_undefined_si128(),
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_mask_broadcastw_epi16 (__m512i __O, __mmask32 __M, __m128i __A)
 {
-  return (__m512i) __builtin_ia32_pbroadcastw512_mask ((__v8hi) __A,
-   (__v32hi) __O,
-   __M);
+  return (__m512i)__builtin_ia32_selectw_512(__M,
+ (__v32hi) 
_mm512_broadcastw_epi16(__A),
+ (__v32hi) __O);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_maskz_broadcastw_epi16 (__mmask32 __M, __m128i __A)
 {
-  return (__m512i) __builtin_ia32_pbroadcastw512_mask ((__v8hi) __A,
-   (__v32hi) _mm512_setzero_hi(),
-   __M);
+  return (__m512i)__builtin_ia32_selectw_512(__M,
+ (__v32hi) 
_mm512_broadcastw_epi16(__A),
+ (__v32hi) _mm512_setzero_si512());
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=274544&r1=274543&r2=274544&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Tue Jul  5 07:59:33 2016
@@ -195,54 +195,54 @@ _mm512_undefined_epi32(void)
 {
   return (__m512i)__builtin_ia32_undef512();
 }
+
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_broadcastd_epi32 (__m128i __A)
 {
-  return (__m512i) __builtin_ia32_pbroadcastd512 ((__v4si) __A,
-  

Re: [PATCH] D21075: Correct invalid end location in diagnostics for some identifiers.

2016-07-05 Thread Erik Verbruggen via cfe-commits
erikjv added a comment.

I'll add tests in the next diff, but I'd like to know if these changes are ok.



Comment at: lib/Sema/SemaType.cpp:1339
@@ +1338,3 @@
+auto R = DS.getSourceRange();
+if (R.getEnd().isInvalid())
+  R.setEnd(R.getBegin());

klimek wrote:
> Do you know in which cases we get source ranges that are half valid?
In Parser::ParseTypeofSpecifier the 'cast range' for a typeof(...) is parsed, 
but is found to be invalid. Then it explicitly sets the DeclSpec's end location 
to an invalid location.


http://reviews.llvm.org/D21075



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


Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-07-05 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: include/clang/AST/Decl.h:3249
@@ -3248,1 +3248,3 @@
 
+  /// This is true if this struct ends with an array marked 'flexible_array'.
+  bool HasFlexibleArrayAttr : 1;

Does this require a bit, or can this simply be looked up as needed?


Comment at: include/clang/Basic/Attr.td:18
@@ -17,2 +17,3 @@
 def DocCatVariable : DocumentationCategory<"Variable Attributes">;
+def DocCatField : DocumentationCategory<"Field Attributes">;
 def DocCatType : DocumentationCategory<"Type Attributes">;

Instead of "field", how about "non-static data member"? That should make it 
more clear as to what it pertains to.


Comment at: include/clang/Basic/Attr.td:2282
@@ +2281,3 @@
+  let Subjects = SubjectList<[Field], ErrorDiag,
+ "ExpectedField">;
+  let Documentation = [FlexibleArrayDocs];

Should be able to drop the string literal here; it should work by default. If 
it doesn't, then ClangAttrEmitter.cpp should be updated to properly handle it.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2165
@@ +2164,3 @@
+def err_flexible_array_attribute : Error<
+  "'flexible_array' attribute only applies to %0">;
+def err_flexible_array_nested : Error<

This should be updated to use a %select instead of passing string literals (for 
eventual localization purposes).


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2520
@@ -2516,1 +2519,3 @@
+  "variables, functions, methods, types, enumerations, enumerators, labels, 
and non-static data members|"
+  "fields}1">,
   InGroup;

non-static data members instead of fields.


Comment at: lib/AST/ExprConstant.cpp:170
@@ +169,3 @@
+/// Indicator of whether the last array added is marked flexible_array.
+bool IsFlexibleArray : 1;
+

Is the bit required here as well, or can this be queried as-needed?


Comment at: lib/AST/ExprConstant.cpp:1133
@@ -1128,1 +1132,3 @@
+void addArray(EvalInfo &Info, const Expr *E, const ConstantArrayType *CAT,
+  bool HasFlexibleArrayAttr) {
   if (checkSubobject(Info, E, CSK_ArrayToPointer))

Perhaps this should be a default argument, since it's false almost everywhere?


Comment at: lib/AST/ExprConstant.cpp:5184-5185
@@ +5183,4 @@
+  bool HasFlexibleArrayAttr = false;
+  if (auto *ME = dyn_cast(SubExpr)) {
+auto *FD = dyn_cast(ME->getMemberDecl());
+HasFlexibleArrayAttr = FD && FD->hasAttr();

Should be `const` qualified.


Comment at: lib/Sema/SemaDeclAttr.cpp:1808-1809
@@ +1807,4 @@
+const AttributeList &Attr) {
+  auto *FD = cast(D);
+  auto *CAT = dyn_cast(FD->getType().getTypePtr());
+

Should be `const`


http://reviews.llvm.org/D21453



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


Re: [PATCH] D20352: Add XRay flags to Clang

2016-07-05 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: include/clang/Basic/Attr.td:436
@@ +435,3 @@
+   CXX11<"clang", "xray_never_instrument">];
+  let Subjects = SubjectList<[CXXMethod, ObjCMethod, Function], WarnDiag,
+  "ExpectedFunctionOrMethod">;

Then ClangAttrEmitter.cpp needs to be updated as well (this is a reasonable 
case to automatically support, I think).


Comment at: include/clang/Basic/AttrDocs.td:2457
@@ +2456,3 @@
+  let Content = [{
+``__attribute__((xray_always_instrument))`` or 
``[[clang:xray_always_instrument]]`` is used to mark member functions (in C++), 
methods (in Objective C), and free functions (in C, C++, and Objective C) to be 
instrumented with XRay. This will cause the function to always have space at 
the beginning and exit points to allow for runtime patching.
+

I get the impression they do conflict because they have overlapping 
functionality (both provide prologue space for runtime patching, for instance). 
It would be best to have only one attribute if we can do it.


Comment at: lib/CodeGen/CodeGenFunction.cpp:696
@@ +695,3 @@
+if (const auto *XRayAttr = D->getAttr()) {
+  if (XRayAttr->alwaysXRayInstrument()) {
+Fn->addFnAttr("function-instrument", "xray-always");

Yes, this is the right way to solve it. Thanks!

However, you should elide the braces when there's only a single statement (per 
our coding standards).


http://reviews.llvm.org/D20352



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


Re: [PATCH] D15994: Allow for unfinished #if blocks in preambles.

2016-07-05 Thread Erik Verbruggen via cfe-commits
erikjv updated the summary for this revision.
erikjv updated this revision to Diff 62748.
erikjv added a comment.

This version stores/loads the conditional stack in the preprocessor the the 
generated pch file. It suppresses errors about unfinished conditional 
preprocessor blocks, and after restoring, it will check if the block is closed 
in the main file.


http://reviews.llvm.org/D15994

Files:
  include/clang/Lex/Preprocessor.h
  include/clang/Lex/PreprocessorLexer.h
  include/clang/Lex/PreprocessorOptions.h
  include/clang/Serialization/ASTBitCodes.h
  lib/Frontend/ASTUnit.cpp
  lib/Lex/Lexer.cpp
  lib/Lex/PPLexerChange.cpp
  lib/Lex/Preprocessor.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp
  test/Lexer/preamble.c
  test/Lexer/preamble2.c

Index: test/Lexer/preamble2.c
===
--- /dev/null
+++ test/Lexer/preamble2.c
@@ -0,0 +1,19 @@
+// Preamble detection test: header with an include guard.
+#ifndef HEADER_H
+#define HEADER_H
+#include "foo"
+int bar;
+#endif
+
+// This test checks for detection of the preamble of a file, which
+// includes all of the starting comments and #includes.
+
+// RUN: %clang_cc1 -print-preamble %s > %t
+// RUN: echo END. >> %t
+// RUN: FileCheck < %t %s
+
+// CHECK: // Preamble detection test: header with an include guard.
+// CHECK-NEXT: #ifndef HEADER_H
+// CHECK-NEXT: #define HEADER_H
+// CHECK-NEXT: #include "foo"
+// CHECK-NEXT: END.
Index: test/Lexer/preamble.c
===
--- test/Lexer/preamble.c
+++ test/Lexer/preamble.c
@@ -9,15 +9,12 @@
 #pragma unknown
 #endif
 #ifdef WIBBLE
-#include "honk"
-#else
-int foo();
+#include "foo"
+int bar;
 #endif
 
 // This test checks for detection of the preamble of a file, which
-// includes all of the starting comments and #includes. Note that any
-// changes to the preamble part of this file must be mirrored in
-// Inputs/preamble.txt, since we diff against it.
+// includes all of the starting comments and #includes.
 
 // RUN: %clang_cc1 -print-preamble %s > %t
 // RUN: echo END. >> %t
@@ -33,4 +30,6 @@
 // CHECK-NEXT: #endif
 // CHECK-NEXT: #pragma unknown
 // CHECK-NEXT: #endif
+// CHECK-NEXT: #ifdef WIBBLE
+// CHECK-NEXT: #include "foo"
 // CHECK-NEXT: END.
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -983,6 +983,7 @@
   RECORD(POINTERS_TO_MEMBERS_PRAGMA_OPTIONS);
   RECORD(UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES);
   RECORD(DELETE_EXPRS_TO_ANALYZE);
+  RECORD(PP_CONDITIONAL_STACK);
 
   // SourceManager Block.
   BLOCK(SOURCE_MANAGER_BLOCK);
@@ -2140,6 +2141,17 @@
 Stream.EmitRecord(PP_COUNTER_VALUE, Record);
   }
 
+  if (PP.IsRecordingPreamble() && PP.HasRecordedPreamble()) {
+for (const auto &Cond : PP.getPreambleConditionalStack()) {
+  AddSourceLocation(Cond.IfLoc, Record);
+  Record.push_back(Cond.WasSkipping);
+  Record.push_back(Cond.FoundNonSkip);
+  Record.push_back(Cond.FoundElse);
+}
+Stream.EmitRecord(PP_CONDITIONAL_STACK, Record);
+Record.clear();
+  }
+
   // Enter the preprocessor block.
   Stream.EnterSubblock(PREPROCESSOR_BLOCK_ID, 3);
 
Index: lib/Serialization/ASTReader.cpp
===
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -2803,6 +2803,20 @@
   }
   break;
 
+case PP_CONDITIONAL_STACK:
+  if (!Record.empty()) {
+SmallVector ConditionalStack;
+for (unsigned Idx = 0, N = Record.size() - 1; Idx < N; /* in loop */) {
+  auto loc = ReadSourceLocation(F, Record, Idx);
+  bool WasSkipping = Record[Idx++];
+  bool FoundNonSkip = Record[Idx++];
+  bool FoundElse = Record[Idx++];
+  ConditionalStack.push_back({ loc, WasSkipping, FoundNonSkip, FoundElse });
+}
+PP.setReplayablePreambleConditionalStack(ConditionalStack);
+  }
+  break;
+
 case PP_COUNTER_VALUE:
   if (!Record.empty() && Listener)
 Listener->ReadCounter(F, Record[0]);
Index: lib/Lex/Preprocessor.cpp
===
--- lib/Lex/Preprocessor.cpp
+++ lib/Lex/Preprocessor.cpp
@@ -140,6 +140,9 @@
 Ident_GetExceptionInfo = Ident_GetExceptionCode = nullptr;
 Ident_AbnormalTermination = nullptr;
   }
+
+  if (this->PPOpts->PreambleGeneration)
+PreambleConditionalStack.startRecording();
 }
 
 Preprocessor::~Preprocessor() {
Index: lib/Lex/PPLexerChange.cpp
===
--- lib/Lex/PPLexerChange.cpp
+++ lib/Lex/PPLexerChange.cpp
@@ -130,6 +130,11 @@
 Callbacks->FileChanged(CurLexer->getFileLoc(),
PPCallbacks::EnterFile, FileType);
   }
+
+  if (PreambleConditionalStack.isReplaying()) {
+CurPPLexe

Re: [PATCH] D21936: [clang-tidy] UnnecessaryValueParamCheck - only warn for virtual methods

2016-07-05 Thread Felix Berger via cfe-commits
flx removed rL LLVM as the repository for this revision.
flx updated this revision to Diff 62750.

http://reviews.llvm.org/D21936

Files:
  clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  test/clang-tidy/performance-unnecessary-value-param.cpp

Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -182,6 +182,19 @@
   }
 };
 
+struct VirtualMethodWarningOnly {
+  virtual void methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:66: warning: the parameter 'T' is copied
+  // CHECK-FIXES: virtual void 
methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+  virtual ~VirtualMethodWarningOnly() {}
+};
+
+struct PositiveNonVirualMethod {
+  void method(const ExpensiveToCopyType T) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:41: warning: the const qualified parameter 
'T' is copied
+  // CHECK-FIXES: void method(const ExpensiveToCopyType& T) {}
+};
+
 struct NegativeDeletedMethod {
   ~NegativeDeletedMethod() {}
   NegativeDeletedMethod& operator=(NegativeDeletedMethod N) = delete;
Index: clang-tidy/performance/UnnecessaryValueParamCheck.cpp
===
--- clang-tidy/performance/UnnecessaryValueParamCheck.cpp
+++ clang-tidy/performance/UnnecessaryValueParamCheck.cpp
@@ -118,8 +118,10 @@
   "invocation but only used as a const reference; "
   "consider making it a const reference")
   << paramNameOrIndex(Param->getName(), Index);
-  // Do not propose fixes in macros since we cannot place them correctly.
-  if (Param->getLocStart().isMacroID())
+  // Do not propose fixes in macros since we cannot place them correctly, or if
+  // function is virtual as it might break overrides.
+  const auto *Method = llvm::dyn_cast(Function);
+  if (Param->getLocStart().isMacroID() || (Method && Method->isVirtual()))
 return;
   for (const auto *FunctionDecl = Function; FunctionDecl != nullptr;
FunctionDecl = FunctionDecl->getPreviousDecl()) {


Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -182,6 +182,19 @@
   }
 };
 
+struct VirtualMethodWarningOnly {
+  virtual void methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:66: warning: the parameter 'T' is copied
+  // CHECK-FIXES: virtual void methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+  virtual ~VirtualMethodWarningOnly() {}
+};
+
+struct PositiveNonVirualMethod {
+  void method(const ExpensiveToCopyType T) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:41: warning: the const qualified parameter 'T' is copied
+  // CHECK-FIXES: void method(const ExpensiveToCopyType& T) {}
+};
+
 struct NegativeDeletedMethod {
   ~NegativeDeletedMethod() {}
   NegativeDeletedMethod& operator=(NegativeDeletedMethod N) = delete;
Index: clang-tidy/performance/UnnecessaryValueParamCheck.cpp
===
--- clang-tidy/performance/UnnecessaryValueParamCheck.cpp
+++ clang-tidy/performance/UnnecessaryValueParamCheck.cpp
@@ -118,8 +118,10 @@
   "invocation but only used as a const reference; "
   "consider making it a const reference")
   << paramNameOrIndex(Param->getName(), Index);
-  // Do not propose fixes in macros since we cannot place them correctly.
-  if (Param->getLocStart().isMacroID())
+  // Do not propose fixes in macros since we cannot place them correctly, or if
+  // function is virtual as it might break overrides.
+  const auto *Method = llvm::dyn_cast(Function);
+  if (Param->getLocStart().isMacroID() || (Method && Method->isVirtual()))
 return;
   for (const auto *FunctionDecl = Function; FunctionDecl != nullptr;
FunctionDecl = FunctionDecl->getPreviousDecl()) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21936: [clang-tidy] UnnecessaryValueParamCheck - only warn for virtual methods

2016-07-05 Thread Felix Berger via cfe-commits
flx added inline comments.


Comment at: test/clang-tidy/performance-unnecessary-value-param.cpp:234
@@ +233,3 @@
+};
+
+struct PositiveNonVirualMethod {

alexfh wrote:
> Please add a test for an override not explicitly marked "virtual" or 
> "override".
That case is already covered in line 180. I moved these tests up now to have 
them grouped together.


http://reviews.llvm.org/D21936



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


Re: [PATCH] D15926: Do not print certain warnings when input is a header.

2016-07-05 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman.


Comment at: include/clang/Basic/LangOptions.h:131
@@ +130,3 @@
+  /// input is a header file (i.e. -x c-header).
+  bool IsHeaderFile = false;
+

Should move the initializer to the constructor (not certain that MSVC 2013 
supports this construct, but it's also more consistent).


http://reviews.llvm.org/D15926



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


[clang-tools-extra] r274552 - [clang-tidy] UnnecessaryValueParamCheck - only warn for virtual methods

2016-07-05 Thread Felix Berger via cfe-commits
Author: flx
Date: Tue Jul  5 09:40:44 2016
New Revision: 274552

URL: http://llvm.org/viewvc/llvm-project?rev=274552&view=rev
Log:
[clang-tidy] UnnecessaryValueParamCheck - only warn for virtual methods

Summary:

As changing virtual methods could break method overrides disable applying the 
fix and just warn.

Reviewers: alexfh, sbenza

Subscribers: cfe-commits

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

Modified:

clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp

clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp?rev=274552&r1=274551&r2=274552&view=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp 
(original)
+++ 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp 
Tue Jul  5 09:40:44 2016
@@ -118,8 +118,10 @@ void UnnecessaryValueParamCheck::check(c
   "invocation but only used as a const reference; "
   "consider making it a const reference")
   << paramNameOrIndex(Param->getName(), Index);
-  // Do not propose fixes in macros since we cannot place them correctly.
-  if (Param->getLocStart().isMacroID())
+  // Do not propose fixes in macros since we cannot place them correctly, or if
+  // function is virtual as it might break overrides.
+  const auto *Method = llvm::dyn_cast(Function);
+  if (Param->getLocStart().isMacroID() || (Method && Method->isVirtual()))
 return;
   for (const auto *FunctionDecl = Function; FunctionDecl != nullptr;
FunctionDecl = FunctionDecl->getPreviousDecl()) {

Modified: 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp?rev=274552&r1=274551&r2=274552&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp 
(original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp 
Tue Jul  5 09:40:44 2016
@@ -182,6 +182,19 @@ struct NegativeOverriddenMethod : public
   }
 };
 
+struct VirtualMethodWarningOnly {
+  virtual void methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:66: warning: the parameter 'T' is copied
+  // CHECK-FIXES: virtual void 
methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+  virtual ~VirtualMethodWarningOnly() {}
+};
+
+struct PositiveNonVirualMethod {
+  void method(const ExpensiveToCopyType T) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:41: warning: the const qualified parameter 
'T' is copied
+  // CHECK-FIXES: void method(const ExpensiveToCopyType& T) {}
+};
+
 struct NegativeDeletedMethod {
   ~NegativeDeletedMethod() {}
   NegativeDeletedMethod& operator=(NegativeDeletedMethod N) = delete;


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


Re: [PATCH] D21936: [clang-tidy] UnnecessaryValueParamCheck - only warn for virtual methods

2016-07-05 Thread Felix Berger via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274552: [clang-tidy] UnnecessaryValueParamCheck - only warn 
for virtual methods (authored by flx).

Changed prior to commit:
  http://reviews.llvm.org/D21936?vs=62750&id=62752#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21936

Files:
  clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp

Index: 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
===
--- 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
+++ 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
@@ -118,8 +118,10 @@
   "invocation but only used as a const reference; "
   "consider making it a const reference")
   << paramNameOrIndex(Param->getName(), Index);
-  // Do not propose fixes in macros since we cannot place them correctly.
-  if (Param->getLocStart().isMacroID())
+  // Do not propose fixes in macros since we cannot place them correctly, or if
+  // function is virtual as it might break overrides.
+  const auto *Method = llvm::dyn_cast(Function);
+  if (Param->getLocStart().isMacroID() || (Method && Method->isVirtual()))
 return;
   for (const auto *FunctionDecl = Function; FunctionDecl != nullptr;
FunctionDecl = FunctionDecl->getPreviousDecl()) {
Index: 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
+++ 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -182,6 +182,19 @@
   }
 };
 
+struct VirtualMethodWarningOnly {
+  virtual void methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:66: warning: the parameter 'T' is copied
+  // CHECK-FIXES: virtual void 
methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+  virtual ~VirtualMethodWarningOnly() {}
+};
+
+struct PositiveNonVirualMethod {
+  void method(const ExpensiveToCopyType T) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:41: warning: the const qualified parameter 
'T' is copied
+  // CHECK-FIXES: void method(const ExpensiveToCopyType& T) {}
+};
+
 struct NegativeDeletedMethod {
   ~NegativeDeletedMethod() {}
   NegativeDeletedMethod& operator=(NegativeDeletedMethod N) = delete;


Index: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
@@ -118,8 +118,10 @@
   "invocation but only used as a const reference; "
   "consider making it a const reference")
   << paramNameOrIndex(Param->getName(), Index);
-  // Do not propose fixes in macros since we cannot place them correctly.
-  if (Param->getLocStart().isMacroID())
+  // Do not propose fixes in macros since we cannot place them correctly, or if
+  // function is virtual as it might break overrides.
+  const auto *Method = llvm::dyn_cast(Function);
+  if (Param->getLocStart().isMacroID() || (Method && Method->isVirtual()))
 return;
   for (const auto *FunctionDecl = Function; FunctionDecl != nullptr;
FunctionDecl = FunctionDecl->getPreviousDecl()) {
Index: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -182,6 +182,19 @@
   }
 };
 
+struct VirtualMethodWarningOnly {
+  virtual void methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:66: warning: the parameter 'T' is copied
+  // CHECK-FIXES: virtual void methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+  virtual ~VirtualMethodWarningOnly() {}
+};
+
+struct PositiveNonVirualMethod {
+  void method(const ExpensiveToCopyType T) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:41: warning: the const qualified parameter 'T' is copied
+  // CHECK-FIXES: void method(const ExpensiveToCopyType& T) {}
+};
+
 struct NegativeDeletedMethod {
   ~NegativeDeletedMethod() {}
   NegativeDeletedMethod& operator=(NegativeDeletedMethod N) = delete;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r274554 - [X86][AVX512] Remove vector BROADCAST builtins.

2016-07-05 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Tue Jul  5 09:49:31 2016
New Revision: 274554

URL: http://llvm.org/viewvc/llvm-project?rev=274554&view=rev
Log:
[X86][AVX512] Remove vector BROADCAST builtins.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=274554&r1=274553&r2=274554&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Tue Jul  5 09:49:31 2016
@@ -996,8 +996,6 @@ TARGET_BUILTIN(__builtin_ia32_pmuldq512_
 TARGET_BUILTIN(__builtin_ia32_pmuludq512_mask, "V8LLiV16iV16iV8LLiUc", "", 
"avx512f")
 TARGET_BUILTIN(__builtin_ia32_ptestmd512, "UsV16iV16iUs", "", "avx512f")
 TARGET_BUILTIN(__builtin_ia32_ptestmq512, "UcV8LLiV8LLiUc", "", "avx512f")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastd512, "V16iV4iV16iUs","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastq512, "V8LLiV2LLiV8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pbroadcastd512_gpr_mask, "V16iiV16iUs", "", 
"avx512f")
 TARGET_BUILTIN(__builtin_ia32_pbroadcastq512_gpr_mask, "V8LLiLLiV8LLiUc", "", 
"avx512f")
 TARGET_BUILTIN(__builtin_ia32_pbroadcastq512_mem_mask, "V8LLiLLiV8LLiUc", "", 
"avx512f")
@@ -1908,8 +1906,6 @@ TARGET_BUILTIN(__builtin_ia32_broadcastf
 TARGET_BUILTIN(__builtin_ia32_broadcastf64x4_512, "V8dV4dV8dUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_broadcasti32x4_512, "V16iV4iV16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_broadcasti64x4_512, 
"V8LLiV4LLiV8LLiUc","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_broadcastsd512, "V8dV2dV8dUc","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_broadcastss512, "V16fV4fV16fUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_broadcastmb128, "V2LLiUc","","avx512cd,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_broadcastmb256, "V4LLiUc","","avx512cd,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_broadcastmw128, "V4iUs","","avx512cd,avx512vl")
@@ -1927,19 +1923,6 @@ TARGET_BUILTIN(__builtin_ia32_broadcasti
 TARGET_BUILTIN(__builtin_ia32_broadcasti64x2_256_mask, 
"V4LLiV2LLiV4LLiUc","","avx512dq,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_broadcastf32x4_256_mask, 
"V8fV4fV8fUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_broadcasti32x4_256_mask, 
"V8iV4iV8iUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_broadcastsd256_mask, "V4dV2dV4dUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_broadcastss128_mask, "V4fV4fV4fUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_broadcastss256_mask, "V8fV4fV8fUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastw512_mask, 
"V32sV8sV32sUi","","avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastb128_mask, 
"V16cV16cV16cUs","","avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastb256_mask, 
"V32cV16cV32cUi","","avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastw128_mask, 
"V8sV8sV8sUc","","avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastw256_mask, 
"V16sV8sV16sUs","","avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastd128_mask, "V4iV4iV4iUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastd256_mask, "V8iV4iV8iUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastq128_mask, 
"V2LLiV2LLiV2LLiUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastq256_mask, 
"V4LLiV2LLiV4LLiUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastb512_mask, 
"V64cV16cV64cULLi","","avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pbroadcastw512_gpr_mask, 
"V32shV32sUi","","avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pbroadcastw256_gpr_mask, 
"V16shV16sUs","","avx512bw,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pbroadcastw128_gpr_mask, 
"V8ssV8sUc","","avx512bw,avx512vl")


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


Re: [PATCH] D21991: [libunwind][ARM] Improve unwinder stack usage - Make WMMX support optional

2016-07-05 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: CMakeLists.txt:108
@@ -107,2 +107,3 @@
 option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding 
support." OFF)
+option(LIBUNWIND_ENABLE_ARM_WMMX "Enable unwinding support for ARM WMMX 
registers." ON)
 

Buried in one of the .s files, I see a preprocessor definition check for 
__ARM_WMMX.  Can the use of the preprocessor define be used instead of adding a 
new configuration option?


http://reviews.llvm.org/D21991



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


Re: [PATCH] D15121: A new clang-tidy module to find calls to `std::swap`, and change them to use ADL

2016-07-05 Thread Piotr Padlewski via cfe-commits
Prazek added a subscriber: Prazek.


Comment at: test/clang-tidy/misc-StdSwap.cpp:7-11
@@ +6,7 @@
+
+// FIXME: Add something that triggers the check here.
+// FIXME: Verify the applied fix.
+//   * Make the CHECK patterns specific enough and try to make verified lines
+// unique to avoid incorrect matches.
+//   * Use {{}} for regular expressions.
+

template thing


http://reviews.llvm.org/D15121



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


Re: [PATCH] D21295: Add a negative TBAA test

2016-07-05 Thread Anastasia Stulova via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM!

Has this test case been missing from the original commit? If yes, could you 
point to it please! Thanks!


http://reviews.llvm.org/D21295



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


r274559 - [Clang][Feature] Adding CLFLUSHOPT feature and intrinsic to clang

2016-07-05 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Tue Jul  5 10:56:03 2016
New Revision: 274559

URL: http://llvm.org/viewvc/llvm-project?rev=274559&view=rev
Log:
[Clang][Feature] Adding CLFLUSHOPT feature and intrinsic to clang

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


Added:
cfe/trunk/lib/Headers/clflushoptintrin.h
cfe/trunk/test/CodeGen/builtin-clflushopt.c
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/CMakeLists.txt
cfe/trunk/lib/Headers/immintrin.h

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=274559&r1=274558&r2=274559&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Tue Jul  5 10:56:03 2016
@@ -652,6 +652,9 @@ TARGET_BUILTIN(__builtin_ia32_xsavec64,
 TARGET_BUILTIN(__builtin_ia32_xsaves, "vv*ULLi", "", "xsaves")
 TARGET_BUILTIN(__builtin_ia32_xsaves64, "vv*ULLi", "", "xsaves")
 
+//CLFLUSHOPT
+TARGET_BUILTIN(__builtin_ia32_clflushopt, "vc*", "", "clflushopt")
+
 // ADX
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "", "adx")
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "", "adx")

Modified: cfe/trunk/lib/Headers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/CMakeLists.txt?rev=274559&r1=274558&r2=274559&view=diff
==
--- cfe/trunk/lib/Headers/CMakeLists.txt (original)
+++ cfe/trunk/lib/Headers/CMakeLists.txt Tue Jul  5 10:56:03 2016
@@ -27,6 +27,7 @@ set(files
   __clang_cuda_runtime_wrapper.h
   cpuid.h
   cuda_builtin_vars.h
+  clflushoptintrin.h
   emmintrin.h
   f16cintrin.h
   float.h

Added: cfe/trunk/lib/Headers/clflushoptintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/clflushoptintrin.h?rev=274559&view=auto
==
--- cfe/trunk/lib/Headers/clflushoptintrin.h (added)
+++ cfe/trunk/lib/Headers/clflushoptintrin.h Tue Jul  5 10:56:03 2016
@@ -0,0 +1,41 @@
+/*=== clflushoptintrin.h - CLFLUSHOPT intrinsic 
===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use  directly; include  
instead."
+#endif
+
+#ifndef __CLFLUSHOPTINTRIN_H
+#define __CLFLUSHOPTINTRIN_H
+
+/* Define the default attributes for the functions in this file. */
+#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__,  
__target__("clflushopt")))
+
+static __inline__ void __DEFAULT_FN_ATTRS
+_mm_clflushopt(char * __m) {
+  __builtin_ia32_clflushopt(__m);
+}
+
+#undef __DEFAULT_FN_ATTRS
+
+#endif

Modified: cfe/trunk/lib/Headers/immintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/immintrin.h?rev=274559&r1=274558&r2=274559&view=diff
==
--- cfe/trunk/lib/Headers/immintrin.h (original)
+++ cfe/trunk/lib/Headers/immintrin.h Tue Jul  5 10:56:03 2016
@@ -54,6 +54,10 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLFLUSHOPT__)
+#include 
+#endif
+
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
 #include 
 #endif

Added: cfe/trunk/test/CodeGen/builtin-clflushopt.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-clflushopt.c?rev=274559&view=auto
==
--- cfe/trunk/test/CodeGen/builtin-clflushopt.c (added)
+++ cfe/trunk/test/CodeGen/builtin-clflushopt.c Tue Jul  5 10:56:03 2016
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -tar

Re: [PATCH] D21792: [Clang][Feature] Adding CLFLUSHOPT feature and intrinsic to clang

2016-07-05 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274559: [Clang][Feature] Adding CLFLUSHOPT feature and 
intrinsic to clang (authored by mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D21792?vs=62088&id=62759#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21792

Files:
  cfe/trunk/include/clang/Basic/BuiltinsX86.def
  cfe/trunk/lib/Headers/CMakeLists.txt
  cfe/trunk/lib/Headers/clflushoptintrin.h
  cfe/trunk/lib/Headers/immintrin.h
  cfe/trunk/test/CodeGen/builtin-clflushopt.c

Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def
@@ -652,6 +652,9 @@
 TARGET_BUILTIN(__builtin_ia32_xsaves, "vv*ULLi", "", "xsaves")
 TARGET_BUILTIN(__builtin_ia32_xsaves64, "vv*ULLi", "", "xsaves")
 
+//CLFLUSHOPT
+TARGET_BUILTIN(__builtin_ia32_clflushopt, "vc*", "", "clflushopt")
+
 // ADX
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "", "adx")
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "", "adx")
Index: cfe/trunk/test/CodeGen/builtin-clflushopt.c
===
--- cfe/trunk/test/CodeGen/builtin-clflushopt.c
+++ cfe/trunk/test/CodeGen/builtin-clflushopt.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +clflushopt  -emit-llvm -o - -Werror | FileCheck %s
+#define __MM_MALLOC_H
+
+#include 
+void test_mm_clflushopt(char * __m) {
+  //CHECK-LABLE: @test_mm_clflushopt
+  //CHECK: @llvm.x86.clflushopt
+  _mm_clflushopt(__m);
+}
Index: cfe/trunk/lib/Headers/clflushoptintrin.h
===
--- cfe/trunk/lib/Headers/clflushoptintrin.h
+++ cfe/trunk/lib/Headers/clflushoptintrin.h
@@ -0,0 +1,41 @@
+/*=== clflushoptintrin.h - CLFLUSHOPT intrinsic ===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use  directly; include  instead."
+#endif
+
+#ifndef __CLFLUSHOPTINTRIN_H
+#define __CLFLUSHOPTINTRIN_H
+
+/* Define the default attributes for the functions in this file. */
+#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__,  __target__("clflushopt")))
+
+static __inline__ void __DEFAULT_FN_ATTRS
+_mm_clflushopt(char * __m) {
+  __builtin_ia32_clflushopt(__m);
+}
+
+#undef __DEFAULT_FN_ATTRS
+
+#endif
Index: cfe/trunk/lib/Headers/immintrin.h
===
--- cfe/trunk/lib/Headers/immintrin.h
+++ cfe/trunk/lib/Headers/immintrin.h
@@ -54,6 +54,10 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLFLUSHOPT__)
+#include 
+#endif
+
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
 #include 
 #endif
Index: cfe/trunk/lib/Headers/CMakeLists.txt
===
--- cfe/trunk/lib/Headers/CMakeLists.txt
+++ cfe/trunk/lib/Headers/CMakeLists.txt
@@ -27,6 +27,7 @@
   __clang_cuda_runtime_wrapper.h
   cpuid.h
   cuda_builtin_vars.h
+  clflushoptintrin.h
   emmintrin.h
   f16cintrin.h
   float.h
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r274560 - test: Use add_lit_testsuites so that subsets of tests can be specified

2016-07-05 Thread Justin Bogner via cfe-commits
Author: bogner
Date: Tue Jul  5 11:06:12 2016
New Revision: 274560

URL: http://llvm.org/viewvc/llvm-project?rev=274560&view=rev
Log:
test: Use add_lit_testsuites so that subsets of tests can be specified

This creates make/ninja targets like check-clang-codegen and
check-clang-unit, much like LLVM already has. I had to move some input
files into Input directories so they weren't picked up as test
directories.

Added:
cfe/trunk/test/ARCMT/Inputs/with space/
cfe/trunk/test/ARCMT/Inputs/with space/test.h
  - copied, changed from r274559, cfe/trunk/test/ARCMT/with space/test.h
cfe/trunk/test/ARCMT/Inputs/with space/test.h.result
  - copied, changed from r274559, cfe/trunk/test/ARCMT/with 
space/test.h.result
cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in
  - copied, changed from r274559, cfe/trunk/test/ARCMT/with space/test1.m.in
cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in.result
  - copied, changed from r274559, cfe/trunk/test/ARCMT/with 
space/test1.m.in.result
cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in
  - copied, changed from r274559, cfe/trunk/test/ARCMT/with space/test2.m.in
cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in.result
  - copied, changed from r274559, cfe/trunk/test/ARCMT/with 
space/test2.m.in.result
cfe/trunk/test/PCH/Inputs/libroot/
cfe/trunk/test/PCH/Inputs/libroot/usr/
cfe/trunk/test/PCH/Inputs/libroot/usr/include/
cfe/trunk/test/PCH/Inputs/libroot/usr/include/reloc.h
  - copied, changed from r274559, 
cfe/trunk/test/PCH/libroot/usr/include/reloc.h
cfe/trunk/test/PCH/Inputs/libroot/usr/include/reloc2.h
  - copied, changed from r274559, 
cfe/trunk/test/PCH/libroot/usr/include/reloc2.h
Removed:
cfe/trunk/test/ARCMT/with space/test.h
cfe/trunk/test/ARCMT/with space/test.h.result
cfe/trunk/test/ARCMT/with space/test1.m.in
cfe/trunk/test/ARCMT/with space/test1.m.in.result
cfe/trunk/test/ARCMT/with space/test2.m.in
cfe/trunk/test/ARCMT/with space/test2.m.in.result
cfe/trunk/test/PCH/libroot/usr/include/reloc.h
cfe/trunk/test/PCH/libroot/usr/include/reloc2.h
Modified:
cfe/trunk/test/ARCMT/migrate-space-in-path.m
cfe/trunk/test/CMakeLists.txt
cfe/trunk/test/PCH/reloc.c

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test.h (from r274559, 
cfe/trunk/test/ARCMT/with space/test.h)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test.h?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test.h&p1=cfe/trunk/test/ARCMT/with%20space/test.h&r1=274559&r2=274560&rev=274560&view=diff
==
(empty)

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test.h.result (from r274559, 
cfe/trunk/test/ARCMT/with space/test.h.result)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test.h.result?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test.h.result&p1=cfe/trunk/test/ARCMT/with%20space/test.h.result&r1=274559&r2=274560&rev=274560&view=diff
==
(empty)

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in (from r274559, 
cfe/trunk/test/ARCMT/with space/test1.m.in)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test1.m.in?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test1.m.in&p1=cfe/trunk/test/ARCMT/with%20space/test1.m.in&r1=274559&r2=274560&rev=274560&view=diff
==
(empty)

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in.result (from r274559, 
cfe/trunk/test/ARCMT/with space/test1.m.in.result)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test1.m.in.result?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test1.m.in.result&p1=cfe/trunk/test/ARCMT/with%20space/test1.m.in.result&r1=274559&r2=274560&rev=274560&view=diff
==
(empty)

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in (from r274559, 
cfe/trunk/test/ARCMT/with space/test2.m.in)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test2.m.in?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test2.m.in&p1=cfe/trunk/test/ARCMT/with%20space/test2.m.in&r1=274559&r2=274560&rev=274560&view=diff
==
(empty)

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in.result (from r274559, 
cfe/trunk/test/ARCMT/with space/test2.m.in.result)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test2.m.in.result?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test2.m.in.result&p1=cfe/trunk/test/ARCMT/with%20space/test2.m.in.result&r1=274559&r2=274560&rev=274560&view=diff
==

Re: [PATCH] D21991: [libunwind][ARM] Improve unwinder stack usage - Make WMMX support optional

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


Comment at: CMakeLists.txt:108
@@ -107,2 +107,3 @@
 option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding 
support." OFF)
+option(LIBUNWIND_ENABLE_ARM_WMMX "Enable unwinding support for ARM WMMX 
registers." ON)
 

bcraig wrote:
> Buried in one of the .s files, I see a preprocessor definition check for 
> __ARM_WMMX.  Can the use of the preprocessor define be used instead of adding 
> a new configuration option?
Missed that. Digging into some past commits bumped into 
http://reviews.llvm.org/D5314#74501

I think it's safe to guard the whole thing with `__ARM_WMMX`. Will do that 
instead.




http://reviews.llvm.org/D21991



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


r274562 - Revert "test: Use add_lit_testsuites so that subsets of tests can be specified"

2016-07-05 Thread Justin Bogner via cfe-commits
Author: bogner
Date: Tue Jul  5 11:14:58 2016
New Revision: 274562

URL: http://llvm.org/viewvc/llvm-project?rev=274562&view=rev
Log:
Revert "test: Use add_lit_testsuites so that subsets of tests can be specified"

This reverts r274560. It's breaking a bunch of bots due to a directory
with a space in the name. Doesn't repro locally for some reason.

Added:
cfe/trunk/test/ARCMT/with space/test.h
  - copied, changed from r274560, cfe/trunk/test/ARCMT/Inputs/with 
space/test.h
cfe/trunk/test/ARCMT/with space/test.h.result
  - copied, changed from r274560, cfe/trunk/test/ARCMT/Inputs/with 
space/test.h.result
cfe/trunk/test/ARCMT/with space/test1.m.in
  - copied, changed from r274560, cfe/trunk/test/ARCMT/Inputs/with 
space/test1.m.in
cfe/trunk/test/ARCMT/with space/test1.m.in.result
  - copied, changed from r274560, cfe/trunk/test/ARCMT/Inputs/with 
space/test1.m.in.result
cfe/trunk/test/ARCMT/with space/test2.m.in
  - copied, changed from r274560, cfe/trunk/test/ARCMT/Inputs/with 
space/test2.m.in
cfe/trunk/test/ARCMT/with space/test2.m.in.result
  - copied, changed from r274560, cfe/trunk/test/ARCMT/Inputs/with 
space/test2.m.in.result
cfe/trunk/test/PCH/libroot/usr/include/reloc.h
  - copied, changed from r274560, 
cfe/trunk/test/PCH/Inputs/libroot/usr/include/reloc.h
cfe/trunk/test/PCH/libroot/usr/include/reloc2.h
  - copied, changed from r274560, 
cfe/trunk/test/PCH/Inputs/libroot/usr/include/reloc2.h
Removed:
cfe/trunk/test/ARCMT/Inputs/with space/test.h
cfe/trunk/test/ARCMT/Inputs/with space/test.h.result
cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in
cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in.result
cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in
cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in.result
cfe/trunk/test/PCH/Inputs/libroot/usr/include/reloc.h
cfe/trunk/test/PCH/Inputs/libroot/usr/include/reloc2.h
Modified:
cfe/trunk/test/ARCMT/migrate-space-in-path.m
cfe/trunk/test/CMakeLists.txt
cfe/trunk/test/PCH/reloc.c

Removed: cfe/trunk/test/ARCMT/Inputs/with space/test.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test.h?rev=274561&view=auto
==
--- cfe/trunk/test/ARCMT/Inputs/with space/test.h (original)
+++ cfe/trunk/test/ARCMT/Inputs/with space/test.h (removed)
@@ -1,15 +0,0 @@
-@protocol NSObject
-- (oneway void)release;
-@end
-
-#ifdef PART1
-static inline void part1(id p) {
-  [p release];
-}
-#endif
-
-#ifdef PART2
-static inline void part2(id p) {
-  [p release];
-}
-#endif

Removed: cfe/trunk/test/ARCMT/Inputs/with space/test.h.result
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test.h.result?rev=274561&view=auto
==
--- cfe/trunk/test/ARCMT/Inputs/with space/test.h.result (original)
+++ cfe/trunk/test/ARCMT/Inputs/with space/test.h.result (removed)
@@ -1,13 +0,0 @@
-@protocol NSObject
-- (oneway void)release;
-@end
-
-#ifdef PART1
-static inline void part1(id p) {
-}
-#endif
-
-#ifdef PART2
-static inline void part2(id p) {
-}
-#endif

Removed: cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test1.m.in?rev=274561&view=auto
==
--- cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in (original)
+++ cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in (removed)
@@ -1,6 +0,0 @@
-#define PART1
-#include "test.h"
-
-void test1(id p) {
-  [p release];
-}

Removed: cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in.result
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test1.m.in.result?rev=274561&view=auto
==
--- cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in.result (original)
+++ cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in.result (removed)
@@ -1,5 +0,0 @@
-#define PART1
-#include "test.h"
-
-void test1(id p) {
-}

Removed: cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test2.m.in?rev=274561&view=auto
==
--- cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in (original)
+++ cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in (removed)
@@ -1,6 +0,0 @@
-#define PART2
-#include "test.h"
-
-void test2(id p) {
-  [p release];
-}

Removed: cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in.result
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test2.m.in.result?rev=274561&view=auto
==
--- cfe/trunk/test/ARCMT/Inputs/with space/te

Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-07-05 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: src/cxa_thread_atexit.cpp:47
@@ +46,3 @@
+// called during the loop.
+if (pthread_setspecific(dtors, ptr) != 0) {
+  abort_message("pthread_setspecific() failed during thread_local 
destruction");

The loop doesn't read pthread_getspecific anymore.  I get the need for the 
setspecific call here for your previous design, but I don't think it's needed 
now.


Comment at: src/cxa_thread_atexit.cpp:99
@@ +98,3 @@
+
+  if (__cxa_thread_atexit_impl) {
+return __cxa_thread_atexit_impl(dtor, obj, dso_symbol);

I'm going to have to agree with @majnemer.  I think that the config check for 
LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL should stay in place.  If 
cxa_thread_atexit_impl exists, then all of the fallback code can disappear at 
preprocessing time.

We do lose out on the minor benefit of avoiding some libc++ recompiles, but we 
also avoid code bloat.

For what it's worth, I'm willing to keep the weak symbol check in place if 
__cxa_thread_atexit_impl isn't present, I just don't want to pay for the 
fallback when I know I'm not going to use it.


Comment at: test/thread_local_destruction_order.pass.cpp:1
@@ +1,2 @@
+//===- cxa_thread_atexit_test.cpp 
-===//
+//

Nit: file name is wrong here.


Comment at: test/thread_local_destruction_order.pass.cpp:48
@@ +47,3 @@
+  thread_local OrderChecker fn_thread_local{0};
+}
+

Can we have a CreatesThreadLocalInDestructor in the thread_fn as well?  That 
way we can test both the main function and a pthread.  If I understand your 
code and comments correctly, those go through different code paths.


Comment at: test/thread_local_destruction_order.pass.cpp:54
@@ +53,3 @@
+  std::thread{thread_fn}.join();
+
+  thread_local OrderChecker fn_thread_local{2};

In the places where you can, validate that dtors actually are getting called.  
This may be your only place where you can do that.

So something like 'assert(seq == 1)' here.


http://reviews.llvm.org/D21803



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


Re: [PATCH] D21991: [libunwind][ARM] Improve unwinder stack usage - Make WMMX support optional

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


Comment at: CMakeLists.txt:108
@@ -107,2 +107,3 @@
 option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding 
support." OFF)
+option(LIBUNWIND_ENABLE_ARM_WMMX "Enable unwinding support for ARM WMMX 
registers." ON)
 

rmaprath wrote:
> bcraig wrote:
> > Buried in one of the .s files, I see a preprocessor definition check for 
> > __ARM_WMMX.  Can the use of the preprocessor define be used instead of 
> > adding a new configuration option?
> Missed that. Digging into some past commits bumped into 
> http://reviews.llvm.org/D5314#74501
> 
> I think it's safe to guard the whole thing with `__ARM_WMMX`. Will do that 
> instead.
> 
> 
Although, now I'm not sure if clang ever generates this predefine.

The ACLE clearly says it should be defined for supporting targets: 
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053c/IHI0053C_acle_2_0.pdf

I'm not sure if that justifies using this predefine to completely exclude all 
of WMMX support. Perhaps a build option is safer? @jroelofs: what's your take?


http://reviews.llvm.org/D21991



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


Re: [PATCH] D21505: [Clang][AVX512][Intrinsics]Adding intrinsics for mov{ss|sd} instruction set

2016-07-05 Thread michael zuckerman via cfe-commits
m_zuckerman updated this revision to Diff 62766.

http://reviews.llvm.org/D21505

Files:
  lib/Headers/avx512fintrin.h
  test/CodeGen/avx512f-builtins.c

Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -241,6 +241,23 @@
   _mm512_mask_store_pd(p, m, a);
 }
 
+__m128 test_mm_mask_store_ss (float * __W, __mmask8 __U, __m128 __A)
+{
+  // CHECK-LABEL: @test_mm_mask_store_ss
+  // CHECK:  store float {{.*}}, float* {{.*}}
+  // CHECK: load <4 x float>, <4 x float>* {{.*}}
+  return _mm_mask_store_ss (__W, __U, __A);
+}
+
+__m128d test_mm_mask_store_sd (double * __W, __mmask8 __U, __m128d __A)
+{
+  // CHECK-LABEL: @test_mm_mask_store_sd
+  // CHECK:  store double {{.*}}, double* {{.*}}
+  // CHECK: load <2 x double>, <2 x double>* {{.*}}
+  return _mm_mask_store_sd ( __W,  __U,  __A);
+}
+
+
 void test_mm512_mask_storeu_epi32(void *__P, __mmask16 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_mask_storeu_epi32
   // CHECK: @llvm.masked.store.v16i32.p0v16i32(<16 x i32> %{{.*}}, <16 x i32>* %{{.*}}, i32 1, <16 x i1> %{{.*}})
@@ -371,6 +388,38 @@
   return _mm512_maskz_load_pd(__U, __P);
 }
 
+__m128 test_mm_mask_load_ss (__m128 __W, __mmask8 __U, float const* __A)
+{
+  // CHECK-LABEL: @test_mm_mask_load_ss
+  // CHECK: select <4 x i1> {{.*}}, <4 x float> {{.*}}, <4 x float> {{.*}}
+  // CHECK: load <4 x float>, <4 x float>* {{.*}}
+  return _mm_mask_load_ss ( __W,  __U,  __A);
+}
+
+__m128 test_mm_maskz_load_ss (__mmask8 __U, float const* __A)
+{
+  // CHECK-LABEL: @test_mm_maskz_load_ss
+  // CHECK: select <4 x i1> {{.*}}, <4 x float> {{.*}}, <4 x float> {{.*}}
+  // CHECK: load <4 x float>, <4 x float>* {{.*}}
+  return _mm_maskz_load_ss (__U, __A);
+}
+
+__m128d test_mm_mask_load_sd (__m128 __W, __mmask8 __U, double const* __A)
+{
+  // CHECK-LABEL: @test_mm_mask_load_sd
+  // CHECK: select <2 x i1>{{.*}}, <2 x double>{{.*}}, <2 x double>{{.*}} 
+  // CHECK: load <2 x double>, <2 x double>* {{.*}}
+  return _mm_mask_load_sd ( __W,  __U,  __A);
+}
+
+__m128d test_mm_maskz_load_sd (__mmask8 __U, double const* __A)
+{
+  // CHECK-LABEL: @test_mm_maskz_load_sd
+  // CHECK: select <2 x i1> {{.*}}, <2 x double> {{.*}}, <2 x double> {{.*}}
+  // CHECK: load <2 x double>, <2 x double>* {{.*}}
+  return _mm_maskz_load_sd (__U, __A);
+}
+
 __m512d test_mm512_set1_pd(double d)
 {
   // CHECK-LABEL: @test_mm512_set1_pd
@@ -6199,6 +6248,38 @@
   return _mm512_maskz_mov_ps(__U, __A); 
 }
 
+__m128 test_mm_mask_move_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
+{
+  // CHECK-LABEL: @test_mm_mask_move_ss
+  // CHECK: select <4 x i1>{{.*}}, <4 x float> {{.*}}, <4 x float>{{.*}}
+  // CHECK: load <4 x float>, <4 x float>* {{.*}}
+ return _mm_mask_move_ss ( __W,  __U,  __A,  __B);
+}
+
+__m128 test_mm_maskz_move_ss (__mmask8 __U, __m128 __A, __m128 __B)
+{
+  // CHECK-LABEL: @test_mm_maskz_move_ss
+  // CHECK: select <4 x i1>{{.*}}, <4 x float> {{.*}}, <4 x float>{{.*}}
+  // CHECK: load <4 x float>, <4 x float>* {{.*}}
+  return _mm_maskz_move_ss (__U, __A, __B);
+}
+
+__m128d test_mm_mask_move_sd (__m128 __W, __mmask8 __U, __m128d __A, __m128d __B)
+{
+  // CHECK-LABEL: @test_mm_mask_move_sd
+  // CHECK: select <2 x i1>{{.*}}, <2 x double>{{.*}}, <2 x double>{{.*}}
+  // CHECK: load <2 x double>, <2 x double>* {{.*}}
+  return _mm_mask_move_sd ( __W,  __U,  __A,  __B);
+}
+
+__m128d test_mm_maskz_move_sd (__mmask8 __U, __m128d __A, __m128d __B)
+{
+  // CHECK-LABEL: @test_mm_maskz_move_sd
+  // CHECK: select <2 x i1> {{.*}}, <2 x double> {{.*}}, <2 x double> {{.*}}
+  // CHECK: load <2 x double>, <2 x double>* {{.*}}
+  return _mm_maskz_move_sd (__U, __A, __B);
+}
+
 void test_mm512_mask_compressstoreu_pd(void *__P, __mmask8 __U, __m512d __A) {
   // CHECK-LABEL: @test_mm512_mask_compressstoreu_pd
   // CHECK: @llvm.x86.avx512.mask.compress.store.pd.512
Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -4558,6 +4558,30 @@
   return *(__m512i *) __P;
 }
 
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_mask_load_ss (__m128 __W, __mmask8 __U, const float* __A)
+{
+  return (__U & 1) ?  _mm_load_ss(__A) :  (__m128) { __W[0], 0, 0, 0}; 
+}
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_maskz_load_ss (__mmask8 __U, const float* __A)
+{
+  return (__U & 1) ?  _mm_load_ss(__A) :  (__m128) { 0, 0, 0, 0}; 
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask_load_sd (__m128d __W, __mmask8 __U, const double* __A)
+{
+  return (__U & 1) ?  _mm_load_sd(__A) :(__m128d) { __W[0], 0};
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_maskz_load_sd (__mmask8 __U, const double* __A)
+{
+  return (__U & 1) ?  _mm_load_sd(__A) :(__m128d) { 0, 0};
+}
+
 /* SIMD store ops */
 
 static __inline void __DEFAULT_FN_ATTRS
@@ -4649,6 +4673,20 @@
   *(__m512i *) __P = _

Re: [PATCH] D21968: [libcxx] Externally threaded libc++ variant - Take 2

2016-07-05 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: CMakeLists.txt:131
@@ -130,2 +130,3 @@
 option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" 
OFF)
-option(LIBCXX_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread 
API" OFF)
+option(LIBCXX_HAS_PTHREAD_THREAD_API "Ignore auto-detection and force use of 
pthread API" OFF)
+option(LIBCXX_HAS_EXTERNAL_THREAD_API

I would prefer that you not change this option name, as that will break my 
builds.  It's easy enough to fix on my side, but unless there's a really 
compelling reason, I'd rather not deal with the breakage.


Comment at: include/__external_threading:26
@@ +25,3 @@
+
+#if !defined(_LIBCPP_MUTEX_T) || \
+!defined(_LIBCPP_MUTEX_INITIALIZER) || \

So users of external pthreading (or their compiler driver) would need to 
provide a pile of -D options on the command line?  Or is it expected that users 
will have their own __external_threading header that comes earlier in the 
include path?  Please document your expectation.


Comment at: include/__threading_support:33
@@ -32,2 +32,2 @@
 #define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
 typedef pthread_mutex_t __libcpp_mutex_t;

More context would be useful here. "-U9" perhaps (if using git).


http://reviews.llvm.org/D21968



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


Re: [PATCH] D21505: [Clang][AVX512][Intrinsics]Adding intrinsics for mov{ss|sd} instruction set

2016-07-05 Thread michael zuckerman via cfe-commits
m_zuckerman updated this revision to Diff 62768.

http://reviews.llvm.org/D21505

Files:
  lib/Headers/avx512fintrin.h
  test/CodeGen/avx512f-builtins.c

Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -241,6 +241,23 @@
   _mm512_mask_store_pd(p, m, a);
 }
 
+void test_mm_mask_store_ss (float * __W, __mmask8 __U, __m128 __A)
+{
+  // CHECK-LABEL: @test_mm_mask_store_ss
+  // CHECK:  store float {{.*}}, float* {{.*}}
+  // CHECK: load <4 x float>, <4 x float>* {{.*}}
+  return _mm_mask_store_ss (__W, __U, __A);
+}
+
+void test_mm_mask_store_sd (double * __W, __mmask8 __U, __m128d __A)
+{
+  // CHECK-LABEL: @test_mm_mask_store_sd
+  // CHECK:  store double {{.*}}, double* {{.*}}
+  // CHECK: load <2 x double>, <2 x double>* {{.*}}
+  return _mm_mask_store_sd ( __W,  __U,  __A);
+}
+
+
 void test_mm512_mask_storeu_epi32(void *__P, __mmask16 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_mask_storeu_epi32
   // CHECK: @llvm.masked.store.v16i32.p0v16i32(<16 x i32> %{{.*}}, <16 x i32>* %{{.*}}, i32 1, <16 x i1> %{{.*}})
@@ -371,6 +388,38 @@
   return _mm512_maskz_load_pd(__U, __P);
 }
 
+__m128 test_mm_mask_load_ss (__m128 __W, __mmask8 __U, float const* __A)
+{
+  // CHECK-LABEL: @test_mm_mask_load_ss
+  // CHECK: select <4 x i1> {{.*}}, <4 x float> {{.*}}, <4 x float> {{.*}}
+  // CHECK: load <4 x float>, <4 x float>* {{.*}}
+  return _mm_mask_load_ss ( __W,  __U,  __A);
+}
+
+__m128 test_mm_maskz_load_ss (__mmask8 __U, float const* __A)
+{
+  // CHECK-LABEL: @test_mm_maskz_load_ss
+  // CHECK: select <4 x i1> {{.*}}, <4 x float> {{.*}}, <4 x float> {{.*}}
+  // CHECK: load <4 x float>, <4 x float>* {{.*}}
+  return _mm_maskz_load_ss (__U, __A);
+}
+
+__m128d test_mm_mask_load_sd (__m128 __W, __mmask8 __U, double const* __A)
+{
+  // CHECK-LABEL: @test_mm_mask_load_sd
+  // CHECK: select <2 x i1>{{.*}}, <2 x double>{{.*}}, <2 x double>{{.*}} 
+  // CHECK: load <2 x double>, <2 x double>* {{.*}}
+  return _mm_mask_load_sd ( __W,  __U,  __A);
+}
+
+__m128d test_mm_maskz_load_sd (__mmask8 __U, double const* __A)
+{
+  // CHECK-LABEL: @test_mm_maskz_load_sd
+  // CHECK: select <2 x i1> {{.*}}, <2 x double> {{.*}}, <2 x double> {{.*}}
+  // CHECK: load <2 x double>, <2 x double>* {{.*}}
+  return _mm_maskz_load_sd (__U, __A);
+}
+
 __m512d test_mm512_set1_pd(double d)
 {
   // CHECK-LABEL: @test_mm512_set1_pd
@@ -6199,6 +6248,38 @@
   return _mm512_maskz_mov_ps(__U, __A); 
 }
 
+__m128 test_mm_mask_move_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
+{
+  // CHECK-LABEL: @test_mm_mask_move_ss
+  // CHECK: select <4 x i1>{{.*}}, <4 x float> {{.*}}, <4 x float>{{.*}}
+  // CHECK: load <4 x float>, <4 x float>* {{.*}}
+ return _mm_mask_move_ss ( __W,  __U,  __A,  __B);
+}
+
+__m128 test_mm_maskz_move_ss (__mmask8 __U, __m128 __A, __m128 __B)
+{
+  // CHECK-LABEL: @test_mm_maskz_move_ss
+  // CHECK: select <4 x i1>{{.*}}, <4 x float> {{.*}}, <4 x float>{{.*}}
+  // CHECK: load <4 x float>, <4 x float>* {{.*}}
+  return _mm_maskz_move_ss (__U, __A, __B);
+}
+
+__m128d test_mm_mask_move_sd (__m128 __W, __mmask8 __U, __m128d __A, __m128d __B)
+{
+  // CHECK-LABEL: @test_mm_mask_move_sd
+  // CHECK: select <2 x i1>{{.*}}, <2 x double>{{.*}}, <2 x double>{{.*}}
+  // CHECK: load <2 x double>, <2 x double>* {{.*}}
+  return _mm_mask_move_sd ( __W,  __U,  __A,  __B);
+}
+
+__m128d test_mm_maskz_move_sd (__mmask8 __U, __m128d __A, __m128d __B)
+{
+  // CHECK-LABEL: @test_mm_maskz_move_sd
+  // CHECK: select <2 x i1> {{.*}}, <2 x double> {{.*}}, <2 x double> {{.*}}
+  // CHECK: load <2 x double>, <2 x double>* {{.*}}
+  return _mm_maskz_move_sd (__U, __A, __B);
+}
+
 void test_mm512_mask_compressstoreu_pd(void *__P, __mmask8 __U, __m512d __A) {
   // CHECK-LABEL: @test_mm512_mask_compressstoreu_pd
   // CHECK: @llvm.x86.avx512.mask.compress.store.pd.512
Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -4558,6 +4558,30 @@
   return *(__m512i *) __P;
 }
 
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_mask_load_ss (__m128 __W, __mmask8 __U, const float* __A)
+{
+  return (__U & 1) ?  _mm_load_ss(__A) :  (__m128) { __W[0], 0, 0, 0}; 
+}
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_maskz_load_ss (__mmask8 __U, const float* __A)
+{
+  return (__U & 1) ?  _mm_load_ss(__A) :  (__m128) { 0, 0, 0, 0}; 
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask_load_sd (__m128d __W, __mmask8 __U, const double* __A)
+{
+  return (__U & 1) ?  _mm_load_sd(__A) :(__m128d) { __W[0], 0};
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_maskz_load_sd (__mmask8 __U, const double* __A)
+{
+  return (__U & 1) ?  _mm_load_sd(__A) :(__m128d) { 0, 0};
+}
+
 /* SIMD store ops */
 
 static __inline void __DEFAULT_FN_ATTRS
@@ -4649,6 +4673,20 @@
   *(__m512i *) __P = __A;
 

Re: [PATCH] D11360: Proposed patch to prevent the creation of empty (forwarding) blocks resulting from nested ifs.

2016-07-05 Thread Wolfgang Pieb via cfe-commits
wolfgangp added a comment.

Ping...


http://reviews.llvm.org/D11360



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


Re: [PATCH] D21329: Rename and rework `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR`. Move FreeBSD configuration in-tree.

2016-07-05 Thread Dimitry Andric via cfe-commits
dim added a comment.

@theraven, do you have any other feedback? :)


http://reviews.llvm.org/D21329



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


r274565 - Re-apply "test: Use add_lit_testsuites so that subsets of tests can be specified"

2016-07-05 Thread Justin Bogner via cfe-commits
Author: bogner
Date: Tue Jul  5 12:54:40 2016
New Revision: 274565

URL: http://llvm.org/viewvc/llvm-project?rev=274565&view=rev
Log:
Re-apply "test: Use add_lit_testsuites so that subsets of tests can be 
specified"

This version should actually remove the empty directories I removed
all of the files from. Thanks to tstellar for pointing out git-svn's
--rmdir flag.

Original message:

This creates make/ninja targets like check-clang-codegen and
check-clang-unit, much like LLVM already has. I had to move some input
files into Input directories so they weren't picked up as test
directories.

Added:
cfe/trunk/test/ARCMT/Inputs/with space/test.h
  - copied, changed from r274562, cfe/trunk/test/ARCMT/with space/test.h
cfe/trunk/test/ARCMT/Inputs/with space/test.h.result
  - copied, changed from r274562, cfe/trunk/test/ARCMT/with 
space/test.h.result
cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in
  - copied, changed from r274562, cfe/trunk/test/ARCMT/with space/test1.m.in
cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in.result
  - copied, changed from r274562, cfe/trunk/test/ARCMT/with 
space/test1.m.in.result
cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in
  - copied, changed from r274562, cfe/trunk/test/ARCMT/with space/test2.m.in
cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in.result
  - copied, changed from r274562, cfe/trunk/test/ARCMT/with 
space/test2.m.in.result
cfe/trunk/test/PCH/Inputs/libroot/usr/include/reloc.h
  - copied, changed from r274562, 
cfe/trunk/test/PCH/libroot/usr/include/reloc.h
cfe/trunk/test/PCH/Inputs/libroot/usr/include/reloc2.h
  - copied, changed from r274562, 
cfe/trunk/test/PCH/libroot/usr/include/reloc2.h
Removed:
cfe/trunk/test/ARCMT/with space/
cfe/trunk/test/PCH/libroot/
Modified:
cfe/trunk/test/ARCMT/migrate-space-in-path.m
cfe/trunk/test/CMakeLists.txt
cfe/trunk/test/PCH/reloc.c

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test.h (from r274562, 
cfe/trunk/test/ARCMT/with space/test.h)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test.h?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test.h&p1=cfe/trunk/test/ARCMT/with%20space/test.h&r1=274562&r2=274565&rev=274565&view=diff
==
(empty)

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test.h.result (from r274562, 
cfe/trunk/test/ARCMT/with space/test.h.result)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test.h.result?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test.h.result&p1=cfe/trunk/test/ARCMT/with%20space/test.h.result&r1=274562&r2=274565&rev=274565&view=diff
==
(empty)

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in (from r274562, 
cfe/trunk/test/ARCMT/with space/test1.m.in)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test1.m.in?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test1.m.in&p1=cfe/trunk/test/ARCMT/with%20space/test1.m.in&r1=274562&r2=274565&rev=274565&view=diff
==
(empty)

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test1.m.in.result (from r274562, 
cfe/trunk/test/ARCMT/with space/test1.m.in.result)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test1.m.in.result?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test1.m.in.result&p1=cfe/trunk/test/ARCMT/with%20space/test1.m.in.result&r1=274562&r2=274565&rev=274565&view=diff
==
(empty)

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in (from r274562, 
cfe/trunk/test/ARCMT/with space/test2.m.in)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test2.m.in?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test2.m.in&p1=cfe/trunk/test/ARCMT/with%20space/test2.m.in&r1=274562&r2=274565&rev=274565&view=diff
==
(empty)

Copied: cfe/trunk/test/ARCMT/Inputs/with space/test2.m.in.result (from r274562, 
cfe/trunk/test/ARCMT/with space/test2.m.in.result)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/Inputs/with%20space/test2.m.in.result?p2=cfe/trunk/test/ARCMT/Inputs/with%20space/test2.m.in.result&p1=cfe/trunk/test/ARCMT/with%20space/test2.m.in.result&r1=274562&r2=274565&rev=274565&view=diff
==
(empty)

Modified: cfe/trunk/test/ARCMT/migrate-space-in-path.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/migrate-space-in-path.m?rev=274565&r1=274564&r2=274565&view=diff
==
--- cfe/trunk/test/ARCMT/migrate-space-in-path.

r274566 - [Sema] Fix a bug where pack expansion was not expanded in type alias

2016-07-05 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Tue Jul  5 12:57:24 2016
New Revision: 274566

URL: http://llvm.org/viewvc/llvm-project?rev=274566&view=rev
Log:
[Sema] Fix a bug where pack expansion was not expanded in type alias

The problem is that the parameter pack in a function type type alias is not
reexpanded after being transformed. Also remove an incorrect comment in a
similar function. Fixes PR26017.

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

Modified:
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=274566&r1=274565&r2=274566&view=diff
==
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Tue Jul  5 12:57:24 2016
@@ -3327,8 +3327,6 @@ bool TreeTransform::TransformEx
 if (Out.isInvalid())
   return true;
 
-// FIXME: Can this happen? We should not try to expand the pack
-// in this case.
 if (Out.get()->containsUnexpandedParameterPack()) {
   Out = getDerived().RebuildPackExpansion(
   Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
@@ -4822,6 +4820,14 @@ bool TreeTransform::TransformFu
   if (NewType.isNull())
 return true;
 
+  if (NewType->containsUnexpandedParameterPack()) {
+NewType =
+getSema().getASTContext().getPackExpansionType(NewType, None);
+
+if (NewType.isNull())
+  return true;
+  }
+
   if (ParamInfos)
 PInfos.set(OutParamTypes.size(), ParamInfos[i]);
   OutParamTypes.push_back(NewType);

Modified: cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp?rev=274566&r1=274565&r2=274566&view=diff
==
--- cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp Tue Jul  5 12:57:24 
2016
@@ -437,3 +437,35 @@ namespace PR21289 {
   template void g<>();
   template void g<1, 2, 3>();
 }
+
+template 
+int var_expr(Ts... ts);
+
+template 
+auto a_function(Ts... ts) -> decltype(var_expr(ts...));
+
+template 
+using partial = decltype(a_function);
+
+int use_partial() { partial n; }
+
+namespace PR26017 {
+template 
+struct Foo {};
+template 
+using FooAlias = Foo;
+
+template 
+using FooAliasAlias = FooAlias;
+
+template 
+void bar(const FooAlias &) {}
+
+int fn() {
+  FooAlias<> a;
+  bar(a);
+
+  FooAlias b;
+  bar(b);
+}
+}


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


Re: [PATCH] D21030: [Sema] Fix rejects-valid where parameter pack was not expanded in type alias

2016-07-05 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274566: [Sema] Fix a bug where pack expansion was not 
expanded in type alias (authored by epilk).

Changed prior to commit:
  http://reviews.llvm.org/D21030?vs=60908&id=62771#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21030

Files:
  cfe/trunk/lib/Sema/TreeTransform.h
  cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp

Index: cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
===
--- cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
+++ cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
@@ -437,3 +437,35 @@
   template void g<>();
   template void g<1, 2, 3>();
 }
+
+template 
+int var_expr(Ts... ts);
+
+template 
+auto a_function(Ts... ts) -> decltype(var_expr(ts...));
+
+template 
+using partial = decltype(a_function);
+
+int use_partial() { partial n; }
+
+namespace PR26017 {
+template 
+struct Foo {};
+template 
+using FooAlias = Foo;
+
+template 
+using FooAliasAlias = FooAlias;
+
+template 
+void bar(const FooAlias &) {}
+
+int fn() {
+  FooAlias<> a;
+  bar(a);
+
+  FooAlias b;
+  bar(b);
+}
+}
Index: cfe/trunk/lib/Sema/TreeTransform.h
===
--- cfe/trunk/lib/Sema/TreeTransform.h
+++ cfe/trunk/lib/Sema/TreeTransform.h
@@ -3327,8 +3327,6 @@
 if (Out.isInvalid())
   return true;
 
-// FIXME: Can this happen? We should not try to expand the pack
-// in this case.
 if (Out.get()->containsUnexpandedParameterPack()) {
   Out = getDerived().RebuildPackExpansion(
   Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
@@ -4822,6 +4820,14 @@
   if (NewType.isNull())
 return true;
 
+  if (NewType->containsUnexpandedParameterPack()) {
+NewType =
+getSema().getASTContext().getPackExpansionType(NewType, None);
+
+if (NewType.isNull())
+  return true;
+  }
+
   if (ParamInfos)
 PInfos.set(OutParamTypes.size(), ParamInfos[i]);
   OutParamTypes.push_back(NewType);


Index: cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
===
--- cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
+++ cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
@@ -437,3 +437,35 @@
   template void g<>();
   template void g<1, 2, 3>();
 }
+
+template 
+int var_expr(Ts... ts);
+
+template 
+auto a_function(Ts... ts) -> decltype(var_expr(ts...));
+
+template 
+using partial = decltype(a_function);
+
+int use_partial() { partial n; }
+
+namespace PR26017 {
+template 
+struct Foo {};
+template 
+using FooAlias = Foo;
+
+template 
+using FooAliasAlias = FooAlias;
+
+template 
+void bar(const FooAlias &) {}
+
+int fn() {
+  FooAlias<> a;
+  bar(a);
+
+  FooAlias b;
+  bar(b);
+}
+}
Index: cfe/trunk/lib/Sema/TreeTransform.h
===
--- cfe/trunk/lib/Sema/TreeTransform.h
+++ cfe/trunk/lib/Sema/TreeTransform.h
@@ -3327,8 +3327,6 @@
 if (Out.isInvalid())
   return true;
 
-// FIXME: Can this happen? We should not try to expand the pack
-// in this case.
 if (Out.get()->containsUnexpandedParameterPack()) {
   Out = getDerived().RebuildPackExpansion(
   Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
@@ -4822,6 +4820,14 @@
   if (NewType.isNull())
 return true;
 
+  if (NewType->containsUnexpandedParameterPack()) {
+NewType =
+getSema().getASTContext().getPackExpansionType(NewType, None);
+
+if (NewType.isNull())
+  return true;
+  }
+
   if (ParamInfos)
 PInfos.set(OutParamTypes.size(), ParamInfos[i]);
   OutParamTypes.push_back(NewType);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21814: clang-rename: support multiple renames with one invocation

2016-07-05 Thread Miklos Vajna via cfe-commits
vmiklos added a comment.

Manuel, do you have an opinion on this, please?


http://reviews.llvm.org/D21814



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


RE: [PATCH] D21031: [OpenCL] Allow -cl-std and other standard -cl- options in driver

2016-07-05 Thread Liu, Yaxun (Sam) via cfe-commits
We will add it. Thanks.

Sam

-Original Message-
From: Jan Vesely [mailto:jan.ves...@rutgers.edu] 
Sent: Friday, July 1, 2016 4:59 PM
To: Shi, Aaron (en ye) ; anastasia.stul...@arm.com
Cc: jan.ves...@rutgers.edu; nhaus...@gmail.com; rich...@metafoo.co.uk; 
alexey.ba...@intel.com; xiuli...@outlook.com; cfe-commits@lists.llvm.org; Liu, 
Yaxun (Sam) 
Subject: Re: [PATCH] D21031: [OpenCL] Allow -cl-std and other standard -cl- 
options in driver

jvesely added a subscriber: jvesely.


Comment at: cfe/trunk/include/clang/Driver/Options.td:381
@@ +380,3 @@
+def cl_unsafe_math_optimizations : Flag<["-"], 
+"cl-unsafe-math-optimizations">, Group, 
+Flags<[CC1Option]>,
+  HelpText<"OpenCL only. Allow unsafe floating-point optimizations.  
+Also implies -cl-no-signed-zeros and -cl-mad-enable.">; def 
+cl_fast_relaxed_math : Flag<["-"], "cl-fast-relaxed-math">, 
+Group, Flags<[CC1Option]>,

It'd be nice if you added cl-no-signed-zeros since it's mentioned here


Repository:
  rL LLVM

http://reviews.llvm.org/D21031



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


Re: [PATCH] D15926: Do not print certain warnings when input is a header.

2016-07-05 Thread Mehdi AMINI via cfe-commits
mehdi_amini added inline comments.


Comment at: include/clang/Basic/LangOptions.h:131
@@ +130,3 @@
+  /// input is a header file (i.e. -x c-header).
+  bool IsHeaderFile = false;
+

aaron.ballman wrote:
> Should move the initializer to the constructor (not certain that MSVC 2013 
> supports this construct, but it's also more consistent).
Interestingly I prefer to have them on the fields themselves (when writing new 
struct/classes), but I agree that consistency takes precedence when adding a 
field to an existing class.


http://reviews.llvm.org/D15926



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


Re: [PATCH] D21145: [Sema] Fix crash on valid where instantiation of lambda cannot access type of 'this'

2016-07-05 Thread Erik Pilkington via cfe-commits
erik.pilkington added a comment.

Ping!


http://reviews.llvm.org/D21145



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


Re: [PATCH] D21989: [OpenCL] Improve diagnostics of OpenCL types

2016-07-05 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

Can we add tests for returning sampler, image and pipe type? Thanks.


http://reviews.llvm.org/D21989



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


Re: [PATCH] D20373: PR27799: [OpenCL] Clang fails to compile libclc

2016-07-05 Thread Yaxun Liu via cfe-commits
yaxunl closed this revision.
yaxunl added a comment.

This patch was superseded by http://reviews.llvm.org/D20389


http://reviews.llvm.org/D20373



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


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-07-05 Thread Tavian Barnes via cfe-commits
tavianator added inline comments.


Comment at: src/cxa_thread_atexit.cpp:47
@@ +46,3 @@
+// called during the loop.
+if (pthread_setspecific(dtors, ptr) != 0) {
+  abort_message("pthread_setspecific() failed during thread_local 
destruction");

bcraig wrote:
> The loop doesn't read pthread_getspecific anymore.  I get the need for the 
> setspecific call here for your previous design, but I don't think it's needed 
> now.
__cxa_thread_atexit() calls pthread_getspecific(), so it's still needed.  
Otherwise it would create a new list instead of adding to the current one, and 
the ordering would be wrong.


Comment at: src/cxa_thread_atexit.cpp:99
@@ +98,3 @@
+
+  if (__cxa_thread_atexit_impl) {
+return __cxa_thread_atexit_impl(dtor, obj, dso_symbol);

bcraig wrote:
> I'm going to have to agree with @majnemer.  I think that the config check for 
> LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL should stay in place.  If 
> cxa_thread_atexit_impl exists, then all of the fallback code can disappear at 
> preprocessing time.
> 
> We do lose out on the minor benefit of avoiding some libc++ recompiles, but 
> we also avoid code bloat.
> 
> For what it's worth, I'm willing to keep the weak symbol check in place if 
> __cxa_thread_atexit_impl isn't present, I just don't want to pay for the 
> fallback when I know I'm not going to use it.
Makes sense, I'll do that.


Comment at: test/thread_local_destruction_order.pass.cpp:48
@@ +47,3 @@
+  thread_local OrderChecker fn_thread_local{0};
+}
+

bcraig wrote:
> Can we have a CreatesThreadLocalInDestructor in the thread_fn as well?  That 
> way we can test both the main function and a pthread.  If I understand your 
> code and comments correctly, those go through different code paths.
Yep, meant to do that actually!


Comment at: test/thread_local_destruction_order.pass.cpp:54
@@ +53,3 @@
+  std::thread{thread_fn}.join();
+
+  thread_local OrderChecker fn_thread_local{2};

bcraig wrote:
> In the places where you can, validate that dtors actually are getting called. 
>  This may be your only place where you can do that.
> 
> So something like 'assert(seq == 1)' here.
Sounds good.  What I wanted to do was print some output in the destructors, and 
check for a certain expected output.  But I couldn't figure out how to do that 
with lit.


http://reviews.llvm.org/D21803



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


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-07-05 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: test/thread_local_destruction_order.pass.cpp:54
@@ +53,3 @@
+  std::thread{thread_fn}.join();
+
+  thread_local OrderChecker fn_thread_local{2};

tavianator wrote:
> bcraig wrote:
> > In the places where you can, validate that dtors actually are getting 
> > called.  This may be your only place where you can do that.
> > 
> > So something like 'assert(seq == 1)' here.
> Sounds good.  What I wanted to do was print some output in the destructors, 
> and check for a certain expected output.  But I couldn't figure out how to do 
> that with lit.
Normally, you would do that by piping the output to the llvm FileCheck utility. 
 My unconfirmed suspicion is that that approach will run into difficulties 
because of libcxx and libcxxabi specific setups.

I think just having the global object's dtor check is good enough for the final 
post condition though.  I'm not terribly worried about global dtors 
malfunctioning.


http://reviews.llvm.org/D21803



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


Re: [PATCH] D21992: [clang-tidy] new cppcoreguidelines-slicing

2016-07-05 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Please mention this check in docs/ReleaseNotes.rst (in alphabetical order).


http://reviews.llvm.org/D21992



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


[PATCH] D22010: Add more gcc compatibility names to clang's cpuid.h

2016-07-05 Thread Dimitry Andric via cfe-commits
dim created this revision.
dim added reviewers: joerg, rsmith.
dim added a subscriber: cfe-commits.

Some cpuid bit defines are named slightly different from how gcc's cpuid.h 
calls them.

Define a few more compatibility names to appease software built for gcc:
* `bit_PCLMUL`  alias of `bit_PCLMULQDQ`
* `bit_SSE4_1`  alias of `bit_SSE41`
* `bit_SSE4_2`  alias of `bit_SSE42`
* `bit_AES` alias of `bit_AESNI`
* `bit_CMPXCHG8B`   alias of `bit_CX8`

While here, add the misssing 29th bit, `bit_F16C`.

http://reviews.llvm.org/D22010

Files:
  lib/Headers/cpuid.h

Index: lib/Headers/cpuid.h
===
--- lib/Headers/cpuid.h
+++ lib/Headers/cpuid.h
@@ -82,6 +82,7 @@
 /* Features in %ecx for level 1 */
 #define bit_SSE30x0001
 #define bit_PCLMULQDQ   0x0002
+#define bit_PCLMUL  bit_PCLMULQDQ   /* for gcc compat */
 #define bit_DTES64  0x0004
 #define bit_MONITOR 0x0008
 #define bit_DSCPL   0x0010
@@ -98,15 +99,19 @@
 #define bit_PCID0x0002
 #define bit_DCA 0x0004
 #define bit_SSE41   0x0008
+#define bit_SSE4_1  bit_SSE41   /* for gcc compat */
 #define bit_SSE42   0x0010
+#define bit_SSE4_2  bit_SSE42   /* for gcc compat */
 #define bit_x2APIC  0x0020
 #define bit_MOVBE   0x0040
 #define bit_POPCNT  0x0080
 #define bit_TSCDeadline 0x0100
 #define bit_AESNI   0x0200
+#define bit_AES bit_AESNI   /* for gcc compat */
 #define bit_XSAVE   0x0400
 #define bit_OSXSAVE 0x0800
 #define bit_AVX 0x1000
+#define bit_F16C0x2000
 #define bit_RDRND   0x4000
 
 /* Features in %edx for level 1 */
@@ -119,6 +124,7 @@
 #define bit_PAE 0x0040
 #define bit_MCE 0x0080
 #define bit_CX8 0x0100
+#define bit_CMPXCHG8B   bit_CX8 /* for gcc compat */
 #define bit_APIC0x0200
 #define bit_SEP 0x0800
 #define bit_MTRR0x1000
@@ -133,7 +139,7 @@
 #define bit_ACPI0x0040
 #define bit_MMX 0x0080
 #define bit_FXSR0x0100
-#define bit_FXSAVE  bit_FXSR/* for gcc compat */
+#define bit_FXSAVE  bit_FXSR/* for gcc compat */
 #define bit_SSE 0x0200
 #define bit_SSE20x0400
 #define bit_SS  0x0800


Index: lib/Headers/cpuid.h
===
--- lib/Headers/cpuid.h
+++ lib/Headers/cpuid.h
@@ -82,6 +82,7 @@
 /* Features in %ecx for level 1 */
 #define bit_SSE30x0001
 #define bit_PCLMULQDQ   0x0002
+#define bit_PCLMUL  bit_PCLMULQDQ   /* for gcc compat */
 #define bit_DTES64  0x0004
 #define bit_MONITOR 0x0008
 #define bit_DSCPL   0x0010
@@ -98,15 +99,19 @@
 #define bit_PCID0x0002
 #define bit_DCA 0x0004
 #define bit_SSE41   0x0008
+#define bit_SSE4_1  bit_SSE41   /* for gcc compat */
 #define bit_SSE42   0x0010
+#define bit_SSE4_2  bit_SSE42   /* for gcc compat */
 #define bit_x2APIC  0x0020
 #define bit_MOVBE   0x0040
 #define bit_POPCNT  0x0080
 #define bit_TSCDeadline 0x0100
 #define bit_AESNI   0x0200
+#define bit_AES bit_AESNI   /* for gcc compat */
 #define bit_XSAVE   0x0400
 #define bit_OSXSAVE 0x0800
 #define bit_AVX 0x1000
+#define bit_F16C0x2000
 #define bit_RDRND   0x4000
 
 /* Features in %edx for level 1 */
@@ -119,6 +124,7 @@
 #define bit_PAE 0x0040
 #define bit_MCE 0x0080
 #define bit_CX8 0x0100
+#define bit_CMPXCHG8B   bit_CX8 /* for gcc compat */
 #define bit_APIC0x0200
 #define bit_SEP 0x0800
 #define bit_MTRR0x1000
@@ -133,7 +139,7 @@
 #define bit_ACPI0x0040
 #define bit_MMX 0x0080
 #define bit_FXSR0x0100
-#define bit_FXSAVE  bit_FXSR/* for gcc compat */
+#define bit_FXSAVE  bit_FXSR/* for gcc compat */
 #define bit_SSE 0x0200
 #define bit_SSE20x0400
 #define bit_SS  0x0800
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D22012: [libcxx] [tests] Add missing includes, especially , to priority.queue/types.pass.cpp.

2016-07-05 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Add missing includes, especially , to priority.queue/types.pass.cpp.

This is required according to the Standard, and it fixes compiler errors with 
MSVC (as our headers don't usually drag in std::greater).

http://reviews.llvm.org/D22012

Files:
  test/std/containers/container.adaptors/priority.queue/types.pass.cpp

Index: test/std/containers/container.adaptors/priority.queue/types.pass.cpp
===
--- test/std/containers/container.adaptors/priority.queue/types.pass.cpp
+++ test/std/containers/container.adaptors/priority.queue/types.pass.cpp
@@ -27,7 +27,11 @@
 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
 
 struct test
 : private std::priority_queue


Index: test/std/containers/container.adaptors/priority.queue/types.pass.cpp
===
--- test/std/containers/container.adaptors/priority.queue/types.pass.cpp
+++ test/std/containers/container.adaptors/priority.queue/types.pass.cpp
@@ -27,7 +27,11 @@
 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
 
 struct test
 : private std::priority_queue
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D22013: [libcxx] [test] bind's function call operator isn't guaranteed to SFINAE.

2016-07-05 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

bind's function call operator isn't guaranteed to SFINAE.

There's nothing in the Standard that specifies this, and MSVC's implementation 
doesn't do it (we explode in a tuple bounds check). For portability, anything 
expecting the function call operator to vanish should be marked as 
libcxx-specific, unless and until a Library Issue is voted in saying otherwise.

http://reviews.llvm.org/D22013

Files:
  
test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp

Index: 
test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
===
--- 
test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
+++ 
test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
@@ -24,6 +24,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 int dummy = 42;
 
 int return_value(int) { return dummy; }
@@ -81,10 +83,10 @@
 // Check that the call operator SFINAE's away when too few arguments
 // are provided but is well-formed otherwise.
 {
-static_assert(!CheckCall(), "");
+LIBCPP_STATIC_ASSERT(!CheckCall(), "");
 static_assert(CheckCall(), "");
 static_assert(CheckCall(), "");
-static_assert(!CheckCall(), "");
+LIBCPP_STATIC_ASSERT(!CheckCall(), "");
 static_assert(CheckCall(), "");
 static_assert(CheckCall(), "");
 }
@@ -108,7 +110,7 @@
 // Check that the call operator SFINAE's away when too few arguments
 // are provided but is well-formed otherwise.
 {
-static_assert(!CheckCall(), "");
+LIBCPP_STATIC_ASSERT(!CheckCall(), "");
 static_assert(CheckCall(), "");
 static_assert(CheckCall(), "");
 }


Index: test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
===
--- test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
+++ test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
@@ -24,6 +24,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 int dummy = 42;
 
 int return_value(int) { return dummy; }
@@ -81,10 +83,10 @@
 // Check that the call operator SFINAE's away when too few arguments
 // are provided but is well-formed otherwise.
 {
-static_assert(!CheckCall(), "");
+LIBCPP_STATIC_ASSERT(!CheckCall(), "");
 static_assert(CheckCall(), "");
 static_assert(CheckCall(), "");
-static_assert(!CheckCall(), "");
+LIBCPP_STATIC_ASSERT(!CheckCall(), "");
 static_assert(CheckCall(), "");
 static_assert(CheckCall(), "");
 }
@@ -108,7 +110,7 @@
 // Check that the call operator SFINAE's away when too few arguments
 // are provided but is well-formed otherwise.
 {
-static_assert(!CheckCall(), "");
+LIBCPP_STATIC_ASSERT(!CheckCall(), "");
 static_assert(CheckCall(), "");
 static_assert(CheckCall(), "");
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D22014: [libcxx] [test] Follow LWG 2520 "N4089 broke initializing unique_ptr from a nullptr".

2016-07-05 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Follow LWG 2520 "N4089 broke initializing unique_ptr from a nullptr".

This library issue permits nullptr, but not 0 or NULL (which can be 0). In 
null_ctor.pass.cpp, replace 0 with nullptr. In pointer_deleter01.pass.cpp, 
which is testing both NULL and nullptr, mark the NULL test as libcxx-specific.

http://reviews.llvm.org/D22014

Files:
  test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
  
test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp

Index: 
test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
===
--- 
test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
+++ 
test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
@@ -42,7 +42,9 @@
 assert(A::count == 0);
 
 { // LWG#2520 says that nullptr is a valid input as well as null
+#ifdef _LIBCPP_VERSION
 std::unique_ptr > s1(NULL, Deleter());
+#endif
 std::unique_ptr > s2(nullptr, Deleter());
 }
 assert(A::count == 0);
Index: 
test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
===
--- test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
+++ test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
@@ -36,7 +36,7 @@
 Deleter d;
 assert(d.state() == 0);
 {
-std::unique_ptr p(0, d);
+std::unique_ptr p(nullptr, d);
 assert(p.get() == 0);
 assert(&p.get_deleter() == &d);
 }


Index: test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
===
--- test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
+++ test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
@@ -42,7 +42,9 @@
 assert(A::count == 0);
 
 { // LWG#2520 says that nullptr is a valid input as well as null
+#ifdef _LIBCPP_VERSION
 std::unique_ptr > s1(NULL, Deleter());
+#endif
 std::unique_ptr > s2(nullptr, Deleter());
 }
 assert(A::count == 0);
Index: test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
===
--- test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
+++ test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
@@ -36,7 +36,7 @@
 Deleter d;
 assert(d.state() == 0);
 {
-std::unique_ptr p(0, d);
+std::unique_ptr p(nullptr, d);
 assert(p.get() == 0);
 assert(&p.get_deleter() == &d);
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D22016: [libcxx] [test] Fix a non-Standard allocator in vector.cons/construct_iter_iter_alloc.pass.cpp.

2016-07-05 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Fix a non-Standard allocator in vector.cons/construct_iter_iter_alloc.pass.cpp.

You gotta have a rebinding constructor. MSVC loves rebinding.

http://reviews.llvm.org/D22016

Files:
  
test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp

Index: 
test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
===
--- 
test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
+++ 
test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
@@ -40,6 +40,9 @@
 {
 implicit_conv_allocator(void*) {}
 implicit_conv_allocator(const implicit_conv_allocator&) = default;
+
+template 
+implicit_conv_allocator(implicit_conv_allocator) {}
 };
 
 #endif


Index: test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
===
--- test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
+++ test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
@@ -40,6 +40,9 @@
 {
 implicit_conv_allocator(void*) {}
 implicit_conv_allocator(const implicit_conv_allocator&) = default;
+
+template 
+implicit_conv_allocator(implicit_conv_allocator) {}
 };
 
 #endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D22017: [libcxx] [test] Work around MSVC's non-Standard ABI for enums.

2016-07-05 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Work around MSVC's non-Standard ABI for enums.

So this is definitely an MSVC bug, but one that's baked into our layout 
behavior, so even Clang has to enable it unconditionally when targeting Windows.

In underlying_type.pass.cpp, I'm simply marking the affected static_asserts as 
libcxx-specific (this probably won't be sufficient when you try to get the 
Clang/LLVM/libcxx stack running on Windows). In make_signed.pass.cpp and 
make_unsigned.pass.cpp, I'm giving the enum an explicitly specified underlying 
type, so the tests below can remain unaffected.

If there's a better way to do this, please let me know. I could give 
underlying_type.pass.cpp an explicitly specified underlying type, but I'm 
unsure as to how your C++03 tests work.

http://reviews.llvm.org/D22017

Files:
  test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
  test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
  test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp

Index: test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
===
--- test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
+++ test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
@@ -13,9 +13,15 @@
 
 #include 
 
+#include "test_macros.h"
+
 enum Enum {zero, one_};
 
+#if TEST_STD_VER >= 11
+enum BigEnum : unsigned long long // MSVC's ABI doesn't follow the Standard
+#else
 enum BigEnum
+#endif
 {
 bigzero,
 big = 0xULL
Index: test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
===
--- test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
+++ test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
@@ -13,9 +13,15 @@
 
 #include 
 
+#include "test_macros.h"
+
 enum Enum {zero, one_};
 
+#if TEST_STD_VER >= 11
+enum BigEnum : unsigned long long // MSVC's ABI doesn't follow the Standard
+#else
 enum BigEnum
+#endif
 {
 bigzero,
 big = 0xULL
Index: 
test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
===
--- test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
+++ test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
@@ -23,12 +23,12 @@
 {
 static_assert((std::is_same::type, int>::value),
   "E has the wrong underlying type");
-static_assert((std::is_same::type, 
unsigned>::value),
-  "F has the wrong underlying type");
+LIBCPP_STATIC_ASSERT((std::is_same::type, 
unsigned>::value),
+  "F has the wrong underlying type"); // MSVC's ABI doesn't 
follow the Standard
 
 #if _LIBCPP_STD_VER > 11
 static_assert((std::is_same, int>::value), "");
-static_assert((std::is_same, unsigned>::value), 
"");
+LIBCPP_STATIC_ASSERT((std::is_same, 
unsigned>::value), ""); // MSVC's ABI
 #endif
 
 #if TEST_STD_VER >= 11


Index: test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
===
--- test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
+++ test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
@@ -13,9 +13,15 @@
 
 #include 
 
+#include "test_macros.h"
+
 enum Enum {zero, one_};
 
+#if TEST_STD_VER >= 11
+enum BigEnum : unsigned long long // MSVC's ABI doesn't follow the Standard
+#else
 enum BigEnum
+#endif
 {
 bigzero,
 big = 0xULL
Index: test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
===
--- test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
+++ test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
@@ -13,9 +13,15 @@
 
 #include 
 
+#include "test_macros.h"
+
 enum Enum {zero, one_};
 
+#if TEST_STD_VER >= 11
+enum BigEnum : unsigned long long // MSVC's ABI doesn't follow the Standard
+#else
 enum BigEnum
+#endif
 {
 bigzero,
 big = 0xULL
Index: test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
===
--- test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
+++ test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
@@ -23,12 +23,12 @@
 {
 static_assert((std::is_same::type, int>::value),
   "E has the wrong underlying type");
-static_assert((std::is_same::type, unsigned>::value),
-  "F has the wrong underlying type");
+LIBCPP_STATIC_ASSERT((std::i

Re: [PATCH] D21834: Implementing 'If statement with Initializer'

2016-07-05 Thread Anton Bikineev via cfe-commits
AntonBikineev updated this revision to Diff 62790.
AntonBikineev added a comment.

@rsmith,
Thanks for the comments, I've addressed them (except for tests, they are to be 
added asap). I'm especially not sure about changes in CFG.cpp, could you verify 
please?


http://reviews.llvm.org/D21834

Files:
  include/clang/AST/Stmt.h
  include/clang/Sema/Sema.h
  lib/AST/ASTImporter.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/Stmt.cpp
  lib/Analysis/BodyFarm.cpp
  lib/Analysis/CFG.cpp
  lib/CodeGen/CGStmt.cpp
  lib/Sema/JumpDiagnostics.cpp
  lib/Sema/SemaStmt.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/Parser/cxx1z-init-statement.cpp

Index: test/Parser/cxx1z-init-statement.cpp
===
--- test/Parser/cxx1z-init-statement.cpp
+++ test/Parser/cxx1z-init-statement.cpp
@@ -4,17 +4,17 @@
 typedef int T;
 int f() {
   // init-statement declarations
-  if (T n = 0; n != 0) {} // expected-error {{not yet supported}}
-  if (T f(); f()) {} // expected-error {{not yet supported}}
-  if (T(f()); f()) {} // expected-error {{not yet supported}}
-  if (T(f()), g, h; f()) {} // expected-error {{not yet supported}}
-  if (T f(); f()) {} // expected-error {{not yet supported}}
-  if (T f(), g, h; f()) {} // expected-error {{not yet supported}}
+  if (T n = 0; n != 0) {}
+  if (T f(); f()) {}
+  if (T(f()); f()) {}
+  if (T(f()), g, h; f()) {}
+  if (T f(); f()) {}
+  if (T f(), g, h; f()) {}
 
   // init-statement expressions
-  if (T{f()}; f()) {} // expected-error {{not yet supported}}
-  if (T{f()}, g, h; f()) {} // expected-error {{not yet supported}} expected-warning 2{{unused}}
-  if (T(f()), g, h + 1; f()) {} // expected-error {{not yet supported}} expected-warning 2{{unused}}
+  if (T{f()}; f()) {}
+  if (T{f()}, g, h; f()) {} // expected-warning 2{{unused}}
+  if (T(f()), g, h + 1; f()) {} // expected-warning 2{{unused}}
 
   // condition declarations
   if (T(n){g}) {}
@@ -32,10 +32,10 @@
   //if (T(n)(g)) {} // expected-err-FIXME {{not a function}}
 
   // Likewise for 'switch'
-  switch (int n; n) {} // expected-error {{not yet supported}}
-  switch (g; int g = 5) {} // expected-error {{not yet supported}}
+  switch (int n; n) {}
+  switch (g; int g = 5) {}
 
-  if (int a, b; int c = a) { // expected-error {{not yet supported}} expected-note 6{{previous}}
+  if (int a, b; int c = a) { // expected-note 6{{previous}}
 int a; // expected-error {{redefinition}}
 int b; // expected-error {{redefinition}}
 int c; // expected-error {{redefinition}}
@@ -44,4 +44,6 @@
 int b; // expected-error {{redefinition}}
 int c; // expected-error {{redefinition}}
   }
+
+  return 0;
 }
Index: lib/Serialization/ASTWriterStmt.cpp
===
--- lib/Serialization/ASTWriterStmt.cpp
+++ lib/Serialization/ASTWriterStmt.cpp
@@ -129,6 +129,7 @@
 void ASTStmtWriter::VisitIfStmt(IfStmt *S) {
   VisitStmt(S);
   Record.push_back(S->isConstexpr());
+  Record.AddStmt(S->getInit());
   Record.AddDeclRef(S->getConditionVariable());
   Record.AddStmt(S->getCond());
   Record.AddStmt(S->getThen());
@@ -140,6 +141,7 @@
 
 void ASTStmtWriter::VisitSwitchStmt(SwitchStmt *S) {
   VisitStmt(S);
+  Record.AddStmt(S->getInit());
   Record.AddDeclRef(S->getConditionVariable());
   Record.AddStmt(S->getCond());
   Record.AddStmt(S->getBody());
Index: lib/Serialization/ASTReaderStmt.cpp
===
--- lib/Serialization/ASTReaderStmt.cpp
+++ lib/Serialization/ASTReaderStmt.cpp
@@ -185,6 +185,7 @@
 void ASTStmtReader::VisitIfStmt(IfStmt *S) {
   VisitStmt(S);
   S->setConstexpr(Record[Idx++]);
+  S->setInit(Reader.ReadSubStmt());
   S->setConditionVariable(Reader.getContext(),
   ReadDeclAs(Record, Idx));
   S->setCond(Reader.ReadSubExpr());
@@ -196,6 +197,7 @@
 
 void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
   VisitStmt(S);
+  S->setInit(Reader.ReadSubStmt());
   S->setConditionVariable(Reader.getContext(),
   ReadDeclAs(Record, Idx));
   S->setCond(Reader.ReadSubExpr());
Index: lib/Sema/TreeTransform.h
===
--- lib/Sema/TreeTransform.h
+++ lib/Sema/TreeTransform.h
@@ -1174,9 +1174,9 @@
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
   StmtResult RebuildIfStmt(SourceLocation IfLoc, bool IsConstexpr,
-   Sema::ConditionResult Cond, Stmt *Then,
+   Sema::ConditionResult Cond, Stmt *Init, Stmt *Then,
SourceLocation ElseLoc, Stmt *Else) {
-return getSema().ActOnIfStmt(IfLoc, IsConstexpr, nullptr, Cond, Then,
+return getSema().ActOnIfStmt(IfLoc, IsConstexpr, Init, Cond, Then,
  ElseL

r274577 - [OpenMP] remove outdated comment (NFC)

2016-07-05 Thread Kelvin Li via cfe-commits
Author: kli
Date: Tue Jul  5 16:38:53 2016
New Revision: 274577

URL: http://llvm.org/viewvc/llvm-project?rev=274577&view=rev
Log:
[OpenMP] remove outdated comment (NFC)

Modified:
cfe/trunk/lib/Basic/OpenMPKinds.cpp

Modified: cfe/trunk/lib/Basic/OpenMPKinds.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/OpenMPKinds.cpp?rev=274577&r1=274576&r2=274577&view=diff
==
--- cfe/trunk/lib/Basic/OpenMPKinds.cpp (original)
+++ cfe/trunk/lib/Basic/OpenMPKinds.cpp Tue Jul  5 16:38:53 2016
@@ -644,7 +644,6 @@ bool clang::isOpenMPTargetExecutionDirec
 }
 
 bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
-  // TODO add target update directive check.
   return DKind == OMPD_target_data || DKind == OMPD_target_enter_data ||
  DKind == OMPD_target_exit_data || DKind == OMPD_target_update;
 }


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


Re: [PATCH] D21472: [clang-tidy] readability-identifier-naming - support for other case types

2016-07-05 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

In http://reviews.llvm.org/D21472#473813, @JamesReynolds wrote:

> Ah, I took this from a single example in the CPP core guidelines - that PDF 
> is indeed a very different style. An idea we toyed with was "UpperSeparated" 
> and "UpperSeparatedBack"? Would that work?


You mean Upper_Separated and upper_Separated_Back? ;) Actually, these names are 
not particularly clear. I've managed to find "Camel_Snake_Case" used for 
exactly this naming convention (in the https://github.com/t6/camel_snake_kebab 
library). Maybe "camel_Snake_Back" as well?

> This comes from ...


I just wanted to hear that this is actually going to be used. No objections.


http://reviews.llvm.org/D21472



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


Re: [PATCH] D11360: Proposed patch to prevent the creation of empty (forwarding) blocks resulting from nested ifs.

2016-07-05 Thread Mehdi AMINI via cfe-commits
mehdi_amini added inline comments.


Comment at: lib/CodeGen/CGStmt.cpp:614
@@ -610,1 +613,3 @@
+  SimplifyForwardingBlocks(CurBlock); 
+  }
 

Document


Comment at: lib/CodeGen/CGStmt.cpp:633
@@ -626,1 +632,3 @@
+  if (CurBlock)
+SimplifyForwardingBlocks(CurBlock); 
 }

Document


Comment at: test/CodeGen/forwarding-blocks-if.c:17
@@ +16,3 @@
+return 0;
+}
+

Any reason to not stick with LLVM coding convention here?


http://reviews.llvm.org/D11360



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


Re: [PATCH] D21295: Add a negative TBAA test

2016-07-05 Thread Manman Ren via cfe-commits
manmanren added a subscriber: manmanren.
manmanren added a comment.

In http://reviews.llvm.org/D21295#474241, @Anastasia wrote:

> LGTM!
>
> Has this test case been missing from the original commit? If yes, could you 
> point to it please! Thanks!


The original commit is the support for tbaa, when we added support for tbaa, we 
check that correct tbaa metadata is generated when tbaa is on, but didn't test 
the other way (i.e no tbaa metadata if tbaa is off).


http://reviews.llvm.org/D21295



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


Re: [PATCH] D21700: [SemaExpr] Support lax conversions in assignments with vector and scalars with same size

2016-07-05 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

In http://reviews.llvm.org/D21700#470103, @rnk wrote:

> After writing r266366, we discovered that GCC accepts none of the code in 
> that test case, so we should consider turning -flax-vector-conversions off by 
> default.


Makes sense, specially given the non obvious semantics; users shouldn't rely on 
this behavior by default without the knowledge of what's actually going on.



Comment at: test/Sema/vector-cast.c:65
@@ -59,1 +64,3 @@
+  d = f2;
+  d = d + f2;
 }

rnk wrote:
> Why should we allow this conversion? I don't see how <2 x float> and double 
> should be convertible. I'm not sure why we allow `f2 += d` above, but I think 
> of it as "widening" the type from scalar to vector.
> 
> Would it be OK for your if we tightened our lax vector conversion checks to 
> just allow conversion from `<1 x T>` to `T`? The test case in the summary 
> seems like pretty reasonable code, even if GCC rejects.
I misread the testcase, `<2 x float>` and `double` shouldn't be convertible 
indeed. Thanks for the catch.

Allowing conversions from `<1 x T>` to `T` is enough for us, it also sounds 
more correct. 


http://reviews.llvm.org/D21700



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


Re: [PATCH] D21700: [SemaExpr] Support lax conversions in assignments with vector and scalars with same size

2016-07-05 Thread Bruno Cardoso Lopes via cfe-commits
bruno updated this revision to Diff 62802.
bruno added a comment.

Update patch after Reid's suggestions.


http://reviews.llvm.org/D21700

Files:
  lib/Sema/SemaExpr.cpp
  test/Sema/vector-cast.c

Index: test/Sema/vector-cast.c
===
--- test/Sema/vector-cast.c
+++ test/Sema/vector-cast.c
@@ -45,15 +45,23 @@
 }
 
 typedef float float2 __attribute__ ((vector_size (8)));
+typedef __attribute__((vector_size(8))) double float64x1_t;
+typedef __attribute__((vector_size(16))) double float64x2_t;
+float64x1_t vget_low_f64(float64x2_t __p0);
 
 void f4() {
   float2 f2;
-  double d;
+  double d, a, b, c;
+  float64x2_t v = {0.0, 1.0};
   f2 += d;
-  // We used to allow the next statement, but we've always rejected the next 
two
-  // statements
+  a = 3.0 + vget_low_f64(v);
+  b = vget_low_f64(v) + 3.0;
+  c = vget_low_f64(v);
+  // LAX conversions within compound assignments are not supported.
   // FIXME: This diagnostic is inaccurate.
   d += f2; // expected-error {{cannot convert between vector values of 
different size}}
+  c -= vget_low_f64(v); // expected-error {{cannot convert between vector 
values of different size}}
+  // LAX conversions between scalar and vector types require same size and one 
element sized vectors.
   d = f2; // expected-error {{assigning to 'double' from incompatible type 
'float2'}}
   d = d + f2; // expected-error {{assigning to 'double' from incompatible type 
'float2'}}
 }
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -7394,6 +7394,22 @@
 return IncompatibleVectors;
   }
 }
+
+// When the RHS comes from another lax conversion (e.g. binops between
+// scalars and vectors) the result is canonicalized as a vector. When the
+// LHS is also a vector, the lax is allowed by the condition above. Handle
+// the case where LHS is a scalar.
+if (LHSType->isScalarType()) {
+  const VectorType *VecType = RHSType->getAs();
+  if (VecType && VecType->getNumElements() == 1 &&
+  isLaxVectorConversion(RHSType, LHSType)) {
+ExprResult *VecExpr = &RHS;
+*VecExpr = ImpCastExprToType(VecExpr->get(), LHSType, CK_BitCast);
+Kind = CK_BitCast;
+return Compatible;
+  }
+}
+
 return Incompatible;
   }
 


Index: test/Sema/vector-cast.c
===
--- test/Sema/vector-cast.c
+++ test/Sema/vector-cast.c
@@ -45,15 +45,23 @@
 }
 
 typedef float float2 __attribute__ ((vector_size (8)));
+typedef __attribute__((vector_size(8))) double float64x1_t;
+typedef __attribute__((vector_size(16))) double float64x2_t;
+float64x1_t vget_low_f64(float64x2_t __p0);
 
 void f4() {
   float2 f2;
-  double d;
+  double d, a, b, c;
+  float64x2_t v = {0.0, 1.0};
   f2 += d;
-  // We used to allow the next statement, but we've always rejected the next two
-  // statements
+  a = 3.0 + vget_low_f64(v);
+  b = vget_low_f64(v) + 3.0;
+  c = vget_low_f64(v);
+  // LAX conversions within compound assignments are not supported.
   // FIXME: This diagnostic is inaccurate.
   d += f2; // expected-error {{cannot convert between vector values of different size}}
+  c -= vget_low_f64(v); // expected-error {{cannot convert between vector values of different size}}
+  // LAX conversions between scalar and vector types require same size and one element sized vectors.
   d = f2; // expected-error {{assigning to 'double' from incompatible type 'float2'}}
   d = d + f2; // expected-error {{assigning to 'double' from incompatible type 'float2'}}
 }
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -7394,6 +7394,22 @@
 return IncompatibleVectors;
   }
 }
+
+// When the RHS comes from another lax conversion (e.g. binops between
+// scalars and vectors) the result is canonicalized as a vector. When the
+// LHS is also a vector, the lax is allowed by the condition above. Handle
+// the case where LHS is a scalar.
+if (LHSType->isScalarType()) {
+  const VectorType *VecType = RHSType->getAs();
+  if (VecType && VecType->getNumElements() == 1 &&
+  isLaxVectorConversion(RHSType, LHSType)) {
+ExprResult *VecExpr = &RHS;
+*VecExpr = ImpCastExprToType(VecExpr->get(), LHSType, CK_BitCast);
+Kind = CK_BitCast;
+return Compatible;
+  }
+}
+
 return Incompatible;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16538: [cc1as] Add MCTargetOptions argument to createAsmBackend

2016-07-05 Thread Joel Jones via cfe-commits
joelkevinjones updated this revision to Diff 62793.
joelkevinjones added a comment.
Herald added a subscriber: mehdi_amini.

Updated to ToT. Passes "make check-clang"


http://reviews.llvm.org/D16538

Files:
  tools/driver/cc1as_main.cpp

Index: tools/driver/cc1as_main.cpp
===
--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -379,7 +379,8 @@
 MCAsmBackend *MAB = nullptr;
 if (Opts.ShowEncoding) {
   CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
-  MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple, Opts.CPU);
+  MCTargetOptions Options;
+  MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple, Opts.CPU, 
Options);
 }
 auto FOut = llvm::make_unique(*Out);
 Str.reset(TheTarget->createAsmStreamer(
@@ -396,8 +397,9 @@
 }
 
 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
+MCTargetOptions Options;
 MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple,
-  Opts.CPU);
+  Opts.CPU, Options);
 Triple T(Opts.Triple);
 Str.reset(TheTarget->createMCObjectStreamer(
 T, Ctx, *MAB, *Out, CE, *STI, Opts.RelaxAll,


Index: tools/driver/cc1as_main.cpp
===
--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -379,7 +379,8 @@
 MCAsmBackend *MAB = nullptr;
 if (Opts.ShowEncoding) {
   CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
-  MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple, Opts.CPU);
+  MCTargetOptions Options;
+  MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple, Opts.CPU, Options);
 }
 auto FOut = llvm::make_unique(*Out);
 Str.reset(TheTarget->createAsmStreamer(
@@ -396,8 +397,9 @@
 }
 
 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
+MCTargetOptions Options;
 MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple,
-  Opts.CPU);
+  Opts.CPU, Options);
 Triple T(Opts.Triple);
 Str.reset(TheTarget->createMCObjectStreamer(
 T, Ctx, *MAB, *Out, CE, *STI, Opts.RelaxAll,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21515: Update clang for D21514. NFC

2016-07-05 Thread Amaury SECHET via cfe-commits
deadalnix updated this revision to Diff 62791.
deadalnix added a comment.

rebase/ping


http://reviews.llvm.org/D21515

Files:
  lib/CodeGen/CGExpr.cpp

Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -2753,10 +2753,11 @@
 llvm::CallInst *CodeGenFunction::EmitTrapCall(llvm::Intrinsic::ID IntrID) {
   llvm::CallInst *TrapCall = Builder.CreateCall(CGM.getIntrinsic(IntrID));
 
-  if (!CGM.getCodeGenOpts().TrapFuncName.empty())
-TrapCall->addAttribute(llvm::AttributeSet::FunctionIndex,
-   "trap-func-name",
-   CGM.getCodeGenOpts().TrapFuncName);
+  if (!CGM.getCodeGenOpts().TrapFuncName.empty()) {
+auto A = llvm::Attribute::get(getLLVMContext(), "trap-func-name",
+  CGM.getCodeGenOpts().TrapFuncName);
+TrapCall->addAttribute(llvm::AttributeSet::FunctionIndex, A);
+  }
 
   return TrapCall;
 }


Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -2753,10 +2753,11 @@
 llvm::CallInst *CodeGenFunction::EmitTrapCall(llvm::Intrinsic::ID IntrID) {
   llvm::CallInst *TrapCall = Builder.CreateCall(CGM.getIntrinsic(IntrID));
 
-  if (!CGM.getCodeGenOpts().TrapFuncName.empty())
-TrapCall->addAttribute(llvm::AttributeSet::FunctionIndex,
-   "trap-func-name",
-   CGM.getCodeGenOpts().TrapFuncName);
+  if (!CGM.getCodeGenOpts().TrapFuncName.empty()) {
+auto A = llvm::Attribute::get(getLLVMContext(), "trap-func-name",
+  CGM.getCodeGenOpts().TrapFuncName);
+TrapCall->addAttribute(llvm::AttributeSet::FunctionIndex, A);
+  }
 
   return TrapCall;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21991: [libunwind][ARM] Improve unwinder stack usage - Make WMMX support optional

2016-07-05 Thread Saleem Abdulrasool via cfe-commits
compnerd added a subscriber: compnerd.
compnerd added a comment.

I don't think that clang nor LLVM have much in terms of support for XScale.  
Can we do something more convoluted perhaps?  I like the preprocessor based 
approach.  However, if the compiler doesn't define it with the correct target, 
we define it and push it into the CPPFLAGS.  This way, in the future, we can 
rely on the compiler to do the right thing and eventually lose the cmake magic.


http://reviews.llvm.org/D21991



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


Re: [PATCH] D18510: [cxx1z-constexpr-lambda] Make conversion function constexpr

2016-07-05 Thread Faisal Vali via cfe-commits
faisalv updated the summary for this revision.
faisalv updated this revision to Diff 62814.
faisalv added a comment.

Mark the lambda's conversion to function-pointer as incontrovertibly constexpr.

auto L = [](auto a) { return a; };
constexpr int* (*fp)(int*) = L; // This is now allowed.

Instead of inserting the extension/compatibility-warning into the same list 
that houses the notes that identify errors that occurred during 
constant-folding (and subsequently modifying the logic to ignore such warnings 
when determining the result of constant folding), I resorted to the simple 
approach used to emit a warning for integer-overflow (during constant folding) 
by invoking getDiagnostics().Report.

Richard I hope you're OK with this approach - I know in Oulu I was leaning 
towards inserting the warning into the same list that houses the error-notes 
(or potentially creating another one, or having EvalInfo track whether an 
error-note truly occurred instead of relying simply on the size of the list) - 
and while doable (and potentially cleaner) - that change is a larger one that 
requires handing some subtleties, and can be done at a later time, if you feel 
strongly about it.


http://reviews.llvm.org/D18510

Files:
  include/clang/Basic/DiagnosticASTKinds.td
  lib/AST/ExprConstant.cpp
  lib/Sema/SemaLambda.cpp
  test/SemaCXX/cxx1z-constexpr-lambdas.cpp

Index: test/SemaCXX/cxx1z-constexpr-lambdas.cpp
===
--- test/SemaCXX/cxx1z-constexpr-lambdas.cpp
+++ test/SemaCXX/cxx1z-constexpr-lambdas.cpp
@@ -2,7 +2,9 @@
 // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks 
-fdelayed-template-parsing %s 
 // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fms-extensions 
%s 
 // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks 
-fdelayed-template-parsing -fms-extensions %s 
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -Wc++14-compat %s 
-DCHECK_COMPATIBILITY_WARNING
 
+#ifndef CHECK_COMPATIBILITY_WARNING
 namespace test_constexpr_checking {
 
 namespace ns1 {
@@ -33,4 +35,17 @@
   L(3); //expected-note{{non-constexpr function}}
 } 
 
-} // end ns test_constexpr_call
\ No newline at end of file
+} // end ns test_constexpr_call
+#endif
+
+#ifdef CHECK_COMPATIBILITY_WARNING
+//expected-warning@+6{{incompatible with C++ standards before C++1z}}
+//expected-warning@+6{{incompatible with C++ standards before C++1z}}
+#endif
+
+namespace ns4 {
+auto L = [](auto a) { return a; };
+constexpr int (*fp1)(int) = L;  
+constexpr int* (*fp2)(int*) = L; 
+
+} // end ns4
\ No newline at end of file
Index: lib/Sema/SemaLambda.cpp
===
--- lib/Sema/SemaLambda.cpp
+++ lib/Sema/SemaLambda.cpp
@@ -1261,7 +1261,7 @@
 ConvTy, 
 ConvTSI,
 /*isInline=*/true, /*isExplicit=*/false,
-/*isConstexpr=*/false, 
+/*isConstexpr=*/true, 
 CallOperator->getBody()->getLocEnd());
   Conversion->setAccess(AS_public);
   Conversion->setImplicit(true);
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -4353,6 +4353,17 @@
 if (!EvaluateObjectArgument(Info, ME->getBase(), ThisVal))
   return false;
 Member = ME->getMemberDecl();
+// If this is a non-capturing lambda's closure type's conversion
+// operator that results in a pointer-to-function, remind users that 
the
+// conversion operator itself was made 'constexpr' in C++1z.
+if (const CXXConversionDecl *Conv = 
dyn_cast(Member))
+  if (Conv->getParent()->isLambda()) {
+Info.Ctx.getDiagnostics().Report(
+E->getExprLoc(),
+!Info.Ctx.getLangOpts().CPlusPlus1z
+? diag::ext_constexpr_conversion_on_lambda_cxx1z
+: diag::warn_cxx14_compat_constexpr_conversion_on_lambda);
+  }
 This = &ThisVal;
 HasQualifier = ME->hasQualifier();
   } else if (const BinaryOperator *BE = dyn_cast(Callee)) {
Index: include/clang/Basic/DiagnosticASTKinds.td
===
--- include/clang/Basic/DiagnosticASTKinds.td
+++ include/clang/Basic/DiagnosticASTKinds.td
@@ -162,8 +162,17 @@
 // implementation is complete, and like the preceding constexpr notes belongs
 // in Sema.
 def note_unimplemented_constexpr_lambda_feature_ast : Note<
-"unimplemented constexpr lambda feature: %0 (coming soon!)">;
+  "unimplemented constexpr lambda feature: %0 (coming soon!)">;
 
+// C++1z constexpr lambda expressions
+def warn_cxx14_compat_constexpr_conversion_on_lambda : Warning<
+  "constexpr conversion to pointer-to-function on lambdas is "
+  "incomp

Re: [PATCH] D22007: [OpenMP] Sema and parsing for 'distribute simd' pragma

2016-07-05 Thread Alexey Bataev via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


http://reviews.llvm.org/D22007



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


Re: [PATCH] D21904: [OpenMP] Initial implementation of parse+sema for clause use_device_ptr of 'target data'

2016-07-05 Thread Carlo Bertolli via cfe-commits
carlo.bertolli updated this revision to Diff 62817.
carlo.bertolli added a comment.

[OpenMP] Remove private variable creation from this patch as requested by 
comments and rebase.


Repository:
  rL LLVM

http://reviews.llvm.org/D21904

Files:
  include/clang/AST/OpenMPClause.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/OpenMPKinds.def
  include/clang/Sema/Sema.h
  lib/AST/OpenMPClause.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Basic/OpenMPKinds.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/OpenMP/target_data_use_device_ptr_messages.cpp
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -2274,6 +2274,9 @@
 void OMPClauseEnqueue::VisitOMPFromClause(const OMPFromClause *C) {
   VisitOMPClauseList(C);
 }
+void OMPClauseEnqueue::VisitOMPUseDevicePtrClause(const OMPUseDevicePtrClause *C) {
+  VisitOMPClauseList(C);
+}
 }
 
 void EnqueueVisitor::EnqueueChildren(const OMPClause *S) {
Index: test/OpenMP/target_data_use_device_ptr_messages.cpp
===
--- /dev/null
+++ test/OpenMP/target_data_use_device_ptr_messages.cpp
@@ -0,0 +1,206 @@
+// RUN: %clang_cc1 -std=c++11 -verify -fopenmp -ferror-limit 200 %s
+struct ST {
+  int *a;
+};
+struct SA {
+  const int d = 5;
+  const int da[5] = { 0 };
+  ST e;
+  ST g[10];
+  int i;
+  int &j = i;
+  int *k = &j;
+  int *&z = k;
+  int aa[10];
+  void func(int arg) {
+#pragma omp target data map(i) use_device_ptr // expected-error {{expected '(' after 'use_device_ptr'}}
+{}
+#pragma omp target data map(i) use_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
+{}
+#pragma omp target data map(i) use_device_ptr() // expected-error {{expected expression}}
+{}
+#pragma omp target data map(i) use_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
+{}
+#pragma omp target data map(i) use_device_ptr(arg // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{item used in 'use_device_pointer' clause is not a pointer}}
+{}
+#pragma omp target data map(i) use_device_ptr(i) // expected-error {{item used in 'use_device_pointer' clause is not a pointer}}
+{}
+#pragma omp target data map(i) use_device_ptr(j) // expected-error {{item used in 'use_device_pointer' clause is not a pointer}}
+{}
+#pragma omp target data map(i) use_device_ptr(k) // OK
+{}
+#pragma omp target data map(i) use_device_ptr(z) // OK
+{}
+#pragma omp target data map(i) use_device_ptr(aa) // expected-error{{item used in 'use_device_pointer' clause is not a pointer}}
+{}
+#pragma omp target data map(i) use_device_ptr(e) // expected-error{{item used in 'use_device_pointer' clause is not a pointer}}
+{}
+#pragma omp target data map(i) use_device_ptr(g) // expected-error{{item used in 'use_device_pointer' clause is not a pointer}}
+{}
+#pragma omp target data map(i) use_device_ptr(k,i,j) // expected-error2 {{item used in 'use_device_pointer' clause is not a pointer}}
+{}
+#pragma omp target data map(i) use_device_ptr(d) // expected-error{{item used in 'use_device_pointer' clause is not a pointer}}
+{}
+#pragma omp target data map(i) use_device_ptr(da) // expected-error{{item used in 'use_device_pointer' clause is not a pointer}}
+{}
+  return;
+ }
+};
+struct SB {
+  unsigned A;
+  unsigned B;
+  float Arr[100];
+  float *Ptr;
+  float *foo() {
+return &Arr[0];
+  }
+};
+
+struct SC {
+  unsigned A : 2;
+  unsigned B : 3;
+  unsigned C;
+  unsigned D;
+  float Arr[100];
+  SB S;
+  SB ArrS[100];
+  SB *PtrS;
+  SB *&RPtrS;
+  float *Ptr;
+
+  SC(SB *&_RPtrS) : RPtrS(_RPtrS) {}
+};
+
+union SD {
+  unsigned A;
+  float B;
+};
+
+struct S1;
+extern S1 a;
+class S2 {
+  mutable int a;
+public:
+  S2():a(0) { }
+  S2(S2 &s2):a(s2.a) { }
+  static float S2s;
+  static const float S2sc;
+};
+const float S2::S2sc = 0;
+const S2 b;
+const S2 ba[5];
+class S3 {
+  int a;
+public:
+  S3():a(0) { }
+  S3(S3 &s3):a(s3.a) { }
+};
+const S3 c;
+const S3 ca[5];
+extern const int f;
+class S4 {
+  int a;
+  S4();
+  S4(const S4 &s4);
+public:
+  S4(int v):a(v) { }
+};
+class S5 {
+  int a;
+  S5():a(0) {}
+  S5(const S5 &s5):a(s5.a) { }
+public:
+  S5(int v):a(v) { }
+};
+
+S3 h;
+#pragma omp threadprivate(h)
+
+typedef int from;
+
+template 
+T tmain(T argc) {
+  const T d = 5;
+  const T da[5] = { 0 };
+  S4 e(4);
+  S5 g(5);
+  T i;
+  T &j = i;
+  T *k = &j;
+  T *&z = k;
+  T aa[10];
+#pragma omp target data map(i) use_device_ptr // expected-error {{expected '(' after 'use_device_ptr'}}
+  {}
+#pragma omp target

Re: [PATCH] D21904: [OpenMP] Initial implementation of parse+sema for clause use_device_ptr of 'target data'

2016-07-05 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.


Comment at: include/clang/AST/OpenMPClause.h:4221
@@ +4220,3 @@
+
+/// \brief This represents clause 'use_device_ptr' in the '#pragma omp ...'
+/// directives.

No \brief's


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:8333
@@ -8332,1 +8332,3 @@
   "expected at least one 'to' clause or 'from' clause specified to '#pragma 
omp target update'">;
+def  err_omp_usedeviceptr_not_a_pointer : Error<
+  "item used in 'use_device_pointer' clause is not a pointer">;

I think it 's better to use 'expected ...' form as in other errors/warnings


Comment at: include/clang/Sema/Sema.h:8466
@@ -8465,1 +8465,3 @@
SourceLocation EndLoc);
+  /// \brief Called on well-formed 'use_device_ptr' clause.
+  OMPClause *ActOnOpenMPUseDevicePtrClause(ArrayRef VarList,

No \brief


Comment at: lib/Sema/TreeTransform.h:1784
@@ -1783,1 +1783,3 @@
 
+  /// \brief Build a new OpenMP 'use_device_ptr' clause.
+  ///

Remove \brief tag


Repository:
  rL LLVM

http://reviews.llvm.org/D21904



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


r274599 - Delete some dead code, NFC

2016-07-05 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Tue Jul  5 22:08:47 2016
New Revision: 274599

URL: http://llvm.org/viewvc/llvm-project?rev=274599&view=rev
Log:
Delete some dead code, NFC

Found using clang's code coverage tool.

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

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=274599&r1=274598&r2=274599&view=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Tue Jul  5 22:08:47 2016
@@ -202,12 +202,6 @@ public:
 return None;
   }
 
-  /// \brief Return true if the given clang's file id has a corresponding
-  /// coverage file id.
-  bool hasExistingCoverageFileID(FileID File) const {
-return FileIDMapping.count(File);
-  }
-
   /// \brief Gather all the regions that were skipped by the preprocessor
   /// using the constructs like #if.
   void gatherSkippedRegions() {
@@ -387,10 +381,6 @@ struct CounterCoverageMappingBuilder
 return addCounters(addCounters(C1, C2), C3);
   }
 
-  Counter addCounters(Counter C1, Counter C2, Counter C3, Counter C4) {
-return addCounters(addCounters(C1, C2, C3), C4);
-  }
-
   /// \brief Return the region counter for the given statement.
   ///
   /// This should only be called on statements that have a dedicated counter.


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


r274600 - [AVX512] The 128 and 256-bit vplzcnt builtins require avx512cd in addition to avx512vl.

2016-07-05 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Tue Jul  5 22:25:17 2016
New Revision: 274600

URL: http://llvm.org/viewvc/llvm-project?rev=274600&view=rev
Log:
[AVX512] The 128 and 256-bit vplzcnt builtins require avx512cd in addition to 
avx512vl.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=274600&r1=274599&r2=274600&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Tue Jul  5 22:25:17 2016
@@ -1766,10 +1766,10 @@ TARGET_BUILTIN(__builtin_ia32_rcp14pd128
 TARGET_BUILTIN(__builtin_ia32_rcp14pd256_mask, "V4dV4dV4dUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_rcp14ps128_mask, "V4fV4fV4fUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_rcp14ps256_mask, "V8fV8fV8fUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_vplzcntd_128_mask, "V4iV4iV4iUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_vplzcntd_256_mask, "V8iV8iV8iUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_vplzcntq_128_mask, 
"V2LLiV2LLiV2LLiUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_vplzcntq_256_mask, 
"V4LLiV4LLiV4LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_vplzcntd_128_mask, 
"V4iV4iV4iUc","","avx512cd,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_vplzcntd_256_mask, 
"V8iV8iV8iUc","","avx512cd,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_vplzcntq_128_mask, 
"V2LLiV2LLiV2LLiUc","","avx512cd,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_vplzcntq_256_mask, 
"V4LLiV4LLiV4LLiUc","","avx512cd,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_vcvtsd2si64, "LLiV2dIi","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_vcvtsd2si32, "iV2dIi","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_vcvtsd2usi32, "UiV2dIi","","avx512f")


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


r274601 - [AST] Use ArrayRef in more interfaces

2016-07-05 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Tue Jul  5 23:19:16 2016
New Revision: 274601

URL: http://llvm.org/viewvc/llvm-project?rev=274601&view=rev
Log:
[AST] Use ArrayRef in more interfaces

ArrayRef is a little better than passing around a pointer/length pair.

No functional change is intended.

Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=274601&r1=274600&r2=274601&view=diff
==
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Tue Jul  5 23:19:16 2016
@@ -489,8 +489,8 @@ public:
   Profile(llvm::FoldingSetNodeID &ID, ArrayRef TemplateArgs,
   ASTContext &Context) {
 ID.AddInteger(TemplateArgs.size());
-for (unsigned Arg = 0; Arg != TemplateArgs.size(); ++Arg)
-  TemplateArgs[Arg].Profile(ID, Context);
+for (const TemplateArgument &TemplateArg : TemplateArgs)
+  TemplateArg.Profile(ID, Context);
   }
 };
 
@@ -1179,9 +1179,8 @@ class NonTypeTemplateParmDecl final
   SourceLocation IdLoc, unsigned D, unsigned P,
   IdentifierInfo *Id, QualType T,
   TypeSourceInfo *TInfo,
-  const QualType *ExpandedTypes,
-  unsigned NumExpandedTypes,
-  TypeSourceInfo **ExpandedTInfos);
+  ArrayRef ExpandedTypes,
+  ArrayRef ExpandedTInfos);
 
   friend class ASTDeclReader;
   friend TrailingObjects;
@@ -1195,9 +1194,8 @@ public:
   static NonTypeTemplateParmDecl *
   Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
  SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id,
- QualType T, TypeSourceInfo *TInfo,
- const QualType *ExpandedTypes, unsigned NumExpandedTypes,
- TypeSourceInfo **ExpandedTInfos);
+ QualType T, TypeSourceInfo *TInfo, ArrayRef ExpandedTypes,
+ ArrayRef ExpandedTInfos);
 
   static NonTypeTemplateParmDecl *CreateDeserialized(ASTContext &C, 
  unsigned ID);
@@ -1360,8 +1358,7 @@ class TemplateTemplateParmDecl final
   TemplateTemplateParmDecl(DeclContext *DC, SourceLocation L,
unsigned D, unsigned P,
IdentifierInfo *Id, TemplateParameterList *Params,
-   unsigned NumExpansions,
-   TemplateParameterList * const *Expansions);
+   ArrayRef Expansions);
 
 public:
   static TemplateTemplateParmDecl *Create(const ASTContext &C, DeclContext *DC,
@@ -1768,8 +1765,8 @@ public:
   Profile(llvm::FoldingSetNodeID &ID, ArrayRef TemplateArgs,
   ASTContext &Context) {
 ID.AddInteger(TemplateArgs.size());
-for (unsigned Arg = 0; Arg != TemplateArgs.size(); ++Arg)
-  TemplateArgs[Arg].Profile(ID, Context);
+for (const TemplateArgument &TemplateArg : TemplateArgs)
+  TemplateArg.Profile(ID, Context);
   }
 
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
@@ -2162,18 +2159,11 @@ private:
   // Location of the 'friend' specifier.
   SourceLocation FriendLoc;
 
-
   FriendTemplateDecl(DeclContext *DC, SourceLocation Loc,
- unsigned NParams,
- TemplateParameterList **Params,
- FriendUnion Friend,
- SourceLocation FriendLoc)
-: Decl(Decl::FriendTemplate, DC, Loc),
-  NumParams(NParams),
-  Params(Params),
-  Friend(Friend),
-  FriendLoc(FriendLoc)
-  {}
+ MutableArrayRef Params,
+ FriendUnion Friend, SourceLocation FriendLoc)
+  : Decl(Decl::FriendTemplate, DC, Loc), NumParams(Params.size()),
+Params(Params.data()), Friend(Friend), FriendLoc(FriendLoc) {}
 
   FriendTemplateDecl(EmptyShell Empty)
 : Decl(Decl::FriendTemplate, Empty),
@@ -2182,12 +2172,10 @@ private:
   {}
 
 public:
-  static FriendTemplateDecl *Create(ASTContext &Context,
-DeclContext *DC, SourceLocation Loc,
-unsigned NParams,
-TemplateParameterList **Params,
-FriendUnion Friend,
-SourceLocation FriendLoc);
+  static FriendTemplateDecl *
+  Create(ASTContext &Context, DeclContext *DC, SourceLocation Loc,
+ MutableArrayRef Params, FriendUnion Friend,
+ SourceLocation FriendLoc);
 
   static FriendTemplateDecl *CreateDeserialized(ASTContext &C, unsigned 

r274603 - [AVX512] Use the generic ctlz intrinsic to implement the vplzcntd/q builtins.

2016-07-05 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Tue Jul  5 23:24:29 2016
New Revision: 274603

URL: http://llvm.org/viewvc/llvm-project?rev=274603&view=rev
Log:
[AVX512] Use the generic ctlz intrinsic to implement the vplzcntd/q builtins.

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/avx512cdintrin.c
cfe/trunk/test/CodeGen/avx512vlcd-builtins.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=274603&r1=274602&r2=274603&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Jul  5 23:24:29 2016
@@ -7163,6 +7163,18 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 return EmitX86MaskedCompare(*this, CC, false, Ops);
   }
 
+  case X86::BI__builtin_ia32_vplzcntd_128_mask:
+  case X86::BI__builtin_ia32_vplzcntd_256_mask:
+  case X86::BI__builtin_ia32_vplzcntd_512_mask:
+  case X86::BI__builtin_ia32_vplzcntq_128_mask:
+  case X86::BI__builtin_ia32_vplzcntq_256_mask:
+  case X86::BI__builtin_ia32_vplzcntq_512_mask: {
+Function *F = CGM.getIntrinsic(Intrinsic::ctlz, Ops[0]->getType());
+return EmitX86Select(*this, Ops[2],
+ Builder.CreateCall(F, 
{Ops[0],Builder.getInt1(false)}),
+ Ops[1]);
+  }
+
   // TODO: Handle 64/512-bit vector widths of min/max.
   case X86::BI__builtin_ia32_pmaxsb128:
   case X86::BI__builtin_ia32_pmaxsw128:

Modified: cfe/trunk/test/CodeGen/avx512cdintrin.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512cdintrin.c?rev=274603&r1=274602&r2=274603&view=diff
==
--- cfe/trunk/test/CodeGen/avx512cdintrin.c (original)
+++ cfe/trunk/test/CodeGen/avx512cdintrin.c Tue Jul  5 23:24:29 2016
@@ -37,32 +37,36 @@ __m512i test_mm512_maskz_conflict_epi32(
 }
 __m512i test_mm512_lzcnt_epi32(__m512i __A) {
   // CHECK-LABEL: @test_mm512_lzcnt_epi32
-  // CHECK: @llvm.x86.avx512.mask.lzcnt.d.512
+  // CHECK: call <16 x i32> @llvm.ctlz.v16i32(<16 x i32> %{{.*}}, i1 false)
   return _mm512_lzcnt_epi32(__A); 
 }
 __m512i test_mm512_mask_lzcnt_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_mask_lzcnt_epi32
-  // CHECK: @llvm.x86.avx512.mask.lzcnt.d.512
+  // CHECK: call <16 x i32> @llvm.ctlz.v16i32(<16 x i32> %{{.*}}, i1 false)
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_mask_lzcnt_epi32(__W,__U,__A); 
 }
 __m512i test_mm512_maskz_lzcnt_epi32(__mmask16 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_maskz_lzcnt_epi32
-  // CHECK: @llvm.x86.avx512.mask.lzcnt.d.512
+  // CHECK: call <16 x i32> @llvm.ctlz.v16i32(<16 x i32> %{{.*}}, i1 false)
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_maskz_lzcnt_epi32(__U,__A); 
 }
 __m512i test_mm512_lzcnt_epi64(__m512i __A) {
   // CHECK-LABEL: @test_mm512_lzcnt_epi64
-  // CHECK: @llvm.x86.avx512.mask.lzcnt.q.512
+  // CHECK: call <8 x i64> @llvm.ctlz.v8i64(<8 x i64> %{{.*}}, i1 false)
   return _mm512_lzcnt_epi64(__A); 
 }
 __m512i test_mm512_mask_lzcnt_epi64(__m512i __W, __mmask8 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_mask_lzcnt_epi64
-  // CHECK: @llvm.x86.avx512.mask.lzcnt.q.512
+  // CHECK: call <8 x i64> @llvm.ctlz.v8i64(<8 x i64> %{{.*}}, i1 false)
+  // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
   return _mm512_mask_lzcnt_epi64(__W,__U,__A); 
 }
 __m512i test_mm512_maskz_lzcnt_epi64(__mmask8 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_maskz_lzcnt_epi64
-  // CHECK: @llvm.x86.avx512.mask.lzcnt.q.512
+  // CHECK: call <8 x i64> @llvm.ctlz.v8i64(<8 x i64> %{{.*}}, i1 false)
+  // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
   return _mm512_maskz_lzcnt_epi64(__U,__A); 
 }
 

Modified: cfe/trunk/test/CodeGen/avx512vlcd-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512vlcd-builtins.c?rev=274603&r1=274602&r2=274603&view=diff
==
--- cfe/trunk/test/CodeGen/avx512vlcd-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512vlcd-builtins.c Tue Jul  5 23:24:29 2016
@@ -103,72 +103,80 @@ __m256i test_mm256_maskz_conflict_epi32(
 
 __m128i test_mm_lzcnt_epi32(__m128i __A) {
   // CHECK-LABEL: @test_mm_lzcnt_epi32
-  // CHECK: @llvm.x86.avx512.mask.lzcnt.d
+  // CHECK: call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %{{.*}}, i1 false)
   return _mm_lzcnt_epi32(__A); 
 }
 
 __m128i test_mm_mask_lzcnt_epi32(__m128i __W, __mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_lzcnt_epi32
-  // CHECK: @llvm.x86.avx512.mask.lzcnt.d
+  // CHECK: call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %{{.*}}, i1 false)
+  // CHECK: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
   return _mm_mask_lzcnt_epi32(__W

[libcxx] r274605 - Fix typo in #ifdef, and re-enable tests now that the green-dragon bots are no more

2016-07-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Jul  6 00:28:44 2016
New Revision: 274605

URL: http://llvm.org/viewvc/llvm-project?rev=274605&view=rev
Log:
Fix typo in #ifdef, and re-enable tests now that the green-dragon bots are no 
more

Modified:

libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp?rev=274605&r1=274604&r2=274605&view=diff
==
--- 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
 Wed Jul  6 00:28:44 2016
@@ -103,11 +103,11 @@ int main()
 test_is_not_constructible ();
 
 //  LWG 2560  -- postpone this test until bots updated
-// test_is_not_constructible ();
-// #if TEST_STD_VERS > 11
-// test_is_not_constructible ();
-// test_is_not_constructible ();
-// test_is_not_constructible ();
-// test_is_not_constructible ();
-// #endif
+test_is_not_constructible ();
+#if TEST_STD_VER > 11
+test_is_not_constructible ();
+test_is_not_constructible ();
+test_is_not_constructible ();
+test_is_not_constructible ();
+#endif
 }


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


Re: [PATCH] D20352: Add XRay flags to Clang

2016-07-05 Thread Dean Michael Berris via cfe-commits
dberris marked 2 inline comments as done.


Comment at: include/clang/Basic/Attr.td:436
@@ +435,3 @@
+   CXX11<"clang", "xray_never_instrument">];
+  let Subjects = SubjectList<[CXXMethod, ObjCMethod, Function], WarnDiag,
+  "ExpectedFunctionOrMethod">;

aaron.ballman wrote:
> Then ClangAttrEmitter.cpp needs to be updated as well (this is a reasonable 
> case to automatically support, I think).
That makes sense, I can do it in another change that's more focused on just 
that if you don't mind?


Comment at: include/clang/Basic/AttrDocs.td:2457
@@ +2456,3 @@
+  let Content = [{
+``__attribute__((xray_always_instrument))`` or 
``[[clang:xray_always_instrument]]`` is used to mark member functions (in C++), 
methods (in Objective C), and free functions (in C, C++, and Objective C) to be 
instrumented with XRay. This will cause the function to always have space at 
the beginning and exit points to allow for runtime patching.
+

aaron.ballman wrote:
> I get the impression they do conflict because they have overlapping 
> functionality (both provide prologue space for runtime patching, for 
> instance). It would be best to have only one attribute if we can do it.
I've explored that option (using `patchable-function` instead) and while I 
haven't excluded that outright, there needs to be a discussion about how we're 
going to implement complimentary instrumentation functionality that do nop-sled 
inserting. I suspect that has to happen in D19904 where we can still make those 
changes to instead use `patchable-function`.

The response to my comment in D19908 seems to be that there should be no 
conflicts in the platforms XRay currently cares about -- but that if we do ever 
want to get XRay implemented/supported in x86 32-bit, then we're going to have 
issues. This suggests that a harder look at `patchable-function` and exclusive 
modes (or special-casing the supported configurations) might need to happen 
sooner than later.


http://reviews.llvm.org/D20352



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


Re: [PATCH] D21349: [libcxx] [test] Fix a typo in commented-out code.

2016-07-05 Thread Marshall Clow via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

Landed as  r274605


http://reviews.llvm.org/D21349



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


Re: [PATCH] D20352: Add XRay flags to Clang

2016-07-05 Thread Dean Michael Berris via cfe-commits
dberris updated this revision to Diff 62824.
dberris marked an inline comment as done.
dberris added a comment.

- Formatting changes


http://reviews.llvm.org/D20352

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/xray-attributes-supported.cpp
  test/Sema/xray-always-instrument-attr.c
  test/Sema/xray-always-instrument-attr.cpp

Index: test/Sema/xray-always-instrument-attr.cpp
===
--- /dev/null
+++ test/Sema/xray-always-instrument-attr.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -std=c++11 -x c++
+void foo [[clang::xray_always_instrument]] ();
+
+struct [[clang::xray_always_instrument]] a { int x; }; // expected-warning {{'xray_always_instrument' attribute only applies to functions and methods}}
+
+class b {
+ void c [[clang::xray_always_instrument]] ();
+};
+
+void baz [[clang::xray_always_instrument("not-supported")]] (); // expected-error {{'xray_always_instrument' attribute takes no arguments}}
Index: test/Sema/xray-always-instrument-attr.c
===
--- /dev/null
+++ test/Sema/xray-always-instrument-attr.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -std=c11
+void foo() __attribute__((xray_always_instrument));
+
+struct __attribute__((xray_always_instrument)) a { int x; }; // expected-warning {{'xray_always_instrument' attribute only applies to functions and methods}}
+
+void bar() __attribute__((xray_always_instrument("not-supported"))); // expected-error {{'xray_always_instrument' attribute takes no arguments}}
Index: test/CodeGen/xray-attributes-supported.cpp
===
--- /dev/null
+++ test/CodeGen/xray-attributes-supported.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - -triple x86_64-unknown-linux-gnu | FileCheck %s
+
+// Make sure that the LLVM attribute for XRay-annotated functions do show up.
+[[clang::xray_always_instrument]] void foo() {
+// CHECK: define void @_Z3foov() #0
+};
+
+[[clang::xray_never_instrument]] void bar() {
+// CHECK: define void @_Z3barv() #1
+};
+
+// CHECK: #0 = {{.*}}"function-instrument"="xray-always"
+// CHECK: #1 = {{.*}}"function-instrument"="xray-never"
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -5909,10 +5909,13 @@
   case AttributeList::AT_TypeTagForDatatype:
 handleTypeTagForDatatypeAttr(S, D, Attr);
 break;
-
   case AttributeList::AT_RenderScriptKernel:
 handleSimpleAttribute(S, D, Attr);
 break;
+  // XRay attributes.
+  case AttributeList::AT_XRayInstrument:
+handleSimpleAttribute(S, D, Attr);
+break;
   }
 }
 
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -686,6 +686,9 @@
   }
 
   Opts.InstrumentFunctions = Args.hasArg(OPT_finstrument_functions);
+  Opts.XRayInstrumentFunctions = Args.hasArg(OPT_fxray_instrument);
+  Opts.XRayInstructionThreshold =
+  getLastArgIntValue(Args, OPT_fxray_instruction_threshold_, 200, Diags);
   Opts.InstrumentForProfiling = Args.hasArg(OPT_pg);
   Opts.EmitOpenCLArgMetadata = Args.hasArg(OPT_cl_kernel_arg_info);
   Opts.CompressDebugSections = Args.hasArg(OPT_compress_debug_sections);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3181,6 +3181,28 @@
   return !StaticRuntimes.empty();
 }
 
+static bool addXRayRuntime(const ToolChain &TC, const ArgList &Args,
+   ArgStringList &CmdArgs) {
+  if (Args.hasArg(options::OPT_fxray_instrument,
+  options::OPT_fnoxray_instrument, false)) {
+CmdArgs.push_back("-whole-archive");
+CmdArgs.push_back(TC.getCompilerRTArgString(Args, "xray", false));
+CmdArgs.push_back("-no-whole-archive");
+return true;
+  }
+  return false;
+}
+
+static void linkXRayRuntimeDeps(const ToolChain &TC, ArgStringList &CmdArgs) {
+  CmdArgs.push_back("--no-as-needed");
+  CmdArgs.push_back("-lpthread");
+  CmdArgs.push_back("-lrt");
+  CmdArgs.push_back("-lm");
+  CmdArgs.push_back("-latomic");
+  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD)
+CmdArgs.push_back("-ldl");
+}
+
 static bool areOptimizationsEnabled(const ArgList &Args) {
   // Find the last -O arg and see if it is non-zero.
   if (Arg *A = Args.getLastArg(options::OPT_O_Group))
@@ -4582,6 +4604,16 @@
 
   Args.AddAllArgs(CmdArgs, options::OPT_finstrument_funct

r274608 - [X86] Use native IR for immediate values 0-7 of packed fp cmp builtins. This makes them the same as what is done when using the SSE builtins for these same encodings.

2016-07-05 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Jul  6 01:27:31 2016
New Revision: 274608

URL: http://llvm.org/viewvc/llvm-project?rev=274608&view=rev
Log:
[X86] Use native IR for immediate values 0-7 of packed fp cmp builtins. This 
makes them the same as what is done when using the SSE builtins for these same 
encodings.

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/avx2-builtins.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=274608&r1=274607&r2=274608&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Jul  6 01:27:31 2016
@@ -7289,6 +7289,51 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 return getVectorFCmpIR(CmpInst::FCMP_UGT, V2F64);
   case X86::BI__builtin_ia32_cmpordpd:
 return getVectorFCmpIR(CmpInst::FCMP_ORD, V2F64);
+  case X86::BI__builtin_ia32_cmpps:
+  case X86::BI__builtin_ia32_cmpps256:
+  case X86::BI__builtin_ia32_cmppd:
+  case X86::BI__builtin_ia32_cmppd256: {
+unsigned CC = cast(Ops[2])->getZExtValue();
+// If this one of the SSE immediates, we can use native IR.
+if (CC < 8) {
+  FCmpInst::Predicate Pred;
+  switch (CC) {
+  case 0: Pred = FCmpInst::FCMP_OEQ; break;
+  case 1: Pred = FCmpInst::FCMP_OLT; break;
+  case 2: Pred = FCmpInst::FCMP_OLE; break;
+  case 3: Pred = FCmpInst::FCMP_UNO; break;
+  case 4: Pred = FCmpInst::FCMP_UNE; break;
+  case 5: Pred = FCmpInst::FCMP_UGE; break;
+  case 6: Pred = FCmpInst::FCMP_UGT; break;
+  case 7: Pred = FCmpInst::FCMP_ORD; break;
+  }
+  Value *Cmp = Builder.CreateFCmp(Pred, Ops[0], Ops[1]);
+  auto *FPVecTy = cast(Ops[0]->getType());
+  auto *IntVecTy = llvm::VectorType::getInteger(FPVecTy);
+  Value *Sext = Builder.CreateSExt(Cmp, IntVecTy);
+  return Builder.CreateBitCast(Sext, FPVecTy);
+}
+
+// We can't handle 8-31 immediates with native IR, use the intrinsic.
+Intrinsic::ID ID;
+switch (BuiltinID) {
+default: llvm_unreachable("Unsupported intrinsic!");
+case X86::BI__builtin_ia32_cmpps:
+  ID = Intrinsic::x86_sse_cmp_ps;
+  break;
+case X86::BI__builtin_ia32_cmpps256:
+  ID = Intrinsic::x86_avx_cmp_ps_256;
+  break;
+case X86::BI__builtin_ia32_cmppd:
+  ID = Intrinsic::x86_sse2_cmp_pd;
+  break;
+case X86::BI__builtin_ia32_cmppd256:
+  ID = Intrinsic::x86_avx_cmp_pd_256;
+  break;
+}
+
+return Builder.CreateCall(CGM.getIntrinsic(ID), Ops);
+  }
 
   // SSE scalar comparison intrinsics
   case X86::BI__builtin_ia32_cmpeqss:

Modified: cfe/trunk/test/CodeGen/avx2-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx2-builtins.c?rev=274608&r1=274607&r2=274608&view=diff
==
--- cfe/trunk/test/CodeGen/avx2-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx2-builtins.c Wed Jul  6 01:27:31 2016
@@ -488,7 +488,9 @@ __m128d test_mm_mask_i32gather_pd(__m128
 
 __m256d test_mm256_i32gather_pd(double const *b, __m128i c) {
   // CHECK-LABEL: test_mm256_i32gather_pd
-  // CHECK: call <4 x double> @llvm.x86.avx.cmp.pd.256(<4 x double> %{{.*}}, 
<4 x double> %{{.*}}, i8 0)
+  // CHECK: [[CMP:%.*]] = fcmp oeq <4 x double>
+  // CHECK-NEXT:[[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i64>
+  // CHECK-NEXT:[[BC:%.*]] = bitcast <4 x i64> [[SEXT]] to <4 x double>
   // CHECK: call <4 x double> @llvm.x86.avx2.gather.d.pd.256(<4 x double> 
undef, i8* %{{.*}}, <4 x i32> %{{.*}}, <4 x double> %{{.*}}, i8 2)
   return _mm256_i32gather_pd(b, c, 2);
 }
@@ -516,7 +518,9 @@ __m128 test_mm_mask_i32gather_ps(__m128
 
 __m256 test_mm256_i32gather_ps(float const *b, __m256i c) {
   // CHECK-LABEL: test_mm256_i32gather_ps
-  // CHECK: call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %{{.*}}, <8 
x float> %{{.*}}, i8 0)
+  // CHECK: [[CMP:%.*]] = fcmp oeq <8 x float>
+  // CHECK-NEXT:[[SEXT:%.*]] = sext <8 x i1> [[CMP]] to <8 x i32>
+  // CHECK-NEXT:[[BC:%.*]] = bitcast <8 x i32> [[SEXT]] to <8 x float>
   // CHECK: call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, 
i8* %{{.*}}, <8 x i32> %{{.*}}, <8 x float> %{{.*}}, i8 2)
   return _mm256_i32gather_ps(b, c, 2);
 }
@@ -592,7 +596,9 @@ __m128d test_mm_mask_i64gather_pd(__m128
 
 __m256d test_mm256_i64gather_pd(double const *b, __m256i c) {
   // CHECK-LABEL: test_mm256_i64gather_pd
-  // CHECK: call <4 x double> @llvm.x86.avx.cmp.pd.256(<4 x double> %{{.*}}, 
<4 x double> %{{.*}}, i8 0)
+  // CHECK: [[CMP:%.*]] = fcmp oeq <4 x double>
+  // CHECK-NEXT:[[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i64>
+  // CHECK-NEXT:[[BC:%.*]] = bitcast <4 x i64> [[SEXT]] to <4 x double>
   // CHECK: call <4 x double> @llvm.x86.avx2.gather.q.pd.256(<4 x double> 
undef, i8* %{{.*}}, <