1. Apr 13, 2019
    • Chen Zheng's avatar
      fc59a032
    • Richard Smith's avatar
      [verify] Add support for location markers in directives. · 4e8144a0
      Richard Smith authored
      A marker (matching /#[A-Za-z0-9_-]/) is specified by attaching a comment
      containing the marker to the line at which the diagnostic is expected,
      and then can be referenced from an expected-* directive after an @:
      
        foo // #1
        // expected-error@#1 {{undeclared identifier 'foo'}}
      
      The intent is for markers to be used in situations where relative line
      numbers are currently used, to avoid the need to renumber when the test
      case is rearranged.
      
      llvm-svn: 358326
      4e8144a0
    • Philip Reames's avatar
      [StackMaps] Update llvm-readobj to parse V3 Stackmaps · e03301a3
      Philip Reames authored
      This updates the StackMap parser in the llvm-readobj tool to parse version 3 StackMaps, which were bumped in https://reviews.llvm.org/D32629.
      
      Version 3 StackMaps differ in that they have a uint16 sized "location size" field which was added to the Location block in a StackMap record. The record has additional padding for alignment. This was a backwards incompatible change resulting in a StackMap version bump.
      
      Patch By: jacob.hughes@kcl.ac.uk (with a rewrite of tests by me)
      Differential Revision: https://reviews.llvm.org/D59020
      
      llvm-svn: 358325
      e03301a3
    • Philip Reames's avatar
      [StackMaps] Add location size to llvm-readobj -stackmap output · eea989a9
      Philip Reames authored
      The size field of a location can be different for each entry, so it is useful to have this displayed in the output of llvm-readobj -stackmap. Below is an example of how the output would look:
      
      Record ID: 2882400000, instruction offset: 16
         3 locations:
           #1: Constant 1, size: 8
           #2: Constant 2, size: 8
           #3: Constant 3, size: 8
         0 live-outs: [ ]
      
      Patch By: jacob.hughes@kcl.ac.uk (with heavy modification by me)
      Differential Revision: https://reviews.llvm.org/D59169
      
      llvm-svn: 358324
      eea989a9
    • Philip Reames's avatar
      [llvm-readobj] Minor style tweak for consistency sake [NFC] · f7acef9c
      Philip Reames authored
      llvm-svn: 358323
      f7acef9c
    • Philip Reames's avatar
      [StackMaps] Remove format version from the class name [NFC] · 377f507a
      Philip Reames authored
      Motivation is to reduce silly diffs when we change the format.  For instance, this causes most of D59020 to disappear.
      
      llvm-svn: 358322
      377f507a
    • Artem Dergachev's avatar
      [analyzer] Escape pointers stored into top-level parameters with destructors. · 7d469454
      Artem Dergachev authored
      Writing stuff into an argument variable is usually equivalent to writing stuff
      to a local variable: it will have no effect outside of the function.
      There's an important exception from this rule: if the argument variable has
      a non-trivial destructor, the destructor would be invoked on
      the parent stack frame, exposing contents of the otherwise dead
      argument variable to the caller.
      
      If such argument is the last place where a pointer is stored before the function
      exits and the function is the one we've started our analysis from (i.e., we have
      no caller context for it), we currently diagnose a leak. This is incorrect
      because the destructor of the argument still has access to the pointer.
      The destructor may deallocate the pointer or even pass it further.
      
      Treat writes into such argument regions as "escapes" instead, suppressing
      spurious memory leak reports but not messing with dead symbol removal.
      
      Differential Revision: https://reviews.llvm.org/D60112
      
      llvm-svn: 358321
      7d469454
    • Kostya Serebryany's avatar
      [libFuzzer] speedup the merge step in the fork mode by merging only the files... · 5e67abd9
      Kostya Serebryany authored
      [libFuzzer] speedup the merge step in the fork mode by merging only the files that have unique features.
      
      llvm-svn: 358320
      5e67abd9
    • Philip Reames's avatar
      [StackMaps] Add explicit location size accessor to the stackmap parser · cebf0b3a
      Philip Reames authored
      The reserved uint8 field in the location block of the stackmap record is used to denote the size of the location.
      
      Patch By: jacob.hughes@kcl.ac.uk
      Differential Revision: https://reviews.llvm.org/D59167
      
      llvm-svn: 358319
      cebf0b3a
    • Amara Emerson's avatar
      [AArch64][GlobalISel] Enable copy elision in the pre-legalizer combine and fix a crash. · 93e58d23
      Amara Emerson authored
      This enables the simple copy combine that already exists in the CombinerHelper.
      However, it exposed a bug in the GISelChangeObserver where it wouldn't clear a
      set of MIs to process, and so would end up causing a crash when deleted MIs were
      being added to the combiner worklist again.
      
      Differential Revision: https://reviews.llvm.org/D60579
      
      llvm-svn: 358318
      93e58d23
    • Kostya Serebryany's avatar
      4614cc3d
    • Julian Lettner's avatar
      [TSan][libdispatch] Move libdispatch tests out of Darwin folder · c77bf89d
      Julian Lettner authored
      The libdispatch tests are now not tied to Darwin anymore. Move them to
      their own platform-independent folder.
      
      llvm-svn: 358316
      c77bf89d
    • Thomas Lively's avatar
      [WebAssembly] Add DataCount section to object files · fef8de66
      Thomas Lively authored
      Summary:
      This ensures that object files will continue to validate as
      WebAssembly modules in the presence of bulk memory operations. Engines
      that don't support bulk memory operations will not recognize the
      DataCount section and will report validation errors, but that's ok
      because object files aren't supposed to be run directly anyway.
      
      Reviewers: aheejin, dschuff, sbc100
      
      Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60623
      
      llvm-svn: 358315
      fef8de66
    • Amara Emerson's avatar
      [GlobalISel] Fix a crash when handling an invalid MVT during call lowering. · bdb5e4e4
      Amara Emerson authored
      This crash was introduced in r358032 as we try to construct an EVT from an MVT
      in order to find the register type for the calling conv. Fall back instead of
      trying to do this with an invalid MVT coming from i256.
      
      llvm-svn: 358314
      bdb5e4e4
    • Alina Sbirlea's avatar
      [MemorySSA] Add previous def to cache when found, even if trivial. · f9f073a8
      Alina Sbirlea authored
      Summary:
      When inserting a new Def, MemorySSA may be have non-minimal number of Phis.
      While inserting, the walk to find the previous definition may cleanup minimal Phis.
      When the last definition is trivial to obtain, we do not cache it.
      
      It is possible while getting the previous definition for a Def to get two different answers:
      - one that was straight-forward to find when walking the first path (a trivial phi in this case), and
      - another that follows a cleanup of the trivial phi, it determines it may need additional Phi nodes, it inserts them and returns a new phi in the same position as the former trivial one.
      While the Phis added for the second path are all redundant, they are not complete (the walk is only done upwards), and they are not properly cleaned up afterwards.
      
      A way to fix this problem is to cache the straight-forward answer we got on the first walk.
      The caching is only kept for the duration of a getPreviousDef call, and for Phis we use TrackingVH, so removing the trivial phi will lead to replacing it with the next dominating phi in the cache.
      Resolves PR40749.
      
      Reviewers: george.burgess.iv
      
      Subscribers: jlebar, Prazek, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60634
      
      llvm-svn: 358313
      f9f073a8
    • Amara Emerson's avatar
      [AArch64][GlobalISel] Fix a crash when selecting shufflevectors with an undef mask element. · 2806fd01
      Amara Emerson authored
      If a shufflevector's mask vector has an element with "undef" then the generic
      instruction defining that element register is a G_IMPLICT_DEF instead of G_CONSTANT.
      This fixes the selector to handle this case, and for now assumes that undef just means
      zero. In future we'll optimize this case properly.
      
      llvm-svn: 358312
      2806fd01
    • Max Moroz's avatar
      [libFuzzer] Fix DataFlow.cpp logic when tracing long inputs. · b6e6d3c7
      Max Moroz authored
      Summary:
      1. Do not create DFSan labels for the bytes which we do not trace. This is where we run out of labels at the first place.
      2. When dumping the traces on the disk, make sure to offset the label identifiers by the number of the first byte in the trace range.
      3. For the last label, make sure to write it at the last position of the trace bit string, as that label represents the input size, not any particular byte.
      
      Also fixed the bug with division in python which I've introduced when migrated the scripts to Python3 (`//` is required for integral division).
      
      Otherwise, the scripts are wasting too much time unsuccessfully trying to
      collect and process traces from the long inputs. For more context, see
      https://github.com/google/oss-fuzz/issues/1632#issuecomment-481761789
      
      Reviewers: kcc
      
      Reviewed By: kcc
      
      Subscribers: delcypher, #sanitizers, llvm-commits
      
      Tags: #llvm, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D60538
      
      llvm-svn: 358311
      b6e6d3c7
    • Thomas Lively's avatar
      [WebAssembly] Add mutable-globals to bleeding-edge CPU · 9e275149
      Thomas Lively authored
      Summary: This brings the backend in line with Clang.
      
      Reviewers: aheejin, dschuff
      
      Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60594
      
      llvm-svn: 358310
      9e275149
    • Julian Lettner's avatar
      [TSan][libdispatch] Don't link against Foundation · 66369782
      Julian Lettner authored
      Now that our tests don't depend on Foundation anymore,
      don't link it in.
      
      llvm-svn: 358309
      66369782
    • Julian Lettner's avatar
      [TSan][libdispatch] Replace NSTemporaryDirectory in tests · bfcbd677
      Julian Lettner authored
      After this change, most tests don't have a dependency on Foundation.
      
      Note: To hold the file name `tempnam` allocates a new buffer. We leak
            this buffer (omit the free), but I don't think we need to care.
      
      Reviewed By: kubamracek
      
      Differential Revision: https://reviews.llvm.org/D60591
      
      llvm-svn: 358308
      bfcbd677
    • Amy Huang's avatar
      Relanding r357928 with fixed debuginfo check. · 0d0334fe
      Amy Huang authored
      [MS] Add metadata for __declspec(allocator)
      
      Original summary:
      Emit !heapallocsite in the metadata for calls to functions marked with
      __declspec(allocator). Eventually this will be emitted as S_HEAPALLOCSITE debug
      info in codeview.
      
      Differential Revision: https://reviews.llvm.org/D60237
      
      llvm-svn: 358307
      0d0334fe
    • Kostya Serebryany's avatar
      [libFuzzer] support -runs=N in the fork mode. Make sure we see one-line... · 65132e21
      Kostya Serebryany authored
      [libFuzzer] support -runs=N in the fork mode. Make sure we see one-line reports from ubsan in the fork mode. Test both
      
      llvm-svn: 358306
      65132e21
    • Nikita Popov's avatar
      [ConstantRange] Clarify makeGuaranteedNoWrapRegion() guarantees; NFC · 3dc7c7ca
      Nikita Popov authored
      makeGuaranteedNoWrapRegion() is actually makeExactNoWrapRegion() as
      long as only one of NUW or NSW is specified. This is not obvious from
      the current documentation, and some code seems to think that it is
      only exact for single-element ranges. Clarify docs and add tests to
      be more confident this really holds.
      
      There are currently no users of makeGuaranteedNoWrapRegion() that
      pass both NUW and NSW. I think it would be best to drop support for
      this entirely and then rename the function to makeExactNoWrapRegion().
      
      Knowing that the no-wrap region is exact is useful, because we can
      backwards-constrain values. What I have in mind in particular is
      that LVI should be able to constrain values on edges where the
      with.overflow overflow flag is false.
      
      Differential Revision: https://reviews.llvm.org/D60598
      
      llvm-svn: 358305
      3dc7c7ca
    • Alina Sbirlea's avatar
      [SCEV] Add option to forget everything in SCEV. · 2312a06c
      Alina Sbirlea authored
      Summary:
      Create a method to forget everything in SCEV.
      Add a cl::opt and PassManagerBuilder option to use this in LoopUnroll.
      
      Motivation: Certain Halide applications spend a very long time compiling in forgetLoop, and prefer to forget everything and rebuild SCEV from scratch.
      Sample difference in compile time reduction: 21.04 to 14.78 using current ToT release build.
      Testcase showcasing this cannot be opensourced and is fairly large.
      
      The option disabled by default, but it may be desirable to enable by
      default. Evidence in favor (two difference runs on different days/ToT state):
      
      File Before (s) After (s)
      clang-9.bc 7267.91 6639.14
      llvm-as.bc 194.12 194.12
      llvm-dis.bc 62.50 62.50
      opt.bc 1855.85 1857.53
      
      File Before (s) After (s)
      clang-9.bc 8588.70 7812.83
      llvm-as.bc 196.20 194.78
      llvm-dis.bc 61.55 61.97
      opt.bc 1739.78 1886.26
      
      Reviewers: sanjoy
      
      Subscribers: mehdi_amini, jlebar, zzheng, javed.absar, dmgreen, jdoerfert, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60144
      
      llvm-svn: 358304
      2312a06c
    • Alina Sbirlea's avatar
      [MemorySSA] Small fix for the clobber limit. · 57769382
      Alina Sbirlea authored
      Summary:
      After introducing the limit for clobber walking, `walkToPhiOrClobber` would assert that the limit is at least 1 on entry.
      The test included triggered that assert.
      
      The callsite in `tryOptimizePhi` making the calls to `walkToPhiOrClobber` is structured like this:
      ```
      while (true) {
         if (getBlockingAccess()) { // calls walkToPhiOrClobber
         }
         for (...) {
           walkToPhiOrClobber();
         }
      }
      ```
      
      The cleanest fix is to check if the limit was reached inside `walkToPhiOrClobber`, and give an allowence of 1.
      This approach not make any alias() calls (no calls to instructionClobbersQuery), so the performance condition is enforced.
      The limit is set back to 0 if not used, as this provides info on the fact that we stopped before reaching a true clobber.
      
      Reviewers: george.burgess.iv
      
      Subscribers: jlebar, Prazek, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60479
      
      llvm-svn: 358303
      57769382
    • Louis Dionne's avatar
      [NFC] Add explicit return from main() in tests · 11bbb583
      Louis Dionne authored
      llvm-svn: 358302
      11bbb583
    • Nicolas Lesser's avatar
      [NFC] Move the export attribute after extern "C". · b95559c9
      Nicolas Lesser authored
      Not all compilers support attributes before `extern "C"`. gcc is the main one
      that doesn't support it.
      
      llvm-svn: 358301
      b95559c9
    • Julian Lettner's avatar
      [TSan][libdispatch] Fix failing test · 43e27eb8
      Julian Lettner authored
      The ThreadSanitizer-x86_64-iossim configuration (different SDK) seems to
      require an additional #include.
      
      rdar://49856637
      
      llvm-svn: 358300
      43e27eb8
    • Philip Reames's avatar
      [InstCombine] Fix a nasty miscompile introduced w/masked.gather demanded elts · b091cc08
      Philip Reames authored
      This fixes a miscompile which was introduced in r356510 (https://reviews.llvm.org/D57372).
      
      The problem is that the original patch removed pointer operands where the load results we're demanded, but without considering the legality of the load itself.  If the masked.gather had active, but undemanded, lanes, then we could end up creating a load which loaded from an undef address.  The result could be a segfault, or, in theory, an arbitrary read from a random memory location into an used register.  
      
      llvm-svn: 358299
      b091cc08
    • Nikita Popov's avatar
      [CVP] Set NSW/NUW flags when simplifying with.overflow · 00a0d5d1
      Nikita Popov authored
      When CVP determines that a with.overflow intrinsic cannot overflow,
      it currently inserts a simple add/sub. As we already determined that
      there can be no overflow, we should add the appropriate NUW/NSW flag.
      
      Differential Revision: https://reviews.llvm.org/D60585
      
      llvm-svn: 358298
      00a0d5d1
    • Nikita Popov's avatar
      [KnownBits] Add computeForAddCarry() · 7671fc71
      Nikita Popov authored
      This is for D60460. computeForAddSub() essentially already supports
      carries because it has to deal with subtractions. This revision
      extracts a lower-level computeForAddCarry() function, which allows
      computing the known bits for add (carry known zero), sub (carry known
      one) and addcarry (carry unknown).
      
      As we don't seem to have any yet, I've added a unit test file for
      KnownBits and exhaustive tests for the new computeForAddCarry()
      functionality, as well the existing computeForAddSub() function.
      
      Differential Revision: https://reviews.llvm.org/D60522
      
      llvm-svn: 358297
      7671fc71
    • Philip Reames's avatar
    • Lang Hames's avatar
      Simplify decoupling between RuntimeDyld/RuntimeDyldChecker, add 'got_addr' util. · c7c1f215
      Lang Hames authored
      This patch reduces the number of functions in the interface between RuntimeDyld
      and RuntimeDyldChecker by combining "GetXAddress" and "GetXContent" functions
      into "GetXInfo" functions that return a struct describing both the address and
      content. The GetStubOffset function is also replaced with a pair of utilities,
      GetStubInfo and GetGOTInfo, that fit the new scheme. For RuntimeDyld both of
      these functions will return the same result, but for the new JITLink linker
      (https://reviews.llvm.org/D58704) these will provide the addresses of PLT stubs
      and GOT entries respectively.
      
      For JITLink's use, a 'got_addr' utility has been added to the rtdyld-check
      language, and the syntax of 'got_addr' and 'stub_addr' has been changed: both
      functions now take two arguments, a 'stub container name' and a target symbol
      name. For llvm-rtdyld/RuntimeDyld the stub container name is the object file
      name and section name, separated by a slash. E.g.:
      
      rtdyld-check: *{8}(stub_addr(foo.o/__text, y)) = y
      
      For the upcoming llvm-jitlink utility, which creates stubs on a per-file basis
      rather than a per-section basis, the container name is just the file name. E.g.:
      
      jitlink-check: *{8}(got_addr(foo.o, y)) = y
      llvm-svn: 358295
      c7c1f215
    • Louis Dionne's avatar
      [libc++] Run back-deployment CI against previously-released libc++abi dylibs · e4d6ac5d
      Louis Dionne authored
      We used to do it against the current system's libc++abi, which is not as
      good as doing it with the libc++abi that matches the libc++ we're running
      against.
      
      Note that I made sure we were indeed picking up the provided libc++abi
      by replacing it by something that doesn't work and watching it burn.
      
      llvm-svn: 358294
      e4d6ac5d
    • Kadir Cetinkaya's avatar
      [clangd] Fix an overflow inside a test · 5757bfbd
      Kadir Cetinkaya authored
      llvm-svn: 358293
      5757bfbd
    • Brendon Cahoon's avatar
      [Hexagon] Fix reuse bug in Vector Loop Carried Reuse pass · 4df216cd
      Brendon Cahoon authored
      The Hexagon Vector Loop Carried Reuse pass was allowing reuse between
      two shufflevectors with different masks. The reason is that the masks
      are not instruction objects, so the code that checks each operand
      just skipped over the operands.
      
      This patch fixes the bug by checking if the operands are the same
      when they are not instruction objects. If the objects are not the
      same, then the code assumes that reuse cannot occur.
      
      Differential Revision: https://reviews.llvm.org/D60019
      
      llvm-svn: 358292
      4df216cd
    • Sanjay Patel's avatar
      [DAGCombiner] narrow shuffle of concatenated vectors · 5e4ad39a
      Sanjay Patel authored
      // shuffle (concat X, undef), (concat Y, undef), Mask -->
      // concat (shuffle X, Y, Mask0), (shuffle X, Y, Mask1)
      
      The ARM changes with 'vtrn' and narrowed 'vuzp' are improvements.
      
      The x86 changes look neutral or better. There's one test with an
      extra instruction, but that could be reversed for a subtarget with
      the right attributes. But by default, we want to avoid the 256-bit
      op when possible (in my motivating benchmark, a handful of ymm ops
      sprinkled into a sequence of xmm ops are triggering frequency
      throttling on Haswell resulting in significantly worse perf).
      
      Differential Revision: https://reviews.llvm.org/D60545
      
      llvm-svn: 358291
      5e4ad39a
    • Yaxun Liu's avatar
      [HIP] Use -mlink-builtin-bitcode to link device library · 7bd8c37b
      Yaxun Liu authored
      Use -mlink-builtin-bitcode instead of llvm-link to link
      device library so that device library bitcode and user
      device code can be compiled in a consistent way.
      
      This is the same approach used by CUDA and OpenMP.
      
      Differential Revision: https://reviews.llvm.org/D60513
      
      llvm-svn: 358290
      7bd8c37b
  2. Apr 12, 2019