1. Apr 27, 2018
    • Francis Visoiu Mistrih's avatar
      [AArch64] Place the first ldp at the end when ReverseCSRRestoreSeq is true · c855e92c
      Francis Visoiu Mistrih authored
      Put the first ldp at the end, so that the load-store optimizer can run
      and merge the ldp and the add into a post-index ldp.
      
      This didn't work in case no frame was needed and resulted in code size
      regressions.
      
      llvm-svn: 331044
      c855e92c
    • Frederic Riss's avatar
      Mark test as @skipIfOutOfTreeDebugserver · ffb8d871
      Frederic Riss authored
      This test will currently fail for people using the system debugserver.
      
      llvm-svn: 331043
      ffb8d871
    • Kostya Kortchinsky's avatar
      [CMake] Enable warnings for runtimes · 03b7c4da
      Kostya Kortchinsky authored
      Summary:
      `HandleLLVMOptions` adds `-w` to the cflags if `LLVM_ENABLE_WARNINGS` is not on.
      With `-w`, `check_cxx_compiler_flag` doesn't error out for unsupported flags
      (for example `-mcrc` on x86_64), and those flags end up being detected as
      working - and really they aren't.
      
      I am not entirely sure what the best way to solve this is, but setting
      `LLVM_ENABLE_WARNINGS` prior to including `HandleLLVMOptions` does the job.
      
      Reviewers: phosek, beanz
      
      Reviewed By: phosek
      
      Subscribers: mgorny, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46079
      
      llvm-svn: 331042
      03b7c4da
    • Sanjay Patel's avatar
      [Driver, CodeGen] add options to enable/disable an FP cast optimization · d1754765
      Sanjay Patel authored
      As discussed in the post-commit thread for:
      rL330437 ( http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180423/545906.html )
      
      We need a way to opt-out of a float-to-int-to-float cast optimization because too much 
      existing code relies on the platform-specific undefined result of those casts when the 
      float-to-int overflows.
      
      The LLVM changes associated with adding this function attribute are here:
      rL330947
      rL330950
      rL330951
      
      Also as suggested, I changed the LLVM doc to mention the specific sanitizer flag that 
      catches this problem:
      rL330958
      
      Differential Revision: https://reviews.llvm.org/D46135
      
      llvm-svn: 331041
      d1754765
    • Jonas Paulsson's avatar
      [SystemZ] Remove scheduling info from some Pseudo instructions (NFC). · 9a485985
      Jonas Paulsson authored
      If the MachineInstr uses a custom inserter and is then erased after
      instruction selection, there is no use for mapping it to a sched class.
      
      Review: Ulrich Weigand
      llvm-svn: 331040
      9a485985
    • Oliver Stannard's avatar
      [ARM,AArch64] Add intrinsics for dot product instructions · 2fcee8bd
      Oliver Stannard authored
      The ACLE spec which describes these intrinsics hasn't been published yet, but
      this is based on the final draft which will be published soon, and these have
      already been implemented by GCC.
      
      Differential revision: https://reviews.llvm.org/D46109
      
      llvm-svn: 331039
      2fcee8bd
    • Oliver Stannard's avatar
      [ARM] Add __ARM_FEATURE_DOTPROD pre-defined macro · 39ee9de6
      Oliver Stannard authored
      This adds a pre-defined macro to test if the compiler has support for the
      v8.2-A dot rpoduct intrinsics in AArch32 mode.
      
      The AAcrh64 equivalent has already been added by rL330229.
      
      The ACLE spec which describes this macro hasn't been published yet, but this is
      based on the final internal draft, and GCC has already implemented this.
      
      Differential revision: https://reviews.llvm.org/D46108
      
      llvm-svn: 331038
      39ee9de6
    • Florian Hahn's avatar
      [LoopInterchange] Allow some loops with PHI nodes in the exit block. · f3fea0f1
      Florian Hahn authored
      We currently support LCSSA PHI nodes in the outer loop exit, if their
      incoming values do not come from the outer loop latch or if the
      outer loop latch has a single predecessor. In that case, the outer loop latch
      will be executed only if the inner loop gets executed. If we have multiple
      predecessors for the outer loop latch, it may be executed even if the inner
      loop does not get executed.
      
      This is a first step to support the case described in
      https://bugs.llvm.org/show_bug.cgi?id=30472
      
      Reviewers: efriedma, karthikthecool, mcrosier
      
      Reviewed By: efriedma
      
      Differential Revision: https://reviews.llvm.org/D43237
      
      llvm-svn: 331037
      f3fea0f1
    • Oliver Stannard's avatar
      [AArch64] Codegen for v8.2A dot product intrinsics · 76088a59
      Oliver Stannard authored
      This adds IR intrinsics for the AArch64 dot-product instructions introduced in
      v8.2-A.
      
      Differential revisioon: https://reviews.llvm.org/D46107
      
      llvm-svn: 331036
      76088a59
    • Benjamin Kramer's avatar
      [NVPTX] Turn on Loop/SLP vectorization · 733c7fc5
      Benjamin Kramer authored
      Since PTX has grown a <2 x half> datatype vectorization has become more
      important. The late LoadStoreVectorizer intentionally only does loads
      and stores, but now arithmetic has to be vectorized for optimal
      throughput too.
      
      This is still very limited, SLP vectorization happily creates <2 x half>
      if it's a legal type but there's still a lot of register moving
      happening to get that fed into a vectorized store. Overall it's a small
      performance win by reducing the amount of arithmetic instructions.
      
      I haven't really checked what the loop vectorizer does to PTX code, the
      cost model there might need some more tweaks. I didn't see it causing
      harm though.
      
      Differential Revision: https://reviews.llvm.org/D46130
      
      llvm-svn: 331035
      733c7fc5
    • Simon Pilgrim's avatar
    • Aleksandar Beserminji's avatar
      [mips] Fix how compiler fuse instructions to fmadd/fmsub · 3546c160
      Aleksandar Beserminji authored
      This patch makes compiler does not fuse fmul and fadd/fsub into
      fmadd/fmsub by default. Instead, -fp-contract=fast option can
      be used when such behavior is desired.
      
      Differential Revision: https://reviews.llvm.org/D46057
      
      llvm-svn: 331033
      3546c160
    • Oliver Stannard's avatar
      [ARM] Codegen for v8.2A dot product intrinsics · f3632143
      Oliver Stannard authored
      This adds IR intrinsics for the ARM dot-product instructions introduced in
      v8.2-A.
      
      Differential revision: https://reviews.llvm.org/D46106
      
      llvm-svn: 331032
      f3632143
    • Sam McCall's avatar
      [clangd] Fix unicode handling, using UTF-16 where LSP requires it. · a4962cce
      Sam McCall authored
      Summary:
      The Language Server Protocol unfortunately mandates that locations in files
      be represented by line/column pairs, where the "column" is actually an index
      into the UTF-16-encoded text of the line.
      (This is because VSCode is written in JavaScript, which is UTF-16-native).
      
      Internally clangd treats source files at UTF-8, the One True Encoding, and
      generally deals with byte offsets (though there are exceptions).
      
      Before this patch, conversions between offsets and LSP Position pretended
      that Position.character was UTF-8 bytes, which is only true for ASCII lines.
      Now we examine the text to convert correctly (but don't actually need to
      transcode it, due to some nice details of the encodings).
      
      The updated functions in SourceCode are the blessed way to interact with
      the Position.character field, and anything else is likely to be wrong.
      So I also updated the other accesses:
       - CodeComplete needs a "clang-style" line/column, with column in utf-8 bytes.
         This is now converted via Position -> offset -> clang line/column
         (a new function is added to SourceCode.h for the second conversion).
       - getBeginningOfIdentifier skipped backwards in UTF-16 space, which is will
         behave badly when it splits a surrogate pair. Skipping backwards in UTF-8
         coordinates gives the lexer a fighting chance of getting this right.
         While here, I clarified(?) the logic comments, fixed a bug with identifiers
         containing digits, simplified the signature slightly and added a test.
      
      This seems likely to cause problems with editors that have the same bug, and
      treat the protocol as if columns are UTF-8 bytes. But we can find and fix those.
      
      Reviewers: hokein
      
      Subscribers: klimek, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D46035
      
      llvm-svn: 331029
      a4962cce
    • Alex Bradbury's avatar
      [RISCV] Add remat.ll test case · f5800a2a
      Alex Bradbury authored
      This test case demonstrates suboptimal codegen due to the fact that simple 
      constants aren't recognised as rematerialisable.
      
      llvm-svn: 331028
      f5800a2a
    • David Green's avatar
      [ARM] Enable misched for R52. · c4cccea4
      David Green authored
      Back when the R52 schedule was added in rL286949, there was no way
      to enable machine schedules in ARM for specific cores. Since then a
      target feature has been added. This enables the feature for R52,
      removing the need to manually specify compiler flags.
      
      llvm-svn: 331027
      c4cccea4
    • Sven van Haastregt's avatar
      [OpenCL] Add separate read_only and write_only pipe IR types · 4700faa2
      Sven van Haastregt authored
      SPIR-V encodes the read_only and write_only access qualifiers of pipes,
      so separate LLVM IR types are required to target SPIR-V.  Other backends
      may also find this useful.
      
      These new types are `opencl.pipe_ro_t` and `opencl.pipe_wo_t`, which
      replace `opencl.pipe_t`.
      
      This replaces __get_pipe_num_packets(...) and __get_pipe_max_packets(...)
      which took a read_only pipe with separate versions for read_only and
      write_only pipes, namely:
      
       * __get_pipe_num_packets_ro(...)
       * __get_pipe_num_packets_wo(...)
       * __get_pipe_max_packets_ro(...)
       * __get_pipe_max_packets_wo(...)
      
      These separate versions exist to avoid needing a bitcast to one of the
      two qualified pipe types.
      
      Patch by Stuart Brady.
      
      Differential Revision: https://reviews.llvm.org/D46015
      
      llvm-svn: 331026
      4700faa2
    • Mikhail Maltsev's avatar
      [IR] Do not assume that function pointers are aligned · ffaa8a87
      Mikhail Maltsev authored
      Summary:
      The value tracking analysis uses function alignment to infer that the
      least significant bits of function pointers are known to be zero.
      Unfortunately, this is not correct for ARM targets: the least
      significant bit of a function pointer stores the ARM/Thumb state
      information (i.e., the LSB is set for Thumb functions and cleared for
      ARM functions).
      
      The original approach (https://reviews.llvm.org/D44781) introduced a
      new field for function pointer alignment in the DataLayout structure
      to address this. But it seems unlikely that optimizations based on
      function pointer alignment would bring much benefit in practice to
      justify the additional maintenance burden, so this patch simply
      assumes that function pointer alignment is always unknown.
      
      Reviewers: javed.absar, efriedma
      
      Reviewed By: efriedma
      
      Subscribers: kristof.beyls, llvm-commits, hfinkel, rogfer01
      
      Differential Revision: https://reviews.llvm.org/D46110
      
      llvm-svn: 331025
      ffaa8a87
    • Petar Jovanovic's avatar
      [mips] Add support for Virtualization ASE · d4349f3b
      Petar Jovanovic authored
      This includes
      
        Instructions: tlbginv, tlbginvf, tlbgp, tlbgr, tlbgwi, tlbgwr, hypcall
                      mfgc0, mtgc0, mfhgc0, mthgc0, dmfgc0, dmtgc0,
      
        Assembler directives: .set virt, .set novirt, .module virt, .module novirt
      
        Attribute: virt
      
        .MIPS.abiflags: VZ (0x100)
      
      Patch by Vladimir Stefanovic.
      
      Differential Revision: https://reviews.llvm.org/D44905
      
      llvm-svn: 331024
      d4349f3b
    • Dmitry Vyukov's avatar
      tsan: improve "destroy of a locked mutex" reports · 21dc68fe
      Dmitry Vyukov authored
      1. Allow to suppress by current stack.
      We generally allow to suppress by all main stacks.
      Current is probably the stack one wants to use to
      suppress such reports.
      
      2. Fix last lock stack restoration.
      We trimmed shadow value by storing it in u32.
      This magically worked for the test that provoked
      the report on the main thread. But this breaks
      for locks in any other threads.
      
      llvm-svn: 331023
      21dc68fe
    • Serguei Katkov's avatar
      [SCEV] Add trivial case handling for umin utilities. NFC. · 1956a48d
      Serguei Katkov authored
      Reviewers: sanjoy, mkazantsev
      Reviewed By: mkazantsev
      Subscribers: llvm-commits
      Differential Revision: https://reviews.llvm.org/D46175
      
      llvm-svn: 331022
      1956a48d
    • Raphael Isemann's avatar
      Make MultiplexASTDeserializationListener part of the API [NFC] · 0d24edab
      Raphael Isemann authored
      Summary:
      This patch moves the MultiplexASTDeserializationListener declaration into a public header.
      
      We're currently using this multiplexer in the cling interpreter to attach another
      ASTDeserializationListener during the execution (so, after the MultiplexConsumer is already
      attached which prevents us from attaching more). So far we're doing this by patching clang
      and making this class public, but it makes things easier if we make this instead just public in
      upstream.
      
      Reviewers: thakis, v.g.vassilev, rsmith, bruno
      
      Reviewed By: bruno
      
      Subscribers: llvm-commits, cfe-commits, v.g.vassilev
      
      Differential Revision: https://reviews.llvm.org/D37475
      
      llvm-svn: 331021
      0d24edab
    • Akira Hatanaka's avatar
      [CodeGen] Avoid destructing a callee-destructued struct type in a · ccda3d29
      Akira Hatanaka authored
      function if a function delegates to another function.
      
      Fix a bug introduced in r328731, which caused a struct with ObjC __weak
      fields that was passed to a function to be destructed twice, once in the
      callee function and once in another function the callee function
      delegates to. To prevent this, keep track of the callee-destructed
      structs passed to a function and disable their cleanups at the point of
      the call to the delegated function.
      
      This reapplies r331016, which was reverted in r331019 because it caused
      an assertion to fail in EmitDelegateCallArg on a windows bot. I made
      changes to EmitDelegateCallArg so that it doesn't try to deactivate
      cleanups for structs that have trivial destructors (cleanups for those
      structs are never pushed to the cleanup stack in EmitParmDecl).
      
      rdar://problem/39194693
      
      Differential Revision: https://reviews.llvm.org/D45382
      
      llvm-svn: 331020
      ccda3d29
    • Akira Hatanaka's avatar
      Revert "[CodeGen] Avoid destructing a callee-destructued struct type in a" · b4f3637c
      Akira Hatanaka authored
      This reverts commit r331016, which broke a windows bot.
      
      http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/11727
      
      llvm-svn: 331019
      b4f3637c
    • Fangrui Song's avatar
      [ELF] Fix typo. NFC · 1f3e2b29
      Fangrui Song authored
      llvm-svn: 331018
      1f3e2b29
    • Richard Smith's avatar
      Fix typo. · 3b8ccd5d
      Richard Smith authored
      llvm-svn: 331017
      3b8ccd5d
    • Akira Hatanaka's avatar
      [CodeGen] Avoid destructing a callee-destructued struct type in a · e7123744
      Akira Hatanaka authored
      function if a function delegates to another function.
      
      Fix a bug introduced in r328731, which caused a struct with ObjC __weak
      fields that was passed to a function to be destructed twice, once in the
      callee function and once in another function the callee function
      delegates to. To prevent this, keep track of the callee-destructed
      structs passed to a function and disable their cleanups at the point of
      the call to the delegated function.
      
      rdar://problem/39194693
      
      Differential Revision: https://reviews.llvm.org/D45382
      
      llvm-svn: 331016
      e7123744
    • Serguei Katkov's avatar
      [SCEV] Introduce bulk umin creation utilities · fa7fd13c
      Serguei Katkov authored
      Add new umin creation method which accepts a list of operands.
      
      SCEV does not represents umin which is required in getExact, so
      it transforms umin to umax with not. As a result the transformation of
      tree of max to max with several operands does not work.
      We just use the new introduced method for creation umin from several operands.
      
      Reviewers: sanjoy, mkazantsev
      Reviewed By: sanjoy
      Subscribers: javed.absar, llvm-commits
      Differential Revision: https://reviews.llvm.org/D46047
      
      llvm-svn: 331015
      fa7fd13c
    • Artem Dergachev's avatar
      [analyzer] Fix operator delete[] array-type-sub-expression handling. · 4fbd97e1
      Artem Dergachev authored
      Avoid crash when the sub-expression of operator delete[] is of array type.
      
      This is not the same as simply using a delete[] syntax.
      
      We're still not properly calling destructors in this case in the analyzer.
      
      Differential Revision: https://reviews.llvm.org/D46146
      
      llvm-svn: 331014
      4fbd97e1
    • Richard Smith's avatar
      Parse A::template B as an identifier rather than as a template-id with no · c08b693e
      Richard Smith authored
      template arguments.
      
      This fixes some cases where we'd incorrectly accept "A::template B" when B is a
      kind of template that requires template arguments (in particular, a variable
      template or a concept).
      
      llvm-svn: 331013
      c08b693e
    • Jim Ingham's avatar
      Fix a thinko in the iteration over StructuredDataPlugin Create functions. · 93979f67
      Jim Ingham authored
      The code was grabbing the first plugin, and then never getting
      another one.
      
      <rdar://problem/39779438>
      
      llvm-svn: 331012
      93979f67
    • Matt Morehouse's avatar
      Revert "[SimplifyLibcalls] Replace locked IO with unlocked IO" · 1ae1febf
      Matt Morehouse authored
      This reverts r331002 due to sanitizer bot breakage.
      
      llvm-svn: 331011
      1ae1febf
    • Akira Hatanaka's avatar
      [Driver] Don't enable "-fregister-global-dtors-with-atexit" by default · 18db58e7
      Akira Hatanaka authored
      when compiling the kernel or kexts.
      
      Destructors should be registered with atexit by default only when we are
      compiling userland code.
      
      llvm-svn: 331010
      18db58e7
    • Petr Hosek's avatar
      Revert "[CMake] Make simple source used for CMake checks a C file" · 5d3df3cf
      Petr Hosek authored
      This reverts commit r331003 which breaks sanitizer bots because of
      missing 32-bit libstdc++ library.
      
      llvm-svn: 331009
      5d3df3cf
    • Eli Friedman's avatar
      [LowerTypeTests] Mark .cfi.jumptable nounwind. · e0653945
      Eli Friedman authored
      It doesn't unwind, and the wrong marking leads to the creation of an
      .eh_frame section when it isn't necessary.
      
      Differential Revision: https://reviews.llvm.org/D46082
      
      llvm-svn: 331008
      e0653945
    • Eli Friedman's avatar
      [MachineOutliner] Don't outline from functions with a section marking. · da018e56
      Eli Friedman authored
      The program might have unusual expectations for functions; for example,
      the Linux kernel's build system warns if it finds references from .text
      to .init.data.
      
      I'm not sure this is something we actually want to make any guarantees
      about (there isn't any explicit rule that would disallow outlining
      in this case), but we might want to be conservative anyway.
      
      Differential Revision: https://reviews.llvm.org/D46091
      
      llvm-svn: 331007
      da018e56
    • Sam Clegg's avatar
      typo · e0658119
      Sam Clegg authored
      llvm-svn: 331006
      e0658119
    • Sam Clegg's avatar
      [WebAssembly] Section symbols must have local binding · d5504a0a
      Sam Clegg authored
      Summary: Also test for symbols information in test/MC/WebAssembly/debug-info.ll.
      
      Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, JDevlieghere, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46160
      
      llvm-svn: 331005
      d5504a0a
    • Frederic Riss's avatar
      [debugserver] Fix handling of the 'g' packet · 34ec0bfb
      Frederic Riss authored
      LLDB doesn't use this packet so we never hit this, but it looks like
      some other projects talk to debugserver and are hitting an assert
      (https://github.com/derekparker/delve/issues/1015).
      
      We had an off by 1 in the accounting of the FPU structure sizes.
      I added a test that basically just check that 'g' doesn't return
      an error (currently it assert in debug builds). I didn't make
      it an lldb-server test because it looks like lldb-server doesn't
      implement the g packet.
      
      llvm-svn: 331004
      34ec0bfb
    • Petr Hosek's avatar
      [CMake] Make simple source used for CMake checks a C file · 887fbc61
      Petr Hosek authored
      The source being compiled is plain C, but using .cc extension forces it
      to be compiled as C++ which requires a working C++ compiler including
      C++ library which may not be the case when we're building compiler-rt
      together with libcxx as part of runtimes build.
      
      Differential Revision: https://reviews.llvm.org/D46152
      
      llvm-svn: 331003
      887fbc61