1. Aug 13, 2019
    • Matt Arsenault's avatar
      GlobalISel: Add more verifier checks for G_SHUFFLE_VECTOR · 0a04a062
      Matt Arsenault authored
      llvm-svn: 368705
      0a04a062
    • Matt Arsenault's avatar
      GlobalISel: Change representation of shuffle masks · 5af9cf04
      Matt Arsenault authored
      Currently shufflemasks get emitted as any other constant, and you end
      up with a bunch of virtual registers of G_CONSTANT with a
      G_BUILD_VECTOR. The AArch64 selector then asserts on anything that
      doesn't fit this pattern. This isn't an ideal representation, and
      should avoid legalization and have fewer opportunities for a
      representational error.
      
      Rather than invent a new shuffle mask operand type, similar to what
      ShuffleVectorSDNode does, just track the original IR Constant mask
      operand. I don't completely like the idea of adding another link to
      the IR, but MIR is already quite dependent on IR constants already,
      and this will allow sharing the shuffle mask utility functions with
      the IR.
      
      llvm-svn: 368704
      5af9cf04
    • Louis Dionne's avatar
      [libc++] Always build with -fvisibility=hidden · 8a033a9e
      Louis Dionne authored
      Summary:
      This avoids symbols being accidentally exported from the dylib when they
      shouldn't. The next step is to use a pragma to apply hidden visibility
      to all declarations (unless otherwise specified), which will allow us
      to drop the per-declaration hidden visibility attributes we currently
      have.
      
      This also has the nice side effect of making sure the dylib exports the
      same symbols regardless of the optimization level.
      
      PR38138
      
      Reviewers: EricWF, mclow.lists
      
      Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits
      
      Tags: #libc
      
      Differential Revision: https://reviews.llvm.org/D62868
      
      llvm-svn: 368703
      8a033a9e
    • Roman Lebedev's avatar
      [CodeGen][SelectionDAG] More efficient code for X % C == 0 (SREM case) · 67659430
      Roman Lebedev authored
      Summary:
      This implements an optimization described in Hacker's Delight 10-17:
      when `C` is constant, the result of `X % C == 0` can be computed
      more cheaply without actually calculating the remainder.
      The motivation is discussed here: https://bugs.llvm.org/show_bug.cgi?id=35479.
      
      One huge caveat: this signed case is only valid for positive divisors.
      
      While we can freely negate negative divisors, we can't negate `INT_MIN`,
      so for now if `INT_MIN` is encountered, we bailout.
      As a follow-up, it should be possible to handle that more gracefully
      via extra `and`+`setcc`+`select`.
      
      This passes llvm's test-suite, and from cursory(!) cross-examination
      the folds (the assembly) match those of GCC, and manual checking via alive
      did not reveal any issues (other than the `INT_MIN` case)
      
      Reviewers: RKSimon, spatel, hermord, craig.topper, xbolva00
      
      Reviewed By: RKSimon, xbolva00
      
      Subscribers: xbolva00, thakis, javed.absar, hiraditya, dexonsmith, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D65366
      
      llvm-svn: 368702
      67659430
    • Roman Lebedev's avatar
      [TargetLowering][NFC] prepareUREMEqFold(): fixup comment · f4de7eda
      Roman Lebedev authored
      The comment initially matched the code, but the code was incorrect
      and was fixed after the initial revert back back when it was introduced,
      but the comment was never updated.
      
      llvm-svn: 368701
      f4de7eda
    • Yitzhak Mandelbaum's avatar
      [clang-tidy] Update `TransformerClangTidyCheck` to use new `buildMatchers` functionality. · 1896a31d
      Yitzhak Mandelbaum authored
      Summary:
      `buildMatchers` is the new, more general way to extract the matcher from a rule.
      This change migrates the code to use it instead of `buildMatcher`.
      
      Reviewers: gribozavr
      
      Subscribers: xazax.hun, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D65879
      
      llvm-svn: 368700
      1896a31d
    • Hubert Tong's avatar
      Revert r368691; test checked in without changes by accident · 07e66137
      Hubert Tong authored
      llvm-svn: 368699
      07e66137
    • Jordan Rupprecht's avatar
      [llvm-readelf] Implement note parsing for NT_FILE and unknown descriptors · 63ac3e5c
      Jordan Rupprecht authored
      Summary:
      This patch implements two note parsers; one for NT_FILE coredumps, e.g.:
      
      ```
        CORE                  0x00000080      NT_FILE (mapped files)
          Page size: 4096
                       Start                 End         Page Offset
          0x0000000000001000  0x0000000000002000  0x0000000000003000
              /path/to/a.out
          0x0000000000004000  0x0000000000005000  0x0000000000006000
              /path/to/libc.so
          0x0000000000007000  0x0000000000008000  0x0000000000009000
              [stack]
      ```
      
      (A more realistic example can be tested locally by creating a crashing program and running `llvm-readelf -n core`)
      
      And also implements a raw hex dump for unknown descriptor data for unhandled descriptor types.
      
      Reviewers: MaskRay, jhenderson, grimar, alexshap
      
      Reviewed By: MaskRay, grimar
      
      Subscribers: emaste, llvm-commits, labath
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D65832
      
      llvm-svn: 368698
      63ac3e5c
    • Momchil Velikov's avatar
      Enable memtag sanitizer in all AArch64 toolchains · 94166029
      Momchil Velikov authored
      That sanitizer does not have runtime library or other dependencies.
      
      Differential Revision: https://reviews.llvm.org/D65642
      
      llvm-svn: 368697
      94166029
    • Momchil Velikov's avatar
      [AArch64] Make the memtag sanitizer require the memtag extension · 5b25674b
      Momchil Velikov authored
      ... or otherwise we get an ICE.
      
      Differential Revision: https://reviews.llvm.org/D65508
      
      llvm-svn: 368696
      5b25674b
    • Raphael Isemann's avatar
      [lldb] Fix Microsoft guard variable detection · a23b2503
      Raphael Isemann authored
      Apparently we need to check for a suffix, not a prefix. This broke
      probably broke expression evaluation on Windows.
      
      llvm-svn: 368695
      a23b2503
    • Kristof Umann's avatar
      [analyzer][NFC] Refactoring BugReporter.cpp P2.: Clean up the construction of... · ed9cc407
      Kristof Umann authored
      [analyzer][NFC] Refactoring BugReporter.cpp P2.: Clean up the construction of bug paths and finding a valid report
      
      This patch refactors the utility functions and classes around the construction
      of a bug path.
      
      At a very high level, this consists of 3 steps:
      
      * For all BugReports in the same BugReportEquivClass, collect all their error
      nodes in a set. With that set, create a new, trimmed ExplodedGraph whose leafs
      are all error nodes.
      * Until a valid report is found, construct a bug path, which is yet another
      ExplodedGraph, that is linear from a given error node to the root of the graph.
      * Run all visitors on the constructed bug path. If in this process the report
      got invalidated, start over from step 2.
      
      Now, to the changes within this patch:
      
      * Do not allow the invalidation of BugReports up to the point where the trimmed
      graph is constructed. Checkers shouldn't add bug reports that are known to be
      invalid, and should use visitors and argue about the entirety of the bug path if
      needed.
      * Do not calculate indices. I may be biased, but I personally find code like
      this horrible. I'd like to point you to one of the comments in the original code:
      
      SmallVector<const ExplodedNode *, 32> errorNodes;
      for (const auto I : bugReports) {
        if (I->isValid()) {
          HasValid = true;
          errorNodes.push_back(I->getErrorNode());
        } else {
          // Keep the errorNodes list in sync with the bugReports list.
          errorNodes.push_back(nullptr);
        }
      }
      
      Not on my watch. Instead, use a far easier to follow trick: store a pointer to
      the BugReport in question, not an index to it.
      
      * Add range iterators to ExplodedGraph's successors and predecessors, and a
      visitor range to BugReporter.
      * Rename TrimmedGraph to BugPathGetter. Because that is what it has always been:
      no sane graph type should store an iterator-like state, or have an interface not
      exposing a single graph-like functionalities.
      * Rename ReportGraph to BugPathInfo, because it is only a linear path with some
      other context.
      * Instead of having both and out and in parameter (which I think isn't ever
      excusable unless we use the out-param for caching), return a record object with
      descriptive getter methods.
      * Where descriptive names weren't sufficient, compliment the code with comments.
      
      Differential Revision: https://reviews.llvm.org/D65379
      
      llvm-svn: 368694
      ed9cc407
    • Simon Pilgrim's avatar
      Fix -Wdocumentation warning (@returns used in void function). NFCI. · bda73ae0
      Simon Pilgrim authored
      llvm-svn: 368693
      bda73ae0
    • Simon Pilgrim's avatar
      Fix -Wdocumentation typo. NFCI. · 202d660a
      Simon Pilgrim authored
      llvm-svn: 368692
      202d660a
    • Hubert Tong's avatar
      [AIX] Implement LR prolog/epilog save/restore · 8f1db0cd
      Hubert Tong authored
      Summary:
      This patch fixes the offsets of fields in the stack frame linkage save
      area for AIX.
      
      Reviewers: sfertile, hubert.reinterpretcast, jasonliu, Xiangling_L, xingxue, ZarkoCA, daltenty
      
      Reviewed By: hubert.reinterpretcast
      
      Subscribers: wuzish, nemanjai, hiraditya, kbarton, MaskRay, jsji, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D64424
      
      Patch by Chris Bowler!
      
      llvm-svn: 368691
      8f1db0cd
    • Hubert Tong's avatar
      [AIX][test/Index] Set/propagate AIXTHREAD_STK for AIX · f635e28d
      Hubert Tong authored
      Summary:
      Some tests perform deep recursion, which requires a larger pthread stack
      size than the relatively low default of 192 KiB for 64-bit processes on
      AIX. The `AIXTHREAD_STK` environment variable provides a non-intrusive
      way to request a larger pthread stack size for the tests. The required
      pthread stack size depends on the build configuration.
      
      A 4 MiB default is generous compared to the 512 KiB of macOS; however,
      it is known that some compilers on AIX produce code that uses
      comparatively more stack space.
      
      Reviewers: xingxue, daltenty, jasonliu
      
      Reviewed By: daltenty
      
      Subscribers: arphaman, jfb, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D65688
      
      llvm-svn: 368690
      f635e28d
    • Kristof Umann's avatar
      [analyzer][NFC] Refactoring BugReporter.cpp P1.: Store interesting symbols/regions in a simple set · b9bd6ebe
      Kristof Umann authored
      The goal of this refactoring effort was to better understand how interestingness
      was propagated in BugReporter.cpp, which eventually turned out to be a dead end,
      but with such a twist, I wouldn't even want to spoil it ahead of time. However,
      I did get to learn a lot about how things are working in there.
      
      In these series of patches, as well as cleaning up the code big time, I invite
      you to study how BugReporter.cpp operates, and discuss how we could design this
      file to reduce the horrible mess that it is.
      
      This patch reverts a great part of rC162028, which holds the title "Allow
      multiple PathDiagnosticConsumers to be used with a BugReporter at the same
      time.". This, however doesn't imply that there's any need for multiple "layers"
      or stacks of interesting symbols and regions, quite the contrary, I would argue
      that we would like to generate the same amount of information for all output
      types, and only process them differently.
      
      Differential Revision: https://reviews.llvm.org/D65378
      
      llvm-svn: 368689
      b9bd6ebe
    • Raphael Isemann's avatar
      [lldb] Reland "Refactor guard variable checks in IRForTarget" · 7f7b2966
      Raphael Isemann authored
      It seems the broken guard variable check for Windows was a feature(TM)
      and not a bug, so let's keep add a flag to the guard check that keeps
      the old behavior in the places where we ignored guard variables before.
      
      llvm-svn: 368688
      7f7b2966
    • Roman Lebedev's avatar
      [InstCombine] Non-canonical clamp-like pattern handling · 73f702ff
      Roman Lebedev authored
      Summary:
      Given a pattern like:
      ```
      %old_cmp1 = icmp slt i32 %x, C2
      %old_replacement = select i1 %old_cmp1, i32 %target_low, i32 %target_high
      %old_x_offseted = add i32 %x, C1
      %old_cmp0 = icmp ult i32 %old_x_offseted, C0
      %r = select i1 %old_cmp0, i32 %x, i32 %old_replacement
      ```
      it can be rewritten as more canonical pattern:
      ```
      %new_cmp1 = icmp slt i32 %x, -C1
      %new_cmp2 = icmp sge i32 %x, C0-C1
      %new_clamped_low = select i1 %new_cmp1, i32 %target_low, i32 %x
      %r = select i1 %new_cmp2, i32 %target_high, i32 %new_clamped_low
      ```
      Iff `-C1 s<= C2 s<= C0-C1`
      Also, `ULT` predicate can also be `UGE`; or `UGT` iff `C0 != -1` (+invert result)
      Also, `SLT` predicate can also be `SGE`; or `SGT` iff `C2 != INT_MAX` (+invert result)
      
      If `C1 == 0`, then all 3 instructions must be one-use; else at most either `%old_cmp1` or `%old_x_offseted` can have extra uses.
      NOTE: if we could reuse `%old_cmp1` as one of the comparisons we'll have to build, this could be less limiting.
      
      So there are two icmp's, each one with 3 predicate variants, so there are 9 fold variants:
      
      |     | ULT                            | UGE                             | UGT                             |
      | SLT | https://rise4fun.com/Alive/yIJ | https://rise4fun.com/Alive/5BfN | https://rise4fun.com/Alive/INH  |
      | SGE | https://rise4fun.com/Alive/hd8 | https://rise4fun.com/Alive/Abk  | https://rise4fun.com/Alive/PlzS |
      | SGT | https://rise4fun.com/Alive/VYG | https://rise4fun.com/Alive/oMY  | https://rise4fun.com/Alive/KrzC |
      {F9730206}
      
      This fold was brought up in https://reviews.llvm.org/D65148#1603922 by @dmgreen, and is needed to unblock that patch.
      This patch requires D65530.
      
      Reviewers: spatel, nikic, xbolva00, dmgreen
      
      Reviewed By: spatel
      
      Subscribers: hiraditya, llvm-commits, dmgreen
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D65765
      
      llvm-svn: 368687
      73f702ff
    • Roman Lebedev's avatar
    • Roman Lebedev's avatar
      [InstCombine] foldXorOfICmps(): don't give up on non-single-use ICmp's if all... · 2635c324
      Roman Lebedev authored
      [InstCombine] foldXorOfICmps(): don't give up on non-single-use ICmp's if all users are freely invertible
      
      Summary:
      This is rather unconventional..
      
      As the comment there says, we don't have much folds for xor-of-icmps,
      we try to turn them into an and-of-icmps, for which we have plenty of folds.
      But if the ICmp we need to invert is not single-use - we give up.
      
      As discussed in https://reviews.llvm.org/D65148#1603922,
      we may have a non-canonical CLAMP pattern, with bit match and
      select-of-threshold that we'll potentially clamp.
      As it can be seen in `canonicalize-clamp-with-select-of-constant-threshold-pattern.ll`,
      out of all 8 variations of the pattern, only two are **not** canonicalized into
      the variant with and+icmp instead of bit math.
      The reason is because the ICmp we need to invert is not single-use - we give up.
      
      We indeed can't perform this fold at will, the general rule is that
      we should not increase instruction count in InstCombine,
      
      But we wouldn't end up increasing instruction count if we can adapt every other
      user to the inverted value. This way the `not` we create **will** get folded,
      and in the end the instruction count did not increase.
      
      For that, of course, we need to look at the users of a Value,
      which is again rather unconventional for InstCombine :S
      
      Thus i'm proposing to be a little bit more insistive in `foldXorOfICmps()`.
      The alternatives would be to not create that `not`, but add duplicate code to
      manually invert all users; or to add some even less general combine to handle
      some more specific pattern[s].
      
      Reviewers: spatel, nikic, RKSimon, craig.topper
      
      Reviewed By: spatel
      
      Subscribers: hiraditya, jdoerfert, dmgreen, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D65530
      
      llvm-svn: 368685
      2635c324
    • Louis Dionne's avatar
      [pstl] Allow customizing whether per-TU insulation is provided · 1b6d6e59
      Louis Dionne authored
      Like we do in libc++, PSTL needs the ability to constrain
      ABI-unstable symbols to each translation unit. This is OFF by
      default (like for libc++), because most people don't care about
      this and there is a cost associated to enabling the option (code
      bloat because templates are not deduped across TUs).
      
      I'm using '#pragma clang attribute push' to avoid marking each
      declaration with an attribute, which quickly becomes difficult
      to maintain.
      
      llvm-svn: 368684
      1b6d6e59
    • Yitzhak Mandelbaum's avatar
      [libTooling] In Transformer, generalize `applyFirst` to admit rules with incompatible matchers. · 42b957aa
      Yitzhak Mandelbaum authored
      Summary:
      This patch removes an (artificial) limitation of `applyFirst`, which requires
      that all of the rules' matchers can be grouped together in a single `anyOf()`.
      This change generalizes the code to group the matchers into separate `anyOf`s
      based on compatibility. Correspondingly, `buildMatcher` is changed to
      `buildMatchers`, to allow for returning a set of matchers rather than just one.
      
      Reviewers: gribozavr
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D65877
      
      llvm-svn: 368681
      42b957aa
    • Raphael Isemann's avatar
      [lldb][NFC] Add basic IOHandler completion test · 2515640a
      Raphael Isemann authored
      We have no test coverage for the IOHandler code that is doing the
      completion in the command line. This is adding a pexpect-based test
      as a preparation for the switch to using CompletionRequest in the
      whole completion machinery.
      
      llvm-svn: 368679
      2515640a
    • George Rimar's avatar
      [llvm-readobj] - Remove 'error(Error EC)' helper. · 36f23182
      George Rimar authored
      We do not need it. I replaced it with
      reportError(StringRef Input, Error Err).
      
      Differential revision: https://reviews.llvm.org/D66011
      
      llvm-svn: 368677
      36f23182
    • Brian Gesiak's avatar
      [CodeGen] Disable UBSan for coroutine functions · f8d6836f
      Brian Gesiak authored
      Summary:
      As explained in http://lists.llvm.org/pipermail/llvm-dev/2018-March/121924.html,
      the LLVM coroutines transforms are not yet able to move the
      instructions for UBSan null checking past coroutine suspend boundaries.
      For now, disable all UBSan checks when generating code for coroutines
      functions.
      
      I also considered an approach where only '-fsanitize=null' would be disabled,
      However in practice this led to other LLVM errors when writing object files:
      "Cannot represent a difference across sections". For now, disable all
      UBSan checks until coroutine transforms are updated to handle them.
      
      Test Plan:
      1. check-clang
      2. Compile the program in https://gist.github.com/modocache/54a036c3bf9c06882fe85122e105d153
         using the '-fsanitize=null' option and confirm it does not crash
         during LLVM IR generation.
      
      Reviewers: GorNishanov, vsk, eric_niebler, lewissbaker
      
      Reviewed By: vsk
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D44672
      
      llvm-svn: 368675
      f8d6836f
    • Louis Dionne's avatar
      [pstl] Rename PARALLELSTL_BACKEND to PSTL_PARALLEL_BACKEND · 5065e781
      Louis Dionne authored
      It makes more sense to name configuration options as PSTL_XXX.
      Also, I'm naming it PSTL_PARALLEL_BACKEND because we might introduce
      the ability to customize the vectorization backend, in which case
      PSTL_BACKEND would become ambiguous.
      
      llvm-svn: 368672
      5065e781
    • Nico Weber's avatar
      gn build: Extract git() and git_out() functions in sync script · 58f03f21
      Nico Weber authored
      llvm-svn: 368671
      58f03f21
    • Nico Weber's avatar
      gn build: Merge r368630 · 7ed816ba
      Nico Weber authored
      llvm-svn: 368668
      7ed816ba
    • Nico Weber's avatar
      gn build: Give cmake sync script an opt-in --write flag · d5f873e6
      Nico Weber authored
      Differential Revision: https://reviews.llvm.org/D66101
      
      llvm-svn: 368667
      d5f873e6
    • Louis Dionne's avatar
      [libc++] Fix incorrect UNSUPPORTED annotation · fa8cb90e
      Louis Dionne authored
      The test was marked as UNSUPPORTED for clang-6 and clang-6, instead of
      clang-6 and clang-7.
      
      llvm-svn: 368666
      fa8cb90e
    • Nico Weber's avatar
      gn build: Make sync script group output by revision · 01dab0ed
      Nico Weber authored
      Differential Revision: https://reviews.llvm.org/D66090
      
      llvm-svn: 368665
      01dab0ed
    • Louis Dionne's avatar
      [libc++] Use [[nodiscard]] for lock_guard, as an extension · 86dd28a5
      Louis Dionne authored
      Summary:
      D64914 added support for applying [[nodiscard]] to constructors. This
      commit uses that capability to flag incorrect uses of std::lock_guard
      where one forgets to actually create a variable for the lock_guard.
      
      rdar://45790820
      
      Reviewers: mclow.lists, EricWF
      
      Subscribers: christof, jkorous, dexonsmith, libcxx-commits, Quuxplusone, lebedev.ri
      
      Tags: #libc
      
      Differential Revision: https://reviews.llvm.org/D65900
      
      llvm-svn: 368664
      86dd28a5
    • Simon Pilgrim's avatar
      [X86] XFormVExtractWithShuffleIntoLoad - handle shuffle mask scaling · e7b350a5
      Simon Pilgrim authored
      If the target shuffle mask is from a wider type, attempt to scale the mask so that the extraction can attempt to peek through.
      
      Fixes the regression mentioned in rL368662
      
      Reapplying this as rL368308 had to be reverted as part of rL368660 to revert rL368276
      
      llvm-svn: 368663
      e7b350a5
    • Simon Pilgrim's avatar
      [X86] SimplifyDemandedVectorElts - attempt to recombine target shuffle using... · 1a8d790c
      Simon Pilgrim authored
      [X86] SimplifyDemandedVectorElts - attempt to recombine target shuffle using DemandedElts mask (reapplied)
      
      If we don't demand all elements, then attempt to combine to a simpler shuffle.
      
      At the moment we can only do this if Depth == 0 as combineX86ShufflesRecursively uses Depth to track whether the shuffle has really changed or not - we'll need to change this before we can properly start merging combineX86ShufflesRecursively into SimplifyDemandedVectorElts. 
      
      The insertps-combine.ll regression is because XFormVExtractWithShuffleIntoLoad can't see through shuffles of different widths - this will be fixed in a follow-up commit.
      
      Reapplying this as rL368307 had to be reverted as part of rL368660 to revert rL368276
      
      llvm-svn: 368662
      1a8d790c
    • Fangrui Song's avatar
      [ELF] Don't special case symbolic relocations with 0 addend to ifunc in writable locations · dc06b0bc
      Fangrui Song authored
      Currently the following 3 relocation types do not trigger the creation
      of a canonical PLT (which changes STT_GNU_IFUNC to STT_FUNC and
      redirects all references):
      
      1) GOT-generating (`needsGot`)
      2) PLT-generating (`needsPlt`)
      3) R_ABS with 0 addend in a writable location. This is used for
        for ifunc function pointers in writable sections such as .data and .toc.
      
      This patch deletes case 3) to simplify the R_*_IRELATIVE generating
      logic added in D57371. Other advantages:
      
      * It is guaranteed no more than 1 R_*_IRELATIVE is created for an ifunc.
      * PPC64: no need to special case ifunc in toc-indirect to toc-relative relaxation. See D65755
      
      The deleted elf::addIRelativeRelocs demonstrates that one-pass scan
      through relocations makes several optimizations difficult. This is
      something we can think about in the future.
      
      Reviewed By: peter.smith
      
      Differential Revision: https://reviews.llvm.org/D65995
      
      llvm-svn: 368661
      dc06b0bc
    • Hans Wennborg's avatar
      Revert r368276 "[TargetLowering] SimplifyDemandedBits - call... · 5390d25f
      Hans Wennborg authored
      Revert r368276 "[TargetLowering] SimplifyDemandedBits - call SimplifyMultipleUseDemandedBits for ISD::EXTRACT_VECTOR_ELT"
      
      This introduced a false positive MemorySanitizer warning about use of
      uninitialized memory in a vectorized crc function in Chromium. That suggests
      maybe something is not right with this transformation. See
      https://crbug.com/992853#c7 for a reproducer.
      
      This also reverts the follow-up commits r368307 and r368308 which
      depended on this.
      
      > This patch attempts to peek through vectors based on the demanded bits/elt of a particular ISD::EXTRACT_VECTOR_ELT node, allowing us to avoid dependencies on ops that have no impact on the extract.
      >
      > In particular this helps remove some unnecessary scalar->vector->scalar patterns.
      >
      > The wasm shift patterns are annoying - @tlively has indicated that the wasm vector shift codegen are to be refactored in the near-term and isn't considered a major issue.
      >
      > Differential Revision: https://reviews.llvm.org/D65887
      
      llvm-svn: 368660
      5390d25f
    • Fangrui Song's avatar
      [ELF] Simplify handling of exportDynamic and isPreemptible · c6cd6235
      Fangrui Song authored
      In Writer::includeInDynSym(), exportDynamic is used by a Defined with
      protected or default visibility, to record whether it is required to be
      exported into .dynsym. It is set when any of the following conditions
      hold:
      
      1) There is an interposable symbol from a DSO (Undefined or SharedSymbol with default visibility)
      2) If -shared or --export-dynamic is specified, any symbol in an object file/bitcode sets this property, unless suppressed by canBeOmittedFromSymbolTable().
      3) --dynamic-list when producing an executable
      
      4) protected symbol from a DSO preempted by copy relocation/canonical PLT when
        --ignore-{data,function}-address-equality is specified
      5) ifunc is exported when -z ifunc-noplt is specified
      
      Bullet points 4) and 5) are irrelevant in this patch.
      
      Bullet 3) does not play well with 1) and 2). When -shared is specified,
      exportDynamic of most symbols is true. This makes it incapable to record
      --dynamic-list marked symbols. We thus have obscure:
      
          if (!config->shared)
            b->exportDynamic = true;
          else if (b->includeInDynsym())
            b->isPreemptible = true;
      
      This patch adds another bit `Symbol::inDynamicList` to record
      3). We can thus simplify handleDynamicList() by unifying the DSO and
        executable cases. It also allows us to simplify isPreemptible - now
      the field is only used in finalizeSections() and later stages.
      
      Reviewed By: peter.smith
      
      Differential Revision: https://reviews.llvm.org/D66091
      
      llvm-svn: 368659
      c6cd6235
    • David Bolvansky's avatar
      [NFC] Updated tests after r368657 · c3012b2c
      David Bolvansky authored
      llvm-svn: 368658
      c3012b2c
    • David Bolvansky's avatar
      [SimplifyLibCalls] Add dereferenceable bytes from known callsites · 39130314
      David Bolvansky authored
      Summary:
      int mm(char *a, char *b) {
          return memcmp(a,b,16);
      }
      
      Currently:
      define dso_local i32 @mm(i8* nocapture readonly %a, i8* nocapture readonly %b) local_unnamed_addr #1 {
      entry:
        %call = tail call i32 @memcmp(i8* %a, i8* %b, i64 16)
        ret i32 %call
      }
      
      After patch:
      define dso_local i32 @mm(i8* nocapture readonly %a, i8* nocapture readonly %b) local_unnamed_addr #1 {
      entry:
        %call = tail call i32 @memcmp(i8* dereferenceable(16)  %a, i8* dereferenceable(16)  %b, i64 16)
        ret i32 %call
      }
      
      
      
      
      Reviewers: jdoerfert, efriedma
      
      Reviewed By: jdoerfert
      
      Subscribers: javed.absar, spatel, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66079
      
      llvm-svn: 368657
      39130314