1. May 16, 2018
    • Simon Dardis's avatar
    • Henry Wong's avatar
      [analyzer] Improve the modeling of memset(). · afe62cdc
      Henry Wong authored
      Since there is no perfect way bind the non-zero value with the default binding, this patch only considers the case where buffer's offset is zero and the char value is 0. And according to the value for overwriting, decide how to update the string length.
      
      Reviewers: dcoughlin, NoQ, xazax.hun, a.sidorin, george.karpenkov
      
      Reviewed By: NoQ
      
      Differential Revision: https://reviews.llvm.org/D44934
      
      llvm-svn: 332463
      afe62cdc
    • Simon Dardis's avatar
      [mips] Join existing scopes for DecoderNamespace (NFCI) · 6c35f8f4
      Simon Dardis authored
      llvm-svn: 332462
      6c35f8f4
    • Andrea Di Biagio's avatar
      [llvm-mca] Fix perf regression after r332390. · 88997ba2
      Andrea Di Biagio authored
      Revision 332390 introduced a FetchStage class in llvm-mca.
      By design, FetchStage owns all the instructions in-flight in the OoO Backend.
      
      Before this change, new instructions were added to a DenseMap indexed by
      instruction id. The problem with using a DenseMap is that elements are not
      ordered by key. This was causing a massive slow down in method
      FetchStage::postExecute(), which searches for instructions retired that can be
      deleted.
      
      This patch replaces the DenseMap with a std::map ordered by instruction index.
      At the end of every cycle, we search for the first instruction which is not
      marked as "retired", and we remove all the previous instructions before it.
      This works well because instructions are retired in-order.
      
      Before this patch, a debug build of llvm-mca (on my Ryzen linux machine) took
      ~8.0 seconds to simulate 3000 iterations of a x86 dot-product (a `vmulps,
      vpermilps, vaddps, vpermilps, vaddps` sequence). With this patch, it now takes
      ~0.8s to run all the 3000 iterations.
      
      llvm-svn: 332461
      88997ba2
    • Ilya Biryukov's avatar
      [clangd] Parse all comments in Sema and completion. · c22d3447
      Ilya Biryukov authored
      Summary:
      And add tests for the comment extraction code.
      
      clangd will now show non-doxygen comments in completion for results
      coming from Sema and Dynamic index.
      Static index does not include the comments yet, I will enable it in
      a separate commit after investigating which implications it has for
      the size of the index.
      
      Reviewers: sammccall, hokein, ioeric
      
      Reviewed By: sammccall
      
      Subscribers: klimek, MaskRay, jkorous, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D46002
      
      llvm-svn: 332460
      c22d3447
    • Ilya Biryukov's avatar
      [clangd] Retrieve minimally formatted comment text in completion. · 43714504
      Ilya Biryukov authored
      Summary:
      Previous implementation used to extract brief text from doxygen comments.
      Brief text parsing slows down completion and is not suited for
      non-doxygen comments.
      
      This commit switches to providing comments that mimic the ones
      originally written in the source code, doing minimal reindenting and
      removing the comments markers to make the output more user-friendly.
      
      It means we lose support for doxygen-specific features, e.g. extracting
      brief text, but provide useful results for non-doxygen comments.
      Switching the doxygen support back is an option, but I suggest to see
      whether the current approach gives more useful results.
      
      Reviewers: sammccall, hokein, ioeric
      
      Reviewed By: sammccall
      
      Subscribers: klimek, MaskRay, jkorous, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D45999
      
      llvm-svn: 332459
      43714504
    • Ilya Biryukov's avatar
      [AST] Added a helper to extract a user-friendly text of a comment. · 1ff7c32f
      Ilya Biryukov authored
      Summary:
      The helper is used in clangd for documentation shown in code completion
      and storing the docs in the symbols. See D45999.
      
      This patch reuses the code of the Doxygen comment lexer, disabling the
      bits that do command and html tag parsing.
      The new helper works on all comments, including non-doxygen comments.
      However, it does not understand or transform any doxygen directives,
      i.e. cannot extract brief text, etc.
      
      Reviewers: sammccall, hokein, ioeric
      
      Reviewed By: ioeric
      
      Subscribers: mgorny, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D46000
      
      llvm-svn: 332458
      1ff7c32f
    • Ilya Biryukov's avatar
      [CodeComplete] Expose helpers to get RawComment of completion result. · a3f955bd
      Ilya Biryukov authored
      Summary: Used in clangd, see D45999.
      
      Reviewers: sammccall, hokein, ioeric, arphaman
      
      Reviewed By: sammccall
      
      Subscribers: arphaman, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D46001
      
      llvm-svn: 332457
      a3f955bd
    • Eric Liu's avatar
      [clangd] Filter out private proto symbols in SymbolCollector. · d67ec24f
      Eric Liu authored
      Summary:
      This uses heuristics to identify private proto symbols. For example,
      top-level symbols whose name contains "_" are considered private. These symbols
      are not expected to be used by users.
      
      Reviewers: ilya-biryukov, malaperle
      
      Reviewed By: ilya-biryukov
      
      Subscribers: sammccall, klimek, MaskRay, jkorous, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D46751
      
      llvm-svn: 332456
      d67ec24f
    • Clement Courbet's avatar
      [llvm-exegesis] Fix unused variable warning in release mode. · c922e077
      Clement Courbet authored
      llvm-svn: 332455
      c922e077
    • Gabor Marton's avatar
      Test commit access: remove superflous spaces · 344b0995
      Gabor Marton authored
      llvm-svn: 332454
      344b0995
    • Matt Arsenault's avatar
      AMDGPU: Custom lower v4i16/v4f16 vector operations · 67a9815a
      Matt Arsenault authored
      Avoids stack access.
      
      Also handle extract hi elt pattern from truncate + shift
      to avoid a couple test regressions.
      
      llvm-svn: 332453
      67a9815a
    • David Bolvansky's avatar
      [SimplifyLibcalls] Replace locked IO with unlocked IO · ca22d427
      David Bolvansky authored
      Summary: If file stream arg is not captured and source is fopen, we could replace IO calls by unlocked IO ("_unlocked" function variants) to gain better speed,
      
      Reviewers: efriedma, RKSimon, spatel, sanjoy, hfinkel, majnemer, lebedev.ri, rja
      
      Reviewed By: rja
      
      Subscribers: rja, srhines, efriedma, lebedev.ri, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D45736
      
      llvm-svn: 332452
      ca22d427
    • Simon Pilgrim's avatar
      [X86] Split WriteCvtI2F/WriteCvtF2I into I<->F32 and I<->F64 scheduler classes · 5647e89f
      Simon Pilgrim authored
      A lot of the models still have too many InstRW overrides for these new classes - this needs cleaning up but I wanted to get the classes in first
      
      llvm-svn: 332451
      5647e89f
    • David Green's avatar
      [LoopUnroll] Split out simplify code after Unroll into a new function. NFC · cdee1d95
      David Green authored
      So that it can be shared with other passes that may end up doing the same
      thing.
      
      Differential Revision: https://reviews.llvm.org/D45874
      
      llvm-svn: 332450
      cdee1d95
    • Amara Emerson's avatar
      [GlobalISel][IRTranslator] Split aggregates during IR translation. · 0d6a26df
      Amara Emerson authored
      We currently handle all aggregates by creating one large LLT, and letting the
      legalizer deal with splitting them up. However using this approach means that
      we can't support big endian code correctly.
      
      This patch changes the way that the IRTranslator deals with aggregate values,
      by splitting them up into their constituent element values. To do this, parts
      of the translator need to be modified to deal with multiple VRegs for a single
      Value.
      
      A new Value to VReg mapper is introduced to help keep compile time under
      control, currently there is no measurable impact on CTMark despite the extra
      code being generated in some cases.
      
      Patch is based on the original work of Tim Northover.
      
      Differential Revision: https://reviews.llvm.org/D46018
      
      llvm-svn: 332449
      0d6a26df
    • Jonas Devlieghere's avatar
      [diagtool] Add diagtool to install target. · b48447a1
      Jonas Devlieghere authored
      Although not very well known, diagtool is an incredibly convenient
      utility for dealing with diagnostics.
      Particularly useful are the "tree" and "show-enabled" commands:
      
       - The former prints the hierarchy of diagnostic (warning) flags and
         which of them are enabled by default.
       - The latter can be used to replace an invocation to clang and will
         print which diagnostics are disabled, warnings or errors.
         For instance: `diagtool show-enabled -Wall -Werror /tmp/test.c` will
         print that -Wunused-variable (warn_unused_variable) will be treated as
         an error.
      
      This patch adds them to the install target so it gets shipped with the
      LLVM release. It also adds a very basic man page and mentions this
      change in the release notes.
      
      Differential revision: https://reviews.llvm.org/D46694
      
      llvm-svn: 332448
      b48447a1
    • Andrea Di Biagio's avatar
      [llvm-mca] Regenerate tests after r332381 and r332361. NFC · 45ccdd17
      Andrea Di Biagio authored
      llvm-svn: 332447
      45ccdd17
    • Simon Dardis's avatar
      [mips] Add support for isBranchOffsetInRange and use it for MipsLongBranch · 5cf9de4b
      Simon Dardis authored
      Add support for this target hook, covering MIPS, microMIPS and MIPSR6, along
      with some tests. Also add missing getOppositeBranchOpc() cases exposed by the
      tests.
      
      Reviewers: atanasyan, abeserminji, smaksimovic
      
      Differential Revision: https://reviews.llvm.org/D46794
      
      llvm-svn: 332446
      5cf9de4b
    • Clement Courbet's avatar
      [llvm-exegesis] Add a flag to output analysis csv to a file. · caa163ef
      Clement Courbet authored
      Reviewers: gchatelet
      
      Subscribers: llvm-commits, tschuett
      
      Differential Revision: https://reviews.llvm.org/D46931
      
      llvm-svn: 332445
      caa163ef
    • Peter Smith's avatar
      [AArch64] Support "S" inline assembler constraint · c811758d
      Peter Smith authored
      This patch re-introduces the "S" inline assembler constraint. This matches
      an absolute symbolic address or a label reference. The primary use case is
      
      asm("adrp %0, %1\n\t"
          "add %0, %0, :lo12:%1" : "=r"(addr) : "S"(&var));
      
      I say re-introduces as it seems like "S" was implemented in the original
      AArch64 backend, but it looks like it wasn't carried forward to the merged
      backend. The original implementation had A and L modifiers that could be
      used to print ":lo12:" to the string. It looks like gcc doesn't use these
      and :lo12: is expected to be written in the inline assembly string so I've
      not implemented A and L. Clang already supports the S modifier.
      
      Fixes PR37180
      
      Differential Revision: https://reviews.llvm.org/D46745
      
      llvm-svn: 332444
      c811758d
    • Andrea Di Biagio's avatar
      [llvm-mca] Remove redundant includes in Stage.h. · ca0d30cd
      Andrea Di Biagio authored
      This patch also makes Stage::isReady() a const method.
      
      No functional change.
      
      llvm-svn: 332443
      ca0d30cd
    • Sander de Smalen's avatar
      [AArch64][SVE] Asm: Support for structured LD2, LD3 and LD4 (scalar+scalar) load instructions. · a680f558
      Sander de Smalen authored
      Reviewers: rengolin, fhahn, samparker, SjoerdMeijer, javed.absar
      
      Reviewed By: fhahn
      
      Differential Revision: https://reviews.llvm.org/D46679
      
      llvm-svn: 332442
      a680f558
    • Clement Courbet's avatar
      Fix unused variable warning in r332437. · 4022b6c4
      Clement Courbet authored
      llvm-svn: 332441
      4022b6c4
    • Alexander Richardson's avatar
      Escape ]]> in xunit xml output · 1bffd0f7
      Alexander Richardson authored
      Summary:
      This sequence ends the CDATA block so any characters after that are no
      longer escaped. This can be fixed by replacing "]]>" with "]]]]><![CDATA[>".
      
      Reviewers: cmatthews
      
      Reviewed By: cmatthews
      
      Differential Revision: https://reviews.llvm.org/D46886
      
      llvm-svn: 332440
      1bffd0f7
    • Alexander Richardson's avatar
      Emit a left-shift instead of a power-of-two multiply for jump-tables · 8f44579d
      Alexander Richardson authored
      Summary:
      SelectionDAGLegalize::ExpandNode() inserts an ISD::MUL when lowering a
      BR_JT opcode. While many backends optimize this multiply into a shift, e.g.
      the MIPS backend currently always lowers this into a sequence of
      load-immediate+multiply+mflo in MipsSETargetLowering::lowerMulDiv().
      
      I initially changed the multiply to a shift in the MIPS backend but it
      turns out that would not have handled the MIPSR6 case and was a lot more
      code than doing it in LegalizeDAG.
      I believe performing this simple optimization in LegalizeDAG instead of
      each individual backend is the better solution since this also fixes other
      backeds such as MSP430 which calls the multiply runtime function
      __mspabi_mpyi without this patch.
      
      Reviewers: sdardis, atanasyan, pftbest, asl
      
      Reviewed By: sdardis
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D45760
      
      llvm-svn: 332439
      8f44579d
    • Heejin Ahn's avatar
      [clangd] Fix a link failure in unittests · 85e38ee1
      Heejin Ahn authored
      Summary: D46524 (rL332378) introduced a link failure when built with
      `-DSHARED_LIB=ON`, which this patch fixes.
      
      Reviewers: ioeric
      
      Subscribers: klimek, mgorny, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D46906
      
      llvm-svn: 332438
      85e38ee1
    • Clement Courbet's avatar
      [llvm-exegesis] Analysis: Display sched class for instructions. · 6d6c1a99
      Clement Courbet authored
      Reviewers: gchatelet
      
      Subscribers: tschuett, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46883
      
      llvm-svn: 332437
      6d6c1a99
    • Francois Ferrand's avatar
      clang-format: Allow optimizer to break template declaration. · 58e6fe5b
      Francois Ferrand authored
      Summary:
      Introduce `PenaltyBreakTemplateDeclaration` to control the penalty,
      and change `AlwaysBreakTemplateDeclarations` to an enum with 3 modes:
      * `No` for regular, penalty based, wrapping of template declaration
      * `MultiLine` for always wrapping before multi-line declarations (e.g.
        same as legacy behavior when `AlwaysBreakTemplateDeclarations=false`)
      * `Yes` for always wrapping (e.g. same as legacy behavior when
        `AlwaysBreakTemplateDeclarations=true`)
      
      Reviewers: krasimir, djasper, klimek
      
      Subscribers: cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D42684
      
      llvm-svn: 332436
      58e6fe5b
    • Simon Pilgrim's avatar
      [X86][SSE] Fix tests for vector rotates by splat variable. · 5df1ef7a
      Simon Pilgrim authored
      We weren't correctly splatting the offset shift
      
      llvm-svn: 332435
      5df1ef7a
    • Francois Ferrand's avatar
      clang-format: tweak formatting of variable initialization blocks · f92f806a
      Francois Ferrand authored
      Summary:
      This patch changes the behavior of PenaltyBreakBeforeFirstCallParameter
      so that is does not apply after a brace, when Cpp11BracedListStyle is
      false.
      
      This way, variable initialization is wrapped more like an initializer
      than like a function call, which is more consistent with user
      expectations for this braced list style.
      
      With PenaltyBreakBeforeFirstCallParameter=200, this gives the following
      code: (with Cpp11BracedListStyle=false)
      
      Before :
      
        const std::unordered_map<std::string, int> Something::MyHashTable =
            { { "aaaaaaaaaaaaaaaaaaaaa", 0 },
              { "bbbbbbbbbbbbbbbbbbbbb", 1 },
              { "ccccccccccccccccccccc", 2 } };
      
      After :
      
        const std::unordered_set<std::string> Something::MyUnorderedSet = {
          { "aaaaaaaaaaaaaaaaaaaaa", 0 },
          { "bbbbbbbbbbbbbbbbbbbbb", 1 },
          { "ccccccccccccccccccccc", 2 }
        };
      
      Reviewers: krasimir, djasper, klimek
      
      Subscribers: cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D43290
      
      llvm-svn: 332434
      f92f806a
    • Sander de Smalen's avatar
      [AArch64][SVE] Asm: Support for contiguous PRF prefetch instructions. · 67f91549
      Sander de Smalen authored
      Reviewers: rengolin, fhahn, samparker, SjoerdMeijer, javed.absar
      
      Reviewed By: SjoerdMeijer
      
      Differential Revision: https://reviews.llvm.org/D46682
      
      llvm-svn: 332433
      67f91549
    • Fangrui Song's avatar
      [Unix] Indent ChangeStd{in,out}ToBinary. · 2cafed76
      Fangrui Song authored
      llvm-svn: 332432
      2cafed76
    • Mikael Holmen's avatar
      Remove unused variable introduced in r332336 · e01131de
      Mikael Holmen authored
      The unused variable caused a compilation warning:
      
      ../lib/Target/X86/X86ISelLowering.cpp:34614:17: error: unused variable 'SMax' [-Werror,-Wunused-variable]
          if (SDValue SMax = MatchMinMax(SMin, ISD::SMAX, C1))
                      ^
      1 error generated.
      
      llvm-svn: 332431
      e01131de
    • Shoaib Meenai's avatar
      [ObjCARC] Prevent code motion into a catchswitch · 074728a2
      Shoaib Meenai authored
      A catchswitch must be the only non-phi instruction in its basic block;
      attempting to move a retain or release into a catchswitch basic block
      will result in invalid IR. Explicitly mark a CFG hazard in this case to
      prevent the code motion.
      
      Differential Revision: https://reviews.llvm.org/D46482
      
      llvm-svn: 332430
      074728a2
    • JF Bastien's avatar
      Revert "Signal handling should be signal-safe" · b8931c1c
      JF Bastien authored
      Some bots don't have double-pointer width compare-and-exchange. Revert for now.q
      
      llvm-svn: 332429
      b8931c1c
    • JF Bastien's avatar
      Signal handling should be signal-safe · 253aa8b0
      JF Bastien authored
      Summary:
      Before this patch, signal handling wasn't signal safe. This leads to real-world
      crashes. It used ManagedStatic inside of signals, this can allocate and can lead
      to unexpected state when a signal occurs during llvm_shutdown (because
      llvm_shutdown destroys the ManagedStatic). It also used cl::opt without custom
      backing storage. Some de-allocation was performed as well. Acquiring a lock in a
      signal handler is also a great way to deadlock.
      
      We can't just disable signals on llvm_shutdown because the signals might do
      useful work during that shutdown. We also can't just disable llvm_shutdown for
      programs (instead of library uses of clang) because we'd have to then mark the
      pointers as not leaked and make sure all the ManagedStatic uses are OK to leak
      and remain so.
      
      Move all of the code to lock-free datastructures instead, and avoid having any
      of them in an inconsistent state. I'm not trying to be fancy, I'm not using any
      explicit memory order because this code isn't hot. The only purpose of the
      atomics is to guarantee that a signal firing on the same or a different thread
      doesn't see an inconsistent state and crash. In some cases we might miss some
      state (for example, we might fail to delete a temporary file), but that's fine.
      
      Note that I haven't touched any of the backtrace support despite it not
      technically being totally signal-safe. When that code is called we know
      something bad is up and we don't expect to continue execution, so calling
      something that e.g. sets errno is the least of our problems.
      
      A similar patch should be applied to lib/Support/Windows/Signals.inc, but that
      can be done separately.
      
      <rdar://problem/28010281>
      
      Reviewers: dexonsmith
      
      Subscribers: aheejin, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46858
      
      llvm-svn: 332428
      253aa8b0
    • Shiva Chen's avatar
      [DebugInfo] Only handle DBG_VALUE in InlineSpiller. · 21eab936
      Shiva Chen authored
      The instructions using registers should be DBG_VALUE and normal
      instructions. Use isDebugValue() to filter out DBG_VALUE and add
      an assert to ensure there is no other kind of debug instructions
      using the registers.
      
      Differential Revision: https://reviews.llvm.org/D46739
      
      Patch by Hsiangkai Wang.
      
      llvm-svn: 332427
      21eab936
    • Evgeny Stupachenko's avatar
      Fix LSR compile time hang. · bff9302c
      Evgeny Stupachenko authored
      Summary:
      Limit number of reassociations in GenerateReassociationsImpl.
      
      Reviewers: qcolombet, mkazantsev
      
      Differential Revision: https://reviews.llvm.org/D46039
      
      From: Evgeny Stupachenko <evstupac@gmail.com>
                               <evgeny.v.stupachenko@intel.com>
      llvm-svn: 332426
      bff9302c
    • Richard Smith's avatar
      Fix 32-bit buildbots. · 5412b21d
      Richard Smith authored
      llvm-svn: 332425
      5412b21d