1. Feb 15, 2018
    • Kamil Rytarowski's avatar
      Try to unbreak Darwin after XRay/FreeBSD commit · a6affc2f
      Kamil Rytarowski authored
      Add a fallback definition of getTSCFrequency().
      
      llvm-svn: 325249
      a6affc2f
    • Kamil Rytarowski's avatar
      Implement a large part of NetBSD syscalls of netbsd_syscall_hooks.h · 7d15ab6a
      Kamil Rytarowski authored
      This is a follow up of:
      
        r325206 - Add NetBSD syscall hooks skeleton in sanitizers
      
      Sponsored by <The NetBSD Foundation>
      
      llvm-svn: 325248
      7d15ab6a
    • Sanjay Patel's avatar
      [InstCombine] allow sin/cos transforms with 'reassoc' · 339b4d33
      Sanjay Patel authored
      The variable name 'AllowReassociate' is a lie at this point because
      it's set to 'isFast()' which is more than the 'reassoc' FMF after
      rL317488.
      
      In D41286, we showed that this transform may be valid even with strict
      math by brute force checking every 32-bit float result.
      
      There's a potential problem here because we're replacing with a tan()
      libcall rather than a hypothetical LLVM tan intrinsic. So we might
      set errno when we should be guaranteed not to do that. But that's
      independent of this change.
      
      llvm-svn: 325247
      339b4d33
    • Kamil Rytarowski's avatar
      Enable test/asan for NetBSD · 62b0c5bb
      Kamil Rytarowski authored
      Sponsored by <The NetBSD Foundation>
      
      llvm-svn: 325246
      62b0c5bb
    • Kamil Rytarowski's avatar
      Enable syscall-specific functions in TSan/NetBSD · e7c26e79
      Kamil Rytarowski authored
      NetBSD ships now with netbsd_syscall_hooks.h and requires support
      for TSan specific features to be enabled.
      
      This is follow up of:
      
        D42048: Add NetBSD syscall hooks skeleton in sanitizers
      
      Sponsored by <The NetBSD Foundation>
      
      llvm-svn: 325245
      e7c26e79
    • Pablo Barrio's avatar
      [ARM] Allow 64- and 128-bit types with 't' inline asm constraint · e28cb839
      Pablo Barrio authored
      Summary:
      In LLVM, 't' selects a floating-point/SIMD register and only supports
      32-bit values. This is appropriately documented in the LLVM Language
      Reference Manual. However, this behaviour diverges from that of GCC, where
      't' selects the s0-s31 registers and its qX and dX variants depending on
      additional operand modifiers (q/P).
      
      For example, the following C code:
      
      #include <arm_neon.h>
      float32x4_t a, b, x;
      asm("vadd.f32 %0, %1, %2" : "=t" (x) : "t" (a), "t" (b))
      
      results in the following assembly if compiled with GCC:
      
      vadd.f32 s0, s0, s1
      
      whereas LLVM will show "error: couldn't allocate output register for
      constraint 't'", since a, b, x are 128-bit variables, not 32-bit.
      
      This patch extends the use of 't' to mean that of GCC, thus allowing
      selection of the lower Q vector regs and their D/S variants. For example,
      the earlier code will now compile as:
      
      vadd.f32 q0, q0, q1
      
      This behaviour still differs from that of GCC but I think it is actually
      more correct, since LLVM picks up the right register type based on the
      datatype of x, while GCC would need an extra operand modifier to achieve
      the same result, as follows:
      
      asm("vadd.f32 %q0, %q1, %q2" : "=t" (x) : "t" (a), "t" (b))
      
      Since this is only an extension of functionality, existing code should not
      be affected by this change. Note that operand modifiers q/P are already
      supported by LLVM, so this patch should suffice to support inline
      assembly with constraint 't' originally built for GCC.
      
      Reviewers: grosbach, rengolin
      
      Reviewed By: rengolin
      
      Subscribers: rogfer01, efriedma, olista01, aemerson, javed.absar, eraman, kristof.beyls, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D42962
      
      llvm-svn: 325244
      e28cb839
    • Simon Pilgrim's avatar
      [X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKUS... · 17bb6f07
      Simon Pilgrim authored
      [X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKUS vXi32-vXi8 saturated truncation
      
      We can use PACKSS/PACKUS to saturate each stage of the chain: PACKSSDW down to [-32768,32767] and then PACKUSWB to [0,255].
      
      llvm-svn: 325243
      17bb6f07
    • Ilya Biryukov's avatar
      [clangd] Enable snippet completion based on client capabilities. · 23bc73b6
      Ilya Biryukov authored
      Summary: And remove -enable-snippets flag.
      
      Reviewers: hokein, ioeric, sammccall
      
      Reviewed By: ioeric
      
      Subscribers: klimek, jkorous-apple, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D43229
      
      llvm-svn: 325242
      23bc73b6
    • Kamil Rytarowski's avatar
      Adding msan support for FreeBSD · 6353ecb0
      Kamil Rytarowski authored
      Summary: Enabling memory sanitiser for X86_64 arch only. To match the sanitiser counterpart.
      
      Patch by: David CARLIER
      
      Reviewers: krytarowski
      
      Reviewed By: krytarowski
      
      Subscribers: dim, emaste, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D43148
      
      llvm-svn: 325241
      6353ecb0
    • Kamil Rytarowski's avatar
      Add Xray instrumentation support to FreeBSD · 4d4ed0e2
      Kamil Rytarowski authored
      Summary:
      - Enabling the build.
      - Using assembly for the cpuid parts.
      - Using thr_self FreeBSD call to get the thread id 
      
      Patch by: David CARLIER
      
      Reviewers: dberris, rnk, krytarowski
      
      Reviewed By: dberris, krytarowski
      
      Subscribers: emaste, stevecheckoway, nglevin, srhines, kubamracek, dberris, mgorny, krytarowski, llvm-commits, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D43278
      
      llvm-svn: 325240
      4d4ed0e2
    • Sam McCall's avatar
      [clangd] Fix make_unique ambiguity, NFC · 892ea68a
      Sam McCall authored
      llvm-svn: 325239
      892ea68a
    • Kamil Rytarowski's avatar
      Add Xray instrumentation compile-time/link-time support to FreeBSD · 7519288e
      Kamil Rytarowski authored
      Summary: Similarly to the GNU driver version, adding proper compile and linker flags.
      
      Patch by: David CARLIER
      
      Reviewers: vitalybuka, krytarowski, dberris
      
      Reviewed By: krytarowski, dberris
      
      Subscribers: emaste, dberris, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D43279
      
      llvm-svn: 325238
      7519288e
    • Sanjay Patel's avatar
      6a0f6670
    • Martin Bohme's avatar
      Add -no-canonical-prefixes to allow different build modes. · b5f8ca47
      Martin Bohme authored
      llvm-svn: 325236
      b5f8ca47
    • Simon Pilgrim's avatar
      [X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKSS... · 908f833e
      Simon Pilgrim authored
      [X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKSS vXi32-vXi8 saturated truncation
      
      We can use PACKSS to saturate each stage of the chain: PACKSSDW down to [-32768,32767] and then PACKSSWB to [-128,127].
      
      PACKUS is a little trickier and will be handled in a separate patch.
      
      llvm-svn: 325235
      908f833e
    • Momchil Velikov's avatar
      [DebugInfo] Accept enumeration types without underlying integer type present in · 6acc0e55
      Momchil Velikov authored
      debug info metadata
      
      ... when generating DWARF.
      
      Differential Revision: https://reviews.llvm.org/D43304
      
      llvm-svn: 325234
      6acc0e55
    • Ilya Biryukov's avatar
      [clangd] Make functions of ClangdServer callback-based · 2c5e8e82
      Ilya Biryukov authored
      Summary:
      As a consequence, all LSP operations are now handled asynchronously,
      i.e. they never block the main processing thread. However, if
      -run-synchronously flag is specified, clangd still runs everything on
      the main thread.
      
      Reviewers: sammccall, ioeric, hokein
      
      Reviewed By: sammccall, ioeric
      
      Subscribers: klimek, jkorous-apple, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D43227
      
      llvm-svn: 325233
      2c5e8e82
    • Simon Pilgrim's avatar
      [SelectionDAG] Add initial implementation of TargetLowering::SimplifyDemandedVectorElts · 80663ee9
      Simon Pilgrim authored
      This is mainly a move of simplifyShuffleOperands from DAGCombiner::visitVECTOR_SHUFFLE to create a more general purpose TargetLowering::SimplifyDemandedVectorElts implementation.
      
      Further features can be moved/added in future patches.
      
      Differential Revision: https://reviews.llvm.org/D42896
      
      llvm-svn: 325232
      80663ee9
    • Sjoerd Meijer's avatar
      [ARM] f16 vcmp fixes · 9430c8cd
      Sjoerd Meijer authored
      This adds f16 VCMP match rules and fixes the test cases.
      
      Differential Revision: https://reviews.llvm.org/D43291
      
      llvm-svn: 325228
      9430c8cd
    • Serge Pavlov's avatar
      Revert r325224 "Report fatal error in the case of out of memory" · 45000019
      Serge Pavlov authored
      It caused fails on some buildbots.
      
      llvm-svn: 325227
      45000019
    • Serge Pavlov's avatar
      Specify namespace for realloc · ce719a0d
      Serge Pavlov authored
      llvm-svn: 325226
      ce719a0d
    • Gabor Horvath's avatar
      387d0005
    • Serge Pavlov's avatar
      Report fatal error in the case of out of memory · 431502a6
      Serge Pavlov authored
      Analysis of fails in the case of out of memory errors can be tricky on
      Windows. Such error emerges at the point where memory allocation function
      fails, but manifests itself when null pointer is used. These two points
      may be distant from each other. Besides, next runs may not exhibit
      allocation error.
      
      Usual programming practice does not require checking result of 'operator
      new' because it throws 'std::bad_alloc' in the case of allocation error.
      However, LLVM is usually built with exceptions turned off, so 'new' can
      return null pointer. This change installs custom new handler, which causes
      fatal error in the case of out of memory. The handler is installed
      automatically prior to call to 'main' during construction of a static
      object defined in 'lib/Support/ErrorHandling.cpp'. If the application does
      not use this file, the handler may be installed manually by a call to
      'llvm::install_out_of_memory_new_handler', declared in
      'include/llvm/Support/ErrorHandling.h".
      
      There are calls to C allocation functions, malloc, calloc and realloc.
      They are used for interoperability with C code, when allocated object has
      variable size and when it is necessary to avoid call of constructors. In
      many calls the result is not checked against null pointer. To simplify
      checks, new functions are defined in the namespace 'llvm' with the
      same names as these C function. These functions produce fatal error if
      allocation fails. User should use 'llvm::malloc' instead of 'std::malloc'
      in order to use the safe variant. This change replaces 'std::malloc'
      in the cases when the result of allocation function is not checked against
      null pointer.
      
      Finally, there are plain C code, that uses malloc and similar functions. If
      the result is not checked, assert statements are added.
      
      Differential Revision: https://reviews.llvm.org/D43010
      
      llvm-svn: 325224
      431502a6
    • Gabor Horvath's avatar
      [clang-tidy] Minor documentation fix · a06d0802
      Gabor Horvath authored
      llvm-svn: 325223
      a06d0802
    • Gabor Horvath's avatar
      [clang-tidy] New checker for exceptions that are created but not thrown · c23f924b
      Gabor Horvath authored
      Patch by: Kristof Umann
      
      Differential Revision: https://reviews.llvm.org/D43120
      
      llvm-svn: 325222
      c23f924b
    • Jacek Olesiak's avatar
      [clang-format] Improve ObjC headers detection · ce4f0af3
      Jacek Olesiak authored
      Summary: Detect ObjC characteristic types when they start a line and add additional keywords.
      
      Reviewers: benhamilton
      
      Reviewed By: benhamilton
      
      Subscribers: klimek, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D43124
      
      llvm-svn: 325221
      ce4f0af3
    • Sam McCall's avatar
      [clangd] Fix tracing now that spans lifetimes can overlap on a thread. · 7929d006
      Sam McCall authored
      Summary:
      The chrome trace viewer requires events within a thread to strictly nest.
      So we need to record the lifetime of the Span objects, not the contexts.
      
      But we still want to show the relationship between spans where a context crosses
      threads, so do this with flow events (i.e. arrows).
      
      Before: https://photos.app.goo.gl/q4Dd9u9xtelaXk1v1
      After: https://photos.app.goo.gl/5RNLmAMLZR3unvY83
      
      (This could stand some further improvement, in particular I think we want a
      container span whenever we schedule work on a thread. But that's another patch)
      
      Reviewers: ioeric
      
      Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D43272
      
      llvm-svn: 325220
      7929d006
    • Jonas Hahnfeld's avatar
      [CMake] Add -fno-experimental-isel for testing · 6f9e25d3
      Jonas Hahnfeld authored
      GlobalISel doesn't yet implement blockaddress and falls back to
      SelectionDAG. This results in additional branch instruction to
      the next basic block which breaks the OMPT tests.
      Disable GlobalISel for now when compiling the tests because fixing
      them is not easily possible. See http://llvm.org/PR36313 for full
      discussion history.
      
      Differential Revision: https://reviews.llvm.org/D43195
      
      llvm-svn: 325218
      6f9e25d3
    • Andrew V. Tischenko's avatar
      (NFC)[MachineCombiner] Improve debug output. · b65b078d
      Andrew V. Tischenko authored
      llvm-svn: 325217
      b65b078d
    • Max Kazantsev's avatar
      fd180029
    • Max Kazantsev's avatar
      [NFC] Fix metadata placement in test · 6e4ce23a
      Max Kazantsev authored
      llvm-svn: 325215
      6e4ce23a
    • Max Kazantsev's avatar
      [SCEV] Favor isKnownViaSimpleReasoning over constant ranges check · c5941d12
      Max Kazantsev authored
      There is a more powerful but still simple function `isKnownViaSimpleReasoning ` that
      does constant range check and few more additional checks. We use it some places (e.g.
      when proving implications) and in some other places we only check constant ranges.
      
      Currently, indvar simplifier fails to remove the check in following loop:
      
        int inc = ...;
        for (int i = inc, j = inc - 1; i < 200; ++i, ++j)
          if (i > j) { ... }
      
      This patch replaces all usages of `isKnownPredicateViaConstantRanges` with
      `isKnownViaSimpleReasoning` to have smarter proofs. In particular, it fixes the
      case above.
      
      Reviewed-By: sanjoy
      Differential Revision: https://reviews.llvm.org/D43175
      
      llvm-svn: 325214
      c5941d12
    • Igor Kudrin's avatar
      [ELF] Simplify handling of AT section attribute. · 25f91734
      Igor Kudrin authored
      This also makes the behavior close to GNU ld's.
      
      Differential Revision: https://reviews.llvm.org/D43284
      
      llvm-svn: 325213
      25f91734
    • Kamil Rytarowski's avatar
      Teach sanitizer about NetBSD specific ioctl(2) calls · 5ffda0cc
      Kamil Rytarowski authored
      Summary:
      Introduce handling of 1200 NetBSD specific ioctl(2) calls.
      Over 100 operations are disabled as unavailable or conflicting
      with the existing ones (the same operation number).
      
      Add a script that generates the rules to detect ioctls on NetBSD.
      The generate_netbsd_ioctls.awk script has been written
      in NetBSD awk(1) (patched nawk) and is compatible with gawk.
      
      Generate lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
      with the awk(1) script.
      
      Update sanitizer_platform_limits_netbsd accordingly to add the needed
      definitions.
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: joerg, vitalybuka, eugenis, dvyukov
      
      Reviewed By: vitalybuka
      
      Subscribers: kubamracek, llvm-commits, mgorny, fedor.sergeev, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D41636
      
      llvm-svn: 325212
      5ffda0cc
    • Artem Dergachev's avatar
      [analyzer] Inline constructors for destroyable temporaries. · 9af0ed4a
      Artem Dergachev authored
      Since r325210, in cfg-temporary-dtors mode, we can rely on the CFG to tell us
      that we're indeed constructing a temporary, so we can trivially construct a
      temporary region and inline the constructor.
      
      Much like r325202, this is only done under the off-by-default
      cfg-temporary-dtors flag because the temporary destructor, even if available,
      will not be inlined and won't have the correct object value (target region).
      Unless this is fixed, it is quite unsafe to inline the constructor.
      
      If the temporary is lifetime-extended, the destructor would be an automatic
      destructor, which would be evaluated with a "correct" target region - modulo
      the series of incorrect relocations performed during the lifetime extension.
      It means that at least, values within the object are guaranteed to be properly
      escaped or invalidated.
      
      Differential Revision: https://reviews.llvm.org/D43062
      
      llvm-svn: 325211
      9af0ed4a
    • Artem Dergachev's avatar
      [CFG] Provide construction contexts for temproary objects. · 1f68d9d3
      Artem Dergachev authored
      Constructors of C++ temporary objects that have destructors now can be queried
      to discover that they're indeed constructing temporary objects.
      
      The respective CXXBindTemporaryExpr, which is also repsonsible for destroying
      the temporary at the end of full-expression, is now available at the
      construction site in the CFG. This is all the context we need to provide for
      temporary objects that are not lifetime extended. For lifetime-extended
      temporaries, more context is necessary.
      
      Differential Revision: https://reviews.llvm.org/D43056
      
      llvm-svn: 325210
      1f68d9d3
    • Artem Dergachev's avatar
      [analyzer] Decide on inlining destructors via EvalCallOptions. · 168e29f6
      Artem Dergachev authored
      EvalCallOptions were introduced in r324018 for allowing various parts of
      ExprEngine to notify the inlining mechanism, while preparing for evaluating a
      function call, of possible difficulties with evaluating the call that they
      foresee. Then mayInlineCall() would still be a single place for making the
      decision.
      
      Use that mechanism for destructors as well - pass the necessary flags from the
      CFG-element-specific destructor handlers.
      
      Part of this patch accidentally leaked into r324018, which led into a change in
      tests; this change is reverted now, because even though the change looked
      correct, the underlying behavior wasn't. Both of these commits were not intended
      to introduce any function changes otherwise.
      
      Differential Revision: https://reviews.llvm.org/D42991
      
      llvm-svn: 325209
      168e29f6
    • Kamil Rytarowski's avatar
      Prevent recursive MSan interceptors in strftime(3) like functions · 443434e4
      Kamil Rytarowski authored
      Summary:
      This corrects intercepting this call on NetBSD without false positives.
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: joerg, eugenis, vitalybuka
      
      Reviewed By: vitalybuka
      
      Subscribers: llvm-commits, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D42883
      
      llvm-svn: 325208
      443434e4
    • Kamil Rytarowski's avatar
      Prevent recursive MSan interceptors in fgets(3) · a8ab3a60
      Kamil Rytarowski authored
      Summary:
      This corrects intercepting this call on NetBSD without false positives.
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: joerg, eugenis, vitalybuka
      
      Reviewed By: vitalybuka
      
      Subscribers: llvm-commits, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D42884
      
      llvm-svn: 325207
      a8ab3a60
    • Kamil Rytarowski's avatar
      Add NetBSD syscall hooks skeleton in sanitizers · 39628a7a
      Kamil Rytarowski authored
      Summary:
      Implement the skeleton of NetBSD syscall hooks for use with sanitizers.
      
      Add a script that generates the rules to handle syscalls
      on NetBSD: generate_netbsd_syscalls.awk. It has been written
      in NetBSD awk(1) (patched nawk) and is compatible with gawk.
      
      Generate lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
      that is a public header for applications, and included as:
      <sanitizer_common/sanitizer_platform_limits_netbsd.h>.
      
      Generate sanitizer_syscalls_netbsd.inc that defines all the
      syscall rules for NetBSD. This file is modeled after the Linux
      specific file: sanitizer_common_syscalls.inc.
      
      Start recognizing NetBSD syscalls with existing sanitizers:
      ASan, ESan, HWASan, TSan, MSan.
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: joerg, vitalybuka, kcc, dvyukov, eugenis
      
      Reviewed By: vitalybuka
      
      Subscribers: hintonda, kubamracek, mgorny, llvm-commits, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D42048
      
      llvm-svn: 325206
      39628a7a