Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Dec 2017 12:46:48 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r326462 - in vendor/clang/dist: bindings/python/clang bindings/python/tests bindings/python/tests/cindex include/clang/Basic lib/AST lib/Basic lib/CodeGen lib/Driver lib/Driver/ToolChai...
Message-ID:  <201712021246.vB2CkmBe050556@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sat Dec  2 12:46:48 2017
New Revision: 326462
URL: https://svnweb.freebsd.org/changeset/base/326462

Log:
  Vendor import of clang release_50 branch r319231:
  https://llvm.org/svn/llvm-project/cfe/branches/release_50@319231

Added:
  vendor/clang/dist/bindings/python/tests/cindex/test_exception_specification_kind.py   (contents, props changed)
  vendor/clang/dist/test/CodeGen/tbaa-vec.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/cancel_codegen_cleanup.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/task_codegen.c   (contents, props changed)
Deleted:
  vendor/clang/dist/bindings/python/tests/test_exception_specification_kind.py
Modified:
  vendor/clang/dist/bindings/python/clang/cindex.py
  vendor/clang/dist/bindings/python/tests/cindex/test_diagnostics.py
  vendor/clang/dist/include/clang/Basic/Attr.td
  vendor/clang/dist/include/clang/Basic/AttrDocs.td
  vendor/clang/dist/include/clang/Basic/BuiltinsX86.def
  vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td
  vendor/clang/dist/lib/AST/ExprConstant.cpp
  vendor/clang/dist/lib/Basic/Targets.cpp
  vendor/clang/dist/lib/Basic/Version.cpp
  vendor/clang/dist/lib/CodeGen/CGExpr.cpp
  vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp
  vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h
  vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp
  vendor/clang/dist/lib/CodeGen/CodeGenFunction.h
  vendor/clang/dist/lib/Driver/ToolChain.cpp
  vendor/clang/dist/lib/Driver/ToolChains/BareMetal.cpp
  vendor/clang/dist/lib/Driver/ToolChains/BareMetal.h
  vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp
  vendor/clang/dist/lib/Format/Format.cpp
  vendor/clang/dist/lib/Headers/avx512fintrin.h
  vendor/clang/dist/lib/Sema/SemaOpenMP.cpp
  vendor/clang/dist/test/CodeGen/avx512f-builtins.c
  vendor/clang/dist/test/Driver/baremetal.cpp
  vendor/clang/dist/test/OpenMP/declare_reduction_codegen.cpp
  vendor/clang/dist/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/distribute_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/for_codegen.cpp
  vendor/clang/dist/test/OpenMP/for_linear_codegen.cpp
  vendor/clang/dist/test/OpenMP/for_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/for_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/ordered_messages.cpp
  vendor/clang/dist/test/OpenMP/parallel_for_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/parallel_for_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/parallel_reduction_codegen.cpp
  vendor/clang/dist/test/OpenMP/simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/target_parallel_for_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/target_parallel_for_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/target_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/target_teams_distribute_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/taskloop_codegen.cpp
  vendor/clang/dist/test/OpenMP/taskloop_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/taskloop_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/teams_distribute_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/teams_distribute_parallel_for_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/teams_distribute_simd_loop_messages.cpp
  vendor/clang/dist/test/Preprocessor/predefined-arch-macros.c
  vendor/clang/dist/test/Sema/attr-selectany.c
  vendor/clang/dist/test/SemaCXX/attr-selectany.cpp
  vendor/clang/dist/tools/clang-format/clang-format.py

Modified: vendor/clang/dist/bindings/python/clang/cindex.py
==============================================================================
--- vendor/clang/dist/bindings/python/clang/cindex.py	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/bindings/python/clang/cindex.py	Sat Dec  2 12:46:48 2017	(r326462)
@@ -207,7 +207,7 @@ class _CXString(Structure):
         conf.lib.clang_disposeString(self)
 
     @staticmethod
-    def from_result(res, fn, args):
+    def from_result(res, fn=None, args=None):
         assert isinstance(res, _CXString)
         return conf.lib.clang_getCString(res)
 
@@ -459,9 +459,8 @@ class Diagnostic(object):
         """The command-line option that disables this diagnostic."""
         disable = _CXString()
         conf.lib.clang_getDiagnosticOption(self, byref(disable))
+        return _CXString.from_result(disable)
 
-        return conf.lib.clang_getCString(disable)
-
     def format(self, options=None):
         """
         Format this diagnostic for display. The options argument takes
@@ -473,8 +472,7 @@ class Diagnostic(object):
             options = conf.lib.clang_defaultDiagnosticDisplayOptions()
         if options & ~Diagnostic._FormatOptionsMask:
             raise ValueError('Invalid format options')
-        formatted = conf.lib.clang_formatDiagnostic(self, options)
-        return conf.lib.clang_getCString(formatted)
+        return conf.lib.clang_formatDiagnostic(self, options)
 
     def __repr__(self):
         return "<Diagnostic severity %r, location %r, spelling %r>" % (

Modified: vendor/clang/dist/bindings/python/tests/cindex/test_diagnostics.py
==============================================================================
--- vendor/clang/dist/bindings/python/tests/cindex/test_diagnostics.py	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/bindings/python/tests/cindex/test_diagnostics.py	Sat Dec  2 12:46:48 2017	(r326462)
@@ -92,3 +92,11 @@ def test_diagnostic_children():
     assert children[0].spelling.endswith('declared here')
     assert children[0].location.line == 1
     assert children[0].location.column == 1
+
+def test_diagnostic_string_repr():
+    tu = get_tu('struct MissingSemicolon{}')
+    assert len(tu.diagnostics) == 1
+    d = tu.diagnostics[0]
+
+    assert repr(d) == '<Diagnostic severity 3, location <SourceLocation file \'t.c\', line 1, column 26>, spelling "expected \';\' after struct">'
+    

Added: vendor/clang/dist/bindings/python/tests/cindex/test_exception_specification_kind.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/clang/dist/bindings/python/tests/cindex/test_exception_specification_kind.py	Sat Dec  2 12:46:48 2017	(r326462)
@@ -0,0 +1,27 @@
+import clang.cindex
+from clang.cindex import ExceptionSpecificationKind
+from .util import get_tu
+
+
+def find_function_declarations(node, declarations=[]):
+    if node.kind == clang.cindex.CursorKind.FUNCTION_DECL:
+        declarations.append((node.spelling, node.exception_specification_kind))
+    for child in node.get_children():
+        declarations = find_function_declarations(child, declarations)
+    return declarations
+
+
+def test_exception_specification_kind():
+    source = """int square1(int x);
+                int square2(int x) noexcept;
+                int square3(int x) noexcept(noexcept(x * x));"""
+
+    tu = get_tu(source, lang='cpp', flags=['-std=c++14'])
+
+    declarations = find_function_declarations(tu.cursor)
+    expected = [
+        ('square1', ExceptionSpecificationKind.NONE),
+        ('square2', ExceptionSpecificationKind.BASIC_NOEXCEPT),
+        ('square3', ExceptionSpecificationKind.COMPUTED_NOEXCEPT)
+    ]
+    assert declarations == expected

Modified: vendor/clang/dist/include/clang/Basic/Attr.td
==============================================================================
--- vendor/clang/dist/include/clang/Basic/Attr.td	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/include/clang/Basic/Attr.td	Sat Dec  2 12:46:48 2017	(r326462)
@@ -2459,9 +2459,9 @@ def DLLImport : InheritableAttr, TargetSpecificAttr<Ta
   let Documentation = [DLLImportDocs];
 }
 
-def SelectAny : InheritableAttr, TargetSpecificAttr<TargetWindows> {
+def SelectAny : InheritableAttr {
   let Spellings = [Declspec<"selectany">, GCC<"selectany">];
-  let Documentation = [Undocumented];
+  let Documentation = [SelectAnyDocs];
 }
 
 def Thread : Attr {

Modified: vendor/clang/dist/include/clang/Basic/AttrDocs.td
==============================================================================
--- vendor/clang/dist/include/clang/Basic/AttrDocs.td	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/include/clang/Basic/AttrDocs.td	Sat Dec  2 12:46:48 2017	(r326462)
@@ -3106,3 +3106,18 @@ This attribute can be added to an Objective-C ``@inter
 ensure that this class cannot be subclassed.
   }];
 }
+
+
+def SelectAnyDocs : Documentation {
+  let Category = DocCatType;
+  let Content = [{
+This attribute appertains to a global symbol, causing it to have a weak
+definition (
+`linkonce <https://llvm.org/docs/LangRef.html#linkage-types>`_
+), allowing the linker to select any definition.
+
+For more information see
+`gcc documentation <https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Microsoft-Windows-Variable-Attributes.html>`_
+or `msvc documentation <https://docs.microsoft.com/pl-pl/cpp/cpp/selectany>`_.
+}];
+}

Modified: vendor/clang/dist/include/clang/Basic/BuiltinsX86.def
==============================================================================
--- vendor/clang/dist/include/clang/Basic/BuiltinsX86.def	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/include/clang/Basic/BuiltinsX86.def	Sat Dec  2 12:46:48 2017	(r326462)
@@ -976,7 +976,6 @@ TARGET_BUILTIN(__builtin_ia32_pmuludq512, "V8LLiV16iV1
 TARGET_BUILTIN(__builtin_ia32_ptestmd512, "UsV16iV16iUs", "", "avx512f")
 TARGET_BUILTIN(__builtin_ia32_ptestmq512, "UcV8LLiV8LLiUc", "", "avx512f")
 TARGET_BUILTIN(__builtin_ia32_pbroadcastd512_gpr_mask, "V16iiV16iUs", "", "avx512f")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastq512_mem_mask, "V8LLiLLiV8LLiUc", "", "avx512f")
 TARGET_BUILTIN(__builtin_ia32_loaddqusi512_mask, "V16iiC*V16iUs", "", "avx512f")
 TARGET_BUILTIN(__builtin_ia32_loaddqudi512_mask, "V8LLiLLiC*V8LLiUc", "", "avx512f")
 TARGET_BUILTIN(__builtin_ia32_loadups512_mask, "V16ffC*V16fUs", "", "avx512f")

Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td
==============================================================================
--- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td	Sat Dec  2 12:46:48 2017	(r326462)
@@ -8830,7 +8830,7 @@ def err_omp_firstprivate_distribute_in_teams_reduction
 def err_omp_depend_clause_thread_simd : Error<
   "'depend' clauses cannot be mixed with '%0' clause">;
 def err_omp_depend_sink_expected_loop_iteration : Error<
-  "expected %0 loop iteration variable">;
+  "expected%select{| %1}0 loop iteration variable">;
 def err_omp_depend_sink_unexpected_expr : Error<
   "unexpected expression: number of expressions is larger than the number of associated loops">;
 def err_omp_depend_sink_expected_plus_minus : Error<

Modified: vendor/clang/dist/lib/AST/ExprConstant.cpp
==============================================================================
--- vendor/clang/dist/lib/AST/ExprConstant.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/AST/ExprConstant.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -537,7 +537,7 @@ namespace {
   /// rules.  For example, the RHS of (0 && foo()) is not evaluated.  We can
   /// evaluate the expression regardless of what the RHS is, but C only allows
   /// certain things in certain situations.
-  struct LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) EvalInfo {
+  struct EvalInfo {
     ASTContext &Ctx;
 
     /// EvalStatus - Contains information about the evaluation.
@@ -977,24 +977,22 @@ namespace {
   /// RAII object used to optionally suppress diagnostics and side-effects from
   /// a speculative evaluation.
   class SpeculativeEvaluationRAII {
-    /// Pair of EvalInfo, and a bit that stores whether or not we were
-    /// speculatively evaluating when we created this RAII.
-    llvm::PointerIntPair<EvalInfo *, 1, bool> InfoAndOldSpecEval;
-    Expr::EvalStatus Old;
+    EvalInfo *Info = nullptr;
+    Expr::EvalStatus OldStatus;
+    bool OldIsSpeculativelyEvaluating;
 
     void moveFromAndCancel(SpeculativeEvaluationRAII &&Other) {
-      InfoAndOldSpecEval = Other.InfoAndOldSpecEval;
-      Old = Other.Old;
-      Other.InfoAndOldSpecEval.setPointer(nullptr);
+      Info = Other.Info;
+      OldStatus = Other.OldStatus;
+      Other.Info = nullptr;
     }
 
     void maybeRestoreState() {
-      EvalInfo *Info = InfoAndOldSpecEval.getPointer();
       if (!Info)
         return;
 
-      Info->EvalStatus = Old;
-      Info->IsSpeculativelyEvaluating = InfoAndOldSpecEval.getInt();
+      Info->EvalStatus = OldStatus;
+      Info->IsSpeculativelyEvaluating = OldIsSpeculativelyEvaluating;
     }
 
   public:
@@ -1002,8 +1000,8 @@ namespace {
 
     SpeculativeEvaluationRAII(
         EvalInfo &Info, SmallVectorImpl<PartialDiagnosticAt> *NewDiag = nullptr)
-        : InfoAndOldSpecEval(&Info, Info.IsSpeculativelyEvaluating),
-          Old(Info.EvalStatus) {
+        : Info(&Info), OldStatus(Info.EvalStatus),
+          OldIsSpeculativelyEvaluating(Info.IsSpeculativelyEvaluating) {
       Info.EvalStatus.Diag = NewDiag;
       Info.IsSpeculativelyEvaluating = true;
     }

Modified: vendor/clang/dist/lib/Basic/Targets.cpp
==============================================================================
--- vendor/clang/dist/lib/Basic/Targets.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/Basic/Targets.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -2169,7 +2169,7 @@ class AMDGPUTargetInfo final : public TargetInfo {
 public:
   AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
     : TargetInfo(Triple) ,
-      GPU(isAMDGCN(Triple) ? GK_GFX6 : GK_R600),
+      GPU(isAMDGCN(Triple) ? GK_GFX6 : parseR600Name(Opts.CPU)),
       hasFP64(false),
       hasFMAF(false),
       hasLDEXPF(false),
@@ -2179,6 +2179,12 @@ class AMDGPUTargetInfo final : public TargetInfo {
       hasFMAF = true;
       hasLDEXPF = true;
     }
+    if (getTriple().getArch() == llvm::Triple::r600) {
+      if (GPU == GK_EVERGREEN_DOUBLE_OPS || GPU == GK_CAYMAN) {
+        hasFMAF = true;
+      }
+    }
+
     auto IsGenericZero = isGenericZero(Triple);
     resetDataLayout(getTriple().getArch() == llvm::Triple::amdgcn ?
                     (IsGenericZero ? DataLayoutStringSIGenericIsZero :
@@ -9350,8 +9356,7 @@ class AVRTargetInfo : public TargetInfo { (public)
     WIntType = SignedInt;
     Char32Type = UnsignedLong;
     SigAtomicType = SignedChar;
-    resetDataLayout("e-p:16:16:16-i8:8:8-i16:16:16-i32:32:32-i64:64:64"
-		    "-f32:32:32-f64:64:64-n8");
+    resetDataLayout("e-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8");
   }
 
   void getTargetDefines(const LangOptions &Opts,

Modified: vendor/clang/dist/lib/Basic/Version.cpp
==============================================================================
--- vendor/clang/dist/lib/Basic/Version.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/Basic/Version.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -36,7 +36,7 @@ std::string getClangRepositoryPath() {
 
   // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us
   // pick up a tag in an SVN export, for example.
-  StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_500/final/lib/Basic/Version.cpp $");
+  StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_50/lib/Basic/Version.cpp $");
   if (URL.empty()) {
     URL = SVNRepository.slice(SVNRepository.find(':'),
                               SVNRepository.find("/lib/Basic"));

Modified: vendor/clang/dist/lib/CodeGen/CGExpr.cpp
==============================================================================
--- vendor/clang/dist/lib/CodeGen/CGExpr.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/CodeGen/CGExpr.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -3309,12 +3309,7 @@ static Address emitOMPArraySectionBase(CodeGenFunction
 
 LValue CodeGenFunction::EmitOMPArraySectionExpr(const OMPArraySectionExpr *E,
                                                 bool IsLowerBound) {
-  QualType BaseTy;
-  if (auto *ASE =
-          dyn_cast<OMPArraySectionExpr>(E->getBase()->IgnoreParenImpCasts()))
-    BaseTy = OMPArraySectionExpr::getBaseOriginalType(ASE);
-  else
-    BaseTy = E->getBase()->getType();
+  QualType BaseTy = OMPArraySectionExpr::getBaseOriginalType(E->getBase());
   QualType ResultExprTy;
   if (auto *AT = getContext().getAsArrayType(BaseTy))
     ResultExprTy = AT->getElementType();
@@ -3619,8 +3614,9 @@ LValue CodeGenFunction::EmitLValueForField(LValue base
     getFieldAlignmentSource(BaseInfo.getAlignmentSource());
   LValueBaseInfo FieldBaseInfo(fieldAlignSource, BaseInfo.getMayAlias());
 
+  QualType type = field->getType();
   const RecordDecl *rec = field->getParent();
-  if (rec->isUnion() || rec->hasAttr<MayAliasAttr>())
+  if (rec->isUnion() || rec->hasAttr<MayAliasAttr>() || type->isVectorType())
     FieldBaseInfo.setMayAlias(true);
   bool mayAlias = FieldBaseInfo.getMayAlias();
 
@@ -3645,7 +3641,6 @@ LValue CodeGenFunction::EmitLValueForField(LValue base
     return LValue::MakeBitfield(Addr, Info, fieldType, FieldBaseInfo);
   }
 
-  QualType type = field->getType();
   Address addr = base.getAddress();
   unsigned cvr = base.getVRQualifiers();
   bool TBAAPath = CGM.getCodeGenOpts().StructPathTBAA;

Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp
==============================================================================
--- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -264,6 +264,13 @@ class CGOpenMPInlinedRegionInfo : public CGOpenMPRegio
     return nullptr;
   }
 
+  /// \brief Get an LValue for the current ThreadID variable.
+  LValue getThreadIDVariableLValue(CodeGenFunction &CGF) override {
+    if (OuterRegionInfo)
+      return OuterRegionInfo->getThreadIDVariableLValue(CGF);
+    llvm_unreachable("No LValue for inlined OpenMP construct");
+  }
+
   /// \brief Get the name of the capture helper.
   StringRef getHelperName() const override {
     if (auto *OuterRegionInfo = getOldCSI())
@@ -771,7 +778,8 @@ static void emitInitWithReductionInitializer(CodeGenFu
 /// \param Init Initial expression of array.
 /// \param SrcAddr Address of the original array.
 static void EmitOMPAggregateInit(CodeGenFunction &CGF, Address DestAddr,
-                                 QualType Type, const Expr *Init,
+                                 QualType Type, bool EmitDeclareReductionInit,
+                                 const Expr *Init,
                                  const OMPDeclareReductionDecl *DRD,
                                  Address SrcAddr = Address::invalid()) {
   // Perform element-by-element initialization.
@@ -825,7 +833,7 @@ static void EmitOMPAggregateInit(CodeGenFunction &CGF,
   // Emit copy.
   {
     CodeGenFunction::RunCleanupsScope InitScope(CGF);
-    if (DRD && (DRD->getInitializer() || !Init)) {
+    if (EmitDeclareReductionInit) {
       emitInitWithReductionInitializer(CGF, DRD, Init, DestElementCurrent,
                                        SrcElementCurrent, ElementTy);
     } else
@@ -883,8 +891,12 @@ void ReductionCodeGen::emitAggregateInitialization(
   // captured region.
   auto *PrivateVD =
       cast<VarDecl>(cast<DeclRefExpr>(ClausesData[N].Private)->getDecl());
+  bool EmitDeclareReductionInit =
+      DRD && (DRD->getInitializer() || !PrivateVD->hasInit());
   EmitOMPAggregateInit(CGF, PrivateAddr, PrivateVD->getType(),
-                       DRD ? ClausesData[N].ReductionOp : PrivateVD->getInit(),
+                       EmitDeclareReductionInit,
+                       EmitDeclareReductionInit ? ClausesData[N].ReductionOp
+                                                : PrivateVD->getInit(),
                        DRD, SharedLVal.getAddress());
 }
 
@@ -4244,9 +4256,20 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFunction &CGF, So
   // Build type kmp_routine_entry_t (if not built yet).
   emitKmpRoutineEntryT(KmpInt32Ty);
   // Build type kmp_task_t (if not built yet).
-  if (KmpTaskTQTy.isNull()) {
-    KmpTaskTQTy = C.getRecordType(createKmpTaskTRecordDecl(
-        CGM, D.getDirectiveKind(), KmpInt32Ty, KmpRoutineEntryPtrQTy));
+  if (isOpenMPTaskLoopDirective(D.getDirectiveKind())) {
+    if (SavedKmpTaskloopTQTy.isNull()) {
+      SavedKmpTaskloopTQTy = C.getRecordType(createKmpTaskTRecordDecl(
+          CGM, D.getDirectiveKind(), KmpInt32Ty, KmpRoutineEntryPtrQTy));
+    }
+    KmpTaskTQTy = SavedKmpTaskloopTQTy;
+  } else if (D.getDirectiveKind() == OMPD_task) {
+    assert(D.getDirectiveKind() == OMPD_task &&
+           "Expected taskloop or task directive");
+    if (SavedKmpTaskTQTy.isNull()) {
+      SavedKmpTaskTQTy = C.getRecordType(createKmpTaskTRecordDecl(
+          CGM, D.getDirectiveKind(), KmpInt32Ty, KmpRoutineEntryPtrQTy));
+    }
+    KmpTaskTQTy = SavedKmpTaskTQTy;
   }
   auto *KmpTaskTQTyRD = cast<RecordDecl>(KmpTaskTQTy->getAsTagDecl());
   // Build particular struct kmp_task_t for the given task.

Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h
==============================================================================
--- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h	Sat Dec  2 12:46:48 2017	(r326462)
@@ -313,6 +313,10 @@ class CGOpenMPRuntime { (private)
   ///    deconstructors of firstprivate C++ objects */
   /// } kmp_task_t;
   QualType KmpTaskTQTy;
+  /// Saved kmp_task_t for task directive.
+  QualType SavedKmpTaskTQTy;
+  /// Saved kmp_task_t for taskloop-based directive.
+  QualType SavedKmpTaskloopTQTy;
   /// \brief Type typedef struct kmp_depend_info {
   ///    kmp_intptr_t               base_addr;
   ///    size_t                     len;

Modified: vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp
==============================================================================
--- vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -1210,12 +1210,14 @@ void CodeGenFunction::EmitOMPInnerLoop(
   EmitBlock(LoopExit.getBlock());
 }
 
-void CodeGenFunction::EmitOMPLinearClauseInit(const OMPLoopDirective &D) {
+bool CodeGenFunction::EmitOMPLinearClauseInit(const OMPLoopDirective &D) {
   if (!HaveInsertPoint())
-    return;
+    return false;
   // Emit inits for the linear variables.
+  bool HasLinears = false;
   for (const auto *C : D.getClausesOfKind<OMPLinearClause>()) {
     for (auto *Init : C->inits()) {
+      HasLinears = true;
       auto *VD = cast<VarDecl>(cast<DeclRefExpr>(Init)->getDecl());
       if (auto *Ref = dyn_cast<DeclRefExpr>(VD->getInit()->IgnoreImpCasts())) {
         AutoVarEmission Emission = EmitAutoVarAlloca(*VD);
@@ -1240,6 +1242,7 @@ void CodeGenFunction::EmitOMPLinearClauseInit(const OM
         EmitIgnoredExpr(CS);
       }
   }
+  return HasLinears;
 }
 
 void CodeGenFunction::EmitOMPLinearClauseFinal(
@@ -1529,7 +1532,7 @@ void CodeGenFunction::EmitOMPSimdDirective(const OMPSi
     CGF.EmitOMPSimdInit(S);
 
     emitAlignedClause(CGF, S);
-    CGF.EmitOMPLinearClauseInit(S);
+    (void)CGF.EmitOMPLinearClauseInit(S);
     {
       OMPPrivateScope LoopScope(CGF);
       CGF.EmitOMPPrivateLoopCounters(S, LoopScope);
@@ -2147,7 +2150,7 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(
 
     llvm::DenseSet<const Expr *> EmittedFinals;
     emitAlignedClause(*this, S);
-    EmitOMPLinearClauseInit(S);
+    bool HasLinears = EmitOMPLinearClauseInit(S);
     // Emit helper vars inits.
 
     std::pair<LValue, LValue> Bounds = CodeGenLoopBounds(*this, S);
@@ -2161,7 +2164,7 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(
     // Emit 'then' code.
     {
       OMPPrivateScope LoopScope(*this);
-      if (EmitOMPFirstprivateClause(S, LoopScope)) {
+      if (EmitOMPFirstprivateClause(S, LoopScope) || HasLinears) {
         // Emit implicit barrier to synchronize threads and avoid data races on
         // initialization of firstprivate variables and post-update of
         // lastprivate variables.

Modified: vendor/clang/dist/lib/CodeGen/CodeGenFunction.h
==============================================================================
--- vendor/clang/dist/lib/CodeGen/CodeGenFunction.h	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/CodeGen/CodeGenFunction.h	Sat Dec  2 12:46:48 2017	(r326462)
@@ -1116,7 +1116,7 @@ class CodeGenFunction : public CodeGenTypeCache { (pri
         auto IP = CGF.Builder.saveAndClearIP();
         CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
         CodeGen(CGF);
-        CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
+        CGF.EmitBranch(Stack.back().ContBlock.getBlock());
         CGF.Builder.restoreIP(IP);
         Stack.back().HasBeenEmitted = true;
       }
@@ -2761,7 +2761,9 @@ class CodeGenFunction : public CodeGenTypeCache { (pri
   /// and initializes them with the values according to OpenMP standard.
   ///
   /// \param D Directive (possibly) with the 'linear' clause.
-  void EmitOMPLinearClauseInit(const OMPLoopDirective &D);
+  /// \return true if at least one linear variable is found that should be
+  /// initialized with the value of the original variable, false otherwise.
+  bool EmitOMPLinearClauseInit(const OMPLoopDirective &D);
 
   typedef const llvm::function_ref<void(CodeGenFunction & /*CGF*/,
                                         llvm::Value * /*OutlinedFn*/,

Modified: vendor/clang/dist/lib/Driver/ToolChain.cpp
==============================================================================
--- vendor/clang/dist/lib/Driver/ToolChain.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/Driver/ToolChain.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -74,11 +74,6 @@ ToolChain::ToolChain(const Driver &D, const llvm::Trip
     : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
       CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)),
       EffectiveTriple() {
-  if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
-    if (!isThreadModelSupported(A->getValue()))
-      D.Diag(diag::err_drv_invalid_thread_model_for_target)
-          << A->getValue() << A->getAsString(Args);
-
   std::string CandidateLibPath = getArchSpecificLibPath();
   if (getVFS().exists(CandidateLibPath))
     getFilePaths().push_back(CandidateLibPath);

Modified: vendor/clang/dist/lib/Driver/ToolChains/BareMetal.cpp
==============================================================================
--- vendor/clang/dist/lib/Driver/ToolChains/BareMetal.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/Driver/ToolChains/BareMetal.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -65,14 +65,6 @@ Tool *BareMetal::buildLinker() const {
   return new tools::baremetal::Linker(*this);
 }
 
-std::string BareMetal::getThreadModel() const {
-  return "single";
-}
-
-bool BareMetal::isThreadModelSupported(const StringRef Model) const {
-  return Model == "single";
-}
-
 std::string BareMetal::getRuntimesDir() const {
   SmallString<128> Dir(getDriver().ResourceDir);
   llvm::sys::path::append(Dir, "lib", "baremetal");

Modified: vendor/clang/dist/lib/Driver/ToolChains/BareMetal.h
==============================================================================
--- vendor/clang/dist/lib/Driver/ToolChains/BareMetal.h	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/Driver/ToolChains/BareMetal.h	Sat Dec  2 12:46:48 2017	(r326462)
@@ -38,8 +38,6 @@ class LLVM_LIBRARY_VISIBILITY BareMetal : public ToolC
   bool isPICDefaultForced() const override { return false; }
   bool SupportsProfiling() const override { return false; }
   bool SupportsObjCGC() const override { return false; }
-  std::string getThreadModel() const override;
-  bool isThreadModelSupported(const StringRef Model) const override;
 
   RuntimeLibType GetDefaultRuntimeLibType() const override {
     return ToolChain::RLT_CompilerRT;

Modified: vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp
==============================================================================
--- vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -2227,8 +2227,12 @@ void Clang::ConstructJob(Compilation &C, const JobActi
   }
 
   CmdArgs.push_back("-mthread-model");
-  if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
+  if (Arg *A = Args.getLastArg(options::OPT_mthread_model)) {
+    if (!getToolChain().isThreadModelSupported(A->getValue()))
+      D.Diag(diag::err_drv_invalid_thread_model_for_target)
+          << A->getValue() << A->getAsString(Args);
     CmdArgs.push_back(A->getValue());
+  }
   else
     CmdArgs.push_back(Args.MakeArgString(getToolChain().getThreadModel()));
 

Modified: vendor/clang/dist/lib/Format/Format.cpp
==============================================================================
--- vendor/clang/dist/lib/Format/Format.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/Format/Format.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -506,7 +506,7 @@ static FormatStyle expandPresets(const FormatStyle &St
     Expanded.BraceWrapping.AfterFunction = true;
     Expanded.BraceWrapping.AfterStruct = true;
     Expanded.BraceWrapping.AfterUnion = true;
-    Expanded.BraceWrapping.SplitEmptyFunction = false;
+    Expanded.BraceWrapping.SplitEmptyFunction = true;
     Expanded.BraceWrapping.SplitEmptyRecord = false;
     break;
   case FormatStyle::BS_Stroustrup:

Modified: vendor/clang/dist/lib/Headers/avx512fintrin.h
==============================================================================
--- vendor/clang/dist/lib/Headers/avx512fintrin.h	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/Headers/avx512fintrin.h	Sat Dec  2 12:46:48 2017	(r326462)
@@ -267,21 +267,16 @@ _mm512_maskz_set1_epi32(__mmask16 __M, int __A)
                  __M);
 }
 
+#ifdef __x86_64__
 static __inline __m512i __DEFAULT_FN_ATTRS
 _mm512_maskz_set1_epi64(__mmask8 __M, long long __A)
 {
-#ifdef __x86_64__
   return (__m512i) __builtin_ia32_pbroadcastq512_gpr_mask (__A,
                  (__v8di)
                  _mm512_setzero_si512 (),
                  __M);
-#else
-  return (__m512i) __builtin_ia32_pbroadcastq512_mem_mask (__A,
-                 (__v8di)
-                 _mm512_setzero_si512 (),
-                 __M);
-#endif
 }
+#endif
 
 static __inline __m512 __DEFAULT_FN_ATTRS
 _mm512_setzero_ps(void)

Modified: vendor/clang/dist/lib/Sema/SemaOpenMP.cpp
==============================================================================
--- vendor/clang/dist/lib/Sema/SemaOpenMP.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/lib/Sema/SemaOpenMP.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -3111,8 +3111,8 @@ bool OpenMPIterationSpaceChecker::SetStep(Expr *NewSte
   if (!NewStep->isValueDependent()) {
     // Check that the step is integer expression.
     SourceLocation StepLoc = NewStep->getLocStart();
-    ExprResult Val =
-        SemaRef.PerformOpenMPImplicitIntegerConversion(StepLoc, NewStep);
+    ExprResult Val = SemaRef.PerformOpenMPImplicitIntegerConversion(
+        StepLoc, getExprAsWritten(NewStep));
     if (Val.isInvalid())
       return true;
     NewStep = Val.get();
@@ -8858,7 +8858,8 @@ buildDeclareReductionRef(Sema &SemaRef, SourceLocation
       PrevD = D;
     }
   }
-  if (Ty->isDependentType() || Ty->isInstantiationDependentType() ||
+  if (SemaRef.CurContext->isDependentContext() || Ty->isDependentType() ||
+      Ty->isInstantiationDependentType() ||
       Ty->containsUnexpandedParameterPack() ||
       filterLookupForUDR<bool>(Lookups, [](ValueDecl *D) -> bool {
         return !D->isInvalidDecl() &&
@@ -10226,9 +10227,14 @@ Sema::ActOnOpenMPDependClause(OpenMPDependClauseKind D
         if (!CurContext->isDependentContext() &&
             DSAStack->getParentOrderedRegionParam() &&
             DepCounter != DSAStack->isParentLoopControlVariable(D).first) {
-          Diag(ELoc, diag::err_omp_depend_sink_expected_loop_iteration)
-              << DSAStack->getParentLoopControlVariable(
-                     DepCounter.getZExtValue());
+          ValueDecl* VD = DSAStack->getParentLoopControlVariable(
+              DepCounter.getZExtValue());
+          if (VD) {
+            Diag(ELoc, diag::err_omp_depend_sink_expected_loop_iteration)
+                << 1 << VD;
+          } else {
+             Diag(ELoc, diag::err_omp_depend_sink_expected_loop_iteration) << 0;
+          }
           continue;
         }
         OpsOffs.push_back({RHS, OOK});
@@ -10258,8 +10264,9 @@ Sema::ActOnOpenMPDependClause(OpenMPDependClauseKind D
 
     if (!CurContext->isDependentContext() && DepKind == OMPC_DEPEND_sink &&
         TotalDepCount > VarList.size() &&
-        DSAStack->getParentOrderedRegionParam()) {
-      Diag(EndLoc, diag::err_omp_depend_sink_expected_loop_iteration)
+        DSAStack->getParentOrderedRegionParam() &&
+        DSAStack->getParentLoopControlVariable(VarList.size() + 1)) {
+      Diag(EndLoc, diag::err_omp_depend_sink_expected_loop_iteration) << 1
           << DSAStack->getParentLoopControlVariable(VarList.size() + 1);
     }
     if (DepKind != OMPC_DEPEND_source && DepKind != OMPC_DEPEND_sink &&

Modified: vendor/clang/dist/test/CodeGen/avx512f-builtins.c
==============================================================================
--- vendor/clang/dist/test/CodeGen/avx512f-builtins.c	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/CodeGen/avx512f-builtins.c	Sat Dec  2 12:46:48 2017	(r326462)
@@ -7929,6 +7929,13 @@ __m512i test_mm512_mask_set1_epi64 (__m512i __O, __mma
     //CHECK: @llvm.x86.avx512.mask.pbroadcast.q.gpr.512
   return _mm512_mask_set1_epi64 (__O, __M, __A);
 }
+
+__m512i test_mm512_maskz_set1_epi64 (__mmask8 __M, long long __A)
+{
+    //CHECK-LABEL: @test_mm512_maskz_set1_epi64
+    //CHECK: @llvm.x86.avx512.mask.pbroadcast.q.gpr.512
+  return _mm512_maskz_set1_epi64 (__M, __A);
+}
 #endif
 
 __m512i test_mm512_set_epi64 (long long __A, long long __B, long long __C,

Added: vendor/clang/dist/test/CodeGen/tbaa-vec.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/clang/dist/test/CodeGen/tbaa-vec.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -disable-llvm-passes %s -emit-llvm -o - | FileCheck %s
+// Test TBAA metadata generated by front-end (vector types are always treated as mayalias).
+
+typedef float __m128 __attribute__ ((__vector_size__ (16)));
+
+struct A {
+  __m128 a, b;
+};
+
+void foo(A *a, __m128 v) {
+  // CHECK-LABEL: define void @_Z3fooP1ADv4_f
+  a->a = v;
+  // CHECK: store <4 x float> %v, <4 x float>* %{{.*}}, align 16, !tbaa [[TAG_char:!.*]]
+  // CHECK: store <4 x float> %{{.*}}, <4 x float>* %{{.*}}, align 16, !tbaa [[TAG_char]]
+}
+
+// CHECK: [[TYPE_char:!.*]] = !{!"omnipotent char", [[TAG_cxx_tbaa:!.*]],
+// CHECK: [[TAG_cxx_tbaa]] = !{!"Simple C++ TBAA"}
+// CHECK: [[TAG_char]] = !{[[TYPE_char]], [[TYPE_char]], i64 0}
+

Modified: vendor/clang/dist/test/Driver/baremetal.cpp
==============================================================================
--- vendor/clang/dist/test/Driver/baremetal.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/Driver/baremetal.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -74,4 +74,12 @@
 
 // RUN: %clangxx -target arm-none-eabi -v 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-THREAD-MODEL
-// CHECK-THREAD-MODEL: Thread model: single
+// CHECK-THREAD-MODEL: Thread model: posix
+
+// RUN: %clangxx -target arm-none-eabi -mthread-model single -v 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-THREAD-MODEL-SINGLE
+// CHECK-THREAD-MODEL-SINGLE: Thread model: single
+
+// RUN: %clangxx -target arm-none-eabi -mthread-model posix -v 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-THREAD-MODEL-POSIX
+// CHECK-THREAD-MODEL-POSIX: Thread model: posix

Added: vendor/clang/dist/test/OpenMP/cancel_codegen_cleanup.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/clang/dist/test/OpenMP/cancel_codegen_cleanup.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s
+
+//CHECK: call i32 @__kmpc_cancel
+//CHECK: br {{.*}}label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
+//CHECK: [[EXIT]]:
+//CHECK: store i32 [[EXIT_SLOT:[0-9]+]]
+//CHECK: br label %[[CLEANUP:.+]]
+//CHECK: [[CONTINUE]]:
+//CHECK: store i32 [[CONT_SLOT:[0-9]+]],
+//CHECK: br label %[[CLEANUP]]
+//CHECK: [[CLEANUP]]:
+//CHECK-NEXT: call void @_ZN3ObjD1Ev
+//CHECK: switch i32{{.*}}, label %[[UNREACHABLE:.+]] [
+//CHECK:   i32 [[CONT_SLOT]], label %[[CLEANUPCONT:.+]]
+//CHECK:   i32 [[EXIT_SLOT]], label %[[CANCELEXIT:.+]]
+//CHECK-NEXT: ]
+//CHECK: [[CLEANUPCONT]]:
+//CHECK: br label %[[CANCELCONT:.+]]
+//CHECK: [[CANCELCONT]]:
+//CHECK-NEXT: call void @__kmpc_barrier(
+//CHECK-NEXT: ret void
+//CHECK: [[UNREACHABLE]]:
+//CHECK-NEXT: unreachable
+//CHECK-NEXT: }
+
+struct Obj {
+  int a; Obj(); Obj(const Obj& r) = delete; Obj &operator=(const Obj& r);
+  ~Obj();
+};
+ 
+void foo() {
+  int i,count = 0;
+  Obj obj;
+
+  #pragma omp parallel private(i) num_threads(1)
+  {
+      #pragma omp for reduction(+:count) lastprivate(obj)
+      for (i=0; i<1000; i++) {
+            if(i==100) {
+                obj.a = 100;
+                #pragma omp cancel for
+            }
+            count++;
+        }
+    }
+}

Modified: vendor/clang/dist/test/OpenMP/declare_reduction_codegen.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/declare_reduction_codegen.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/declare_reduction_codegen.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -9,6 +9,26 @@
 // CHECK: [[SSS_INT:.+]] = type { i32 }
 // CHECK-LOAD: [[SSS_INT:.+]] = type { i32 }
 
+// CHECK: add
+void add(short &out, short &in) {}
+
+#pragma omp declare reduction(my_add : short : add(omp_out, omp_in))
+
+// CHECK: define internal void @.
+// CHECK: call void @{{.+}}add{{.+}}(
+// CHECK: ret void
+
+// CHECK: foo_reduction_array
+void foo_reduction_array() {
+  short y[1];
+  // CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
+#pragma omp parallel for reduction(my_add : y)
+  for (int i = 0; i < 1; i++) {
+  }
+}
+
+// CHECK: define internal void @
+
 #pragma omp declare reduction(+ : int, char : omp_out *= omp_in)
 // CHECK: define internal {{.*}}void @{{[^(]+}}(i32* noalias, i32* noalias)
 // CHECK: [[MUL:%.+]] = mul nsw i32
@@ -92,6 +112,22 @@ T foo(T a) {
   return a;
 }
 
+struct Summary {
+  void merge(const Summary& other) {}
+};
+
+template <typename K>
+void work() {
+  Summary global_summary;
+#pragma omp declare reduction(+ : Summary : omp_out.merge(omp_in))
+#pragma omp parallel for reduction(+ : global_summary)
+  for (int k = 1; k <= 100; ++k) {
+  }
+}
+
+struct A {};
+
+
 // CHECK-LABEL: @main
 int main() {
   int i = 0;
@@ -110,6 +146,8 @@ int main() {
   // CHECK: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
   // CHECK: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
   // CHECK: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call({{[^@]*}} @{{[^@]*}}[[REGION:@[^ ]+]]
+  // CHECK-LABEL: work
+  work<A>();
   // CHECK-LABEL: foo
   return foo(15);
 }

Modified: vendor/clang/dist/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -702,7 +702,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/distribute_simd_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/distribute_simd_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/distribute_simd_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -691,7 +691,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/for_codegen.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/for_codegen.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/for_codegen.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -484,6 +484,18 @@ void loop_with_It(It<char> begin, It<char> end) {
 // CHECK: call void @__kmpc_for_static_init_8(
 // CHECK: call void @__kmpc_for_static_fini(
 
+void loop_with_It_plus(It<char> begin, It<char> end) {
+#pragma omp for
+  for (It<char> it = begin; it < end; it+=1u) {
+    *it = 0;
+  }
+}
+
+// CHECK-LABEL: loop_with_It_plus
+// CHECK: call i32 @__kmpc_global_thread_num(
+// CHECK: call void @__kmpc_for_static_init_8(
+// CHECK: call void @__kmpc_for_static_fini(
+
 void loop_with_stmt_expr() {
 #pragma omp for
   for (int i = __extension__({float b = 0;b; }); i < __extension__({double c = 1;c; }); i += __extension__({char d = 1; d; }))

Modified: vendor/clang/dist/test/OpenMP/for_linear_codegen.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/for_linear_codegen.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/for_linear_codegen.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -422,6 +422,7 @@ int main() {
 // CHECK: [[A_PRIV:%.+]] = alloca i{{[0-9]+}},
 // CHECK: [[B_PRIV:%.+]] = alloca i{{[0-9]+}},
 // CHECK: [[C_PRIV:%.+]] = alloca i{{[0-9]+}},
+// CHECK: call void @__kmpc_barrier(
 // CHECK: store i{{[0-9]+}}* [[A_PRIV]], i{{[0-9]+}}** [[REFA:%.+]],
 // CHECK: store i{{[0-9]+}}* [[C_PRIV]], i{{[0-9]+}}** [[REFC:%.+]],
 // CHECK: call void @__kmpc_for_static_init_4(

Modified: vendor/clang/dist/test/OpenMP/for_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/for_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/for_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -660,7 +660,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/for_simd_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/for_simd_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/for_simd_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -624,7 +624,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/ordered_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/ordered_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/ordered_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -270,5 +270,13 @@ int k;
     }
   }
 
+#pragma omp for ordered(2) // expected-note {{as specified in 'ordered' clause}}
+  for (int i = 0; i < 10; ++i) { // expected-error {{expected 2 for loops after '#pragma omp for', but found only 1}}
+#pragma omp ordered depend(sink : i)
+    int j;
+#pragma omp ordered depend(sink : i, j) // expected-error {{expected loop iteration variable}}
+    foo();
+  }
+
   return foo<int>(); // expected-note {{in instantiation of function template specialization 'foo<int>' requested here}}
 }

Modified: vendor/clang/dist/test/OpenMP/parallel_for_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/parallel_for_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/parallel_for_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -539,7 +539,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/parallel_for_simd_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/parallel_for_simd_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/parallel_for_simd_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -540,7 +540,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/parallel_reduction_codegen.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/parallel_reduction_codegen.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/parallel_reduction_codegen.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -80,6 +80,14 @@ struct SST {
 // CHECK-DAG: [[REDUCTION_LOC:@.+]] = private unnamed_addr constant %{{.+}} { i32 0, i32 18, i32 0, i32 0, i8*
 // CHECK-DAG: [[REDUCTION_LOCK:@.+]] = common global [8 x i32] zeroinitializer
 
+//CHECK: foo_array_sect
+//CHECK: call void {{.+}}@__kmpc_fork_call(
+//CHECK: ret void
+void foo_array_sect(short x[1]) {
+#pragma omp parallel reduction(+ : x[:])
+  {}
+}
+
 template <typename T>
 T tmain() {
   T t;

Modified: vendor/clang/dist/test/OpenMP/simd_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/simd_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/simd_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -527,7 +527,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/target_parallel_for_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/target_parallel_for_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/target_parallel_for_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -539,7 +539,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/target_parallel_for_simd_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/target_parallel_for_simd_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/target_parallel_for_simd_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -539,7 +539,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/target_simd_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/target_simd_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/target_simd_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -541,7 +541,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/target_teams_distribute_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/target_teams_distribute_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/target_teams_distribute_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -525,7 +525,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -523,7 +523,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -526,7 +526,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Modified: vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -525,7 +525,7 @@ void test_with_template() {
   t1.dotest_lt(begin, end);
   t2.dotest_lt(begin, end);         // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
   dotest_gt(begin, end);            // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
-  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
+  dotest_gt<unsigned, 10>(0, 100);  // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
 }
 
 void test_loop_break() {

Added: vendor/clang/dist/test/OpenMP/task_codegen.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/clang/dist/test/OpenMP/task_codegen.c	Sat Dec  2 12:46:48 2017	(r326462)
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -x c -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c -triple x86_64-apple-darwin10 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+void foo();
+
+// CHECK-LABEL: @main
+int main() {
+  // CHECK: call i32 @__kmpc_global_thread_num(
+  // CHECK: call i8* @__kmpc_omp_task_alloc(
+  // CHECK: call i32 @__kmpc_omp_task(
+#pragma omp task
+  {
+#pragma omp taskgroup
+    {
+#pragma omp task
+      foo();
+    }
+  }
+  // CHECK: ret i32 0
+  return 0;
+}
+// CHECK: call void @__kmpc_taskgroup(
+// CHECK: call i8* @__kmpc_omp_task_alloc(
+// CHECK: call i32 @__kmpc_omp_task(
+// CHECK: call void @__kmpc_end_taskgroup(
+#endif

Modified: vendor/clang/dist/test/OpenMP/taskloop_codegen.cpp
==============================================================================
--- vendor/clang/dist/test/OpenMP/taskloop_codegen.cpp	Sat Dec  2 12:46:31 2017	(r326461)
+++ vendor/clang/dist/test/OpenMP/taskloop_codegen.cpp	Sat Dec  2 12:46:48 2017	(r326462)
@@ -8,6 +8,10 @@
 // CHECK-LABEL: @main
 int main(int argc, char **argv) {
 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%ident_t* [[DEFLOC:@.+]])
+// CHECK: call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]],

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712021246.vB2CkmBe050556>