1. Dec 30, 2016
  2. Dec 29, 2016
    • Sanjoy Das's avatar
      [TBAAVerifier] Be stricter around verifying scalar nodes · 00d76a57
      Sanjoy Das authored
      This fixes the issue exposed in PR31393, where we weren't trying
      sufficiently hard to diagnose bad TBAA metadata.
      
      This does reduce the variety in the error messages we print out, but I
      think the tradeoff of verifying more, simply and quickly overrules the
      need for more helpful error messags here.
      
      llvm-svn: 290713
      00d76a57
    • Sanjoy Das's avatar
      [TBAAVerifier] Make things const-consistent; NFC · 600d2a5a
      Sanjoy Das authored
      llvm-svn: 290712
      600d2a5a
    • Sanjoy Das's avatar
      [TBAAVerifier] Memoize validity of scalar tbaa nodes; NFCI · 55f12d9d
      Sanjoy Das authored
      llvm-svn: 290711
      55f12d9d
    • Artem Tamazov's avatar
      [AMDGPU][mc] Enable absolute expressions in .hsa_code_object_isa directive · 25478d82
      Artem Tamazov authored
      Among other stuff, this allows to use predefined .option.machine_version_major
      /minor/stepping symbols in the directive.
      
      Relevant test expanded at once (also file renamed for clarity).
      
      Differential Revision: https://reviews.llvm.org/D28140
      
      llvm-svn: 290710
      25478d82
    • Igor Laevsky's avatar
      Fix documentation generator warnings after rL290708. · fedab157
      Igor Laevsky authored
      llvm-svn: 290709
      fedab157
    • Igor Laevsky's avatar
      Introduce element-wise atomic memcpy intrinsic · 4f31e52f
      Igor Laevsky authored
      This change adds a new intrinsic which is intended to provide memcpy functionality
      with additional atomicity guarantees. Please refer to the review thread
      or language reference for further details.
      
      Differential Revision: https://reviews.llvm.org/D27133
      
      llvm-svn: 290708
      4f31e52f
    • Craig Topper's avatar
      [InstCombine] Use getVectorNumElements instead of explicitly casting to... · 17b5568b
      Craig Topper authored
      [InstCombine] Use getVectorNumElements instead of explicitly casting to VectorType and calling getNumElements. NFC
      
      llvm-svn: 290707
      17b5568b
    • Craig Topper's avatar
      [InstCombine] Fix typo in comment. NFC · 62f06e24
      Craig Topper authored
      llvm-svn: 290706
      62f06e24
    • Craig Topper's avatar
      [InstCombine] Use a 32-bits instead of 64-bits for storing the number of... · 2e18bcfc
      Craig Topper authored
      [InstCombine] Use a 32-bits instead of 64-bits for storing the number of elements in VectorType for a ShuffleVector. While there getVectorNumElements to avoid an explicit cast. NFC
      
      llvm-svn: 290705
      2e18bcfc
    • Craig Topper's avatar
      [InstCombine][X86] If the lowest element of a scalar intrinsic isn't used make... · 1a8a3377
      Craig Topper authored
      [InstCombine][X86] If the lowest element of a scalar intrinsic isn't used make sure we add it to the worklist so we can DCE it sooner.
      
      We bypassed the intrinsic and returned the passthru operand, but we should also add the intrinsic to the worklist since its now dead. This can allow DCE to find it sooner and remove it. Similar was done for InsertElement when the inserted element isn't demanded.
      
      llvm-svn: 290704
      1a8a3377
    • Kostya Serebryany's avatar
      [libFuzzer] make __sanitizer_cov_trace_switch more predictable · d723804f
      Kostya Serebryany authored
      llvm-svn: 290703
      d723804f
    • Craig Topper's avatar
      [InstCombine] Fix some of the AVX-512 scalar arithmetic test cases to do a... · b57a84da
      Craig Topper authored
      [InstCombine] Fix some of the AVX-512 scalar arithmetic test cases to do a better job of testing what they intended to test.
      
      The accidentally had trivially dead code. Also needed to adjust the rounding mode to not CUR_DIRECTION so the intrinsics don't get converted to native operations before going through SimplifyDemandedVectorElts.
      
      llvm-svn: 290702
      b57a84da
    • Mehdi Amini's avatar
      Remove BitstreamWriter::Emit64(), it was never called (NFC) · fce3af01
      Mehdi Amini authored
      llvm-svn: 290701
      fce3af01
    • Reid Kleckner's avatar
      Fix mingw build by moving the static const data member before the bitfields · 32f171fe
      Reid Kleckner authored
      Apparently GCC targeting Windows breaks bitfields on static data members:
        struct Foo {
          unsigned X : 16;
          static const int M = 42;
          unsigned Y : 16;
        };
        static_assert(sizeof(Foo) == 4, "asdf"); // fails
      
      Who knew.
      
      llvm-svn: 290700
      32f171fe
    • Daniel Berlin's avatar
      NewGVN: Sort Dominator Tree in RPO order, and use that for generating order. · 6658cc9e
      Daniel Berlin authored
      Summary:
      The optimal iteration order for this problem is RPO order. We want to
      process as many preds of a backedge as we can before we process the
      backedge.
      
      At the same time, as we add predicate handling, we want to be able to
      touch instructions that are dominated by a given block by
      ranges (because a change in value numbering a predicate possibly
      affects all users we dominate that are using that predicate).
      If we don't do it this way, we can't do value inference over
      backedges (the paper covers this in depth).
      
      The newgvn branch currently overshoots the last part, and guarantees
      that it will touch *at least* the right set of instructions, but it
      does touch more.  This is because the bitvector instruction ranges are
      currently generated in RPO order (so we take the max and the min of
      the ranges of dominated blocks, which means there are some in the
      middle we didn't have to touch that we did).
      
      We can do better by sorting the dominator tree, and then just using
      dominator tree order.
      
      As a preliminary, the dominator tree has some RPO guarantees, but not
      enough. It guarantees that for a given node, your idom must come
      before you in the RPO ordering. It guarantees no relative RPO ordering
      for siblings.  We add siblings in whatever order they appear in the module.
      
      So that is what we fix.
      
      We sort the children array of the domtree into RPO order, and then use
      the dominator tree for ordering, instead of RPO, since the dominator
      tree is now a valid RPO ordering.
      
      Note: This would help any other pass that iterates a forward problem
      in dominator tree order.  Most of them are single pass.  It will still
      maximize whatever result they compute.  We could also build the
      dominator tree in this order, but our incremental updates would still
      put it out of sort order, and recomputing the sort order is almost as
      hard as general incremental updates of the domtree.
      
      Also note that the sorting does not affect any tests, etc. Nothing
      depends on domtree order, including the verifier, the equals
      functions for domtree nodes, etc.
      
      How much could this matter, you ask?
      Here are the current numbers.
      This is generated by running NewGVN over all files in LLVM.
      
      Note that once we propagate equalities, the differences go up by an
      order of magnitude or two (IE instead of 29, the max ends up in the
      thousands, since the worst case we add a factor of N, where N is the
      number of branch predicates).  So while it doesn't look that stark for
      the default ordering, it gets *much much* worse.  There are also
      programs in the wild where the difference is already pretty stark
      (2 iterations vs hundreds).
      
      RPO ordering:
      759040 Number of iterations is 1
      112908 Number of iterations is 2
      
      Default dominator tree ordering:
      755081 Number of iterations is 1
      116234 Number of iterations is 2
         603 Number of iterations is 3
          27 Number of iterations is 4
           2 Number of iterations is 5
           1 Number of iterations is 7
      
      Dominator tree sorted:
      759040 Number of iterations is 1
      112908 Number of iterations is 2
      <yay!>
      
      Really bad ordering (sort domtree siblings in postorder. not quite the
      worst possible, but yeah):
      754008 Number of iterations is 1
          21 Number of iterations is 10
           8 Number of iterations is 11
           6 Number of iterations is 12
           5 Number of iterations is 13
           2 Number of iterations is 14
           2 Number of iterations is 15
           3 Number of iterations is 16
           1 Number of iterations is 17
           2 Number of iterations is 18
       96642 Number of iterations is 2
           1 Number of iterations is 20
           2 Number of iterations is 21
           1 Number of iterations is 22
           1 Number of iterations is 29
       17266 Number of iterations is 3
        2598 Number of iterations is 4
         798 Number of iterations is 5
         273 Number of iterations is 6
         186 Number of iterations is 7
          80 Number of iterations is 8
          42 Number of iterations is 9
      
      Reviewers: chandlerc, davide
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D28129
      
      llvm-svn: 290699
      6658cc9e
    • Reid Kleckner's avatar
      Add a static_assert about the sizeof(GlobalValue) · e9c8d7f8
      Reid Kleckner authored
      I added one for Value back in r262045, and I'm starting to think we
      should have these for any class with bitfields whose memory efficiency
      really matters.
      
      llvm-svn: 290698
      e9c8d7f8
    • Daniel Berlin's avatar
      7ad1ea09
    • Justin Lebar's avatar
      [GlobalValue] Move HasLLVMReservedName into existing bitfield. NFC · ddece375
      Justin Lebar authored
      Summary:
      Follow-up to r290691, where I introduced HasLLVMReservedName.  rnk
      pointed out that that patch added an extra word to GlobalValue on MSVC,
      because it doesn't pack bitfields with different types.
      
      This patch moves HasLLVMReservedName into the existing bitfield, where
      we appear to have plenty of bits to spare.
      
      Reviewers: rnk
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D28149
      
      llvm-svn: 290696
      ddece375
    • Justin Lebar's avatar
      [IR] Clarify that Value::getName() is not actually cheap. · 23a53501
      Justin Lebar authored
      It involves a hashtable lookup when the Value has a name.
      
      llvm-svn: 290695
      23a53501
    • Reid Kleckner's avatar
      [COFF] Use 32-bit jump table entries in .rdata for Win64 · c9e0a153
      Reid Kleckner authored
      Summary:
      We were already using 32-bit jump table entries, but this was a
      consequence of the default PIC model on Win64, and not an intentional
      design decision. This patch ensures that we always use 32-bit label
      difference jump table entries on Win64 regardless of the PIC model. This
      is a good idea because it saves executable size and object file size.
      
      Moving the jump tables to .rdata cleans up the disassembled object code
      and reduces the available ROP targets, but it requires adding one more
      RIP-relative lea to the code.  COFF doesn't have relocations to express
      the difference between two arbitrary symbols, so we can't use the jump
      table label in the label difference like we do elsewhere.
      
      Fixes PR31488
      
      Reviewers: majnemer, compnerd
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D28141
      
      llvm-svn: 290694
      c9e0a153
    • Mehdi Amini's avatar
      Change Metadata Index emission in the bitcode to use 2x32 bits for the placeholder · 5022bb72
      Mehdi Amini authored
      The Bitstream reader and writer are limited to handle a "size_t" at
      most, which means that we can't backpatch and read back a 64bits
      value on 32 bits platform.
      
      llvm-svn: 290693
      5022bb72
    • Piotr Padlewski's avatar
      Revert "[NewGVN] replace emplace_back with push_back" · 6c37d298
      Piotr Padlewski authored
      llvm-svn: 290692
      6c37d298
    • Justin Lebar's avatar
      Speed up Function::isIntrinsic() by adding a bit to GlobalValue. NFC · 291abd3e
      Justin Lebar authored
      Summary:
      Previously isIntrinsic() called getName().  This involves a hashtable
      lookup, so is nontrivially expensive.  And isIntrinsic() is called
      frequently, particularly by dyn_cast<IntrinsicInstr>.
      
      This patch steals a bit of IntID and uses that to store whether or not
      getName() starts with "llvm."
      
      Reviewers: bogner, arsenm, joker-eph
      
      Subscribers: sanjoy, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D22949
      
      llvm-svn: 290691
      291abd3e
    • Mehdi Amini's avatar
      Add an index for Module Metadata record in the bitcode · e98f9258
      Mehdi Amini authored
      This index record the position for each metadata record in
      the bitcode, so that the reader will be able to lazy-load
      on demand each individual record.
      
      We also make sure that every abbrev is emitted upfront so
      that the block can be skipped while reading.
      
      I don't plan to commit this before having the reader
      counterpart, but I figured this can be reviewed mostly
      independently.
      
      Recommit r290684 (was reverted in r290686 because a test
      was broken) after adding a threshold to avoid emitting
      the index when unnecessary (little amount of metadata).
      This optimization "hides" a limitation of the ability
      to backpatch in the bitstream: we can only backpatch
      safely when the position has been flushed. So if we emit
      an index for one metadata, it is possible that (part of)
      the offset placeholder hasn't been flushed and the backpatch
      will fail.
      
      Differential Revision: https://reviews.llvm.org/D28083
      
      llvm-svn: 290690
      e98f9258
    • Evgeniy Stepanov's avatar
      Decrease kLargeMalloc block size in ASAN unit tests. · c0e82d6b
      Evgeniy Stepanov authored
      Summary:
      Make kLargeMalloc big enough to be handled by secondary allocator
      and small enough to fit into quarantine for all configurations.
      It become too big to fit into quarantine on Android after D27873.
      
      Reviewers: eugenis
      
      Patch by Alex Shlyapnikov.
      
      Subscribers: danalbert, llvm-commits, kubabrecka
      
      Differential Revision: https://reviews.llvm.org/D28142
      
      llvm-svn: 290689
      c0e82d6b
    • Greg Clayton's avatar
      Fix the variable view in the "gui" curses mode so that variables whose... · 8369b28d
      Greg Clayton authored
      Fix the variable view in the "gui" curses mode so that variables whose children change will update correctly. Previously the variable view would update the children once and not change. If you were stepping through code where the dynamic type of a variable would change the value and its children, or a synthetic type (like say for a std::vector<int>), the variable view wouldn't update. Now it caches the children and uses the process stop ID to tell when the children need to be updated.
      
      llvm-svn: 290688
      8369b28d
    • Greg Clayton's avatar
      02f74b08
    • Saleem Abdulrasool's avatar
      Revert "Add an index for Module Metadata record in the bitcode" · 2b59eca1
      Saleem Abdulrasool authored
      This reverts commit a0ca6ae2d38339e4ede0dfa588086fc23d87e836.  Revert at
      Mehdi's request as it is breaking bots.
      
      llvm-svn: 290686
      2b59eca1
    • Piotr Padlewski's avatar
      [NewGVN] replace emplace_back with push_back · 629a7f2c
      Piotr Padlewski authored
      emplace_back is not faster if it is equivalent to push_back. In this cases emplaced value had the
      same type that the one stored in container. It is ugly and it might be even slower (see
      Scott Meyers presentation about emplacement).
      
      llvm-svn: 290685
      629a7f2c
    • Mehdi Amini's avatar
      Add an index for Module Metadata record in the bitcode · 32ca1481
      Mehdi Amini authored
      Summary:
      This index record the position for each metadata record in
      the bitcode, so that the reader will be able to lazy-load
      on demand each individual record.
      
      We also make sure that every abbrev is emitted upfront so
      that the block can be skipped while reading.
      
      I don't plan to commit this before having the reader
      counterpart, but I figured this can be reviewed mostly
      independently.
      
      Reviewers: pcc, tejohnson
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D28083
      
      llvm-svn: 290684
      32ca1481