r284956 - [AVX-512] Replace 64-bit element and 512-bit vector pmin/pmax builtins with native IR like we do for 128/256-bit, but with the addition of masking.

2016-10-23 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sun Oct 23 23:04:24 2016
New Revision: 284956

URL: http://llvm.org/viewvc/llvm-project?rev=284956=rev
Log:
[AVX-512] Replace 64-bit element and 512-bit vector pmin/pmax builtins with 
native IR like we do for 128/256-bit, but with the addition of masking.

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/avx512bw-builtins.c
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512vl-builtins.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=284956=284955=284956=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Sun Oct 23 23:04:24 2016
@@ -6979,6 +6979,18 @@ static Value *EmitX86MaskedCompare(CodeG
 std::max(NumElts, 8U)));
 }
 
+static Value *EmitX86MinMax(CodeGenFunction , ICmpInst::Predicate Pred,
+ArrayRef Ops) {
+  Value *Cmp = CGF.Builder.CreateICmp(Pred, Ops[0], Ops[1]);
+  Value *Res = CGF.Builder.CreateSelect(Cmp, Ops[0], Ops[1]);
+
+  if (Ops.size() == 2)
+return Res;
+
+  assert(Ops.size() == 4);
+  return EmitX86Select(CGF, Ops[3], Res, Ops[2]);
+}
+
 Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
const CallExpr *E) {
   if (BuiltinID == X86::BI__builtin_ms_va_start ||
@@ -7511,43 +7523,58 @@ Value *CodeGenFunction::EmitX86BuiltinEx
  Ops[1]);
   }
 
-  // TODO: Handle 64/512-bit vector widths of min/max.
   case X86::BI__builtin_ia32_pmaxsb128:
   case X86::BI__builtin_ia32_pmaxsw128:
   case X86::BI__builtin_ia32_pmaxsd128:
+  case X86::BI__builtin_ia32_pmaxsq128_mask:
   case X86::BI__builtin_ia32_pmaxsb256:
   case X86::BI__builtin_ia32_pmaxsw256:
-  case X86::BI__builtin_ia32_pmaxsd256: {
-Value *Cmp = Builder.CreateICmp(ICmpInst::ICMP_SGT, Ops[0], Ops[1]);
-return Builder.CreateSelect(Cmp, Ops[0], Ops[1]);
-  }
+  case X86::BI__builtin_ia32_pmaxsd256:
+  case X86::BI__builtin_ia32_pmaxsq256_mask:
+  case X86::BI__builtin_ia32_pmaxsb512_mask:
+  case X86::BI__builtin_ia32_pmaxsw512_mask:
+  case X86::BI__builtin_ia32_pmaxsd512_mask:
+  case X86::BI__builtin_ia32_pmaxsq512_mask:
+return EmitX86MinMax(*this, ICmpInst::ICMP_SGT, Ops);
   case X86::BI__builtin_ia32_pmaxub128:
   case X86::BI__builtin_ia32_pmaxuw128:
   case X86::BI__builtin_ia32_pmaxud128:
+  case X86::BI__builtin_ia32_pmaxuq128_mask:
   case X86::BI__builtin_ia32_pmaxub256:
   case X86::BI__builtin_ia32_pmaxuw256:
-  case X86::BI__builtin_ia32_pmaxud256: {
-Value *Cmp = Builder.CreateICmp(ICmpInst::ICMP_UGT, Ops[0], Ops[1]);
-return Builder.CreateSelect(Cmp, Ops[0], Ops[1]);
-  }
+  case X86::BI__builtin_ia32_pmaxud256:
+  case X86::BI__builtin_ia32_pmaxuq256_mask:
+  case X86::BI__builtin_ia32_pmaxub512_mask:
+  case X86::BI__builtin_ia32_pmaxuw512_mask:
+  case X86::BI__builtin_ia32_pmaxud512_mask:
+  case X86::BI__builtin_ia32_pmaxuq512_mask:
+return EmitX86MinMax(*this, ICmpInst::ICMP_UGT, Ops);
   case X86::BI__builtin_ia32_pminsb128:
   case X86::BI__builtin_ia32_pminsw128:
   case X86::BI__builtin_ia32_pminsd128:
+  case X86::BI__builtin_ia32_pminsq128_mask:
   case X86::BI__builtin_ia32_pminsb256:
   case X86::BI__builtin_ia32_pminsw256:
-  case X86::BI__builtin_ia32_pminsd256: {
-Value *Cmp = Builder.CreateICmp(ICmpInst::ICMP_SLT, Ops[0], Ops[1]);
-return Builder.CreateSelect(Cmp, Ops[0], Ops[1]);
-  }
+  case X86::BI__builtin_ia32_pminsd256:
+  case X86::BI__builtin_ia32_pminsq256_mask:
+  case X86::BI__builtin_ia32_pminsb512_mask:
+  case X86::BI__builtin_ia32_pminsw512_mask:
+  case X86::BI__builtin_ia32_pminsd512_mask:
+  case X86::BI__builtin_ia32_pminsq512_mask:
+return EmitX86MinMax(*this, ICmpInst::ICMP_SLT, Ops);
   case X86::BI__builtin_ia32_pminub128:
   case X86::BI__builtin_ia32_pminuw128:
   case X86::BI__builtin_ia32_pminud128:
+  case X86::BI__builtin_ia32_pminuq128_mask:
   case X86::BI__builtin_ia32_pminub256:
   case X86::BI__builtin_ia32_pminuw256:
-  case X86::BI__builtin_ia32_pminud256: {
-Value *Cmp = Builder.CreateICmp(ICmpInst::ICMP_ULT, Ops[0], Ops[1]);
-return Builder.CreateSelect(Cmp, Ops[0], Ops[1]);
-  }
+  case X86::BI__builtin_ia32_pminud256:
+  case X86::BI__builtin_ia32_pminuq256_mask:
+  case X86::BI__builtin_ia32_pminub512_mask:
+  case X86::BI__builtin_ia32_pminuw512_mask:
+  case X86::BI__builtin_ia32_pminud512_mask:
+  case X86::BI__builtin_ia32_pminuq512_mask:
+return EmitX86MinMax(*this, ICmpInst::ICMP_ULT, Ops);
 
   // 3DNow!
   case X86::BI__builtin_ia32_pswapdsf:

Modified: cfe/trunk/test/CodeGen/avx512bw-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512bw-builtins.c?rev=284956=284955=284956=diff

[PATCH] D25403: [CUDA] Mark __libcpp_{isnan, isinf, isfinite} as constexpr.

2016-10-23 Thread Justin Lebar via cfe-commits
jlebar added a comment.

Friendly ping?


https://reviews.llvm.org/D25403



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


r284954 - [AVX-512] Replace masked 128/256-bit byte, word, and dword min/max builtins with selects and the older unmasked builtins.

2016-10-23 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sun Oct 23 18:57:30 2016
New Revision: 284954

URL: http://llvm.org/viewvc/llvm-project?rev=284954=rev
Log:
[AVX-512] Replace masked 128/256-bit byte, word, and dword min/max builtins 
with selects and the older unmasked builtins.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512vlbwintrin.h
cfe/trunk/lib/Headers/avx512vlintrin.h
cfe/trunk/test/CodeGen/avx512vl-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=284954=284953=284954=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Sun Oct 23 18:57:30 2016
@@ -1120,23 +1120,6 @@ TARGET_BUILTIN(__builtin_ia32_vpconflict
 TARGET_BUILTIN(__builtin_ia32_vplzcntd_512_mask, "V16iV16iV16iUs", "", 
"avx512cd")
 TARGET_BUILTIN(__builtin_ia32_vplzcntq_512_mask, "V8LLiV8LLiV8LLiUc", "", 
"avx512cd")
 
-TARGET_BUILTIN(__builtin_ia32_pmaxsb128_mask, "V16cV16cV16cV16cUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pmaxsb256_mask, "V32cV32cV32cV32cUi", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pmaxsw128_mask, "V8sV8sV8sV8sUc", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pmaxsw256_mask, "V16sV16sV16sV16sUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pmaxub128_mask, "V16cV16cV16cV16cUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pmaxub256_mask, "V32cV32cV32cV32cUi", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pmaxuw128_mask, "V8sV8sV8sV8sUc", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pmaxuw256_mask, "V16sV16sV16sV16sUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pminsb128_mask, "V16cV16cV16cV16cUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pminsb256_mask, "V32cV32cV32cV32cUi", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pminsw128_mask, "V8sV8sV8sV8sUc", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pminsw256_mask, "V16sV16sV16sV16sUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pminub128_mask, "V16cV16cV16cV16cUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pminub256_mask, "V32cV32cV32cV32cUi", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pminuw128_mask, "V8sV8sV8sV8sUc", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pminuw256_mask, "V16sV16sV16sV16sUs", "", 
"avx512vl,avx512bw")
-
 TARGET_BUILTIN(__builtin_ia32_vpermi2varhi128_mask, "V8sV8sV8sV8sUc", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_vpermi2varhi256_mask, "V16sV16sV16sV16sUs", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_vpermt2varhi128_mask, "V8sV8sV8sV8sUc", "", 
"avx512vl,avx512bw")
@@ -1247,20 +1230,12 @@ TARGET_BUILTIN(__builtin_ia32_minps_mask
 TARGET_BUILTIN(__builtin_ia32_minps256_mask, "V8fV8fV8fV8fUc", "", "avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pabsq128_mask, "V2LLiV2LLiV2LLiUc", "", 
"avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pabsq256_mask, "V4LLiV4LLiV4LLiUc", "", 
"avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pmaxsd128_mask, "V4iV4iV4iV4iUc", "", "avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pmaxsd256_mask, "V8iV8iV8iV8iUc", "", "avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmaxsq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "", 
"avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmaxsq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "", 
"avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pmaxud128_mask, "V4iV4iV4iV4iUc", "", "avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pmaxud256_mask, "V8iV8iV8iV8iUc", "", "avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmaxuq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "", 
"avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pmaxuq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "", 
"avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pminsd128_mask, "V4iV4iV4iV4iUc", "", "avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pminsd256_mask, "V8iV8iV8iV8iUc", "", "avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pminsq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "", 
"avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pminsq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "", 
"avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pminud128_mask, "V4iV4iV4iV4iUc", "", "avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pminud256_mask, "V8iV8iV8iV8iUc", "", "avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pminuq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "", 
"avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pminuq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "", 
"avx512vl")
 TARGET_BUILTIN(__builtin_ia32_rndscalepd_128_mask, "V2dV2dIiV2dUc", "", 
"avx512vl")

Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlbwintrin.h?rev=284954=284953=284954=diff
==
--- cfe/trunk/lib/Headers/avx512vlbwintrin.h (original)
+++ 

[libcxx] r284952 - Backout enabling -Wshadow until I have time to fix the breakage

2016-10-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun Oct 23 17:24:11 2016
New Revision: 284952

URL: http://llvm.org/viewvc/llvm-project?rev=284952=rev
Log:
Backout enabling -Wshadow until I have time to fix the breakage

Modified:
libcxx/trunk/test/libcxx/test/config.py

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=284952=284951=284952=diff
==
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Sun Oct 23 17:24:11 2016
@@ -627,7 +627,8 @@ class Configuration(object):
 '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
 '-Wall', '-Wextra', '-Werror'
 ]
-self.cxx.addWarningFlagIfSupported('-Wshadow')
+# FIXME turn this back on after fixing potential breakage.
+#self.cxx.addWarningFlagIfSupported('-Wshadow')
 
self.cxx.addWarningFlagIfSupported('-Wno-unused-command-line-argument')
 self.cxx.addWarningFlagIfSupported('-Wno-attributes')
 self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')


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


[PATCH] D24886: Add [[clang::suppress(rule, ...)]] attribute

2016-10-23 Thread Matthias Gehre via cfe-commits
mgehre added inline comments.



Comment at: include/clang/Basic/AttrDocs.td:2509
+to suppress specific clang-tidy warnings. They can be attached to a scope,
+statement or type. The ``[[gsl::suppress]]`` is an alias of 
``[[clang::suppress]]``
+which is intended to be used for suppressing rules of the C++ Core Guidelines_

aaron.ballman wrote:
> This statement does not match the test cases -- it does not appear to be 
> possible to attach the attribute to a type.
It is true that you cannot attach the attribute to an existing type during 
declaration of a variable,
but the attribute can be attached when declaring a new type. (See line 22 of 
the test case, where the attribute is attached to the union type U)
I would propose to says "type declaration" instead of "type", ok?



https://reviews.llvm.org/D24886



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


[libunwind] r284951 - [libunwind] Add support for Fuchsia

2016-10-23 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Sun Oct 23 16:48:47 2016
New Revision: 284951

URL: http://llvm.org/viewvc/llvm-project?rev=284951=rev
Log:
[libunwind] Add support for Fuchsia

Fuchsia is a new operating system which uses libunwind as unwinder.

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

Modified:
libunwind/trunk/src/AddressSpace.hpp
libunwind/trunk/src/assembly.h

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=284951=284950=284951=diff
==
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Sun Oct 23 16:48:47 2016
@@ -61,8 +61,8 @@ extern EHTEntry __exidx_end;
 #endif // !defined(_LIBUNWIND_IS_BAREMETAL)
 #endif // _LIBUNWIND_ARM_EHABI
 
-#if defined(__CloudABI__) || defined(__FreeBSD__) || defined(__linux__) || 
\
-defined(__NetBSD__)
+#if defined(__CloudABI__) || defined(__FreeBSD__) || defined(__Fuchsia__) ||  \
+defined(__linux__) || defined(__NetBSD__)
 #if _LIBUNWIND_SUPPORT_DWARF_UNWIND && _LIBUNWIND_SUPPORT_DWARF_INDEX
 #include 
 // Macro for machine-independent access to the ELF program headers. This

Modified: libunwind/trunk/src/assembly.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/assembly.h?rev=284951=284950=284951=diff
==
--- libunwind/trunk/src/assembly.h (original)
+++ libunwind/trunk/src/assembly.h Sun Oct 23 16:48:47 2016
@@ -47,7 +47,8 @@
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
 
-#if defined(__GNU__) || defined(__ANDROID__) || defined(__FreeBSD__)
+#if defined(__GNU__) || defined(__ANDROID__) || defined(__FreeBSD__) || \
+defined(__Fuchsia__)
 #define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
 #else
 #define NO_EXEC_STACK_DIRECTIVE


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


[libcxx] r284950 - [libcxx] Use C++14 when building libc++ with musl

2016-10-23 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Sun Oct 23 16:48:27 2016
New Revision: 284950

URL: http://llvm.org/viewvc/llvm-project?rev=284950=rev
Log:
[libcxx] Use C++14 when building libc++ with musl

musl's pthread implementations use volatile types in their structs
which is not being constexpr in C++11 but is in C++14.

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

Modified:
libcxx/trunk/CMakeLists.txt

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=284950=284949=284950=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Sun Oct 23 16:48:27 2016
@@ -325,6 +325,11 @@ remove_flags(-Wno-pedantic -pedantic-err
 
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build 
dialect")
+if (LIBCXX_HAS_MUSL_LIBC)
+  # musl's pthread implementations uses volatile types in their structs which 
is
+  # not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
+  set(LIBCXX_STANDARD_VER c++14 CACHE INTERNAL "internal option to change 
build dialect")
+endif()
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
 mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" 
SUPPORTS_DIALECT_NAME)
 if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME})


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


[PATCH] D25491: [libcxx] Use C++14 when building libc++ with musl

2016-10-23 Thread Petr Hosek via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284950: [libcxx] Use C++14 when building libc++ with musl 
(authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D25491?vs=75553=75554#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25491

Files:
  libcxx/trunk/CMakeLists.txt


Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -325,6 +325,11 @@
 
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build 
dialect")
+if (LIBCXX_HAS_MUSL_LIBC)
+  # musl's pthread implementations uses volatile types in their structs which 
is
+  # not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
+  set(LIBCXX_STANDARD_VER c++14 CACHE INTERNAL "internal option to change 
build dialect")
+endif()
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
 mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" 
SUPPORTS_DIALECT_NAME)
 if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME})


Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -325,6 +325,11 @@
 
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect")
+if (LIBCXX_HAS_MUSL_LIBC)
+  # musl's pthread implementations uses volatile types in their structs which is
+  # not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
+  set(LIBCXX_STANDARD_VER c++14 CACHE INTERNAL "internal option to change build dialect")
+endif()
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
 mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME)
 if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME})
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25491: [libcxx] Use C++14 when building libc++ with musl

2016-10-23 Thread Petr Hosek via cfe-commits
phosek updated this revision to Diff 75553.

Repository:
  rL LLVM

https://reviews.llvm.org/D25491

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -325,6 +325,11 @@
 
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build 
dialect")
+if (LIBCXX_HAS_MUSL_LIBC)
+  # musl's pthread implementations uses volatile types in their structs which 
is
+  # not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
+  set(LIBCXX_STANDARD_VER c++14 CACHE INTERNAL "internal option to change 
build dialect")
+endif()
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
 mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" 
SUPPORTS_DIALECT_NAME)
 if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME})


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -325,6 +325,11 @@
 
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect")
+if (LIBCXX_HAS_MUSL_LIBC)
+  # musl's pthread implementations uses volatile types in their structs which is
+  # not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
+  set(LIBCXX_STANDARD_VER c++14 CACHE INTERNAL "internal option to change build dialect")
+endif()
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
 mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME)
 if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME})
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.

2016-10-23 Thread Mehdi AMINI via cfe-commits
mehdi_amini added inline comments.



Comment at: lib/CodeGen/BackendUtil.cpp:422
   // Set up the per-function pass manager.
+  FPM.add(new TargetLibraryInfoWrapperPass(*TLII));
   if (CodeGenOpts.VerifyModule)

This seems unnecessary?


Repository:
  rL LLVM

https://reviews.llvm.org/D21737



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


[PATCH] D25888: Add support for __builtin_os_log_format[_buffer_size]

2016-10-23 Thread Mehdi AMINI via cfe-commits
mehdi_amini updated this revision to Diff 75552.
mehdi_amini added a comment.

Use a separate enum to described OSLogBufferLayout header flags


https://reviews.llvm.org/D25888

Files:
  clang/include/clang/Analysis/Analyses/FormatString.h
  clang/include/clang/Analysis/Analyses/OSLog.h
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Analysis/CMakeLists.txt
  clang/lib/Analysis/FormatString.cpp
  clang/lib/Analysis/OSLog.cpp
  clang/lib/Analysis/PrintfFormatString.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/builtins.c
  clang/test/CodeGenObjC/os_log.m
  clang/test/SemaObjC/format-strings-oslog.m

Index: clang/test/SemaObjC/format-strings-oslog.m
===
--- /dev/null
+++ clang/test/SemaObjC/format-strings-oslog.m
@@ -0,0 +1,62 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#include 
+#include 
+#define __need_wint_t
+#include  // For wint_t and wchar_t
+
+int printf(const char *restrict, ...);
+
+@interface NSString
+@end
+
+void test_os_log_format(const char *pc, int i, void *p, void *buf) {
+  __builtin_os_log_format(buf, "");
+  __builtin_os_log_format(buf, "%d"); // expected-warning {{more '%' conversions than data arguments}}
+  __builtin_os_log_format(buf, "%d", i);
+  __builtin_os_log_format(buf, "%P", p); // expected-warning {{using '%P' format specifier without precision}}
+  __builtin_os_log_format(buf, "%.10P", p);
+  __builtin_os_log_format(buf, "%.*P", p); // expected-warning {{field precision should have type 'int', but argument has type 'void *'}}
+  __builtin_os_log_format(buf, "%.*P", i, p);
+  __builtin_os_log_format(buf, "%.*P", i, i); // expected-warning {{format specifies type 'void *' but the argument has type 'int'}}
+  __builtin_os_log_format(buf, "%n"); // expected-error {{os_log() '%n' format specifier is not allowed}}
+  __builtin_os_log_format(buf, pc);   // expected-error {{os_log() format argument is not a string constant}}
+
+  printf("%{private}s", pc); // expected-warning {{using 'private' format specifier annotation outside of os_log()/os_trace()}}
+  __builtin_os_log_format(buf, "%{private}s", pc);
+
+  // 
+  __builtin_os_log_format_buffer_size("no-args");
+  __builtin_os_log_format(buf, "%s", "hi");
+
+  // 
+  wchar_t wc = 'a';
+  __builtin_os_log_format(buf, "%C", wc);
+  printf("%C", wc);
+  wchar_t wcs[] = {'a', 0};
+  __builtin_os_log_format(buf, "%S", wcs);
+  printf("%S", wcs);
+}
+
+// Test os_log_format primitive with ObjC string literal format argument.
+void test_objc(const char *pc, int i, void *p, void *buf, NSString *nss) {
+  __builtin_os_log_format(buf, @"");
+  __builtin_os_log_format(buf, @"%d"); // expected-warning {{more '%' conversions than data arguments}}
+  __builtin_os_log_format(buf, @"%d", i);
+  __builtin_os_log_format(buf, @"%P", p); // expected-warning {{using '%P' format specifier without precision}}
+  __builtin_os_log_format(buf, @"%.10P", p);
+  __builtin_os_log_format(buf, @"%.*P", p); // expected-warning {{field precision should have type 'int', but argument has type 'void *'}}
+  __builtin_os_log_format(buf, @"%.*P", i, p);
+  __builtin_os_log_format(buf, @"%.*P", i, i); // expected-warning {{format specifies type 'void *' but the argument has type 'int'}}
+
+  __builtin_os_log_format(buf, @"%{private}s", pc);
+  __builtin_os_log_format(buf, @"%@", nss);
+}
+
+// Test the os_log format attribute.
+void MyOSLog(const char *format, ...) __attribute__((format(os_log, 1, 2)));
+void test_attribute(void *p) {
+  MyOSLog("%s\n", "Hello");
+  MyOSLog("%d");// expected-warning {{more '%' conversions than data arguments}}
+  MyOSLog("%P", p); // expected-warning {{using '%P' format specifier without precision}}
+}
Index: clang/test/CodeGenObjC/os_log.m
===
--- /dev/null
+++ clang/test/CodeGenObjC/os_log.m
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 | FileCheck %s
+
+// Make sure we emit clang.arc.use before calling objc_release as part of the
+// cleanup. This way we make sure the object will not be released until the
+// end of the full expression.
+
+// rdar://problem/24528966
+
+@class NSString;
+extern __attribute__((visibility("default"))) NSString *GenString();
+
+// Behavior of __builtin_os_log differs between platforms, so only test on X86
+#ifdef __x86_64__
+// CHECK-LABEL: define i8* @test_builtin_os_log
+void *test_builtin_os_log(void *buf) {
+  return __builtin_os_log_format(buf, "capabilities: %@", GenString());
+
+  // CHECK: store i8 2, i8*
+  // CHECK: [[NUM_ARGS:%.*]] = getelementptr i8, i8* {{.*}}, i64 1
+  // CHECK: store i8 1, i8* [[NUM_ARGS]]
+  //
+  // CHECK: [[ARG1_DESC:%.*]] = getelementptr i8, i8* {{.*}}, i64 2
+  // CHECK: store i8 64, i8* 

r284947 - Remove LLVM_CONSTEXPR.

2016-10-23 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Sun Oct 23 14:39:16 2016
New Revision: 284947

URL: http://llvm.org/viewvc/llvm-project?rev=284947=rev
Log:
Remove LLVM_CONSTEXPR.

Summary: With MSVC 2013 and GCC < 4.8 gone, we can use the "constexpr" keyword.

Reviewers: bkramer, mehdi_amini

Subscribers: llvm-commits

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

Modified:
cfe/trunk/include/clang/Parse/Parser.h

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=284947=284946=284947=diff
==
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Sun Oct 23 14:39:16 2016
@@ -883,8 +883,8 @@ public:
 StopAtCodeCompletion = 1 << 2 ///< Stop at code completion
   };
 
-  friend LLVM_CONSTEXPR SkipUntilFlags operator|(SkipUntilFlags L,
- SkipUntilFlags R) {
+  friend constexpr SkipUntilFlags operator|(SkipUntilFlags L,
+SkipUntilFlags R) {
 return static_cast(static_cast(L) |
static_cast(R));
   }


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


[libcxx] r284946 - Fix breakage introduced by adding -Wshadow.

2016-10-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun Oct 23 14:26:39 2016
New Revision: 284946

URL: http://llvm.org/viewvc/llvm-project?rev=284946=rev
Log:
Fix breakage introduced by adding -Wshadow.

Modified:
libcxx/trunk/include/list

Modified: libcxx/trunk/include/list
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/list?rev=284946=284945=284946=diff
==
--- libcxx/trunk/include/list (original)
+++ libcxx/trunk/include/list Sun Oct 23 14:26:39 2016
@@ -1751,15 +1751,15 @@ list<_Tp, _Alloc>::erase(const_iterator
 --base::__sz();
 #if _LIBCPP_DEBUG_LEVEL >= 2
 __c_node* __c = __get_db()->__find_c_and_lock(this);
-for (__i_node** __p = __c->end_; __p != __c->beg_; )
+for (__i_node** __ip = __c->end_; __ip != __c->beg_; )
 {
---__p;
-iterator* __i = static_cast((*__p)->__i_);
+--__ip;
+iterator* __i = static_cast((*__ip)->__i_);
 if (__i->__ptr_ == __n)
 {
-(*__p)->__c_ = nullptr;
-if (--__c->end_ != __p)
-memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+(*__ip)->__c_ = nullptr;
+if (--__c->end_ != __ip)
+memmove(__ip, __ip+1, (__c->end_ - __ip)*sizeof(__i_node*));
 }
 }
 __get_db()->unlock();
@@ -1961,16 +1961,16 @@ list<_Tp, _Alloc>::splice(const_iterator
 __libcpp_db* __db = __get_db();
 __c_node* __cn1 = __db->__find_c_and_lock(this);
 __c_node* __cn2 = __db->__find_c(&__c);
-for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
+for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
 {
---__p;
-iterator* __i = static_cast((*__p)->__i_);
+--__ip;
+iterator* __i = static_cast((*__ip)->__i_);
 if (__i->__ptr_ != __c.__end_as_link())
 {
-__cn1->__add(*__p);
-(*__p)->__c_ = __cn1;
-if (--__cn2->end_ != __p)
-memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
+__cn1->__add(*__ip);
+(*__ip)->__c_ = __cn1;
+if (--__cn2->end_ != __ip)
+memmove(__ip, __ip+1, (__cn2->end_ - 
__ip)*sizeof(__i_node*));
 }
 }
 __db->unlock();
@@ -2004,16 +2004,16 @@ list<_Tp, _Alloc>::splice(const_iterator
 __libcpp_db* __db = __get_db();
 __c_node* __cn1 = __db->__find_c_and_lock(this);
 __c_node* __cn2 = __db->__find_c(&__c);
-for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
+for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
 {
---__p;
-iterator* __j = static_cast((*__p)->__i_);
+--__ip;
+iterator* __j = static_cast((*__ip)->__i_);
 if (__j->__ptr_ == __f)
 {
-__cn1->__add(*__p);
-(*__p)->__c_ = __cn1;
-if (--__cn2->end_ != __p)
-memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
+__cn1->__add(*__ip);
+(*__ip)->__c_ = __cn1;
+if (--__cn2->end_ != __ip)
+memmove(__ip, __ip+1, (__cn2->end_ - 
__ip)*sizeof(__i_node*));
 }
 }
 __db->unlock();
@@ -2058,19 +2058,19 @@ list<_Tp, _Alloc>::splice(const_iterator
 __libcpp_db* __db = __get_db();
 __c_node* __cn1 = __db->__find_c_and_lock(this);
 __c_node* __cn2 = __db->__find_c(&__c);
-for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
+for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
 {
---__p;
-iterator* __j = static_cast((*__p)->__i_);
+--__ip;
+iterator* __j = static_cast((*__ip)->__i_);
 for (__link_pointer __k = __f.__ptr_;
   __k != __l.__ptr_; __k = 
__k->__next_)
 {
 if (__j->__ptr_ == __k)
 {
-__cn1->__add(*__p);
-(*__p)->__c_ = __cn1;
-if (--__cn2->end_ != __p)
-memmove(__p, __p+1, (__cn2->end_ - 
__p)*sizeof(__i_node*));
+__cn1->__add(*__ip);
+(*__ip)->__c_ = __cn1;
+if (--__cn2->end_ != __ip)
+memmove(__ip, __ip+1, (__cn2->end_ - 
__ip)*sizeof(__i_node*));
 }
 }
 }


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


[libcxx] r284945 - Fix libc++ specific assertion in permissions(...) tests

2016-10-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun Oct 23 14:14:58 2016
New Revision: 284945

URL: http://llvm.org/viewvc/llvm-project?rev=284945=rev
Log:
Fix libc++ specific assertion in permissions(...) tests

Modified:

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp?rev=284945=284944=284945=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
 Sun Oct 23 14:14:58 2016
@@ -35,7 +35,8 @@ TEST_CASE(test_signatures)
 std::error_code ec; ((void)ec);
 ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts));
 // Not noexcept because of narrow contract
-ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts, ec));
+LIBCPP_ONLY(
+ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts, ec)));
 }
 
 TEST_CASE(test_error_reporting)


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


[PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.

2016-10-23 Thread Marcin Koƛcielnicki via cfe-commits
koriakin updated this revision to Diff 75550.
koriakin added a comment.

Added a comment explaining the reason.


Repository:
  rL LLVM

https://reviews.llvm.org/D21737

Files:
  lib/CodeGen/BackendUtil.cpp


Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -295,9 +295,13 @@
 
   PassManagerBuilderWrapper PMBuilder(CodeGenOpts, LangOpts);
 
-  // Figure out TargetLibraryInfo.
+  // Figure out TargetLibraryInfo.  This needs to be added to MPM and FPM
+  // manually (and not via PMBuilder), since some passes (eg. InstrProfiling)
+  // are inserted before PMBuilder ones - they'd get the default-constructed
+  // TLI with an unknown target otherwise.
   Triple TargetTriple(TheModule->getTargetTriple());
-  PMBuilder.LibraryInfo = createTLII(TargetTriple, CodeGenOpts);
+  std::unique_ptr TLII(
+  createTLII(TargetTriple, CodeGenOpts));
 
   switch (Inlining) {
   case CodeGenOptions::NoInlining:
@@ -330,6 +334,8 @@
   PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO;
   PMBuilder.RerollLoops = CodeGenOpts.RerollLoops;
 
+  MPM.add(new TargetLibraryInfoWrapperPass(*TLII));
+
   // Add target-specific passes that need to run as early as possible.
   if (TM)
 PMBuilder.addExtension(
@@ -413,6 +419,7 @@
   }
 
   // Set up the per-function pass manager.
+  FPM.add(new TargetLibraryInfoWrapperPass(*TLII));
   if (CodeGenOpts.VerifyModule)
 FPM.add(createVerifierPass());
 


Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -295,9 +295,13 @@
 
   PassManagerBuilderWrapper PMBuilder(CodeGenOpts, LangOpts);
 
-  // Figure out TargetLibraryInfo.
+  // Figure out TargetLibraryInfo.  This needs to be added to MPM and FPM
+  // manually (and not via PMBuilder), since some passes (eg. InstrProfiling)
+  // are inserted before PMBuilder ones - they'd get the default-constructed
+  // TLI with an unknown target otherwise.
   Triple TargetTriple(TheModule->getTargetTriple());
-  PMBuilder.LibraryInfo = createTLII(TargetTriple, CodeGenOpts);
+  std::unique_ptr TLII(
+  createTLII(TargetTriple, CodeGenOpts));
 
   switch (Inlining) {
   case CodeGenOptions::NoInlining:
@@ -330,6 +334,8 @@
   PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO;
   PMBuilder.RerollLoops = CodeGenOpts.RerollLoops;
 
+  MPM.add(new TargetLibraryInfoWrapperPass(*TLII));
+
   // Add target-specific passes that need to run as early as possible.
   if (TM)
 PMBuilder.addExtension(
@@ -413,6 +419,7 @@
   }
 
   // Set up the per-function pass manager.
+  FPM.add(new TargetLibraryInfoWrapperPass(*TLII));
   if (CodeGenOpts.VerifyModule)
 FPM.add(createVerifierPass());
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25439: Fixed column shift when formatting line containing bit shift operators

2016-10-23 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Generally, always upload diffs with the full file as context to phabricator. 
That way, it is easier to see how the diff fits into the rest of the file. 
Thanks for fixing this!!




Comment at: lib/Format/FormatTokenLexer.cpp:528
 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1);
+Column += 1;
 StateStack.push(LexerState::TOKEN_STASHED);

++Column;



Comment at: lib/Format/FormatTokenLexer.cpp:533
 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1);
+Column += 1;
 StateStack.push(LexerState::TOKEN_STASHED);

++Column;



Comment at: unittests/Format/FormatTest.cpp:11364
 
+TEST_F(FormatTest, BitshiftOperatorWidth) {
+  std::string left = "int a = 1 << 2; /* foo\n"

Could you add this right underneath the test "UnderstandsTemplateParameters"?



Comment at: unittests/Format/FormatTest.cpp:11365
+TEST_F(FormatTest, BitshiftOperatorWidth) {
+  std::string left = "int a = 1 << 2; /* foo\n"
+ "   bar */";

It's always useful to have some other formatting being done in the same test. 
We repeatedly ran into cases in the past where a test only passed because some 
change effectively disabled formatting for a specific line. I suggest writing 
these as:

  EXPECT_EQ("int a = 1 << 2; /* foo\n"
"   bar */",
format("inta=1<<2;  /* foo\n"
   "   bar */"));


https://reviews.llvm.org/D25439



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


[libcxx] r284944 - Turn on -Wshadow so I find occurances before STL does

2016-10-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun Oct 23 14:01:10 2016
New Revision: 284944

URL: http://llvm.org/viewvc/llvm-project?rev=284944=rev
Log:
Turn on -Wshadow so I find occurances before STL does

Modified:
libcxx/trunk/test/libcxx/test/config.py

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=284944=284943=284944=diff
==
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Sun Oct 23 14:01:10 2016
@@ -627,6 +627,7 @@ class Configuration(object):
 '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
 '-Wall', '-Wextra', '-Werror'
 ]
+self.cxx.addWarningFlagIfSupported('-Wshadow')
 
self.cxx.addWarningFlagIfSupported('-Wno-unused-command-line-argument')
 self.cxx.addWarningFlagIfSupported('-Wno-attributes')
 self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')


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


[PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.

2016-10-23 Thread Marcin Koƛcielnicki via cfe-commits
koriakin added a comment.

In https://reviews.llvm.org/D21737#468861, @mehdi_amini wrote:

> Missing test.


This is tested by https://reviews.llvm.org/D21741 (along with 
https://reviews.llvm.org/D21736).


Repository:
  rL LLVM

https://reviews.llvm.org/D21737



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


[PATCH] D25853: [libcxx] [test] Fix non-Standard make_from_tuple() tests.

2016-10-23 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r284943.


https://reviews.llvm.org/D25853



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


[libcxx] r284943 - Make make_from_tuple tests more portable. Patch from s...@microsoft.com

2016-10-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun Oct 23 13:55:51 2016
New Revision: 284943

URL: http://llvm.org/viewvc/llvm-project?rev=284943=rev
Log:
Make make_from_tuple tests more portable. Patch from s...@microsoft.com

Modified:

libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp?rev=284943=284942=284943=diff
==
--- 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp
 Sun Oct 23 13:55:51 2016
@@ -175,14 +175,14 @@ void test_noexcept() {
 Tuple tup; ((void)tup);
 Tuple const& ctup = tup; ((void)ctup);
 ASSERT_NOT_NOEXCEPT(std::make_from_tuple(ctup));
-ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup)));
+
LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup;
 }
 {
 using Tuple = std::pair;
 Tuple tup; ((void)tup);
 Tuple const& ctup = tup; ((void)ctup);
 ASSERT_NOT_NOEXCEPT(std::make_from_tuple(ctup));
-ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup)));
+
LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup;
 }
 {
 using Tuple = std::tuple;
@@ -192,7 +192,7 @@ void test_noexcept() {
 {
 using Tuple = std::tuple;
 Tuple tup; ((void)tup);
-ASSERT_NOEXCEPT(std::make_from_tuple(tup));
+LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(tup)));
 }
 {
 using Tuple = std::array;
@@ -202,7 +202,7 @@ void test_noexcept() {
 {
 using Tuple = std::array;
 Tuple tup; ((void)tup);
-ASSERT_NOEXCEPT(std::make_from_tuple(tup));
+LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(tup)));
 }
 }
 


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


[PATCH] D25853: [libcxx] [test] Fix non-Standard make_from_tuple() tests.

2016-10-23 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

Only scrubs don't have commit access (and don't get no love).


https://reviews.llvm.org/D25853



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


[PATCH] D25851: [libcxx] [test] Fix unreferenced formal parameter warnings.

2016-10-23 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r284942.


https://reviews.llvm.org/D25851



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


[libcxx] r284942 - Fix unreferenced parameters. Patch from s...@microsoft.com

2016-10-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun Oct 23 13:52:58 2016
New Revision: 284942

URL: http://llvm.org/viewvc/llvm-project?rev=284942=rev
Log:
Fix unreferenced parameters. Patch from s...@microsoft.com

Modified:

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp
libcxx/trunk/test/std/utilities/optional/optional.specalg/swap.pass.cpp
libcxx/trunk/test/support/archetypes.hpp

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp?rev=284942=284941=284942=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
 Sun Oct 23 13:52:58 2016
@@ -55,7 +55,7 @@ public:
 class Z
 {
 public:
-Z(int i) {TEST_THROW(6);}
+Z(int) {TEST_THROW(6);}
 };
 
 

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp?rev=284942=284941=284942=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp
 Sun Oct 23 13:52:58 2016
@@ -61,7 +61,7 @@ public:
 Z(Z&&) {TEST_THROW(7);}
 
 friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == 
y.i_;}
-friend void swap(Z& x, Z& y) {TEST_THROW(6);}
+friend void swap(Z&, Z&) {TEST_THROW(6);}
 };
 
 

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.specalg/swap.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.specalg/swap.pass.cpp?rev=284942=284941=284942=diff
==
--- libcxx/trunk/test/std/utilities/optional/optional.specalg/swap.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/optional/optional.specalg/swap.pass.cpp Sun 
Oct 23 13:52:58 2016
@@ -60,7 +60,7 @@ public:
 Z(Z&&) { TEST_THROW(7);}
 
 friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == 
y.i_;}
-friend void swap(Z& x, Z& y) { TEST_THROW(6);}
+friend void swap(Z&, Z&) { TEST_THROW(6);}
 };
 
 

Modified: libcxx/trunk/test/support/archetypes.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/archetypes.hpp?rev=284942=284941=284942=diff
==
--- libcxx/trunk/test/support/archetypes.hpp (original)
+++ libcxx/trunk/test/support/archetypes.hpp Sun Oct 23 13:52:58 2016
@@ -60,11 +60,11 @@ struct TestBase {
 ++alive; ++constructed; ++value_constructed;
 }
 template ::type = true>
-explicit TestBase(int x, int y) noexcept : value(y) {
+explicit TestBase(int, int y) noexcept : value(y) {
 ++alive; ++constructed; ++value_constructed;
 }
 template ::type = true>
-TestBase(int x, int y) noexcept : value(y) {
+TestBase(int, int y) noexcept : value(y) {
 ++alive; ++constructed; ++value_constructed;
 }
 template ::type = true>
@@ -131,9 +131,9 @@ struct ValueBase {
 template ::type = true>
 constexpr ValueBase(int x) : value(x) {}
 template ::type = true>
-explicit constexpr ValueBase(int x, int y) : value(y) {}
+explicit constexpr ValueBase(int, int y) : value(y) {}
 template ::type = true>
-constexpr ValueBase(int x, int y) : value(y) {}
+constexpr ValueBase(int, int y) : value(y) {}
 template ::type = true>
 explicit constexpr ValueBase(std::initializer_list& il, int y = 0) : 
value(il.size()) {}
 template ::type = true>
@@ -189,9 +189,9 @@ struct TrivialValueBase {
 template ::type = true>
 constexpr TrivialValueBase(int x) : value(x) {}
 template ::type = true>
-explicit constexpr TrivialValueBase(int x, int y) : value(y) {}
+explicit constexpr TrivialValueBase(int, int y) : value(y) {}
 template ::type = true>
-constexpr TrivialValueBase(int x, int y) : value(y) {}
+constexpr TrivialValueBase(int, int y) : value(y) {}
 template ::type = true>
 explicit constexpr TrivialValueBase(std::initializer_list& il, int y 
= 0) : value(il.size()) {}
 template ::type = true>


___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D25851: [libcxx] [test] Fix unreferenced formal parameter warnings.

2016-10-23 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

Get commit access!


https://reviews.llvm.org/D25851



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


[PATCH] D25852: [libcxx] [test] Fix shadow warnings.

2016-10-23 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r284941.


https://reviews.llvm.org/D25852



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


[libcxx] r284941 - Fix shadowing warning. Patch from s...@microsoft.com

2016-10-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun Oct 23 13:47:58 2016
New Revision: 284941

URL: http://llvm.org/viewvc/llvm-project?rev=284941=rev
Log:
Fix shadowing warning. Patch from s...@microsoft.com

Modified:

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp?rev=284941=284940=284941=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp
 Sun Oct 23 13:47:58 2016
@@ -81,8 +81,8 @@ void test_multi_arg()
 {
 test_one_arg();
 using Opt = std::optional;
-Opt opt;
 {
+Opt opt;
 opt.emplace(101, 41);
 assert(static_cast(opt) == true);
 assert(*opt == T(101, 41));


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


[PATCH] D25852: [libcxx] [test] Fix shadow warnings.

2016-10-23 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

Y'all need to get commit access :-P


https://reviews.llvm.org/D25852



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


[PATCH] D25898: [clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()

2016-10-23 Thread Piotr Padlewski via cfe-commits
Prazek added inline comments.



Comment at: test/clang-tidy/modernize-make-shared.cpp:122
+  Pderived = std::shared_ptr(new Derived());
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use std::make_shared instead
+  // CHECK-FIXES: Pderived = std::make_shared();

malcolm.parsons wrote:
> Prazek wrote:
> > I think the warning here could be better. The user is using make_shared 
> > here.
> > Maybe ' warning: use std::make_shared with zero arguments ...', but only in 
> > this case
> The user isn't using make_shared.
true, I've read that incorectly



Comment at: test/clang-tidy/modernize-make-shared.cpp:129
+  // FIXME: OK to replace when auto is not used
+  std::shared_ptr PBase = std::shared_ptr(new Derived());
+

malcolm.parsons wrote:
> Prazek wrote:
> > I think it is good to replace it even with auto, like
> > auto PBase = std::make_shared(new Derived());
> > 
> > For shared_ptr we can even do better, that we can't do for unique_ptr - we
> > coud change it to
> > auto PBase = std::make_shared();
> > because all conversions works.
> > Of course not in this patch, but it would be good to leave a comment about 
> > this here.
> A smart pointer to Derived cannot be reset with a pointer to Base.
oh yea, I was only thinking about downcasting smart pointer


https://reviews.llvm.org/D25898



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


[PATCH] D25898: [clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()

2016-10-23 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added inline comments.



Comment at: test/clang-tidy/modernize-make-shared.cpp:122
+  Pderived = std::shared_ptr(new Derived());
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use std::make_shared instead
+  // CHECK-FIXES: Pderived = std::make_shared();

Prazek wrote:
> I think the warning here could be better. The user is using make_shared here.
> Maybe ' warning: use std::make_shared with zero arguments ...', but only in 
> this case
The user isn't using make_shared.



Comment at: test/clang-tidy/modernize-make-shared.cpp:129
+  // FIXME: OK to replace when auto is not used
+  std::shared_ptr PBase = std::shared_ptr(new Derived());
+

Prazek wrote:
> I think it is good to replace it even with auto, like
> auto PBase = std::make_shared(new Derived());
> 
> For shared_ptr we can even do better, that we can't do for unique_ptr - we
> coud change it to
> auto PBase = std::make_shared();
> because all conversions works.
> Of course not in this patch, but it would be good to leave a comment about 
> this here.
A smart pointer to Derived cannot be reset with a pointer to Base.


https://reviews.llvm.org/D25898



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


[PATCH] D21502: Fix heuristics skipping invalid ctor-initializers with C++11

2016-10-23 Thread Piotr Padlewski via cfe-commits
Prazek added a comment.

Richard?


https://reviews.llvm.org/D21502



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


[PATCH] D24894: [clang-tidy] Prefer transparent functors to non-transparent one.

2016-10-23 Thread Piotr Padlewski via cfe-commits
Prazek added inline comments.



Comment at: docs/clang-tidy/checks/modernize-use-transparent-functors.rst:12
+  .. code-block:: c++
+
+// Non-transparent functor  

Say somewhere that you also handle cases like
std::less(arg1, arg2)
because from this documentation I didn't know about it.


https://reviews.llvm.org/D24894



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


[PATCH] D24894: [clang-tidy] Prefer transparent functors to non-transparent one.

2016-10-23 Thread Piotr Padlewski via cfe-commits
Prazek added inline comments.



Comment at: clang-tidy/modernize/UseTransparentFunctorsCheck.cpp:70
+static const StringRef Message =
+"prefer transparent functors (aka diamond operators)";
+

The message would be much better if you would put the name of this functor, like
"prefer transparent functor (%0)" where %0 would be evaluated to 
'std::greater<>" etc.



Comment at: clang-tidy/modernize/UseTransparentFunctorsCheck.cpp:89-109
+  for (; ArgNum < FunctorParentLoc.getNumArgs(); ++ArgNum) {
+const TemplateArgument  =
+FunctorParentLoc.getArgLoc(ArgNum).getArgument();
+if (Arg.getKind() != TemplateArgument::Type)
+  continue;
+QualType ParentArgType = Arg.getAsType();
+if (ParentArgType->isRecordType() &&

This can be moved to one or 2 functions, returning FunctorTypeLoc or 
llvm::Optional



Comment at: docs/clang-tidy/checks/modernize-use-transparent-functors.rst:32-33
+
+   If the option is set to non-zero (default is `0`), the check will not
+   warn on those cases where automatic FIXIT is not safe to apply.

I think
... will not warn on these cases as shown above, where automatic FIXIT...
would have been better.



Comment at: docs/clang-tidy/checks/modernize-use-transparent-functors.rst:33
+   If the option is set to non-zero (default is `0`), the check will not
+   warn on those cases where automatic FIXIT is not safe to apply.

Add a note
This check requires C++14 or higher to run.


https://reviews.llvm.org/D24894



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


[PATCH] D25898: [clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()

2016-10-23 Thread Piotr Padlewski via cfe-commits
Prazek added a comment.

Besides this looks good




Comment at: test/clang-tidy/modernize-make-shared.cpp:122
+  Pderived = std::shared_ptr(new Derived());
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use std::make_shared instead
+  // CHECK-FIXES: Pderived = std::make_shared();

I think the warning here could be better. The user is using make_shared here.
Maybe ' warning: use std::make_shared with zero arguments ...', but only in 
this case



Comment at: test/clang-tidy/modernize-make-shared.cpp:129
+  // FIXME: OK to replace when auto is not used
+  std::shared_ptr PBase = std::shared_ptr(new Derived());
+

I think it is good to replace it even with auto, like
auto PBase = std::make_shared(new Derived());

For shared_ptr we can even do better, that we can't do for unique_ptr - we
coud change it to
auto PBase = std::make_shared();
because all conversions works.
Of course not in this patch, but it would be good to leave a comment about this 
here.


https://reviews.llvm.org/D25898



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


r284936 - [AVX-512] Replace 512-bit pmovzx/sx builtins with native IR.

2016-10-23 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sun Oct 23 02:35:47 2016
New Revision: 284936

URL: http://llvm.org/viewvc/llvm-project?rev=284936=rev
Log:
[AVX-512] Replace 512-bit pmovzx/sx builtins with native IR.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512bwintrin.h
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512bw-builtins.c
cfe/trunk/test/CodeGen/avx512f-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=284936=284935=284936=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Sun Oct 23 02:35:47 2016
@@ -1388,18 +1388,6 @@ TARGET_BUILTIN(__builtin_ia32_rangepd512
 TARGET_BUILTIN(__builtin_ia32_rangeps512_mask, "V16fV16fV16fIiV16fUsIi", "", 
"avx512dq")
 TARGET_BUILTIN(__builtin_ia32_reducepd512_mask, "V8dV8dIiV8dUcIi", "", 
"avx512dq")
 TARGET_BUILTIN(__builtin_ia32_reduceps512_mask, "V16fV16fIiV16fUsIi", "", 
"avx512dq")
-TARGET_BUILTIN(__builtin_ia32_pmovsxbw512_mask, "V32sV32cV32sUi","","avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pmovsxbd512_mask, "V16iV16cV16iUs","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pmovsxbq512_mask, 
"V8LLiV16cV8LLiUc","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pmovsxdq512_mask, "V8LLiV8iV8LLiUc","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pmovsxwd512_mask, "V16iV16sV16iUs","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pmovsxwq512_mask, "V8LLiV8sV8LLiUc","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pmovzxbw512_mask, "V32sV32cV32sUi","","avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pmovzxbd512_mask, "V16iV16cV16iUs","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pmovzxbq512_mask, 
"V8LLiV16cV8LLiUc","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pmovzxdq512_mask, "V8LLiV8iV8LLiUc","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pmovzxwd512_mask, "V16iV16sV16iUs","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pmovzxwq512_mask, "V8LLiV8sV8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_prold512_mask, "V16iV16iIiV16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_prolq512_mask, 
"V8LLiV8LLiIiV8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_prold128_mask, "V4iV4iIiV4iUc","","avx512vl")

Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=284936=284935=284936=diff
==
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Sun Oct 23 02:35:47 2016
@@ -1527,55 +1527,49 @@ _mm512_maskz_unpacklo_epi16(__mmask32 __
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
-_mm512_cvtepi8_epi16 (__m256i __A)
+_mm512_cvtepi8_epi16(__m256i __A)
 {
-  return (__m512i) __builtin_ia32_pmovsxbw512_mask ((__v32qi) __A,
-(__v32hi)
-_mm512_setzero_hi (),
-(__mmask32) -1);
+  /* This function always performs a signed extension, but __v32qi is a char
+ which may be signed or unsigned, so use __v32qs. */
+  return (__m512i)__builtin_convertvector((__v32qs)__A, __v32hi);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
-_mm512_mask_cvtepi8_epi16 (__m512i __W, __mmask32 __U, __m256i __A)
+_mm512_mask_cvtepi8_epi16(__m512i __W, __mmask32 __U, __m256i __A)
 {
-  return (__m512i) __builtin_ia32_pmovsxbw512_mask ((__v32qi) __A,
-(__v32hi) __W,
-(__mmask32) __U);
+  return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
+ 
(__v32hi)_mm512_cvtepi8_epi16(__A),
+ (__v32hi)__W);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
-_mm512_maskz_cvtepi8_epi16 (__mmask32 __U, __m256i __A)
+_mm512_maskz_cvtepi8_epi16(__mmask32 __U, __m256i __A)
 {
-  return (__m512i) __builtin_ia32_pmovsxbw512_mask ((__v32qi) __A,
-(__v32hi)
-_mm512_setzero_hi(),
-(__mmask32) __U);
+  return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
+ 
(__v32hi)_mm512_cvtepi8_epi16(__A),
+ (__v32hi)_mm512_setzero_hi());
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
-_mm512_cvtepu8_epi16 (__m256i __A)
+_mm512_cvtepu8_epi16(__m256i __A)
 {
-  return (__m512i) __builtin_ia32_pmovzxbw512_mask ((__v32qi) __A,
-(__v32hi)
-_mm512_setzero_hi (),
-(__mmask32) -1);
+  return (__m512i)__builtin_convertvector((__v32qu)__A, __v32hi);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
-_mm512_mask_cvtepu8_epi16 (__m512i __W, __mmask32 __U, __m256i __A)
+_mm512_mask_cvtepu8_epi16(__m512i __W, __mmask32 __U, __m256i __A)
 {
-  return (__m512i) __builtin_ia32_pmovzxbw512_mask ((__v32qi) __A,
-

r284935 - [AVX-512] Remove masked 128/256-bit packss/packus builtins and replace with selects and the older unmasked builtins.

2016-10-23 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sun Oct 23 02:35:39 2016
New Revision: 284935

URL: http://llvm.org/viewvc/llvm-project?rev=284935=rev
Log:
[AVX-512] Remove masked 128/256-bit packss/packus builtins and replace with 
selects and the older unmasked builtins.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512vlbwintrin.h
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=284935=284934=284935=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Sun Oct 23 02:35:39 2016
@@ -1120,14 +1120,6 @@ TARGET_BUILTIN(__builtin_ia32_vpconflict
 TARGET_BUILTIN(__builtin_ia32_vplzcntd_512_mask, "V16iV16iV16iUs", "", 
"avx512cd")
 TARGET_BUILTIN(__builtin_ia32_vplzcntq_512_mask, "V8LLiV8LLiV8LLiUc", "", 
"avx512cd")
 
-TARGET_BUILTIN(__builtin_ia32_packssdw128_mask, "V8sV4iV4iV8sUc", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_packssdw256_mask, "V16sV8iV8iV16sUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_packsswb128_mask, "V16cV8sV8sV16cUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_packsswb256_mask, "V32cV16sV16sV32cUi", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_packusdw128_mask, "V8sV4iV4iV8sUc", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_packusdw256_mask, "V16sV8iV8iV16sUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_packuswb128_mask, "V16cV8sV8sV16cUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_packuswb256_mask, "V32cV16sV16sV32cUi", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmaxsb128_mask, "V16cV16cV16cV16cUs", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmaxsb256_mask, "V32cV32cV32cV32cUi", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmaxsw128_mask, "V8sV8sV8sV8sUc", "", 
"avx512vl,avx512bw")

Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlbwintrin.h?rev=284935=284934=284935=diff
==
--- cfe/trunk/lib/Headers/avx512vlbwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlbwintrin.h Sun Oct 23 02:35:39 2016
@@ -851,151 +851,130 @@ _mm256_maskz_abs_epi16(__mmask16 __U, __
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_maskz_packs_epi32 (__mmask8 __M, __m128i __A, __m128i __B)
-{
-  return (__m128i) __builtin_ia32_packssdw128_mask ((__v4si) __A,
-   (__v4si) __B,
-   (__v8hi) _mm_setzero_si128 (), __M);
+_mm_maskz_packs_epi32(__mmask8 __M, __m128i __A, __m128i __B) {
+  return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
+ (__v8hi)_mm_packs_epi32(__A, __B),
+ (__v8hi)_mm_setzero_si128());
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_mask_packs_epi32 (__m128i __W, __mmask16 __M, __m128i __A,
-  __m128i __B)
+_mm_mask_packs_epi32(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B)
 {
-  return (__m128i) __builtin_ia32_packssdw128_mask ((__v4si) __A,
-   (__v4si) __B,
-   (__v8hi) __W, __M);
+  return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
+ (__v8hi)_mm_packs_epi32(__A, __B),
+ (__v8hi)__W);
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
-_mm256_maskz_packs_epi32 (__mmask16 __M, __m256i __A, __m256i __B)
+_mm256_maskz_packs_epi32(__mmask16 __M, __m256i __A, __m256i __B)
 {
-  return (__m256i) __builtin_ia32_packssdw256_mask ((__v8si) __A,
-   (__v8si) __B,
-   (__v16hi) _mm256_setzero_si256 (),
-   __M);
+  return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
+  (__v16hi)_mm256_packs_epi32(__A, 
__B),
+  (__v16hi)_mm256_setzero_si256());
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
-_mm256_mask_packs_epi32 (__m256i __W, __mmask16 __M, __m256i __A,
-   __m256i __B)
+_mm256_mask_packs_epi32(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B)
 {
-  return (__m256i) __builtin_ia32_packssdw256_mask ((__v8si) __A,
-   (__v8si) __B,
-   (__v16hi) __W, __M);
+  return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
+  (__v16hi)_mm256_packs_epi32(__A, 
__B),
+  (__v16hi)__W);
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_maskz_packs_epi16 (__mmask16 __M, __m128i __A, __m128i __B)
+_mm_maskz_packs_epi16(__mmask16 __M, __m128i __A, __m128i __B)
 {
-  return (__m128i) __builtin_ia32_packsswb128_mask ((__v8hi) 

[PATCH] D25063: [x86][inline-asm][AVX512][clang][PART-1] Introducing "k" and "Yk" constraints for extended inline assembly, enabling use of AVX512 masked vectorized instructions.

2016-10-23 Thread Matan via cfe-commits
mharoush added inline comments.



Comment at: test/CodeGen/avx512-kconstraints-att_inline_asm.c:6
+void mask_Yk_i8(char msk){ 
+//CHECK: #APP 
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}

rnk wrote:
> The LLVM IR won't have #APP markers in it. Does this test really pass?
Sorry I uploaded the wrong patch file.


Repository:
  rL LLVM

https://reviews.llvm.org/D25063



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


r284934 - Add more doxygen comments to emmintrin.h's intrinsics.

2016-10-23 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Sun Oct 23 02:30:50 2016
New Revision: 284934

URL: http://llvm.org/viewvc/llvm-project?rev=284934=rev
Log:
Add more doxygen comments to emmintrin.h's intrinsics.

With this patch, all intrinsics in this file (with an exception of a handful of 
a recently added ones) will be documented. I will send out a patch for 4 
missining intrisics later.

The doxygen comments are automatically generated based on Sony's intrinsics 
document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream. This patch was internally reviewed by Yunzhong Gao.


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

Modified: cfe/trunk/lib/Headers/emmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?rev=284934=284933=284934=diff
==
--- cfe/trunk/lib/Headers/emmintrin.h (original)
+++ cfe/trunk/lib/Headers/emmintrin.h Sun Oct 23 02:30:50 2016
@@ -1210,18 +1210,63 @@ _mm_ucomige_sd(__m128d __a, __m128d __b)
   return __builtin_ia32_ucomisdge((__v2df)__a, (__v2df)__b);
 }
 
+/// \brief Compares the lower double-precision floating-point values in each of
+///the two 128-bit floating-point vectors of [2 x double] to determine if
+///the value in the first parameter is unequal to the corresponding value 
in
+///the second parameter. The comparison yields 0 for false, 1 for true. If
+///either of the two lower double-precision values is NaN, 0 is returned.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VUCOMISD / UCOMISD instruction.
+///
+/// \param __a
+///A 128-bit vector of [2 x double]. The lower double-precision value is
+///compared to the lower double-precision value of __b.
+/// \param __b
+///A 128-bit vector of [2 x double]. The lower double-precision value is
+///compared to the lower double-precision value of __a.
+/// \returns An integer containing the comparison result. If either of the two
+///lower double-precision values is NaN, 0 is returned.
 static __inline__ int __DEFAULT_FN_ATTRS
 _mm_ucomineq_sd(__m128d __a, __m128d __b)
 {
   return __builtin_ia32_ucomisdneq((__v2df)__a, (__v2df)__b);
 }
 
+/// \brief Converts the two double-precision floating-point elements of a
+///128-bit vector of [2 x double] into two single-precision floating-point
+///values, returned in the lower 64 bits of a 128-bit vector of [4 x 
float].
+///The upper 64 bits of the result vector are set to zero.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VCVTPD2PS / CVTPD2PS instruction.
+///
+/// \param __a
+///A 128-bit vector of [2 x double].
+/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
+///converted values. The upper 64 bits are set to zero.
 static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_cvtpd_ps(__m128d __a)
 {
   return __builtin_ia32_cvtpd2ps((__v2df)__a);
 }
 
+/// \brief Converts the lower two single-precision floating-point elements of a
+///128-bit vector of [4 x float] into two double-precision floating-point
+///values, returned in a 128-bit vector of [2 x double]. The upper two
+///elements of the input vector are unused.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VCVTPS2PD / CVTPS2PD instruction.
+///
+/// \param __a
+///A 128-bit vector of [4 x float]. The lower two single-precision
+///floating-point elements are converted to double-precision values. The
+///upper two elements are unused.
+/// \returns A 128-bit vector of [2 x double] containing the converted values.
 static __inline__ __m128d __DEFAULT_FN_ATTRS
 _mm_cvtps_pd(__m128 __a)
 {
@@ -1229,6 +1274,19 @@ _mm_cvtps_pd(__m128 __a)
   __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 1), __v2df);
 }
 
+/// \brief Converts the lower two integer elements of a 128-bit vector of
+///[4 x i32] into two double-precision floating-point values, returned in a
+///128-bit vector of [2 x double]. The upper two elements of the input
+///vector are unused.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VCVTDQ2PD / CVTDQ2PD instruction.
+///
+/// \param __a
+///A 128-bit integer vector of [4 x i32]. The lower two integer elements 
are
+///converted to double-precision values. The upper two elements are unused.
+/// \returns A 128-bit vector of [2 x double] containing the converted values.
 static __inline__ __m128d __DEFAULT_FN_ATTRS
 _mm_cvtepi32_pd(__m128i __a)
 {
@@ -1236,24 +1294,84 @@ _mm_cvtepi32_pd(__m128i __a)
   __builtin_shufflevector((__v4si)__a, (__v4si)__a, 0, 1), __v2df);
 }
 
+/// \brief Converts the two double-precision floating-point elements of a
+///128-bit vector of [2 x double] into two signed 32-bit integer values,
+///returned in the lower 64 bits of a 128-bit vector of [4 x i32]. The 
upper
+///64 bits of the result vector are set to zero.
+///

[PATCH] D25063: [x86][inline-asm][AVX512][clang][PART-1] Introducing "k" and "Yk" constraints for extended inline assembly, enabling use of AVX512 masked vectorized instructions.

2016-10-23 Thread Matan via cfe-commits
mharoush set the repository for this revision to rL LLVM.
mharoush updated this revision to Diff 75542.
mharoush added a comment.

Only test affected(correct version this time: checking LLVM IR instead of x86 
asm), 
This test depends on D25012  being applied.


Repository:
  rL LLVM

https://reviews.llvm.org/D25063

Files:
  lib/Basic/Targets.cpp
  test/CodeGen/avx512-kconstraints-att_inline_asm.c

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -3987,6 +3987,7 @@
 case 't': // Any SSE register, when SSE2 is enabled.
 case 'i': // Any SSE register, when SSE2 and inter-unit moves enabled.
 case 'm': // Any MMX register, when inter-unit moves enabled.
+case 'k': // AVX512 arch mask registers: k1-k7.
   Info.setAllowsRegister();
   return true;
 }
@@ -4008,6 +4009,8 @@
   case 'q': // Any register accessible as [r]l: a, b, c, and d.
   case 'y': // Any MMX register.
   case 'x': // Any SSE register.
+  case 'k': // Any AVX512 mask register (same as Yk, additionaly allows k0
+// for intermideate k reg operations).
   case 'Q': // Any register accessible as [r]h: a, b, c, and d.
   case 'R': // "Legacy" registers: ax, bx, cx, dx, di, si, sp, bp.
   case 'l': // "Index" registers: any general register that can be used as an
@@ -4041,6 +4044,8 @@
 unsigned Size) const {
   switch (Constraint[0]) {
   default: break;
+  case 'k':
+  // Registers k0-k7 (AVX512) size limit is 64 bit.
   case 'y':
 return Size <= 64;
   case 'f':
@@ -4061,6 +4066,7 @@
 default: break;
 case 'm':
   // 'Ym' is synonymous with 'y'.
+case 'k':
   return Size <= 64;
 case 'i':
 case 't':
@@ -4092,6 +4098,20 @@
 return std::string("{st}");
   case 'u': // second from top of floating point stack.
 return std::string("{st(1)}"); // second from top of floating point stack.
+  case 'Y':
+switch (Constraint[1]) {
+default:
+  // Break from inner switch and fall through (copy single char),
+  // continue parsing after copying the current constraint into 
+  // the return string.
+  break;
+case 'k':
+  // "^" hints llvm that this is a 2 letter constraint.
+  // "Constraint++" is used to promote the string iterator 
+  // to the next constraint.
+  return std::string("^") + std::string(Constraint++, 2);
+} 
+LLVM_FALLTHROUGH;
   default:
 return std::string(1, *Constraint);
   }
Index: test/CodeGen/avx512-kconstraints-att_inline_asm.c
===
--- test/CodeGen/avx512-kconstraints-att_inline_asm.c
+++ test/CodeGen/avx512-kconstraints-att_inline_asm.c
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 %s -target-cpu skylake-avx512 -O0  -emit-llvm -S -o - -Wall -Werror | FileCheck %s
+// This test checks validity of att\gcc style inline assmebly for avx512 k and Yk constraints.
+// Also checks mask register allows flexible type (size <= 64 bit)
+
+void mask_Yk_i8(char msk){ 
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+	asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   : "Yk" (msk));   //inputs
+}
+
+void mask_Yk_i16(short msk){
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+	asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   :  "Yk" (msk));  //inputs
+}
+
+void mask_Yk_i32(int msk){
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   :  "Yk" (msk)); 	//inputs
+}
+
+void mask_Yk_i64(long long msk){
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+	asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   :  "Yk" (msk)); 	//inputs
+}
+
+void k_wise_op_i8(char msk_dst,char msk_src1,char msk_src2){
+//CHECK: kandw %k1, %k0, %k0
+ asm ("kandw\t%2, %1, %0"
+   : "=k" (msk_dst)
+   : "k" (msk_src1), "k" (msk_src2));
+}
+
+void k_wise_op_i16(short msk_dst, short msk_src1, short msk_src2){
+//CHECK: kandw %k1, %k0, %k0
+  asm ("kandw\t%2, %1, %0"
+   : "=k" (msk_dst)
+   : "k" (msk_src1), "k" (msk_src2));
+}
+
+void k_wise_op_i32(int msk_dst, int msk_src1, int msk_src2){
+//CHECK: kandw %k1, %k0, %k0
+  asm ("kandw\t%2, %1, %0"
+   : "=k" (msk_dst)
+   : "k" (msk_src1), "k" (msk_src2));
+}
+
+void k_wise_op_i64(long long msk_dst, long long msk_src1, long long msk_src2){
+//CHECK: kandw %k1, %k0, %k0
+  asm ("kandw\t%2, %1, %0"
+   : "=k" (msk_dst)
+   : "k" (msk_src1), "k" (msk_src2));
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25898: [clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()

2016-10-23 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 75541.
malcolm.parsons added a comment.

Correct operator signature.
Remove unused parameter.
Rename method.
Reformat.


https://reviews.llvm.org/D25898

Files:
  clang-tidy/modernize/MakeSmartPtrCheck.cpp
  clang-tidy/modernize/MakeSmartPtrCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/modernize-make-shared.rst
  docs/clang-tidy/checks/modernize-make-unique.rst
  test/clang-tidy/modernize-make-shared.cpp
  test/clang-tidy/modernize-make-unique.cpp

Index: test/clang-tidy/modernize-make-unique.cpp
===
--- test/clang-tidy/modernize-make-unique.cpp
+++ test/clang-tidy/modernize-make-unique.cpp
@@ -8,6 +8,7 @@
 template >
 class unique_ptr {
 public:
+  unique_ptr();
   unique_ptr(type *ptr);
   unique_ptr(const unique_ptr ) = delete;
   unique_ptr(unique_ptr &);
@@ -17,11 +18,13 @@
   type *release();
   void reset();
   void reset(type *pt);
+  unique_ptr =(unique_ptr &&);
+  template 
+  unique_ptr =(unique_ptr &&);
 
 private:
   type *ptr;
 };
-
 }
 
 struct Base {
@@ -46,7 +49,8 @@
 
 struct Empty {};
 
-template using unique_ptr_ = std::unique_ptr;
+template 
+using unique_ptr_ = std::unique_ptr;
 
 void *operator new(__SIZE_TYPE__ Count, void *Ptr);
 
@@ -63,11 +67,27 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: use std::make_unique instead [modernize-make-unique]
   // CHECK-FIXES: std::unique_ptr P1 = std::make_unique();
 
+  P1.reset(new int());
+  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: use std::make_unique instead [modernize-make-unique]
+  // CHECK-FIXES: P1 = std::make_unique();
+
+  P1 = std::unique_ptr(new int());
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use std::make_unique instead [modernize-make-unique]
+  // CHECK-FIXES: P1 = std::make_unique();
+
   // Without parenthesis.
   std::unique_ptr P2 = std::unique_ptr(new int);
   // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: use std::make_unique instead [modernize-make-unique]
   // CHECK-FIXES: std::unique_ptr P2 = std::make_unique();
 
+  P2.reset(new int);
+  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: use std::make_unique instead [modernize-make-unique]
+  // CHECK-FIXES: P2 = std::make_unique();
+
+  P2 = std::unique_ptr(new int);
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use std::make_unique instead [modernize-make-unique]
+  // CHECK-FIXES: P2 = std::make_unique();
+
   // With auto.
   auto P3 = std::unique_ptr(new int());
   // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::make_unique instead
@@ -79,6 +99,10 @@
 unique_ptr Q = unique_ptr(new int());
 // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: use std::make_unique instead
 // CHECK-FIXES: unique_ptr Q = std::make_unique();
+
+Q = unique_ptr(new int());
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use std::make_unique instead
+// CHECK-FIXES: Q = std::make_unique();
   }
 
   std::unique_ptr R(new int());
@@ -88,19 +112,36 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::make_unique instead
   // CHECK-FIXES: int T = g(std::make_unique());
 
-  // Only replace if the type in the template is the same than the type returned
+  // Only replace if the type in the template is the same as the type returned
   // by the new operator.
   auto Pderived = std::unique_ptr(new Derived());
 
+  // OK to replace for reset and assign
+  Pderived.reset(new Derived());
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use std::make_unique instead
+  // CHECK-FIXES: Pderived = std::make_unique();
+
+  Pderived = std::unique_ptr(new Derived());
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use std::make_unique instead
+  // CHECK-FIXES: Pderived = std::make_unique();
+
+  // FIXME: OK to replace if assigned to unique_ptr
+  Pderived = std::unique_ptr(new Derived());
+
+  // FIXME: OK to replace when auto is not used
+  std::unique_ptr PBase = std::unique_ptr(new Derived());
+
   // The pointer is returned by the function, nothing to do.
   std::unique_ptr RetPtr = getPointer();
 
   // This emulates std::move.
-  std::unique_ptr Move = static_cast(P1);
+  std::unique_ptr Move = static_cast(P1);
 
-  // Placemenet arguments should not be removed.
+  // Placement arguments should not be removed.
   int *PInt = new int;
   std::unique_ptr Placement = std::unique_ptr(new (PInt) int{3});
+  Placement.reset(new (PInt) int{3});
+  Placement = std::unique_ptr(new (PInt) int{3});
 }
 
 // Calling make_smart_ptr from within a member function of a type with a
@@ -116,6 +157,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: use std::make_unique instead
 // CHECK-FIXES: auto callsPublic = std::make_unique();
 auto ptr = std::unique_ptr(new Private(42));
+ptr.reset(new Private(42));
+ptr = std::unique_ptr(new Private(42));
   }
 
   virtual ~Private();
@@ -132,6 +175,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: use std::make_unique instead
 // CHECK-FIXES: auto