svn commit: r355961 - in vendor/llvm-project/release-9.x: clang/include/clang/CodeGen clang/lib/AST clang/lib/CodeGen clang/lib/Driver/ToolChains clang/lib/Sema compiler-rt/lib/profile lld/COFF lld...

Dimitry Andric dim at FreeBSD.org
Fri Dec 20 21:55:19 UTC 2019


Author: dim
Date: Fri Dec 20 21:55:13 2019
New Revision: 355961
URL: https://svnweb.freebsd.org/changeset/base/355961

Log:
  Vendor import of llvm-project tag llvmorg-9.0.1:
  https://github.com/llvm/llvm-project/tree/llvmorg-9.0.1

Added:
  vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp   (contents, props changed)
  vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h   (contents, props changed)
Modified:
  vendor/llvm-project/release-9.x/clang/include/clang/CodeGen/CGFunctionInfo.h
  vendor/llvm-project/release-9.x/clang/lib/AST/ExprConstant.cpp
  vendor/llvm-project/release-9.x/clang/lib/CodeGen/CGExpr.cpp
  vendor/llvm-project/release-9.x/clang/lib/CodeGen/MicrosoftCXXABI.cpp
  vendor/llvm-project/release-9.x/clang/lib/Driver/ToolChains/Linux.cpp
  vendor/llvm-project/release-9.x/clang/lib/Sema/SemaDecl.cpp
  vendor/llvm-project/release-9.x/clang/lib/Sema/SemaType.cpp
  vendor/llvm-project/release-9.x/compiler-rt/lib/profile/InstrProfilingUtil.c
  vendor/llvm-project/release-9.x/lld/COFF/Driver.cpp
  vendor/llvm-project/release-9.x/lld/ELF/Symbols.h
  vendor/llvm-project/release-9.x/lld/docs/ReleaseNotes.rst
  vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  vendor/llvm-project/release-9.x/lldb/source/Symbol/Symtab.cpp
  vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/MachineFunction.h
  vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/MachineInstr.h
  vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/StackProtector.h
  vendor/llvm-project/release-9.x/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
  vendor/llvm-project/release-9.x/llvm/include/llvm/Transforms/Scalar/GVN.h
  vendor/llvm-project/release-9.x/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  vendor/llvm-project/release-9.x/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
  vendor/llvm-project/release-9.x/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
  vendor/llvm-project/release-9.x/llvm/lib/CodeGen/MachineFunction.cpp
  vendor/llvm-project/release-9.x/llvm/lib/CodeGen/MachineInstr.cpp
  vendor/llvm-project/release-9.x/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  vendor/llvm-project/release-9.x/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
  vendor/llvm-project/release-9.x/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
  vendor/llvm-project/release-9.x/llvm/lib/CodeGen/StackProtector.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Support/ARMTargetParser.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Target/ARM/ARM.td
  vendor/llvm-project/release-9.x/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Target/PowerPC/P9InstrResources.td
  vendor/llvm-project/release-9.x/llvm/lib/Target/PowerPC/PPCInstr64Bit.td
  vendor/llvm-project/release-9.x/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Target/PowerPC/PPCInstrInfo.td
  vendor/llvm-project/release-9.x/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Target/RISCV/RISCVRegisterInfo.h
  vendor/llvm-project/release-9.x/llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td
  vendor/llvm-project/release-9.x/llvm/lib/Target/X86/X86FrameLowering.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Target/X86/X86FrameLowering.h
  vendor/llvm-project/release-9.x/llvm/lib/Target/X86/X86ISelLowering.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Target/X86/X86ISelLowering.h
  vendor/llvm-project/release-9.x/llvm/lib/Target/X86/X86InstrInfo.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Target/X86/X86MachineFunctionInfo.h
  vendor/llvm-project/release-9.x/llvm/lib/Target/X86/X86RegisterInfo.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Transforms/Scalar/GVN.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
  vendor/llvm-project/release-9.x/llvm/lib/Transforms/Scalar/SROA.cpp
  vendor/llvm-project/release-9.x/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
  vendor/llvm-project/release-9.x/llvm/tools/llvm-objcopy/ObjcopyOpts.td
  vendor/llvm-project/release-9.x/llvm/tools/llvm-objcopy/StripOpts.td
  vendor/llvm-project/release-9.x/llvm/tools/opt/opt.cpp

Modified: vendor/llvm-project/release-9.x/clang/include/clang/CodeGen/CGFunctionInfo.h
==============================================================================
--- vendor/llvm-project/release-9.x/clang/include/clang/CodeGen/CGFunctionInfo.h	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/clang/include/clang/CodeGen/CGFunctionInfo.h	Fri Dec 20 21:55:13 2019	(r355961)
@@ -109,14 +109,12 @@ class ABIArgInfo { (private)
     UnpaddedCoerceAndExpandType = T;
   }
 
-  ABIArgInfo(Kind K)
-      : TheKind(K), PaddingInReg(false), InReg(false) {
-  }
-
 public:
-  ABIArgInfo()
+  ABIArgInfo(Kind K = Direct)
       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
+        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
+        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
+        InReg(false), CanBeFlattened(false), SignExt(false) {}
 
   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
                               llvm::Type *Padding = nullptr,

Modified: vendor/llvm-project/release-9.x/clang/lib/AST/ExprConstant.cpp
==============================================================================
--- vendor/llvm-project/release-9.x/clang/lib/AST/ExprConstant.cpp	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/clang/lib/AST/ExprConstant.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -794,58 +794,47 @@ namespace {
     /// constant value.
     bool InConstantContext;
 
+    /// Whether we're checking that an expression is a potential constant
+    /// expression. If so, do not fail on constructs that could become constant
+    /// later on (such as a use of an undefined global).
+    bool CheckingPotentialConstantExpression = false;
+
+    /// Whether we're checking for an expression that has undefined behavior.
+    /// If so, we will produce warnings if we encounter an operation that is
+    /// always undefined.
+    bool CheckingForUndefinedBehavior = false;
+
     enum EvaluationMode {
       /// Evaluate as a constant expression. Stop if we find that the expression
       /// is not a constant expression.
       EM_ConstantExpression,
 
-      /// Evaluate as a potential constant expression. Keep going if we hit a
-      /// construct that we can't evaluate yet (because we don't yet know the
-      /// value of something) but stop if we hit something that could never be
-      /// a constant expression.
-      EM_PotentialConstantExpression,
+      /// Evaluate as a constant expression. Stop if we find that the expression
+      /// is not a constant expression. Some expressions can be retried in the
+      /// optimizer if we don't constant fold them here, but in an unevaluated
+      /// context we try to fold them immediately since the optimizer never
+      /// gets a chance to look at it.
+      EM_ConstantExpressionUnevaluated,
 
       /// Fold the expression to a constant. Stop if we hit a side-effect that
       /// we can't model.
       EM_ConstantFold,
 
-      /// Evaluate the expression looking for integer overflow and similar
-      /// issues. Don't worry about side-effects, and try to visit all
-      /// subexpressions.
-      EM_EvaluateForOverflow,
-
       /// Evaluate in any way we know how. Don't worry about side-effects that
       /// can't be modeled.
       EM_IgnoreSideEffects,
-
-      /// Evaluate as a constant expression. Stop if we find that the expression
-      /// is not a constant expression. Some expressions can be retried in the
-      /// optimizer if we don't constant fold them here, but in an unevaluated
-      /// context we try to fold them immediately since the optimizer never
-      /// gets a chance to look at it.
-      EM_ConstantExpressionUnevaluated,
-
-      /// Evaluate as a potential constant expression. Keep going if we hit a
-      /// construct that we can't evaluate yet (because we don't yet know the
-      /// value of something) but stop if we hit something that could never be
-      /// a constant expression. Some expressions can be retried in the
-      /// optimizer if we don't constant fold them here, but in an unevaluated
-      /// context we try to fold them immediately since the optimizer never
-      /// gets a chance to look at it.
-      EM_PotentialConstantExpressionUnevaluated,
     } EvalMode;
 
     /// Are we checking whether the expression is a potential constant
     /// expression?
     bool checkingPotentialConstantExpression() const {
-      return EvalMode == EM_PotentialConstantExpression ||
-             EvalMode == EM_PotentialConstantExpressionUnevaluated;
+      return CheckingPotentialConstantExpression;
     }
 
     /// Are we checking an expression for overflow?
     // FIXME: We should check for any kind of undefined or suspicious behavior
     // in such constructs, not just overflow.
-    bool checkingForOverflow() { return EvalMode == EM_EvaluateForOverflow; }
+    bool checkingForUndefinedBehavior() { return CheckingForUndefinedBehavior; }
 
     EvalInfo(const ASTContext &C, Expr::EvalStatus &S, EvaluationMode Mode)
       : Ctx(const_cast<ASTContext &>(C)), EvalStatus(S), CurrentCall(nullptr),
@@ -932,15 +921,12 @@ namespace {
           switch (EvalMode) {
           case EM_ConstantFold:
           case EM_IgnoreSideEffects:
-          case EM_EvaluateForOverflow:
             if (!HasFoldFailureDiagnostic)
               break;
             // We've already failed to fold something. Keep that diagnostic.
             LLVM_FALLTHROUGH;
           case EM_ConstantExpression:
-          case EM_PotentialConstantExpression:
           case EM_ConstantExpressionUnevaluated:
-          case EM_PotentialConstantExpressionUnevaluated:
             HasActiveDiagnostic = false;
             return OptionalDiagnostic();
           }
@@ -986,8 +972,8 @@ namespace {
     /// Diagnose that the evaluation does not produce a C++11 core constant
     /// expression.
     ///
-    /// FIXME: Stop evaluating if we're in EM_ConstantExpression or
-    /// EM_PotentialConstantExpression mode and we produce one of these.
+    /// FIXME: Stop evaluating if we're in EM_ConstantExpression mode
+    /// and we produce one of these.
     OptionalDiagnostic CCEDiag(SourceLocation Loc, diag::kind DiagId
                                  = diag::note_invalid_subexpr_in_const_expr,
                                unsigned ExtraNotes = 0) {
@@ -1023,16 +1009,16 @@ namespace {
     /// couldn't model?
     bool keepEvaluatingAfterSideEffect() {
       switch (EvalMode) {
-      case EM_PotentialConstantExpression:
-      case EM_PotentialConstantExpressionUnevaluated:
-      case EM_EvaluateForOverflow:
       case EM_IgnoreSideEffects:
         return true;
 
       case EM_ConstantExpression:
       case EM_ConstantExpressionUnevaluated:
       case EM_ConstantFold:
-        return false;
+        // By default, assume any side effect might be valid in some other
+        // evaluation of this expression from a different context.
+        return checkingPotentialConstantExpression() ||
+               checkingForUndefinedBehavior();
       }
       llvm_unreachable("Missed EvalMode case");
     }
@@ -1047,16 +1033,13 @@ namespace {
     /// Should we continue evaluation after encountering undefined behavior?
     bool keepEvaluatingAfterUndefinedBehavior() {
       switch (EvalMode) {
-      case EM_EvaluateForOverflow:
       case EM_IgnoreSideEffects:
       case EM_ConstantFold:
         return true;
 
-      case EM_PotentialConstantExpression:
-      case EM_PotentialConstantExpressionUnevaluated:
       case EM_ConstantExpression:
       case EM_ConstantExpressionUnevaluated:
-        return false;
+        return checkingForUndefinedBehavior();
       }
       llvm_unreachable("Missed EvalMode case");
     }
@@ -1076,16 +1059,12 @@ namespace {
         return false;
 
       switch (EvalMode) {
-      case EM_PotentialConstantExpression:
-      case EM_PotentialConstantExpressionUnevaluated:
-      case EM_EvaluateForOverflow:
-        return true;
-
       case EM_ConstantExpression:
       case EM_ConstantExpressionUnevaluated:
       case EM_ConstantFold:
       case EM_IgnoreSideEffects:
-        return false;
+        return checkingPotentialConstantExpression() ||
+               checkingForUndefinedBehavior();
       }
       llvm_unreachable("Missed EvalMode case");
     }
@@ -1142,9 +1121,7 @@ namespace {
                         Info.EvalStatus.Diag->empty() &&
                         !Info.EvalStatus.HasSideEffects),
         OldMode(Info.EvalMode) {
-      if (Enabled &&
-          (Info.EvalMode == EvalInfo::EM_ConstantExpression ||
-           Info.EvalMode == EvalInfo::EM_ConstantExpressionUnevaluated))
+      if (Enabled)
         Info.EvalMode = EvalInfo::EM_ConstantFold;
     }
     void keepDiagnostics() { Enabled = false; }
@@ -1163,8 +1140,7 @@ namespace {
     EvalInfo::EvaluationMode OldMode;
     explicit IgnoreSideEffectsRAII(EvalInfo &Info)
         : Info(Info), OldMode(Info.EvalMode) {
-      if (!Info.checkingPotentialConstantExpression())
-        Info.EvalMode = EvalInfo::EM_IgnoreSideEffects;
+      Info.EvalMode = EvalInfo::EM_IgnoreSideEffects;
     }
 
     ~IgnoreSideEffectsRAII() { Info.EvalMode = OldMode; }
@@ -2323,7 +2299,7 @@ static bool CheckedIntArithmetic(EvalInfo &Info, const
   APSInt Value(Op(LHS.extend(BitWidth), RHS.extend(BitWidth)), false);
   Result = Value.trunc(LHS.getBitWidth());
   if (Result.extend(BitWidth) != Value) {
-    if (Info.checkingForOverflow())
+    if (Info.checkingForUndefinedBehavior())
       Info.Ctx.getDiagnostics().Report(E->getExprLoc(),
                                        diag::warn_integer_constant_overflow)
           << Result.toString(10) << E->getType();
@@ -6047,6 +6023,8 @@ class ExprEvaluatorBase (public)
 
     // Always assume __builtin_constant_p(...) ? ... : ... is a potential
     // constant expression; we can't check whether it's potentially foldable.
+    // FIXME: We should instead treat __builtin_constant_p as non-constant if
+    // it would return 'false' in this mode.
     if (Info.checkingPotentialConstantExpression() && IsBcpCall)
       return false;
 
@@ -6329,7 +6307,7 @@ class ExprEvaluatorBase (public)
   bool VisitStmtExpr(const StmtExpr *E) {
     // We will have checked the full-expressions inside the statement expression
     // when they were completed, and don't need to check them again now.
-    if (Info.checkingForOverflow())
+    if (Info.checkingForUndefinedBehavior())
       return Error(E);
 
     BlockScopeRAII Scope(Info);
@@ -9499,14 +9477,11 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const Call
     // size of the referenced object.
     switch (Info.EvalMode) {
     case EvalInfo::EM_ConstantExpression:
-    case EvalInfo::EM_PotentialConstantExpression:
     case EvalInfo::EM_ConstantFold:
-    case EvalInfo::EM_EvaluateForOverflow:
     case EvalInfo::EM_IgnoreSideEffects:
       // Leave it to IR generation.
       return Error(E);
     case EvalInfo::EM_ConstantExpressionUnevaluated:
-    case EvalInfo::EM_PotentialConstantExpressionUnevaluated:
       // Reduce it to a constant now.
       return Success((Type & 2) ? 0 : -1, E);
     }
@@ -12546,8 +12521,9 @@ APSInt Expr::EvaluateKnownConstIntCheckOverflow(
 
   EvalResult EVResult;
   EVResult.Diag = Diag;
-  EvalInfo Info(Ctx, EVResult, EvalInfo::EM_EvaluateForOverflow);
+  EvalInfo Info(Ctx, EVResult, EvalInfo::EM_IgnoreSideEffects);
   Info.InConstantContext = true;
+  Info.CheckingForUndefinedBehavior = true;
 
   bool Result = ::EvaluateAsRValue(Info, this, EVResult.Val);
   (void)Result;
@@ -12564,7 +12540,8 @@ void Expr::EvaluateForOverflow(const ASTContext &Ctx) 
   bool IsConst;
   EvalResult EVResult;
   if (!FastEvaluateAsRValue(this, EVResult, Ctx, IsConst)) {
-    EvalInfo Info(Ctx, EVResult, EvalInfo::EM_EvaluateForOverflow);
+    EvalInfo Info(Ctx, EVResult, EvalInfo::EM_IgnoreSideEffects);
+    Info.CheckingForUndefinedBehavior = true;
     (void)::EvaluateAsRValue(Info, this, EVResult.Val);
   }
 }
@@ -13178,9 +13155,9 @@ bool Expr::isPotentialConstantExpr(const FunctionDecl 
   Expr::EvalStatus Status;
   Status.Diag = &Diags;
 
-  EvalInfo Info(FD->getASTContext(), Status,
-                EvalInfo::EM_PotentialConstantExpression);
+  EvalInfo Info(FD->getASTContext(), Status, EvalInfo::EM_ConstantExpression);
   Info.InConstantContext = true;
+  Info.CheckingPotentialConstantExpression = true;
 
   const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD);
   const CXXRecordDecl *RD = MD ? MD->getParent()->getCanonicalDecl() : nullptr;
@@ -13219,8 +13196,9 @@ bool Expr::isPotentialConstantExprUnevaluated(Expr *E,
   Status.Diag = &Diags;
 
   EvalInfo Info(FD->getASTContext(), Status,
-                EvalInfo::EM_PotentialConstantExpressionUnevaluated);
+                EvalInfo::EM_ConstantExpressionUnevaluated);
   Info.InConstantContext = true;
+  Info.CheckingPotentialConstantExpression = true;
 
   // Fabricate a call stack frame to give the arguments a plausible cover story.
   ArrayRef<const Expr*> Args;

Modified: vendor/llvm-project/release-9.x/clang/lib/CodeGen/CGExpr.cpp
==============================================================================
--- vendor/llvm-project/release-9.x/clang/lib/CodeGen/CGExpr.cpp	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/clang/lib/CodeGen/CGExpr.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -2540,6 +2540,11 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRe
         // Spill the constant value to a global.
         Addr = CGM.createUnnamedGlobalFrom(*VD, Val,
                                            getContext().getDeclAlign(VD));
+        llvm::Type *VarTy = getTypes().ConvertTypeForMem(VD->getType());
+        auto *PTy = llvm::PointerType::get(
+            VarTy, getContext().getTargetAddressSpace(VD->getType()));
+        if (PTy != Addr.getType())
+          Addr = Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, PTy);
       } else {
         // Should we be using the alignment of the constant pointer we emitted?
         CharUnits Alignment =

Modified: vendor/llvm-project/release-9.x/clang/lib/CodeGen/MicrosoftCXXABI.cpp
==============================================================================
--- vendor/llvm-project/release-9.x/clang/lib/CodeGen/MicrosoftCXXABI.cpp	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/clang/lib/CodeGen/MicrosoftCXXABI.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -617,6 +617,9 @@ class MicrosoftCXXABI : public CGCXXABI { (private)
   llvm::Function *EmitVirtualMemPtrThunk(const CXXMethodDecl *MD,
                                          const MethodVFTableLocation &ML);
 
+  llvm::Constant *EmitMemberDataPointer(const CXXRecordDecl *RD,
+                                        CharUnits offset);
+
 public:
   llvm::Type *ConvertMemberPointerType(const MemberPointerType *MPT) override;
 
@@ -2700,7 +2703,11 @@ MicrosoftCXXABI::EmitFullMemberPointer(llvm::Constant 
 llvm::Constant *
 MicrosoftCXXABI::EmitMemberDataPointer(const MemberPointerType *MPT,
                                        CharUnits offset) {
-  const CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl();
+  return EmitMemberDataPointer(MPT->getMostRecentCXXRecordDecl(), offset);
+}
+
+llvm::Constant *MicrosoftCXXABI::EmitMemberDataPointer(const CXXRecordDecl *RD,
+                                                       CharUnits offset) {
   if (RD->getMSInheritanceModel() ==
       MSInheritanceAttr::Keyword_virtual_inheritance)
     offset -= getContext().getOffsetOfBaseWithVBPtr(RD);
@@ -2724,8 +2731,17 @@ llvm::Constant *MicrosoftCXXABI::EmitMemberPointer(con
   if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(MPD)) {
     C = EmitMemberFunctionPointer(MD);
   } else {
+    // For a pointer to data member, start off with the offset of the field in
+    // the class in which it was declared, and convert from there if necessary.
+    // For indirect field decls, get the outermost anonymous field and use the
+    // parent class.
     CharUnits FieldOffset = Ctx.toCharUnitsFromBits(Ctx.getFieldOffset(MPD));
-    C = EmitMemberDataPointer(DstTy, FieldOffset);
+    const FieldDecl *FD = dyn_cast<FieldDecl>(MPD);
+    if (!FD)
+      FD = cast<FieldDecl>(*cast<IndirectFieldDecl>(MPD)->chain_begin());
+    const CXXRecordDecl *RD = cast<CXXRecordDecl>(FD->getParent());
+    RD = RD->getMostRecentNonInjectedDecl();
+    C = EmitMemberDataPointer(RD, FieldOffset);
   }
 
   if (!MemberPointerPath.empty()) {

Modified: vendor/llvm-project/release-9.x/clang/lib/Driver/ToolChains/Linux.cpp
==============================================================================
--- vendor/llvm-project/release-9.x/clang/lib/Driver/ToolChains/Linux.cpp	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/clang/lib/Driver/ToolChains/Linux.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -658,11 +658,11 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &D
   if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
     addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include");
 
-  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
-    SmallString<128> P(D.ResourceDir);
-    llvm::sys::path::append(P, "include");
-    addSystemInclude(DriverArgs, CC1Args, P);
-  }
+  SmallString<128> ResourceDirInclude(D.ResourceDir);
+  llvm::sys::path::append(ResourceDirInclude, "include");
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc) &&
+      (!getTriple().isMusl() || DriverArgs.hasArg(options::OPT_nostdlibinc)))
+    addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude);
 
   if (DriverArgs.hasArg(options::OPT_nostdlibinc))
     return;
@@ -860,6 +860,9 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &D
   addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include");
 
   addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
+
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc) && getTriple().isMusl())
+    addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude);
 }
 
 static std::string DetectLibcxxIncludePath(llvm::vfs::FileSystem &vfs,

Modified: vendor/llvm-project/release-9.x/clang/lib/Sema/SemaDecl.cpp
==============================================================================
--- vendor/llvm-project/release-9.x/clang/lib/Sema/SemaDecl.cpp	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/clang/lib/Sema/SemaDecl.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -3475,7 +3475,12 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedD
       }
     }
 
-    if (OldQTypeForComparison == NewQType)
+    // If the function types are compatible, merge the declarations. Ignore the
+    // exception specifier because it was already checked above in
+    // CheckEquivalentExceptionSpec, and we don't want follow-on diagnostics
+    // about incompatible types under -fms-compatibility.
+    if (Context.hasSameFunctionTypeIgnoringExceptionSpec(OldQTypeForComparison,
+                                                         NewQType))
       return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld);
 
     // If the types are imprecise (due to dependent constructs in friends or

Modified: vendor/llvm-project/release-9.x/clang/lib/Sema/SemaType.cpp
==============================================================================
--- vendor/llvm-project/release-9.x/clang/lib/Sema/SemaType.cpp	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/clang/lib/Sema/SemaType.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -6325,7 +6325,8 @@ namespace {
       Pointer,
       BlockPointer,
       Reference,
-      MemberPointer
+      MemberPointer,
+      MacroQualified,
     };
 
     QualType Original;
@@ -6356,6 +6357,9 @@ namespace {
         } else if (isa<AttributedType>(Ty)) {
           T = cast<AttributedType>(Ty)->getEquivalentType();
           Stack.push_back(Attributed);
+        } else if (isa<MacroQualifiedType>(Ty)) {
+          T = cast<MacroQualifiedType>(Ty)->getUnderlyingType();
+          Stack.push_back(MacroQualified);
         } else {
           const Type *DTy = Ty->getUnqualifiedDesugaredType();
           if (Ty == DTy) {
@@ -6411,6 +6415,9 @@ namespace {
         QualType New = wrap(C, cast<ParenType>(Old)->getInnerType(), I);
         return C.getParenType(New);
       }
+
+      case MacroQualified:
+        return wrap(C, cast<MacroQualifiedType>(Old)->getUnderlyingType(), I);
 
       case Pointer: {
         QualType New = wrap(C, cast<PointerType>(Old)->getPointeeType(), I);

Modified: vendor/llvm-project/release-9.x/compiler-rt/lib/profile/InstrProfilingUtil.c
==============================================================================
--- vendor/llvm-project/release-9.x/compiler-rt/lib/profile/InstrProfilingUtil.c	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/compiler-rt/lib/profile/InstrProfilingUtil.c	Fri Dec 20 21:55:13 2019	(r355961)
@@ -189,8 +189,9 @@ COMPILER_RT_VISIBILITY FILE *lprofOpenFileEx(const cha
   f = fdopen(fd, "r+b");
 #elif defined(_WIN32)
   // FIXME: Use the wide variants to handle Unicode filenames.
-  HANDLE h = CreateFileA(ProfileName, GENERIC_READ | GENERIC_WRITE, 0, 0,
-                         OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
+  HANDLE h = CreateFileA(ProfileName, GENERIC_READ | GENERIC_WRITE,
+                         FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_ALWAYS,
+                         FILE_ATTRIBUTE_NORMAL, 0);
   if (h == INVALID_HANDLE_VALUE)
     return NULL;
 
@@ -199,6 +200,10 @@ COMPILER_RT_VISIBILITY FILE *lprofOpenFileEx(const cha
     CloseHandle(h);
     return NULL;
   }
+
+  if (lprofLockFd(fd) != 0)
+    PROF_WARN("Data may be corrupted during profile merging : %s\n",
+              "Fail to obtain file lock due to system limit.");
 
   f = _fdopen(fd, "r+b");
   if (f == 0) {

Modified: vendor/llvm-project/release-9.x/lld/COFF/Driver.cpp
==============================================================================
--- vendor/llvm-project/release-9.x/lld/COFF/Driver.cpp	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/lld/COFF/Driver.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -1138,7 +1138,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr
     }
   }
 
-  if (!args.hasArg(OPT_INPUT)) {
+  if (!args.hasArg(OPT_INPUT, OPT_wholearchive_file)) {
     if (args.hasArg(OPT_deffile))
       config->noEntry = true;
     else
@@ -1626,7 +1626,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr
   }
 
   // Handle generation of import library from a def file.
-  if (!args.hasArg(OPT_INPUT)) {
+  if (!args.hasArg(OPT_INPUT, OPT_wholearchive_file)) {
     fixupExports();
     createImportLibrary(/*asLib=*/true);
     return;
@@ -1672,8 +1672,8 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr
 
   // Set default image name if neither /out or /def set it.
   if (config->outputFile.empty()) {
-    config->outputFile =
-        getOutputPath((*args.filtered(OPT_INPUT).begin())->getValue());
+    config->outputFile = getOutputPath(
+        (*args.filtered(OPT_INPUT, OPT_wholearchive_file).begin())->getValue());
   }
 
   // Fail early if an output file is not writable.

Modified: vendor/llvm-project/release-9.x/lld/ELF/Symbols.h
==============================================================================
--- vendor/llvm-project/release-9.x/lld/ELF/Symbols.h	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/lld/ELF/Symbols.h	Fri Dec 20 21:55:13 2019	(r355961)
@@ -108,27 +108,27 @@ class Symbol { (public)
 
   // Symbol visibility. This is the computed minimum visibility of all
   // observed non-DSO symbols.
-  unsigned visibility : 2;
+  uint8_t visibility : 2;
 
   // True if the symbol was used for linking and thus need to be added to the
   // output file's symbol table. This is true for all symbols except for
   // unreferenced DSO symbols, lazy (archive) symbols, and bitcode symbols that
   // are unreferenced except by other bitcode objects.
-  unsigned isUsedInRegularObj : 1;
+  uint8_t isUsedInRegularObj : 1;
 
   // If this flag is true and the symbol has protected or default visibility, it
   // will appear in .dynsym. This flag is set by interposable DSO symbols in
   // executables, by most symbols in DSOs and executables built with
   // --export-dynamic, and by dynamic lists.
-  unsigned exportDynamic : 1;
+  uint8_t exportDynamic : 1;
 
   // False if LTO shouldn't inline whatever this symbol points to. If a symbol
   // is overwritten after LTO, LTO shouldn't inline the symbol because it
   // doesn't know the final contents of the symbol.
-  unsigned canInline : 1;
+  uint8_t canInline : 1;
 
   // True if this symbol is specified by --trace-symbol option.
-  unsigned traced : 1;
+  uint8_t traced : 1;
 
   inline void replace(const Symbol &New);
 
@@ -236,28 +236,28 @@ class Symbol { (public)
 public:
   // True the symbol should point to its PLT entry.
   // For SharedSymbol only.
-  unsigned needsPltAddr : 1;
+  uint8_t needsPltAddr : 1;
 
   // True if this symbol is in the Iplt sub-section of the Plt and the Igot
   // sub-section of the .got.plt or .got.
-  unsigned isInIplt : 1;
+  uint8_t isInIplt : 1;
 
   // True if this symbol needs a GOT entry and its GOT entry is actually in
   // Igot. This will be true only for certain non-preemptible ifuncs.
-  unsigned gotInIgot : 1;
+  uint8_t gotInIgot : 1;
 
   // True if this symbol is preemptible at load time.
-  unsigned isPreemptible : 1;
+  uint8_t isPreemptible : 1;
 
   // True if an undefined or shared symbol is used from a live section.
-  unsigned used : 1;
+  uint8_t used : 1;
 
   // True if a call to this symbol needs to be followed by a restore of the
   // PPC64 toc pointer.
-  unsigned needsTocRestore : 1;
+  uint8_t needsTocRestore : 1;
 
   // True if this symbol is defined by a linker script.
-  unsigned scriptDefined : 1;
+  uint8_t scriptDefined : 1;
 
   // The partition whose dynamic symbol table contains this symbol's definition.
   uint8_t partition = 1;

Modified: vendor/llvm-project/release-9.x/lld/docs/ReleaseNotes.rst
==============================================================================
--- vendor/llvm-project/release-9.x/lld/docs/ReleaseNotes.rst	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/lld/docs/ReleaseNotes.rst	Fri Dec 20 21:55:13 2019	(r355961)
@@ -153,7 +153,7 @@ COFF Improvements
 
 * Having more than two ``/natvis:`` now works correctly; it used to not
   work for larger binaries before.
-  (`r327895 <https://reviews.llvm.org/rL327895>`_)
+  (`r359515 <https://reviews.llvm.org/rL359515>`_)
 
 * Undefined symbols are now printed only in demangled form. Pass
   ``/demangle:no`` to see raw symbol names instead.

Added: vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -0,0 +1,88 @@
+#include "PythonReadline.h"
+
+#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE
+
+#include <stdio.h>
+
+#include <editline/readline.h>
+
+// Simple implementation of the Python readline module using libedit.
+// In the event that libedit is excluded from the build, this turns
+// back into a null implementation that blocks the module from pulling
+// in the GNU readline shared lib, which causes linkage confusion when
+// both readline and libedit's readline compatibility symbols collide.
+//
+// Currently it only installs a PyOS_ReadlineFunctionPointer, without
+// implementing any of the readline module methods. This is meant to
+// work around LLVM pr18841 to avoid seg faults in the stock Python
+// readline.so linked against GNU readline.
+//
+// Bug on the cpython side: https://bugs.python.org/issue38634
+
+PyDoc_STRVAR(moduleDocumentation,
+             "Simple readline module implementation based on libedit.");
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef readline_module = {
+    PyModuleDef_HEAD_INIT, // m_base
+    "lldb_editline",       // m_name
+    moduleDocumentation,   // m_doc
+    -1,                    // m_size
+    nullptr,               // m_methods
+    nullptr,               // m_reload
+    nullptr,               // m_traverse
+    nullptr,               // m_clear
+    nullptr,               // m_free
+};
+#else
+static struct PyMethodDef moduleMethods[] = {{nullptr, nullptr, 0, nullptr}};
+#endif
+
+static char *
+#if PY_MAJOR_VERSION >= 3
+simple_readline(FILE *stdin, FILE *stdout, const char *prompt)
+#else
+simple_readline(FILE *stdin, FILE *stdout, char *prompt)
+#endif
+{
+  rl_instream = stdin;
+  rl_outstream = stdout;
+  char *line = readline(prompt);
+  if (!line) {
+#if PY_MAJOR_VERSION >= 3
+    char *ret = (char *)PyMem_RawMalloc(1);
+#else
+    char *ret = (char *)PyMem_Malloc(1);
+#endif
+    if (ret != NULL)
+      *ret = '\0';
+    return ret;
+  }
+  if (*line)
+    add_history(line);
+  int n = strlen(line);
+#if PY_MAJOR_VERSION >= 3
+  char *ret = (char *)PyMem_RawMalloc(n + 2);
+#else
+  char *ret = (char *)PyMem_Malloc(n + 2);
+#endif
+  if (ret) {
+    strncpy(ret, line, n);
+    free(line);
+    ret[n] = '\n';
+    ret[n + 1] = '\0';
+  }
+  return ret;
+}
+
+PyMODINIT_FUNC initlldb_readline(void) {
+  PyOS_ReadlineFunctionPointer = simple_readline;
+
+#if PY_MAJOR_VERSION >= 3
+  return PyModule_Create(&readline_module);
+#else
+  Py_InitModule4("readline", moduleMethods, moduleDocumentation,
+                 static_cast<PyObject *>(NULL), PYTHON_API_VERSION);
+#endif
+}
+#endif

Added: vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h	Fri Dec 20 21:55:13 2019	(r355961)
@@ -0,0 +1,26 @@
+//===-- PythonReadline.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+
+#if !defined(LLDB_DISABLE_LIBEDIT) && defined(__linux__)
+// NOTE: Since Python may define some pre-processor definitions which affect the
+// standard headers on some systems, you must include Python.h before any
+// standard headers are included.
+#include "Python.h"
+
+// no need to hack into Python's readline module if libedit isn't used.
+//
+#define LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE 1
+
+extern "C" PyMODINIT_FUNC initlldb_readline(void);
+
+#endif
+
+#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H

Modified: vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
==============================================================================
--- vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -17,6 +17,7 @@
 
 #include "PythonDataObjects.h"
 #include "PythonExceptionState.h"
+#include "PythonReadline.h"
 #include "ScriptInterpreterPythonImpl.h"
 
 #include "lldb/API/SBFrame.h"
@@ -206,6 +207,22 @@ struct InitializePythonRAII { (public)
     m_stdin_tty_state.Save(STDIN_FILENO, false);
 
     InitializePythonHome();
+
+#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE
+    // Python's readline is incompatible with libedit being linked into lldb.
+    // Provide a patched version local to the embedded interpreter.
+    bool ReadlinePatched = false;
+    for (auto *p = PyImport_Inittab; p->name != NULL; p++) {
+      if (strcmp(p->name, "readline") == 0) {
+        p->initfunc = initlldb_readline;
+        break;
+      }
+    }
+    if (!ReadlinePatched) {
+      PyImport_AppendInittab("readline", initlldb_readline);
+      ReadlinePatched = true;
+    }
+#endif
 
     // Register _lldb as a built-in module.
     PyImport_AppendInittab("_lldb", LLDBSwigPyInit);

Modified: vendor/llvm-project/release-9.x/lldb/source/Symbol/Symtab.cpp
==============================================================================
--- vendor/llvm-project/release-9.x/lldb/source/Symbol/Symtab.cpp	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/lldb/source/Symbol/Symtab.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -896,14 +896,8 @@ void Symtab::InitAddressIndexes() {
       for (size_t i = 0; i < num_entries; i++) {
         FileRangeToIndexMap::Entry *entry =
             m_file_addr_to_index.GetMutableEntryAtIndex(i);
-        if (entry->GetByteSize() > 0)
-          continue;
-        addr_t curr_base_addr = entry->GetRangeBase();
-        // Symbols with non-zero size will show after zero-sized symbols on the
-        // same address. So do not set size of a non-last zero-sized symbol.
-        if (i == num_entries - 1 ||
-            m_file_addr_to_index.GetMutableEntryAtIndex(i + 1)
-                    ->GetRangeBase() != curr_base_addr) {
+        if (entry->GetByteSize() == 0) {
+          addr_t curr_base_addr = entry->GetRangeBase();
           const RangeVector<addr_t, addr_t>::Entry *containing_section =
               section_ranges.FindEntryThatContains(curr_base_addr);
 

Modified: vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/MachineFunction.h
==============================================================================
--- vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/MachineFunction.h	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/MachineFunction.h	Fri Dec 20 21:55:13 2019	(r355961)
@@ -792,6 +792,10 @@ class MachineFunction { (public)
                     MCSymbol *PreInstrSymbol = nullptr,
                     MCSymbol *PostInstrSymbol = nullptr);
 
+  MachineInstr::ExtraInfo *createMIExtraInfoWithMarker(
+      ArrayRef<MachineMemOperand *> MMOs, MCSymbol *PreInstrSymbol,
+      MCSymbol *PostInstrSymbol, MDNode *HeapAllocMarker);
+
   /// Allocate a string and populate it with the given external symbol name.
   const char *createExternalSymbolName(StringRef Name);
 

Modified: vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/MachineInstr.h
==============================================================================
--- vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/MachineInstr.h	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/MachineInstr.h	Fri Dec 20 21:55:13 2019	(r355961)
@@ -137,19 +137,23 @@ class MachineInstr (private)
   /// This has to be defined eagerly due to the implementation constraints of
   /// `PointerSumType` where it is used.
   class ExtraInfo final
-      : TrailingObjects<ExtraInfo, MachineMemOperand *, MCSymbol *> {
+      : TrailingObjects<ExtraInfo, MachineMemOperand *, MCSymbol *, MDNode *> {
   public:
     static ExtraInfo *create(BumpPtrAllocator &Allocator,
                              ArrayRef<MachineMemOperand *> MMOs,
                              MCSymbol *PreInstrSymbol = nullptr,
-                             MCSymbol *PostInstrSymbol = nullptr) {
+                             MCSymbol *PostInstrSymbol = nullptr,
+                             MDNode *HeapAllocMarker = nullptr) {
       bool HasPreInstrSymbol = PreInstrSymbol != nullptr;
       bool HasPostInstrSymbol = PostInstrSymbol != nullptr;
+      bool HasHeapAllocMarker = HeapAllocMarker != nullptr;
       auto *Result = new (Allocator.Allocate(
-          totalSizeToAlloc<MachineMemOperand *, MCSymbol *>(
-              MMOs.size(), HasPreInstrSymbol + HasPostInstrSymbol),
+          totalSizeToAlloc<MachineMemOperand *, MCSymbol *, MDNode *>(
+              MMOs.size(), HasPreInstrSymbol + HasPostInstrSymbol,
+              HasHeapAllocMarker),
           alignof(ExtraInfo)))
-          ExtraInfo(MMOs.size(), HasPreInstrSymbol, HasPostInstrSymbol);
+          ExtraInfo(MMOs.size(), HasPreInstrSymbol, HasPostInstrSymbol,
+                    HasHeapAllocMarker);
 
       // Copy the actual data into the trailing objects.
       std::copy(MMOs.begin(), MMOs.end(),
@@ -160,6 +164,8 @@ class MachineInstr (private)
       if (HasPostInstrSymbol)
         Result->getTrailingObjects<MCSymbol *>()[HasPreInstrSymbol] =
             PostInstrSymbol;
+      if (HasHeapAllocMarker)
+        Result->getTrailingObjects<MDNode *>()[0] = HeapAllocMarker;
 
       return Result;
     }
@@ -178,6 +184,10 @@ class MachineInstr (private)
                  : nullptr;
     }
 
+    MDNode *getHeapAllocMarker() const {
+      return HasHeapAllocMarker ? getTrailingObjects<MDNode *>()[0] : nullptr;
+    }
+
   private:
     friend TrailingObjects;
 
@@ -189,6 +199,7 @@ class MachineInstr (private)
     const int NumMMOs;
     const bool HasPreInstrSymbol;
     const bool HasPostInstrSymbol;
+    const bool HasHeapAllocMarker;
 
     // Implement the `TrailingObjects` internal API.
     size_t numTrailingObjects(OverloadToken<MachineMemOperand *>) const {
@@ -197,12 +208,17 @@ class MachineInstr (private)
     size_t numTrailingObjects(OverloadToken<MCSymbol *>) const {
       return HasPreInstrSymbol + HasPostInstrSymbol;
     }
+    size_t numTrailingObjects(OverloadToken<MDNode *>) const {
+      return HasHeapAllocMarker;
+    }
 
     // Just a boring constructor to allow us to initialize the sizes. Always use
     // the `create` routine above.
-    ExtraInfo(int NumMMOs, bool HasPreInstrSymbol, bool HasPostInstrSymbol)
+    ExtraInfo(int NumMMOs, bool HasPreInstrSymbol, bool HasPostInstrSymbol,
+              bool HasHeapAllocMarker)
         : NumMMOs(NumMMOs), HasPreInstrSymbol(HasPreInstrSymbol),
-          HasPostInstrSymbol(HasPostInstrSymbol) {}
+          HasPostInstrSymbol(HasPostInstrSymbol),
+          HasHeapAllocMarker(HasHeapAllocMarker) {}
   };
 
   /// Enumeration of the kinds of inline extra info available. It is important
@@ -577,6 +593,16 @@ class MachineInstr (private)
     return nullptr;
   }
 
+  /// Helper to extract a heap alloc marker if one has been added.
+  MDNode *getHeapAllocMarker() const {
+    if (!Info)
+      return nullptr;
+    if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>())
+      return EI->getHeapAllocMarker();
+
+    return nullptr;
+  }
+
   /// API for querying MachineInstr properties. They are the same as MCInstrDesc
   /// queries but they are bundle aware.
 
@@ -1578,6 +1604,12 @@ class MachineInstr (private)
   /// replace ours with it.
   void cloneInstrSymbols(MachineFunction &MF, const MachineInstr &MI);
 
+  /// Set a marker on instructions that denotes where we should create and emit
+  /// heap alloc site labels. This waits until after instruction selection and
+  /// optimizations to create the label, so it should still work if the
+  /// instruction is removed or duplicated.
+  void setHeapAllocMarker(MachineFunction &MF, MDNode *MD);
+
   /// Return the MIFlags which represent both MachineInstrs. This
   /// should be used when merging two MachineInstrs into one. This routine does
   /// not modify the MIFlags of this MachineInstr.
@@ -1632,6 +1664,12 @@ class MachineInstr (private)
   const TargetRegisterClass *getRegClassConstraintEffectForVRegImpl(
       unsigned OpIdx, unsigned Reg, const TargetRegisterClass *CurRC,
       const TargetInstrInfo *TII, const TargetRegisterInfo *TRI) const;
+
+  /// Stores extra instruction information inline or allocates as ExtraInfo
+  /// based on the number of pointers.
+  void setExtraInfo(MachineFunction &MF, ArrayRef<MachineMemOperand *> MMOs,
+                    MCSymbol *PreInstrSymbol, MCSymbol *PostInstrSymbol,
+                    MDNode *HeapAllocMarker);
 };
 
 /// Special DenseMapInfo traits to compare MachineInstr* by *value* of the

Modified: vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/StackProtector.h
==============================================================================
--- vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/StackProtector.h	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/llvm/include/llvm/CodeGen/StackProtector.h	Fri Dec 20 21:55:13 2019	(r355961)
@@ -89,7 +89,8 @@ class StackProtector : public FunctionPass { (private)
                                 bool InStruct = false) const;
 
   /// Check whether a stack allocation has its address taken.
-  bool HasAddressTaken(const Instruction *AI);
+  bool HasAddressTaken(const Instruction *AI,
+                       SmallPtrSetImpl<const PHINode *> &VisitedPHIs);
 
   /// RequiresStackProtector - Check whether or not this function needs a
   /// stack protector based upon the stack protector level.

Modified: vendor/llvm-project/release-9.x/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
==============================================================================
--- vendor/llvm-project/release-9.x/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h	Fri Dec 20 21:55:13 2019	(r355961)
@@ -16,6 +16,8 @@
 #include "llvm/Demangle/DemangleConfig.h"
 #include "llvm/Demangle/StringView.h"
 #include <array>
+#include <cstdint>
+#include <string>
 
 namespace llvm {
 namespace itanium_demangle {

Modified: vendor/llvm-project/release-9.x/llvm/include/llvm/Transforms/Scalar/GVN.h
==============================================================================
--- vendor/llvm-project/release-9.x/llvm/include/llvm/Transforms/Scalar/GVN.h	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/llvm/include/llvm/Transforms/Scalar/GVN.h	Fri Dec 20 21:55:13 2019	(r355961)
@@ -120,6 +120,8 @@ class GVN : public PassInfoMixin<GVN> { (public)
     uint32_t lookupOrAddCall(CallInst *C);
     uint32_t phiTranslateImpl(const BasicBlock *BB, const BasicBlock *PhiBlock,
                               uint32_t Num, GVN &Gvn);
+    bool areCallValsEqual(uint32_t Num, uint32_t NewNum, const BasicBlock *Pred,
+                          const BasicBlock *PhiBlock, GVN &Gvn);
     std::pair<uint32_t, bool> assignExpNewValueNum(Expression &exp);
     bool areAllValsInBB(uint32_t num, const BasicBlock *BB, GVN &Gvn);
 

Modified: vendor/llvm-project/release-9.x/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
==============================================================================
--- vendor/llvm-project/release-9.x/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -1127,15 +1127,9 @@ void CodeViewDebug::emitDebugInfoForFunction(const Fun
     }
 
     for (auto HeapAllocSite : FI.HeapAllocSites) {
-      MCSymbol *BeginLabel = std::get<0>(HeapAllocSite);
-      MCSymbol *EndLabel = std::get<1>(HeapAllocSite);
-
-      // The labels might not be defined if the instruction was replaced
-      // somewhere in the codegen pipeline.
-      if (!BeginLabel->isDefined() || !EndLabel->isDefined())
-        continue;
-
-      DIType *DITy = std::get<2>(HeapAllocSite);
+      const MCSymbol *BeginLabel = std::get<0>(HeapAllocSite);
+      const MCSymbol *EndLabel = std::get<1>(HeapAllocSite);
+      const DIType *DITy = std::get<2>(HeapAllocSite);
       MCSymbol *HeapAllocEnd = beginSymbolRecord(SymbolKind::S_HEAPALLOCSITE);
       OS.AddComment("Call site offset");
       OS.EmitCOFFSecRel32(BeginLabel, /*Offset=*/0);
@@ -1454,6 +1448,16 @@ void CodeViewDebug::beginFunctionImpl(const MachineFun
     DebugLoc FnStartDL = PrologEndLoc.getFnDebugLoc();
     maybeRecordLocation(FnStartDL, MF);
   }
+
+  // Find heap alloc sites and emit labels around them.
+  for (const auto &MBB : *MF) {
+    for (const auto &MI : MBB) {
+      if (MI.getHeapAllocMarker()) {
+        requestLabelBeforeInsn(&MI);
+        requestLabelAfterInsn(&MI);
+      }
+    }
+  }
 }
 
 static bool shouldEmitUdt(const DIType *T) {
@@ -2888,8 +2892,18 @@ void CodeViewDebug::endFunctionImpl(const MachineFunct
     return;
   }
 
+  // Find heap alloc sites and add to list.
+  for (const auto &MBB : *MF) {
+    for (const auto &MI : MBB) {
+      if (MDNode *MD = MI.getHeapAllocMarker()) {
+        CurFn->HeapAllocSites.push_back(std::make_tuple(getLabelBeforeInsn(&MI),
+                                                        getLabelAfterInsn(&MI),
+                                                        dyn_cast<DIType>(MD)));
+      }
+    }
+  }
+
   CurFn->Annotations = MF->getCodeViewAnnotations();
-  CurFn->HeapAllocSites = MF->getCodeViewHeapAllocSites();
 
   CurFn->End = Asm->getFunctionEnd();
 

Modified: vendor/llvm-project/release-9.x/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
==============================================================================
--- vendor/llvm-project/release-9.x/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h	Fri Dec 20 21:55:13 2019	(r355961)
@@ -148,7 +148,8 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public D
     SmallVector<LexicalBlock *, 1> ChildBlocks;
 
     std::vector<std::pair<MCSymbol *, MDNode *>> Annotations;
-    std::vector<std::tuple<MCSymbol *, MCSymbol *, DIType *>> HeapAllocSites;
+    std::vector<std::tuple<const MCSymbol *, const MCSymbol *, const DIType *>>
+        HeapAllocSites;
 
     const MCSymbol *Begin = nullptr;
     const MCSymbol *End = nullptr;

Modified: vendor/llvm-project/release-9.x/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
==============================================================================
--- vendor/llvm-project/release-9.x/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp	Fri Dec 20 21:45:20 2019	(r355960)
+++ vendor/llvm-project/release-9.x/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp	Fri Dec 20 21:55:13 2019	(r355961)
@@ -588,8 +588,8 @@ void IRTranslator::emitSwitchCase(SwitchCG::CaseBlock 
     Register CondRHS = getOrCreateVReg(*CB.CmpRHS);
     Cond = MIB.buildICmp(CB.PredInfo.Pred, i1Ty, CondLHS, CondRHS).getReg(0);
   } else {
-    assert(CB.PredInfo.Pred == CmpInst::ICMP_ULE &&
-           "Can only handle ULE ranges");
+    assert(CB.PredInfo.Pred == CmpInst::ICMP_SLE &&
+           "Can only handle SLE ranges");
 
     const APInt& Low = cast<ConstantInt>(CB.CmpLHS)->getValue();
     const APInt& High = cast<ConstantInt>(CB.CmpRHS)->getValue();
@@ -598,7 +598,7 @@ void IRTranslator::emitSwitchCase(SwitchCG::CaseBlock 
     if (cast<ConstantInt>(CB.CmpLHS)->isMinValue(true)) {
       Register CondRHS = getOrCreateVReg(*CB.CmpRHS);
       Cond =
-          MIB.buildICmp(CmpInst::ICMP_ULE, i1Ty, CmpOpReg, CondRHS).getReg(0);
+          MIB.buildICmp(CmpInst::ICMP_SLE, i1Ty, CmpOpReg, CondRHS).getReg(0);
     } else {
       const LLT &CmpTy = MRI->getType(CmpOpReg);
       auto Sub = MIB.buildSub({CmpTy}, CmpOpReg, CondLHS);
@@ -728,7 +728,7 @@ bool IRTranslator::lowerSwitchRangeWorkItem(SwitchCG::
     MHS = nullptr;

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


More information about the svn-src-all mailing list