1. Aug 20, 2019
    • Alex Bradbury's avatar
      [RISCV] Implement getExprForFDESymbol to ensure RISCV_32_PCREL is used for the FDE location · 7cb3cd34
      Alex Bradbury authored
      Follow binutils in using RISCV_32_PCREL for the FDE initial location. As
      explained in the relevant binutils commit
      <https://github.com/riscv/riscv-binutils-gdb/commit/a6cbf936e3dce68114d28cdf60d510a3f78a6d40>,
      the ADD/SUB pair of relocations is problematic in the presence of linker
      relaxation.
      
      This patch has the same end goal as D64715 but includes test changes and
      avoids adding a new global VariantKind to MCExpr.h (preferring
      RISCVMCExpr VKs like the rest of the RISC-V backend).
      
      Differential Revision: https://reviews.llvm.org/D66419
      
      llvm-svn: 369375
      7cb3cd34
    • Pavel Labath's avatar
      unittests: Use yaml2obj as a library instead of an external process · a2e270fa
      Pavel Labath authored
      Summary:
      Recently, yaml2obj has been turned into a library. This means we can use
      it from our unit tests directly, instead of shelling out to an external
      process. This patch does just that.
      
      Reviewers: JDevlieghere, aadsm, espindola, jdoerfert
      
      Subscribers: emaste, mgorny, arichardson, MaskRay, jhenderson, abrachet, lldb-commits
      
      Differential Revision: https://reviews.llvm.org/D65949
      
      llvm-svn: 369374
      a2e270fa
    • Sven van Haastregt's avatar
      [OpenCL] Add const, volatile and pointer builtin handling · cc0ba28c
      Sven van Haastregt authored
      Const, volatile, and pointer types were previously available, but not
      working.  This patch adds handling for OpenCL builtin functions.
      
      Add TableGen definitions for some atomic and asynchronous builtins to
      make use of the new functionality.
      
      Patch by Pierre Gondois and Sven van Haastregt.
      
      Differential Revision: https://reviews.llvm.org/D63442
      
      llvm-svn: 369373
      cc0ba28c
    • Pavel Labath's avatar
      [cmake] Remove the test for libstdc++<4.9 · 66d10964
      Pavel Labath authored
      It is no longer relevant now that llvm requires >=5.1.
      
      llvm-svn: 369371
      66d10964
    • Pavel Labath's avatar
      Recommit "MemoryBuffer: Add a missing error-check to getOpenFileImpl" · 51d7398f
      Pavel Labath authored
      This recommits r368977, which was reverted in r369027 due to test
      failures in lldb. The cause of this was different behavior of
      readNativeFileSlice on windows and unix. These have been addressed in
      r369269.
      
      The original commit message was:
      In case the function was called with a desired read size *and* the file
      was not an "mmap()" candidate, the function was falling back to a
      "pread()", but it was failing to check the result of that system call.
      This meant that the function would return "success" even though the read
      operation failed, and it returned a buffer full of uninitialized memory.
      
      Reviewers: rnk, dblaikie
      
      Subscribers: kristina, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66224
      
      llvm-svn: 369370
      51d7398f
    • Simon Pilgrim's avatar
      [CMake] Update C4324 MSVC warning comment to explain its still broken at VS2019 · ed72e0ec
      Simon Pilgrim authored
      As promised, I've updated the comment for the C4324 MSVC warning that was re-disabled at rL367409 / rG8f823e63 to put it in terms of currently supported VS versions
      
      llvm-svn: 369368
      ed72e0ec
    • Simon Pilgrim's avatar
      [MCA][X86] Add tests for LOCK variants of standard X86 arithmetic ops · 6a3dc3e1
      Simon Pilgrim authored
      D66424 adds the base support for LOCK so we should be able to add special case support for all these cases in future patches
      
      llvm-svn: 369367
      6a3dc3e1
    • Simon Pilgrim's avatar
      5a28f0ae
    • Andrea Di Biagio's avatar
      [X86][Btver2] Fix latency and throughput of CMPXCHG instructions. · b1bdd97a
      Andrea Di Biagio authored
      On Jaguar, CMPXCHG has a latency of 11cy, and a maximum throughput of 0.33 IPC.
      Throughput is superiorly limited to 0.33 because of the implicit in/out
      dependency on register EAX. In the case of repeated non-atomic CMPXCHG with the
      same memory location, store-to-load forwarding occurs and values for sequent
      loads are quickly forwarded from the store buffer.
      
      Interestingly, the functionality in LLVM that computes the reciprocal throughput
      doesn't seem to know about RMW instructions. That functionality only looks at
      the "consumed resource cycles" for the throughput computation. It should be
      fixed/improved by a future patch. In particular, for RMW instructions, that
      logic should also take into account for the write latency of in/out register
      operands.
      
      An atomic CMPXCHG has a latency of ~17cy. Throughput is also limited to
      ~17cy/inst due to cache locking, which prevents other memory uOPs to start
      executing before the "lock releasing" store uOP.
      
      CMPXCHG8rr and CMPXCHG8rm are treated specially because they decode to one less
      macro opcode. Their latency tend to be the same as the other RR/RM variants. RR
      variants are relatively fast 3cy (but still microcoded - 5 macro opcodes).
      
      CMPXCHG8B is 11cy and unfortunately doesn't seem to benefit from store-to-load
      forwarding. That means, throughput is clearly limited by the in/out dependency
      on GPR registers. The uOP composition is sadly unknown (due to the lack of PMCs
      for the Integer pipes). I have reused the same mix of consumed resource from the
      other CMPXCHG instructions for CMPXCHG8B too.
      LOCK CMPXCHG8B is instead 18cycles.
      
      CMPXCHG16B is 32cycles. Up to 38cycles when the LOCK prefix is specified. Due to
      the in/out dependencies, throughput is limited to 1 instruction every 32 (or 38)
      cycles dependeing on whether the LOCK prefix is specified or not.
      I wouldn't be surprised if the microcode for CMPXCHG16B is similar to 2x
      microcode from CMPXCHG8B. So, I have speculatively set the JALU01 consumption to
      2x the resource cycles used for CMPXCHG8B.
      
      The two new hasLockPrefix() functions are used by the btver2 scheduling model
      check if a MCInst/MachineInst has a LOCK prefix. Calls to hasLockPrefix() have
      been encoded in predicates of variant scheduling classes that describe lat/thr
      of CMPXCHG.
      
      Differential Revision: https://reviews.llvm.org/D66424
      
      llvm-svn: 369365
      b1bdd97a
    • Mikhail Maltsev's avatar
      [libcxx] Fix build breakage on mips · a83220c6
      Mikhail Maltsev authored
      Fixes https://bugs.llvm.org/show_bug.cgi?id=43011 caused by
      https://reviews.llvm.org/D63284.
      
      Committing as obvious.
      
      llvm-svn: 369364
      a83220c6
    • Martin Storsjo's avatar
      [COFF] Require an explicit -implib option for creating implibs in mingw mode · 6540e550
      Martin Storsjo authored
      GNU ld doesn't produce implibs unless explicitly requested.
      
      Differential Revision: https://reviews.llvm.org/D66367
      
      llvm-svn: 369363
      6540e550
    • Seiya Nuta's avatar
      [yaml2obj/obj2yaml][MachO] Fix a test failure in big endian hosts · b8dcc193
      Seiya Nuta authored
      These section contents are dummy data (0xdeadbeef) and it's endianess
      does not matter.
      
      - http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/37265
      
      llvm-svn: 369360
      b8dcc193
    • Martin Storsjo's avatar
      [COFF] Allow using custom .edata from input object files · dadc6f24
      Martin Storsjo authored
      This is used by Wine for manually crafting export tables.
      
      If the input object contains .edata sections, GNU ld references them
      in the export directory instead of synthesizing an export table using
      either export directives or the normal auto export mechanism. (AFAIK,
      historically, way way back, GNU ld didn't support synthesizing the
      export table - one was supposed to generate it using dlltool and link
      it in instead.)
      
      If faced with --out-implib and --output-def, GNU ld still populates
      those output files with the same export info as it would have generated
      otherwise, disregarding the input .edata. As this isn't an intended
      usage combination, I'm not adding checks for that in tests.
      
      Differential Revision: https://reviews.llvm.org/D65903
      
      llvm-svn: 369358
      dadc6f24
    • Igor Kudrin's avatar
      [DWARF] Fix DWARFUnit::getDebugInfoSize() for 64-bit DWARF. · e64af757
      Igor Kudrin authored
      The calculation there was correct only for DWARF32.
      
      Differential Revision: https://reviews.llvm.org/D66421
      
      llvm-svn: 369356
      e64af757
    • Raphael Isemann's avatar
      [lldb][NFC] Test quotes when completing · 213a5abb
      Raphael Isemann authored
      llvm-svn: 369353
      213a5abb
    • Jan Kratochvil's avatar
      [lldb] D66174 `RegularExpression` cleanup · f9d90bc5
      Jan Kratochvil authored
      I find as a good cleanup to drop the Compile method. As I do not find TIMTOWTDI
      as an advantage and there is already constructor parameter to compile the
      regex.
      
      Differential Revision: https://reviews.llvm.org/D66392
      
      llvm-svn: 369352
      f9d90bc5
    • Fangrui Song's avatar
      [ELF][PPC] Allow PT_LOAD to have overlapping p_offset ranges on EM_PPC · 12d83b42
      Fangrui Song authored
      Ported the D64906 technique to EM_PPC.
      
      Delete ppc-rela.s that is covered by ppc32-abs-pic.s
      
      llvm-svn: 369351
      12d83b42
    • Ilya Biryukov's avatar
      [clangd] Skip function bodies inside processed files while indexing · 30c86b64
      Ilya Biryukov authored
      Summary:
      This significantly improves performance of background indexing.
      
      We do not collect references and declarations inside the processed
      files, so this does not affect the final indexing results.
      
      The idea is borrowed from libclang, which has a similar optimization in
      its indexing functionality.
      
      Measurements show a nice decrease in indexing time, up to ~40% for
      building the whole index. These are not proper benchmarks, so one should
      not rely on these results too much.
      
      1. Rebuilding the whole index for LLVM:
        - Before. Total time: 14m58s.
          ./bin/clangd -pch-storage=memory < ./clangd.input  23917.67s user 515.86s system 2718% cpu 14:58.68 total
        - After. Total time: 8m41s.
          ./bin/clangd -pch-storage=memory < ./clangd.input  13627.29s user 288.10s system 2672% cpu 8:40.67 total
      
      2. Rebuilding index after removing shards matching '*clangd*' (case-insensitively):
        - Before. Total time: 30s.
          ./bin/clangd -pch-storage=memory < ./clangd.input  130.94s user 6.82s system 452% cpu 30.423 total
        - After. Total time: 26s.
          ./bin/clangd -pch-storage=memory < ./clangd.input  80.51s user 5.40s system 333% cpu 25.777 total
      
      Reviewers: kadircet, sammccall
      
      Reviewed By: kadircet
      
      Subscribers: MaskRay, jkorous, arphaman, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D66226
      
      llvm-svn: 369349
      30c86b64
    • Seiya Nuta's avatar
      [yaml2obj/obj2yaml][MachO] Allow setting custom section data · 52237749
      Seiya Nuta authored
      Reviewers: alexshap, jhenderson, rupprecht
      
      Reviewed By: alexshap, jhenderson
      
      Subscribers: abrachet, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D65799
      
      llvm-svn: 369348
      52237749
    • Fangrui Song's avatar
      [ELF][X86] Allow PT_LOAD to have overlapping p_offset ranges on EM_386 · 9c371309
      Fangrui Song authored
      Ported the D64906 technique to EM_386.
      
      If `sh_addralign(.tdata) < sh_addralign(.tbss)`,
      we can potentially make `p_vaddr(PT_TLS)%p_align(PT_TLS) != 0`.
      
      ld.so that are known to have problems if p_vaddr%p_align!=0:
      
      * FreeBSD 13.0-CURRENT rtld-elf
      * glibc https://sourceware.org/bugzilla/show_bug.cgi?id=24606
      
      New test i386-tls-vaddr-align.s checks our workaround makes p_vaddr%p_align = 0.
      
      Reviewed By: ruiu
      
      Differential Revision: https://reviews.llvm.org/D65865
      
      llvm-svn: 369347
      9c371309
    • Seiya Nuta's avatar
      [llvm-objcopy][MachO] Fix method names. NFC. · 36848ff8
      Seiya Nuta authored
      Reviewers: alexshap, rupprecht, jhenderson
      
      Reviewed By: alexshap, rupprecht
      
      Subscribers: jakehehrlich, abrachet, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D65540
      
      llvm-svn: 369346
      36848ff8
    • Stephan Bergmann's avatar
      Rudimentary support for Doxygen \retval command · 982b105d
      Stephan Bergmann authored
      ...so that at least a preceding \param etc. that lacks a description gets a
      -Wdocumentation warning (instead of erroneously treating the \retval ... text as
      its paragraph).
      
      Differential Revision: https://reviews.llvm.org/D66350
      
      llvm-svn: 369345
      982b105d
    • Fangrui Song's avatar
      [ELF][AArch64] Allow PT_LOAD to have overlapping p_offset ranges · f66b767a
      Fangrui Song authored
      Ported the D64906 technique to AArch64. It deletes 3 alignments at
      PT_LOAD boundaries for the default case: the size of an aarch64 binary
      decreases by at most 192kb.
      
      If `sh_addralign(.tdata) < sh_addralign(.tbss)`,
      we can potentially make `p_vaddr(PT_TLS)%p_align(PT_TLS) != 0`.
      
      ld.so that are known to have problems if p_vaddr%p_align!=0:
      
      * musl<=1.1.22
      * FreeBSD 13.0-CURRENT (and before) rtld-elf arm64
      
      New test aarch64-tls-vaddr-align.s checks that our workaround makes p_vaddr%p_align = 0.
      
      Reviewed By: ruiu
      
      Differential Revision: https://reviews.llvm.org/D64930
      
      llvm-svn: 369344
      f66b767a
    • Fangrui Song's avatar
      [ELF][PPC] Allow PT_LOAD to have overlapping p_offset ranges · 01c7f4b6
      Fangrui Song authored
      This change affects the non-linker script case (precisely, when the
      `SECTIONS` command is not used). It deletes 3 alignments at PT_LOAD
      boundaries for the default case: the size of a powerpc64 binary can be
      decreased by at most 192kb. The technique can be ported to other
      targets.
      
      Let me demonstrate the idea with a maxPageSize=65536 example:
      
      When assigning the address to the first output section of a new PT_LOAD,
      if the end p_vaddr of the previous PT_LOAD is 0x10020, we advance to
      the next multiple of maxPageSize: 0x20000. The new PT_LOAD will thus
      have p_vaddr=0x20000. Because p_offset and p_vaddr are congruent modulo
      maxPageSize, p_offset will be 0x20000, leaving a p_offset gap [0x10020,
      0x20000) in the output.
      
      Alternatively, if we advance to 0x20020, the new PT_LOAD will have
      p_vaddr=0x20020. We can pick either 0x10020 or 0x20020 for p_offset!
      Obviously 0x10020 is the choice because it leaves no gap. At runtime,
      p_vaddr will be rounded down by pagesize (65536 if
      pagesize=maxPageSize). This PT_LOAD will load additional initial
      contents from p_offset ranges [0x10000,0x10020), which will also be
      loaded by the previous PT_LOAD. This is fine if -z noseparate-code is in
      effect or if we are not transiting between executable and non-executable
      segments.
      
      ld.bfd -z noseparate-code leverages this technique to keep output small.
      This patch implements the technique in lld, which is mostly effective on
      targets with large defaultMaxPageSize (AArch64/MIPS/PPC: 65536). The 3
      removed alignments can save almost 3*65536 bytes.
      
      Two places that rely on p_vaddr%pagesize = 0 have to be updated.
      
      1) We used to round p_memsz(PT_GNU_RELRO) up to commonPageSize (defaults
        to 4096 on all targets). Now p_vaddr%commonPageSize may be non-zero.
        The updated formula takes account of that factor.
      2) Our TP offsets formulae are only correct if p_vaddr%p_align = 0.
        Fix them. See the updated comments in InputSection.cpp for details.
      
        On targets that we enable the technique (only PPC64 now),
        we can potentially make `p_vaddr(PT_TLS)%p_align(PT_TLS) != 0`
        if `sh_addralign(.tdata) < sh_addralign(.tbss)`
      
        This exposes many problems in ld.so implementations, especially the
        offsets of dynamic TLS blocks. Known issues:
      
        FreeBSD 13.0-CURRENT rtld-elf (i386/amd64/powerpc/arm64)
        glibc (HEAD) i386 and x86_64 https://sourceware.org/bugzilla/show_bug.cgi?id=24606
        musl<=1.1.22 on TLS Variant I architectures (aarch64/powerpc64/...)
      
        So, force p_vaddr%p_align = 0 by rounding dot up to p_align(PT_TLS).
      
      The technique will be enabled (with updated tests) for other targets in
      subsequent patches.
      
      Reviewed By: ruiu
      
      Differential Revision: https://reviews.llvm.org/D64906
      
      llvm-svn: 369343
      01c7f4b6
    • George Rimar's avatar
      [test/Object] - Move/rewrite 2 more test cases. · ebc8fd3c
      George Rimar authored
      This patch makes a change for test/Object tests responsible
      for relocations.
      
      * 2 tests were moved to llvm-readobj/llvm-objdump folders:
      Object/elf-reloc-no-sym.test -> tools/llvm-readobj/elf-reloc-no-sym.test
      Object/objdump-reloc-shared.test -> tools/llvm-objdump/relocations-in-nonreloc.test
      
      * A prerecompiled binary was removed and these tests were refactored.
      
      Differential revision: https://reviews.llvm.org/D66291
      
      llvm-svn: 369342
      ebc8fd3c
    • Fangrui Song's avatar
      [MC] Delete an overload of MCExpr::evaluateKnownAbsolute and its associated hack · 2682340c
      Fangrui Song authored
      The hack dated back to 2010 (r121076) and was documented by r122144:
      
        // FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us
        // absolutize differences across sections and that is what the MachO writer
        // uses Addrs for.
      
      llvm-svn: 369337
      2682340c
    • Hans Wennborg's avatar
      [compiler-rt][crt] Pass -fno-lto in check_cxx_section_exists · 9e8b0111
      Hans Wennborg authored
      Otherwise it doesn't work when building with -DLLVM_ENABLE_LTO=thin
      
      (We hit this in Chromium in
      https://bugs.chromium.org/p/chromium/issues/detail?id=966403)
      
      llvm-svn: 369336
      9e8b0111
    • Fangrui Song's avatar
    • Craig Topper's avatar
      [X86] Add back the -x86-experimental-vector-widening-legalization comand line... · 1ada1378
      Craig Topper authored
      [X86] Add back the -x86-experimental-vector-widening-legalization comand line flag and all associated code, but leave it enabled by default
      
      Google is reporting performance issues with the new default behavior
      and have asked for a way to switch back to the old behavior while we
      investigate and make fixes.
      
      I've restored all of the code that had since been removed and added
      additional checks of the command flag onto code paths that are
      not otherwise guarded by a check of getTypeAction.
      
      I've also modified the cost model tables to hopefully get us back
      to the previous costs.
      
      Hopefully we won't need to support this for very long since we
      have no test coverage of the old behavior so we can very easily
      break it.
      
      llvm-svn: 369332
      1ada1378
    • Johannes Doerfert's avatar
      [Attributor] Create abstract attributes on-demand · 12cbbab9
      Johannes Doerfert authored
      Before, we create the set of abstract attributes initially and then
      dealt with the fact hat a lookup could fail, e.g., return a nullptr.
      This patch will ensure we always return a valid object from a lookup,
      allowing us not only to remove the nullptr checks but also to grow the
      set of abstract attributes "in-flight" on-demand.
      
      One can now start from those that have the best chance of improving
      performance without the need to specify all they might depend on.
      
      While this introduces some boilerplate, the usage of attributes is much
      easier and cleaner now.
      
      Reviewers: uenoku, sstefan1
      
      Subscribers: hiraditya, bollu, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66276
      
      llvm-svn: 369331
      12cbbab9
    • Johannes Doerfert's avatar
      [Attributor][NFC] Cleanup statistics code · 169af994
      Johannes Doerfert authored
      llvm-svn: 369330
      169af994
    • Johannes Doerfert's avatar
      [Attributor] Use structured deduction for AADereferenceable · cfcca1a5
      Johannes Doerfert authored
      Summary:
      This is analogous to D66128 but for AADereferenceable. We have the logic
      concentrated in the floating value updateImpl and we use the combiner
      helper classes for arguments and return values.
      
      The regressions will go away with "on-demand" attribute creation.
      Improvements are already visible in the existing tests.
      
      Reviewers: uenoku, sstefan1
      
      Subscribers: hiraditya, bollu, jfb, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66272
      
      llvm-svn: 369329
      cfcca1a5
    • Johannes Doerfert's avatar
      [Attributor] Use structured deduction for AANonNull · b9b8791f
      Johannes Doerfert authored
      Summary:
      What D66126 did for AAAlign, this patch does for AANonNull. Agian, the
      logic becomes more concise and localized. Again, returned poiners are
      not annotated properly but that will not be an issue if this lands with
      the "on-demand" generation of attributes. First improvements due to the
      genericValueTraversal are already visible.
      
      Reviewers: sstefan1, uenoku
      
      Subscribers: hiraditya, bollu, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66128
      
      llvm-svn: 369328
      b9b8791f
    • Johannes Doerfert's avatar
      [Attributor] Fix the "clamp" operator · 028b2aa5
      Johannes Doerfert authored
      The clamp operator should not take the known of the given state as the
      known is potentially based on assumed information. This also adds TODOs
      to guide improvements.
      
      llvm-svn: 369327
      028b2aa5
    • Thomas Raoux's avatar
      [NFC] Test commit, fix some comment spelling. · a08e139d
      Thomas Raoux authored
      llvm-svn: 369326
      a08e139d
    • Karl-Johan Karlsson's avatar
      [AsmPrinter] Remove const qualifier from EmitBasicBlockStart. · 40da6be2
      Karl-Johan Karlsson authored
      Overriders may want to modify state in it. AMDGPU wants
      to, but has to make its members mutable in order to do so.
      
      Besides, EmitBasicBlockEnd is not const, so why should
      Start be?
      
      Patch by Bevin Hansson.
      
      Reviewed By: nickdesaulniers
      
      Differential Revision: https://reviews.llvm.org/D66341
      
      llvm-svn: 369325
      40da6be2
    • Fangrui Song's avatar
    • Artem Dergachev's avatar
      [CallGraph] Take into accound calls that aren't within any function bodies. · 8cf3dfea
      Artem Dergachev authored
      This patch improves Clang call graph analysis by adding in expressions
      that are not found in regular function bodies, such as default arguments
      or member initializers.
      
      Patch by Joshua Cranmer!
      
      Differential Revision: https://reviews.llvm.org/D65453
      
      llvm-svn: 369321
      8cf3dfea
    • Artem Dergachev's avatar
      [analyzer] NFC: Rename GRBugReporter to PathSensitiveBugReporter. · ee92f12f
      Artem Dergachev authored
      The GR prefix is super ancient.
      
      llvm-svn: 369320
      ee92f12f
    • Artem Dergachev's avatar
      [analyzer] NFC: Drop support for extra text attached to bug reports. · 48786cf8
      Artem Dergachev authored
      It was introduced in 2011 but never used since then.
      
      llvm-svn: 369319
      48786cf8