1. Dec 15, 2016
  2. Dec 14, 2016
    • Nirav Dave's avatar
      In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled. · 8527ab0a
      Nirav Dave authored
      Retrying after fixing after removing load-store factoring through
      token factors in favor of improved token factor operand pruning
      
      Simplify Consecutive Merge Store Candidate Search
      
      Now that address aliasing is much less conservative, push through
      simplified store merging search which only checks for parallel stores
      through the chain subgraph. This is cleaner as the separation of
      non-interfering loads/stores from the store-merging logic.
      
      Whem merging stores, search up the chain through a single load, and
      finds all possible stores by looking down from through a load and a
      TokenFactor to all stores visited. This improves the quality of the
      output SelectionDAG and generally the output CodeGen (with some
      exceptions).
      
      Additional Minor Changes:
      
         1. Finishes removing unused AliasLoad code
         2. Unifies the the chain aggregation in the merged stores across
            code paths
         3. Re-add the Store node to the worklist after calling
            SimplifyDemandedBits.
         4. Increase GatherAllAliasesMaxDepth from 6 to 18. That number is
            arbitrary, but seemed sufficient to not cause regressions in
            tests.
      
      This finishes the change Matt Arsenault started in r246307 and
      jyknight's original patch.
      
      Many tests required some changes as memory operations are now
      reorderable. Some tests relying on the order were changed to use
      volatile memory operations
      
      Noteworthy tests:
      
          CodeGen/AArch64/argument-blocks.ll -
            It's not entirely clear what the test_varargs_stackalign test is
            supposed to be asserting, but the new code looks right.
      
          CodeGen/AArch64/arm64-memset-inline.lli -
          CodeGen/AArch64/arm64-stur.ll -
          CodeGen/ARM/memset-inline.ll -
      
            The backend now generates *worse* code due to store merging
            succeeding, as we do do a 16-byte constant-zero store efficiently.
      
          CodeGen/AArch64/merge-store.ll -
            Improved, but there still seems to be an extraneous vector insert
            from an element to itself?
      
          CodeGen/PowerPC/ppc64-align-long-double.ll -
            Worse code emitted in this case, due to the improved store->load
            forwarding.
      
          CodeGen/X86/dag-merge-fast-accesses.ll -
          CodeGen/X86/MergeConsecutiveStores.ll -
          CodeGen/X86/stores-merging.ll -
          CodeGen/Mips/load-store-left-right.ll -
            Restored correct merging of non-aligned stores
      
          CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll -
            Improved. Correctly merges buffer_store_dword calls
      
          CodeGen/AMDGPU/si-triv-disjoint-mem-access.ll -
            Improved. Sidesteps loading a stored value and
            merges two stores
      
          CodeGen/X86/pr18023.ll -
            This test has been removed, as it was asserting incorrect
            behavior. Non-volatile stores *CAN* be moved past volatile loads,
            and now are.
      
          CodeGen/X86/vector-idiv.ll -
          CodeGen/X86/vector-lzcnt-128.ll -
            It's basically impossible to tell what these tests are actually
            testing. But, looks like the code got better due to the memory
            operations being recognized as non-aliasing.
      
          CodeGen/X86/win32-eh.ll -
            Both loads of the securitycookie are now merged.
      
      Reviewers: arsenm, hfinkel, tstellarAMD, jyknight, nhaehnle
      
      Subscribers: wdng, nhaehnle, nemanjai, arsenm, weimingz, niravd, RKSimon, aemerson, qcolombet, dsanders, resistor, tstellarAMD, t.p.northover, spatel
      
      Differential Revision: https://reviews.llvm.org/D14834
      
      llvm-svn: 289659
      8527ab0a
    • Piotr Padlewski's avatar
      Deleted unused typedef · ce452ceb
      Piotr Padlewski authored
      llvm-svn: 289658
      ce452ceb
    • Kelvin Li's avatar
      Fix assert message. NFC. · 8437625e
      Kelvin Li authored
      llvm-svn: 289657
      8437625e
    • Piotr Padlewski's avatar
      modernize-use-auto NFC fixes · 08124b11
      Piotr Padlewski authored
      llvm-svn: 289656
      08124b11
    • Simon Pilgrim's avatar
      Wdocumentation fix · facbd356
      Simon Pilgrim authored
      llvm-svn: 289655
      facbd356
    • Simon Pilgrim's avatar
      [DAGCombiner] Try to use SelectionDAG::isKnownToBeAPowerOfTwo instead of just APInt::isPowerOf2 · 05ab8ffc
      Simon Pilgrim authored
      Generalize sdiv/udiv/srem/urem combines using APInt::isPowerOf2, which only works for const/splat-const values, to call SelectionDAG::isKnownToBeAPowerOfTwo instead which recognises many more cases.
      
      Added a DAGCombiner::BuildLogBase2 helper since PowerOf2 combines often involve taking the log2 of such a value.
      
      Differential Revision: https://reviews.llvm.org/D27714
      
      llvm-svn: 289654
      05ab8ffc
    • Michael Zuckerman's avatar
      Fix bug 30945- [AVX512] Failure to flip vector comparison to remove not mask instruction · 1ce2a23a
      Michael Zuckerman authored
      adding new optimization opportunity by adding new X86ISelLowering pattern. The test case was shown in https://llvm.org/bugs/show_bug.cgi?id=30945.
      
      Test explanation:
      Select gets three arguments mask, op and op2. In this case, the Mask is a result of ICMP. The ICMP instruction compares (with equal operand) the zero initializer vector and the result of the first ICMP.
      
      In general, The result of "cmp eq, op1, zero initializers" is "not(op1)" where op1 is a mask. By rearranging of the two arguments inside the Select instruction, we can get the same result. Without the necessary of the middle phase ("cmp eq, op1, zero initializers").
      
      Missed optimization opportunity: 
      vpcmpled %zmm0, %zmm1, %k0
      knotw %k0, %k1
      
      can be combine to 
      vpcmpgtd %zmm0, %zmm2, %k1
      
      Reviewers: 
      1. delena
      2. igorb 
      
      Commited after check all 
      Differential Revision: https://reviews.llvm.org/D27160
      
      llvm-svn: 289653
      1ce2a23a
    • Simon Pilgrim's avatar
      [X86][SSE] Add AVX1 tests to sdiv/udiv srem/urem combine tests · ebe58191
      Simon Pilgrim authored
      As requested on D27714
      
      llvm-svn: 289652
      ebe58191
    • Renato Golin's avatar
      Revert "[AVR] Add the very first on-target test" · ce1dd3c9
      Renato Golin authored
      This reverts commit r289648, as it's an execution test and relies on the
      emulator/dispatcher being available on all builders.
      
      llvm-svn: 289651
      ce1dd3c9
    • Neil Hickey's avatar
      Fixing cast condition for removing casts from builtin FPClassification. · 7b5ddab5
      Neil Hickey authored
      The function SemaBuiltinFPClassification removed superfluous float to double 
      casts, this was changed to also remove float to float casts but this isn't 
      valid in all cases, for example when doing an rvaluetolvalue cast. Added a
      check to only remove if this was a conventional floating cast.
      
      Added additional tests into SemaOpenCL/extensions to cover these cases
      
      llvm-svn: 289650
      7b5ddab5
    • Stephan Bergmann's avatar
      Adapt to recent APFloat change · 7d94d54a
      Stephan Bergmann authored
      llvm-svn: 289649
      7d94d54a
    • Dylan McKay's avatar
      [AVR] Add the very first on-target test · 452e266c
      Dylan McKay authored
      This test runs on actual AVR hardware.
      
      llvm-svn: 289648
      452e266c
    • Stephan Bergmann's avatar
      Replace APFloatBase static fltSemantics data members with getter functions · 17c7f703
      Stephan Bergmann authored
      At least the plugin used by the LibreOffice build
      (<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly
      uses those members (through inline functions in LLVM/Clang include files in turn
      using them), but they are not exported by utils/extract_symbols.py on Windows,
      and accessing data across DLL/EXE boundaries on Windows is generally
      problematic.
      
      Differential Revision: https://reviews.llvm.org/D26671
      
      llvm-svn: 289647
      17c7f703
    • Artur Pilipenko's avatar
      f3ee4440
    • Dylan McKay's avatar
      [AVR] Add the integrated testing tool to the .gitignore · cfd1ce6a
      Dylan McKay authored
      We build it as an LLVM tool.
      
      llvm-svn: 289645
      cfd1ce6a
    • Hafiz Abid Qadeer's avatar
      Remove code needed for supporting old VS versions. · e00b96ec
      Hafiz Abid Qadeer authored
      Summary: This code was probably needed to support VS2013 and is not needed now. I have built it with VS and mingw. Ok to remove it?
      
      Reviewers: zturner, abidh
      
      Subscribers: lldb-commits
      
      Differential Revision: https://reviews.llvm.org/D27707
      
      llvm-svn: 289644
      e00b96ec
    • Oliver Stannard's avatar
      [Assembler] Better error messages for .org directive · 268f42f1
      Oliver Stannard authored
      Currently, the error messages we emit for the .org directive when the
      expression is not absolute or is out of range do not include the line
      number of the directive, so it can be hard to track down the problem if
      a file contains many .org directives.
      
      This patch stores the source location in the MCOrgFragment, so that it
      can be used for diagnostics emitted during layout.
      
      Since layout is an iterative process, and the errors are detected during
      each iteration, it would have been possible for errors to be reported
      multiple times. To prevent this, I've made the assembler bail out after
      each iteration if any errors have been reported. This will still allow
      multiple unrelated errors to be reported in the common case where they
      are all detected in the first round of layout.
      
      Differential Revision: https://reviews.llvm.org/D27411
      
      llvm-svn: 289643
      268f42f1
    • Peter Smith's avatar
      [ELF] Accept first SHT_ARM_ATTRIBUTES section · 532bc984
      Peter Smith authored
          
      The eglibc library, as used by Ubuntu 14.04 requires the presence of an
      SHT_ARM_ATTRIBUTES section in for the purposes of checking hard/soft float
      compatibility when dlopen() is used. Unfortunately when the section is not
      present dlopen() fails with a generic could not find file message.
          
      This change makes lld keep the first .ARM.attributes section that it
      encounters and propagates it to the output. This is not a complete
      SHT_ARM_ATTRIBUTES implementation, that would involve reading the contents
      of the section and joining each individual attribute. It should suffice
      for a homogenous build all libraries and executables on the same system
      with a compatible set of command line options.
      
      Differential revision: https://reviews.llvm.org/D27718
      
      llvm-svn: 289642
      532bc984
    • Dylan McKay's avatar
      [AVR] Add a function instrumentation pass · 3abd1d3e
      Dylan McKay authored
      This will be used for an on-chip test suite.
      
      llvm-svn: 289641
      3abd1d3e
    • Andrey Churbanov's avatar
      Cleanup: debug print fixed and moved inside critical section. · 5dee8c43
      Andrey Churbanov authored
      Patch by Victor Campos.
      
      Differential Revision: https://reviews.llvm.org/D27647
      
      llvm-svn: 289640
      5dee8c43
    • Craig Topper's avatar
      [X86][InstCombine] Handle demanded elements for operand of AVX-512 scalar... · aeaa52cc
      Craig Topper authored
      [X86][InstCombine] Handle demanded elements for operand of AVX-512 scalar floating point to integer conversion intrinsics.
      
      llvm-svn: 289639
      aeaa52cc
    • Hal Finkel's avatar
      [PowerPC] Fix logic dealing with nop after calls (and tail-call eligibility) · 065b7565
      Hal Finkel authored
      This change aims to unify and correct our logic for when we need to allow for
      the possibility of the linker adding a TOC restoration instruction after a
      call. This comes up in two contexts:
      
       1. When determining tail-call eligibility. If we make a tail call (i.e.
          directly branch to a function) then there is no place for the linker to add
          a TOC restoration.
       2. When determining when we need to add a nop instruction after a call.
          Likewise, if there is a possibility that the linker might need to add a
          TOC restoration after a call, then we need to put a nop after the call
          (the bl instruction).
      
      First problem: We were using similar, but different, logic to decide (1) and
      (2). This is just wrong. Both the resideInSameModule function (used when
      determining tail-call eligibility) and the isLocalCall function (used when
      deciding if the post-call nop is needed) were supposed to be determining the
      same underlying fact (i.e. might a TOC restoration be needed after the call).
      The same logic should be used in both places.
      
      Second problem: The logic in both places was wrong. We only know that two
      functions will share the same TOC when both functions come from the same
      section of the same object. Otherwise the linker might cause the functions to
      use different TOC base addresses (unless the multi-TOC linker option is
      disabled, in which case only shared-library boundaries are relevant). There are
      a number of factors that can cause functions to be placed in different sections
      or come from different objects (-ffunction-sections, explicitly-specified
      section names, COMDAT, weak linkage, etc.). All of these need to be checked.
      The existing logic only checked properties of the callee, but the properties of
      the caller must also be checked (for example, calling from a function in a
      COMDAT section means calling between sections).
      
      There was a conceptual error in the resideInSameModule function in that it
      allowed tail calls to functions with weak linkage and protected/hidden
      visibility. While protected/hidden visibility does prevent the function
      implementation from being replaced at runtime (via interposition), it does not
      prevent the linker from using an alternate implementation at link time (i.e.
      using some strong definition to replace the provided weak one during linking).
      If this happens, then we're still potentially looking at a required TOC
      restoration upon return.
      
      Otherwise, in general, the post-call nop is needed wherever ELF interposition
      needs to be supported. We don't currently support ELF interposition at the IR
      level (see http://lists.llvm.org/pipermail/llvm-dev/2016-November/107625.html
      for more information), and I don't think we should try to make it appear to
      work in the backend in spite of that fact. This will yield subtle bugs if
      interposition is attempted. As a result, regardless of whether we're in PIC
      mode, we don't assume that we need to add the nop to support the possibility of
      ELF interposition. However, the necessary check is in place (i.e. calling
      GV->isInterposable and TM.shouldAssumeDSOLocal) so when we have functions for
      which interposition is allowed at the IR level, we'll add the nop as necessary.
      In the mean time, we'll generate more tail calls and fewer nops when compiling
      position-independent code.
      
      Differential Revision: https://reviews.llvm.org/D27231
      
      llvm-svn: 289638
      065b7565
    • Justin Lebar's avatar
      [clang-tidy] Suggest including <cmath> if necessary in type-promotion-in-math-fn-check. · 2edf6f16
      Justin Lebar authored
      Reviewers: alexfh
      
      Subscribers: JDevlieghere, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D27748
      
      llvm-svn: 289637
      2edf6f16