1. Dec 29, 2016
  2. Dec 28, 2016
    • Davide Italiano's avatar
      [NewGVN] Global sweep replacing NULL with nullptr. NFCI. · 0e714805
      Davide Italiano authored
      llvm-svn: 290670
      0e714805
    • Davide Italiano's avatar
      [NewGVN] Remove redundant code. NFCI. · 0fb3c7cd
      Davide Italiano authored
      llvm-svn: 290669
      0fb3c7cd
    • Alexander Kornienko's avatar
    • Davide Italiano's avatar
      [NewGVN] equals() for loads/stores is the same. Unify. · b1114090
      Davide Italiano authored
      Differential Revision:  https://reviews.llvm.org/D28116
      
      llvm-svn: 290667
      b1114090
    • Eric Fiselier's avatar
      Fix typo in comment · 99940720
      Eric Fiselier authored
      llvm-svn: 290666
      99940720
    • Chandler Carruth's avatar
      [PM] Introduce a devirtualization iteration layer for the new PM. · 05ca5acc
      Chandler Carruth authored
      This is an orthogonal and separated layer instead of being embedded
      inside the pass manager. While it adds a small amount of complexity, it
      is fairly minimal and the composability and control seems worth the
      cost.
      
      The logic for this ends up being nicely isolated and targeted. It should
      be easy to experiment with different iteration strategies wrapped around
      the CGSCC bottom-up walk using this kind of facility.
      
      The mechanism used to track devirtualization is the simplest one I came
      up with. I think it handles most of the cases the existing iteration
      machinery handles, but I haven't done a *very* in depth analysis. It
      does however match the basic intended semantics, and we can tweak or
      tune its exact behavior incrementally as necessary. One thing that we
      may want to revisit is freshly building the value handle set on each
      iteration. While I don't think this will be a significant cost (it is
      strictly fewer value handles but more churn of value handes than the old
      call graph), it is conceivable that we'll want a somewhat more clever
      tracking mechanism. My hope is to layer that on as a follow up patch
      with data supporting any implementation complexity it adds.
      
      This code also provides for a basic count heuristic: if the number of
      indirect calls decreases and the number of direct calls increases for
      a given function in the SCC, we assume devirtualization is responsible.
      This matches the heuristics currently used in the legacy pass manager.
      
      Differential Revision: https://reviews.llvm.org/D23114
      
      llvm-svn: 290665
      05ca5acc
    • Chandler Carruth's avatar
      [PM] Teach the CGSCC's CG update utility to more carefully invalidate · 443e57e0
      Chandler Carruth authored
      analyses when we're about to break apart an SCC.
      
      We can't wait until after breaking apart the SCC to invalidate things:
      1) Which SCC do we then invalidate? All of them?
      2) Even if we invalidate all of them, a newly created SCC may not have
         a proxy that will convey the invalidation to functions!
      
      Previously we only invalidated one of the SCCs and too late. This led to
      stale analyses remaining in the cache. And because the caching strategy
      actually works, they would get used and chaos would ensue.
      
      Doing invalidation early is somewhat pessimizing though if we *know*
      that the SCC structure won't change. So it turns out that the design to
      make the mutation API force the caller to know the *kind* of mutation in
      advance was indeed 100% correct and we didn't do enough of it. So this
      change also splits two cases of switching a call edge to a ref edge into
      two separate APIs so that callers can clearly test for this and take the
      easy path without invalidating when appropriate. This is particularly
      important in this case as we expect most inlines to be between functions
      in separate SCCs and so the common case is that we don't have to so
      aggressively invalidate analyses.
      
      The LCG API change in turn needed some basic cleanups and better testing
      in its unittest. No interesting functionality changed there other than
      more coverage of the returned sequence of SCCs.
      
      While this seems like an obvious improvement over the current state, I'd
      like to revisit the core concept of invalidating within the CG-update
      layer at all. I'm wondering if we would be better served forcing the
      callers to handle the invalidation beforehand in the cases that they
      can handle it. An interesting example is when we want to teach the
      inliner to *update and preserve* analyses. But we can cross that bridge
      when we get there.
      
      With this patch, the new pass manager an build all of the LLVM test
      suite at -O3 and everything passes. =D I haven't bootstrapped yet and
      I'm sure there are still plenty of bugs, but this gives a nice baseline
      so I'm going to increasingly focus on fleshing out the missing
      functionality, especially the bits that are just turned off right now in
      order to let us establish this baseline.
      
      llvm-svn: 290664
      443e57e0
    • Gadi Haber's avatar
      This is a large patch for X86 AVX-512 of an optimization for reducing code... · 19c4fc5e
      Gadi Haber authored
      This is a large patch for X86 AVX-512 of an optimization for reducing code size by encoding EVEX AVX-512 instructions using the shorter VEX encoding when possible.
      
      There are cases of AVX-512 instructions that have two possible encodings. This is the case with instructions that use vector registers with low indexes of 0 - 15 and do not use the zmm registers or the mask k registers.
      The EVEX encoding prefix requires 4 bytes whereas the VEX prefix can take only up to 3 bytes. Consequently, using the VEX encoding for these instructions results in a code size reduction of ~2 bytes even though it is compiled with the AVX-512 features enabled.
      
      Reviewers: Craig Topper, Zvi Rackoover, Elena Demikhovsky 
      Differential Revision: https://reviews.llvm.org/D27901
      
      llvm-svn: 290663
      19c4fc5e
    • Eric Fiselier's avatar
      Fix ABI incompatible C++03 nullptr_t · b9565705
      Eric Fiselier authored
      In C++03 libc++ emulates nullptr_t using a class, and #define's nullptr.
      However this makes nullptr_t mangle differently between C++03 and C++11.
      This breaks any function ABI which takes nullptr_t.
      
      Thanfully Clang provides __nullptr in all dialects. This patch adds
      an ABI option to switch to using __nullptr in C++03. In a perfect world
      I would like to turn this on by default, since it's just ABI breaking fix
      to an ABI breaking bug.
      
      llvm-svn: 290662
      b9565705
    • George Burgess IV's avatar
      [CodeGen] Unique constant CompoundLiterals. · 1a39b86d
      George Burgess IV authored
      Our newly aggressive constant folding logic makes it possible for
      CGExprConstant to see the same CompoundLiteralExpr more than once. So,
      emitting a new GlobalVariable every time we see a CompoundLiteral is no
      longer correct.
      
      We had a similar issue with BlockExprs that was caught while testing
      said aggressive folding, so I applied the same style of fix (see D26410)
      here. If we find yet another case where this needs to happen, we should
      probably refactor this so we don't have a third DenseMap+getter+setter.
      
      As a design note: getAddrOfConstantCompoundLiteralIfEmitted is really
      only intended to be called by ConstExprEmitter::EmitLValue. So,
      returning a GlobalVariable* instead of a ConstantAddress costs us
      effectively nothing, and saves us either a few bytes per entry in our
      map or a bit of code duplication.
      
      llvm-svn: 290661
      1a39b86d
    • Richard Smith's avatar
      Mark 'auto' as dependent when instantiating the type of a non-type template · 15361a21
      Richard Smith authored
      parameter. Fixes failed deduction for 'auto' non-type template parameters
      nested within templates.
      
      llvm-svn: 290660
      15361a21
    • Eric Fiselier's avatar
      Remove dead debug_mode doc link · 873c275c
      Eric Fiselier authored
      llvm-svn: 290659
      873c275c
    • Eric Fiselier's avatar
      Ensure <__debug> gets the nullptr definition in C++03 · d5ae0257
      Eric Fiselier authored
      llvm-svn: 290658
      d5ae0257
    • Eric Fiselier's avatar
      Fix debug mode for vector/list and cleanup tests · 2e519579
      Eric Fiselier authored
      llvm-svn: 290657
      2e519579
    • Eric Fiselier's avatar
      Fix stupid build error caused by a stupid person · 8dd73d8e
      Eric Fiselier authored
      llvm-svn: 290656
      8dd73d8e
    • Eric Fiselier's avatar
      Add tests for unordered container tests and std::string · 780b51df
      Eric Fiselier authored
      llvm-svn: 290655
      780b51df
    • Eric Fiselier's avatar
      Fix __wrap_iter in debug mode and apply _NOEXCEPT_DEBUG to it · 14bd0bf0
      Eric Fiselier authored
      llvm-svn: 290654
      14bd0bf0
    • Eric Fiselier's avatar
      Fix build errors in C++03 caused by recent debug changes · c842c8d8
      Eric Fiselier authored
      llvm-svn: 290653
      c842c8d8
    • Eric Fiselier's avatar
      Fix debug mode build w/o exceptions · ab768a85
      Eric Fiselier authored
      llvm-svn: 290652
      ab768a85
    • Eric Fiselier's avatar
      Implement a throwing version of _LIBCPP_ASSERT. · 687d3213
      Eric Fiselier authored
      This patch implements changes to allow _LIBCPP_ASSERT to throw on failure
      instead of aborting. The main changes needed to do this are:
      
      1. Change _LIBCPP_ASSERT to call a handler via a replacable function pointer
         instead of calling abort directly. Additionally this patch implements two
         handler functions, one which aborts and another that throws an exception.
      
      2. Add _NOEXCEPT_DEBUG macro for disabling noexcept spec on function which
         contain _LIBCPP_ASSERT. This is required in order to prevent assertion
         failures throwing through a noexcept function. This macro has no effect
         unless _LIBCPP_DEBUG_USE_EXCEPTIONS is defined.
      
      Having a non-aborting _LIBCPP_ASSERT is very important to allow sane testing of
      debug mode. Currently we can only have one test case per file, since the test
      case will cause the program to abort. Testing debug mode this way would require
      thousands of test files, most of which would be 95% boiler plate. I don't think
      this is a feasible strategy. Fortunately using a throwing debug handler solves
      these issues.
      
      Additionally this patch rewrites the documentation for debug mode.
      
      llvm-svn: 290651
      687d3213
    • Kostya Serebryany's avatar
      add cxa_demangle_fuzzer · 4eb60cb9
      Kostya Serebryany authored
      Summary:
      All easy-to-find bugs in cxa_demangle where fixed now
      (https://bugs.chromium.org/p/chromium/issues/detail?id=606626)
      except for one (https://llvm.org/bugs/show_bug.cgi?id=31031).
      Now I'd like to properly integrate this fuzzer with the source tree
      and then run the fuzzer continuously on https://github.com/google/oss-fuzz
      
      Reviewers: compnerd, mclow.lists, mehdi_amini
      
      Subscribers: cfe-commits, mgorny
      
      Differential Revision: https://reviews.llvm.org/D28133
      
      llvm-svn: 290650
      4eb60cb9
    • Chandler Carruth's avatar
      [PM] Teach the inliner's call graph update to handle inserting new edges · 9900d18b
      Chandler Carruth authored
      when they are call edges at the leaf but may (transitively) be reached
      via ref edges.
      
      It turns out there is a simple rule: insert everything as a ref edge
      which is a safe conservative default. Then we let the existing update
      logic handle promoting some of those to call edges.
      
      Note that it would be fairly cheap to make these call edges right away
      if that is desirable by testing whether there is some existing call path
      from the source to the target. It just seemed like slightly more
      complexity in this code path that isn't strictly necessary. If anyone
      feels strongly about handling this differently I'm happy to change it.
      
      llvm-svn: 290649
      9900d18b
    • Craig Topper's avatar
      [InstCombine] Remove a piece of a comment that said that InstCombiner contains... · 28ec3460
      Craig Topper authored
      [InstCombine] Remove a piece of a comment that said that InstCombiner contains pass infrastructure. That hasn't been true since r226618. NFC
      
      llvm-svn: 290648
      28ec3460
    • Richard Smith's avatar
      DR1315: a non-type template argument in a partial specialization is permitted · 57aae07b
      Richard Smith authored
      to make reference to template parameters. This is only a partial
      implementation; we retain the restriction that the argument must not be
      type-dependent, since it's unclear how that would work given the existence of
      other language rules requiring an exact type match in this context, even for
      type-dependent cases (a question has been raised on the core reflector).
      
      llvm-svn: 290647
      57aae07b
    • Chandler Carruth's avatar
      [PM] Actually commit the test update that was supposed to accompany · 69c5cc69
      Chandler Carruth authored
      r290644. Sorry for this.
      
      llvm-svn: 290646
      69c5cc69
    • Chandler Carruth's avatar
      [LCG] Teach the ref edge removal to handle a ref edge that is trivial · c6334579
      Chandler Carruth authored
      due to a call cycle.
      
      This actually crashed the ref removal before.
      
      I've added a unittest that covers this kind of interesting graph
      structure and mutation.
      
      llvm-svn: 290645
      c6334579
    • Chandler Carruth's avatar
      [PM] Disable the loop vectorizer from the new PM's pipeline as it · e635289e
      Chandler Carruth authored
      currenty relies on the old PM's dependency system forming LCSSA.
      
      The new PM will require a different design for this, and for now this is
      causing most of the issues I'm currently seeing in testing. I'd like to
      get to a testable baseline and then work on re-enabling things one at
      a time.
      
      llvm-svn: 290644
      e635289e
    • Evgeniy Stepanov's avatar
      Fix unit test broken by D27873. · 8988ebb4
      Evgeniy Stepanov authored
      Summary:
      Reduce RSS size treshold in the unit test to accomodate for the smaller
      ASAN quarantine size on Android (see D27873).
      
      Reviewers: eugenis
      
      Patch by Alex Shlyapnikov.
      
      Subscribers: danalbert, kubabrecka, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D28132
      
      llvm-svn: 290643
      8988ebb4