1. Jan 05, 2019
    • Jonas Devlieghere's avatar
      [Driver] Some more cleanup. NFC · e6366a85
      Jonas Devlieghere authored
      llvm-svn: 350446
      e6366a85
    • Peter Collingbourne's avatar
      Bring back the pthread_create interceptor, but only on non-aarch64. · 1c650deb
      Peter Collingbourne authored
      We still need the interceptor on non-aarch64 to untag the pthread_t
      and pthread_attr_t pointers and disable tagging on allocations done
      internally by glibc.
      
      llvm-svn: 350445
      1c650deb
    • Peter Collingbourne's avatar
      Disable system-allocator-fallback.cc test on Android O and earlier. · 714e1706
      Peter Collingbourne authored
      The dynamic loader on Android O appears to have a bug where it crashes
      when dlopening DF_1_GLOBAL libraries.
      
      llvm-svn: 350444
      714e1706
    • Evgeniy Stepanov's avatar
      [sanitizer] Reduce stack depot size on Android. · 9fbc364e
      Evgeniy Stepanov authored
      Summary:
      The default setting kTabSizeLog=20 results in an 8Mb global hash table,
      almost all of it in private pages. That is not a sane setting in a
      mobile, system-wide use case: with ~150 concurrent processes stack
      depot will account for more than 1Gb of RAM.
      
      Reviewers: kcc, pcc
      
      Subscribers: srhines, kubamracek, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D56333
      
      llvm-svn: 350443
      9fbc364e
    • Rong Xu's avatar
      [PGO] Use SourceFileName rather module name in PGOFuncName · b5fa0a89
      Rong Xu authored
      In LTO or Thin-lto mode (though linker plugin), the module
      names are of temp file names which are different for
      different compilations. Using SourceFileName avoids the issue.
      This should not change any functionality for current PGO as
      all the current callers of getPGOFuncName() is before LTO.
      
      llvm-svn: 350442
      b5fa0a89
    • Joel E. Denny's avatar
      [OpenMP] Refactor const restriction for linear · bae586fb
      Joel E. Denny authored
      As discussed in D56113, this patch refactors the implementation of the
      const restriction for linear to reuse a function introduced by D56113.
      A side effect is that, if a variable has mutable members, this
      diagnostic is now skipped, and the diagnostic for the variable not
      being an integer or pointer is reported instead.
      
      Reviewed By: ABataev
      
      Differential Revision: https://reviews.llvm.org/D56299
      
      llvm-svn: 350441
      bae586fb
    • Joel E. Denny's avatar
      [OpenMP] Refactor const restriction for reductions · d2649292
      Joel E. Denny authored
      As discussed in D56113, this patch refactors the implementation of the
      const restriction for reductions to reuse a function introduced by
      D56113.  A side effect is that diagnostics sometimes now say
      "variable" instead of "list item" when a list item is a variable.
      
      Reviewed By: ABataev
      
      Differential Revision: https://reviews.llvm.org/D56298
      
      llvm-svn: 350440
      d2649292
    • Joel E. Denny's avatar
      [OpenMP] Replace predetermined shared for const variable · e6234d14
      Joel E. Denny authored
      The following appears in OpenMP 3.1 sec. 2.9.1.1 as a predetermined
      data-sharing attribute:
      
      > Variables with const-qualified type having no mutable member are
      > shared.
      
      It does not appear in OpenmP 4.0, 4.5, or 5.0.  This patch removes the
      implementation of that attribute when the requested OpenMP version is
      greater than 3.1.
      
      One effect of that removal is that `default(none)` affects const
      variables without mutable members.
      
      Also, without this patch, if a const variable without mutable members
      was explicitly lastprivate or private, it was an error because it was
      predetermined shared.  Now, clang instead complains that it's const
      without mutable fields, which is a more intelligible diagnostic.  That
      should be fine for all of the above versions because they all have
      something like the following, which is quoted from OpenMP 5.0
      sec. 2.19.3:
      
      > A variable that is privatized must not have a const-qualified type
      > unless it is of class type with a mutable member. This restriction does
      > not apply to the firstprivate clause.
      
      reduction and linear clauses already have separate checks for const
      variables.  Future patches will merge the implementations.
      
      Reviewed By: ABataev
      
      Differential Revision: https://reviews.llvm.org/D56113
      
      llvm-svn: 350439
      e6234d14
    • Alexandre Ganea's avatar
      79d48516
    • Nikita Popov's avatar
      [X86] Fix warning; NFC · c35b4a37
      Nikita Popov authored
      llvm-svn: 350437
      c35b4a37
    • Vyacheslav Zakharin's avatar
      Update the pr_datasz of .note.gnu.property section. · 0a6f86c5
      Vyacheslav Zakharin authored
      Patch by Xiang Zhang.
      
      Differential Revision: https://reviews.llvm.org/D56080
      
      llvm-svn: 350436
      0a6f86c5
    • Nikita Popov's avatar
      [BDCE] Remove dead uses of arguments · 6658fce4
      Nikita Popov authored
      In addition to finding dead uses of instructions, also find dead uses
      of function arguments, and replace them with zero as well.
      
      I'm changing the way the known bits are computed here to remove the
      coupling between the transfer function and the algorithm. It previously
      relied on the first op being visited first and computing known bits --
      unless the first op is not an instruction, in which case they're computed
      on the second op. I could have adjusted this to check for "instruction
      or argument", but I think it's better to avoid the repeated calculation
      with an explicit flag.
      
      Differential Revision: https://reviews.llvm.org/D56247
      
      llvm-svn: 350435
      6658fce4
    • Evandro Menezes's avatar
      [AArch64] Adjust the cost model for Exynos M3 · 9f53bea5
      Evandro Menezes authored
      Improve the modeling of ASIMD loads and stores.
      
      llvm-svn: 350434
      9f53bea5
    • Peter Collingbourne's avatar
      Fix default-function-attr.c so that it works on Windows. · f90e1507
      Peter Collingbourne authored
      llvm-svn: 350433
      f90e1507
    • Craig Topper's avatar
      [X86] Add INSERT_SUBVECTOR to ComputeNumSignBits · cfeb1cf9
      Craig Topper authored
      This adds support for calculating sign bits of insert_subvector. I based it on the computeKnownBits.
      
      My motivating case is propagating sign bits information across basic blocks on AVX targets where concatenating using insert_subvector is common.
      
      Differential Revision: https://reviews.llvm.org/D56283
      
      llvm-svn: 350432
      cfeb1cf9
    • Alexey Bataev's avatar
      [OPENMP][NVPTX]General formatting/code improvement, NFC. · 6b3153ad
      Alexey Bataev authored
      Summary: Formatting.
      
      Reviewers: gtbercea, grokos, kkwli0
      
      Subscribers: guansong, openmp-commits, caomhin
      
      Differential Revision: https://reviews.llvm.org/D56290
      
      llvm-svn: 350431
      6b3153ad
    • Sanjay Patel's avatar
      [x86] add tests for potential horizontal vector ops; NFC · 6a565670
      Sanjay Patel authored
      These are modified versions of the FP tests from rL349923.
      
      llvm-svn: 350430
      6a565670
    • Peter Collingbourne's avatar
      hwasan: Implement lazy thread initialization for the interceptor ABI. · 87f477b5
      Peter Collingbourne authored
      The problem is similar to D55986 but for threads: a process with the
      interceptor hwasan library loaded might have some threads started by
      instrumented libraries and some by uninstrumented libraries, and we
      need to be able to run instrumented code on the latter.
      
      The solution is to perform per-thread initialization lazily. If a
      function needs to access shadow memory or add itself to the per-thread
      ring buffer its prologue checks to see whether the value in the
      sanitizer TLS slot is null, and if so it calls __hwasan_thread_enter
      and reloads from the TLS slot. The runtime does the same thing if it
      needs to access this data structure.
      
      This change means that the code generator needs to know whether we
      are targeting the interceptor runtime, since we don't want to pay
      the cost of lazy initialization when targeting a platform with native
      hwasan support. A flag -fsanitize-hwaddress-abi={interceptor,platform}
      has been introduced for selecting the runtime ABI to target. The
      default ABI is set to interceptor since it's assumed that it will
      be more common that users will be compiling application code than
      platform code.
      
      Because we can no longer assume that the TLS slot is initialized,
      the pthread_create interceptor is no longer necessary, so it has
      been removed.
      
      Ideally, lazy initialization should only cost one instruction in the
      hot path, but at present the call may cause us to spill arguments
      to the stack, which means more instructions in the hot path (or
      theoretically in the cold path if the spills are moved with shrink
      wrapping). With an appropriately chosen calling convention for
      the per-thread initialization function (TODO) the hot path should
      always need just one instruction and the cold path should need two
      instructions with no spilling required.
      
      Differential Revision: https://reviews.llvm.org/D56038
      
      llvm-svn: 350429
      87f477b5
    • Davide Italiano's avatar
      [Scalar] Simplify comparison operators and add coverage. · ff92a1a7
      Davide Italiano authored
      llvm-svn: 350428
      ff92a1a7
    • Peter Collingbourne's avatar
      hwasan: Use system allocator to realloc and free untagged pointers in interceptor mode. · fcbcc611
      Peter Collingbourne authored
      The Android dynamic loader has a non-standard feature that allows
      libraries such as the hwasan runtime to interpose symbols even after
      the symbol already has a value. The new value of the symbol is used to
      relocate libraries loaded after the interposing library, but existing
      libraries keep the old value. This behaviour is activated by the
      DF_1_GLOBAL flag in DT_FLAGS_1, which is set by passing -z global to
      the linker, which is what we already do to link the hwasan runtime.
      
      What this means in practice is that if we have .so files that depend
      on interceptor-mode hwasan without the main executable depending on
      it, some of the libraries in the process will be using the hwasan
      allocator and some will be using the system allocator, and these
      allocators need to interact somehow. For example, if an instrumented
      library calls a function such as strdup that allocates memory on
      behalf of the caller, the instrumented library can reasonably expect
      to be able to call free to deallocate the memory.
      
      We can handle that relatively easily with hwasan by using tag 0 to
      represent allocations from the system allocator. If hwasan's realloc
      or free functions are passed a pointer with tag 0, the system allocator
      is called.
      
      One limitation is that this scheme doesn't work in reverse: if an
      instrumented library allocates memory, it must free the memory itself
      and cannot pass ownership to a system library. In a future change,
      we may want to expose an API for calling the system allocator so
      that instrumented libraries can safely transfer ownership of memory
      to system libraries.
      
      Differential Revision: https://reviews.llvm.org/D55986
      
      llvm-svn: 350427
      fcbcc611
    • Aaron Enye Shi's avatar
      [HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types · 0743cda6
      Aaron Enye Shi authored
      The offload bundler action should not unbundle the input file types that does not match the action type. This fixes an issue where .so files are unbundled when the action type is object files.
      
      Reviewers: yaxunl
      
      Differential Revision: https://reviews.llvm.org/D56321
      
      llvm-svn: 350426
      0743cda6
    • Aaron Enye Shi's avatar
      [HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types · bea57bb5
      Aaron Enye Shi authored
      The offload bundler action should not unbundle the input file types that does not match the action type. This fixes an issue where .so files are unbundled when the action type is object files.
      
      llvm-svn: 350425
      bea57bb5
    • Teresa Johnson's avatar
      [ThinLTO] Clang changes to utilize new pass to handle chains of aliases · 6ed7913c
      Teresa Johnson authored
      Summary:
      As with NameAnonGlobals, invoke the new CanonicalizeAliases via clang
      when using the new PM.
      
      Depends on D54507.
      
      Reviewers: pcc, davidxl
      
      Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D55620
      
      llvm-svn: 350424
      6ed7913c
    • Teresa Johnson's avatar
      [ThinLTO] Handle chains of aliases · 853b9624
      Teresa Johnson authored
      At -O0, globalopt is not run during the compile step, and we can have a
      chain of an alias having an immediate aliasee of another alias. The
      summaries are constructed assuming aliases in a canonical form
      (flattened chains), and as a result only the base object but no
      intermediate aliases were preserved.
      
      Fix by adding a pass that canonicalize aliases, which ensures each
      alias is a direct alias of the base object.
      
      Reviewers: pcc, davidxl
      
      Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, arphaman, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D54507
      
      llvm-svn: 350423
      853b9624
    • Erik Pilkington's avatar
      [ObjCARC] Add an new attribute, objc_externally_retained · 1e36882b
      Erik Pilkington authored
      This attribute, called "objc_externally_retained", exposes clang's
      notion of pseudo-__strong variables in ARC. Pseudo-strong variables
      "borrow" their initializer, meaning that they don't retain/release
      it, instead assuming that someone else is keeping their value alive.
      
      If a function is annotated with this attribute, implicitly strong
      parameters of that function aren't implicitly retained/released in
      the function body, and are implicitly const. This is useful to expose
      for performance reasons, most functions don't need the extra safety
      of the retain/release, so programmers can opt out as needed.
      
      This attribute can also apply to declarations of local variables,
      with similar effect.
      
      Differential revision: https://reviews.llvm.org/D55865
      
      llvm-svn: 350422
      1e36882b
    • Sanjay Patel's avatar
      [x86] lower extracted fadd/fsub to horizontal vector math; 2nd try · 61535655
      Sanjay Patel authored
      The 1st try for this was at rL350369, but it caused IR-level diffs because
      our cost models differentiate custom vs. legal/promote lowering. So that was
      reverted at rL350373. The cost models were fixed independently at rL350403,
      so this is effectively the same patch as last time.
      
      Original commit message:
      This would show up if we fix horizontal reductions to narrow as they go along,
      but it's an improvement for size and/or Jaguar (fast-hops) independent of that.
      
      We need to do this late to not interfere with other pattern matching of larger
      horizontal sequences.
      
      We can extend this to integer ops in a follow-up patch.
      
      Differential Revision: https://reviews.llvm.org/D56011
      
      llvm-svn: 350421
      61535655
    • Vedant Kumar's avatar
      [CodeExtractor] Do not extract unsafe lifetime markers · a1778df4
      Vedant Kumar authored
      Lifetime markers which reference inputs to the extraction region are not
      safe to extract. Example ('rhs' will be extracted):
      
      ```
                     entry:
                    +------------+
                    | x = alloca |
                    | y = alloca |
                    +------------+
                   /              \
         lhs:                      rhs:
        +-------------------+     +-------------------+
        | lifetime_start(x) |     | lifetime_start(x) |
        | use(x)            |     | lifetime_start(y) |
        | lifetime_end(x)   |     | use(x, y)         |
        | lifetime_start(y) |     | lifetime_end(y)   |
        | use(y)            |     | lifetime_end(x)   |
        | lifetime_end(y)   |     +-------------------+
        +-------------------+
      ```
      
      Prior to extraction, the stack coloring pass sees that the slots for 'x'
      and 'y' are in-use at the same time. After extraction, the coloring pass
      infers that 'x' and 'y' are *not* in-use concurrently, because markers
      from 'rhs' are no longer available to help decide otherwise.
      
      This leads to a miscompile, because the stack slots actually are in-use
      concurrently in the extracted function.
      
      Fix this by moving lifetime start/end markers for memory regions defined
      in the calling function around the call to the extracted function.
      
      Fixes llvm.org/PR39671 (rdar://45939472).
      
      Differential Revision: https://reviews.llvm.org/D55967
      
      llvm-svn: 350420
      a1778df4
    • Sanjay Patel's avatar
      [InstCombine] reduce raw IR narrowing rotate patterns to funnel shift · 722466e1
      Sanjay Patel authored
        
      Similar to rL350199 - there are no known analysis/codegen holes for
      funnel shift intrinsics now, so we can canonicalize the 6+ regular
      instructions to funnel shift to improve vectorization, inlining,
      unrolling, etc.
      
      llvm-svn: 350419
      722466e1
    • Nico Weber's avatar
      [gn build] Merge r350351 · 16a133bd
      Nico Weber authored
      llvm-svn: 350418
      16a133bd
    • Nico Weber's avatar
      [gn build] Commit change that should have been in r350410. · c9141fc9
      Nico Weber authored
      llvm-svn: 350416
      c9141fc9
    • Alexey Bataev's avatar
      [OPENMP][NVPTX]Use new functions from the runtime library. · 8e009036
      Alexey Bataev authored
      Updated codegen to use the new functions from the runtime library.
      
      llvm-svn: 350415
      8e009036
    • Aaron Ballman's avatar
      Add two new pragmas for controlling software pipelining optimizations. · 9bdf515c
      Aaron Ballman authored
      This patch adds #pragma clang loop pipeline and #pragma clang loop pipeline_initiation_interval for debugging or reducing compile time purposes. It is possible to disable SWP for concrete loops to save compilation time or to find bugs by not doing SWP to certain loops. It is possible to set value of initiation interval to concrete number to save compilation time by not doing extra pipeliner passes or to check created schedule for specific initiation interval.
      
      Patch by Alexey Lapshin.
      
      llvm-svn: 350414
      9bdf515c
    • Nico Weber's avatar
      [gn build] Add even more build files for LLVM unittests · 022e29b9
      Nico Weber authored
      Another random assortment of easy build files.
      
      Differential Revision: https://reviews.llvm.org/D56217
      
      llvm-svn: 350413
      022e29b9
    • Nico Weber's avatar
      [gn build] Add more build files for LLVM unittests · 47d9ff73
      Nico Weber authored
      A fairly random assortment of build files that are easy.
      
      Differential Revision: https://reviews.llvm.org/D56213
      
      llvm-svn: 350412
      47d9ff73
    • Nico Weber's avatar
      [gn build] Start adding build files for LLVM unittests · 2c497b51
      Nico Weber authored
      Adds build files for //llvm/unittest/[A-D].
      
      Also teach sync_source_lists_from_cmake.py to not complain about missing
      BUILD.gn files for CMakeLists.txt files that just call add_subdirectory()
      without calling add_.+_unittest, like e.g.
      llvm/unittests/Target/CMakeLists.txt.
      
      (Omits CodeGen/GlobalISel and DebugInfo/PDB because their build files are somewhat interesting, and this patch is already on the larger side.)
      
      Differential Revision: https://reviews.llvm.org/D56212
      
      llvm-svn: 350411
      2c497b51
    • Nico Weber's avatar
      [gn build] Add check-llvm target and make it work · 421c17fe
      Nico Weber authored
      With this, check-llvm runs and passes all of clang's lit tests. It doesn't run
      any of its unit tests yet.
      
      This is the only change in the GN build patch series that needs a change to a
      file outside of llvm/utils/gn: llvm/test/tools/llvm-config/booleans.test checks
      the result of llvm-config --build-system for some reason, so I'm updating the
      test to accept "gn" as valid output in addition to "cmake". (The alternative
      would be to let the gn build self-identify as cmake, which seems worse.)
      
      Like with check-clang and check-lld, running just ninja -C out/gn will build
      all prerequisites needed to run tests, but it won't run the tests (so that the
      build becomes clean after one build). Running ninja -C out/gn check-llvm will
      build prerequisites if needed and run the tests. The check-llvm target never
      becomes clean and runs tests every time.
      
      Differential Revision: https://reviews.llvm.org/D56195
      
      llvm-svn: 350410
      421c17fe
    • Nico Weber's avatar
      [gn build] Add build file for libLTO.dylib · c01e15ed
      Nico Weber authored
      Not used by anything yet, but will be needed to make check-llvm run ld64's libLTO plugin tests.
      
      Differential Revision: https://reviews.llvm.org/D56317
      
      llvm-svn: 350409
      c01e15ed
    • John Brawn's avatar
      [LICM] Adjust how moving the re-hoist point works · 39ac159c
      John Brawn authored
      In some cases the order that we hoist instructions in means that when rehoisting
      (which uses the same order as hoisting) we can rehoist to a block A, then a
      block B, then block A again. This currently causes an assertion failure as it
      expects that when changing the hoist point it only ever moves to a block that
      dominates the hoist point being moved from.
      
      Fix this by moving the re-hoist point when it doesn't dominate the dominator of
      hoisted instruction, or in other words when it wouldn't dominate the uses of
      the instruction being rehoisted.
      
      Differential Revision: https://reviews.llvm.org/D55266
      
      llvm-svn: 350408
      39ac159c
    • Nico Weber's avatar
      [gn build] Add build files for llvm/lib/{LineEditor,Testing/Support,TextAPI} · 2b506d9f
      Nico Weber authored
      Nothing pulls them in yet, but they will be needed for check-llvm.
      
      LineEditor depends on libedit, so create a gn/build/lib for it, following the
      usual pattern.
      
      Differential Revision: https://reviews.llvm.org/D56316
      
      llvm-svn: 350407
      2b506d9f
    • Nirav Dave's avatar
      Undo r350355 "[X86] Remove terrible DX Register parsing hack in parse operand. NFCI." · 1468d6e1
      Nirav Dave authored
      Add missing test case and update comments.
      
      llvm-svn: 350406
      1468d6e1