1. Aug 25, 2018
    • Sanjay Patel's avatar
      [x86] try harder to use broadcast to load a scalar into vector reg · 8a84c747
      Sanjay Patel authored
      This is a preliminary step for a preliminary step for D50992. 
      I noticed that x86 often misses chances to load a scalar directly 
      into a vector register.
      
      So this patch is just allowing more of those cases to match a 
      broadcast op in lowerBuildVectorAsBroadcast(). The old code comment 
      said it doesn't make sense to use a broadcast when we're loading a 
      single element and everything else is undef, but I think that's the 
      best case in the improved tests in insert-loaded-scalar.ll. We avoid 
      scalar-to-vector-register move and/or less efficient shuffling.
      
      Note that there are some existing types that were already producing 
      a broadcast, but that happens semi-accidentally. Ie, it's not 
      happening as part of lowerBuildVectorAsBroadcast(). The build vector 
      gets expanded into load + shuffle, and then shuffle lowering produces 
      the broadcast.
      
      Description of the other test diffs:
      1. avx-basic.ll - replacing load+shufle is a win.
      2. sse3-avx-addsub-2.ll - vmovddup vs. vbroadcastss is neutral
      3. sse41.ll - don't care - we convert that intrinsic to generic IR now, so this test is deprecated
      4. vector-shuffle-128-v8.ll / vector-shuffle-256-v16.ll - pshufb alternatives with an extra instruction are not obviously bad
      
      Differential Revision: https://reviews.llvm.org/D51125
      
      llvm-svn: 340685
      8a84c747
    • Tim Renouf's avatar
      [AMDGPU] Add support for multi-dword s.buffer.load intrinsic · 904343f8
      Tim Renouf authored
      Summary:
      Patch by Marek Olsak and David Stuttard, both of AMD.
      
      This adds a new amdgcn intrinsic supporting s.buffer.load, in particular
      multiple dword variants. These are convenient to use from some front-end
      implementations.
      
      Also modified the existing llvm.SI.load.const intrinsic to common up the
      underlying implementation.
      
      This modification also requires that we can lower to non-uniform loads correctly
      by splitting larger dword variants into sizes supported by the non-uniform
      versions of the load.
      
      V2: Addressed minor review comments.
      V3: i1 glc is now i32 cachepolicy for consistency with buffer and
          tbuffer intrinsics, plus fixed formatting issue.
      V4: Added glc test.
      
      Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, t-tye, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D51098
      
      Change-Id: I83a6e00681158bb243591a94a51c7baa445f169b
      llvm-svn: 340684
      904343f8
    • Sanjay Patel's avatar
      [InstCombine] add tests for shuffle+binop transform; NFC · 57a0b4ed
      Sanjay Patel authored
      llvm-svn: 340683
      57a0b4ed
    • Simon Pilgrim's avatar
      [X86] Make requested test changes from D50636 · eb6a3cbb
      Simon Pilgrim authored
      The tests were relying on X / X -> 1 and X % X -> 0 combines not happening in the DAG.
      
      llvm-svn: 340682
      eb6a3cbb
    • Jonas Hahnfeld's avatar
      [CUDA/OpenMP] Define only some host macros during device compilation · 931939bf
      Jonas Hahnfeld authored
      When compiling CUDA or OpenMP device code Clang parses header files
      that expect certain predefined macros from the host architecture. To
      make this work the compiler passes the host triple via the -aux-triple
      argument and (until now) pulls in all macros for that "auxiliary triple"
      unconditionally.
      
      However this results in defines like __SSE_MATH__ that will trigger
      inline assembly making use of the "advertised" target features. See
      the discussion of D47849 and PR38464 for a detailed explanation of
      the encountered problems.
      
      Instead of blacklisting "known bad" examples this patch starts adding
      defines that are needed for certain headers like bits/wordsize.h and
      bits/mathinline.h.
      The disadvantage of this approach is that it decouples the definitions
      from their target toolchain. However in my opinion it's more important
      to keep definitions for one header close together. For one this will
      include a clear documentation why these particular defines are needed.
      Furthermore it simplifies maintenance because adding defines for a new
      header or support for a new aux-triple only needs to touch one piece
      of code.
      
      Differential Revision: https://reviews.llvm.org/D50845
      
      llvm-svn: 340681
      931939bf
    • Bjorn Pettersson's avatar
      [CodeGen] Set FrameSetup/FrameDestroy on BUNDLE instructions · 7ded6a90
      Bjorn Pettersson authored
      Summary:
      If any of the bundled instructions are marked as FrameSetup
      or FrameDestroy, then that property is set on the BUNDLE
      instruction as well.
      
      As long as the scheduler/packetizer aren't mixing
      prologue/epilogue instructions (i.e. all the bundled
      instructions have the same property) then this simply gives
      the bundle the correct property (so when using a bundle
      iterator in late passes a bundle will be correctly identified
      as FrameSetup/FrameDestroy).
      
      When for example bundling a mix of FrameSetup instructions
      with non-FrameSetup instructions it could be discussed if
      the bundle should have the property or not. The choice here
      has been to set these properties on the BUNDLE instruction if
      any of the bundled instructions have the property set.
      
      Reviewers: #debug-info, kparzysz
      
      Reviewed By: kparzysz
      
      Subscribers: vsk, thegameg, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D50637
      
      llvm-svn: 340680
      7ded6a90
    • Bjorn Pettersson's avatar
      [LiveDebugVariables] Avoid faulty addDefsFromCopies in computeIntervals · 84830047
      Bjorn Pettersson authored
      Summary:
      When computeIntervals is looking through COPY instruction to
      extend the location mapping for a debug variable it did not
      handle subregisters correctly.
      
      For example
          DBG_VALUE debug-use %0.sub_8bit_hi, ...
          %1:gr16 = COPY %0
      was transformed into
          DBG_VALUE debug-use %0.sub_8bit_hi, ...
          %1:gr16 = COPY %0
          DBG_VALUE debug-use %1, ...
      So the subregister index was missing in the added DBG_VALUE.
      
      As long as the subreg refered to the least significant bits
      of the superreg, then I guess we could get the correct
      result in a debugger even when referring to the superreg.
      But as in the example above when the subreg refers to other
      parts of the superreg, then debuginfo would be incorrect.
      
      I'm not sure exactly how to fix this properly, so this patch
      just avoids looking through the COPY when there is a subreg
      involved (for more info, see the FIXME added in the code).
      
      Reviewers: rnk, aprantl
      
      Reviewed By: aprantl
      
      Subscribers: JDevlieghere, llvm-commits
      
      Tags: #debug-info
      
      Differential Revision: https://reviews.llvm.org/D50788
      
      llvm-svn: 340679
      84830047
    • Ana Pazos's avatar
      [MC, RISCV] Fixed StringRef Assertion `Index < Length && "Invalid index!"' · 353f67a7
      Ana Pazos authored
      Summary:
      Handle the case IDVal is an empty string.
      
      This bug was uncovered by a LLVM MC Assembler Protocol Buffer
      Fuzzer  for the RISC-V assembly language.
      
      Reviewers: rnk
      
      Reviewed By: rnk
      
      Subscribers: rnk, niravd, pcc, peter.smith, asb, grosbach, llvm-commits, bcain, kito-cheng, shiva0217, rogfer01, PkmX
      
      Differential Revision: https://reviews.llvm.org/D50808
      
      llvm-svn: 340678
      353f67a7
    • Kuba Mracek's avatar
      [llvm] Document "%T" as deprecated in CommandGuide/lit.rst · a2e0c246
      Kuba Mracek authored
      Differential Revision: https://reviews.llvm.org/D48842
      
      llvm-svn: 340677
      a2e0c246
    • Frederic Riss's avatar
      Disable exceptions for TestDataFormatterLibcxxOptional.py · 314614ad
      Frederic Riss authored
      On macOS, some of the <optional> APIs used by the test are available only
      starting on macOS 10.14 when using exceptions. Build the test with
      -fno-exceptions so that the test builds on older systems too.
      
      rdar://problem/43700544
      
      llvm-svn: 340676
      314614ad
    • Eric Christopher's avatar
      This patch adds support to LLVM for writing HermitCore (https://hermitcore.org) ELF binaries. · 2ab82347
      Eric Christopher authored
      HermitCore is a POSIX-compatible kernel for running a single application in an isolated environment to get maximum performance and predictable runtime behavior. It can either be used bare-metal on hardware or a VM (Unikernel) or side by side to an existing Linux system (Multikernel).
      Due to the latter feature, HermitCore binaries are marked with ELFOSABI_STANDALONE to let the Linux ELF loader distinguish them from regular Unix/Linux binaries and load them using the HermitCore "proxy" tool.
      
      Patch by Colin Finck!
      
      llvm-svn: 340675
      2ab82347
    • Ana Pazos's avatar
      [RISCV] Fixed Assertion`Kind == Immediate && "Invalid type access!"' failed. · ecc65edd
      Ana Pazos authored
      Summary:
      Missing check for isImm() in some Immediate classes.
      
      This bug was uncovered by a LLVM MC Assembler Protocol Buffer Fuzzer
      for the RISC-V assembly language.
      
      Reviewers: hiraditya, asb
      
      Reviewed By: hiraditya, asb
      
      Subscribers: llvm-commits, hiraditya, kito-cheng, shiva0217, rkruppe, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei
      
      Differential Revision: https://reviews.llvm.org/D50797
      
      llvm-svn: 340674
      ecc65edd
    • Adrian Prantl's avatar
      Prevent DILocation::getMergedLocation() from creating invalid metadata. · 4ddd0596
      Adrian Prantl authored
      The function's new implementation from r340583 had a bug in it that
      could cause an invalid scope to be generated when merging two
      DILocations with no common ancestor scope.
      
      This patch detects this situation and picks the scope of the first
      location. This is not perfect, because the scope is misleading, but on
      the other hand, this will be a line 0 location.
      
      rdar://problem/43687474
      
      Differential Revision: https://reviews.llvm.org/D51238
      
      llvm-svn: 340672
      4ddd0596
    • Richard Smith's avatar
      Port my recent changes from LLVM copy of the demangler: · 2b1dc39d
      Richard Smith authored
      r340663 - Allow Allocator::make to make a node of a different type than that
                requested.
      r340664 - Add documentation comment to ForwardTemplateReference.
      r340665 - Fix ExpandedSpecialSubstitution demangling for Sa and Sb.
      r340670 - Allow demangler's node allocator to fail, and bail out of the entire
                demangling process when it does.
      
      llvm-svn: 340671
      2b1dc39d
    • Richard Smith's avatar
      Allow demangler's node allocator to fail, and bail out of the entire · 9c2e4f39
      Richard Smith authored
      demangling process when it does.
      
      Use this to support a "lookup" query for the mangling canonicalizer that
      does not create new nodes. This could also be used to implement
      demangling with a fixed-size temporary storage buffer.
      
      Reviewers: erik.pilkington
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D51003
      
      llvm-svn: 340670
      9c2e4f39
    • Ana Pazos's avatar
      [RISCV] Fix std::advance slowness · 61b28ede
      Ana Pazos authored
      Summary:
      It seems std::advance template is treating "-MFI.getCalleeSavedInfo().size()"
      as a large unsigned value", causing slowness.
      
      Thanks to Henrik Gustafsson for reporting the issue.
      
      Reviewers: asb
      
      Reviewed By: asb
      
      Subscribers: llvm-commits, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, asb
      
      Differential Revision: https://reviews.llvm.org/D51148
      
      llvm-svn: 340669
      61b28ede
    • Matt Davis's avatar
      [llvm-mca] Move ResourceManager from Scheduler into its own file. NFC. · 673412e3
      Matt Davis authored
      This time I should be preserving history of the ResourceManager changes.
      
      llvm-svn: 340668
      673412e3
    • Hans Wennborg's avatar
      Revert r323281 "Adjust MaxAtomicInlineWidth for i386/i486 targets." · b4278895
      Hans Wennborg authored
      As reported on http://lists.llvm.org/pipermail/cfe-dev/2018-August/058760.html,
      this broke i386-freebsd11 due to its lack of atomic 64 bit primitives.
      
      While that's not really this commit's fault, let's revert back to the old
      behaviour until this can be fixed. This means generating cmpxchg8b etc for i386
      and i486 which don't technically support those, but that's been the behaviour
      for a long time, so a little longer probably doesn't hurt that much.
      
      > Adjust MaxAtomicInlineWidth for i386/i486 targets.
      >
      > This is to fix the bug reported in https://bugs.llvm.org/show_bug.cgi?id=34347#c6.
      > Currently, all  MaxAtomicInlineWidth of x86-32 targets are set to 64. However,
      > i386 doesn't support any cmpxchg related instructions. i486 only supports cmpxchg.
      > So in this patch MaxAtomicInlineWidth is reset as follows:
      > For i386, the MaxAtomicInlineWidth should be 0 because no cmpxchg is supported.
      > For i486, the MaxAtomicInlineWidth should be 32 because it supports cmpxchg.
      > For others 32 bits x86 cpu, the MaxAtomicInlineWidth should be 64 because of cmpxchg8b.
      >
      > Differential Revision: https://reviews.llvm.org/D42154
      
      llvm-svn: 340666
      b4278895
    • Richard Smith's avatar
      Fix ExpandedSpecialSubstitution demangling for Sa and Sb. · 3aca4811
      Richard Smith authored
      No functionality change: we never actually create these forms currently.
      
      llvm-svn: 340665
      3aca4811
    • Richard Smith's avatar
      Add documentation comment to ForwardTemplateReference. · 55857c5b
      Richard Smith authored
      This node doesn't directly correspond to a mangled name fragment, so
      it's useful to explicitly describe when it's created and what it's for.
      
      llvm-svn: 340664
      55857c5b
    • Richard Smith's avatar
      Add data structure to form equivalence classes of mangled names. · 2ae8468b
      Richard Smith authored
      Summary:
      Given a set of equivalent name fragments, this mechanism determines whether two
      mangled names are equivalent. The intent is to use this for fuzzy matching of
      profile data against the program after certain refactorings are performed.
      
      Reviewers: erik.pilkington, dlj
      
      Subscribers: mgorny, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D50935
      
      llvm-svn: 340663
      2ae8468b
    • Matt Davis's avatar
      [llvm-mca] Revert r340659. NFC. · e442a870
      Matt Davis authored
      Choosing to revert the change and do it again, hopefully preserving the history
      of the changes by using svn copy instead of simply creating a new file from the
      contents within Scheduler.
      
      llvm-svn: 340661
      e442a870
    • Philip Reames's avatar
      [CVP] Extend tests to illustrate an old patch isn't needed · 006bdad6
      Philip Reames authored
      Back in https://reviews.llvm.org/D19559, I tried to teach CVP about range facts implied by value/value icmps (i.e. no constants.)  In the meantime, we've implemented the optimization, but I couldn't find tests checked in, so adding them.
      
      llvm-svn: 340660
      006bdad6
    • Matt Davis's avatar
      220271ac
    • Stella Stamenova's avatar
      [vscode] Skip some of the vscode tests on Linux and fix one · 04acc99d
      Stella Stamenova authored
      Summary: These are already skipped on Darwin because they cause build bot failures. Both on the build bots as well as in our testing we have seen a number of these tests fail and hang. This change skips the failing/hanging tests on Linux and also fixes one of the test - the test needs the thread library to build.
      
      Reviewers: asmith, clayborg, aprantl
      
      Subscribers: teemperor, lldb-commits
      
      Differential Revision: https://reviews.llvm.org/D51227
      
      llvm-svn: 340658
      04acc99d
    • Xinliang David Li's avatar
      [PGO] add target md5sum in warning message for icall · bcf726a3
      Xinliang David Li authored
      Differential revision: http://reviews.llvm.org/D51193
      
      llvm-svn: 340657
      bcf726a3
    • Jonathan Peyton's avatar
      [OpenMP] Remove deprecated/obsolete MIC attributes from headers · 2a966e84
      Jonathan Peyton authored
      llvm-svn: 340656
      2a966e84
    • Matt Arsenault's avatar
      DAG: Allow matching fminnum/fmaxnum from vselect · 5b9ef39b
      Matt Arsenault authored
      llvm-svn: 340655
      5b9ef39b
    • Vitaly Buka's avatar
      Use unique_ptr to hold MCInstrInfo · 96cbeffa
      Vitaly Buka authored
      llvm-svn: 340654
      96cbeffa
    • Adrian Prantl's avatar
      Verifier: verify that a DILocation's scope is a DILocalScope. · 3807217d
      Adrian Prantl authored
      This fixes an assertion failure(!) in the Verifier.
      
      rdar://problem/43687474
      
      llvm-svn: 340653
      3807217d
    • Raphael Isemann's avatar
      Fixed windows bots that were failing because of PATH_MAX · 6328ccc1
      Raphael Isemann authored
      As we only use PATH_MAX for an assert in a unit test that is supposed
      to catch the random failures on the Swift CI bots, we might as well
      just ifdef this assert out on Windows.
      
      llvm-svn: 340652
      6328ccc1
    • Eli Friedman's avatar
      [SafeStack] Set debug location for calls to __safestack_pointer_address. · 59de37ba
      Eli Friedman authored
      Otherwise, the debug info is incorrect.  On its own, this is mostly
      harmless, but the safe-stack also later inlines the call to
      __safestack_pointer_address, which leads to debug info with the wrong
      scope, which eventually causes an assertion failure (and incorrect debug
      info in release mode).
      
      Differential Revision: https://reviews.llvm.org/D51075
      
      llvm-svn: 340651
      59de37ba
    • Adrian Prantl's avatar
      Reduce the memory footprint of dsymutil. (NFC) · 29729f15
      Adrian Prantl authored
      This (partially) fixes a regression introduced by
      https://reviews.llvm.org/D43945 / r327399, which parallelized
      DwarfLinker. This patch avoids parsing and allocating the memory for
      all input DIEs up front and instead only allocates them in the
      concurrent loop in the AnalyzeLambda. At the end of the loop the
      memory from the LinkContext is cleared again.
      
      This reduces the peak memory needed to link the debug info of a
      non-modular build of the Swift compiler by >3GB.
      
      rdar://problem/43444464
      
      Differential Revision: https://reviews.llvm.org/D51078
      
      llvm-svn: 340650
      29729f15
    • Peter Collingbourne's avatar
      Reland r340552, "Driver: Enable address-significance tables by default when... · faf300f0
      Peter Collingbourne authored
      Reland r340552, "Driver: Enable address-significance tables by default when targeting COFF." which was reverted in r340579.
      
      The underlying problem that caused the revert was fixed in r340648.
      
      Differential Revision: https://reviews.llvm.org/D51049
      
      llvm-svn: 340649
      faf300f0
    • Peter Collingbourne's avatar
      CodeGen: Add two more conditions for adding symbols to the address-significance table. · 3f792230
      Peter Collingbourne authored
      Firstly, require the symbol to be used within the module. If a
      symbol is unused within a module, then by definition it cannot be
      address-significant within that module. This condition is useful on all
      platforms because it could make symbol tables smaller -- without this
      change, emitting an address-significance table could cause otherwise
      unused undefined symbols to be added to the object file.
      
      But this change is necessary with COFF specifically in order to
      preserve the property that an unreferenced undefined symbol in an IR
      module does not result in a link failure. This is already the case for
      ELF because ELF linkers only reject links with unresolved symbols if
      there is a relocation to that symbol, but COFF linkers require all
      undefined symbols to be resolved regardless of relocations. So if
      a module contains an unreferenced undefined symbol, we need to make
      sure not to add it to the address-significance table (and thus the
      symbol table) in case it doesn't end up resolved at link time.
      
      Secondly, do not add dllimport symbols to the table. These symbols
      won't be able to be resolved because their definitions live in another
      module and are accessed via the IAT, and the address-significance
      table has no effect on other modules anyway. It wouldn't make sense
      to add the IAT entry symbol to the address-significance table either
      because the IAT entry isn't address-significant -- the generated code
      never takes its address.
      
      Differential Revision: https://reviews.llvm.org/D51199
      
      llvm-svn: 340648
      3f792230
    • Jonathan Peyton's avatar
      [OpenMP] Fixed affinity verbose double printing for balanced type. · 2c3e5d82
      Jonathan Peyton authored
      llvm-svn: 340647
      2c3e5d82
    • David Blaikie's avatar
      DebugInfo: Fix skipping CUs in DWARFv5 debug_names table · 6dd452b5
      David Blaikie authored
      My previoust test case had skipped CUs from one TU out of a two-TU LTO
      scenario, which meant the CU index wasn't needed (as it was unambiguous
      which CU a table entry applied to) - expanding the test to use 3 TUs,
      skipping one (so long as it's not the last one) shows the indexes are
      miscomputed. Fix that with a little indirection for the index.
      
      llvm-svn: 340646
      6dd452b5
    • Matt Davis's avatar
      [llvm-mca] Move views and stats into a Views subdir. NFC. · 10aa09f0
      Matt Davis authored
      llvm-svn: 340645
      10aa09f0
    • Eli Friedman's avatar
      Add REQUIRES: x86-registered-target to test. · 7a4750ff
      Eli Friedman authored
      (This isn't really x86-specific, but we have to pick some non-Apple
      triple to exercise the right codepath.)
      
      llvm-svn: 340644
      7a4750ff
    • Stefan Pintilie's avatar
      [PowerPC] Emit xscpsgndp instead of xxlor when copying floating point scalar registers for P9 · f3846067
      Stefan Pintilie authored
      This patch will address using the xscpsgndp instruction to copy floating point
      scalar registers instead of the xxlor (specifically XXLORf) instruction that is
      currently used. Additionally, this patch of utilizing xscpsgndp will apply to
      P9, while pre-P9 will still use xxlor.
      
      Patch by amyk
      
      Differential Revision: https://reviews.llvm.org/D50004
      
      llvm-svn: 340643
      f3846067