1. Oct 10, 2018
    • Zachary Turner's avatar
      [git-llvm] Fix some issues surrouding EOL conversion on Windows. · e5f47bbe
      Zachary Turner authored
      This patch fixes three issues.
      
      The first is that we didn't consider files which are explicitly
      set to eolstyle CRLF in the repo, and there are a handful of
      these.
      
      Second is that dos2unix doesn't have a -q option in GnuWin32,
      so this codepath wasn't working properly.
      
      Finally with newer versions of Python (or newer versions of Git,
      or some combination of the two) patches can't be applied when
      we treat stdin as text, because Python silently undoes all the
      work we did to convert the newlines to LF using dos2unix by
      using universal_newlines=True and then converting them *back*
      to CRLF.  So we need to add a way to force stdin to be treated
      as binary, and use it when LF-newlines are required.
      
      Differential Revision: https://reviews.llvm.org/D51444
      
      llvm-svn: 344095
      e5f47bbe
    • Thomas Lively's avatar
      [WebAssembly] Handle V128 register class in explicit locals pass · 409f5840
      Thomas Lively authored
      Summary:
      Also add tests to catch crashes in passes that are not normally run in
      tests.
      
      Reviewers: aheejin, dschuff
      
      Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D52959
      
      llvm-svn: 344094
      409f5840
    • Nemanja Ivanovic's avatar
      [DAGCombiner] Expand combining of FP logical ops to sign-setting FP ops · 72d4866e
      Nemanja Ivanovic authored
      We already do the following combines:
      (bitcast int (and (bitcast fp X to int), 0x7fff...) to fp) -> fabs X
      (bitcast int (xor (bitcast fp X to int), 0x8000...) to fp) -> fneg X
      
      When the target has "bit preserving fp logic". This patch just extends it
      to also combine:
      (bitcast int (or (bitcast fp X to int), 0x8000...) to fp) -> fneg (fabs X)
      
      As some targets have fnabs and even those that don't can efficiently lower
      both the fabs and the fneg.
      
      Differential revision: https://reviews.llvm.org/D44548
      
      llvm-svn: 344093
      72d4866e
    • Rong Xu's avatar
      [X86] Fix sanitizer bot failure from 344085 · 5c7bf1a7
      Rong Xu authored
      Fix the memory issue exposed by sanitizer.
      
      llvm-svn: 344092
      5c7bf1a7
    • Nemanja Ivanovic's avatar
      [PowerPC][NFC] Commit nabs test case in preparation for committing D44548 · c62dfe51
      Nemanja Ivanovic authored
      This just adds the test case so that the different code gen is clearly visible
      when the DAG Combine lands.
      
      llvm-svn: 344091
      c62dfe51
    • Rui Ueyama's avatar
      Merge two overloaded functions into one function. NFC. · 71cdbb7f
      Rui Ueyama authored
      llvm-svn: 344089
      71cdbb7f
    • Rui Ueyama's avatar
      Return early. NFC. · e65cb488
      Rui Ueyama authored
      llvm-svn: 344088
      e65cb488
    • Justin Bogner's avatar
      [LV] Move test for r343954 into x86 subdirectory · 90fde0e0
      Justin Bogner authored
      This test uses an x86 triple, so it needs to be in the x86 specific
      test directory.
      
      llvm-svn: 344087
      90fde0e0
    • Heejin Ahn's avatar
      [WebAssembly] Improve readability of SIMD instructions (NFC) · d9a6de3c
      Heejin Ahn authored
      Summary:
      - Categorize instructions into the categories as in the SIMD spec
      - Move SIMD-related definition to WebAssemblyInstrSIMD.td
      - Put definition and use of patterns together
      - Add newlines here and there
      
      Reviewers: tlively
      
      Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D53045
      
      llvm-svn: 344086
      d9a6de3c
    • Rong Xu's avatar
      Recommit r343993: [X86] condition branches folding for three-way conditional codes · 3d2efdfd
      Rong Xu authored
      Fix the memory issue exposed by sanitizer.
      
      llvm-svn: 344085
      3d2efdfd
    • Cameron McInally's avatar
    • Rui Ueyama's avatar
      Attempt to fix ubsan. · 2b53b4be
      Rui Ueyama authored
      Previously, we cast a pointer to Elf{32,64}_Chdr like this
      
        auto *Hdr = reinterpret_cast<const ELF64_Chdr>(Ptr);
      
      and read from its members like this
      
        read32(&Hdr->ch_size);
      
      I was thinking that this does not violate alignment requirement,
      since &Hdr->ch_size doesn't really access memory, but seems like
      it is a violation in terms of C++ spec (?)
      
      In this patch, I use a different struct that allows unaligned access.
      
      llvm-svn: 344083
      2b53b4be
    • Sanjay Patel's avatar
      [InstCombine] reverse 'trunc X to <N x i1>' canonicalization · e9ca7ea3
      Sanjay Patel authored
      icmp ne (and X, 1), 0 --> trunc X to N x i1
      
      Ideally, we'd do the same for scalars, but there will likely be 
      regressions unless we add more trunc folds as we're doing here 
      for vectors.
      
      The motivating vector case is from PR37549:
      https://bugs.llvm.org/show_bug.cgi?id=37549
      
      define <4 x float> @bitwise_select(<4 x float> %x, <4 x float> %y, <4 x float> %z, <4 x float> %w) {
        %c = fcmp ole <4 x float> %x, %y
        %s = sext <4 x i1> %c to <4 x i32>
        %s1 = shufflevector <4 x i32> %s, <4 x i32> undef, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
        %s2 = shufflevector <4 x i32> %s, <4 x i32> undef, <4 x i32> <i32 2, i32 2, i32 3, i32 3>
        %cond = or <4 x i32> %s1, %s2
        %condtr = trunc <4 x i32> %cond to <4 x i1>
        %r = select <4 x i1> %condtr, <4 x float> %z, <4 x float> %w
        ret <4 x float> %r
      }
      
      Here's a sampling of the vector codegen for that case using 
      mask+icmp (current behavior) vs. trunc (with this patch):
      
      AVX before:
      
      vcmpleps	%xmm1, %xmm0, %xmm0
      vpermilps	$80, %xmm0, %xmm1 ## xmm1 = xmm0[0,0,1,1]
      vpermilps	$250, %xmm0, %xmm0 ## xmm0 = xmm0[2,2,3,3]
      vorps	%xmm0, %xmm1, %xmm0
      vandps	LCPI0_0(%rip), %xmm0, %xmm0
      vxorps	%xmm1, %xmm1, %xmm1
      vpcmpeqd	%xmm1, %xmm0, %xmm0
      vblendvps	%xmm0, %xmm3, %xmm2, %xmm0
      
      AVX after:
      
      vcmpleps	%xmm1, %xmm0, %xmm0
      vpermilps	$80, %xmm0, %xmm1 ## xmm1 = xmm0[0,0,1,1]
      vpermilps	$250, %xmm0, %xmm0 ## xmm0 = xmm0[2,2,3,3]
      vorps	%xmm0, %xmm1, %xmm0
      vblendvps	%xmm0, %xmm2, %xmm3, %xmm0
      
      AVX512f before:
      
      vcmpleps	%xmm1, %xmm0, %xmm0
      vpermilps	$80, %xmm0, %xmm1 ## xmm1 = xmm0[0,0,1,1]
      vpermilps	$250, %xmm0, %xmm0 ## xmm0 = xmm0[2,2,3,3]
      vorps	%xmm0, %xmm1, %xmm0
      vpbroadcastd	LCPI0_0(%rip), %xmm1 ## xmm1 = [1,1,1,1]
      vptestnmd	%zmm1, %zmm0, %k1
      vblendmps	%zmm3, %zmm2, %zmm0 {%k1}
      
      AVX512f after:
      
      vcmpleps	%xmm1, %xmm0, %xmm0
      vpermilps	$80, %xmm0, %xmm1 ## xmm1 = xmm0[0,0,1,1]
      vpermilps	$250, %xmm0, %xmm0 ## xmm0 = xmm0[2,2,3,3]
      vorps	%xmm0, %xmm1, %xmm0
      vpslld	$31, %xmm0, %xmm0
      vptestmd	%zmm0, %zmm0, %k1
      vblendmps	%zmm2, %zmm3, %zmm0 {%k1}
      
      AArch64 before:
      
      fcmge	v0.4s, v1.4s, v0.4s
      zip1	v1.4s, v0.4s, v0.4s
      zip2	v0.4s, v0.4s, v0.4s
      orr	v0.16b, v1.16b, v0.16b
      movi	v1.4s, #1
      and	v0.16b, v0.16b, v1.16b
      cmeq	v0.4s, v0.4s, #0
      bsl	v0.16b, v3.16b, v2.16b
      
      AArch64 after:
      
      fcmge	v0.4s, v1.4s, v0.4s
      zip1	v1.4s, v0.4s, v0.4s
      zip2	v0.4s, v0.4s, v0.4s
      orr	v0.16b, v1.16b, v0.16b
      bsl	v0.16b, v2.16b, v3.16b
      
      PowerPC-le before:
      
      xvcmpgesp 34, 35, 34
      vspltisw 0, 1
      vmrglw 3, 2, 2
      vmrghw 2, 2, 2
      xxlor 0, 35, 34
      xxlxor 35, 35, 35
      xxland 34, 0, 32
      vcmpequw 2, 2, 3
      xxsel 34, 36, 37, 34
      
      PowerPC-le after:
      
      xvcmpgesp 34, 35, 34
      vmrglw 3, 2, 2
      vmrghw 2, 2, 2
      xxlor 0, 35, 34
      xxsel 34, 37, 36, 0
      
      Differential Revision: https://reviews.llvm.org/D52747
      
      llvm-svn: 344082
      e9ca7ea3
    • Zachary Turner's avatar
      [PDB] Fix another bug in globals stream name lookup. · 5989281c
      Zachary Turner authored
      When we're on the last bucket the computation is tricky.
      We were failing when the last bucket contained multiple
      matches.  Added a new test for this.
      
      llvm-svn: 344081
      5989281c
    • Jake Ehrlich's avatar
      [llvm-objcopy] Make -S an alias for --strip-all · 5e49846c
      Jake Ehrlich authored
      -S should be an alias for --strip-all not --strip-all-gnu
      
      llvm-svn: 344080
      5e49846c
    • Adrian Prantl's avatar
    • Lang Hames's avatar
      [ORC] Promote and rename private symbols inside the CompileOnDemand layer, · bf6603e9
      Lang Hames authored
      rather than require them to have been promoted before being passed in.
      
      Dropping this precondition is better for layer composition (CompileOnDemandLayer
      was the only one that placed pre-conditions on the modules that could be added).
      It also means that the promoted private symbols do not show up in the target
      JITDylib's symbol table. Instead, they are confined to the hidden implementation
      dylib that contains the actual definitions.
      
      For the 403.gcc testcase this cut down the public symbol table size from ~15,000
      symbols to ~4000, substantially reducing symbol dependence tracking costs.
      
      llvm-svn: 344078
      bf6603e9
    • Nemanja Ivanovic's avatar
      [PowerPC] Implement hasBitPreservingFPLogic for types that can be supported · 87873d04
      Nemanja Ivanovic authored
      This is the PPC-specific non-controversial part of
      https://reviews.llvm.org/D44548 that simply enables this combine for PPC
      since PPC has these instructions.
      This commit will allow the target-independent portion to be truly target
      independent.
      
      llvm-svn: 344077
      87873d04
    • Rui Ueyama's avatar
      Calculate an offset only once. NFC. · e3ccd286
      Rui Ueyama authored
      llvm-svn: 344076
      e3ccd286
    • Rui Ueyama's avatar
      Remove redundant `Symtab->`. · fbc62970
      Rui Ueyama authored
      `SymbolTable` is a singleton class and is a global variable for the
      unique instance, so we can always refer the symtab by `Symtab->`.
      However, we don't need to use the global varaible from member functions
      of SymbolTable class.
      
      llvm-svn: 344075
      fbc62970
    • Rui Ueyama's avatar
      Simplify. NFC. · 714abece
      Rui Ueyama authored
      llvm-svn: 344074
      714abece
    • Matt Davis's avatar
      [compiler-rt] Remove unused formal parameters from allocateOneNode. NFC. · 839ec9d9
      Matt Davis authored
      Summary: This is just a minor cleanup to the allocateOneNode interface.  The formals are no-longer used, so I just removed them.
      
      Reviewers: davidxl, void
      
      Reviewed By: davidxl
      
      Subscribers: dberris, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D52509
      
      llvm-svn: 344073
      839ec9d9
    • Rui Ueyama's avatar
      Remove a use of template to make code less abstracted. · 659cff37
      Rui Ueyama authored
      Sometimes, code that is a bit longer but doesn't use template is
      easier to understand than code that uses template.
      
      llvm-svn: 344072
      659cff37
    • Craig Topper's avatar
      [X86] When lowering unsigned v2i64 setcc without SSE42, flip the sign bits in... · f6d84008
      Craig Topper authored
      [X86] When lowering unsigned v2i64 setcc without SSE42, flip the sign bits in the v2i64 type then bitcast to v4i32.
      
      This may give slightly better opportunities for DAG combine to simplify with the operations before the setcc. It also matches the type the xors will eventually be promoted to anyway so it saves a legalization step.
      
      Almost all of the test changes are because our constant pool entry is now v2i64 instead of v4i32 on 64-bit targets. On 32-bit targets getConstant should be emitting a v4i32 build_vector and a v4i32->v2i64 bitcast.
      
      There are a couple test cases where it appears we now combine a bitwise not with one of these xors which caused a new constant vector to be generated. This prevented a constant pool entry from being shared. But if that's an issue we're concerned about, it seems we need to address it another way that just relying a bitcast to hide it.
      
      This came about from experiments I've been trying with pushing the promotion of and/or/xor to vXi64 later than LegalizeVectorOps where it is today. We run LegalizeVectorOps in a bottom up order. So the and/or/xor are promoted before their users are legalized. The bitcasts added for the promotion act as a barrier to computeKnownBits if we try to use it during vector legalization of a later operation. So by moving the promotion out we can hopefully get better results from computeKnownBits/computeNumSignBits like in LowerTruncate on AVX512. I've also looked at running LegalizeVectorOps in a top down order like LegalizeDAG, but thats showing some other issues.
      
      llvm-svn: 344071
      f6d84008
    • Richard Smith's avatar
      PR39231: fix null dereference when diagnosing deduction failure due to · e54d9525
      Richard Smith authored
      conflicting values for a non-type pack.
      
      llvm-svn: 344070
      e54d9525
    • Sam Clegg's avatar
      [SLPVectorizer] Check that lowered type is floating point before calling isFabsFree · 81abca32
      Sam Clegg authored
      In the case of soft-fp (e.g. fp128 under wasm) the result of
      getTypeLegalizationCost() can be an integer type even if the input is
      floating point (See LegalizeTypeAction::TypeSoftenFloat).
      
      Before calling isFabsFree() (which asserts if given a non-fp
      type) we need to check that that result is fp.  This is safe since in
      fabs is certainly not free in the soft-fp case.
      
      Fixes PR39168
      
      Differential Revision: https://reviews.llvm.org/D52899
      
      llvm-svn: 344069
      81abca32
    • Wolfgang Pieb's avatar
      [DWARF] Make llvm-dwarfdump display the .debug_loc.dwo section. Fixes PR38991. · a9ea9c50
      Wolfgang Pieb authored
      Reviewer: dblaikie
      
      Differential Revision: https://reviews.llvm.org/D52444
      
      llvm-svn: 344068
      a9ea9c50
    • Sanjay Patel's avatar
      [InstCombine] add tests for extract subvector shuffles; NFC · 1238e6c2
      Sanjay Patel authored
      llvm-svn: 344067
      1238e6c2
    • Zachary Turner's avatar
      Fix lld test. · 2be11c02
      Zachary Turner authored
      I removed this output from the dumper because it was non-portable,
      but I didn't update the test which checked the output.
      
      llvm-svn: 344066
      2be11c02
    • Nico Weber's avatar
      lld-link: attempt to fix tests on Windows after r344061. · e1b9331d
      Nico Weber authored
      llvm-svn: 344065
      e1b9331d
    • Adrian Prantl's avatar
      Add missing space · d969abde
      Adrian Prantl authored
      llvm-svn: 344064
      d969abde
    • Zachary Turner's avatar
      [PDB] Fix failure on big endian machines. · b7dd12b7
      Zachary Turner authored
      We changed an ArrayRef<uint8_t> to an ArrayRef<uint32_t>, but
      it needs to be an ArrayRef<support::ulittle32_t>.
      
      We also change ArrayRef<> to FixedStreamArray<>.  Technically
      an ArrayRef<> will work, but it can cause a copy in the underlying
      implementation if the memory is not contiguous, and there's no
      reason not to use a FixedStreamArray<>.
      
      Thanks to nemanjai@ and thakis@ for helping me track this down
      and confirm the fix.
      
      llvm-svn: 344063
      b7dd12b7
    • Rui Ueyama's avatar
      Add an entry to the release notes. · c2921f00
      Rui Ueyama authored
      llvm-svn: 344062
      c2921f00
    • Nico Weber's avatar
      lld-link: Use /pdbsourcepath: for more places when present. · 4764bb2c
      Nico Weber authored
      /pdbsourcepath: was added in https://reviews.llvm.org/D48882 to make it
      possible to have relative paths in the debug info that clang-cl writes.
      lld-link then makes the paths absolute at link time, which debuggers require.
      This way, clang-cl's output is independent of the absolute path of the build
      directory, which is useful for cacheability in distcc-like systems.
      
      This patch extends /pdbsourcepath: (if passed) to also be used for:
      
      1. The "cwd" stored in the env block in the pdb is /pdbsourcepath: if present
      2. The "exe" stored in the env block in the pdb is made absolute relative
         to /pdbsourcepath: instead of the cwd
      3. The "pdb" stored in the env block in the pdb is made absolute relative
         to /pdbsourcepath: instead of the cwd
      4. For making absolute paths to .obj files referenced from the pdb
      
      /pdbsourcepath: is now useful in three scenarios (the first one already working
      before this change):
      
      1. When building with full debug info, passing the real build dir to
         /pdbsourcepath: allows having clang-cl's output to be independent
         of the build directory path. This patch effectively doesn't change
         behavior for this use case (assuming the cwd is the build dir).
      
      2. When building without compile-time debug info but linking with /debug,
         a fake fixed /pdbsourcepath: can be passed to get symbolized stacks
         while making the pdb and exe independent of the current build dir.
         For this two work, lld-link needs to be invoked with relative paths for
         the lld-link invocation itself (for "exe"), for the pdb output name, the exe
         output name (for "pdb"), and the obj input files, and no absolute path
         must appear on the link command (for "cmd" in the pdb's env block).
         Since no full debug info is present, it doesn't matter that the absolute
         path doesn't exist on disk -- we only get symbols in stacks.
      
      3. When building production builds with full debug info that don't have
         local changes, and that get source indexed and their pdbs get uploaded
         to a symbol server. /pdbsourcepath: again makes the build output independent
         of the current directory, and the fixed path passed to /pdbsourcepath: can
         be given the source indexing transform so that it gets mapped to a
         repository path. This has the same requirements as 2.
      
      This patch also makes it possible to create PDB files containing Windows-style
      absolute paths when cross-compiling on a POSIX system.
      
      Differential Revision: https://reviews.llvm.org/D53021
      
      llvm-svn: 344061
      4764bb2c
    • Craig Topper's avatar
      [X86] Autogenerate complete checks. NFC · 4ea56962
      Craig Topper authored
      llvm-svn: 344060
      4ea56962
    • Sanjay Patel's avatar
      [AArch64][x86] add tests for bitcasted fnabs; NFC · a875030a
      Sanjay Patel authored
      Alternate target coverage for  D44548.
      
      llvm-svn: 344059
      a875030a
  2. Oct 09, 2018