Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Dec 2017 21:22:50 +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: r327300 - in vendor/llvm/dist: bindings/go/llvm cmake cmake/modules docs include/llvm/Analysis include/llvm/BinaryFormat include/llvm/CodeGen include/llvm/IR include/llvm/ProfileData li...
Message-ID:  <201712282122.vBSLMoJK024103@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Thu Dec 28 21:22:49 2017
New Revision: 327300
URL: https://svnweb.freebsd.org/changeset/base/327300

Log:
  Vendor import of llvm trunk r321530:
  https://llvm.org/svn/llvm-project/llvm/trunk@321530

Added:
  vendor/llvm/dist/test/Analysis/Lint/noalias-byval.ll
  vendor/llvm/dist/test/Analysis/ScalarEvolution/truncate.ll
  vendor/llvm/dist/test/CodeGen/AArch64/combine-and-like.ll
  vendor/llvm/dist/test/MC/ELF/comdat-declaration-errors.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/PREFETCH-32.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/PREFETCH-64.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/RDPMC-32.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/RDPMC-64.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/RDRAND-32.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/RDRAND-64.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/RDSEED-32.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/RDSEED-64.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/RDTSCP-32.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/RDTSCP-64.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/RDWRFSGS-64.s   (contents, props changed)
  vendor/llvm/dist/test/MC/X86/x86_64-asm-match.s   (contents, props changed)
  vendor/llvm/dist/test/SafepointIRVerifier/from-same-relocation-in-phi-nodes.ll
  vendor/llvm/dist/test/ThinLTO/X86/Inputs/noinline.ll
  vendor/llvm/dist/test/ThinLTO/X86/noinline.ll
  vendor/llvm/dist/test/Transforms/InstCombine/extractelement.ll
  vendor/llvm/dist/test/Transforms/InstSimplify/extract-element.ll
  vendor/llvm/dist/test/Transforms/LoopUnroll/runtime-epilog-debuginfo.ll
  vendor/llvm/dist/test/Transforms/RewriteStatepointsForGC/check_traversal_order.ll
  vendor/llvm/dist/test/tools/llvm-readobj/Inputs/needed-libs.obj.coff-am64   (contents, props changed)
  vendor/llvm/dist/test/tools/llvm-readobj/coff-needed-libs.test
Deleted:
  vendor/llvm/dist/test/Transforms/MemCpyOpt/memcpy-invoke-memcpy.ll
  vendor/llvm/dist/test/Transforms/MemCpyOpt/merge-into-memset.ll
  vendor/llvm/dist/test/Transforms/MemCpyOpt/mixed-sizes.ll
  vendor/llvm/dist/test/Transforms/MemCpyOpt/nonlocal-memcpy-memcpy.ll
  vendor/llvm/dist/test/Transforms/SimplifyCFG/X86/if-conversion.ll
Modified:
  vendor/llvm/dist/bindings/go/llvm/ir_test.go
  vendor/llvm/dist/cmake/config-ix.cmake
  vendor/llvm/dist/cmake/modules/CheckAtomic.cmake
  vendor/llvm/dist/cmake/modules/CheckCompilerVersion.cmake
  vendor/llvm/dist/docs/ProgrammersManual.rst
  vendor/llvm/dist/include/llvm/Analysis/InstructionSimplify.h
  vendor/llvm/dist/include/llvm/Analysis/MemoryDependenceAnalysis.h
  vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfo.h
  vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfoImpl.h
  vendor/llvm/dist/include/llvm/BinaryFormat/COFF.h
  vendor/llvm/dist/include/llvm/CodeGen/BasicTTIImpl.h
  vendor/llvm/dist/include/llvm/IR/IntrinsicsAMDGPU.td
  vendor/llvm/dist/include/llvm/ProfileData/SampleProf.h
  vendor/llvm/dist/lib/Analysis/DemandedBits.cpp
  vendor/llvm/dist/lib/Analysis/InstructionSimplify.cpp
  vendor/llvm/dist/lib/Analysis/Lint.cpp
  vendor/llvm/dist/lib/Analysis/MemoryDependenceAnalysis.cpp
  vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp
  vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp
  vendor/llvm/dist/lib/Analysis/ScalarEvolutionExpander.cpp
  vendor/llvm/dist/lib/Analysis/TargetTransformInfo.cpp
  vendor/llvm/dist/lib/Analysis/ValueTracking.cpp
  vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  vendor/llvm/dist/lib/IR/SafepointIRVerifier.cpp
  vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp
  vendor/llvm/dist/lib/MC/MCParser/ELFAsmParser.cpp
  vendor/llvm/dist/lib/ProfileData/Coverage/CoverageMapping.cpp
  vendor/llvm/dist/lib/Support/ARMAttributeParser.cpp
  vendor/llvm/dist/lib/Support/CommandLine.cpp
  vendor/llvm/dist/lib/TableGen/Main.cpp
  vendor/llvm/dist/lib/Target/AArch64/AArch64InstrInfo.cpp
  vendor/llvm/dist/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
  vendor/llvm/dist/lib/Target/NVPTX/NVPTXMCExpr.cpp
  vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  vendor/llvm/dist/lib/Target/X86/AsmParser/X86AsmParser.cpp
  vendor/llvm/dist/lib/Target/X86/X86.td
  vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp
  vendor/llvm/dist/lib/Target/X86/X86ISelLowering.h
  vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td
  vendor/llvm/dist/lib/Target/X86/X86InstrSSE.td
  vendor/llvm/dist/lib/Transforms/IPO/SampleProfile.cpp
  vendor/llvm/dist/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
  vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCalls.cpp
  vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
  vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/GVNSink.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/MemCpyOptimizer.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  vendor/llvm/dist/lib/Transforms/Utils/LoopUnrollRuntime.cpp
  vendor/llvm/dist/lib/Transforms/Utils/SimplifyCFG.cpp
  vendor/llvm/dist/test/Analysis/DemandedBits/basic.ll
  vendor/llvm/dist/test/Analysis/DemandedBits/intrinsics.ll
  vendor/llvm/dist/test/CodeGen/AArch64/aarch64-combine-fmul-fsub.mir
  vendor/llvm/dist/test/CodeGen/X86/avx512-schedule.ll
  vendor/llvm/dist/test/CodeGen/X86/branch_instruction_and_target_split_perf_nops.mir
  vendor/llvm/dist/test/CodeGen/X86/combine-pmuldq.ll
  vendor/llvm/dist/test/CodeGen/X86/fdiv-combine.ll
  vendor/llvm/dist/test/CodeGen/X86/gather-addresses.ll
  vendor/llvm/dist/test/CodeGen/X86/masked_gather_scatter.ll
  vendor/llvm/dist/test/CodeGen/X86/setcc-combine.ll
  vendor/llvm/dist/test/CodeGen/X86/shrink_vmul.ll
  vendor/llvm/dist/test/CodeGen/X86/slow-pmulld.ll
  vendor/llvm/dist/test/CodeGen/X86/sse2-schedule.ll
  vendor/llvm/dist/test/MC/ARM/branch-disassemble.s
  vendor/llvm/dist/test/MC/X86/x86-64.s
  vendor/llvm/dist/test/SafepointIRVerifier/unrecorded-live-at-sp.ll
  vendor/llvm/dist/test/SafepointIRVerifier/uses-in-phi-nodes.ll
  vendor/llvm/dist/test/Transforms/InstCombine/X86/X86FsubCmpCombine.ll
  vendor/llvm/dist/test/Transforms/InstCombine/intrinsics.ll
  vendor/llvm/dist/test/Transforms/InstCombine/minmax-fold.ll
  vendor/llvm/dist/test/Transforms/InstCombine/minmax-fp.ll
  vendor/llvm/dist/test/Transforms/InstCombine/rem.ll
  vendor/llvm/dist/test/Transforms/LoopUnroll/runtime-loop1.ll
  vendor/llvm/dist/test/tools/llvm-cov/cov-comdat.test
  vendor/llvm/dist/test/tools/llvm-objdump/X86/hex-displacement.test
  vendor/llvm/dist/tools/dsymutil/CFBundle.cpp
  vendor/llvm/dist/tools/llvm-cov/CodeCoverage.cpp
  vendor/llvm/dist/tools/llvm-objdump/llvm-objdump.cpp
  vendor/llvm/dist/tools/llvm-readobj/COFFDumper.cpp
  vendor/llvm/dist/tools/llvm-readobj/ELFDumper.cpp
  vendor/llvm/dist/tools/yaml2obj/yaml2obj.cpp
  vendor/llvm/dist/unittests/Analysis/ScalarEvolutionTest.cpp
  vendor/llvm/dist/utils/TableGen/CodeGenDAGPatterns.cpp
  vendor/llvm/dist/utils/TableGen/DFAPacketizerEmitter.cpp
  vendor/llvm/dist/utils/TableGen/IntrinsicEmitter.cpp

Modified: vendor/llvm/dist/bindings/go/llvm/ir_test.go
==============================================================================
--- vendor/llvm/dist/bindings/go/llvm/ir_test.go	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/bindings/go/llvm/ir_test.go	Thu Dec 28 21:22:49 2017	(r327300)
@@ -142,7 +142,7 @@ func TestSubtypes(t *testing.T) {
 	int_pointer := PointerType(cont.Int32Type(), 0)
 	int_inner := int_pointer.Subtypes()
 	if len(int_inner) != 1 {
-		t.Errorf("Got size %d, though wanted 1")
+		t.Errorf("Got size %d, though wanted 1", len(int_inner))
 	}
 	if int_inner[0] != cont.Int32Type() {
 		t.Errorf("Expected int32 type")
@@ -151,7 +151,7 @@ func TestSubtypes(t *testing.T) {
 	st_pointer := cont.StructType([]Type{cont.Int32Type(), cont.Int8Type()}, false)
 	st_inner := st_pointer.Subtypes()
 	if len(st_inner) != 2 {
-		t.Errorf("Got size %d, though wanted 2")
+		t.Errorf("Got size %d, though wanted 2", len(int_inner))
 	}
 	if st_inner[0] != cont.Int32Type() {
 		t.Errorf("Expected first struct field to be int32")

Modified: vendor/llvm/dist/cmake/config-ix.cmake
==============================================================================
--- vendor/llvm/dist/cmake/config-ix.cmake	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/cmake/config-ix.cmake	Thu Dec 28 21:22:49 2017	(r327300)
@@ -17,7 +17,7 @@ include(HandleLLVMStdlib)
 
 if( UNIX AND NOT (BEOS OR HAIKU) )
   # Used by check_symbol_exists:
-  set(CMAKE_REQUIRED_LIBRARIES m)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES "m")
 endif()
 # x86_64 FreeBSD 9.2 requires libcxxrt to be specified explicitly.
 if( CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE" AND

Modified: vendor/llvm/dist/cmake/modules/CheckAtomic.cmake
==============================================================================
--- vendor/llvm/dist/cmake/modules/CheckAtomic.cmake	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/cmake/modules/CheckAtomic.cmake	Thu Dec 28 21:22:49 2017	(r327300)
@@ -8,7 +8,7 @@ INCLUDE(CheckLibraryExists)
 
 function(check_working_cxx_atomics varname)
   set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
   CHECK_CXX_SOURCE_COMPILES("
 #include <atomic>
 std::atomic<int> x;

Modified: vendor/llvm/dist/cmake/modules/CheckCompilerVersion.cmake
==============================================================================
--- vendor/llvm/dist/cmake/modules/CheckCompilerVersion.cmake	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/cmake/modules/CheckCompilerVersion.cmake	Thu Dec 28 21:22:49 2017	(r327300)
@@ -28,7 +28,7 @@ if(NOT DEFINED LLVM_COMPILER_CHECKED)
         # bug in libstdc++4.6 that is fixed in libstdc++4.7.
         set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
         set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
-        set(CMAKE_REQUIRED_FLAGS "-std=c++0x")
+        set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x")
         check_cxx_source_compiles("
 #include <atomic>
 std::atomic<float> x(0.0f);

Modified: vendor/llvm/dist/docs/ProgrammersManual.rst
==============================================================================
--- vendor/llvm/dist/docs/ProgrammersManual.rst	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/docs/ProgrammersManual.rst	Thu Dec 28 21:22:49 2017	(r327300)
@@ -1040,7 +1040,7 @@ line argument:
 
 .. code-block:: c++
 
-  DEBUG(errs() << "I am here!\n");
+  DEBUG(dbgs() << "I am here!\n");
 
 Then you can run your pass like this:
 
@@ -1076,10 +1076,10 @@ follows:
 .. code-block:: c++
 
   #define DEBUG_TYPE "foo"
-  DEBUG(errs() << "'foo' debug type\n");
+  DEBUG(dbgs() << "'foo' debug type\n");
   #undef  DEBUG_TYPE
   #define DEBUG_TYPE "bar"
-  DEBUG(errs() << "'bar' debug type\n"));
+  DEBUG(dbgs() << "'bar' debug type\n");
   #undef  DEBUG_TYPE
 
 Then you can run your pass like this:
@@ -1120,8 +1120,8 @@ preceding example could be written as:
 
 .. code-block:: c++
 
-  DEBUG_WITH_TYPE("foo", errs() << "'foo' debug type\n");
-  DEBUG_WITH_TYPE("bar", errs() << "'bar' debug type\n"));
+  DEBUG_WITH_TYPE("foo", dbgs() << "'foo' debug type\n");
+  DEBUG_WITH_TYPE("bar", dbgs() << "'bar' debug type\n");
 
 .. _Statistic:
 

Modified: vendor/llvm/dist/include/llvm/Analysis/InstructionSimplify.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Analysis/InstructionSimplify.h	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/include/llvm/Analysis/InstructionSimplify.h	Thu Dec 28 21:22:49 2017	(r327300)
@@ -197,6 +197,9 @@ Value *SimplifyBinOp(unsigned Opcode, Value *LHS, Valu
 Value *SimplifyFPBinOp(unsigned Opcode, Value *LHS, Value *RHS,
                        FastMathFlags FMF, const SimplifyQuery &Q);
 
+/// Given a callsite, fold the result or return null.
+Value *SimplifyCall(ImmutableCallSite CS, const SimplifyQuery &Q);
+
 /// Given a function and iterators over arguments, fold the result or return
 /// null.
 Value *SimplifyCall(ImmutableCallSite CS, Value *V, User::op_iterator ArgBegin,

Modified: vendor/llvm/dist/include/llvm/Analysis/MemoryDependenceAnalysis.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Analysis/MemoryDependenceAnalysis.h	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/include/llvm/Analysis/MemoryDependenceAnalysis.h	Thu Dec 28 21:22:49 2017	(r327300)
@@ -407,12 +407,6 @@ class MemoryDependenceResults { (public)
   void getNonLocalPointerDependency(Instruction *QueryInst,
                                     SmallVectorImpl<NonLocalDepResult> &Result);
 
-  /// Perform a dependency query specifically for QueryInst's access to Loc.
-  /// The other comments for getNonLocalPointerDependency apply here as well.
-  void getNonLocalPointerDependencyFrom(Instruction *QueryInst,
-                                        const MemoryLocation &Loc, bool isLoad,
-                                        SmallVectorImpl<NonLocalDepResult> &Result);
-
   /// Removes an instruction from the dependence analysis, updating the
   /// dependence of instructions that previously depended on it.
   void removeInstruction(Instruction *InstToRemove);

Modified: vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfo.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfo.h	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfo.h	Thu Dec 28 21:22:49 2017	(r327300)
@@ -646,9 +646,6 @@ class TargetTransformInfo { (public)
   /// \brief Additional properties of an operand's values.
   enum OperandValueProperties { OP_None = 0, OP_PowerOf2 = 1 };
 
-  /// \return True if target can execute instructions out of order.
-  bool isOutOfOrder() const;
-
   /// \return The number of scalar or vector registers that the target has.
   /// If 'Vectors' is true, it returns the number of vector registers. If it is
   /// set to false, it returns the number of scalar registers.
@@ -1021,7 +1018,6 @@ class TargetTransformInfo::Concept { (public)
                             Type *Ty) = 0;
   virtual int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
                             Type *Ty) = 0;
-  virtual bool isOutOfOrder() const = 0;
   virtual unsigned getNumberOfRegisters(bool Vector) = 0;
   virtual unsigned getRegisterBitWidth(bool Vector) const = 0;
   virtual unsigned getMinVectorRegisterBitWidth() = 0;
@@ -1298,9 +1294,6 @@ class TargetTransformInfo::Model final : public Target
   int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
                     Type *Ty) override {
     return Impl.getIntImmCost(IID, Idx, Imm, Ty);
-  }
-  bool isOutOfOrder() const override {
-    return Impl.isOutOfOrder();
   }
   unsigned getNumberOfRegisters(bool Vector) override {
     return Impl.getNumberOfRegisters(Vector);

Modified: vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfoImpl.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfoImpl.h	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfoImpl.h	Thu Dec 28 21:22:49 2017	(r327300)
@@ -337,8 +337,6 @@ class TargetTransformInfoImplBase { (public)
     return TTI::TCC_Free;
   }
 
-  bool isOutOfOrder() const { return false; }
-
   unsigned getNumberOfRegisters(bool Vector) { return 8; }
 
   unsigned getRegisterBitWidth(bool Vector) const { return 32; }

Modified: vendor/llvm/dist/include/llvm/BinaryFormat/COFF.h
==============================================================================
--- vendor/llvm/dist/include/llvm/BinaryFormat/COFF.h	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/include/llvm/BinaryFormat/COFF.h	Thu Dec 28 21:22:49 2017	(r327300)
@@ -95,7 +95,7 @@ enum MachineTypes : unsigned {
   MT_Invalid = 0xffff,
 
   IMAGE_FILE_MACHINE_UNKNOWN = 0x0,
-  IMAGE_FILE_MACHINE_AM33 = 0x13,
+  IMAGE_FILE_MACHINE_AM33 = 0x1D3,
   IMAGE_FILE_MACHINE_AMD64 = 0x8664,
   IMAGE_FILE_MACHINE_ARM = 0x1C0,
   IMAGE_FILE_MACHINE_ARMNT = 0x1C4,

Modified: vendor/llvm/dist/include/llvm/CodeGen/BasicTTIImpl.h
==============================================================================
--- vendor/llvm/dist/include/llvm/CodeGen/BasicTTIImpl.h	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/include/llvm/CodeGen/BasicTTIImpl.h	Thu Dec 28 21:22:49 2017	(r327300)
@@ -402,10 +402,6 @@ class BasicTTIImplBase : public TargetTransformInfoImp
     return BaseT::getInstructionLatency(I);
   }
 
-  bool isOutOfOrder() const {
-    return getST()->getSchedModel().isOutOfOrder();
-  }
-
   /// @}
 
   /// \name Vector TTI Implementations

Modified: vendor/llvm/dist/include/llvm/IR/IntrinsicsAMDGPU.td
==============================================================================
--- vendor/llvm/dist/include/llvm/IR/IntrinsicsAMDGPU.td	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/include/llvm/IR/IntrinsicsAMDGPU.td	Thu Dec 28 21:22:49 2017	(r327300)
@@ -288,7 +288,8 @@ class AMDGPUAtomicIncIntrin : Intrinsic<[llvm_anyint_t
   llvm_i32_ty, // ordering
   llvm_i32_ty, // scope
   llvm_i1_ty], // isVolatile
-  [IntrArgMemOnly, NoCapture<0>]
+  [IntrArgMemOnly, NoCapture<0>], "",
+  [SDNPMemOperand]
 >;
 
 def int_amdgcn_atomic_inc : AMDGPUAtomicIncIntrin;

Modified: vendor/llvm/dist/include/llvm/ProfileData/SampleProf.h
==============================================================================
--- vendor/llvm/dist/include/llvm/ProfileData/SampleProf.h	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/include/llvm/ProfileData/SampleProf.h	Thu Dec 28 21:22:49 2017	(r327300)
@@ -226,8 +226,8 @@ class FunctionSamples { (public)
 
   sampleprof_error addCalledTargetSamples(uint32_t LineOffset,
                                           uint32_t Discriminator,
-                                          const std::string &FName,
-                                          uint64_t Num, uint64_t Weight = 1) {
+                                          StringRef FName, uint64_t Num,
+                                          uint64_t Weight = 1) {
     return BodySamples[LineLocation(LineOffset, Discriminator)].addCalledTarget(
         FName, Num, Weight);
   }

Modified: vendor/llvm/dist/lib/Analysis/DemandedBits.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/DemandedBits.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Analysis/DemandedBits.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -385,8 +385,8 @@ bool DemandedBits::isInstructionDead(Instruction *I) {
 void DemandedBits::print(raw_ostream &OS) {
   performAnalysis();
   for (auto &KV : AliveBits) {
-    OS << "DemandedBits: 0x" << utohexstr(KV.second.getLimitedValue()) << " for "
-       << *KV.first << "\n";
+    OS << "DemandedBits: 0x" << Twine::utohexstr(KV.second.getLimitedValue())
+       << " for " << *KV.first << '\n';
   }
 }
 

Modified: vendor/llvm/dist/lib/Analysis/InstructionSimplify.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/InstructionSimplify.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Analysis/InstructionSimplify.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -3897,8 +3897,9 @@ static Value *SimplifyExtractElementInst(Value *Vec, V
   // If extracting a specified index from the vector, see if we can recursively
   // find a previously computed scalar that was inserted into the vector.
   if (auto *IdxC = dyn_cast<ConstantInt>(Idx))
-    if (Value *Elt = findScalarElement(Vec, IdxC->getZExtValue()))
-      return Elt;
+    if (IdxC->getValue().ule(Vec->getType()->getVectorNumElements()))
+      if (Value *Elt = findScalarElement(Vec, IdxC->getZExtValue()))
+        return Elt;
 
   // An undef extract index can be arbitrarily chosen to be an out-of-range
   // index value, which would result in the instruction being undef.
@@ -4494,6 +4495,22 @@ static Value *SimplifyIntrinsic(Function *F, IterTy Ar
         return *ArgBegin;
       return nullptr;
     }
+    case Intrinsic::bswap: {
+      Value *IIOperand = *ArgBegin;
+      Value *X = nullptr;
+      // bswap(bswap(x)) -> x
+      if (match(IIOperand, m_BSwap(m_Value(X))))
+        return X;
+      return nullptr;
+    }
+    case Intrinsic::bitreverse: {
+      Value *IIOperand = *ArgBegin;
+      Value *X = nullptr;
+      // bitreverse(bitreverse(x)) -> x
+      if (match(IIOperand, m_BitReverse(m_Value(X))))
+        return X;
+      return nullptr;
+    }
     default:
       return nullptr;
     }
@@ -4548,6 +4565,16 @@ static Value *SimplifyIntrinsic(Function *F, IterTy Ar
         return SimplifyRelativeLoad(C0, C1, Q.DL);
       return nullptr;
     }
+    case Intrinsic::powi:
+      if (ConstantInt *Power = dyn_cast<ConstantInt>(RHS)) {
+        // powi(x, 0) -> 1.0
+        if (Power->isZero())
+          return ConstantFP::get(LHS->getType(), 1.0);
+        // powi(x, 1) -> x
+        if (Power->isOne())
+          return LHS;
+      }
+      return nullptr;
     default:
       return nullptr;
     }
@@ -4616,6 +4643,12 @@ Value *llvm::SimplifyCall(ImmutableCallSite CS, Value 
   return ::SimplifyCall(CS, V, Args.begin(), Args.end(), Q, RecursionLimit);
 }
 
+Value *llvm::SimplifyCall(ImmutableCallSite ICS, const SimplifyQuery &Q) {
+  CallSite CS(const_cast<Instruction*>(ICS.getInstruction()));
+  return ::SimplifyCall(CS, CS.getCalledValue(), CS.arg_begin(), CS.arg_end(),
+                        Q, RecursionLimit);
+}
+
 /// See if we can compute a simplified version of this instruction.
 /// If not, this returns null.
 
@@ -4750,8 +4783,7 @@ Value *llvm::SimplifyInstruction(Instruction *I, const
     break;
   case Instruction::Call: {
     CallSite CS(cast<CallInst>(I));
-    Result = SimplifyCall(CS, CS.getCalledValue(), CS.arg_begin(), CS.arg_end(),
-                          Q);
+    Result = SimplifyCall(CS, Q);
     break;
   }
 #define HANDLE_CAST_INST(num, opc, clas) case Instruction::opc:

Modified: vendor/llvm/dist/lib/Analysis/Lint.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/Lint.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Analysis/Lint.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -265,13 +265,21 @@ void Lint::visitCallSite(CallSite CS) {
         // Check that noalias arguments don't alias other arguments. This is
         // not fully precise because we don't know the sizes of the dereferenced
         // memory regions.
-        if (Formal->hasNoAliasAttr() && Actual->getType()->isPointerTy())
-          for (CallSite::arg_iterator BI = CS.arg_begin(); BI != AE; ++BI)
+        if (Formal->hasNoAliasAttr() && Actual->getType()->isPointerTy()) {
+          AttributeList PAL = CS.getAttributes();
+          unsigned ArgNo = 0;
+          for (CallSite::arg_iterator BI = CS.arg_begin(); BI != AE; ++BI) {
+            // Skip ByVal arguments since they will be memcpy'd to the callee's
+            // stack so we're not really passing the pointer anyway.
+            if (PAL.hasParamAttribute(ArgNo++, Attribute::ByVal))
+              continue;
             if (AI != BI && (*BI)->getType()->isPointerTy()) {
               AliasResult Result = AA->alias(*AI, *BI);
               Assert(Result != MustAlias && Result != PartialAlias,
                      "Unusual: noalias argument aliases another argument", &I);
             }
+          }
+        }
 
         // Check that an sret argument points to valid memory.
         if (Formal->hasStructRetAttr() && Actual->getType()->isPointerTy()) {

Modified: vendor/llvm/dist/lib/Analysis/MemoryDependenceAnalysis.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/MemoryDependenceAnalysis.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Analysis/MemoryDependenceAnalysis.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -920,14 +920,6 @@ void MemoryDependenceResults::getNonLocalPointerDepend
     Instruction *QueryInst, SmallVectorImpl<NonLocalDepResult> &Result) {
   const MemoryLocation Loc = MemoryLocation::get(QueryInst);
   bool isLoad = isa<LoadInst>(QueryInst);
-  return getNonLocalPointerDependencyFrom(QueryInst, Loc, isLoad, Result);
-}
-
-void MemoryDependenceResults::getNonLocalPointerDependencyFrom(
-    Instruction *QueryInst,
-    const MemoryLocation &Loc,
-    bool isLoad,
-    SmallVectorImpl<NonLocalDepResult> &Result) {
   BasicBlock *FromBB = QueryInst->getParent();
   assert(FromBB);
 
@@ -1127,15 +1119,21 @@ bool MemoryDependenceResults::getNonLocalPointerDepFro
   // If we already have a cache entry for this CacheKey, we may need to do some
   // work to reconcile the cache entry and the current query.
   if (!Pair.second) {
-    if (CacheInfo->Size != Loc.Size) {
-      // The query's Size differs from the cached one. Throw out the
-      // cached data and proceed with the query at the new size.
+    if (CacheInfo->Size < Loc.Size) {
+      // The query's Size is greater than the cached one. Throw out the
+      // cached data and proceed with the query at the greater size.
       CacheInfo->Pair = BBSkipFirstBlockPair();
       CacheInfo->Size = Loc.Size;
       for (auto &Entry : CacheInfo->NonLocalDeps)
         if (Instruction *Inst = Entry.getResult().getInst())
           RemoveFromReverseMap(ReverseNonLocalPtrDeps, Inst, CacheKey);
       CacheInfo->NonLocalDeps.clear();
+    } else if (CacheInfo->Size > Loc.Size) {
+      // This query's Size is less than the cached one. Conservatively restart
+      // the query using the greater size.
+      return getNonLocalPointerDepFromBB(
+          QueryInst, Pointer, Loc.getWithNewSize(CacheInfo->Size), isLoad,
+          StartBB, Result, Visited, SkipFirstBlock);
     }
 
     // If the query's AATags are inconsistent with the cached one,

Modified: vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -306,7 +306,9 @@ computeFunctionSummary(ModuleSummaryIndex &Index, cons
       NonRenamableLocal || HasInlineAsmMaybeReferencingInternal ||
       // Inliner doesn't handle variadic functions.
       // FIXME: refactor this to use the same code that inliner is using.
-      F.isVarArg();
+      F.isVarArg() ||
+      // Don't try to import functions with noinline attribute.
+      F.getAttributes().hasFnAttribute(Attribute::NoInline);
   GlobalValueSummary::GVFlags Flags(F.getLinkage(), NotEligibleForImport,
                                     /* Live = */ false, F.isDSOLocal());
   FunctionSummary::FFlags FunFlags{

Modified: vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -1268,7 +1268,11 @@ const SCEV *ScalarEvolution::getTruncateExpr(const SCE
     }
     if (!hasTrunc)
       return getAddExpr(Operands);
-    UniqueSCEVs.FindNodeOrInsertPos(ID, IP);  // Mutates IP, returns NULL.
+    // In spite we checked in the beginning that ID is not in the cache,
+    // it is possible that during recursion and different modification
+    // ID came to cache, so if we found it, just return it.
+    if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP))
+      return S;
   }
 
   // trunc(x1*x2*...*xN) --> trunc(x1)*trunc(x2)*...*trunc(xN) if we can
@@ -1284,7 +1288,11 @@ const SCEV *ScalarEvolution::getTruncateExpr(const SCE
     }
     if (!hasTrunc)
       return getMulExpr(Operands);
-    UniqueSCEVs.FindNodeOrInsertPos(ID, IP);  // Mutates IP, returns NULL.
+    // In spite we checked in the beginning that ID is not in the cache,
+    // it is possible that during recursion and different modification
+    // ID came to cache, so if we found it, just return it.
+    if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP))
+      return S;
   }
 
   // If the input value is a chrec scev, truncate the chrec's operands.

Modified: vendor/llvm/dist/lib/Analysis/ScalarEvolutionExpander.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/ScalarEvolutionExpander.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Analysis/ScalarEvolutionExpander.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -187,8 +187,21 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOp
       // generated code.
       if (isa<DbgInfoIntrinsic>(IP))
         ScanLimit++;
+
+      // Conservatively, do not use any instruction which has any of wrap/exact
+      // flags installed.
+      // TODO: Instead of simply disable poison instructions we can be clever
+      //       here and match SCEV to this instruction.
+      auto canGeneratePoison = [](Instruction *I) {
+        if (isa<OverflowingBinaryOperator>(I) &&
+            (I->hasNoSignedWrap() || I->hasNoUnsignedWrap()))
+          return true;
+        if (isa<PossiblyExactOperator>(I) && I->isExact())
+          return true;
+        return false;
+      };
       if (IP->getOpcode() == (unsigned)Opcode && IP->getOperand(0) == LHS &&
-          IP->getOperand(1) == RHS)
+          IP->getOperand(1) == RHS && !canGeneratePoison(&*IP))
         return &*IP;
       if (IP == BlockBegin) break;
     }

Modified: vendor/llvm/dist/lib/Analysis/TargetTransformInfo.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/TargetTransformInfo.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Analysis/TargetTransformInfo.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -314,10 +314,6 @@ int TargetTransformInfo::getIntImmCost(Intrinsic::ID I
   return Cost;
 }
 
-bool TargetTransformInfo::isOutOfOrder() const {
-  return TTIImpl->isOutOfOrder();
-}
-
 unsigned TargetTransformInfo::getNumberOfRegisters(bool Vector) const {
   return TTIImpl->getNumberOfRegisters(Vector);
 }

Modified: vendor/llvm/dist/lib/Analysis/ValueTracking.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/ValueTracking.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Analysis/ValueTracking.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -4238,14 +4238,14 @@ static SelectPatternResult matchSelectPattern(CmpInst:
   LHS = CmpLHS;
   RHS = CmpRHS;
 
-  // If the predicate is an "or-equal"  (FP) predicate, then signed zeroes may
-  // return inconsistent results between implementations.
-  //   (0.0 <= -0.0) ? 0.0 : -0.0 // Returns 0.0
-  //   minNum(0.0, -0.0)          // May return -0.0 or 0.0 (IEEE 754-2008 5.3.1)
-  // Therefore we behave conservatively and only proceed if at least one of the
-  // operands is known to not be zero, or if we don't care about signed zeroes.
+  // Signed zero may return inconsistent results between implementations.
+  //  (0.0 <= -0.0) ? 0.0 : -0.0 // Returns 0.0
+  //  minNum(0.0, -0.0)          // May return -0.0 or 0.0 (IEEE 754-2008 5.3.1)
+  // Therefore, we behave conservatively and only proceed if at least one of the
+  // operands is known to not be zero or if we don't care about signed zero.
   switch (Pred) {
   default: break;
+  // FIXME: Include OGT/OLT/UGT/ULT.
   case CmpInst::FCMP_OGE: case CmpInst::FCMP_OLE:
   case CmpInst::FCMP_UGE: case CmpInst::FCMP_ULE:
     if (!FMF.noSignedZeros() && !isKnownNonZero(CmpLHS) &&
@@ -4493,14 +4493,24 @@ SelectPatternResult llvm::matchSelectPattern(Value *V,
 
   // Deal with type mismatches.
   if (CastOp && CmpLHS->getType() != TrueVal->getType()) {
-    if (Value *C = lookThroughCast(CmpI, TrueVal, FalseVal, CastOp))
+    if (Value *C = lookThroughCast(CmpI, TrueVal, FalseVal, CastOp)) {
+      // If this is a potential fmin/fmax with a cast to integer, then ignore
+      // -0.0 because there is no corresponding integer value.
+      if (*CastOp == Instruction::FPToSI || *CastOp == Instruction::FPToUI)
+        FMF.setNoSignedZeros();
       return ::matchSelectPattern(Pred, FMF, CmpLHS, CmpRHS,
                                   cast<CastInst>(TrueVal)->getOperand(0), C,
                                   LHS, RHS);
-    if (Value *C = lookThroughCast(CmpI, FalseVal, TrueVal, CastOp))
+    }
+    if (Value *C = lookThroughCast(CmpI, FalseVal, TrueVal, CastOp)) {
+      // If this is a potential fmin/fmax with a cast to integer, then ignore
+      // -0.0 because there is no corresponding integer value.
+      if (*CastOp == Instruction::FPToSI || *CastOp == Instruction::FPToUI)
+        FMF.setNoSignedZeros();
       return ::matchSelectPattern(Pred, FMF, CmpLHS, CmpRHS,
                                   C, cast<CastInst>(FalseVal)->getOperand(0),
                                   LHS, RHS);
+    }
   }
   return ::matchSelectPattern(Pred, FMF, CmpLHS, CmpRHS, TrueVal, FalseVal,
                               LHS, RHS);

Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
==============================================================================
--- vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -1922,14 +1922,16 @@ SDValue DAGCombiner::foldBinOpIntoSelect(SDNode *BO) {
   EVT VT = Sel.getValueType();
   SDLoc DL(Sel);
   SDValue NewCT = DAG.getNode(BinOpcode, DL, VT, CT, C1);
-  assert((NewCT.isUndef() || isConstantOrConstantVector(NewCT) ||
-          isConstantFPBuildVectorOrConstantFP(NewCT)) &&
-         "Failed to constant fold a binop with constant operands");
+  if (!NewCT.isUndef() &&
+      !isConstantOrConstantVector(NewCT, true) &&
+      !isConstantFPBuildVectorOrConstantFP(NewCT))
+    return SDValue();
 
   SDValue NewCF = DAG.getNode(BinOpcode, DL, VT, CF, C1);
-  assert((NewCF.isUndef() || isConstantOrConstantVector(NewCF) ||
-          isConstantFPBuildVectorOrConstantFP(NewCF)) &&
-         "Failed to constant fold a binop with constant operands");
+  if (!NewCF.isUndef() &&
+      !isConstantOrConstantVector(NewCF, true) &&
+      !isConstantFPBuildVectorOrConstantFP(NewCF))
+    return SDValue();
 
   return DAG.getSelect(DL, VT, Sel.getOperand(0), NewCT, NewCF);
 }
@@ -3577,7 +3579,8 @@ SDValue DAGCombiner::foldLogicOfSetCCs(bool IsAnd, SDV
 
   // TODO: What is the 'or' equivalent of this fold?
   // (and (setne X, 0), (setne X, -1)) --> (setuge (add X, 1), 2)
-  if (IsAnd && LL == RL && CC0 == CC1 && IsInteger && CC0 == ISD::SETNE &&
+  if (IsAnd && LL == RL && CC0 == CC1 && OpVT.getScalarSizeInBits() > 1 &&
+      IsInteger && CC0 == ISD::SETNE &&
       ((isNullConstant(LR) && isAllOnesConstant(RR)) ||
        (isAllOnesConstant(LR) && isNullConstant(RR)))) {
     SDValue One = DAG.getConstant(1, DL, OpVT);
@@ -3641,15 +3644,18 @@ SDValue DAGCombiner::visitANDLike(SDValue N0, SDValue 
   if (N0.getOpcode() == ISD::ADD && N1.getOpcode() == ISD::SRL &&
       VT.getSizeInBits() <= 64) {
     if (ConstantSDNode *ADDI = dyn_cast<ConstantSDNode>(N0.getOperand(1))) {
-      APInt ADDC = ADDI->getAPIntValue();
-      if (!TLI.isLegalAddImmediate(ADDC.getSExtValue())) {
+      if (ConstantSDNode *SRLI = dyn_cast<ConstantSDNode>(N1.getOperand(1))) {
         // Look for (and (add x, c1), (lshr y, c2)). If C1 wasn't a legal
         // immediate for an add, but it is legal if its top c2 bits are set,
         // transform the ADD so the immediate doesn't need to be materialized
         // in a register.
-        if (ConstantSDNode *SRLI = dyn_cast<ConstantSDNode>(N1.getOperand(1))) {
+        APInt ADDC = ADDI->getAPIntValue();
+        APInt SRLC = SRLI->getAPIntValue();
+        if (ADDC.getMinSignedBits() <= 64 &&
+            SRLC.ult(VT.getSizeInBits()) &&
+            !TLI.isLegalAddImmediate(ADDC.getSExtValue())) {
           APInt Mask = APInt::getHighBitsSet(VT.getSizeInBits(),
-                                             SRLI->getZExtValue());
+                                             SRLC.getZExtValue());
           if (DAG.MaskedValueIsZero(N0.getOperand(1), Mask)) {
             ADDC |= Mask;
             if (TLI.isLegalAddImmediate(ADDC.getSExtValue())) {

Modified: vendor/llvm/dist/lib/IR/SafepointIRVerifier.cpp
==============================================================================
--- vendor/llvm/dist/lib/IR/SafepointIRVerifier.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/IR/SafepointIRVerifier.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -237,6 +237,59 @@ class InstructionVerifier;
 /// Builds BasicBlockState for each BB of the function.
 /// It can traverse function for verification and provides all required
 /// information.
+///
+/// GC pointer may be in one of three states: relocated, unrelocated and
+/// poisoned.
+/// Relocated pointer may be used without any restrictions.
+/// Unrelocated pointer cannot be dereferenced, passed as argument to any call
+/// or returned. Unrelocated pointer may be safely compared against another
+/// unrelocated pointer or against a pointer exclusively derived from null.
+/// Poisoned pointers are produced when we somehow derive pointer from relocated
+/// and unrelocated pointers (e.g. phi, select). This pointers may be safely
+/// used in a very limited number of situations. Currently the only way to use
+/// it is comparison against constant exclusively derived from null. All
+/// limitations arise due to their undefined state: this pointers should be
+/// treated as relocated and unrelocated simultaneously.
+/// Rules of deriving:
+/// R + U = P - that's where the poisoned pointers come from
+/// P + X = P
+/// U + U = U
+/// R + R = R
+/// X + C = X
+/// Where "+" - any operation that somehow derive pointer, U - unrelocated,
+/// R - relocated and P - poisoned, C - constant, X - U or R or P or C or
+/// nothing (in case when "+" is unary operation).
+/// Deriving of pointers by itself is always safe.
+/// NOTE: when we are making decision on the status of instruction's result:
+/// a) for phi we need to check status of each input *at the end of
+///    corresponding predecessor BB*.
+/// b) for other instructions we need to check status of each input *at the
+///    current point*.
+///
+/// FIXME: This works fairly well except one case
+///     bb1:
+///     p = *some GC-ptr def*
+///     p1 = gep p, offset
+///         /     |
+///        /      |
+///    bb2:       |
+///    safepoint  |
+///        \      |
+///         \     |
+///      bb3:
+///      p2 = phi [p, bb2] [p1, bb1]
+///      p3 = phi [p, bb2] [p, bb1]
+///      here p and p1 is unrelocated
+///           p2 and p3 is poisoned (though they shouldn't be)
+///
+/// This leads to some weird results:
+///      cmp eq p, p2 - illegal instruction (false-positive)
+///      cmp eq p1, p2 - illegal instruction (false-positive)
+///      cmp eq p, p3 - illegal instruction (false-positive)
+///      cmp eq p, p1 - ok
+/// To fix this we need to introduce conception of generations and be able to
+/// check if two values belong to one generation or not. This way p2 will be
+/// considered to be unrelocated and no false alarm will happen.
 class GCPtrTracker {
   const Function &F;
   SpecificBumpPtrAllocator<BasicBlockState> BSAllocator;
@@ -244,6 +297,9 @@ class GCPtrTracker {
   // This set contains defs of unrelocated pointers that are proved to be legal
   // and don't need verification.
   DenseSet<const Instruction *> ValidUnrelocatedDefs;
+  // This set contains poisoned defs. They can be safely ignored during
+  // verification too.
+  DenseSet<const Value *> PoisonedDefs;
 
 public:
   GCPtrTracker(const Function &F, const DominatorTree &DT);
@@ -251,6 +307,8 @@ class GCPtrTracker {
   BasicBlockState *getBasicBlockState(const BasicBlock *BB);
   const BasicBlockState *getBasicBlockState(const BasicBlock *BB) const;
 
+  bool isValuePoisoned(const Value *V) const { return PoisonedDefs.count(V); }
+
   /// Traverse each BB of the function and call
   /// InstructionVerifier::verifyInstruction for each possibly invalid
   /// instruction.
@@ -349,7 +407,9 @@ const BasicBlockState *GCPtrTracker::getBasicBlockStat
 }
 
 bool GCPtrTracker::instructionMayBeSkipped(const Instruction *I) const {
-  return ValidUnrelocatedDefs.count(I);
+  // Poisoned defs are skipped since they are always safe by itself by
+  // definition (for details see comment to this class).
+  return ValidUnrelocatedDefs.count(I) || PoisonedDefs.count(I);
 }
 
 void GCPtrTracker::verifyFunction(GCPtrTracker &&Tracker,
@@ -418,31 +478,78 @@ bool GCPtrTracker::removeValidUnrelocatedDefs(const Ba
          "Passed Contribution should be from the passed BasicBlockState!");
   AvailableValueSet AvailableSet = BBS->AvailableIn;
   bool ContributionChanged = false;
+  // For explanation why instructions are processed this way see
+  // "Rules of deriving" in the comment to this class.
   for (const Instruction &I : *BB) {
-    bool ProducesUnrelocatedPointer = false;
-    if ((isa<GetElementPtrInst>(I) || isa<BitCastInst>(I)) &&
-        containsGCPtrType(I.getType())) {
-      // GEP/bitcast of unrelocated pointer is legal by itself but this
-      // def shouldn't appear in any AvailableSet.
+    bool ValidUnrelocatedPointerDef = false;
+    bool PoisonedPointerDef = false;
+    // TODO: `select` instructions should be handled here too.
+    if (const PHINode *PN = dyn_cast<PHINode>(&I)) {
+      if (containsGCPtrType(PN->getType())) {
+        // If both is true, output is poisoned.
+        bool HasRelocatedInputs = false;
+        bool HasUnrelocatedInputs = false;
+        for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
+          const BasicBlock *InBB = PN->getIncomingBlock(i);
+          const Value *InValue = PN->getIncomingValue(i);
+
+          if (isNotExclusivelyConstantDerived(InValue)) {
+            if (isValuePoisoned(InValue)) {
+              // If any of inputs is poisoned, output is always poisoned too.
+              HasRelocatedInputs = true;
+              HasUnrelocatedInputs = true;
+              break;
+            }
+            if (BlockMap[InBB]->AvailableOut.count(InValue))
+              HasRelocatedInputs = true;
+            else
+              HasUnrelocatedInputs = true;
+          }
+        }
+        if (HasUnrelocatedInputs) {
+          if (HasRelocatedInputs)
+            PoisonedPointerDef = true;
+          else
+            ValidUnrelocatedPointerDef = true;
+        }
+      }
+    } else if ((isa<GetElementPtrInst>(I) || isa<BitCastInst>(I)) &&
+               containsGCPtrType(I.getType())) {
+      // GEP/bitcast of unrelocated pointer is legal by itself but this def
+      // shouldn't appear in any AvailableSet.
       for (const Value *V : I.operands())
         if (containsGCPtrType(V->getType()) &&
             isNotExclusivelyConstantDerived(V) && !AvailableSet.count(V)) {
-          ProducesUnrelocatedPointer = true;
+          if (isValuePoisoned(V))
+            PoisonedPointerDef = true;
+          else
+            ValidUnrelocatedPointerDef = true;
           break;
         }
     }
-    if (!ProducesUnrelocatedPointer) {
-      bool Cleared = false;
-      transferInstruction(I, Cleared, AvailableSet);
-      (void)Cleared;
-    } else {
-      // Remove def of unrelocated pointer from Contribution of this BB
-      // and trigger update of all its successors.
+    assert(!(ValidUnrelocatedPointerDef && PoisonedPointerDef) &&
+           "Value cannot be both unrelocated and poisoned!");
+    if (ValidUnrelocatedPointerDef) {
+      // Remove def of unrelocated pointer from Contribution of this BB and
+      // trigger update of all its successors.
       Contribution.erase(&I);
+      PoisonedDefs.erase(&I);
       ValidUnrelocatedDefs.insert(&I);
-      DEBUG(dbgs() << "Removing " << I << " from Contribution of "
+      DEBUG(dbgs() << "Removing urelocated " << I << " from Contribution of "
                    << BB->getName() << "\n");
       ContributionChanged = true;
+    } else if (PoisonedPointerDef) {
+      // Mark pointer as poisoned, remove its def from Contribution and trigger
+      // update of all successors.
+      Contribution.erase(&I);
+      PoisonedDefs.insert(&I);
+      DEBUG(dbgs() << "Removing poisoned " << I << " from Contribution of "
+                   << BB->getName() << "\n");
+      ContributionChanged = true;
+    } else {
+      bool Cleared = false;
+      transferInstruction(I, Cleared, AvailableSet);
+      (void)Cleared;
     }
   }
   return ContributionChanged;
@@ -524,8 +631,8 @@ void InstructionVerifier::verifyInstruction(
 
     // Returns true if LHS and RHS are unrelocated pointers and they are
     // valid unrelocated uses.
-    auto hasValidUnrelocatedUse = [&AvailableSet, baseTyLHS, baseTyRHS, &LHS,
-                                   &RHS] () {
+    auto hasValidUnrelocatedUse = [&AvailableSet, Tracker, baseTyLHS, baseTyRHS,
+                                   &LHS, &RHS] () {
         // A cmp instruction has valid unrelocated pointer operands only if
         // both operands are unrelocated pointers.
         // In the comparison between two pointers, if one is an unrelocated
@@ -545,12 +652,23 @@ void InstructionVerifier::verifyInstruction(
             (baseTyLHS == BaseType::NonConstant &&
              baseTyRHS == BaseType::ExclusivelySomeConstant))
           return false;
+
+        // If one of pointers is poisoned and other is not exclusively derived
+        // from null it is an invalid expression: it produces poisoned result
+        // and unless we want to track all defs (not only gc pointers) the only
+        // option is to prohibit such instructions.
+        if ((Tracker->isValuePoisoned(LHS) && baseTyRHS != ExclusivelyNull) ||
+            (Tracker->isValuePoisoned(RHS) && baseTyLHS != ExclusivelyNull))
+            return false;
+
         // All other cases are valid cases enumerated below:
-        // 1. Comparison between an exlusively derived null pointer and a
+        // 1. Comparison between an exclusively derived null pointer and a
         // constant base pointer.
-        // 2. Comparison between an exlusively derived null pointer and a
+        // 2. Comparison between an exclusively derived null pointer and a
         // non-constant unrelocated base pointer.
         // 3. Comparison between 2 unrelocated pointers.
+        // 4. Comparison between a pointer exclusively derived from null and a
+        // non-constant poisoned pointer.
         return true;
     };
     if (!hasValidUnrelocatedUse()) {

Modified: vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp
==============================================================================
--- vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -76,7 +76,7 @@ static void saveTempBitcode(const Module &TheModule, S
   if (TempDir.empty())
     return;
   // User asked to save temps, let dump the bitcode file after import.
-  std::string SaveTempPath = (TempDir + llvm::utostr(count) + Suffix).str();
+  std::string SaveTempPath = (TempDir + llvm::Twine(count) + Suffix).str();
   std::error_code EC;
   raw_fd_ostream OS(SaveTempPath, EC, sys::fs::F_None);
   if (EC)

Modified: vendor/llvm/dist/lib/MC/MCParser/ELFAsmParser.cpp
==============================================================================
--- vendor/llvm/dist/lib/MC/MCParser/ELFAsmParser.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/MC/MCParser/ELFAsmParser.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -427,13 +427,13 @@ bool ELFAsmParser::parseGroup(StringRef &GroupName) {
     GroupName = getTok().getString();
     Lex();
   } else if (getParser().parseIdentifier(GroupName)) {
-    return true;
+    return TokError("invalid group name");
   }
   if (L.is(AsmToken::Comma)) {
     Lex();
     StringRef Linkage;
     if (getParser().parseIdentifier(Linkage))
-      return true;
+      return TokError("invalid linkage");
     if (Linkage != "comdat")
       return TokError("Linkage must be 'comdat'");
   }

Modified: vendor/llvm/dist/lib/ProfileData/Coverage/CoverageMapping.cpp
==============================================================================
--- vendor/llvm/dist/lib/ProfileData/Coverage/CoverageMapping.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/ProfileData/Coverage/CoverageMapping.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -628,7 +628,7 @@ CoverageMapping::getInstantiationGroups(StringRef File
   }
 
   std::vector<InstantiationGroup> Result;
-  for (const auto &InstantiationSet : InstantiationSetCollector) {
+  for (auto &InstantiationSet : InstantiationSetCollector) {
     InstantiationGroup IG{InstantiationSet.first.first,
                           InstantiationSet.first.second,
                           std::move(InstantiationSet.second)};

Modified: vendor/llvm/dist/lib/Support/ARMAttributeParser.cpp
==============================================================================
--- vendor/llvm/dist/lib/Support/ARMAttributeParser.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Support/ARMAttributeParser.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -666,7 +666,7 @@ void ARMAttributeParser::ParseSubsection(const uint8_t
       ParseIndexList(Data, Offset, Indicies);
       break;
     default:
-      errs() << "unrecognised tag: 0x" << utohexstr(Tag) << '\n';
+      errs() << "unrecognised tag: 0x" << Twine::utohexstr(Tag) << '\n';
       return;
     }
 

Modified: vendor/llvm/dist/lib/Support/CommandLine.cpp
==============================================================================
--- vendor/llvm/dist/lib/Support/CommandLine.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Support/CommandLine.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -688,7 +688,9 @@ static bool EatsUnboundedNumberOfValues(const Option *
          O->getNumOccurrencesFlag() == cl::OneOrMore;
 }
 
-static bool isWhitespace(char C) { return strchr(" \t\n\r\f\v", C); }
+static bool isWhitespace(char C) {
+  return C == ' ' || C == '\t' || C == '\r' || C == '\n';
+}
 
 static bool isQuote(char C) { return C == '\"' || C == '\''; }
 
@@ -709,17 +711,19 @@ void cl::TokenizeGNUCommandLine(StringRef Src, StringS
         break;
     }
 
+    char C = Src[I];
+
     // Backslash escapes the next character.
-    if (I + 1 < E && Src[I] == '\\') {
+    if (I + 1 < E && C == '\\') {
       ++I; // Skip the escape.
       Token.push_back(Src[I]);
       continue;
     }
 
     // Consume a quoted string.
-    if (isQuote(Src[I])) {
-      char Quote = Src[I++];
-      while (I != E && Src[I] != Quote) {
+    if (isQuote(C)) {
+      ++I;
+      while (I != E && Src[I] != C) {
         // Backslash escapes the next character.
         if (Src[I] == '\\' && I + 1 != E)
           ++I;
@@ -732,7 +736,7 @@ void cl::TokenizeGNUCommandLine(StringRef Src, StringS
     }
 
     // End the token if this is whitespace.
-    if (isWhitespace(Src[I])) {
+    if (isWhitespace(C)) {
       if (!Token.empty())
         NewArgv.push_back(Saver.save(StringRef(Token)).data());
       Token.clear();
@@ -740,7 +744,7 @@ void cl::TokenizeGNUCommandLine(StringRef Src, StringS
     }
 
     // This is a normal character.  Append it.
-    Token.push_back(Src[I]);
+    Token.push_back(C);
   }
 
   // Append the last token after hitting EOF with no whitespace.
@@ -798,25 +802,27 @@ void cl::TokenizeWindowsCommandLine(StringRef Src, Str
   // end of the source string.
   enum { INIT, UNQUOTED, QUOTED } State = INIT;
   for (size_t I = 0, E = Src.size(); I != E; ++I) {
+    char C = Src[I];
+
     // INIT state indicates that the current input index is at the start of
     // the string or between tokens.
     if (State == INIT) {
-      if (isWhitespace(Src[I])) {
+      if (isWhitespace(C)) {
         // Mark the end of lines in response files
-        if (MarkEOLs && Src[I] == '\n')
+        if (MarkEOLs && C == '\n')
           NewArgv.push_back(nullptr);
         continue;
       }
-      if (Src[I] == '"') {
+      if (C == '"') {
         State = QUOTED;
         continue;
       }
-      if (Src[I] == '\\') {
+      if (C == '\\') {
         I = parseBackslash(Src, I, Token);
         State = UNQUOTED;
         continue;
       }
-      Token.push_back(Src[I]);
+      Token.push_back(C);
       State = UNQUOTED;
       continue;
     }
@@ -825,38 +831,38 @@ void cl::TokenizeWindowsCommandLine(StringRef Src, Str
     // quotes.
     if (State == UNQUOTED) {
       // Whitespace means the end of the token.
-      if (isWhitespace(Src[I])) {
+      if (isWhitespace(C)) {
         NewArgv.push_back(Saver.save(StringRef(Token)).data());
         Token.clear();
         State = INIT;
         // Mark the end of lines in response files
-        if (MarkEOLs && Src[I] == '\n')
+        if (MarkEOLs && C == '\n')
           NewArgv.push_back(nullptr);
         continue;
       }
-      if (Src[I] == '"') {
+      if (C == '"') {
         State = QUOTED;
         continue;
       }
-      if (Src[I] == '\\') {
+      if (C == '\\') {
         I = parseBackslash(Src, I, Token);
         continue;
       }
-      Token.push_back(Src[I]);
+      Token.push_back(C);
       continue;
     }
 
     // QUOTED state means that it's reading a token quoted by double quotes.
     if (State == QUOTED) {
-      if (Src[I] == '"') {
+      if (C == '"') {
         State = UNQUOTED;
         continue;
       }
-      if (Src[I] == '\\') {
+      if (C == '\\') {
         I = parseBackslash(Src, I, Token);
         continue;
       }
-      Token.push_back(Src[I]);
+      Token.push_back(C);
     }
   }
   // Append the last token after hitting EOF with no whitespace.

Modified: vendor/llvm/dist/lib/TableGen/Main.cpp
==============================================================================
--- vendor/llvm/dist/lib/TableGen/Main.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/TableGen/Main.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -110,7 +110,7 @@ int llvm::TableGenMain(char *argv0, TableGenMainFn *Ma
     return 1;
 
   if (ErrorsPrinted > 0)
-    return reportError(argv0, utostr(ErrorsPrinted) + " errors.\n");
+    return reportError(argv0, Twine(ErrorsPrinted) + " errors.\n");
 
   // Declare success.
   Out.keep();

Modified: vendor/llvm/dist/lib/Target/AArch64/AArch64InstrInfo.cpp
==============================================================================
--- vendor/llvm/dist/lib/Target/AArch64/AArch64InstrInfo.cpp	Thu Dec 28 21:12:27 2017	(r327299)
+++ vendor/llvm/dist/lib/Target/AArch64/AArch64InstrInfo.cpp	Thu Dec 28 21:22:49 2017	(r327300)
@@ -3673,15 +3673,6 @@ static bool getFMAPatterns(MachineInstr &Root,
     }
     break;
   case AArch64::FSUBv2f32:
-    if (canCombineWithFMUL(MBB, Root.getOperand(1),
-                           AArch64::FMULv2i32_indexed)) {
-      Patterns.push_back(MachineCombinerPattern::FMLSv2i32_indexed_OP1);
-      Found = true;
-    } else if (canCombineWithFMUL(MBB, Root.getOperand(1),
-                                  AArch64::FMULv2f32)) {
-      Patterns.push_back(MachineCombinerPattern::FMLSv2f32_OP1);
-      Found = true;
-    }
     if (canCombineWithFMUL(MBB, Root.getOperand(2),
                            AArch64::FMULv2i32_indexed)) {
       Patterns.push_back(MachineCombinerPattern::FMLSv2i32_indexed_OP2);
@@ -3691,17 +3682,17 @@ static bool getFMAPatterns(MachineInstr &Root,
       Patterns.push_back(MachineCombinerPattern::FMLSv2f32_OP2);
       Found = true;
     }
-    break;
-  case AArch64::FSUBv2f64:
     if (canCombineWithFMUL(MBB, Root.getOperand(1),
-                           AArch64::FMULv2i64_indexed)) {
-      Patterns.push_back(MachineCombinerPattern::FMLSv2i64_indexed_OP1);
+                           AArch64::FMULv2i32_indexed)) {
+      Patterns.push_back(MachineCombinerPattern::FMLSv2i32_indexed_OP1);
       Found = true;
     } else if (canCombineWithFMUL(MBB, Root.getOperand(1),

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



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