1. Jun 26, 2019
    • Jinsong Ji's avatar
      [MachinePipeliner] Fix risky iterator usage R++, --R · fee855b5
      Jinsong Ji authored
      When we calculate MII, we use two loops, one with iterator R++ to
      check whether we can reserve the resource, then --R to move back
      the iterator to do reservation.
      
      This is risky, as R++, --R may not point to the same element at all.
      The can cause wrong MII.
      
      Differential Revision: https://reviews.llvm.org/D63536
      
      llvm-svn: 364353
      fee855b5
    • Saleem Abdulrasool's avatar
      android: enable double-word CAS on x64 · c32d307a
      Saleem Abdulrasool authored
      The android target assumes that for the x86_64 target, the CPU supports SSE4.2
      and popcnt. This implies that the CPU is Nehalem or newer. This should be
      sufficiently new to provide the double word compare and exchange instruction.
      This allows us to directly lower `__sync_val_compare_and_swap_16` to a `cmpxchg16b`.
      It appears that the libatomic in android's NDK does not provide the
      implementation for lowering calls to the library function.
      
      llvm-svn: 364352
      c32d307a
    • Jonas Devlieghere's avatar
      [dotest] Remove unused function · c8e450a9
      Jonas Devlieghere authored
      The function `EnvArray` has no used.
      
      llvm-svn: 364351
      c8e450a9
    • Jinsong Ji's avatar
      [PowerPC][NFC]Add a test for MachinePipeliner bug · bc7fc3ec
      Jinsong Ji authored
      llvm-svn: 364350
      bc7fc3ec
    • Matt Arsenault's avatar
      Don't look for the TargetFrameLowering in the implementation · 8fcc70f1
      Matt Arsenault authored
      The same oddity was apparently copy-pasted between multiple targets.
      
      llvm-svn: 364349
      8fcc70f1
    • Huihui Zhang's avatar
      [InstCombine] Simplify icmp ult/uge (shl %x, C2), C1 iff C1 is power of two ->... · b90cb57b
      Huihui Zhang authored
      [InstCombine] Simplify icmp ult/uge (shl %x, C2), C1 iff C1 is power of two -> icmp eq/ne (and %x, (lshr -C1, C2)), 0.
      
      Simplify 'shl' inequality test into 'and' equality test.
      
      This pattern happens in the middle-end while simplifying bitfield access,
      Exposed in https://reviews.llvm.org/D63505
      
      https://rise4fun.com/Alive/6uz
      
      Reviewers: lebedev.ri, efriedma
      
      Reviewed By: lebedev.ri
      
      Subscribers: spatel, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63675
      
      llvm-svn: 364348
      b90cb57b
    • Richard Smith's avatar
      Remove redundant expression evaluation context when substituting into a · dcd7eb71
      Richard Smith authored
      template argument.
      
      We do need one of these but we don't need two.
      
      llvm-svn: 364347
      dcd7eb71
    • Philip Reames's avatar
      [LFTR] Adjust debug output to include extensions (if any) · c42a3571
      Philip Reames authored
      llvm-svn: 364346
      c42a3571
    • Kostya Kortchinsky's avatar
      [scudo] Correct a behavior on the shared TSD registry · 3ad32a03
      Kostya Kortchinsky authored
      Summary:
      There is an error in the shared TSD registry logic when looking for a
      TSD in the slow path. There is an unlikely event when a TSD's precedence
      was 0 after attempting a `tryLock` which indicated that it was grabbed
      by another thread in between. We dealt with that case by continuing to
      the next iteration, but that meant that the `Index` was not increased
      and we ended up trying to lock the same TSD.
      This would manifest in heavy contention, and in the end we would still
      lock a TSD, but that was a wasted iteration.
      So, do not `continue`, just skip the TSD as a potential candidate.
      
      This is in both the standalone & non-standalone versions.
      
      Reviewers: morehouse, eugenis, vitalybuka, hctim
      
      Reviewed By: morehouse
      
      Subscribers: delcypher, #sanitizers, llvm-commits
      
      Tags: #llvm, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D63783
      
      llvm-svn: 364345
      3ad32a03
    • Adrian Prantl's avatar
      Add a defensive check for nullptr as in the block above. · 510f4098
      Adrian Prantl authored
      Unfortunately I had to work backwards from a crash log,
      so I don't have a good testcase at this point in time.
      
      rdar://problem/51874647
      
      llvm-svn: 364344
      510f4098
    • Pirama Arumuga Nainar's avatar
      [llvm-shlib] Do not use version script when building with MinGW · 7803eac2
      Pirama Arumuga Nainar authored
      Summary:
      The MinGW driver for lld does not support the --version-script option.
      For GNU ld, it's a no-op since LLVM.dll exports all symbols.
      
      Reviewers: srhines, mstorsjo
      
      Subscribers: mgorny, fedor.sergeev, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63743
      
      llvm-svn: 364343
      7803eac2
    • Diego Novillo's avatar
      Update phis in AMDGPUUnifyDivergentExitNodes · 688afeb8
      Diego Novillo authored
      Original patch https://reviews.llvm.org/D63659 from
      Steven Perron <stevenperron@google.com>
      
      The pass AMDGPUUnifyDivergentExitNodes does not update the phi nodes in
      the successors of blocks that is splits. This is fixed by calling
      BasicBlock::splitBasicBlock to split the block instead of doing it
      manually. This does extra work because a new conditional branch is
      created in BB which is immediately replaced, but I think the simplicity
      is worth it. It also helps make the code more future proof in case other
      things need to be updated.
      
      llvm-svn: 364342
      688afeb8
    • Sanjay Patel's avatar
      [InstCombine] reduce checks for power-of-2-or-zero using ctpop · fcfa056c
      Sanjay Patel authored
      This follows up the transform from rL363956 to use the ctpop intrinsic when checking for power-of-2-or-zero.
      
      This is matching the isPowerOf2() patterns used in PR42314:
      https://bugs.llvm.org/show_bug.cgi?id=42314
      
      But there's at least 1 instcombine follow-up needed to match the alternate form:
      
      (v & (v - 1)) == 0;
      
      We should have all of the backend expansions handled with:
      rL364319
      (x86-specific changes still needed for optimal code based on subtarget)
      
      And the larger patterns to exclude zero as a power-of-2 are joining with this change after:
      rL364153 ( D63660 )
      rL364246
      
      Differential Revision: https://reviews.llvm.org/D63777
      
      llvm-svn: 364341
      fcfa056c
    • Richard Smith's avatar
      Add regression test for PR41576 (which is already fixed in trunk, · 30519a68
      Richard Smith authored
      perhaps by r361300).
      
      llvm-svn: 364340
      30519a68
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] Removed dead SIMachineFunctionInfo::getWorkItemIDVGPR() · 4be636eb
      Stanislav Mekhanoshin authored
      Differential Revision: https://reviews.llvm.org/D63780
      
      llvm-svn: 364339
      4be636eb
    • Sam Clegg's avatar
      [WebAssembly] Error on archives without a symbol index · 61d70e4a
      Sam Clegg authored
      This is fairly common with wasm since GNU ar (most likely the system ar)
      doesn't support the wasm object format so user who don't override AR
      will end up with archives without an index.  We don't want to silently
      ignore this issue.
      
      In the future we could choose to instead behave like the ELF backend and
      read the symbols from each object file in the archive if they are all of
      the same type.  However, error'ing out seem like a conservative approach
      for now.
      
      Fixes: PR42376
      
      Differential Revision: https://reviews.llvm.org/D63739
      
      llvm-svn: 364338
      61d70e4a
    • Craig Topper's avatar
      [X86] Remove isel patterns that look for (vzext_movl (scalar_to_vector (load))) · 4577b8c1
      Craig Topper authored
      I believe these all get canonicalized to vzext_movl. The only case where that wasn't true was when the load was loadi32 and the load was an extload aligned to 32 bits. But that was fixed in r364207.
      
      Differential Revision: https://reviews.llvm.org/D63701
      
      llvm-svn: 364337
      4577b8c1
    • Philip Reames's avatar
      [Peephole] Allow folding loads into instructions w/multiple uses (such as test64rr) · be0dedb2
      Philip Reames authored
      Peephole opt has a one use limitation which appears to be accidental. The function being used was incorrectly documented as returning whether the def had one *user*, but instead returned true only when there was one *use*. Add a corresponding hasOneNonDbgUser helper, and adjust peephole-opt to use the appropriate one.
      
      All of the actual folding code handles multiple uses within a single instruction. That codepath is well exercised through instruction selection.
      
      Differential Revision: https://reviews.llvm.org/D63656
      
      llvm-svn: 364336
      be0dedb2
    • Jonas Devlieghere's avatar
      [Python] Flush prompt before reading input · 99a44915
      Jonas Devlieghere authored
      Make sure the prompt has been flushed before reading commands. Buffering
      is different in Python 3, which led to the prompt not being displayed in
      the Xcode console.
      
      llvm-svn: 364335
      99a44915
    • Davide Italiano's avatar
      [CMake] Check that a certificate for lldb is present at build time. · 97017a8e
      Davide Italiano authored
      Reviewers: JDevlieghere, sgraenitz, aprantl, friss
      
      Subscribers: mgorny, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D63745
      
      llvm-svn: 364334
      97017a8e
    • Craig Topper's avatar
      [X86] Add a DAG combine to turn vzmovl+load into vzload if the load isn't... · 14ea14ae
      Craig Topper authored
      [X86] Add a DAG combine to turn vzmovl+load into vzload if the load isn't volatile. Remove isel patterns for vzmovl+load
      
      We currently have some isel patterns for treating vzmovl+load the same as vzload, but that shrinks the load which we shouldn't do if the load is volatile.
      
      Rather than adding isel checks for volatile. This patch removes the patterns and teachs DAG combine to merge them into vzload when its legal to do so.
      
      Differential Revision: https://reviews.llvm.org/D63665
      
      llvm-svn: 364333
      14ea14ae
    • Kostya Kortchinsky's avatar
      [scudo][standalone] Introduce the C & C++ wrappers · 37340e3c
      Kostya Kortchinsky authored
      Summary:
      This CL adds C & C++ wrappers and associated tests. Those use default
      configurations for a Scudo combined allocator that will likely be
      tweaked in the future.
      
      This is the final CL required to have a functional C & C++ allocator
      based on Scudo.
      
      The structure I have chosen is to define the core C allocation
      primitives in an `.inc` file that can be customized through defines.
      This allows to easily have 2 (or more) sets of wrappers backed by
      different combined allocators, as demonstrated by the `Bionic`
      wrappers: one set for the "default" allocator, one set for the "svelte"
      allocator.
      
      Currently all the tests added have been gtests, but I am planning to
      add some more lit tests as well.
      
      Reviewers: morehouse, eugenis, vitalybuka, hctim, rengolin
      
      Reviewed By: morehouse
      
      Subscribers: srhines, mgorny, delcypher, jfb, #sanitizers, llvm-commits
      
      Tags: #llvm, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D63612
      
      llvm-svn: 364332
      37340e3c
    • Simon Tatham's avatar
      [ARM] Support inline assembler constraints for MVE. · e8de8ba6
      Simon Tatham authored
      "To" selects an odd-numbered GPR, and "Te" an even one. There are some
      8.1-M instructions that have one too few bits in their register fields
      and require registers of particular parity, without necessarily using
      a consecutive even/odd pair.
      
      Also, the constraint letter "t" should select an MVE q-register, when
      MVE is present. This didn't need any source changes, but some extra
      tests have been added.
      
      Reviewers: dmgreen, samparker, SjoerdMeijer
      
      Subscribers: javed.absar, eraman, kristof.beyls, hiraditya, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D60709
      
      llvm-svn: 364331
      e8de8ba6
    • Ayke van Laethem's avatar
      [AVR] Adjust to Register class change · 88139c14
      Ayke van Laethem authored
      A refactor in r364191 changed register types from an unsigned int to the
      llvm:Register class. Adjust the AVR backend to this change.
      
      This fixes build errors when building with the experimental AVR backend
      enabled.
      
      Differential Revision: https://reviews.llvm.org/D63776
      
      llvm-svn: 364330
      88139c14
    • Simon Tatham's avatar
      [ARM] Code-generation infrastructure for MVE. · a4b415a6
      Simon Tatham authored
      This provides the low-level support to start using MVE vector types in
      LLVM IR, loading and storing them, passing them to __asm__ statements
      containing hand-written MVE vector instructions, and *if* you have the
      hard-float ABI turned on, using them as function parameters.
      
      (In the soft-float ABI, vector types are passed in integer registers,
      and combining all those 32-bit integers into a q-reg requires support
      for selection DAG nodes like insert_vector_elt and build_vector which
      aren't implemented yet for MVE. In fact I've also had to add
      `arm_aapcs_vfpcc` to a couple of existing tests to avoid that
      problem.)
      
      Specifically, this commit adds support for:
      
       * spills, reloads and register moves for MVE vector registers
      
       * ditto for the VPT predication mask that lives in VPR.P0
      
       * make all the MVE vector types legal in ISel, and provide selection
         DAG patterns for BITCAST, LOAD and STORE
      
       * make loads and stores of scalar FP types conditional on
         `hasFPRegs()` rather than `hasVFP2Base()`. As a result a few
         existing tests needed their llc command lines updating to use
         `-mattr=-fpregs` as their method of turning off all hardware FP
         support.
      
      Reviewers: dmgreen, samparker, SjoerdMeijer
      
      Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60708
      
      llvm-svn: 364329
      a4b415a6
    • Kevin P. Neal's avatar
      [FPEnv] A missing crucial step was undocumented. · d0f96be2
      Kevin P. Neal authored
      llvm-svn: 364328
      d0f96be2
    • Alexey Bataev's avatar
      [OPENMP]Fix PR41966: type mismatch in runtime functions. · a90fc661
      Alexey Bataev authored
      Target-based runtime functions use int64_t type for sizes, while the
      compiler uses size_t type. It leads to miscompilation in 32 bit mode.
      
      llvm-svn: 364327
      a90fc661
    • Simon Pilgrim's avatar
      [DAGCombine] combineRepeatedFPDivisors - recognize -1.0 / X as a reciprocal · 9762b260
      Simon Pilgrim authored
      Fixes issue identified by @nemanjai (Nemanja Ivanovic) in D62963 / rL363040 - infinite loop due to GetNegatedExpression fighting combineRepeatedFPDivisors resulting in fneg(fdiv(x,splat)) -> fneg(fmul(x,1.0/splat)) -> fmul(x,-1.0/splat) -> fmul(x,(-1.0 * 1.0)/splat) ......
      
      llvm-svn: 364326
      9762b260
  2. Jun 25, 2019
    • Jonas Devlieghere's avatar
      [Python 3] Decode check_ouput result as UTF-8 · 635eb806
      Jonas Devlieghere authored
      llvm-svn: 364325
      635eb806
    • Fangrui Song's avatar
      [PPC32] Support PLT calls for -msecure-plt -fpic · 96a192ea
      Fangrui Song authored
      Summary:
      In Secure PLT ABI, -fpic is similar to -fPIC. The differences are that:
      
      * -fpic stores the address of _GLOBAL_OFFSET_TABLE_ in r30, while -fPIC stores .got2+0x8000.
      * -fpic uses an addend of 0 for R_PPC_PLTREL24, while -fPIC uses 0x8000.
      
      Reviewers: hfinkel, jhibbits, joerg, nemanjai, spetrovic
      
      Reviewed By: jhibbits
      
      Subscribers: adalava, kbarton, jsji, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63563
      
      llvm-svn: 364324
      96a192ea
    • Sam Parker's avatar
      [ARM] Fix for DLS/LE CodeGen · bcf0eb7a
      Sam Parker authored
      The expensive buildbots highlighted the mir tests were broken, which
      I've now updated and added --verify-machineinstrs to them. This also
      uncovered a couple of bugs in the backend pass, so these have also
      been fixed.
      
      llvm-svn: 364323
      bcf0eb7a
    • Xing Xue's avatar
      Improve zero-size allocation with safe_malloc, etc. · ece53d0a
      Xing Xue authored
      Summary:
      The current implementations of the memory allocation functions mistake a nullptr returned from std::malloc, std::calloc, or std::realloc as a failure. The behaviour for each of std::malloc, std::calloc, and std::realloc when the size is 0 is implementation defined (ISO/IEC 9899:2018 7.22.3), and may return a nullptr.
      
      This patch checks if space requested is zero when a nullptr is returned, retry requesting non-zero if it is.
      
      Authored By: andusy
      
      Reviewers: hubert.reinterpretcast, xingxue, jasonliu
      
      Reviewed By: hubert.reinterpretcast, xingxue, abrachet
      
      Subscribers: abrachet, jsji, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63668
      
      llvm-svn: 364322
      ece53d0a
    • Hans Wennborg's avatar
      Revert r362743 "Revert "Revert "Reland D61583 [ELF] Error on relocations to... · 36c23cad
      Hans Wennborg authored
      Revert r362743 "Revert "Revert "Reland D61583 [ELF] Error on relocations to STT_SECTION symbols if the sections were discarded"""
      
      (In effect, reverting "[ELF] Error on relocations to STT_SECTION symbols if the sections were discarded".)
      
      It caused debug info problems in LibreOffice [1] and Chromium/V8 [2].
      Reverting until those can be fixed.
      
      It also reverts r362497 "STT_SECTION symbol should be defined" on .eh_frame, .debug*, .zdebug* and .gcc_except_table"
      which was landed as a follow-up to the above.
      
      > With -r or --emit-relocs, we warn `STT_SECTION symbol should be defined`
      > on relocations to discarded section symbol. This was added as an error
      > in rLLD319404, but was not so effective before D61583 (it turned the
      > error to a warning).
      >
      > Relocations from .eh_frame .debug* .zdebug* .gcc_except_table to
      > discarded .text are very common and somewhat expected. Don't warn/error
      > on them. As a reference, ld.bfd has a similar logic in
      > _bfd_elf_default_action_discarded() to allow these cases.
      >
      > Delete invalid-undef-section-symbol.test because what it intended to
      > check is now covered by the updated comdat-discarded-reloc.s
      >
      > Delete relocatable-eh-frame.s because we allow relocations from
      > .eh_frame as a special case now.
      
      And finally it reverts r362218 "[ELF] Replace a dead test in getSymVA() with assert()"
      as that also depended on the main change reverted here.
      
      > Symbols relative to discarded comdat sections are Undefined instead of
      > Defined now (after D59649 and D61583). The `== &InputSection::Discarded`
      > test becomes dead. I cannot find a test related to this behavior.
      
       [1] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190603/659848.html
       [2] https://bugs.chromium.org/p/chromium/issues/detail?id=978067
      
      llvm-svn: 364321
      36c23cad
    • Simon Pilgrim's avatar
      [SLPVectorizer] Precommit of supernode.ll test for D63661 · e98f8cf7
      Simon Pilgrim authored
      This is a pre-commit of the tests introduced by the SuperNode SLP patch D63661.
      
      Committed on behalf of @vporpo (Vasileios Porpodas)
      
      Differential Revision: https://reviews.llvm.org/D63664
      
      llvm-svn: 364320
      e98f8cf7
    • Sanjay Patel's avatar
      [SDAG] expand ctpop != 1 · 685c5cbc
      Sanjay Patel authored
      Change the generic ctpop expansion to more efficiently handle a
      check for not-a-power-of-two value:
      (ctpop x) != 1 --> (x == 0) || ((x & x-1) != 0)
      
      This is the inverted predicate sibling pattern that was added with:
      D63004
      
      This should have been done before I changed IR canonicalization to
      favor this form with:
      rL364246
      ...so if this requires revert/changing, the earlier commit may also
      need to modified.
      
      llvm-svn: 364319
      685c5cbc
    • Michael Liao's avatar
      [AMDGPU] Null checking on TS to avoid crashing in clang tests. · f0a665af
      Michael Liao authored
      - `test/Misc/backend-resource-limit-diagnostics.cl` crashes as null
        streamer is used.
      
      llvm-svn: 364318
      f0a665af
    • Pavel Labath's avatar
      Options: Correctly check for missing arguments · 34cac095
      Pavel Labath authored
      Relying on the value of optind for detecting missing arguments is
      unreliable because its value after a failed parse is an implementation
      detail. A more correct way to achieve this is to pass ':' at the
      beginning of option string, which tells getopt to return ':' for missing
      arguments.
      
      For this to work, I also had to add a nullptr at the end of the argv
      vector, as some getopt implementations did not work without that. This
      is also an implementation detail, as getopt should normally be called
      with argc+argc "as to main function" (i.e. null-terminated).
      
      Thanks to Michał Górny for testing this patch out on NetBSD.
      
      llvm-svn: 364317
      34cac095
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Fix broken test · f4e51dd2
      Matt Arsenault authored
      llvm-svn: 364316
      f4e51dd2
    • Nikolai Kosjar's avatar
      [clang-tidy] Update documentation for Qt Creator integration. · 181f252d
      Nikolai Kosjar authored
      Subscribers: xazax.hun, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D63763
      
      llvm-svn: 364315
      181f252d
    • Sanjay Patel's avatar
      [AArch64][x86] add tests for ctpop != 1; NFC · 0baacea2
      Sanjay Patel authored
      This is the inverted predicate pattern for D63004.
      
      llvm-svn: 364314
      0baacea2