1. Mar 10, 2020
    • Mikhail Maltsev's avatar
      [ARM,CDE] Generalize MVE intrinsics infrastructure to support CDE · 47edf5ba
      Mikhail Maltsev authored
      Summary:
      This patch generalizes the existing code to support CDE intrinsics
      which will share some properties with existing MVE intrinsics
      (some of the intrinsics will be polymorphic and accept/return values
      of MVE vector types).
      Specifically the patch:
      * Adds new tablegen backends -gen-arm-cde-builtin-def,
        -gen-arm-cde-builtin-codegen, -gen-arm-cde-builtin-sema,
        -gen-arm-cde-builtin-aliases, -gen-arm-cde-builtin-header based on
        existing MVE backends.
      * Renames the '__clang_arm_mve_alias' attribute into
        '__clang_arm_builtin_alias' (it will be used with CDE intrinsics as
        well as MVE intrinsics)
      * Implements semantic checks for the coprocessor argument of the CDE
        intrinsics as well as the existing coprocessor intrinsics.
      * Adds one CDE intrinsic __arm_cx1 to test the above changes
      
      Reviewers: simon_tatham, MarkMurrayARM, ostannard, dmgreen
      
      Reviewed By: simon_tatham
      
      Subscribers: sdesmalen, mgorny, kristof.beyls, danielkiss, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D75850
      47edf5ba
    • Jonas Paulsson's avatar
      [SimplifyCFG] Skip merging return blocks if it would break a CallBr. · c2dafe12
      Jonas Paulsson authored
      SimplifyCFG should not merge empty return blocks and leave a CallBr behind
      with a duplicated destination since the verifier will then trigger an
      assert. This patch checks for this case and avoids the transformation.
      
      CodeGenPrepare has a similar check which also has a FIXME comment about why
      this is needed. It seems perhaps better if these two passes would eventually
      instead update the CallBr instruction instead of just checking and avoiding.
      
      This fixes https://bugs.llvm.org/show_bug.cgi?id=45062.
      
      Review: Craig Topper
      
      Differential Revision: https://reviews.llvm.org/D75620
      c2dafe12
    • Sanjay Patel's avatar
      [InstCombine] regenerate test checks; NFC · 6e60e102
      Sanjay Patel authored
      tmp -> t because 'tmp' tends to cause problems for the auto-generation script.
      6e60e102
    • Simon Pilgrim's avatar
      [TargetLowering] SimplifyDemandedVectorElts - add DemandedElts mask to... · e71fb46a
      Simon Pilgrim authored
      [TargetLowering] SimplifyDemandedVectorElts - add DemandedElts mask to ISD::BITCAST SimplifyDemandedBits call.
      
      This fixes most of the regressions introduced in the rG4bc6f633 bugfix. The vector-trunc.ll issue should be fixed by D66004.
      e71fb46a
    • Pavel Labath's avatar
      [lldb] Improve test failure messages in vscode tests · 6b37c476
      Pavel Labath authored
      A couple of tests sporadically fail on these assertions, but the error
      messages do not give a clue as to what has actually happened.
      
      Improve them so that we can better understand what is going wrong.
      6b37c476
    • Sanjay Patel's avatar
      [InstCombine] fold gep-of-select-of-constants (PR45084) · 467eec09
      Sanjay Patel authored
      As shown in:
      https://bugs.llvm.org/show_bug.cgi?id=45084
      ...we failed to combine a gep with constant indexes with a
      pointer operand that is a select of constants.
      
      Differential Revision: https://reviews.llvm.org/D75807
      467eec09
    • Sanjay Patel's avatar
      [InstCombine] add/adjust tests for select-gep; NFC · 5b465ad2
      Sanjay Patel authored
      Goes with D75807
      5b465ad2
    • Florian Hahn's avatar
      [SLP] Support vectorizing functions provided by vector libs. · 2d6ecf46
      Florian Hahn authored
      It seems like the SLPVectorizer is currently not aware of vector
      versions of functions provided by libraries like Accelerate [1].
      This patch updates SLPVectorizer to use the same infrastructure
      the LoopVectorizer uses to detect vectorizable library functions.
      
      For calls, it computes the cost of an intrinsic call (existing behavior)
      and the cost of a vector function library call, if available. Like
      LoopVectorizer, it assumes the cost of the vector function is simply the
      cost of a call to a vector function.
      
      [1] https://developer.apple.com/documentation/accelerate
      
      Reviewers: ABataev, RKSimon, spatel
      
      Reviewed By: ABataev
      
      Differential Revision: https://reviews.llvm.org/D75878
      2d6ecf46
    • Pavel Labath's avatar
      [lldb] Break up CommandObjectDisassemble::DoExecute · 1ca1e08e
      Pavel Labath authored
      The function consisted of a complicated set of conditions to compute the
      address ranges which are to be disassembled (depending on the mode
      selected by command line switches). This patch creates a separate
      function for each mode, so that DoExecute is only left with the task of
      figuring out how to dump the relevant ranges.
      
      This is NFC-ish, except for one change in the error message, which is
      actually an improvement.
      1ca1e08e
    • Pavel Labath's avatar
      [lldb] Make UnwindLLDB a non-plugin · d00dff88
      Pavel Labath authored
      Summary:
      This is the only real unwinder, and things have been this way for quite
      a long time. At this point, the class has accumulated so many features
      it is unlikely that anyone will want to reimplement the whole thing.
      
      The class is also fairly closely coupled (through UnwindPlans and
      FuncUnwinders) with a lot of other lldb components that it is hard to
      imagine a different unwinder implementation being substantially
      different without reimplementing all of those.
      
      The existing unwinding functionality is nonetheless fairly complex and
      there is space for adding more structure to it, but I believe a more
      worthwhile effort would be to take the existing UnwindLLDB class and try
      to break it down and introduce extension/customization points, instead
      of writing a brand new Unwind implementation.
      
      Reviewers: jasonmolenda, JDevlieghere, xiaobai
      
      Subscribers: mgorny, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D75848
      d00dff88
    • Nathan James's avatar
      [NFC] Tweak OptionsUtils · 1fc5be06
      Nathan James authored
      1fc5be06
    • David Bozier's avatar
      [LLD] Add support for --unique option · 6e2804ce
      David Bozier authored
      Summary:
      Places orphan sections into a unique output section. This prevents the merging of orphan sections of the same name.
      Matches behaviour of GNU ld --unique. --unique=pattern is not implemented.
      
      Motivated user case shown in the test has 2 local symbols as they would appear if C++ source has been compiled with -ffunction-sections. The merging of these sections in the case of a partial link (-r) may limit the effectiveness of -gc-sections of a subsequent link.
      
      Reviewers: espindola, jhenderson, bd1976llvm, edd, andrewng, JonChesterfield, MaskRay, grimar, ruiu, psmith
      
      Reviewed By: MaskRay, grimar
      
      Subscribers: emaste, arichardson, MaskRay, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D75536
      6e2804ce
    • Simon Pilgrim's avatar
      [X86][SSE] Add more accurate costs for fmaxnum/fminnum codegen · 5cbddf7c
      Simon Pilgrim authored
      Based off llvm-mca reports on codegen in llvm\test\CodeGen\X86\fmaxnum.ll + llvm\test\CodeGen\X86\fminnum.ll
      5cbddf7c
    • Djordje Todorovic's avatar
      [NFC][llvm-dwarfdump] Always use 'const Twine &' · 3e47f87e
      Djordje Todorovic authored
      According to the Twine.h comment, the Twines should only
      be used as const references in arguments.
      
      Differential Revision: https://reviews.llvm.org/D75727
      3e47f87e
    • Simon Pilgrim's avatar
      9b05596e
    • Simon Pilgrim's avatar
      0b1dc601
    • Simon Pilgrim's avatar
      b9b96adc
    • alex-t's avatar
      [AMDGPU] SI_INDIRECT_DST_V* pseudos expansion should place EXEC restore to separate basic block · 39e1a907
      alex-t authored
      Summary:
      When SI_INDIRECT_DST_V* pseudos has indexes in VGPR, they get expanded into the self-looped basic block that modifies EXEC in a loop.
      
      To keep EXEC consistent it is stored before and then re-stored after the pseudo expansion result.
      
      %95:vreg_512 = SI_INDIRECT_DST_V16 %93:vreg_512(tied-def 0), %94:sreg_32, 0, killed %1500:vgpr_32
      
      results to
      
          s_mov_b64 s[6:7], exec
      BB0_16:
          v_readfirstlane_b32 s8, v28
          v_cmp_eq_u32_e32 vcc, s8, v28
          s_and_saveexec_b64 vcc, vcc
          s_set_gpr_idx_on s8, gpr_idx(DST)
          v_mov_b32_e32 v6, v25
          s_set_gpr_idx_off
          s_xor_b64 exec, exec, vcc
          s_cbranch_execnz BB0_16
      ; %bb.17:
          s_mov_b64 exec, s[6:7]
      
      The bug appeared in case this expansion occurs in the ELSE block of the CF.
      
      Originally
      
        %110:vreg_512 = SI_INDIRECT_DST_V16 %103:vreg_512(tied-def 0), %85:vgpr_32, 0, %107:vgpr_32,
         %112:sreg_64 = SI_ELSE %108:sreg_64, %bb.19, 0, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
      
      expanded to
      
               ******************   <== here exec has "THEN" context
      
          s_mov_b64 s[6:7], exec
      BB0_16:
          v_readfirstlane_b32 s8, v28
          v_cmp_eq_u32_e32 vcc, s8, v28
          s_and_saveexec_b64 vcc, vcc
          s_set_gpr_idx_on s8, gpr_idx(DST)
          v_mov_b32_e32 v6, v25
          s_set_gpr_idx_off
          s_xor_b64 exec, exec, vcc
          s_cbranch_execnz BB0_16
      ; %bb.17:
          s_or_saveexec_b64 s[4:5], s[4:5]   <-- exec mask is restored for "ELSE" but immediately overwritten.
          s_mov_b64 exec, s[6:7]
      
      The rest of the "ELSE" block is executed not by the workitems which constitute the "else mask" but by those which constitute "then mask"
      
      SILowerControlFlow::emitElse always considers the basic block begin() as an insertion point for s_or_saveexec.
      
      Proposed fix:  The SI_INDIRECT_DST_V* procedure should split the reminder block to create landing pad for the EXEC restoration.
      
      Reviewers: rampitec, vpykhtin, nhaehnle
      
      Reviewed By: vpykhtin
      
      Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D75472
      39e1a907
    • Kerry McLaughlin's avatar
      [AArch64][SVE] Add SVE intrinsics for address calculations · 0bba37a3
      Kerry McLaughlin authored
      Summary: Adds the @llvm.aarch64.sve.adr[b|h|w|d] intrinsics
      
      Reviewers: sdesmalen, andwar, efriedma, dancgr, cameron.mcinally, rengolin
      
      Reviewed By: sdesmalen
      
      Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, danielkiss, cfe-commits, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D75858
      0bba37a3
    • James Greenhalgh's avatar
      [Arm] Do not lower vmax/vmin to Neon instructions · f0de8d09
      James Greenhalgh authored
      On some Arm cores there is a performance penalty when forwarding from an
      S register to a D register.  Calculating VMAX in a D register creates
      false forwarding hazards, so don't do that unless we're on a core which
      specifically asks for it.
      
      Patch by James Greenhalgh
      
      Differential Revision: https://reviews.llvm.org/D75248
      f0de8d09
    • Simon Pilgrim's avatar
      [X86][AVX] combineX86ShuffleChain - combine binary shuffles to X86ISD::VPERM2X128 · 18c19441
      Simon Pilgrim authored
      For pre-AVX512 targets, combine binary shuffles to X86ISD::VPERM2X128 if possible. This mainly helps optimize the blend(extract_subvector(x,1),y) pattern.
      
      At some point soon we're going to have make a decision about when to combine AVX512 shuffles more aggressively - we bail out if there is any change in element size (to protect predicate mask merging) which means we miss out on a lot of optimizations.
      18c19441
    • Adam Balogh's avatar
      [Analyzer][NFC] Change parameter of NoteTag lambdas to PathSensitiveBugReport · 20a3d64c
      Adam Balogh authored
      Lambdas creating path notes using NoteTags still take BugReport as their
      parameter. Since path notes obviously only appear in PathSensitiveBugReports
      it is straightforward that lambdas of NoteTags take PathSensitiveBugReport
      as their parameter.
      
      Differential Revision: https://reviews.llvm.org/D75898
      20a3d64c
    • Clement Courbet's avatar
      [ExpandMemCmp][NFC] Add more tests. · 30477197
      Clement Courbet authored
      30477197
    • Florian Hahn's avatar
      b53907bf
    • Sam Parker's avatar
      [ARM][MVE] Validate tail predication values · ff9ac33e
      Sam Parker authored
      Iterate through the loop and check that the observable values
      produced are the same whether tail predication happens or not.
      
      We want to find out if the tail-predicated version of this loop will
      produce the same values as the loop in its original form. For this to
      be true, the newly inserted implicit predication must not change the
      the (observable) results.
      
      We're doing this because many instructions in the loop will not be
      predicated and so the conversion from VPT predication to tail
      predication can result in different values being produced, because of
      falsely predicated lanes not being updated in the converted form.
      
      A masked load, whether through VPT or tail predication, will write
      zeros to any of the falsely predicated bytes. So, from the loads, we
      know that the false lanes are zeroed and here we're trying to track
      that those false lanes remain zero, or where they change, the
      differences are masked away by their user(s).
      
      All MVE loads and stores have to be predicated, so we know that any
      load operands, or stored results are equivalent already. Other
      explicitly predicated instructions will perform the same operation in
      the original loop and the tail-predicated form too. Because of this,
      we can insert loads, stores and other predicated instructions into
      our KnownFalseZeros set and build from there.
      
      Differential Revision: https://reviews.llvm.org/D75452
      ff9ac33e
    • Jonathan Coe's avatar
      [clang-format] Correct indentation for `[key] = value,` entries in C# object initialisers · 0c28a093
      Jonathan Coe authored
      Restores content of commit cb3f20d2
      reverted in commit 5a101f37
      with a corrected commit message.
      
      Summary: Do not use continuation indent for '[' in blocks in C# code.
      
      Reviewers: krasimir
      
      Reviewed By: krasimir
      
      Subscribers: cfe-commits
      
      Tags: #clang-format, #clang
      
      Differential Revision: https://reviews.llvm.org/D75747
      0c28a093
    • Jonathan Coe's avatar
      Revert "[clang-format] Correct indentation for `[key] = value,` entries in C++ object initialisers" · 5a101f37
      Jonathan Coe authored
      Commit message says "C++" where it should say "C#".
      
      This reverts commit cb3f20d2.
      5a101f37
    • Djordje Todorovic's avatar
    • Dmitry Vyukov's avatar
      tsan: tsan_interface.h: make constants static · a72dc86c
      Dmitry Vyukov authored
      Note that in C++ the static keyword is implicit for const objects.
      In C however it is not, and we get clashes at link time after
      including the header from more than one C file:
      
      lib.a(bar.o):(.rodata+0x0): multiple definition of `__tsan_mutex_linker_init'
      lib.a(foo.o):(.rodata+0x0): first defined here
      lib.a(bar.o):(.rodata+0xc): multiple definition of `__tsan_mutex_not_static'
      lib.a(foo.o):(.rodata+0xc): first defined here
      <snip>
      Indeed both foo.o and bar.o define the clashing symbols:
      
      $ nm foo.o
      <snip>
      0000000000000000 R __tsan_mutex_linker_init
      000000000000000c R __tsan_mutex_not_static
      <snip>
      Fix it by explicitly making the constants static.
      
      Reviewed-in: https://reviews.llvm.org/D75820
      Author: cota (Emilio G. Cota)
      a72dc86c
    • Craig Topper's avatar
      [X86] Remove isel patterns for (X86VBroadcast (i16 (trunc (i32 (load))))).... · ef4f939d
      Craig Topper authored
      [X86] Remove isel patterns for (X86VBroadcast (i16 (trunc (i32 (load))))). Replace with a DAG combine to form VBROADCAST_LOAD.
      
      isTypeDesirableForOp prevents loads from being shrunk to i16 by DAG
      combine. Because of this we can't just match the broadcast and a
      scalar load. So look for broadcast+truncate+load and form a
      vbroadcast_load during DAG combine. This replaces what was
      previously done as an isel pattern and I think fixes it so we
      won't change the size of a volatile load. But my main motivation
      is just to clean up our isel patterns.
      ef4f939d
    • Puyan Lotfi's avatar
      [llvm][MIRVRegNamer] Avoid collisions across constant pool indices. · 4b8af31f
      Puyan Lotfi authored
      When hashing on MachineOperand::MO_ConstantPoolIndex, now MIR-Canon and
      MIRVRegNamer will no longer result in a hash collision.
      
      Differential Revision: https://reviews.llvm.org/D74449
      4b8af31f
    • Siva Chandra Reddy's avatar
      [libc] Add simple implementations of mtx_lock and mtx_unlock. · 550be405
      Siva Chandra Reddy authored
      These functions only support locking and unlocking of plain mutexes.
      They will be extended in future changes to handled recursive and timed
      mutexes.
      
      Reviewers: phosek
      
      Differential Revision: https://reviews.llvm.org/D74653
      550be405
    • Siva Chandra Reddy's avatar
      [libc] Take 2: Add linux implementations of thrd_create and thrd_join functions. · fd8c1336
      Siva Chandra Reddy authored
      The following are the differences from the first version:
      
      1. The kernel does not copy the stack for the new thread (it cannot).
      The previous version missed this fact. In this new version, the new
      thread's start args are copied on to the new stack in a known location
      so that the new thread can sniff them out.
      2. A start args sniffer for x86_64 has been added.
      2. Default stack size has been increased to 64KB.
      
      Reviewers: abrachet, phosek
      
      Differential Revision: https://reviews.llvm.org/D75818
      fd8c1336
    • Mehdi Amini's avatar
      Fix MLIR build when NVPTX backend is not configured in · f80c6d8d
      Mehdi Amini authored
      The GPUToCUDA conversion needs to conditionally link it
      in.
      f80c6d8d
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Avoid illegal vector exts for add/sub/mul · 627bb31a
      Matt Arsenault authored
      When expanding scalar packed operations, we should not introduce
      illegal vector casts LegalizerHelper introduces. We're not in a
      legalizer context, and there's no RegBankSelect apply or legalize
      worklist.
      627bb31a
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Fix mishandling SGPR v2s16 add/sub/mul · ed72bcae
      Matt Arsenault authored
      We weren't considering the packed case correctly, and this was passing
      through to the selector. The selector only checked the size, so this
      would incorrectly compile to a single 32-bit scalar add.
      
      As usual, the LegalizerHelper is somewhat awkward to use from
      applyMappingImpl. I think this is the first place we've needed
      multi-step legalization here though.
      ed72bcae
    • Lang Hames's avatar
      [MC] Allow Stackmap sections after DWARF in MachO. · 3f981cdd
      Lang Hames authored
      Summary:
      Mixing stackmaps and DWARF in a single file triggers an assertion in
      MCMachOStreamer as stackmap sections are emitted in AsmPrinter::emitEndOfAsmFile
      after the DWARF sections have already been emitted.
      
      Since it should be safe to emit stackmap sections after DWARF sections this
      patch relaxes the assertion to allow that.
      
      Reviewers: aprantl, dblaikie, echristo
      
      Subscribers: hiraditya, ributzka, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D75836
      3f981cdd
    • Uday Bondhugula's avatar
      [mlir] NFC: remove IntegerValueSet / MutableIntegerSet · e241573d
      Uday Bondhugula authored
      Summary:
      - these are unused and really not needed now given flat affine
        constraints
      
      Differential Revision: https://reviews.llvm.org/D75792
      e241573d
    • Nathan James's avatar
    • Wouter van Oortmerssen's avatar
      [WebAssembly] Fixed FrameBaseLocal not being set. · a7a37517
      Wouter van Oortmerssen authored
      Summary:
      Fixes: https://bugs.llvm.org/show_bug.cgi?id=44920
      
      WebAssemblyRegColoring may merge the vreg that currently represents
      the FrameBase with one representing an argument.
      WebAssemblyExplicitLocals picks up the corresponding local when
      a vreg is first added to the Reg2Local mapping, except when it is
      an argument instruction which are handled separately.
      
      Note that this does not change that vregs representing the FrameBase
      may get merged, it is not clear to me that this may have other
      effects we may want to avoid?
      
      Reviewers: dschuff
      
      Reviewed By: dschuff
      
      Subscribers: azakai, sbc100, hiraditya, aheejin, sunfish, llvm-commits, jgravelle-google
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D75718
      a7a37517