svn commit: r311317 - in vendor/clang/dist: include/clang-c include/clang/AST include/clang/Basic include/clang/Driver include/clang/Frontend include/clang/Sema include/clang/Serialization include/...

Dimitry Andric dim at FreeBSD.org
Wed Jan 4 22:11:28 UTC 2017


Author: dim
Date: Wed Jan  4 22:11:23 2017
New Revision: 311317
URL: https://svnweb.freebsd.org/changeset/base/311317

Log:
  Vendor import of clang trunk r291012:
  https://llvm.org/svn/llvm-project/cfe/trunk@291012

Added:
  vendor/clang/dist/include/clang/Tooling/Core/Diagnostic.h   (contents, props changed)
  vendor/clang/dist/include/clang/Tooling/DiagnosticsYaml.h   (contents, props changed)
  vendor/clang/dist/lib/Tooling/Core/Diagnostic.cpp   (contents, props changed)
  vendor/clang/dist/test/CodeGenObjCXX/return.mm
  vendor/clang/dist/test/Driver/gold-lto-samplepgo.c   (contents, props changed)
  vendor/clang/dist/test/Driver/mbig-obj.c   (contents, props changed)
  vendor/clang/dist/test/Index/complete-designated-initializer.m
  vendor/clang/dist/test/OpenMP/distribute_lastprivate_codegen.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/distribute_private_codegen.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_aligned_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_default_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_defaultmap_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_device_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_if_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_is_device_ptr_ast_print.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_is_device_ptr_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_nowait_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_num_teams_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_num_threads_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_private_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_proc_bind_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_safelen_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_schedule_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_shared_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_simdlen_messages.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_thread_limit_messages.cpp   (contents, props changed)
Modified:
  vendor/clang/dist/include/clang-c/Index.h
  vendor/clang/dist/include/clang/AST/RecursiveASTVisitor.h
  vendor/clang/dist/include/clang/AST/StmtOpenMP.h
  vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td
  vendor/clang/dist/include/clang/Basic/OpenMPKinds.def
  vendor/clang/dist/include/clang/Basic/StmtNodes.td
  vendor/clang/dist/include/clang/Driver/Options.td
  vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def
  vendor/clang/dist/include/clang/Sema/Sema.h
  vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h
  vendor/clang/dist/include/clang/Tooling/Core/Replacement.h
  vendor/clang/dist/include/clang/Tooling/ReplacementsYaml.h
  vendor/clang/dist/lib/AST/ExprConstant.cpp
  vendor/clang/dist/lib/AST/StmtOpenMP.cpp
  vendor/clang/dist/lib/AST/StmtPrinter.cpp
  vendor/clang/dist/lib/AST/StmtProfile.cpp
  vendor/clang/dist/lib/Analysis/CFG.cpp
  vendor/clang/dist/lib/Basic/OpenMPKinds.cpp
  vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
  vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.h
  vendor/clang/dist/lib/CodeGen/CGStmt.cpp
  vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp
  vendor/clang/dist/lib/CodeGen/CodeGenFunction.cpp
  vendor/clang/dist/lib/CodeGen/CodeGenFunction.h
  vendor/clang/dist/lib/Driver/Tools.cpp
  vendor/clang/dist/lib/Format/Format.cpp
  vendor/clang/dist/lib/Format/UnwrappedLineParser.cpp
  vendor/clang/dist/lib/Frontend/ASTConsumers.cpp
  vendor/clang/dist/lib/Frontend/CompilerInvocation.cpp
  vendor/clang/dist/lib/Headers/__clang_cuda_runtime_wrapper.h
  vendor/clang/dist/lib/Parse/ParseOpenMP.cpp
  vendor/clang/dist/lib/Sema/SemaCUDA.cpp
  vendor/clang/dist/lib/Sema/SemaCodeComplete.cpp
  vendor/clang/dist/lib/Sema/SemaOpenMP.cpp
  vendor/clang/dist/lib/Sema/SemaOverload.cpp
  vendor/clang/dist/lib/Sema/SemaTemplate.cpp
  vendor/clang/dist/lib/Sema/SemaTemplateDeduction.cpp
  vendor/clang/dist/lib/Sema/TreeTransform.h
  vendor/clang/dist/lib/Serialization/ASTReaderStmt.cpp
  vendor/clang/dist/lib/Serialization/ASTWriterStmt.cpp
  vendor/clang/dist/lib/StaticAnalyzer/Core/ExprEngine.cpp
  vendor/clang/dist/lib/Tooling/Core/CMakeLists.txt
  vendor/clang/dist/test/CodeGen/object-size.c
  vendor/clang/dist/test/CodeGen/variadic-null-win64.c
  vendor/clang/dist/test/CodeGenCXX/return.cpp
  vendor/clang/dist/test/Coverage/ast-printing.cpp
  vendor/clang/dist/test/Coverage/cxx-language-features.inc
  vendor/clang/dist/test/Driver/cl-options.c
  vendor/clang/dist/test/Driver/clang_f_opts.c
  vendor/clang/dist/test/OpenMP/nesting_of_regions.cpp
  vendor/clang/dist/test/Sema/warn-overlap.c
  vendor/clang/dist/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
  vendor/clang/dist/test/SemaTemplate/deduction.cpp
  vendor/clang/dist/tools/libclang/CIndex.cpp
  vendor/clang/dist/tools/libclang/CXCursor.cpp
  vendor/clang/dist/unittests/Format/FormatTestJS.cpp
  vendor/clang/dist/unittests/Tooling/ReplacementsYamlTest.cpp
  vendor/clang/dist/utils/perf-training/lit.cfg
  vendor/clang/dist/utils/perf-training/order-files.lit.cfg

Modified: vendor/clang/dist/include/clang-c/Index.h
==============================================================================
--- vendor/clang/dist/include/clang-c/Index.h	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang-c/Index.h	Wed Jan  4 22:11:23 2017	(r311317)
@@ -2366,7 +2366,11 @@ enum CXCursorKind {
    */
   CXCursor_OMPTargetTeamsDistributeParallelForDirective = 277,
 
-  CXCursor_LastStmt = CXCursor_OMPTargetTeamsDistributeParallelForDirective,
+  /** \brief OpenMP target teams distribute parallel for simd directive.
+   */
+  CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective = 278,
+
+  CXCursor_LastStmt = CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective,
 
   /**
    * \brief Cursor that represents the translation unit itself.

Modified: vendor/clang/dist/include/clang/AST/RecursiveASTVisitor.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/RecursiveASTVisitor.h	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang/AST/RecursiveASTVisitor.h	Wed Jan  4 22:11:23 2017	(r311317)
@@ -2669,6 +2669,9 @@ DEF_TRAVERSE_STMT(OMPTargetTeamsDistribu
 DEF_TRAVERSE_STMT(OMPTargetTeamsDistributeParallelForDirective,
                   { TRY_TO(TraverseOMPExecutableDirective(S)); })
 
+DEF_TRAVERSE_STMT(OMPTargetTeamsDistributeParallelForSimdDirective,
+                  { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
 // OpenMP clauses.
 template <typename Derived>
 bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {

Modified: vendor/clang/dist/include/clang/AST/StmtOpenMP.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/StmtOpenMP.h	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang/AST/StmtOpenMP.h	Wed Jan  4 22:11:23 2017	(r311317)
@@ -3638,6 +3638,79 @@ public:
   }
 };
 
+/// This represents '#pragma omp target teams distribute parallel for simd'
+/// combined directive.
+///
+/// \code
+/// #pragma omp target teams distribute parallel for simd private(x)
+/// \endcode
+/// In this example directive '#pragma omp target teams distribute parallel
+/// for simd' has clause 'private' with the variables 'x'
+///
+class OMPTargetTeamsDistributeParallelForSimdDirective final
+    : public OMPLoopDirective {
+  friend class ASTStmtReader;
+
+  /// Build directive with the given start and end location.
+  ///
+  /// \param StartLoc Starting location of the directive kind.
+  /// \param EndLoc Ending location of the directive.
+  /// \param CollapsedNum Number of collapsed nested loops.
+  /// \param NumClauses Number of clauses.
+  ///
+  OMPTargetTeamsDistributeParallelForSimdDirective(SourceLocation StartLoc,
+                                                   SourceLocation EndLoc,
+                                                   unsigned CollapsedNum,
+                                                   unsigned NumClauses)
+      : OMPLoopDirective(this,
+                         OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
+                         OMPD_target_teams_distribute_parallel_for_simd,
+                         StartLoc, EndLoc, CollapsedNum, NumClauses) {}
+
+  /// Build an empty directive.
+  ///
+  /// \param CollapsedNum Number of collapsed nested loops.
+  /// \param NumClauses Number of clauses.
+  ///
+  explicit OMPTargetTeamsDistributeParallelForSimdDirective(
+      unsigned CollapsedNum, unsigned NumClauses)
+      : OMPLoopDirective(
+            this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
+            OMPD_target_teams_distribute_parallel_for_simd, SourceLocation(),
+            SourceLocation(), CollapsedNum, NumClauses) {}
+
+public:
+  /// Creates directive with a list of \a Clauses.
+  ///
+  /// \param C AST context.
+  /// \param StartLoc Starting location of the directive kind.
+  /// \param EndLoc Ending Location of the directive.
+  /// \param CollapsedNum Number of collapsed loops.
+  /// \param Clauses List of clauses.
+  /// \param AssociatedStmt Statement, associated with the directive.
+  /// \param Exprs Helper expressions for CodeGen.
+  ///
+  static OMPTargetTeamsDistributeParallelForSimdDirective *
+  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
+         unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
+         Stmt *AssociatedStmt, const HelperExprs &Exprs);
+
+  /// Creates an empty directive with the place for \a NumClauses clauses.
+  ///
+  /// \param C AST context.
+  /// \param CollapsedNum Number of collapsed nested loops.
+  /// \param NumClauses Number of clauses.
+  ///
+  static OMPTargetTeamsDistributeParallelForSimdDirective *
+  CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
+              EmptyShell);
+
+  static bool classof(const Stmt *T) {
+    return T->getStmtClass() ==
+           OMPTargetTeamsDistributeParallelForSimdDirectiveClass;
+  }
+};
+
 } // end namespace clang
 
 #endif

Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td
==============================================================================
--- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td	Wed Jan  4 22:11:23 2017	(r311317)
@@ -3921,6 +3921,8 @@ def ext_ms_deref_template_argument: ExtW
 def ext_ms_delayed_template_argument: ExtWarn<
   "using the undeclared type %0 as a default template argument is a "
   "Microsoft extension">, InGroup<MicrosoftTemplate>;
+def err_template_arg_deduced_incomplete_pack : Error<
+  "deduced incomplete pack %0 for template parameter %1">;
 
 // C++ template specialization
 def err_template_spec_unknown_kind : Error<

Modified: vendor/clang/dist/include/clang/Basic/OpenMPKinds.def
==============================================================================
--- vendor/clang/dist/include/clang/Basic/OpenMPKinds.def	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang/Basic/OpenMPKinds.def	Wed Jan  4 22:11:23 2017	(r311317)
@@ -162,6 +162,9 @@
 #ifndef OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE
 #define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name)
 #endif
+#ifndef OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE
+#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name)
+#endif
 
 // OpenMP directives.
 OPENMP_DIRECTIVE(threadprivate)
@@ -214,6 +217,7 @@ OPENMP_DIRECTIVE_EXT(teams_distribute_pa
 OPENMP_DIRECTIVE_EXT(target_teams, "target teams")
 OPENMP_DIRECTIVE_EXT(target_teams_distribute, "target teams distribute")
 OPENMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for, "target teams distribute parallel for")
+OPENMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for_simd, "target teams distribute parallel for simd")
 
 // OpenMP clauses.
 OPENMP_CLAUSE(if, OMPIfClause)
@@ -793,6 +797,33 @@ OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_
 OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(schedule)
 OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(linear)
 
+// Clauses allowed for OpenMP directive
+// 'target teams distribute parallel for simd'.
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(if)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(device)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(map)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(private)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(nowait)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(depend)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(defaultmap)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(firstprivate)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(is_device_ptr)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(default)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(shared)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(reduction)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(num_teams)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(thread_limit)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(lastprivate)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(collapse)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(dist_schedule)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(num_threads)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(proc_bind)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(schedule)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(linear)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(aligned)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(safelen)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(simdlen)
+
 #undef OPENMP_TASKLOOP_SIMD_CLAUSE
 #undef OPENMP_TASKLOOP_CLAUSE
 #undef OPENMP_LINEAR_KIND
@@ -843,3 +874,4 @@ OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_
 #undef OPENMP_TARGET_TEAMS_CLAUSE
 #undef OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE
 #undef OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE
+#undef OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE

Modified: vendor/clang/dist/include/clang/Basic/StmtNodes.td
==============================================================================
--- vendor/clang/dist/include/clang/Basic/StmtNodes.td	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang/Basic/StmtNodes.td	Wed Jan  4 22:11:23 2017	(r311317)
@@ -243,3 +243,4 @@ def OMPTeamsDistributeParallelForDirecti
 def OMPTargetTeamsDirective : DStmt<OMPExecutableDirective>;
 def OMPTargetTeamsDistributeDirective : DStmt<OMPLoopDirective>;
 def OMPTargetTeamsDistributeParallelForDirective : DStmt<OMPLoopDirective>;
+def OMPTargetTeamsDistributeParallelForSimdDirective : DStmt<OMPLoopDirective>;

Modified: vendor/clang/dist/include/clang/Driver/Options.td
==============================================================================
--- vendor/clang/dist/include/clang/Driver/Options.td	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang/Driver/Options.td	Wed Jan  4 22:11:23 2017	(r311317)
@@ -882,7 +882,7 @@ def fms_compatibility_version
                "(default))">;
 def fdelayed_template_parsing : Flag<["-"], "fdelayed-template-parsing">, Group<f_Group>,
   HelpText<"Parse templated function definitions at the end of the "
-           "translation unit">,  Flags<[CC1Option]>;
+           "translation unit">,  Flags<[CC1Option, CoreOption]>;
 def fms_memptr_rep_EQ : Joined<["-"], "fms-memptr-rep=">, Group<f_Group>, Flags<[CC1Option]>;
 def fmodules_cache_path : Joined<["-"], "fmodules-cache-path=">, Group<i_Group>,
   Flags<[DriverOption, CC1Option]>, MetaVarName<"<directory>">,
@@ -1031,7 +1031,8 @@ def fno_ms_extensions : Flag<["-"], "fno
   Flags<[CoreOption]>;
 def fno_ms_compatibility : Flag<["-"], "fno-ms-compatibility">, Group<f_Group>,
   Flags<[CoreOption]>;
-def fno_delayed_template_parsing : Flag<["-"], "fno-delayed-template-parsing">, Group<f_Group>;
+def fno_delayed_template_parsing : Flag<["-"], "fno-delayed-template-parsing">, Group<f_Group>,
+  Flags<[DriverOption, CoreOption]>;
 def fno_objc_exceptions: Flag<["-"], "fno-objc-exceptions">, Group<f_Group>;
 def fno_objc_legacy_dispatch : Flag<["-"], "fno-objc-legacy-dispatch">, Group<f_Group>;
 def fno_objc_weak : Flag<["-"], "fno-objc-weak">, Group<f_Group>, Flags<[CC1Option]>;
@@ -1331,6 +1332,12 @@ def funique_section_names : Flag <["-"],
 def fno_unique_section_names : Flag <["-"], "fno-unique-section-names">,
   Group<f_Group>, Flags<[CC1Option]>;
 
+def fstrict_return : Flag<["-"], "fstrict-return">, Group<f_Group>,
+  Flags<[CC1Option]>,
+  HelpText<"Always treat control flow paths that fall off the end of a non-void"
+           "function as unreachable">;
+def fno_strict_return : Flag<["-"], "fno-strict-return">, Group<f_Group>,
+  Flags<[CC1Option]>;
 
 def fdebug_types_section: Flag <["-"], "fdebug-types-section">, Group<f_Group>,
   Flags<[CC1Option]>, HelpText<"Place debug types in their own section (ELF Only)">;

Modified: vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def
==============================================================================
--- vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def	Wed Jan  4 22:11:23 2017	(r311317)
@@ -251,6 +251,10 @@ CODEGENOPT(DiagnosticsWithHotness, 1, 0)
 /// Whether copy relocations support is available when building as PIE.
 CODEGENOPT(PIECopyRelocations, 1, 0)
 
+/// Whether we should use the undefined behaviour optimization for control flow
+/// paths that reach the end of a function without executing a required return.
+CODEGENOPT(StrictReturn, 1, 1)
+
 #undef CODEGENOPT
 #undef ENUM_CODEGENOPT
 #undef VALUE_CODEGENOPT

Modified: vendor/clang/dist/include/clang/Sema/Sema.h
==============================================================================
--- vendor/clang/dist/include/clang/Sema/Sema.h	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang/Sema/Sema.h	Wed Jan  4 22:11:23 2017	(r311317)
@@ -8514,6 +8514,12 @@ public:
       ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
       SourceLocation EndLoc,
       llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
+  /// Called on well-formed '\#pragma omp target teams distribute parallel for
+  /// simd' after parsing of the associated statement.
+  StmtResult ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(
+      ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
+      SourceLocation EndLoc,
+      llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
 
   /// Checks correctness of linear modifiers.
   bool CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind,

Modified: vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h
==============================================================================
--- vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h	Wed Jan  4 22:11:23 2017	(r311317)
@@ -1516,6 +1516,7 @@ namespace clang {
       STMT_OMP_TARGET_TEAMS_DIRECTIVE,
       STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE,
       STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
+      STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
       EXPR_OMP_ARRAY_SECTION,
 
       // ARC

Added: vendor/clang/dist/include/clang/Tooling/Core/Diagnostic.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/clang/dist/include/clang/Tooling/Core/Diagnostic.h	Wed Jan  4 22:11:23 2017	(r311317)
@@ -0,0 +1,100 @@
+//===--- Diagnostic.h - Framework for clang diagnostics tools --*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// \file
+//  Structures supporting diagnostics and refactorings that span multiple
+//  translation units. Indicate diagnostics reports and replacements
+//  suggestions for the analyzed sources.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_TOOLING_CORE_DIAGNOSTIC_H
+#define LLVM_CLANG_TOOLING_CORE_DIAGNOSTIC_H
+
+#include "Replacement.h"
+#include "clang/Basic/Diagnostic.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include <string>
+
+namespace clang {
+namespace tooling {
+
+/// \brief Represents the diagnostic message with the error message associated
+/// and the information on the location of the problem.
+struct DiagnosticMessage {
+  DiagnosticMessage(llvm::StringRef Message = "");
+
+  /// \brief Constructs a diagnostic message with anoffset to the diagnostic
+  /// within the file where the problem occured.
+  ///
+  /// \param Loc Should be a file location, it is not meaningful for a macro
+  /// location.
+  ///
+  DiagnosticMessage(llvm::StringRef Message, const SourceManager &Sources,
+                    SourceLocation Loc);
+  std::string Message;
+  std::string FilePath;
+  unsigned FileOffset;
+};
+
+/// \brief Represents the diagnostic with the level of severity and possible
+/// fixes to be applied.
+struct Diagnostic {
+  enum Level {
+    Warning = DiagnosticsEngine::Warning,
+    Error = DiagnosticsEngine::Error
+  };
+
+  Diagnostic() = default;
+
+  Diagnostic(llvm::StringRef DiagnosticName, Level DiagLevel,
+             StringRef BuildDirectory);
+
+  Diagnostic(llvm::StringRef DiagnosticName, DiagnosticMessage &Message,
+             llvm::StringMap<Replacements> &Fix,
+             SmallVector<DiagnosticMessage, 1> &Notes, Level DiagLevel,
+             llvm::StringRef BuildDirectory);
+
+  /// \brief Name identifying the Diagnostic.
+  std::string DiagnosticName;
+
+  /// \brief Message associated to the diagnostic.
+  DiagnosticMessage Message;
+
+  /// \brief Fixes to apply, grouped by file path.
+  llvm::StringMap<Replacements> Fix;
+
+  /// \brief Potential notes about the diagnostic.
+  SmallVector<DiagnosticMessage, 1> Notes;
+
+  /// \brief Diagnostic level. Can indicate either an error or a warning.
+  Level DiagLevel;
+
+  /// \brief A build directory of the diagnostic source file.
+  ///
+  /// It's an absolute path which is `directory` field of the source file in
+  /// compilation database. If users don't specify the compilation database
+  /// directory, it is the current directory where clang-tidy runs.
+  ///
+  /// Note: it is empty in unittest.
+  std::string BuildDirectory;
+};
+
+/// \brief Collection of Diagnostics generated from a single translation unit.
+struct TranslationUnitDiagnostics {
+  /// Name of the main source for the translation unit.
+  std::string MainSourceFile;
+  std::vector<Diagnostic> Diagnostics;
+};
+
+} // end namespace tooling
+} // end namespace clang
+#endif // LLVM_CLANG_TOOLING_CORE_DIAGNOSTIC_H

Modified: vendor/clang/dist/include/clang/Tooling/Core/Replacement.h
==============================================================================
--- vendor/clang/dist/include/clang/Tooling/Core/Replacement.h	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang/Tooling/Core/Replacement.h	Wed Jan  4 22:11:23 2017	(r311317)
@@ -329,12 +329,6 @@ llvm::Expected<std::string> applyAllRepl
 struct TranslationUnitReplacements {
   /// Name of the main source for the translation unit.
   std::string MainSourceFile;
-
-  /// A freeform chunk of text to describe the context of the replacements.
-  /// Will be printed, for example, when detecting conflicts during replacement
-  /// deduplication.
-  std::string Context;
-
   std::vector<Replacement> Replacements;
 };
 

Added: vendor/clang/dist/include/clang/Tooling/DiagnosticsYaml.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/clang/dist/include/clang/Tooling/DiagnosticsYaml.h	Wed Jan  4 22:11:23 2017	(r311317)
@@ -0,0 +1,101 @@
+//===-- DiagnosticsYaml.h -- Serialiazation for Diagnosticss ---*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// \brief This file defines the structure of a YAML document for serializing
+/// diagnostics.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_TOOLING_DIAGNOSTICSYAML_H
+#define LLVM_CLANG_TOOLING_DIAGNOSTICSYAML_H
+
+#include "clang/Tooling/Core/Diagnostic.h"
+#include "clang/Tooling/ReplacementsYaml.h"
+#include "llvm/Support/YAMLTraits.h"
+#include <string>
+
+LLVM_YAML_IS_SEQUENCE_VECTOR(clang::tooling::Diagnostic)
+
+namespace llvm {
+namespace yaml {
+
+template <> struct MappingTraits<clang::tooling::Diagnostic> {
+  /// \brief Helper to (de)serialize a Diagnostic since we don't have direct
+  /// access to its data members.
+  class NormalizedDiagnostic {
+  public:
+    NormalizedDiagnostic(const IO &)
+        : DiagLevel(clang::tooling::Diagnostic::Level::Warning) {}
+
+    NormalizedDiagnostic(const IO &, const clang::tooling::Diagnostic &D)
+        : DiagnosticName(D.DiagnosticName), Message(D.Message), Fix(D.Fix),
+          Notes(D.Notes), DiagLevel(D.DiagLevel),
+          BuildDirectory(D.BuildDirectory) {}
+
+    clang::tooling::Diagnostic denormalize(const IO &) {
+      return clang::tooling::Diagnostic(DiagnosticName, Message, Fix, Notes,
+                                        DiagLevel, BuildDirectory);
+    }
+
+    std::string DiagnosticName;
+    clang::tooling::DiagnosticMessage Message;
+    llvm::StringMap<clang::tooling::Replacements> Fix;
+    SmallVector<clang::tooling::DiagnosticMessage, 1> Notes;
+    clang::tooling::Diagnostic::Level DiagLevel;
+    std::string BuildDirectory;
+  };
+
+  static void mapping(IO &Io, clang::tooling::Diagnostic &D) {
+    MappingNormalization<NormalizedDiagnostic, clang::tooling::Diagnostic> Keys(
+        Io, D);
+    Io.mapRequired("DiagnosticName", Keys->DiagnosticName);
+
+    // FIXME: Export properly all the different fields.
+
+    std::vector<clang::tooling::Replacement> Fixes;
+    for (auto &Replacements : Keys->Fix) {
+      for (auto &Replacement : Replacements.second) {
+        Fixes.push_back(Replacement);
+      }
+    }
+    Io.mapRequired("Replacements", Fixes);
+    for (auto &Fix : Fixes) {
+      llvm::Error Err = Keys->Fix[Fix.getFilePath()].add(Fix);
+      if (Err) {
+        // FIXME: Implement better conflict handling.
+        llvm::errs() << "Fix conflicts with existing fix: "
+                     << llvm::toString(std::move(Err)) << "\n";
+      }
+    }
+  }
+};
+
+/// \brief Specialized MappingTraits to describe how a
+/// TranslationUnitDiagnostics is (de)serialized.
+template <> struct MappingTraits<clang::tooling::TranslationUnitDiagnostics> {
+  static void mapping(IO &Io, clang::tooling::TranslationUnitDiagnostics &Doc) {
+    Io.mapRequired("MainSourceFile", Doc.MainSourceFile);
+
+    std::vector<clang::tooling::Diagnostic> Diagnostics;
+    for (auto &Diagnostic : Doc.Diagnostics) {
+      // FIXME: Export all diagnostics, not just the ones with fixes.
+      // Update MappingTraits<clang::tooling::Diagnostic>::mapping.
+      if (Diagnostic.Fix.size() > 0) {
+        Diagnostics.push_back(Diagnostic);
+      }
+    }
+    Io.mapRequired("Diagnostics", Diagnostics);
+    Doc.Diagnostics = Diagnostics;
+  }
+};
+} // end namespace yaml
+} // end namespace llvm
+
+#endif // LLVM_CLANG_TOOLING_DIAGNOSTICSYAML_H

Modified: vendor/clang/dist/include/clang/Tooling/ReplacementsYaml.h
==============================================================================
--- vendor/clang/dist/include/clang/Tooling/ReplacementsYaml.h	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/include/clang/Tooling/ReplacementsYaml.h	Wed Jan  4 22:11:23 2017	(r311317)
@@ -65,7 +65,6 @@ template <> struct MappingTraits<clang::
   static void mapping(IO &Io,
                       clang::tooling::TranslationUnitReplacements &Doc) {
     Io.mapRequired("MainSourceFile", Doc.MainSourceFile);
-    Io.mapOptional("Context", Doc.Context, std::string());
     Io.mapRequired("Replacements", Doc.Replacements);
   }
 };

Modified: vendor/clang/dist/lib/AST/ExprConstant.cpp
==============================================================================
--- vendor/clang/dist/lib/AST/ExprConstant.cpp	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/lib/AST/ExprConstant.cpp	Wed Jan  4 22:11:23 2017	(r311317)
@@ -7192,6 +7192,12 @@ static bool determineEndOffset(EvalInfo 
                                CharUnits &EndOffset) {
   bool DetermineForCompleteObject = refersToCompleteObject(LVal);
 
+  auto CheckedHandleSizeof = [&](QualType Ty, CharUnits &Result) {
+    if (Ty.isNull() || Ty->isIncompleteType() || Ty->isFunctionType())
+      return false;
+    return HandleSizeof(Info, ExprLoc, Ty, Result);
+  };
+
   // We want to evaluate the size of the entire object. This is a valid fallback
   // for when Type=1 and the designator is invalid, because we're asked for an
   // upper-bound.
@@ -7209,7 +7215,7 @@ static bool determineEndOffset(EvalInfo 
       return false;
 
     QualType BaseTy = getObjectType(LVal.getLValueBase());
-    return !BaseTy.isNull() && HandleSizeof(Info, ExprLoc, BaseTy, EndOffset);
+    return CheckedHandleSizeof(BaseTy, EndOffset);
   }
 
   // We want to evaluate the size of a subobject.
@@ -7238,7 +7244,7 @@ static bool determineEndOffset(EvalInfo 
   }
 
   CharUnits BytesPerElem;
-  if (!HandleSizeof(Info, ExprLoc, Designator.MostDerivedType, BytesPerElem))
+  if (!CheckedHandleSizeof(Designator.MostDerivedType, BytesPerElem))
     return false;
 
   // According to the GCC documentation, we want the size of the subobject

Modified: vendor/clang/dist/lib/AST/StmtOpenMP.cpp
==============================================================================
--- vendor/clang/dist/lib/AST/StmtOpenMP.cpp	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/lib/AST/StmtOpenMP.cpp	Wed Jan  4 22:11:23 2017	(r311317)
@@ -1659,3 +1659,64 @@ OMPTargetTeamsDistributeParallelForDirec
   return new (Mem)
       OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
 }
+
+OMPTargetTeamsDistributeParallelForSimdDirective *
+OMPTargetTeamsDistributeParallelForSimdDirective::Create(
+    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
+    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
+    const HelperExprs &Exprs) {
+  auto Size =
+      llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
+                    alignof(OMPClause *));
+  void *Mem = C.Allocate(
+      Size + sizeof(OMPClause *) * Clauses.size() +
+      sizeof(Stmt *) *
+          numLoopChildren(CollapsedNum,
+                          OMPD_target_teams_distribute_parallel_for_simd));
+  OMPTargetTeamsDistributeParallelForSimdDirective *Dir =
+      new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
+           StartLoc, EndLoc, CollapsedNum, Clauses.size());
+  Dir->setClauses(Clauses);
+  Dir->setAssociatedStmt(AssociatedStmt);
+  Dir->setIterationVariable(Exprs.IterationVarRef);
+  Dir->setLastIteration(Exprs.LastIteration);
+  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
+  Dir->setPreCond(Exprs.PreCond);
+  Dir->setCond(Exprs.Cond);
+  Dir->setInit(Exprs.Init);
+  Dir->setInc(Exprs.Inc);
+  Dir->setIsLastIterVariable(Exprs.IL);
+  Dir->setLowerBoundVariable(Exprs.LB);
+  Dir->setUpperBoundVariable(Exprs.UB);
+  Dir->setStrideVariable(Exprs.ST);
+  Dir->setEnsureUpperBound(Exprs.EUB);
+  Dir->setNextLowerBound(Exprs.NLB);
+  Dir->setNextUpperBound(Exprs.NUB);
+  Dir->setNumIterations(Exprs.NumIterations);
+  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
+  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
+  Dir->setCounters(Exprs.Counters);
+  Dir->setPrivateCounters(Exprs.PrivateCounters);
+  Dir->setInits(Exprs.Inits);
+  Dir->setUpdates(Exprs.Updates);
+  Dir->setFinals(Exprs.Finals);
+  Dir->setPreInits(Exprs.PreInits);
+  return Dir;
+}
+
+OMPTargetTeamsDistributeParallelForSimdDirective *
+OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
+    const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
+    EmptyShell) {
+  auto Size =
+      llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
+                    alignof(OMPClause *));
+  void *Mem = C.Allocate(
+      Size + sizeof(OMPClause *) * NumClauses +
+      sizeof(Stmt *) *
+          numLoopChildren(CollapsedNum,
+                          OMPD_target_teams_distribute_parallel_for_simd));
+  return new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
+      CollapsedNum, NumClauses);
+}
+

Modified: vendor/clang/dist/lib/AST/StmtPrinter.cpp
==============================================================================
--- vendor/clang/dist/lib/AST/StmtPrinter.cpp	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/lib/AST/StmtPrinter.cpp	Wed Jan  4 22:11:23 2017	(r311317)
@@ -1244,6 +1244,12 @@ void StmtPrinter::VisitOMPTargetTeamsDis
   PrintOMPExecutableDirective(Node);
 }
 
+void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
+    OMPTargetTeamsDistributeParallelForSimdDirective *Node) {
+  Indent() << "#pragma omp target teams distribute parallel for simd ";
+  PrintOMPExecutableDirective(Node);
+}
+
 //===----------------------------------------------------------------------===//
 //  Expr printing methods.
 //===----------------------------------------------------------------------===//

Modified: vendor/clang/dist/lib/AST/StmtProfile.cpp
==============================================================================
--- vendor/clang/dist/lib/AST/StmtProfile.cpp	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/lib/AST/StmtProfile.cpp	Wed Jan  4 22:11:23 2017	(r311317)
@@ -763,6 +763,11 @@ void StmtProfiler::VisitOMPTargetTeamsDi
   VisitOMPLoopDirective(S);
 }
 
+void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
+    const OMPTargetTeamsDistributeParallelForSimdDirective *S) {
+  VisitOMPLoopDirective(S);
+}
+
 void StmtProfiler::VisitExpr(const Expr *S) {
   VisitStmt(S);
 }

Modified: vendor/clang/dist/lib/Analysis/CFG.cpp
==============================================================================
--- vendor/clang/dist/lib/Analysis/CFG.cpp	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/lib/Analysis/CFG.cpp	Wed Jan  4 22:11:23 2017	(r311317)
@@ -1690,15 +1690,19 @@ CFGBuilder::VisitLogicalOperator(BinaryO
     // we have been provided.
     ExitBlock = RHSBlock = createBlock(false);
 
+    // Even though KnownVal is only used in the else branch of the next
+    // conditional, tryEvaluateBool performs additional checking on the
+    // Expr, so it should be called unconditionally.
+    TryResult KnownVal = tryEvaluateBool(RHS);
+    if (!KnownVal.isKnown())
+      KnownVal = tryEvaluateBool(B);
+
     if (!Term) {
       assert(TrueBlock == FalseBlock);
       addSuccessor(RHSBlock, TrueBlock);
     }
     else {
       RHSBlock->setTerminator(Term);
-      TryResult KnownVal = tryEvaluateBool(RHS);
-      if (!KnownVal.isKnown())
-        KnownVal = tryEvaluateBool(B);
       addSuccessor(RHSBlock, TrueBlock, !KnownVal.isFalse());
       addSuccessor(RHSBlock, FalseBlock, !KnownVal.isTrue());
     }

Modified: vendor/clang/dist/lib/Basic/OpenMPKinds.cpp
==============================================================================
--- vendor/clang/dist/lib/Basic/OpenMPKinds.cpp	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/lib/Basic/OpenMPKinds.cpp	Wed Jan  4 22:11:23 2017	(r311317)
@@ -690,6 +690,16 @@ bool clang::isAllowedClauseForDirective(
       break;
     }
     break;
+  case OMPD_target_teams_distribute_parallel_for_simd:
+    switch (CKind) {
+#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name)          \
+  case OMPC_##Name:                                                            \
+    return true;
+#include "clang/Basic/OpenMPKinds.def"
+    default:
+      break;
+    }
+    break;
   case OMPD_declare_target:
   case OMPD_end_declare_target:
   case OMPD_unknown:
@@ -721,7 +731,8 @@ bool clang::isOpenMPLoopDirective(OpenMP
          DKind == OMPD_teams_distribute_parallel_for_simd ||
          DKind == OMPD_teams_distribute_parallel_for ||
          DKind == OMPD_target_teams_distribute ||
-         DKind == OMPD_target_teams_distribute_parallel_for;
+         DKind == OMPD_target_teams_distribute_parallel_for ||
+         DKind == OMPD_target_teams_distribute_parallel_for_simd;
 }
 
 bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
@@ -735,8 +746,8 @@ bool clang::isOpenMPWorksharingDirective
          DKind == OMPD_target_parallel_for_simd ||
          DKind == OMPD_teams_distribute_parallel_for_simd ||
          DKind == OMPD_teams_distribute_parallel_for ||
-         DKind == OMPD_target_teams_distribute_parallel_for;
-  // TODO add next directives.
+         DKind == OMPD_target_teams_distribute_parallel_for ||
+         DKind == OMPD_target_teams_distribute_parallel_for_simd;
 }
 
 bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) {
@@ -752,8 +763,8 @@ bool clang::isOpenMPParallelDirective(Op
          DKind == OMPD_target_parallel_for_simd ||
          DKind == OMPD_teams_distribute_parallel_for ||
          DKind == OMPD_teams_distribute_parallel_for_simd ||
-         DKind == OMPD_target_teams_distribute_parallel_for;
-  // TODO add next directives.
+         DKind == OMPD_target_teams_distribute_parallel_for ||
+         DKind == OMPD_target_teams_distribute_parallel_for_simd;
 }
 
 bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
@@ -761,7 +772,8 @@ bool clang::isOpenMPTargetExecutionDirec
          DKind == OMPD_target_parallel_for || 
          DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
          DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
-         DKind == OMPD_target_teams_distribute_parallel_for;
+         DKind == OMPD_target_teams_distribute_parallel_for ||
+         DKind == OMPD_target_teams_distribute_parallel_for_simd;
 }
 
 bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
@@ -779,7 +791,8 @@ bool clang::isOpenMPNestingTeamsDirectiv
 bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
   return isOpenMPNestingTeamsDirective(DKind) ||
          DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
-         DKind == OMPD_target_teams_distribute_parallel_for;
+         DKind == OMPD_target_teams_distribute_parallel_for ||
+         DKind == OMPD_target_teams_distribute_parallel_for_simd;
 }
 
 bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
@@ -788,8 +801,8 @@ bool clang::isOpenMPSimdDirective(OpenMP
          DKind == OMPD_distribute_parallel_for_simd ||
          DKind == OMPD_distribute_simd || DKind == OMPD_target_simd ||
          DKind == OMPD_teams_distribute_simd ||
-         DKind == OMPD_teams_distribute_parallel_for_simd;
-  // TODO add next directives.
+         DKind == OMPD_teams_distribute_parallel_for_simd ||
+         DKind == OMPD_target_teams_distribute_parallel_for_simd;
 }
 
 bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
@@ -805,7 +818,8 @@ bool clang::isOpenMPDistributeDirective(
          Kind == OMPD_teams_distribute_parallel_for_simd ||
          Kind == OMPD_teams_distribute_parallel_for ||
          Kind == OMPD_target_teams_distribute ||
-         Kind == OMPD_target_teams_distribute_parallel_for;
+         Kind == OMPD_target_teams_distribute_parallel_for ||
+         Kind == OMPD_target_teams_distribute_parallel_for_simd;
 }
 
 bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
@@ -830,5 +844,6 @@ bool clang::isOpenMPLoopBoundSharingDire
          Kind == OMPD_teams_distribute_parallel_for_simd ||
          Kind == OMPD_teams_distribute_parallel_for ||
          Kind == OMPD_target_teams_distribute ||
-         Kind == OMPD_target_teams_distribute_parallel_for;
+         Kind == OMPD_target_teams_distribute_parallel_for ||
+         Kind == OMPD_target_teams_distribute_parallel_for_simd;
 }

Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
==============================================================================
--- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp	Wed Jan  4 22:11:23 2017	(r311317)
@@ -20,53 +20,64 @@
 using namespace clang;
 using namespace CodeGen;
 
-/// \brief Get the GPU warp size.
-llvm::Value *CGOpenMPRuntimeNVPTX::getNVPTXWarpSize(CodeGenFunction &CGF) {
+namespace {
+enum OpenMPRTLFunctionNVPTX {
+  /// \brief Call to void __kmpc_kernel_init(kmp_int32 omp_handle,
+  /// kmp_int32 thread_limit);
+  OMPRTL_NVPTX__kmpc_kernel_init,
+};
+
+// NVPTX Address space
+enum AddressSpace {
+  AddressSpaceShared = 3,
+};
+} // namespace
+
+/// Get the GPU warp size.
+static llvm::Value *getNVPTXWarpSize(CodeGenFunction &CGF) {
   CGBuilderTy &Bld = CGF.Builder;
   return Bld.CreateCall(
       llvm::Intrinsic::getDeclaration(
-          &CGM.getModule(), llvm::Intrinsic::nvvm_read_ptx_sreg_warpsize),
+          &CGF.CGM.getModule(), llvm::Intrinsic::nvvm_read_ptx_sreg_warpsize),
       llvm::None, "nvptx_warp_size");
 }
 
-/// \brief Get the id of the current thread on the GPU.
-llvm::Value *CGOpenMPRuntimeNVPTX::getNVPTXThreadID(CodeGenFunction &CGF) {
+/// Get the id of the current thread on the GPU.
+static llvm::Value *getNVPTXThreadID(CodeGenFunction &CGF) {
   CGBuilderTy &Bld = CGF.Builder;
   return Bld.CreateCall(
       llvm::Intrinsic::getDeclaration(
-          &CGM.getModule(), llvm::Intrinsic::nvvm_read_ptx_sreg_tid_x),
+          &CGF.CGM.getModule(), llvm::Intrinsic::nvvm_read_ptx_sreg_tid_x),
       llvm::None, "nvptx_tid");
 }
 
-// \brief Get the maximum number of threads in a block of the GPU.
-llvm::Value *CGOpenMPRuntimeNVPTX::getNVPTXNumThreads(CodeGenFunction &CGF) {
+/// Get the maximum number of threads in a block of the GPU.
+static llvm::Value *getNVPTXNumThreads(CodeGenFunction &CGF) {
   CGBuilderTy &Bld = CGF.Builder;
   return Bld.CreateCall(
       llvm::Intrinsic::getDeclaration(
-          &CGM.getModule(), llvm::Intrinsic::nvvm_read_ptx_sreg_ntid_x),
+          &CGF.CGM.getModule(), llvm::Intrinsic::nvvm_read_ptx_sreg_ntid_x),
       llvm::None, "nvptx_num_threads");
 }
 
-/// \brief Get barrier to synchronize all threads in a block.
-void CGOpenMPRuntimeNVPTX::getNVPTXCTABarrier(CodeGenFunction &CGF) {
+/// Get barrier to synchronize all threads in a block.
+static void getNVPTXCTABarrier(CodeGenFunction &CGF) {
   CGBuilderTy &Bld = CGF.Builder;
   Bld.CreateCall(llvm::Intrinsic::getDeclaration(
-      &CGM.getModule(), llvm::Intrinsic::nvvm_barrier0));
+      &CGF.CGM.getModule(), llvm::Intrinsic::nvvm_barrier0));
 }
 
-// \brief Synchronize all GPU threads in a block.
-void CGOpenMPRuntimeNVPTX::syncCTAThreads(CodeGenFunction &CGF) {
-  getNVPTXCTABarrier(CGF);
-}
+/// Synchronize all GPU threads in a block.
+static void syncCTAThreads(CodeGenFunction &CGF) { getNVPTXCTABarrier(CGF); }
 
-/// \brief Get the thread id of the OMP master thread.
+/// Get the thread id of the OMP master thread.
 /// The master thread id is the first thread (lane) of the last warp in the
 /// GPU block.  Warp size is assumed to be some power of 2.
 /// Thread id is 0 indexed.
 /// E.g: If NumThreads is 33, master id is 32.
 ///      If NumThreads is 64, master id is 32.
 ///      If NumThreads is 1024, master id is 992.
-llvm::Value *CGOpenMPRuntimeNVPTX::getMasterThreadID(CodeGenFunction &CGF) {
+static llvm::Value *getMasterThreadID(CodeGenFunction &CGF) {
   CGBuilderTy &Bld = CGF.Builder;
   llvm::Value *NumThreads = getNVPTXNumThreads(CGF);
 
@@ -77,19 +88,6 @@ llvm::Value *CGOpenMPRuntimeNVPTX::getMa
                        Bld.CreateNot(Mask), "master_tid");
 }
 
-namespace {
-enum OpenMPRTLFunctionNVPTX {
-  /// \brief Call to void __kmpc_kernel_init(kmp_int32 omp_handle,
-  /// kmp_int32 thread_limit);
-  OMPRTL_NVPTX__kmpc_kernel_init,
-};
-
-// NVPTX Address space
-enum ADDRESS_SPACE {
-  ADDRESS_SPACE_SHARED = 3,
-};
-} // namespace
-
 CGOpenMPRuntimeNVPTX::WorkerFunctionState::WorkerFunctionState(
     CodeGenModule &CGM)
     : WorkerFn(nullptr), CGFI(nullptr) {
@@ -119,14 +117,14 @@ void CGOpenMPRuntimeNVPTX::initializeEnv
       CGM.getModule(), CGM.Int32Ty, /*isConstant=*/false,
       llvm::GlobalValue::CommonLinkage,
       llvm::Constant::getNullValue(CGM.Int32Ty), "__omp_num_threads", 0,
-      llvm::GlobalVariable::NotThreadLocal, ADDRESS_SPACE_SHARED);
+      llvm::GlobalVariable::NotThreadLocal, AddressSpaceShared);
   ActiveWorkers->setAlignment(DL.getPrefTypeAlignment(CGM.Int32Ty));
 
   WorkID = new llvm::GlobalVariable(
       CGM.getModule(), CGM.Int64Ty, /*isConstant=*/false,
       llvm::GlobalValue::CommonLinkage,
       llvm::Constant::getNullValue(CGM.Int64Ty), "__tgt_work_id", 0,
-      llvm::GlobalVariable::NotThreadLocal, ADDRESS_SPACE_SHARED);
+      llvm::GlobalVariable::NotThreadLocal, AddressSpaceShared);
   WorkID->setAlignment(DL.getPrefTypeAlignment(CGM.Int64Ty));
 }
 

Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.h
==============================================================================
--- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.h	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.h	Wed Jan  4 22:11:23 2017	(r311317)
@@ -50,38 +50,6 @@ public:
 
 private:
   //
-  // NVPTX calls.
-  //
-
-  /// \brief Get the GPU warp size.
-  llvm::Value *getNVPTXWarpSize(CodeGenFunction &CGF);
-
-  /// \brief Get the id of the current thread on the GPU.
-  llvm::Value *getNVPTXThreadID(CodeGenFunction &CGF);
-
-  // \brief Get the maximum number of threads in a block of the GPU.
-  llvm::Value *getNVPTXNumThreads(CodeGenFunction &CGF);
-
-  /// \brief Get barrier to synchronize all threads in a block.
-  void getNVPTXCTABarrier(CodeGenFunction &CGF);
-
-  // \brief Synchronize all GPU threads in a block.
-  void syncCTAThreads(CodeGenFunction &CGF);
-
-  //
-  // OMP calls.
-  //
-
-  /// \brief Get the thread id of the OMP master thread.
-  /// The master thread id is the first thread (lane) of the last warp in the
-  /// GPU block.  Warp size is assumed to be some power of 2.
-  /// Thread id is 0 indexed.
-  /// E.g: If NumThreads is 33, master id is 32.
-  ///      If NumThreads is 64, master id is 32.
-  ///      If NumThreads is 1024, master id is 992.
-  llvm::Value *getMasterThreadID(CodeGenFunction &CGF);
-
-  //
   // Private state and methods.
   //
 

Modified: vendor/clang/dist/lib/CodeGen/CGStmt.cpp
==============================================================================
--- vendor/clang/dist/lib/CodeGen/CGStmt.cpp	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/lib/CodeGen/CGStmt.cpp	Wed Jan  4 22:11:23 2017	(r311317)
@@ -326,6 +326,10 @@ void CodeGenFunction::EmitStmt(const Stm
     EmitOMPTargetTeamsDistributeParallelForDirective(
         cast<OMPTargetTeamsDistributeParallelForDirective>(*S));
     break;
+  case Stmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass:
+    EmitOMPTargetTeamsDistributeParallelForSimdDirective(
+        cast<OMPTargetTeamsDistributeParallelForSimdDirective>(*S));
+    break;
   }
 }
 

Modified: vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp
==============================================================================
--- vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp	Wed Jan  4 22:11:23 2017	(r311317)
@@ -2032,6 +2032,16 @@ void CodeGenFunction::EmitOMPTargetTeams
       });
 }
 
+void CodeGenFunction::EmitOMPTargetTeamsDistributeParallelForSimdDirective(
+    const OMPTargetTeamsDistributeParallelForSimdDirective &S) {
+  CGM.getOpenMPRuntime().emitInlinedDirective(
+      *this, OMPD_target_teams_distribute_parallel_for_simd,
+      [&S](CodeGenFunction &CGF, PrePostActionTy &) {
+        CGF.EmitStmt(
+            cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+      });
+}
+
 /// \brief Emit a helper variable and return corresponding lvalue.
 static LValue EmitOMPHelperVar(CodeGenFunction &CGF,
                                const DeclRefExpr *Helper) {
@@ -2760,6 +2770,7 @@ void CodeGenFunction::EmitOMPDistributeL
 
   auto &RT = CGM.getOpenMPRuntime();
 
+  bool HasLastprivateClause = false;
   // Check pre-condition.
   {
     OMPLoopScope PreInitScope(*this, S);
@@ -2793,6 +2804,16 @@ void CodeGenFunction::EmitOMPDistributeL
           EmitOMPHelperVar(*this, cast<DeclRefExpr>(S.getIsLastIterVariable()));
 
       OMPPrivateScope LoopScope(*this);
+      if (EmitOMPFirstprivateClause(S, LoopScope)) {
+        // Emit implicit barrier to synchronize threads and avoid data races on
+        // initialization of firstprivate variables and post-update of
+        // lastprivate variables.
+        CGM.getOpenMPRuntime().emitBarrierCall(
+          *this, S.getLocStart(), OMPD_unknown, /*EmitChecks=*/false,
+          /*ForceSimpleCall=*/true);
+      }
+      EmitOMPPrivateClause(S, LoopScope);
+      HasLastprivateClause = EmitOMPLastprivateClauseInit(S, LoopScope);
       EmitOMPPrivateLoopCounters(S, LoopScope);
       (void)LoopScope.Privatize();
 
@@ -2849,6 +2870,13 @@ void CodeGenFunction::EmitOMPDistributeL
                             LB.getAddress(), UB.getAddress(), ST.getAddress(),
                             IL.getAddress(), Chunk);
       }
+
+      // Emit final copy of the lastprivate variables if IsLastIter != 0.
+      if (HasLastprivateClause)
+        EmitOMPLastprivateClauseFinal(
+            S, /*NoFinals=*/false,
+            Builder.CreateIsNotNull(
+                EmitLoadOfScalar(IL, S.getLocStart())));
     }
 
     // We're now done with the loop, so jump to the continuation block.

Modified: vendor/clang/dist/lib/CodeGen/CodeGenFunction.cpp
==============================================================================
--- vendor/clang/dist/lib/CodeGen/CodeGenFunction.cpp	Wed Jan  4 22:11:18 2017	(r311316)
+++ vendor/clang/dist/lib/CodeGen/CodeGenFunction.cpp	Wed Jan  4 22:11:23 2017	(r311317)
@@ -1049,6 +1049,19 @@ QualType CodeGenFunction::BuildFunctionA
   return ResTy;
 }
 
+static bool
+shouldUseUndefinedBehaviorReturnOptimization(const FunctionDecl *FD,
+                                             const ASTContext &Context) {
+  QualType T = FD->getReturnType();
+  // Avoid the optimization for functions that return a record type with a
+  // trivial destructor or another trivially copyable type.
+  if (const RecordType *RT = T.getCanonicalType()->getAs<RecordType>()) {
+    if (const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl()))
+      return !ClassDecl->hasTrivialDestructor();
+  }
+  return !T.isTriviallyCopyableType(Context);
+}
+
 void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
                                    const CGFunctionInfo &FnInfo) {
   const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl());

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list