platform/upstream/llvm.git
3 years ago[gn build] (manually) port bc1a2979fc70
Nico Weber [Tue, 20 Jul 2021 10:43:30 +0000 (06:43 -0400)]
[gn build] (manually) port bc1a2979fc70

3 years ago[PowerPC][NFC] add more cases for lfiwzx/lfiwax
Chen Zheng [Tue, 20 Jul 2021 10:27:47 +0000 (10:27 +0000)]
[PowerPC][NFC] add more cases for lfiwzx/lfiwax

3 years ago[clang][deps] Avoid minimizing PCH input files
Jan Svoboda [Tue, 20 Jul 2021 10:12:40 +0000 (12:12 +0200)]
[clang][deps] Avoid minimizing PCH input files

This patch avoid minimizing input files that contributed to a PCH or its modules. This prevents the implicit modular build to fail on unexpected file size. Depends on D106146.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D104536

3 years ago[clang][deps] Separate filesystem caches for minimized and original files
Jan Svoboda [Tue, 20 Jul 2021 09:42:34 +0000 (11:42 +0200)]
[clang][deps] Separate filesystem caches for minimized and original files

This patch separates the local and global caches of `DependencyScanningFilesystem` into two buckets: minimized files and original files. This is necessary to deal with precompiled modules/headers.

Consider a single worker with its instance of filesystem:
1. Build system uses the worker to scan dependencies of module A => filesystem cache gets populated with minimized input files.
2. Build system uses the results to explicitly build module A => explicitly built module captures the state of the real filesystem (containing non-minimized input files).
3. Build system uses the prebuilt module A as an explicit precompiled dependency for another compile job B.
4. Build system uses the same worker to scan dependencies for job B => worker uses implicit modular build to discover dependencies, which validates the filesystem state embedded in the prebuilt module (non-minimized files) to the current view of the filesystem (minimized files), resulting in validation failures.

This problem can be avoided in step 4 by collecting input files from the precompiled module and marking them as "ignored" in the minimizing filesystem. This way, the validation should succeed, since we should be always dealing with the original (non-minized) input files. However, the filesystem already minimized the input files in step 1 and put it in the cache, which gets used in step 4 as well even though it's marked ignored (do not minimize). This patch essentially fixes this oversight by making the `"file is minimized"` part of the cache key (from high level).

Depends on D106064.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D106146

3 years ago[AMDGPU] Disable LDS lowering for GFX shaders
Stanislav Mekhanoshin [Fri, 16 Jul 2021 16:15:10 +0000 (09:15 -0700)]
[AMDGPU] Disable LDS lowering for GFX shaders

Apparently these need external LDS symbols to remain.

Fixes: SC1-3279

Differential Revision: https://reviews.llvm.org/D106288

3 years ago[DSE] Transform memset + malloc --> calloc (PR25892)
Dawid Jurczak [Mon, 5 Jul 2021 09:42:17 +0000 (11:42 +0200)]
[DSE] Transform memset + malloc --> calloc (PR25892)

After this change DSE can eliminate malloc + memset and emit calloc.
It's https://reviews.llvm.org/D101440 follow-up.

Differential Revision: https://reviews.llvm.org/D103009

3 years agoRevert "[hwasan] Use stack safety analysis."
Florian Mayer [Tue, 20 Jul 2021 09:36:26 +0000 (10:36 +0100)]
Revert "[hwasan] Use stack safety analysis."

This reverts commit e9c63ed10b3bdf6eb3fa76d1a3eb403d6fc6a118.

3 years ago[clang][deps] Normalize ignored filenames in minimizing file system
Jan Svoboda [Tue, 20 Jul 2021 08:57:12 +0000 (10:57 +0200)]
[clang][deps] Normalize ignored filenames in minimizing file system

This patch normalizes filenames in `DependencyScanningWorkerFilesystem` so that lookup of ignored files works correctly on Windows (where `/` and `\` are equivalent).

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D106064

3 years ago[NFC] run clang-format on hwasan use-after-scope tests.
Florian Mayer [Mon, 19 Jul 2021 10:16:38 +0000 (11:16 +0100)]
[NFC] run clang-format on hwasan use-after-scope tests.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D106259

3 years ago[PowerPC] Add lit.local.cfg in AtomicExpand tests
Kai Luo [Tue, 20 Jul 2021 09:11:01 +0000 (09:11 +0000)]
[PowerPC] Add lit.local.cfg in AtomicExpand tests

Fixed build errors on other platforms.

3 years ago[hwasan] [NFC] copy and disable ASAN tests to hwasan.
Florian Mayer [Fri, 16 Jul 2021 15:30:37 +0000 (16:30 +0100)]
[hwasan] [NFC] copy and disable ASAN tests to hwasan.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D106159

3 years ago[hwasan] Use stack safety analysis.
Florian Mayer [Mon, 19 Jul 2021 11:52:17 +0000 (12:52 +0100)]
[hwasan] Use stack safety analysis.

This avoids unnecessary instrumentation.

Reviewed By: eugenis, vitalybuka

Differential Revision: https://reviews.llvm.org/D105703

3 years ago[AArch64][SVE][InstCombine] last{a,b} of a splat vector
Sander de Smalen [Mon, 19 Jul 2021 09:48:42 +0000 (10:48 +0100)]
[AArch64][SVE][InstCombine] last{a,b} of a splat vector

Replace last{a,b}(splat(X)) with X, irrespective of the predicate.

Patch by/Committing on behalf of: Usman Nadeem (mnadeem)

Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D105520

3 years ago[lldb] Remove unused variable. NFCI
Benjamin Kramer [Tue, 20 Jul 2021 08:34:05 +0000 (10:34 +0200)]
[lldb] Remove unused variable. NFCI

3 years ago[AArch64][SME] Add system registers and related instructions
Cullen Rhodes [Tue, 20 Jul 2021 07:19:10 +0000 (07:19 +0000)]
[AArch64][SME] Add system registers and related instructions

This patch adds the new system registers introduced in SME:

  - ID_AA64SMFR0_EL1 (ro) SME feature identifier.
  - SMCR_ELx (r/w) streaming mode control register for configuring
    effective SVE Streaming SVE Vector length when the PE is in
    Streaming SVE mode.
  - SVCR (r/w) streaming vector control register, visible at all
    exception levels. Provides access to PSTATE.SM and PSTATE.ZA
    using MSR and MRS instructions.
  - SMPRI_EL1 (r/w) streaming mode execution priority register.
  - SMPRIMAP_EL2 (r/w) streaming mode priority mapping register.
  - SMIDR_EL1 (ro) streaming mode identification register.
  - TPIDR2_EL0 (r/w) for use by SME software to manage per-thread
    SME context.
  - MPAMSM_EL1 (r/w) MPAM (v8.4) streaming mode register, for
    labelling memory accesses performed in streaming mode.

Also added in this patch are the SME mode change instructions.
Three MSR immediate instructions are implemented to set or clear
PSTATE.SM, PSTATE.ZA, or both respectively:

  - MSR SVCRSM, #<imm1>
  - MSR SVCRZA, #<imm1>
  - MSR SVCRSMZA, #<imm1>

The following smstart/smstop aliases are also implemented for
convenience:

  smstart    -> MSR SVCRSMZA, #1
  smstart sm -> MSR SVCRSM,   #1
  smstart za -> MSR SVCRZA,   #1

  smstop     -> MSR SVCRSMZA, #0
  smstop sm  -> MSR SVCRSM,   #0
  smstop za  -> MSR SVCRZA,   #0

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-06

Reviewed By: david-arm

Differential Revision: https://reviews.llvm.org/D105576

3 years ago[mlir-tblgen] Fix failed matching when binds same operand of an op in different depth
Chia-hung Duan [Tue, 20 Jul 2021 07:26:23 +0000 (15:26 +0800)]
[mlir-tblgen] Fix failed matching when binds same operand of an op in different depth

For example, we will generate incorrect code for the pattern,

def : Pat<((FooOp (FooOp, $a, $b), $b)), (...)>;

We didn't allow $b to be bond twice with same operand of same op.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D105677

3 years agoRemove the DarwinLog functionality from debguserver
Jason Molenda [Tue, 20 Jul 2021 07:31:19 +0000 (00:31 -0700)]
Remove the DarwinLog functionality from debguserver

Remove the DarwinLog and qStructuredDataPlugins support
from debugserver.  The DarwinLog plugin was never debugged
fully and made reliable, and the underlying private APIs
it uses have migrated since 2016 so none of them exist
any longer.

Differential Revision: https://reviews.llvm.org/D106324
rdar://75073283

3 years ago[AArch64][GlobalISel] Don't form truncstores in postlegalizer-lowering for s128.
Amara Emerson [Tue, 20 Jul 2021 07:03:37 +0000 (00:03 -0700)]
[AArch64][GlobalISel] Don't form truncstores in postlegalizer-lowering for s128.

We don't support truncating s128 stores, so don't form them.

3 years ago[Attributor] Use set vector instead of vector to prevent duplicates
Johannes Doerfert [Wed, 14 Jul 2021 03:54:52 +0000 (22:54 -0500)]
[Attributor] Use set vector instead of vector to prevent duplicates

3 years ago[Attributor] Simplify to values in the genericValueTraversal
Johannes Doerfert [Tue, 13 Jul 2021 03:14:36 +0000 (22:14 -0500)]
[Attributor] Simplify to values in the genericValueTraversal

We already simplified to a constant, given the new interface we can also
simplify to a generic value.

3 years ago[Attributor] Use checkForAllUses instead of custom use tracking
Johannes Doerfert [Wed, 14 Jul 2021 03:50:57 +0000 (22:50 -0500)]
[Attributor] Use checkForAllUses instead of custom use tracking

AAMemoryBehaviorFloating used a custom use tracking mechanism even
though checkForAllUses exists and is already more powerful. Further,
AAMemoryBehaviorFloating uses AANoCapture to guarantee that there are no
aliases and following the uses is sufficient. This is an OK assumption
if checkForAllUses is used but custom tracking is easily out of sync
with AANoCapture and problems follow.

3 years agosanitizer_common: add new mutex
Dmitry Vyukov [Sun, 18 Jul 2021 08:19:37 +0000 (10:19 +0200)]
sanitizer_common: add new mutex

We currently have 3 different mutexes:
 - RWMutex
 - BlockingMutex
 - __tsan::Mutex

RWMutex and __tsan::Mutex are roughly the same,
except that tsan version supports deadlock detection.
BlockingMutex degrades better under heavy contention
from lots of threads (blocks in OS), but much slower
for light contention and has non-portable performance
and has larger static size and is not reader-writer.

Add a new mutex that combines all advantages of these
mutexes: it's reader-writer, has fast non-contended path,
supports blocking to gracefully degrade under higher contention,
has portable size/performance.

For now it's named Mutex2 for incremental submission. The plan is to:
 - land this change
 - then move deadlock detection logic from tsan
 - then rename it to Mutex and remove tsan Mutex
 - then typedef RWMutex/BlockingMutex to this mutex

SpinMutex stays as separate type because it has faster fast path:
1 atomic RMW per lock/unlock as compared to 2 for this mutex.

Reviewed By: vitalybuka, melver

Differential Revision: https://reviews.llvm.org/D106231

3 years ago[PowerPC] Fallback to base's implementation of shouldExpandAtomicCmpXchgInIR and...
Kai Luo [Tue, 20 Jul 2021 06:14:08 +0000 (06:14 +0000)]
[PowerPC] Fallback to base's implementation of shouldExpandAtomicCmpXchgInIR and shouldExpandAtomicCmpXchgInIR

If we can't decide `shouldExpandAtomicCmpXchgInIR` or `shouldExpandAtomicCmpXchgInIR` in PPC's implementation after https://reviews.llvm.org/rGb9c3941cd61de1e1b9e4f3311ddfa92394475f4b, resort to base's implementation.

This fixes internal build of OpenMP which uses atomic operations on float.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D106234

3 years ago[NFC][profile] Move writeMMappedFile to ELF ifdef block
Petr Hosek [Tue, 20 Jul 2021 05:45:33 +0000 (22:45 -0700)]
[NFC][profile] Move writeMMappedFile to ELF ifdef block

This avoids the compiler warning on Darwin where that function is unused.

3 years ago[RISCV] Add test cases to show an issue with our fcvt.wu isel patterns on RV64.
Craig Topper [Tue, 20 Jul 2021 05:52:05 +0000 (22:52 -0700)]
[RISCV] Add test cases to show an issue with our fcvt.wu isel patterns on RV64.

The pattern we match is (sext_inreg (assertzexti32 (fp_to_uint)), i32). If
the assertzexti32 has an additional user we'll end up emitting
an fcvt.wu and an fcvt.lu.

This can happen if the original fp_to_uint before type legalization
has one user that causes a sext_inreg to be emitted and one that
doesn't.

3 years ago[gn build] Port adb55d7c3265
LLVM GN Syncbot [Tue, 20 Jul 2021 05:51:14 +0000 (05:51 +0000)]
[gn build] Port adb55d7c3265

3 years ago[lldb] Make WatchpointList iterable
Michał Górny [Mon, 19 Jul 2021 11:17:52 +0000 (13:17 +0200)]
[lldb] Make WatchpointList iterable

Based on de448c0a9e5088979526e2e67152fe547ae4ccf0.

Differential Revision: https://reviews.llvm.org/D106263

3 years agotsan: remove the stats subsystem
Dmitry Vyukov [Mon, 19 Jul 2021 14:19:07 +0000 (16:19 +0200)]
tsan: remove the stats subsystem

I don't think the stat subsystem was ever used since tsan
development in 2012. But it adds lots of code and this
effectively dead code needs to be updated if the runtime
code changes, which adds maintanance cost for no benefit.
Normal profiler usually gives enough info and that info
is more trustworthy.
Remove the stats subsystem.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D106276

3 years ago[Attributor] Gracefully handle interprocedural reachability queries
Johannes Doerfert [Tue, 20 Jul 2021 05:30:20 +0000 (00:30 -0500)]
[Attributor] Gracefully handle interprocedural reachability queries

This does ensure `InformationCache::getPotentiallyReachable` will not
crash/assert on instructions from different functions but simply return
that one is reachable, which is conservatively correct.

3 years ago[Attributor] Ensure to simplify operands in AAValueConstantRange
Johannes Doerfert [Thu, 15 Jul 2021 21:09:33 +0000 (16:09 -0500)]
[Attributor] Ensure to simplify operands in AAValueConstantRange

As with other patches before, the simplification callback interface
requires us to go through the Attributor::getAssumedSimplified API first
before we recurs.

It is unclear if the problem can be explicitly tested with our current
infrastructure.

3 years ago[Attributor] Extend the AAValueSimplify compare simplification logic
Johannes Doerfert [Thu, 15 Jul 2021 20:41:46 +0000 (15:41 -0500)]
[Attributor] Extend the AAValueSimplify compare simplification logic

We first simplify the operands of a compare and then reason on the
simplified versions, e.g., with AANonNull.

This does improve the simplification capabilities but also fixes a
potential problem that has not yet been observed by simplifying the
operands first.

3 years ago[Attributor][NFCI] Expose `getAssumedUnderlyingObjects` API
Johannes Doerfert [Tue, 13 Jul 2021 03:22:31 +0000 (22:22 -0500)]
[Attributor][NFCI] Expose `getAssumedUnderlyingObjects` API

3 years ago[OpenMP] Remove XFAIL and update check lines properly
Johannes Doerfert [Tue, 20 Jul 2021 05:26:52 +0000 (00:26 -0500)]
[OpenMP] Remove XFAIL and update check lines properly

Undo 15c5701c8324d2dea519fa379c04d5c619a570ab and update check lines.

3 years ago[Attributor][NFC] Fix function name spelling
Johannes Doerfert [Tue, 20 Jul 2021 04:50:20 +0000 (23:50 -0500)]
[Attributor][NFC] Fix function name spelling

3 years agotsan: add pragma line to buildgo.sh
Dmitry Vyukov [Mon, 19 Jul 2021 13:54:44 +0000 (15:54 +0200)]
tsan: add pragma line to buildgo.sh

Add pragma line so that errors messages point to the actual
source files rather than to the concatenated gotsan.cpp.

Reviewed By: vitalybuka, melver

Differential Revision: https://reviews.llvm.org/D106275

3 years ago[OpenMP][FIX] Temporarily XFAIL tests waiting for new check lines
Johannes Doerfert [Tue, 20 Jul 2021 04:14:35 +0000 (23:14 -0500)]
[OpenMP][FIX] Temporarily XFAIL tests waiting for new check lines

The test is not wrong nor is the current main broken, it just an
interplay issue. Check lines will be updated in shortly.

3 years ago[Attributor][FIX] Do not simplify byval arguments
Johannes Doerfert [Wed, 14 Jul 2021 21:06:57 +0000 (16:06 -0500)]
[Attributor][FIX] Do not simplify byval arguments

A byval argument is a different value in the caller and callee, we
cannot propagate the information as part of AAValueSimplify. Users that
want to deal with byval arguments need to specifically perform the
argument -> call site step. We do not do this for now.

3 years ago[Attributor] Introduce AAPointerInfo
Johannes Doerfert [Mon, 12 Jul 2021 00:27:26 +0000 (19:27 -0500)]
[Attributor] Introduce AAPointerInfo

This patch introduces AAPointerInfo which tracks the uses of a pointer
and places them in "bins" based on their offset from the base and access
size.

As with other AAs, any pointer can be tracked but it is up to the user
to make sense of the results. The user in this patch is AAValueSimplify
and AAPotentialValues which both utilize AAPointerInfo to determine the
value of a load. For now, this is restricted to loads of allocas and
internal globals. Through the use of AAPointerInfo and the "bins" we can
track struct members separately. The users also know that storing only
zeros (at unknown indices) will result in loading only 0 (from unknown
indices). Other than that, the users are flow and context insensitive
(for now).

To deal with the "bins" more easily, AAPointerInfo provides a
forallInterfearingAccesses that applies a callback on all accesses
that might interfere with a given load or store.

Differential Revision: https://reviews.llvm.org/D104432

3 years ago[Attributor] Simplify loads
Johannes Doerfert [Mon, 10 May 2021 06:11:06 +0000 (01:11 -0500)]
[Attributor] Simplify loads

As a first step to simplify loads we only handle `null` and `undef`
underlying objects, as well as objects that have the load as a single user.
Loads of those values can be replaced by the initializer, if any.
Proper reasoning is introduced in a follow up patch

Differential Revision: https://reviews.llvm.org/D103862

3 years ago[OpenMP] Fix carefully track SPMDCompatibilityTracker
Johannes Doerfert [Thu, 15 Jul 2021 18:12:00 +0000 (13:12 -0500)]
[OpenMP] Fix carefully track SPMDCompatibilityTracker

We did not properly use SPMDCompatibilityTracker in various places.
This patch makes sure we look at the validity properly and also fix
the state if we can.

Differential Revision: https://reviews.llvm.org/D106085

3 years agoRevert "[PowerPC] Extra test case for LDARX"
Albion Fung [Tue, 20 Jul 2021 02:27:02 +0000 (21:27 -0500)]
Revert "[PowerPC] Extra test case for LDARX"

This reverts commit 1d3e77e7a8421a9d2dd13e3ef499ea967ea8f85c as
some buildbots seem to be unable to obtain the target
powerpc64le-unknown-linux-gnu.

3 years ago[NFC] Correct documentation error in OpenMP release ReleaseNotes
Tony Tye [Tue, 20 Jul 2021 01:20:22 +0000 (01:20 +0000)]
[NFC] Correct documentation error in OpenMP release ReleaseNotes

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D106330

3 years ago[ORC-RT] Introduce a ORC_RT_JIT_DISPATCH_TAG macro.
Lang Hames [Mon, 19 Jul 2021 23:06:39 +0000 (09:06 +1000)]
[ORC-RT] Introduce a ORC_RT_JIT_DISPATCH_TAG macro.

This macro can be used to define tag variables for use with jit-dispatch.

3 years ago[ORC-RT] Add ORC_RT prefix to WEAK_IMPORT macro.
Lang Hames [Mon, 19 Jul 2021 22:52:21 +0000 (08:52 +1000)]
[ORC-RT] Add ORC_RT prefix to WEAK_IMPORT macro.

3 years ago[Clang][RISCV] Correct the alignment of stores generated by vlseg/vlsegff.
Hsiangkai Wang [Mon, 19 Jul 2021 08:57:41 +0000 (16:57 +0800)]
[Clang][RISCV] Correct the alignment of stores generated by vlseg/vlsegff.

Differential Revision: https://reviews.llvm.org/D106255

3 years agoRevert D106128 "[lld-macho] Use DO_BIND_ADD_ADDR_IMM_SCALED for bind opcodes"
Fangrui Song [Tue, 20 Jul 2021 01:13:52 +0000 (18:13 -0700)]
Revert D106128 "[lld-macho] Use DO_BIND_ADD_ADDR_IMM_SCALED for bind opcodes"

This reverts commit 321b2bef098553ec648e4174aae92c63a6e1a810.

`for (BindIR *p = &opcodes[0]; p->opcode != BIND_OPCODE_DONE; ++p) {` has a heap-buffer-overflow with test/MachO/bind-opcodes.

3 years ago[OpenMP] Fixed a segmentation fault when using taskloop and target nowait
Shilei Tian [Tue, 20 Jul 2021 01:08:40 +0000 (21:08 -0400)]
[OpenMP] Fixed a segmentation fault when using taskloop and target nowait

The synchronization of task loop misses hidden helper tasks, causing segmentation
fault reported in https://bugs.llvm.org/show_bug.cgi?id=50002.

Reviewed By: ye-luo

Differential Revision: https://reviews.llvm.org/D106220

3 years agoCodeGen: Make MachineOptimizationRemarkEmitterPass a CFG analysis
Matt Arsenault [Wed, 12 May 2021 21:10:24 +0000 (17:10 -0400)]
CodeGen: Make MachineOptimizationRemarkEmitterPass a CFG analysis

This avoids rerunning it a few times.

3 years ago[PowerPC] Extra test case for LDARX
Albion Fung [Tue, 20 Jul 2021 01:03:22 +0000 (20:03 -0500)]
[PowerPC] Extra test case for LDARX

An extra test case added for the builtin __LDARX.

Differential revision: https://reviews.llvm.org/D105926

3 years agoGlobalISel: Remove some mystery code that clears isReturned
Matt Arsenault [Fri, 16 Jul 2021 23:59:22 +0000 (19:59 -0400)]
GlobalISel: Remove some mystery code that clears isReturned

I don't understand what this is going for, and haven't found an analog
in DAG code. No tests fail with this removed.

3 years agoAArch64/GlobalISel: Preserve memory types
Matt Arsenault [Fri, 16 Jul 2021 13:54:52 +0000 (09:54 -0400)]
AArch64/GlobalISel: Preserve memory types

3 years agoRevert D105519 "[WebAssembly] Deduplicate imports of the same module name, field...
Fangrui Song [Tue, 20 Jul 2021 00:09:01 +0000 (17:09 -0700)]
Revert D105519 "[WebAssembly] Deduplicate imports of the same module name, field name, and type" and its followup

This reverts commit 4ae575b9997e0903d1c2ec01a43e3f3f2db5df16 and 9b965b37c75d626c01951184088314590e38d299.

There is an use-of-uninitialized-value bug in the `else` branch in ImportSection::addImport.

3 years ago[Libomptarget] Remove volatile from NVPTX work function
Joseph Huber [Mon, 19 Jul 2021 20:54:31 +0000 (16:54 -0400)]
[Libomptarget] Remove volatile from NVPTX work function

Currently the NPVTX work function is marked volatile. This prevents some
optimizations from using this value.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D106310

3 years ago[gn build] Fix llvm_build_instrumented_coverage=true builds with goma/rbe
Nico Weber [Mon, 19 Jul 2021 23:57:02 +0000 (19:57 -0400)]
[gn build] Fix llvm_build_instrumented_coverage=true builds with goma/rbe

3 years ago[libc++] Tidy-up instances of __STDCPP_DEFAULT_NEW_ALIGNMENT__ in the tests
Louis Dionne [Fri, 16 Jul 2021 19:52:42 +0000 (15:52 -0400)]
[libc++] Tidy-up instances of __STDCPP_DEFAULT_NEW_ALIGNMENT__ in the tests

See https://reviews.llvm.org/D105905 for context.

Differential Revision: https://reviews.llvm.org/D106182

3 years ago[libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABI in <ranges>
Louis Dionne [Mon, 19 Jul 2021 16:34:56 +0000 (12:34 -0400)]
[libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABI in <ranges>

We've been forgetting to add those to most of the <ranges> review.
To avoid forgetting in the future, I added an item in the pre-commit
checklist.

Differential Revision: https://reviews.llvm.org/D106287

3 years ago[tests] Add a couple of tests for zero stride trip counts w/loop varying exit values
Philip Reames [Mon, 19 Jul 2021 23:33:01 +0000 (16:33 -0700)]
[tests] Add a couple of tests for zero stride trip counts w/loop varying exit values

3 years ago[lld-macho] Use DO_BIND_ADD_ADDR_IMM_SCALED for bind opcodes
Vincent Lee [Fri, 16 Jul 2021 03:25:48 +0000 (20:25 -0700)]
[lld-macho] Use DO_BIND_ADD_ADDR_IMM_SCALED for bind opcodes

Implement pass 3 of bind opcodes from ld64 (which supports both 32-bit and 64-bit).
Pass 3 implementation condenses BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB opcode
to BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED.  This change is already behind an
O2 flag so it shouldn't impact current performance. I verified ld64's output with x86_64 LLD
and they were both emitting the same optimized bind opcodes (although in a slightly different
order). Tested with arm64_32 LLD and compared that with x86 LLD that the order of the bind
opcodes are the same (offset values are different which should be expected).

Reviewed By: int3, #lld-macho

Differential Revision: https://reviews.llvm.org/D106128

3 years ago[ScalarEvolution] Refine computeMaxBECountForLT to be accurate in more cases.
Eli Friedman [Fri, 16 Jul 2021 23:21:20 +0000 (16:21 -0700)]
[ScalarEvolution] Refine computeMaxBECountForLT to be accurate in more cases.

Allow arbitrary strides, and make sure we return the correct result when
the backedge-taken count is zero.

Differential Revision: https://reviews.llvm.org/D106197

3 years agoDyanamic shape support for memref reassociation reshape ops
Yi Zhang [Mon, 19 Jul 2021 22:10:13 +0000 (15:10 -0700)]
Dyanamic shape support for memref reassociation reshape ops

Only memref with identity layout map is supported for now.

Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D106180

3 years ago[SCEV] Add a clarifying comment in howManyLessThans
Philip Reames [Mon, 19 Jul 2021 22:11:38 +0000 (15:11 -0700)]
[SCEV] Add a clarifying comment in howManyLessThans

Wrap semantics are subtle when combined with multiple exits.  This has caused several rounds of confusion during recent reviews, so try to document the subtly distinction between when wrap flags provide <u and <=u facts.

3 years ago[NewPM][opt] Add -debug-pass-manager=quiet to not print analysis info
Arthur Eubanks [Mon, 19 Jul 2021 20:35:57 +0000 (13:35 -0700)]
[NewPM][opt] Add -debug-pass-manager=quiet to not print analysis info

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D106307

3 years ago[NewPM] Bail out of devirtualization wrapper if the current SCC is invalidated
Arthur Eubanks [Mon, 19 Jul 2021 20:20:57 +0000 (13:20 -0700)]
[NewPM] Bail out of devirtualization wrapper if the current SCC is invalidated

The specific case that triggered this was when inlining a recursive
internal function into itself caused the recursion to go away, allowing
the inliner to mark the function as dead. The inliner marks the SCC as
invalidated but does not provide a new SCC to continue with.

This matches the implementations of ModuleToPostOrderCGSCCPassAdaptor
and CGSCCPassManager.

Fixes PR50363.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D106306

3 years ago[PowerPC] swdiv_nochk Builtins for XL Compat
Quinn Pham [Fri, 16 Jul 2021 16:48:00 +0000 (11:48 -0500)]
[PowerPC] swdiv_nochk Builtins for XL Compat

This patch is in a series of patches to provide builtins for
compatibility with the XL compiler. This patch adds software divide
builtins with no checking. These builtins are each emitted as a fast
fdiv.

Reviewed By: #powerpc, nemanjai

Differential Revision: https://reviews.llvm.org/D106150

3 years agoSplit `InferShapedTypeOpInterface` to create `ReifyRankedShapedTypeInterface`.
MaheshRavishankar [Mon, 19 Jul 2021 21:35:20 +0000 (14:35 -0700)]
Split `InferShapedTypeOpInterface` to create `ReifyRankedShapedTypeInterface`.

The `reifyReturnTypeShapesPerResultDim` method supports shape
inference for rsults that are ranked types. These are used lower in
the codegeneration stack than its counter part `reifyReturnTypeShapes`
which also supports unranked types, and is more suited for use higher
up the compilation stack. To have separation of concerns, this method
is split into its own interface.
See discussion : https://llvm.discourse.group/t/better-layering-for-infershapedtypeopinterface/3823

Differential Revision: https://reviews.llvm.org/D106133

3 years ago[gn build] Port 08b289867b5a
LLVM GN Syncbot [Mon, 19 Jul 2021 21:33:24 +0000 (21:33 +0000)]
[gn build] Port 08b289867b5a

3 years ago[clang] Respect PrintingPolicy::FullyQualifiedName when printing a template-id
Nathan Ridge [Mon, 21 Jun 2021 07:19:19 +0000 (03:19 -0400)]
[clang] Respect PrintingPolicy::FullyQualifiedName when printing a template-id

Fixes PR50774

Differential Revision: https://reviews.llvm.org/D104619

3 years ago[lld][WebAssembly] Cleanup duplicate fields in Symbols.h. NFC
Sam Clegg [Thu, 15 Jul 2021 00:16:15 +0000 (17:16 -0700)]
[lld][WebAssembly] Cleanup duplicate fields in Symbols.h. NFC

This avoids duplication and simplifies the code in several places
without increasing the size of the symbol union (at least not
above the assert'd limit of 120 bytes).

Differential Revision: https://reviews.llvm.org/D106026

3 years agoDon't use !eStateRunning when you mean eStateStopped in DestroyImpl.
Jim Ingham [Mon, 19 Jul 2021 21:25:37 +0000 (14:25 -0700)]
Don't use !eStateRunning when you mean eStateStopped in DestroyImpl.

When we go to destroy the process, we first try to halt it, if
we succeeded and the target stopped, we want to clear out the
thread plans and breakpoints in case we still need to resume to complete
killing the process.  If the target was exited or detached, it's
pointless but harmless to do this.  But if the state is eStateInvalid -
for instance if we tried to interrupt the target to Halt it and that
fails - we don't want to keep trying to interact with the inferior,
so we shouldn't do this work.

This change explicitly checks eStateStopped, and only does the pre-resume
cleanup if we did manage to stop the process.

3 years agoRevert "[MemCpyOpt] Enable memcpy optimizations unconditionally."
Artem Belevich [Mon, 19 Jul 2021 21:27:41 +0000 (14:27 -0700)]
Revert "[MemCpyOpt] Enable memcpy optimizations unconditionally."

This reverts commit 2c98298a7559dfe4a264ef1adaad0921526768cc which breaks
sanitizers.

3 years ago[mlir] Fix bazel build
thomasraoux [Mon, 19 Jul 2021 21:00:51 +0000 (14:00 -0700)]
[mlir] Fix bazel build

Differential Revision: https://reviews.llvm.org/D106311

3 years ago[WebAssembly] Generate R_WASM_FUNCTION_OFFSET relocs in debuginfo sections
Derek Schuff [Wed, 2 Jun 2021 21:37:22 +0000 (14:37 -0700)]
[WebAssembly] Generate R_WASM_FUNCTION_OFFSET relocs in debuginfo sections

Debug info sections need R_WASM_FUNCTION_OFFSET_I32 relocs (with FK_Data_4 fixup
kinds) to refer to functions (instead of R_WASM_TABLE_INDEX as is used in data
sections). Usually this is done in a convoluted way, with unnamed temp data
symbols which target the start of the function, in which case
WasmObjectWriter::recordRelocation converts it to use the section symbol
instead. However in some cases the function can actually be undefined; in this
case the dwarf generator uses the function symbol (a named undefined function
symbol) instead. In that case the section-symbol transform doesn't work and we
need to generate the correct reloc type a different way. In this change
WebAssemblyWasmObjectWriter::getRelocType takes the fixup section type into
account to choose the correct reloc type.

Fixes PR50408
Differential Revision: https://reviews.llvm.org/D103557

3 years ago[MLGO] Use binary protobufs for improved training performance.
Mircea Trofin [Wed, 14 Jul 2021 22:03:14 +0000 (15:03 -0700)]
[MLGO] Use binary protobufs for improved training performance.

It turns out that during training, the time required to parse the
textual protobuf of a training log is about the same as the time it
takes to compile the module generating that log. Using binary protobufs
instead elides that cost almost completely.

Differential Revision: https://reviews.llvm.org/D106157

3 years ago[WebAssembly] Deduplicate imports of the same module name, field name, and type
Nick Fitzgerald [Mon, 19 Jul 2021 20:02:46 +0000 (13:02 -0700)]
[WebAssembly] Deduplicate imports of the same module name, field name, and type

When two symbols import the same thing, only one import should be emitted in the Wasm file.

Fixes https://bugs.llvm.org/show_bug.cgi?id=50938

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D105519

3 years ago[lld/mac] Add test for --lto-O
Leonard Grey [Mon, 19 Jul 2021 20:44:15 +0000 (16:44 -0400)]
[lld/mac] Add test for --lto-O

This belongs to fe08e9c4871, I (thakis) forgot to `git add` it back then.

Differential Revision: https://reviews.llvm.org/D105223

3 years ago[mlir] Add software pipelining transformation for scf.For op
thomasraoux [Tue, 13 Jul 2021 03:49:21 +0000 (20:49 -0700)]
[mlir] Add software pipelining transformation for scf.For op

This is the first step to support software pipeline for scf.for loops.
This is only the transformation to create pipelined kernel and
prologue/epilogue.
The scheduling needs to be given by user as  many different algorithm
and heuristic could be applied.
This currently doesn't handle loop arguments, this will be added in a
follow up patch.

Differential Revision: https://reviews.llvm.org/D105868

3 years ago[lld/mac] Resolve defined symbols before undefined symbols
Nico Weber [Mon, 19 Jul 2021 18:38:15 +0000 (14:38 -0400)]
[lld/mac] Resolve defined symbols before undefined symbols

Ports https://reviews.llvm.org/D95985 to the MachO port.
Happens to fix PR51135; see that bug for details.
Also makes lld's behavior match ld64 for the included test case.

Differential Revision: https://reviews.llvm.org/D106293

3 years ago[clang-format] Break an unwrapped line at a K&R C parameter decl
owenca [Thu, 15 Jul 2021 23:16:49 +0000 (16:16 -0700)]
[clang-format] Break an unwrapped line at a K&R C parameter decl

Break an unwrapped line before the first parameter declaration in a
K&R C function definition.

This fixes PR51074.

Differential Revision: https://reviews.llvm.org/D106112

3 years ago[demangler] Fix demangling of 'half'
Stuart Brady [Mon, 7 Jun 2021 15:30:22 +0000 (16:30 +0100)]
[demangler] Fix demangling of 'half'

Demangle 'Dh' as 'half' (as per GCC), and not 'decimal16' (which doesn't
make sense, as there is no IEEE 754 decimal16 format).

The Itanium C++ ABI specification describes 'Dh' as:
> IEEE 754r half-precision floating point (16 bits)

(https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-builtin)

Reviewed By: ldionne, jyknight

Differential Revision: https://reviews.llvm.org/D103833

3 years ago[LangRef] Clarify support for multiple metadata attachments with same id
Teresa Johnson [Mon, 19 Jul 2021 19:35:45 +0000 (12:35 -0700)]
[LangRef] Clarify support for multiple metadata attachments with same id

As discussed on D105251, currently the compiler does not support
multiple metadata attachments on instructions having the same
identifier, whereas it does for global objects. Note this in the
Language Reference manual for clarity.

See D105251 for discussions of history behind this divergence, and the
complexities and possible approaches of adding this support to
instructions in the future.

Differential Revision: https://reviews.llvm.org/D106304

3 years ago[AMDGPU] Reserve AMDGPU ELF e_flags machine 0x45
Tony Tye [Mon, 19 Jul 2021 02:21:11 +0000 (02:21 +0000)]
[AMDGPU] Reserve AMDGPU ELF e_flags machine 0x45

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D106249

3 years ago[mlir][Linalg] NFC: Rename FusionOfTensors pass to FusionOfElementwiseOps pass.
MaheshRavishankar [Mon, 19 Jul 2021 19:50:30 +0000 (12:50 -0700)]
[mlir][Linalg] NFC: Rename FusionOfTensors pass to FusionOfElementwiseOps pass.

This makes it more explicit what the scope of this pass is. The name
of this pass predates fusion on tensors using tile + fuse, and hence
the confusion.

Differential Revision: https://reviews.llvm.org/D106132

3 years ago[gn build] Port 54902e00d128
LLVM GN Syncbot [Mon, 19 Jul 2021 19:24:16 +0000 (19:24 +0000)]
[gn build] Port 54902e00d128

3 years ago[InstrProfiling] Use weak alias for bias variable
Petr Hosek [Thu, 8 Jul 2021 20:44:05 +0000 (13:44 -0700)]
[InstrProfiling] Use weak alias for bias variable

We need the compiler generated variable to override the weak symbol of
the same name inside the profile runtime, but using LinkOnceODRLinkage
results in weak symbol being emitted in which case the symbol selected
by the linker is going to depend on the order of inputs which can be
fragile.

This change replaces the use of weak definition inside the runtime with
a weak alias. We place the compiler generated symbol inside a COMDAT
group so dead definition can be garbage collected by the linker.

We also disable the use of runtime counter relocation on Darwin since
Mach-O doesn't support weak external references, but Darwin already uses
a different continous mode that relies on overmapping so runtime counter
relocation isn't needed there.

Differential Revision: https://reviews.llvm.org/D105176

3 years ago[infer-address-spaces] Handle complex non-pointer constexpr arguments.
Artem Belevich [Thu, 15 Jul 2021 20:39:47 +0000 (13:39 -0700)]
[infer-address-spaces] Handle complex non-pointer constexpr arguments.

Fixes https://bugs.llvm.org/show_bug.cgi?id=51099

Differential Revision: https://reviews.llvm.org/D106098

3 years ago[SLP][X86] Add dot product tests based off PR51075
Simon Pilgrim [Mon, 19 Jul 2021 18:28:42 +0000 (19:28 +0100)]
[SLP][X86] Add dot product tests based off PR51075

3 years ago[lld/mac] Change load command order to be more like ld64
Nico Weber [Sat, 17 Jul 2021 15:18:48 +0000 (11:18 -0400)]
[lld/mac] Change load command order to be more like ld64

No meaningful behavior change. Makes diffing `otool -l` output a bit easier.

Differential Revision: https://reviews.llvm.org/D106219

3 years ago[ifs] Fix linking errors on some llvm builders
Haowei Wu [Mon, 19 Jul 2021 18:59:04 +0000 (11:59 -0700)]
[ifs] Fix linking errors on some llvm builders

This change fixes linking errors on some llvm builders.

3 years ago[MemCpyOpt] Enable memcpy optimizations unconditionally.
Artem Belevich [Wed, 30 Jun 2021 22:36:14 +0000 (15:36 -0700)]
[MemCpyOpt] Enable memcpy optimizations unconditionally.

The patch does not depend on the availability of the library functions for
memcpy/memset as it operates on LLVM intrinsics.  The optimizations are useful
on the targets that have these functions disabled (e.g. NVPTX & AMDGPU).

Differential Revision: https://reviews.llvm.org/D104801

3 years ago[Bazel] Update for 6103fdfab4
Geoffrey Martin-Noble [Mon, 19 Jul 2021 18:48:52 +0000 (11:48 -0700)]
[Bazel] Update for 6103fdfab4

Update Bazel config for
https://github.com/llvm/llvm-project/commit/6103fdfab4
by deleting the llvm-elfabi target.

Differential Revision: https://reviews.llvm.org/D106295

3 years ago[Sanitizer] Intercepts flopen/flopenat on FreeBSD.
David Carlier [Mon, 19 Jul 2021 18:46:35 +0000 (19:46 +0100)]
[Sanitizer] Intercepts flopen/flopenat on FreeBSD.

Reviewers: vitalybuka

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D106218

3 years ago[libc++] Disable #pragma system_header in the new testing configuration
Louis Dionne [Mon, 19 Jul 2021 15:23:09 +0000 (11:23 -0400)]
[libc++] Disable #pragma system_header in the new testing configuration

The new testing configuration did not turn off #pragma system_header,
which means we were not seeing warnings in system headers.

Differential Revision: https://reviews.llvm.org/D106187

3 years ago[gn build] Port 8b4acb067fd3
LLVM GN Syncbot [Mon, 19 Jul 2021 18:24:11 +0000 (18:24 +0000)]
[gn build] Port 8b4acb067fd3

3 years ago[gn build] Port 61fa9afe4c5b
LLVM GN Syncbot [Mon, 19 Jul 2021 18:24:10 +0000 (18:24 +0000)]
[gn build] Port 61fa9afe4c5b

3 years ago[gn build] Port 6103fdfab4e2
LLVM GN Syncbot [Mon, 19 Jul 2021 18:24:09 +0000 (18:24 +0000)]
[gn build] Port 6103fdfab4e2

3 years ago[ifs][elfabi] Merge llvm-ifs/elfabi tools
Haowei Wu [Fri, 2 Apr 2021 03:55:11 +0000 (20:55 -0700)]
[ifs][elfabi] Merge llvm-ifs/elfabi tools

This change merges llvm-elfabi and llvm-ifs tools.

Differential Revision: https://reviews.llvm.org/D100139

3 years ago[ifs] Prepare llvm-ifs for elfabi/ifs merging.
Haowei Wu [Wed, 7 Apr 2021 22:50:12 +0000 (15:50 -0700)]
[ifs] Prepare llvm-ifs for elfabi/ifs merging.

This diff changes llvm-ifs to use unified IFS file format
and perform other renaming changes in preparation for the
merging between elfabi/ifs.

Differential Revision: https://reviews.llvm.org/D99810

3 years ago[elfabi] Prepare elfabi/ifs merging.
Haowei Wu [Wed, 31 Mar 2021 23:48:56 +0000 (16:48 -0700)]
[elfabi] Prepare elfabi/ifs merging.

This change implements unified text stub format and command line
interface proposed in the elfabi/ifs merge plan.

Differential Revision: https://reviews.llvm.org/D99399

3 years ago[SystemZ] Handle NoRegister in SystemZTargetLowering::emitMemMemWrapper().
Jonas Paulsson [Fri, 16 Jul 2021 09:23:46 +0000 (11:23 +0200)]
[SystemZ]  Handle NoRegister in SystemZTargetLowering::emitMemMemWrapper().

Bugfix: The compiler should be able to generate a memset to nullptr.

Review: Ulrich Weigand

3 years agoRevert "[llvm][sve] Lowering for VLS truncating stores" because it
Amy Huang [Mon, 19 Jul 2021 17:42:28 +0000 (10:42 -0700)]
Revert "[llvm][sve] Lowering for VLS truncating stores" because it
causes a seg fault (see https://reviews.llvm.org/D104471).

This reverts commit c305557acdaad453e32309d575fe9c6c7090c099.