1. Mar 02, 2017
    • Eric Fiselier's avatar
      Generate the test configuration even when LIBCXX_INCLUDE_TESTS=OFF. · d94189dc
      Eric Fiselier authored
      This patch changes the CMake configuration so that it always
      generates the test/lit.site.cfg file, even when testing is disabled.
      
      This allows users to test libc++ without requiring them to have
      a full LLVM checkout on their machine.
      
      llvm-svn: 296685
      d94189dc
    • Matthias Braun's avatar
      LIU:::Query: Query LiveRange instead of LiveInterval; NFC · 173e1143
      Matthias Braun authored
      - We only need the information from the base class, not the additional
        details in the LiveInterval class.
      - Spread more `const`
      - Some code cleanup
      
      llvm-svn: 296684
      173e1143
    • Reid Kleckner's avatar
      Elide argument copies during instruction selection · f7c0980c
      Reid Kleckner authored
      Summary:
      Avoids tons of prologue boilerplate when arguments are passed in memory
      and left in memory. This can happen in a debug build or in a release
      build when an argument alloca is escaped.  This will dramatically affect
      the code size of x86 debug builds, because X86 fast isel doesn't handle
      arguments passed in memory at all. It only handles the x86_64 case of up
      to 6 basic register parameters.
      
      This is implemented by analyzing the entry block before ISel to identify
      copy elision candidates. A copy elision candidate is an argument that is
      used to fully initialize an alloca before any other possibly escaping
      uses of that alloca. If an argument is a copy elision candidate, we set
      a flag on the InputArg. If the the target generates loads from a fixed
      stack object that matches the size and alignment requirements of the
      alloca, the SelectionDAG builder will delete the stack object created
      for the alloca and replace it with the fixed stack object. The load is
      left behind to satisfy any remaining uses of the argument value. The
      store is now dead and is therefore elided. The fixed stack object is
      also marked as mutable, as it may now be modified by the user, and it
      would be invalid to rematerialize the initial load from it.
      
      Supersedes D28388
      
      Fixes PR26328
      
      Reviewers: chandlerc, MatzeB, qcolombet, inglorion, hans
      
      Subscribers: igorb, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D29668
      
      llvm-svn: 296683
      f7c0980c
    • Adam Nemet's avatar
      New tool: opt-stats.py · b7278af5
      Adam Nemet authored
      I am planning to use this tool to find too noisy (missed) optimization
      remarks.  Long term it may actually be better to just have another tool that
      exports the remarks into an sqlite database and perform queries like this in
      SQL.
      
      This splits out the YAML parsing from opt-viewer.py into a new Python module
      optrecord.py.
      
      This is the result of the script on the LLVM testsuite:
      
      Total number of remarks        714433
      
      Top 10 remarks by pass:
        inline                         52%
        gvn                            24%
        licm                           13%
        loop-vectorize                  5%
        asm-printer                     3%
        loop-unroll                     1%
        regalloc                        1%
        inline-cost                     0%
        slp-vectorizer                  0%
        loop-delete                     0%
      
      Top 10 remarks:
        gvn/LoadClobbered              20%
        inline/Inlined                 19%
        inline/CanBeInlined            18%
        inline/NoDefinition             9%
        licm/LoadWithLoopInvariantAddressInvalidated  6%
        licm/Hoisted                    6%
        asm-printer/InstructionCount    3%
        inline/TooCostly                3%
        gvn/LoadElim                    3%
        loop-vectorize/MissedDetails    2%
      
      Beside some refactoring, I also changed optrecords not to use context to
      access global data (max_hotness).  Because of the separate module this would
      have required splitting context into two.  However it's not possible to access
      the optrecord context from the SourceFileRenderer when calling back to
      Remark.RelativeHotness.
      
      llvm-svn: 296682
      b7278af5
    • Zachary Turner's avatar
      Re-enable BinaryStreamTest.StreamReaderObject. · 7329569a
      Zachary Turner authored
      This was failing because I was using memcmp to compare two
      objects that included padding bytes, which were uninitialized.
      
      llvm-svn: 296681
      7329569a
    • Rui Ueyama's avatar
      Unbreak Windows bots. · 962a83fb
      Rui Ueyama authored
      llvm-svn: 296680
      962a83fb
    • Tobias Grosser's avatar
      [ScopInfo] Disable memory folding in case it results in multi-disjunct relations · c2f15108
      Tobias Grosser authored
      Multi-disjunct access maps can easily result in inbound assumptions which
      explode in case of many memory accesses and many parameters. This change reduces
      compilation time of some larger kernel from over 15 minutes to less than 16
      seconds.
      
      Interesting is the test case test/ScopInfo/multidim_param_in_subscript.ll
      which has a memory access
      
        [n] -> { Stmt_for_body3[i0, i1] -> MemRef_A[i0, -1 + n - i1] }
      
      which requires folding, but where only a single disjunct remains. We can still
      model this test case even when only using limited memory folding.
      
      For people only reading commit messages, here the comment that explains what
      memory folding is:
      
      To recover memory accesses with array size parameters in the subscript
      expression we post-process the delinearization results.
      
      We would normally recover from an access A[exp0(i) * N + exp1(i)] into an
      array A[][N] the 2D access A[exp0(i)][exp1(i)]. However, another valid
      delinearization is A[exp0(i) - 1][exp1(i) + N] which - depending on the
      range of exp1(i) - may be preferrable. Specifically, for cases where we
      know exp1(i) is negative, we want to choose the latter expression.
      
      As we commonly do not have any information about the range of exp1(i),
      we do not choose one of the two options, but instead create a piecewise
      access function that adds the (-1, N) offsets as soon as exp1(i) becomes
      negative. For a 2D array such an access function is created by applying
      the piecewise map:
      
      [i,j] -> [i, j] :      j >= 0
      [i,j] -> [i-1, j+N] :  j <  0
      
      After this patch we generate only the first case, except for situations where
      we can proove the first case to be invalid and can consequently select the
      second without introducing disjuncts.
      
      llvm-svn: 296679
      c2f15108
    • Rui Ueyama's avatar
      Don't implement the gdb hash table as a generic in-memory hash table. · d0e07b91
      Rui Ueyama authored
      Looks like .gdb.index and its support classes do things that they don't
      have to or shouldn't do do. This patch addresses one of these issues.
      
      GdbHashTab class is a hash table class. Just like other in-memory hash
      tables, that incrementally updates its internal data and resizes buckets
      as new elements are added so that key lookup is always fast.
      But that is completely not necessary.
      
      Unlike debuggers, we only produce hash tables for .gdb.index and
      never read them. So incrementally updating a hash table in memory is
      just a waste of resource and complicates the code. What we should
      do is to accumulate symbols and then create the final hash table
      at once.
      
      llvm-svn: 296678
      d0e07b91
    • Craig Topper's avatar
      [APInt] Optimize APInt creation from uint64_t · f78a6f08
      Craig Topper authored
      Summary:
      This patch moves the clearUnusedBits calls into the two different initialization paths for APInt from a uint64_t. This allows the compiler to better optimize the clearing of the unused bits for the single word case. And it puts the clearing for the multi word case into the initSlowCase function to save code. In the common case of initializing with 0 this allows the clearing to be completely optimized out for the single word case.
      
      On my local x86 build this is showing a ~45kb reduction in the size of the opt binary.
      
      Reviewers: RKSimon, hans, majnemer, davide, MatzeB
      
      Reviewed By: hans
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D30486
      
      llvm-svn: 296677
      f78a6f08
    • Matthias Braun's avatar
      LIU::Query: Remove unused getter; NFC · d9e4464c
      Matthias Braun authored
      llvm-svn: 296676
      d9e4464c
    • Matthias Braun's avatar
      LIU::Query: Remove always false member+getter; NFC · 702f55bb
      Matthias Braun authored
      llvm-svn: 296675
      702f55bb
    • Matthias Braun's avatar
      LiveIntervalUnion: Remove unused functions; NFC · cc26b91a
      Matthias Braun authored
      Remove two unused functions that are in fact bad API and should not be
      called anyway.
      
      llvm-svn: 296674
      cc26b91a
    • Sanjay Patel's avatar
      [InstCombine] use -instnamer and auto-generate complete checks; NFC · 3063affb
      Sanjay Patel authored
      llvm-svn: 296673
      3063affb
    • Zachary Turner's avatar
      Disable BinaryStreamTest.StreamReaderObject. · 097e9574
      Zachary Turner authored
      llvm-svn: 296672
      097e9574
    • Sanjay Patel's avatar
      [x86] add vector tests for more coverage of D30502; NFC · f8edc3e8
      Sanjay Patel authored
      llvm-svn: 296671
      f8edc3e8
    • Nemanja Ivanovic's avatar
      Improve scheduling with branch coalescing · b223cfab
      Nemanja Ivanovic authored
      This patch adds a MachineSSA pass that coalesces blocks that branch
      on the same condition.
      
      Committing on behalf of Lei Huang.
      
      Differential Revision: https://reviews.llvm.org/D28249
      
      llvm-svn: 296670
      b223cfab
    • Jim Ingham's avatar
      Add a sample_test directory with simple starter · 96b2530f
      Jim Ingham authored
      test cases for standard and "inline" tests.
      
      llvm-svn: 296669
      96b2530f
    • Nirav Dave's avatar
      [DAG] Prevent Stale nodes from entering worklist · 0a4703b5
      Nirav Dave authored
      Add check that deleted nodes do not get added to worklist. This can
      occur when a node's operand is simplified to an existing node.
      
      This fixes PR32108.
      
      Reviewers: jyknight, hfinkel, chandlerc
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D30506
      
      llvm-svn: 296668
      0a4703b5
    • Nirav Dave's avatar
      Add test cases for merging stores of multiply used stores · 3de7fce3
      Nirav Dave authored
      llvm-svn: 296667
      3de7fce3
    • Krzysztof Parzyszek's avatar
      8144f37d
    • Daniel Berlin's avatar
      NewGVN: Add debug counter for value numbering · 283a6087
      Daniel Berlin authored
      llvm-svn: 296665
      283a6087
    • Daniel Jasper's avatar
      clang-format: [JS] Properly format object literals with shorthands. · 893b8adc
      Daniel Jasper authored
      Before:
        return {
          a,
          b: 'b', c,
        };
      
      After:
        return {
          a,
          b: 'b',
          c,
        };
      
      llvm-svn: 296664
      893b8adc
    • Paul Robinson's avatar
      [DWARF] Print leading zeros in type signature · 8932d648
      Paul Robinson authored
      llvm-svn: 296663
      8932d648
    • Krzysztof Parzyszek's avatar
      [RDF] Add recursion limit to getAllReachingDefsRec · ebabd99a
      Krzysztof Parzyszek authored
      For large programs this function can take significant amounts of time.
      Let it abort gracefully when the program is too complex.
      
      llvm-svn: 296662
      ebabd99a
    • Zachary Turner's avatar
      [PDB] Fix and re-enable BinaryStreamArray test. · d2fd4aeb
      Zachary Turner authored
      This was due to the test stream choosing an arbitrary partition
      index for introducing the discontinuity rather than choosing
      an index that would be correctly aligned for the type of data.
      
      Also added an assertion into FixedStreamArray so that this will
      be caught on all bots in the future, and not just the UBSan bot.
      
      llvm-svn: 296661
      d2fd4aeb
    • Paul Robinson's avatar
      Reorder fields for better packing. (NFC) · f05e0b5a
      Paul Robinson authored
      llvm-svn: 296660
      f05e0b5a
    • Daniel Jasper's avatar
      clang-format: [JS/TS] Properly understand cast expressions. · 01b8783a
      Daniel Jasper authored
      Many things were wrong:
      - We didn't always allow wrapping after "as", which can be necessary.
      - We used to Undestand the identifier after "as" as a start of a name.
      - We didn't properly parse the structure of the expression with "as"
        having the precedence of relational operators
      
      llvm-svn: 296659
      01b8783a
    • Bob Haarman's avatar
      enable building with LTO on Windows using clang-cl and lld · f947d8d1
      Bob Haarman authored
      Summary: With clang-cl gaining support for link-time optimization, we can now enable builds using LTO when using clang-cl and lld on Windows. To do this, we must not pass the -flto flag to the linker; lld-link does not understand it, but will perform LTO automatically when it encounters bitcode files. We also don't pass /Brepro when using LTO - the compiler doesn't generate object files for LTO, so passing the flag would only result in a warning about it being unused.
      
      Reviewers: rnk, ruiu, hans
      
      Reviewed By: hans
      
      Subscribers: mgorny, mehdi_amini, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D30240
      
      llvm-svn: 296658
      f947d8d1
    • Filipe Cabecinhas's avatar
      9a563daf
    • Bruno Cardoso Lopes's avatar
      [PCH] Avoid VarDecl emission attempt if no owning module avaiable · 84df6e99
      Bruno Cardoso Lopes authored
      This is a stopgap fix for PR31863, a regression introduced in r276159.
      
      Consider this snippet:
      
      struct FVector;
      struct FVector {};
      struct FBox {
        FVector Min;
        FBox(int);
      };
      namespace {
      FBox InvalidBoundingBox(0);
      }
      
      While parsing the DECL_VAR for 'struct FBox', clang recursively read all the
      dep decls until it finds the DECL_CXX_RECORD forward declaration for 'struct
      FVector'. Then, it resumes all the way up back to DECL_VAR handling in
      `ReadDeclRecord`, where it checks if `isConsumerInterestedIn` for the decl.
      
      One of the condition for `isConsumerInterestedIn` to return false is if the
      VarDecl is imported from a module `D->getImportedOwningModule()`, because it
      will get emitted when we import the relevant module. However, before checking
      if it comes from a module, clang checks if `Ctx.DeclMustBeEmitted(D)`, which
      triggers the emission of 'struct FBox'. Since one of its fields is still
      incomplete, it crashes.
      
      Instead, check if `D->getImportedOwningModule()` is true before calling
      `Ctx.DeclMustBeEmitted(D)`.
      
      Differential Revision: https://reviews.llvm.org/D29753
      
      rdar://problem/30173654
      
      llvm-svn: 296656
      84df6e99
    • Paul Robinson's avatar
      Alphabetize some cases (NFC) · d4f1c487
      Paul Robinson authored
      llvm-svn: 296655
      d4f1c487
    • Hans Wennborg's avatar
      Revert r296575 "[SLP] Fixes the bug due to absence of in order uses of scalars... · cc4ff78c
      Hans Wennborg authored
      Revert r296575 "[SLP] Fixes the bug due to absence of in order uses of scalars which needs to be available"
      
      It caused miscompiles, e.g. in Chromium (PR32109).
      
      llvm-svn: 296654
      cc4ff78c
    • Filipe Cabecinhas's avatar
      Reapply r296419: [asan] Print a "PC is at a non-executable memory region"... · 74ad3115
      Filipe Cabecinhas authored
      Reapply r296419: [asan] Print a "PC is at a non-executable memory region" message if that's the case
      
      Summary: Points the user to look at function pointer assignments.
      
      Reviewers: kcc, eugenis, kubamracek
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D30432
      
      llvm-svn: 296653
      74ad3115
    • Paul Robinson's avatar
      [DWARF] Default lower bound should respect requested DWARF version. · 91d74813
      Paul Robinson authored
      DWARF may define a default lower-bound for arrays in languages defined
      in a particular DWARF version.  But the logic to suppress an
      unnecessary lower-bound attribute was looking at the hard-coded
      default DWARF version, not the version that had been requested.
      
      Also updated the list with all languages defined in DWARF v5.
      
      Differential Revision: http://reviews.llvm.org/D30484
      
      llvm-svn: 296652
      91d74813
    • Artur Pilipenko's avatar
      [DAGCombiner] Support {a|s}ext, {a|z|s}ext load nodes in load combine · e1b2d314
      Artur Pilipenko authored
      Resubmit r295336 after the bug with non-zero offset patterns on BE targets is fixed (r296336).
      
      Support {a|s}ext, {a|z|s}ext load nodes as a part of load combine patters.
      
      Reviewed By: filcab
      
      Differential Revision: https://reviews.llvm.org/D29591
      
      llvm-svn: 296651
      e1b2d314
    • Rui Ueyama's avatar
      Add a reference to a Ulrich Drepper's paper. · 7986b454
      Rui Ueyama authored
      llvm-svn: 296650
      7986b454
    • Alex Lorenz's avatar
      Introduce an 'external_source_symbol' attribute that describes the origin · d5d27e16
      Alex Lorenz authored
      and the nature of a declaration
      
      This commit adds an external_source_symbol attribute to Clang. This attribute
      specifies that a declaration originates from an external source and describes
      the nature of that source. This attribute will be used to improve IDE features
      like 'jump-to-definition' for mixed-language projects or project that use
      auto-generated code.
      
      rdar://30423368
      
      Differential Revision: https://reviews.llvm.org/D29819
      
      llvm-svn: 296649
      d5d27e16
    • Charles Li's avatar
      [Test] NFC: Fixed typo in comments · ceccf2d7
      Charles Li authored
      Changed "declerations" to "declarations"
      
      llvm-svn: 296648
      ceccf2d7
    • Krzysztof Parzyszek's avatar
      [Hexagon] Fix testcase accidentally broken by r296645 · 5f4dedff
      Krzysztof Parzyszek authored
      llvm-svn: 296647
      5f4dedff
    • Devin Coughlin's avatar
      [analyzer] pr32088: Don't destroy the temporary if its initializer causes return. · bfa8e28d
      Devin Coughlin authored
      In the following code involving GNU statement-expression extension:
        struct S {
          ~S();
        };
      
        void foo() {
          const S &x = ({ return; S(); });
        }
      function 'foo()' returns before reference x is initialized. We shouldn't call
      the destructor for the temporary object lifetime-extended by 'x' in this case,
      because the object never gets constructed in the first place.
      
      The real problem is probably in the CFG somewhere, so this is a quick-and-dirty
      hotfix rather than the perfect solution.
      
      A patch by Artem Dergachev!
      
      rdar://problem/30759076
      
      Differential Revision: https://reviews.llvm.org/D30499
      
      llvm-svn: 296646
      bfa8e28d