1. Sep 06, 2019
    • Roman Lebedev's avatar
      [NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): refactor EmitGEPOffsetInBytes() helper · 8f03dcdc
      Roman Lebedev authored
      It shouldn't really be inlined into the EmitCheckedInBoundsGEP().
      Refactoring it beforehand will make follow-up changes more obvious.
      
      This was originally part of https://reviews.llvm.org/D67122
      
      llvm-svn: 371207
      8f03dcdc
    • Roman Lebedev's avatar
      [NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): add some comments to pointer-overflow check · 624620ff
      Roman Lebedev authored
      It's rather eye-twiching, some comments may help here..
      
      This was originally part of https://reviews.llvm.org/D67122
      
      llvm-svn: 371206
      624620ff
    • Nico Weber's avatar
      libclang depends on ClangDriverOptions since r352803 · 06487b01
      Nico Weber authored
      Without this, the build would sometimes fail with
      
          In file included from clang/tools/libclang/CIndexer.cpp:17:
          In file included from clang/include/clang/Driver/Driver.h:15:
          clang/include/clang/Driver/Options.h:44:10: fatal error:
              'clang/Driver/Options.inc' file not found
          #include "clang/Driver/Options.inc"
                   ^~~~~~~~~~~~~~~~~
      
      if Options.inc wasn't generated before libclang was built
      by coincidence.
      
      (In the GN build, this works because lib/Driver there declares
      the dep on tablegen as a public_dep since the generated file
      is part of Driver's public interface, and then things work out
      automatically without every client of Driver having to be careful.)
      
      llvm-svn: 371205
      06487b01
    • Guillaume Chatelet's avatar
      [Alignment] fix dubious min function alignment · 5d870c2e
      Guillaume Chatelet authored
      Summary:
      This was discovered while introducing the llvm::Align type.
      The original setMinFunctionAlignment used to take alignment as log2, looking at the comment it seems like instructions are to be 2-bytes aligned and not 4-bytes aligned.
      
      Reviewers: uweigand
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67271
      
      llvm-svn: 371204
      5d870c2e
    • Nico Weber's avatar
      Revert r370635, it caused PR43241. · 8455294f
      Nico Weber authored
      llvm-svn: 371202
      8455294f
    • George Rimar's avatar
      [llvm-readelf] - Print unknown st_other value if present in GNU output. · edfd276c
      George Rimar authored
      This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40785.
      
      llvm-readelf does not print the st_value of the symbol when
      st_value has any non-visibility bits set.
      
      This patch:
      
      * Aligns "Ndx" row for the default and a new cases.
      (it was 1 space character off for the case when "PROTECTED" visibility was printed)
      
      * Prints "[<other>: 0x??]" for symbols which has an additional st_other bits set.
      In compare with GNU, this logic is a bit simpler and seems to be more consistent.
      
      For MIPS GNU can print named flags, though can't print a mix of them:
      0: 00000000 0 NOTYPE LOCAL DEFAULT UND 
      1: 00000000 0 NOTYPE GLOBAL DEFAULT [OPTIONAL] UND a1
      2: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PLT] UND a2
      3: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PIC] UND a3
      4: 00000000 0 NOTYPE GLOBAL DEFAULT [MICROMIPS] UND a4
      5: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS16] UND a5
      6: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: c] UND b1
      7: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: 28] UND b2
      
      On PPC64 it can print a localentry value that is encoded in the high bits of st_other
      63: 0000000000000850 208 FUNC GLOBAL DEFAULT [<localentry>: 8] 12
      
      We chose to print the raw st_other field, prefixed with '0x'.
      
      Differential revision: https://reviews.llvm.org/D67094
      
      llvm-svn: 371201
      edfd276c
    • Guillaume Chatelet's avatar
      [Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment · 4fc3ad9e
      Guillaume Chatelet authored
      Summary:
      This is patch is part of a series to introduce an Alignment type.
      See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
      See this patch for the introduction of the type: https://reviews.llvm.org/D64790
      
      Reviewers: courbet
      
      Subscribers: jyknight, sdardis, nemanjai, javed.absar, hiraditya, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, s.egerton, pzheng, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67229
      
      llvm-svn: 371200
      4fc3ad9e
    • Djordje Todorovic's avatar
      [test] Update the name of the debug entry values option. NFC · d409408e
      Djordje Todorovic authored
      llvm-svn: 371199
      d409408e
    • James Molloy's avatar
      [DFAPacketizer] Track resources for packetized instructions · db2fa067
      James Molloy authored
      This patch allows the DFAPacketizer to be queried after a packet is formed to work out which
      resources were allocated to the packetized instructions.
      
      This is particularly important for targets that do their own bundle packing - it's not
      sufficient to know simply that instructions can share a packet; which slots are used is
      also required for encoding.
      
      This extends the emitter to emit a side-table containing resource usage diffs for each
      state transition. The packetizer maintains a set of all possible resource states in its
      current state. After packetization is complete, all remaining resource states are
      possible packetization strategies.
      
      The sidetable is only ~500K for Hexagon, but the extra tracking is disabled by default
      (most uses of the packetizer like MachinePipeliner don't care and don't need the extra
      maintained state).
      
      Differential Revision: https://reviews.llvm.org/D66936
      
      llvm-svn: 371198
      db2fa067
    • Serge Guelton's avatar
      Remove call to obsolete gethostbyname, using getaddrinfo · 90d32df7
      Serge Guelton authored
      Differential Revision: https://reviews.llvm.org/D67230
      
      llvm-svn: 371195
      90d32df7
    • Haojian Wu's avatar
      [clangd] Use override keyword to override the base class method, NFC · 2ebd24cc
      Haojian Wu authored
      llvm-svn: 371194
      2ebd24cc
    • Jeremy Morse's avatar
      [DebugInfo] LiveDebugValues: explicitly terminate overwritten stack locations · 5d9cd3b4
      Jeremy Morse authored
      If a stack spill location is overwritten by another spill instruction,
      any variable locations pointing at that slot should be terminated. We
      cannot rely on spills always being restored to registers or variable
      locations being moved by a DBG_VALUE: the register allocator is entitled
      to spill a value and then forget about it when it goes out of liveness.
      
      To address this, scan for memory writes to spill locations, even those we
      don't consider to be normal "spills". isSpillInstruction and
      isLocationSpill distinguish the two now. After identifying spill
      overwrites, terminate the open range, and insert a $noreg DBG_VALUE for
      that variable.
      
      Differential Revision: https://reviews.llvm.org/D66941
      
      llvm-svn: 371193
      5d9cd3b4
    • Jay Foad's avatar
      [AMDGPU] Mark s_barrier as having side effects but not accessing memory. · 6c0204c7
      Jay Foad authored
      Summary:
      This fixes poor scheduling in a function containing a barrier and a few
      load instructions.
      
      Without this fix, ScheduleDAGInstrs::buildSchedGraph adds an artificial
      edge in the dependency graph from the barrier instruction to the exit
      node representing live-out latency, with a latency of about 500 cycles.
      Because of this it thinks the critical path through the graph also has
      a latency of about 500 cycles. And because of that it does not think
      that any of the load instructions are on the critical path, so it
      schedules them with no regard for their (80 cycle) latency, which gives
      poor results.
      
      Reviewers: arsenm, dstuttard, tpr, nhaehnle
      
      Subscribers: kzhuravl, jvesely, wdng, yaxunl, t-tye, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67218
      
      llvm-svn: 371192
      6c0204c7
    • Nico Weber's avatar
      gn build: Merge r371182 · 68df9dc0
      Nico Weber authored
      llvm-svn: 371191
      68df9dc0
    • Nico Weber's avatar
      gn build: Merge r371179 · 3dbb5c7e
      Nico Weber authored
      llvm-svn: 371190
      3dbb5c7e
    • Fangrui Song's avatar
      [ELF][test] Update test after r371185 · 70e002b5
      Fangrui Song authored
      llvm-svn: 371189
      70e002b5
    • Sam Parker's avatar
      [ARM] Fix for buildbot · 29bf68fc
      Sam Parker authored
      llvm-svn: 371187
      29bf68fc
    • Fangrui Song's avatar
      [yaml2obj] Rename SHOffset (e_shoff) field to SHOff. NFC · d20c41dd
      Fangrui Song authored
      `struct Elf*_Shdr` has a field `sh_offset`, named `ShOffset` in
      llvm::ELFYAML::Section. Rename SHOffset (e_shoff) to SHOff to prevent confusion.
      
      Reviewed By: grimar
      
      Differential Revision: https://reviews.llvm.org/D67254
      
      llvm-svn: 371185
      d20c41dd
    • Matthias Gehre's avatar
      Reland [LifetimeAnalysis] Support more STL idioms (template forward... · f64f4886
      Matthias Gehre authored
      Reland [LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)
      
      Reland after https://reviews.llvm.org/D66806 fixed the false-positive diagnostics.
      
      Summary:
      This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator
      on the template is a DependentNameType - we can only put the gsl::Pointer attribute
      on the underlaying record after instantiation)
      
      inference of gsl::Pointer on std::vector::iterator with libc++ (the class was forward-declared,
      we added the gsl::Pointer on the canonical decl (the forward decl), and later when the
      template was instantiated, there was no attribute on the definition so it was not instantiated).
      
      and a duplicate gsl::Pointer on some class with libstdc++ (we first added an attribute to
      a incomplete instantiation, and then another was copied from the template definition
      when the instantiation was completed).
      
      We now add the attributes to all redeclarations to fix thos issues and make their usage easier.
      
      Reviewers: gribozavr
      
      Subscribers: Szelethus, xazax.hun, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D66179
      
      llvm-svn: 371182
      f64f4886
    • Raphael Isemann's avatar
      [lldb][NFC] Remove Args::StripSpaces · 7841e80e
      Raphael Isemann authored
      This just reimplemented llvm::StringRef::[r/l]trim().
      
      llvm-svn: 371181
      7841e80e
    • Raphael Isemann's avatar
      [lldb][NFC] Extend ArgsTest · 0d50c4e0
      Raphael Isemann authored
      llvm-svn: 371180
      0d50c4e0
    • Sam Parker's avatar
      [ARM] MVE Tail Predication · 312409e4
      Sam Parker authored
      The MVE and LOB extensions of Armv8.1m can be combined to enable
      'tail predication' which removes the need for a scalar remainder
      loop after vectorization. Lane predication is performed implicitly
      via a system register. The effects of predication is described in
      Section B5.6.3 of the Armv8.1-m Arch Reference Manual, the key points
      being:
      - For vector operations that perform reduction across the vector and
        produce a scalar result, whether the value is accumulated or not.
      - For non-load instructions, the predicate flags determine if the
        destination register byte is updated with the new value or if the
        previous value is preserved.
      - For vector store instructions, whether the store occurs or not.
      - For vector load instructions, whether the value that is loaded or
        whether zeros are written to that element of the destination
        register.
      
      This patch implements a pass that takes a hardware loop, containing
      masked vector instructions, and converts it something that resembles
      an MVE tail predicated loop. Currently, if we had code generation,
      we'd generate a loop in which the VCTP would generate the predicate
      and VPST would then setup the value of VPR.PO. The loads and stores
      would be placed in VPT blocks so this is not tail predication, but
      normal VPT predication with the predicate based upon a element
      counting induction variable. Further work needs to be done to finally
      produce a true tail predicated loop.
      
      Because only the loads and stores are predicated, in both the LLVM IR
      and MIR level, we will restrict support to only lane-wise operations
      (no horizontal reductions). We will perform a final check on MIR
      during loop finalisation too.
      
      Another restriction, specific to MVE, is that all the vector
      instructions need operate on the same number of elements. This is
      because predication is performed at the byte level and this is set
      on entry to the loop, or by the VCTP instead.
      
      Differential Revision: https://reviews.llvm.org/D65884
      
      llvm-svn: 371179
      312409e4
    • Kang Zhang's avatar
      [CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks · f879c687
      Kang Zhang authored
      Summary:
      
      Fix a bug of not update the jump table and recommit it again.
      
      In `block-placement` pass, it will create some patterns for unconditional we can do the simple early retrun.
      But the `early-ret` pass is before `block-placement`, we don't want to run it again.
      This patch is to do the simple early return to optimize the blocks at the last of `block-placement`.
      
      Reviewed By: efriedma
      
      Differential Revision: https://reviews.llvm.org/D63972
      
      llvm-svn: 371177
      f879c687
    • Raphael Isemann's avatar
      [lldb][NFC] Remove unused Args::GetArgumentQuoteCharAtIndex · dd8e73ff
      Raphael Isemann authored
      llvm-svn: 371176
      dd8e73ff
    • Simon Atanasyan's avatar
    • David Zarzycki's avatar
      [CMake] LLVM_COMPILE_FLAGS also applies to C files · 412a8d7a
      David Zarzycki authored
      LLVM_COMPILE_FLAGS also applies to C files, otherwise tuning flags,
      etc. won't be picked up.
      
      https://reviews.llvm.org/D67171
      
      llvm-svn: 371173
      412a8d7a
    • Raphael Isemann's avatar
      bc35ae73
    • Mikael Holmen's avatar
      [MIR] Change test case to read from stdin instead of file · dee0702b
      Mikael Holmen authored
      The
      
          ;CHECK: bb
          ;CHECK-NEXT: %namedVReg1353:_(p0) = COPY $d0
      
      parts of the test case failed when the tests were placed in a directory
      including "bb" in the path, since the full path of the file is then
      output in the
       ; ModuleID = '/repo/bb/
      line which the CHECK matched on and then the CHECK-NEXT failed.
      
      llvm-svn: 371171
      dee0702b
    • Craig Topper's avatar
      [X86] Add tests for extending and truncating between v16i8 and v16i64 with... · 463c8e5e
      Craig Topper authored
      [X86] Add tests for extending and truncating between v16i8 and v16i64 with min-legal-vector-width=256.
      
      It looks like we might be able to do these in fewer steps, but
      I'm not sure.
      
      llvm-svn: 371170
      463c8e5e
    • Craig Topper's avatar
      [X86] Prevent passing vectors of __int128 as <X x i128> in llvm IR · 6c8a34ed
      Craig Topper authored
      As far as I can tell, gcc passes 256/512 bit vectors __int128 in memory. And passes a vector of 1 _int128 in an xmm register. The backend considers <X x i128> as an illegal type and will scalarize any arguments with that type. So we need to coerce the argument types in the frontend to match to avoid the illegal type.
      
      I'm restricting this to change to Linux and NetBSD based on the
      how similar ABI changes have been handled in the past.
      PS4, FreeBSD, and Darwin are unaffected. I've also added a
      new -fclang-abi-compat version to restore the old behavior.
      
      This issue was identified in PR42607. Though even with the types changed, we still seem to be doing some unnecessary stack realignment.
      
      llvm-svn: 371169
      6c8a34ed
    • Craig Topper's avatar
      [X86] Pre-commit vector of __int128 test cases for D64672. · 890b551f
      Craig Topper authored
      llvm-svn: 371168
      890b551f
    • Craig Topper's avatar
      [X86] Fix bad indentation. NFC · 7739fbc9
      Craig Topper authored
      llvm-svn: 371167
      7739fbc9
    • Aleksandr Urakov's avatar
      [Windows] Add support of watchpoints to `ProcessWindows` · 6179c0eb
      Aleksandr Urakov authored
      Summary:
      This patch adds support of watchpoints to the old `ProcessWindows` plugin.
      
      The `ProcessWindows` plugin uses the `RegisterContext` to set and reset
      watchpoints. The `RegisterContext` has some interface to access watchpoints,
      but it is very limited (e.g. it is impossible to retrieve the last triggered
      watchpoint with it), that's why I have implemented a slightly different
      interface in the `RegisterContextWindows`. Moreover, I have made the
      `ProcessWindows` plugin responsible for search of a vacant watchpoint slot,
      because watchpoints exist per-process (not per-thread), then we can place
      the same watchpoint in the same slot in different threads. With this scheme
      threads don't need to have their own watchpoint lists, and it simplifies
      identifying of the last triggered watchpoint.
      
      Reviewers: asmith, stella.stamenova, amccarth
      
      Reviewed By: amccarth
      
      Subscribers: labath, zturner, leonid.mashinskiy, abidh, JDevlieghere, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D67168
      
      llvm-svn: 371166
      6179c0eb
    • Alex Brachet's avatar
      Fix rL371162 again · dfacf885
      Alex Brachet authored
      llvm-svn: 371164
      dfacf885
    • Alex Brachet's avatar
      Fix failing test from rL371162 · 27d42af6
      Alex Brachet authored
      llvm-svn: 371163
      27d42af6
    • Alex Brachet's avatar
      [yaml2obj] Make e_phoff and e_phentsize 0 if there are no program headers · 0b69c596
      Alex Brachet authored
      Summary: It says [[ http://www.sco.com/developers/gabi/latest/ch4.eheader.html | here ]] that if there are no program headers than e_phoff should be 0, but currently it is always set after the header. GNU's `readelf` (but not `llvm-readelf`) complains about this: `readelf: Warning: possibly corrupt ELF header - it has a non-zero program header offset, but no program headers`.
      
      Reviewers: jhenderson, grimar, MaskRay, rupprecht
      
      Reviewed By: jhenderson, grimar, MaskRay
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67054
      
      llvm-svn: 371162
      0b69c596
    • Nico Weber's avatar
      gn build: Merge r371159 · b1cf1752
      Nico Weber authored
      llvm-svn: 371161
      b1cf1752
    • Fangrui Song's avatar
      Update SHT_LLVM_PART_EHDR test after r371157 · a2028f73
      Fangrui Song authored
      llvm-svn: 371160
      a2028f73
    • Jonas Devlieghere's avatar
      [MC] Fix undefined behavior in MCInstPrinter::formatHex · bee0f7dd
      Jonas Devlieghere authored
      Passing INT64_MIN to MCInstPrinter::formatHex triggers undefined
      behavior because the negation of -9223372036854775808 cannot be
      represented in type 'int64_t' (aka 'long long'). This patch puts a
      workaround in place to just print the hex value directly.
      
      A possible alternative involves using a small helper functions that uses
      (implementation) defined conversions to achieve the desirable value:
      
        static int64_t helper(int64_t V) {
          auto U = static_cast<uint64_t>(V);
          return V < 0 ? -U : U;
        }
      
      The underlying problem is that MCInstPrinter::formatHex(int64_t) returns
      a format_object<int64_t> and should really return a
      format_object<uint64_t>. However, that's not possible because formatImm
      needs to be able to print both as decimal (where a signed is required)
      and hex (where we'd prefer to always have an unsigned).
      
        format_object<int64_t> formatImm(int64_t Value) const {
          return PrintImmHex ? formatHex(Value) : formatDec(Value);
        }
      
      Differential revision: https://reviews.llvm.org/D67236
      
      llvm-svn: 371159
      bee0f7dd
    • Alina Sbirlea's avatar
      Cleanup test. · 57fcb1d7
      Alina Sbirlea authored
      llvm-svn: 371158
      57fcb1d7