platform/upstream/llvm.git
18 months ago[DWARFLibrary] Add support to re-construct cu-index
Alexander Yermolovich [Tue, 10 Jan 2023 23:14:47 +0000 (15:14 -0800)]
[DWARFLibrary] Add support to re-construct cu-index

According to DWARF5 specification and gnu specification for DWARF4 the offset
entry in the CU/TU Index is 32 bits. This presents a problem when
.debug_info.dwo in DWP file grows beyond 4GB. The CU Index becomes partially
corrupted.

This diff adds manual parsing of .debug_info.dwo/.debug_abbrev.dwo to
reconstruct CU index in general, and TU index for DWARF5. This is a work around
until DWARF6 spec is finalized.

Next patch will change internal CU/TU struct to 64 bit, and change uses as
necessary. The plan is to land all the patches in one go after all are approved.

This patch originates from the discussion in: https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902

Reviewed By: dblaikie

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

18 months ago[AsmWriter] Don't crash when printing addrspace and the operand is null
Vasileios Porpodas [Mon, 9 Jan 2023 23:18:55 +0000 (15:18 -0800)]
[AsmWriter] Don't crash when printing addrspace and the operand is null

This helps print instructions with detached operands in the debugger.

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

18 months ago[gn build] Remove --rtlib=libgcc for Android builds
Arthur Eubanks [Tue, 10 Jan 2023 23:12:03 +0000 (15:12 -0800)]
[gn build] Remove --rtlib=libgcc for Android builds

Recent Android NDKs don't ship with libgcc

18 months ago[OpenMP] Avoid running openmp-opt on dead functions
Johannes Doerfert [Tue, 10 Jan 2023 21:51:28 +0000 (13:51 -0800)]
[OpenMP] Avoid running openmp-opt on dead functions

The Attributor has logic to run only on assumed live functions and this
is exposed to users now. OpenMP-opt will (mostly) ignore dead internal
functions now but run the same deduction as before if an internal
function is marked live.

This should lower compile time as we run on less code and delete more
code early on. For the full OpenMC module compiled with noinline and
JITed at runtime, we save ~25%, or ~10s on my machine during JITing.

18 months ago[OpenMP] Ensure AAHeapToShared is only looking at one function
Johannes Doerfert [Tue, 10 Jan 2023 22:01:00 +0000 (14:01 -0800)]
[OpenMP] Ensure AAHeapToShared is only looking at one function

When we collect and process allocations we did not verify the call
against the anchor scope / associated function. This should be done to
avoid processing calls multiple times and generally looking at calls not
in the AAs scope.

18 months ago[OpenMP] Disable ICV deduction by default.
Johannes Doerfert [Tue, 10 Jan 2023 21:55:06 +0000 (13:55 -0800)]
[OpenMP] Disable ICV deduction by default.

This is not tested well and needs to be revisited in the future.

18 months ago[test] Use -verify-cfg-preserved=0 in new-pass-manager.ll
Arthur Eubanks [Tue, 10 Jan 2023 22:55:12 +0000 (14:55 -0800)]
[test] Use -verify-cfg-preserved=0 in new-pass-manager.ll

This matches other tests and makes this test less sensitive

18 months agoRevert "[perf-training] Check extension in findFilesWithExtension"
Amir Aupov [Tue, 10 Jan 2023 22:21:39 +0000 (14:21 -0800)]
Revert "[perf-training] Check extension in findFilesWithExtension"

This reverts commit 1fbbf92e4fda3c7a3be1c02e1f7240135557846d.

18 months ago[Attributor] Improve use of dominating writes during reasoning
Johannes Doerfert [Wed, 14 Dec 2022 01:51:21 +0000 (17:51 -0800)]
[Attributor] Improve use of dominating writes during reasoning

This resolves a recent regression introduced by a bug fix and allows us
to use dominating write information (formerly HasBeenWrittenTo
information) to skip potential interfering accesses.

Generally, there are two changes here:
1) If we have dominating writes they form a chain and we can look at the
   least one to minimize the distance between the write and the (read)
   access in question.
2) If such a least dominating write exists, we can ignore writes in
   other functions as long as they cannot be reached from code between
   this write and the (read) access in question.

We have all the tools available to make such queries and the positive
tests show the result. Note that the negative test from the bug fix is
still in tree and not affected.

As a side-effect, we can remove the (arbitrary) treshold now on the
number of interfering accesses since we do not iterate over dominating
ones anymore.

18 months ago[libc][NFC] Remove the now unused WrapperGen tool and tests.
Siva Chandra Reddy [Tue, 10 Jan 2023 22:06:38 +0000 (22:06 +0000)]
[libc][NFC] Remove the now unused WrapperGen tool and tests.

18 months ago[mlir][tosa] Remove redundant "tosa.transpose" operations
Aviad Cohen [Tue, 10 Jan 2023 20:35:50 +0000 (12:35 -0800)]
[mlir][tosa] Remove redundant "tosa.transpose" operations

We can fold redundant Tosa::TransposeOp actions like identity tranpose/transpose(traspose).

Reviewed By: rsuderman

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

18 months ago[Sanitizer][Apple] Enable sanitizer common unittests for arm64 archs on Apple
Blue Gaston [Sat, 7 Jan 2023 00:26:54 +0000 (17:26 -0700)]
[Sanitizer][Apple] Enable sanitizer common unittests for arm64 archs on Apple

This patch enables sanitizer common unit tests for arm64 architecture only on apple devices.

It also lowers the expected compression ratio for 64 bit machines. Unsure of justification of 130. On apple arm64 we're seeing this number comeout to 128.6

rdar://101436019

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

18 months ago[mlir][Index] Add index.mins and index.minu
Krzysztof Drewniak [Mon, 9 Jan 2023 17:05:54 +0000 (17:05 +0000)]
[mlir][Index] Add index.mins and index.minu

Signed and unsigned minimum operations were missing from the Index
dialect and are needed to test integer range inference.

Reviewed By: Mogball

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

18 months ago[mlir][Arith] Fix bug in zero-extension range inference
Krzysztof Drewniak [Mon, 9 Jan 2023 16:58:24 +0000 (16:58 +0000)]
[mlir][Arith] Fix bug in zero-extension range inference

D135089 extracted the extui code into a helper, but used fromSigned
instead of fromUnsigned.

Reviewed By: Mogball, ThomasRaoux

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

18 months ago[RISCV] Add test coverage for TSO AMOs [nfc]
Philip Reames [Tue, 10 Jan 2023 20:20:50 +0000 (12:20 -0800)]
[RISCV] Add test coverage for TSO AMOs [nfc]

18 months ago[mlir][tosa] Add uint16 to TOSA type support
Rob Suderman [Tue, 10 Jan 2023 19:40:45 +0000 (11:40 -0800)]
[mlir][tosa] Add uint16 to TOSA type support

UInt16 is included as a required TOSA type for basic
operations. Added support as a TOSA Tensor.

Reviewed By: NatashaKnk

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

18 months ago[DAGCombine] fold (sext (sext_inreg x)) -> (sext (trunc x))
Amaury Séchet [Wed, 4 Jan 2023 15:17:35 +0000 (15:17 +0000)]
[DAGCombine] fold (sext (sext_inreg x)) -> (sext (trunc x))

This fixes a regression introduced by D127115 in test/CodeGen/PowerPC/store-forward-be64.ll

Reviewed By: RKSimon

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

18 months agoFix math.cbrt with vector and f16 arguments.
Johannes Reifferscheid [Tue, 10 Jan 2023 20:15:49 +0000 (21:15 +0100)]
Fix math.cbrt with vector and f16 arguments.

Reviewed By: bkramer

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

18 months agoReapply "[Attributor] Introduce AA[Intra/Inter]Reachability"
Johannes Doerfert [Sat, 17 Dec 2022 23:16:41 +0000 (15:16 -0800)]
Reapply "[Attributor] Introduce AA[Intra/Inter]Reachability"

This reverts commit e425a4c45618fcfa8ffb13be4ddfaa5d28aa38f1 after the
memory leak has been fixed.

18 months ago[libc++][utils] Remove unused import in `run.py`
Joe Loser [Mon, 9 Jan 2023 23:51:26 +0000 (16:51 -0700)]
[libc++][utils] Remove unused import in `run.py`

`import sys` is unused in `libcxx/utils/run.py`: remove it.

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

18 months ago[libc++] Remove warning for `LIBCXX_SYSROOT`, `LIBCXX_TARGET_TRIPLE`, and `LIBCXX_GCC...
Joe Loser [Tue, 10 Jan 2023 03:13:44 +0000 (20:13 -0700)]
[libc++] Remove warning for `LIBCXX_SYSROOT`, `LIBCXX_TARGET_TRIPLE`, and `LIBCXX_GCC_TOOLCHAIN`

Support for these CMake variables has been a warning for a while now.  The
comment indicates to just remove the warning message entirely as anyone impacted
had to have update to new mechanisms in order to use `libc++`.  So, remove the
warning message.

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

18 months ago[llvm][ADT] Add deduction guides for `MutableArrayRef`
Joe Loser [Mon, 9 Jan 2023 22:37:11 +0000 (15:37 -0700)]
[llvm][ADT] Add deduction guides for `MutableArrayRef`

Similar to https://reviews.llvm.org/D140896, this adds deduction guides for the
counterpart of `ArrayRef`: `MutableArrayRef`.  The update plan is the following:

1) Add deduction guides for `MutableArrayRef`.
2) Change uses in-tree from `makeMutableArrayRef` to use deduction guides
3) Mark `makeMutableArrayRef` as deprecated for some time before removing to
   give downstream users time to update.

The deduction guides are similar to those provided by the `makeMutableArrayRef`
function templates, except we don't need one explicitly from `MutableArrayRef`.

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

18 months agobuild: with -DCLANGD_ENABLE_REMOTE=ON, search for grpc++ dependencies too
Sylvestre Ledru [Thu, 5 Jan 2023 14:16:10 +0000 (15:16 +0100)]
build: with -DCLANGD_ENABLE_REMOTE=ON, search for grpc++ dependencies too

Fixes: https://github.com/llvm/llvm-project/issues/59844

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

18 months ago[flang] Load unlimited polymorphic box the same way as other
Valentin Clement [Tue, 10 Jan 2023 19:57:39 +0000 (20:57 +0100)]
[flang] Load unlimited polymorphic box the same way as other

Unlimited polymorphic descriptor have a set size and can be loaded the
same way as polymorphic or monomorphic descriptors. The descriptor
code gen as been set in D138587.
Of course, the data hold by those descriptors have an unknown size
at compile time.

Depends on D141383

Reviewed By: jeanPerier, PeteSteinfeld

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

18 months ago[perf-training] Check extension in findFilesWithExtension
Amir Ayupov [Tue, 10 Jan 2023 02:07:26 +0000 (18:07 -0800)]
[perf-training] Check extension in findFilesWithExtension

`findFilesWithExtension` helper checks for `endswith(extension)` instead of
exactly matching the file extension. This causes it to match unrelated files,
for example, `.profdata` files while matching `.fdata` files:

http://157.230.108.44:8011/#/builders/56/builds/247
```
Merging data from /worker/worker/bolt-x86_64-ubuntu-clang-bolt-gcc/build/tools/clang/prof.fdata.1124569.fdata...
Merging data from /worker/worker/bolt-x86_64-ubuntu-clang-bolt-gcc/build/tools/clang/test/Frontend/Output/optimization-remark-with-hotness-new-pm.c.tmp.profdata...
```

Reviewed By: phosek

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

18 months agoAMDGPU/GlobalISel: Widen s1 SGPR constants during regbankselect
Matt Arsenault [Tue, 27 Dec 2022 15:37:52 +0000 (10:37 -0500)]
AMDGPU/GlobalISel: Widen s1 SGPR constants during regbankselect

To unambiguously interpret these as 32-bit SGPRs, we need to widen
these to s32. This was selecting to a copy from a 64-bit SGPR to a
32-bit SGPR for wave64.

18 months agoclang: Fix handling of __builtin_elementwise_copysign
Matt Arsenault [Fri, 23 Dec 2022 18:11:28 +0000 (13:11 -0500)]
clang: Fix handling of __builtin_elementwise_copysign

I realized the handling of copysign made no sense at all.
Only the type of the first operand should really matter, and
it should not perform a conversion between them.

Also fixes misleading errors and producing broken IR for
integers.

We could accept different FP types for the sign argument,
if the intrinsic permitted different types like the DAG node.
As it is we would need to insert a cast, which could have
other effects (like trapping on snan) which should not happen
for a copysign.

18 months ago[CallGraph][FIX] Ensure generic intrinsics are represented in the CG
Johannes Doerfert [Sat, 7 Jan 2023 09:00:14 +0000 (01:00 -0800)]
[CallGraph][FIX] Ensure generic intrinsics are represented in the CG

Intrinsics have historically been excluded from the call graph with an
exception of 3 special ones added at some point. This meant that passes
depending on the call graph needed to handle intrinsics explicitly as
the underlying assumption, namely that intrinsics can't call or modify
things, doesn't hold. We are slowly moving away from special handling of
intrinsics, or at least towards explicitly checking what intrinsics we
want to handle differently.

This patch:
 - Includes most intrinsics in the call graph. Debug intrinsics are
   still excluded.
 - Removes the special handling of intrinsics in the GlobalsAA pass.
 - Removes the `IntrinsicInst::isLeaf` method.

Properly
Fixes: https://github.com/llvm/llvm-project/issues/52706

See also:
https://discourse.llvm.org/t/intrinsics-are-not-special-stop-pretending-i-mean-it/67545

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

18 months ago[lldb] Remove tools copied into LLDB.framework before install
Jonas Devlieghere [Tue, 10 Jan 2023 19:21:09 +0000 (11:21 -0800)]
[lldb] Remove tools copied into LLDB.framework before install

CMake supports building Framework bundles for Apple platforms. We rely
on this functionality to create LLDB.framework. From CMake's
perspective, a framework is associated with a single target. In reality,
this is often not the case. In addition to a main library (liblldb) the
frameworks often contains associated resources that are their own CMake
targets, such as debugserver and lldb-argdumper.

When building and using the framework to run the test suite, those
binaries are expected to be in LLDB.framework. We have a function
(lldb_add_to_buildtree_lldb_framework) that copies those targets into
the framework.

When CMake installs a framework, it copies over the content of the
framework directory and "installs" the associated target. In addition to
copying the target, installing also means updating the RPATH. However,
the RPATH is only updated for the target associated with the framework.
Everything else is naively copied over, including executables or
libraries that have a different build and install RPATH. This means that
those tools need to have their own install rules.

If the framework is installed first, the aforementioned tools are copied
over with build RPATHs from the build tree. And when the tools
themselves are installed, the binaries get overwritten and the RPATHs
updated to the install RPATHs.

The problem is that CMake provides no guarantees when it comes to the
order in which components get installed. If those tools get installed
first, the inverse happens and the binaries get overwritten with the
ones that have build RPATHs.

lldb_add_to_buildtree_lldb_framework has a comment correctly stating
that those copied binaries should be removed before install. This patch
adds a custom target (lldb-framework-cleanup) that will be run before
the install phase and remove those files from LLDB.framework in the
build tree.

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

18 months ago[libc++][test] Silence allocator conversion warnings
Casey Carter [Mon, 9 Jan 2023 22:54:44 +0000 (14:54 -0800)]
[libc++][test] Silence allocator conversion warnings

... by accepting `std::size_t` instead of `int` in `allocate` and `deallocate` functions.

Drive-by: To conform to the allocator requirements, the `Allocator` types in these tests need to have (1) converting constructors and (2) cross-specialization `==` that returns `true` at least for copies of the same allocator.
Differential Revision: https://reviews.llvm.org/D141334

18 months ago[AMDGPU] Fix big endian bots after 7c327c2
Nemanja Ivanovic [Tue, 10 Jan 2023 19:12:54 +0000 (13:12 -0600)]
[AMDGPU] Fix big endian bots after 7c327c2

The pass that this test case is testing has host-endianness
dependencies. This fixes the pertinent one causing failures
on BE bots.

18 months agoAMDGPU: Don't assert on printf of half
Matt Arsenault [Sat, 7 Jan 2023 00:02:10 +0000 (19:02 -0500)]
AMDGPU: Don't assert on printf of half

The comment says fields should be 4-byte aligned, so just pass through
after conversion to integer. The conformance test lacks any testing of
half.

18 months agoLangRef: Add !associated to list of preserved global metadata
Matt Arsenault [Mon, 9 Jan 2023 20:03:31 +0000 (15:03 -0500)]
LangRef: Add !associated to list of preserved global metadata

18 months agoAMDGPU: Fix opaque pointer and other bugs in printf of constant strings
Matt Arsenault [Fri, 6 Jan 2023 19:02:24 +0000 (14:02 -0500)]
AMDGPU: Fix opaque pointer and other bugs in printf of constant strings

Strip pointer casts to get to the global. Fixes not respecting indexed
constant strings. Tolerate non-null terminated and empty strings.

18 months ago[llvm][dwwarf] Change CU/TU index to 64-bit
Alexander Yermolovich [Tue, 10 Jan 2023 18:33:23 +0000 (10:33 -0800)]
[llvm][dwwarf] Change CU/TU index to 64-bit

Changed contribution data structure to 64 bit. I added the 32bit and 64bit
accessors to make it explicit where we use 32bit and where we use 64bit. Also to
make sure sure we catch all the cases where this data structure is used.

Reviewed By: dblaikie

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

18 months agotsan: fix a race when assigning ThreadSignalContext
Peter Ammon [Tue, 10 Jan 2023 18:21:41 +0000 (19:21 +0100)]
tsan: fix a race when assigning ThreadSignalContext

The SigCtx function lazily allocates a ThreadSignalContext, and stores it
in the ThreadState. This function may be called by various interceptors and
the signal handler itself.

If SigCtx itself is interrupted by a signal, then (prior to this fix) there
was a possibility of allocating two ThreadSignalContexts. This not only
leaks, it fails to deliver the signal to the program's signal handler, as
the recorded signal is overwritten by the new ThreadSignalContext.

Fix this by using a CAS to swap in the ThreadSignalContext, preventing the
race. Add a test for this case.

Reviewed By: dvyukov, melver

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

18 months ago[GWP-ASan] Fix up bad report for in-page underflow w/ UaF
Mitch Phillips [Tue, 10 Jan 2023 18:29:49 +0000 (10:29 -0800)]
[GWP-ASan] Fix up bad report for in-page underflow w/ UaF

Complex scenario, but reports when there's both a use-after-free and
buffer-underflow that is in-page (i.e. doesn't touch the guard page)
ended up generating a pretty bad report:

'Use After Free at 0x7ff392e88fef (18446744073709551615 bytes into a
1-byte allocation at 0x7ff392e88ff0) by thread 3836722 here:'

(note the 2^64-bytes-into-alloc, very cool and good!)

Fix up that case, and add a diagnostic about when you have both a
use-after-free and a buffer-overflow that it's probably a bogus report
(assuming the developer didn't *really* screw up and have a uaf+overflow
bug at the same time).

Reviewed By: vitalybuka

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

18 months ago[GWP-ASan] Fix atfork handlers being installed multiple times in tests
Mitch Phillips [Tue, 10 Jan 2023 18:16:03 +0000 (10:16 -0800)]
[GWP-ASan] Fix atfork handlers being installed multiple times in tests

We incorrectly install the atfork handlers multiple times in the test
harness, tracked down to the default parameter used by
CheckLateInitIsOK. This manifested in a hang if running the tests with
--gtest_repeat={>=2} as the atfork handler ran multiple times, causing
double-lock and double-unlock, which on my machine hung.

Add a check-fail for this case as well to prevent this from happening
again (it was difficult to track down and is an easy mistake to make).

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

18 months ago[SLP] Do not ignore ordering for root node when it has in-tree uses.
Valery N Dmitriev [Sat, 7 Jan 2023 03:42:13 +0000 (19:42 -0800)]
[SLP] Do not ignore ordering for root node when it has in-tree uses.

When rooted with PHIs, a vectorization tree may have another node with PHIs
which have roots as their operands. We cannot ignore ordering information
for root in such a case.

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

18 months ago[RISCV] Avoid emitting hardware fences for singlethread fences
Philip Reames [Tue, 10 Jan 2023 17:51:56 +0000 (09:51 -0800)]
[RISCV] Avoid emitting hardware fences for singlethread fences

singlethread fences only synchronize with code running on the same hardware thread (i.e. signal handlers). Because of this, we need to prevent instruction reordering, but do not need to emit hardware fence instructions.

The implementation strategy here matches many other backends. The main motivation of this patch is to introduce the MEMBARRIER node and get some test coverage for it.

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

18 months agoAMDGPU: Don't insert ptrtoint for printf lowering
Matt Arsenault [Fri, 6 Jan 2023 23:34:41 +0000 (18:34 -0500)]
AMDGPU: Don't insert ptrtoint for printf lowering

18 months agoAMDGPU: Stop trying to specially handle vector stores in printf lowering
Matt Arsenault [Fri, 6 Jan 2023 23:23:53 +0000 (18:23 -0500)]
AMDGPU: Stop trying to specially handle vector stores in printf lowering

This was broken for 1 element vectors and trying to create invalid
casts. We can directly store any type just fine, so don't bother with
this buggy conversion logic.

18 months agoclang/AMDGPU: Add missing tests for some builtin
Matt Arsenault [Sat, 7 Jan 2023 21:11:42 +0000 (16:11 -0500)]
clang/AMDGPU: Add missing tests for some builtin

These were tested under opencl but need hip testing for the potential
addrspacecasts.

18 months agoAMDGPU: Move intrinsic definition point
Matt Arsenault [Sat, 7 Jan 2023 13:39:15 +0000 (08:39 -0500)]
AMDGPU: Move intrinsic definition point

This was incorrectly listed under the block for backend internal
intrinsics only.

18 months agoAMDGPU: Set some more attributes on intrinsics
Matt Arsenault [Sat, 7 Jan 2023 13:28:17 +0000 (08:28 -0500)]
AMDGPU: Set some more attributes on intrinsics

18 months ago[WebAssembly][LiveDebugValues] Handle target index defs
Heejin Ahn [Sun, 18 Dec 2022 00:33:22 +0000 (16:33 -0800)]
[WebAssembly][LiveDebugValues] Handle target index defs

This adds the missing handling for defs for target index operands, as is
already done for registers.

There are two kinds of target indices: local indices and stack operands.

- Locals are something similar to registers in Wasm-land. For local
  indices, we can check for local-defining instructions (`local.set` or
  `local.tee`).

- Wasm is a stack machine, so we have values in certain Wasm value stack
  location, which change when Wasm instructions produce or consume
  values. So basically any value-producing instrucion, i.e., instruction
  with defs, can change values in the Wasm stack. But I think we don't
  need to worry about this here, because `WebAssemblyDebugFixup`, which
  runs right before this analysis, makes sure to insert terminating
  `DBG_VALUE $noreg` instructions whenever a stack value gets popped.
  After `WebAssemblyDebugFixup`, there shouldn't be any `DBG_VALUE`s for
  stack operands that don't have a terminating `DBG_VALUE $noreg` within
  the same BB.

So this CL only works on `DBG_VALUE`s for locals. When we encounter a
`local.set` or `local.tee` instructions, we delete `DBG_VALUE`s for
those target index locations from the open range set, so they will not
be availble in `OutLocs`. For example,
```
bb.0:
  successors: %bb.1
  DBG_VALUE target-index(wasm-local) + 2, $noreg, "var", ...
  ...
  local.set 2 ...

bb.1:
; predecessors: %bb.0
  ; We shouldn't add `DBG_VALUE target (wasm-local) + 2 here because
  ; it was killed by 'local.set' in bb.0
```

After disabling register coalescing at -O1, the average PC ranges
covered for Emscripten core benchmarks is currently 20.6% in the LLVM
tot. After applying D138943 and this CL, the coverage goes up to 57%.
This also enables LiveDebugValues analysis in the Wasm pipeline by
default.

Reviewed By: dschuff, jmorse

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

18 months ago[WebAssembly] Use LiveDebugValues analysis
Heejin Ahn [Wed, 21 Sep 2022 21:48:34 +0000 (14:48 -0700)]
[WebAssembly] Use LiveDebugValues analysis

This enables `LiveDebugValues` analysis for Wasm. `DBG_VALUE`s expire at
the end of a BB, and this is the analysis extends their lifetime when
possible, greatly increasing the coverage of variable debug info.

Specifically, this removes the current constraint that this analysis is
only used with physical registers, which was first introduced in D18421,
because Wasm uses only virtual registers. I don't think there's anything
inherent in this analysis that only applies to physical registers; it
was just because all targets using this analysis ran this at the end of
their compiliation pipeline, at which point all their vregs had been
allocated, and Wasm's debug info infrastructure was not really set up
yet, so it was not using it.

This adds supports to Wasm-specific target-index operands, defined in
https://github.com/llvm/llvm-project/blob/2166d9529a60d1cdedb733d2e4134c971f0969ec/llvm/lib/Target/WebAssembly/WebAssembly.h#L87-L100.
Among these, `TI_LOCAL`, `TI_LOCAL_INDIRECT`, and `TI_OPERAND_STACK` are
used by Wasm `DBG_VALUE` instructions.

This does not yet handle mutable target indices, i.e., this does not
terminate a `DBG_VALUE` for a local index when we encounter a new
`local.set` or `local.tee`. It will be implemented as a follow-up.

Reviewed By: dschuff, jmorse

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

18 months ago[NFC][libc++][test] Improves code reuse.
Mark de Wever [Sat, 24 Dec 2022 12:33:21 +0000 (13:33 +0100)]
[NFC][libc++][test] Improves code reuse.

This applies D140115 to the new tuple tests.

Reviewed By: #libc, ldionne

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

18 months ago[NFC] [clang-tools-extra] Alphabetize clang-tidy release notes
Chris Cotter [Tue, 10 Jan 2023 17:37:05 +0000 (17:37 +0000)]
[NFC] [clang-tools-extra] Alphabetize clang-tidy release notes

Alphabetize order of clang-tidy release notes, and fix `:doc:` link.

Reviewed By: Eugene.Zelenko

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

18 months ago[HWASAN] Added empty WordIsPoisoned for LSAN support.
Kirill Stoimenov [Tue, 10 Jan 2023 16:57:38 +0000 (16:57 +0000)]
[HWASAN] Added empty WordIsPoisoned for LSAN support.

Currently it is just an empty implementation to allow the project to link.

Reviewed By: vitalybuka

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

18 months ago[XCOFF] Fix the offset error of dwarf sections caused by D137819.
esmeyi [Tue, 10 Jan 2023 17:32:13 +0000 (12:32 -0500)]
[XCOFF] Fix the offset error of dwarf sections caused by D137819.

18 months ago[DAGCombiner] Fix issue with rot chain pattern
chenglin.bi [Tue, 10 Jan 2023 17:28:43 +0000 (01:28 +0800)]
[DAGCombiner] Fix issue with rot chain pattern

faa35fc87370 fix the case of negative input shift. But when `c1`, `c2` is not the same side, it will also cause negative shift amount.
And that negative shift amount can't normalize by urem. So add one more bit size to normalize the last shift amount.

Fix: https://github.com/llvm/llvm-project/issues/59898

Reviewed By: RKSimon

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

18 months agoRevert "[LSR] Hoist IVInc to loop header if its all uses are in the loop header"
chenglin.bi [Tue, 10 Jan 2023 17:24:34 +0000 (01:24 +0800)]
Revert "[LSR] Hoist IVInc to loop header if its all uses are in the loop header"
The original commit seems to cause a regression in numba test.
This reverts commit b1b4758e7f4b2ffe1faa28b00eb037832e5d26a7.

18 months ago[llvm] Declare llvm::makeArrayRef as obsolete
serge-sans-paille [Tue, 10 Jan 2023 10:49:15 +0000 (11:49 +0100)]
[llvm] Declare llvm::makeArrayRef as obsolete

Also cleans up a few remaining references.

This is the final commit for the series started by
https://reviews.llvm.org/D140896

18 months ago[libc] Fix -Wimplicit-int-conversion warnings
Alex Brachet [Tue, 10 Jan 2023 16:41:28 +0000 (16:41 +0000)]
[libc] Fix -Wimplicit-int-conversion warnings

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

18 months ago[mlir][llvm] Improve error messages during LLVM IR import.
Tobias Gysi [Tue, 10 Jan 2023 16:13:33 +0000 (17:13 +0100)]
[mlir][llvm] Improve error messages during LLVM IR import.

Use the module location instead of unknown location if the imported
LLVM IR module does not have more precise debug information.
Additionally, use the diagMD function to print the metadata instead
of just the metadata kind if the import fails.

Reviewed By: definelicht

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

18 months ago[flang] Fix emboxing when input type is directly a record type
Valentin Clement [Tue, 10 Jan 2023 16:08:33 +0000 (17:08 +0100)]
[flang] Fix emboxing when input type is directly a record type

In some fir.embox cases as shown in the test, the type descriptor
was not correctly found and the descriptor was populated with a null in the
addendum. This patch fixes this issue.

Reviewed By: PeteSteinfeld

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

18 months ago[clang-tidy] Match derived types in in modernize-loop-convert
Chris Cotter [Tue, 10 Jan 2023 15:23:32 +0000 (15:23 +0000)]
[clang-tidy] Match derived types in in modernize-loop-convert

This patch allows clang-tidy to replace traditional for-loops where the
container type inherits its `begin`/`end` methods from a base class.

Test plan: Added unit test cases that confirm the tool replaces the new
pattern.

Reviewed By: carlosgalvezp

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

18 months ago[Verifier] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 10 Jan 2023 15:20:44 +0000 (16:20 +0100)]
[Verifier] Convert tests to opaque pointers (NFC)

Some tests are removed because they check conditions that
are not relevant with opaque pointers.

18 months ago[clang][dataflow] Fix 2 bugs in `MemberExpr` interpretation.
Yitzhak Mandelbaum [Mon, 9 Jan 2023 22:54:53 +0000 (22:54 +0000)]
[clang][dataflow] Fix 2 bugs in `MemberExpr` interpretation.

There were two (small) bugs causing crashes in the analysis.  This patch fixes both of them.

1. An enum value was accessed as a class member. Now, the engine gracefully
ignores such member expressions.

2. Field access in `MemberExpr` of struct/class-typed global variables. Analysis
didn't interpret fields of global vars, because the vars were initialized before
the fields were added to the "allowlist". Now, the allowlist is set _before_
init of globals.

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

18 months agoRemove a stale FIXME comment; NFC
Aaron Ballman [Tue, 10 Jan 2023 15:43:33 +0000 (10:43 -0500)]
Remove a stale FIXME comment; NFC

Also regenerates the AST matcher documentation. This matcher is tested
in TEST(HasImplicitDestinationType, MatchesSimpleCase) and
TEST(HasImplicitDestinationType, DoesNotMatchIncorrectly) in
ASTMatchersTraversalTest.cpp.

18 months agoReland: "[libc] Templatize str{,n}cmp"
Alex Brachet [Tue, 10 Jan 2023 15:37:58 +0000 (15:37 +0000)]
Reland: "[libc] Templatize str{,n}cmp"

This will be used to implement the case insensitive str{,n}casecmp

This was initially reverted because it broke tests on arm platforms.
Unfortunately, it didn't break on my arm machine, but I suspect the
problem was the old comparator returned char and not int.

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

18 months agoFix the documentation for the hasBody AST matcher
Aaron Ballman [Tue, 10 Jan 2023 15:38:07 +0000 (10:38 -0500)]
Fix the documentation for the hasBody AST matcher

The problem was whitespace between the comment and the code for the
matcher. Rather than fix the script, I went the easier route and
removed the offending newline. If this problem comes up again though,
we should consider making the script less fragile.

18 months ago[InstCombine] remove zext-of-icmp fold that may conflict with other folds
Sanjay Patel [Tue, 10 Jan 2023 14:54:54 +0000 (09:54 -0500)]
[InstCombine] remove zext-of-icmp fold that may conflict with other folds

This bit-hack transform would cause the new test to infinite loop
after 21d3871b7c90f85b3ae.

The deleted transform has existed for a very long time,
but the profitable parts appear to be handled by other
folds now. This fold could replace 2 instructions with
4 instructions, so it was always in danger of going
overboard.

No tests regress by removing the whole thing.

18 months ago[lld] Fix comment typos to cycle bots
Nico Weber [Tue, 10 Jan 2023 15:20:39 +0000 (10:20 -0500)]
[lld] Fix comment typos to cycle bots

18 months agoCorrect documentation for the hasBody() AST matcher; NFC
Aaron Ballman [Tue, 10 Jan 2023 14:53:19 +0000 (09:53 -0500)]
Correct documentation for the hasBody() AST matcher; NFC

Note, when regenerating the documentation for this change, no changes
were made to the HTML file. There is an existing bug with the AST
matcher python script that fails to handle hasBody() specifically. So
this commit is to correct the internal documentation but another change
will be needed to fix the public documentation.

18 months agoUpdate dump_ast_matchers.py to Python 3
Aaron Ballman [Tue, 10 Jan 2023 14:51:57 +0000 (09:51 -0500)]
Update dump_ast_matchers.py to Python 3

Also regenerates the documentation and fixed a validation diagnostic
about use of 'is' vs '=='.

18 months ago[mlir] Fix worklist bug in MultiOpPatternRewriteDriver
Matthias Springer [Tue, 10 Jan 2023 14:30:49 +0000 (15:30 +0100)]
[mlir] Fix worklist bug in MultiOpPatternRewriteDriver

When `strict = true`, only pre-existing and newly-created ops are rewritten and/or folded. Such ops are stored in `strictModeFilteredOps`.

Newly-created ops were previously added to `strictModeFilteredOps` after calling `addToWorklist` (via `GreedyPatternRewriteDriver::notifyOperationInserted`). Therefore, newly-created ops were never added to the worklist.

Also fix a test case that should have gone into an infinite loop (`test.replace_with_new_op` was replaced with itself, which should have caused the op to be rewritten over and over), but did not due to this bug.

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

18 months ago[clang][dataflow][NFC] Refine names and comments for field filtering.
Yitzhak Mandelbaum [Mon, 9 Jan 2023 20:13:16 +0000 (20:13 +0000)]
[clang][dataflow][NFC] Refine names and comments for field filtering.

Tweaks elements of the new API for filtering the set of modeled fields.

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

18 months ago[libc++] Fix aligned_alloc usage for Android
Shoaib Meenai [Sat, 7 Jan 2023 07:35:15 +0000 (23:35 -0800)]
[libc++] Fix aligned_alloc usage for Android

Android only provides this function on API 28+; fix libc++ builds when
targeting older API levels.

Reviewed By: arichardson, #libc, philnik

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

18 months agoMove isAllInactivePredicate and isAllActivePredicate definition upwards, NFC
Dinar Temirbulatov [Tue, 10 Jan 2023 14:23:29 +0000 (14:23 +0000)]
Move isAllInactivePredicate and isAllActivePredicate definition upwards, NFC

18 months ago[lld][COFF] Fix bug causing assertion in Chunk::setAlignment
Andrew Ng [Tue, 10 Jan 2023 14:03:48 +0000 (14:03 +0000)]
[lld][COFF] Fix bug causing assertion in Chunk::setAlignment

Reinstate use of FakeSection class to avoid constructing SectionChunk
from unintialised coff_section in FakeSectionChunk constructor.

Issue was caused by commit 5a58b19f9c93f3ac51bcde318508131ae78aa10c,
"[LLD] Remove global state in lld/COFF".

18 months ago[clang][dataflow] Unify `TransferOptions` and `DataflowAnalysisContext::Options`.
Yitzhak Mandelbaum [Tue, 27 Dec 2022 17:34:30 +0000 (17:34 +0000)]
[clang][dataflow] Unify `TransferOptions` and `DataflowAnalysisContext::Options`.

Merges `TransferOptions` into the newly-introduced
`DataflowAnalysisContext::Options` and removes explicit parameter for
`TransferOptions`, relying instead on the common options carried by the analysis
context. Given that there was no intent to allow different options between calls
to `transfer`, a common value for the options is preferable.

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

18 months ago[AMDGPU] Add GFX10/GFX11 wave64 test coverage in huge-private-buffer.ll
Jay Foad [Tue, 10 Jan 2023 14:13:16 +0000 (14:13 +0000)]
[AMDGPU] Add GFX10/GFX11 wave64 test coverage in huge-private-buffer.ll

18 months agoAvoid u8"" literals in tests, their type changes in C++20
Jens Massberg [Tue, 10 Jan 2023 11:20:09 +0000 (12:20 +0100)]
Avoid u8"" literals in tests, their type changes in C++20

Just specify the encoded bytes instead, which causes less confusion anyway.

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

18 months ago[AMDGPU] Fix duplicate -verify-machineinstrs option
Jay Foad [Tue, 10 Jan 2023 14:06:59 +0000 (14:06 +0000)]
[AMDGPU] Fix duplicate -verify-machineinstrs option

18 months ago[AArch64] Comprehensive tests for atomic operations
Tomas Matheson [Tue, 6 Dec 2022 11:18:16 +0000 (11:18 +0000)]
[AArch64] Comprehensive tests for atomic operations

There are a lot of variants of atomic operations, and AArch64 has several
distinct options to codegen them, and does different things depending on
available features, architecture version and optimisation level. The current
testing for atomic operations has been added gradually over time and does not
give full coverate.  Given how complex the codegen for atomic operations is, it
is valuable to cover the entire parameter space, i.e. test them all. The
resulting set of tests serve also as a reference for how each is codegened.

In order to keep the test files readable and avoid constant updating for
unrelated codegen changes, the test outputs are filtered to only include the
relevant instructions. This shows for each operation and feature which codegen
approach is taken (e.g. ll/sc loop, atomic instruction, library call).

The following parameter space is tested:
 - feature: +lse, +rcpc, etc
 - optimisation level: O0, O1 (covers GISel and SelectionDAG)
 - atomic instruction: load, store, cmpxchg, atomirmw*
 - size: i8, i16, i32, i64, i128
 - aligned/unaligned accesses
 - endianness: big, little
 - atomic ordering: release, acquire, etc
 - load atomic only: const/non-const
 - cmpxchg only: weak/strong
 - atomicrmw: update operation (add, sub, etc)

Notably not covered:
 - volatility: there should be no difference between volatile/non-volatile
 - atomicrmw fadd/fsub

The files are split by triple, LLVM instruction, and feature. This makes it
easy to diff between features and endianness for a given instruction.

The file that generates the tests is included.

There are 70 test files with an average of 2800 lines each.

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

18 months ago[mlir] verify that transform ops have memory effects
Alex Zinenko [Tue, 10 Jan 2023 12:19:53 +0000 (12:19 +0000)]
[mlir] verify that transform ops have memory effects

Add a verifier to the TransformOpInterface ensuring that operations
implementing the interface define memory effects on their operands and
results.

Add the missing effects to TileToForeachThreadOp, specifically for
operands that were added at a later version of the op without modifying
`getEffects` accordingly.

Reviewed By: nicolasvasilache

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

18 months agoRevert "[X86] Add RMPQUERY to SNP instructions"
Ganesh Gopalasubramanian [Tue, 10 Jan 2023 13:41:25 +0000 (19:11 +0530)]
Revert "[X86] Add RMPQUERY to SNP instructions"

This reverts commit 313b747c5bf293aa86caf0da57b978a9758cd57b.
It wasn't reviwed as yet.

18 months ago[X86] Add RMPQUERY to SNP instructions
Ganesh Gopalasubramanian [Tue, 10 Jan 2023 13:31:12 +0000 (19:01 +0530)]
[X86] Add RMPQUERY to SNP instructions

18 months ago[mlir][llvm] Call the instruction builders from a static method (NFC).
Tobias Gysi [Tue, 10 Jan 2023 13:16:38 +0000 (14:16 +0100)]
[mlir][llvm] Call the instruction builders from a static method (NFC).

Extract a static method to call the MLIR builders that translate LLVM IR
instructions to MLIR LLVM dialect operations. This change ensures the
MLIR builders have to use the moduleImport argument rather than calling
the import methods directly. As a result, both the intrinsic and the
instruction MLIR builders have to use a moduleImport argument and none
of them has direct access to private moduleImport methods. The revision
thus enforces consistent MLIR builder implementations for instructions
and intrinsics.

The revision also moves parseDataLayoutAlignment closer to its use.

Reviewed By: Dinistro

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

18 months ago[Support] avoid u8"" literals in tests, their type changes in C++20
Sam McCall [Mon, 9 Jan 2023 19:36:05 +0000 (20:36 +0100)]
[Support] avoid u8"" literals in tests, their type changes in C++20

Just specify the encoded bytes instead, which causes less confusion anyway.

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

18 months ago[AST] include decls owned by FriendDecl in -ast-dump
Sam McCall [Tue, 10 Jan 2023 09:51:34 +0000 (10:51 +0100)]
[AST] include decls owned by FriendDecl in -ast-dump

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

18 months ago[AMDGPU] Add GFX11 test coverage for FeatureBackOffBarrier
Jay Foad [Tue, 10 Jan 2023 12:02:55 +0000 (12:02 +0000)]
[AMDGPU] Add GFX11 test coverage for FeatureBackOffBarrier

18 months ago[AMDGPU] Regenerate checks in waitcnt-preexisting-vscnt.mir
Jay Foad [Tue, 10 Jan 2023 12:16:43 +0000 (12:16 +0000)]
[AMDGPU] Regenerate checks in waitcnt-preexisting-vscnt.mir

18 months ago[X86][NFC]Move and rephrase the comment, NFC
Alexey Bataev [Tue, 10 Jan 2023 12:34:16 +0000 (04:34 -0800)]
[X86][NFC]Move and rephrase the comment, NFC

18 months ago[NVPTX] Enforce minumum alignment of 4 for byval parametrs in a function prototype
Pavel Kopyl [Mon, 9 Jan 2023 14:59:47 +0000 (17:59 +0300)]
[NVPTX] Enforce minumum alignment of 4 for byval parametrs in a function prototype

As a result, we have identical alignment calculation of byval
parameters for:

  - LowerCall() - getting alignment of an argument (.param)

  - emitFunctionParamList() - getting alignment of a
    parameter (.param) in a function declaration

  - getPrototype() - getting alignment of a parameter (.param) in a
    function prototypes that is used for indirect calls

This change is required to avoid ptxas error: 'Alignment of argument
does not match formal parameter'. This error happens even in cases
where it logically shouldn't.

For instance:

  .param .align 4 .b8 param0[4];
  ...
  callprototype ()_ (.param .align 2 .b8 _[4]);
  ...

Here we allocate 'param0' with alignment of 4 and it should be fine to
pass it to a function that requires minimum alignment of 2.

At least ptxas v12.0 rejects this code.

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

18 months ago[NVPTX] Set default version of architecture to SM_30, PTX to 6.0.
Pavel Kopyl [Mon, 9 Jan 2023 14:55:55 +0000 (17:55 +0300)]
[NVPTX] Set default version of architecture to SM_30, PTX to 6.0.

Support of variadic functions triggers an assertion on several tests
from llvm/test/CodeGen/Generic/ if nvptx64-* is specified as a default
triplet:

Support for variadic functions (unsized array parameter) introduced in
PTX ISA version 6.0 and requires target sm_30.

That happens because those tests contain variadic function calls and
default versions of both PTX ISA (3.2) and architecture (sm_20) are
below the minimally required.

There were no observable problems with these tests before adding
support of variadic functions, because nvptx backend just didn't
handle them properly generating invalid PTX code.

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

18 months ago[GVNSink] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 10 Jan 2023 11:45:06 +0000 (12:45 +0100)]
[GVNSink] Convert tests to opaque pointers (NFC)

Keeping bitcasts in the common_bitcast() test, otherwise sinking
no longer occurs there. GVNSink seems to have a silly cost model
where sinking just the stores is considered non-profitable, but
sinking the stores and bitcasts (which are free...) is profitable.

As this is not a default-enabled pass, and this problem would exist
without opaque pointers as well, I'm not trying to do anything
about this.

18 months ago[AArch64] lower abs intrinsic to new ABS instruction in GIsel
Ties Stuij [Tue, 10 Jan 2023 11:12:19 +0000 (11:12 +0000)]
[AArch64] lower abs intrinsic to new ABS instruction in GIsel

When feature CSSC is available, the abs intrinsic should map to the
new scalar ABS instruction when using GlobalIsel

spec:
https://developer.arm.com/documentation/ddi0602/2022-09/Base-Instructions/ABS--Absolute-value-

Reviewed By: aemerson

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

18 months ago[GVNSink] Make tests more robust (NFC)
Nikita Popov [Tue, 10 Jan 2023 11:39:36 +0000 (12:39 +0100)]
[GVNSink] Make tests more robust (NFC)

Avoid use of no-op GEPs.

18 months agoRemove unnecessary template specifiers from truct constructors in tests.
Jens Massberg [Mon, 9 Jan 2023 16:56:10 +0000 (17:56 +0100)]
Remove unnecessary template specifiers from truct constructors in tests.

As far as I can see they are unnecessary and in C++20 they lead to errors.
Removing them the tests pass with C++20 and the default version.
Example error message:
```
llvm-project/llvm/unittests/IR/PassBuilderCallbacksTest.cpp:275:30: error: expected unqualified-id before ‘)’ token
  275 |   MockAnalysisHandle<Module>() { setDefaults(); }
```

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

18 months ago[GlobalMerge] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 10 Jan 2023 11:33:04 +0000 (12:33 +0100)]
[GlobalMerge] Convert tests to opaque pointers (NFC)

18 months ago[CostModel][AArch64] Add insert/extract element tests for neoverse cores. NFC.
Sjoerd Meijer [Tue, 10 Jan 2023 11:10:42 +0000 (11:10 +0000)]
[CostModel][AArch64] Add insert/extract element tests for neoverse cores. NFC.

18 months ago[mlir] GreedyPatternRewriter: fix counting of iterations
Matthias Springer [Tue, 10 Jan 2023 11:02:33 +0000 (12:02 +0100)]
[mlir] GreedyPatternRewriter: fix counting of iterations

The GreedyPatternRewriteDriver did previously not count the first iteration. I.e., when setting `config.maxIterations = 1`, two iterations were performed. In pratice, this number is not really important; we usually just need a limit in some reasonable order of magnitude. However, this fix allows us to write better convergence/worklist tests with carefully crafted test patterns to purposely trigger edge cases in the driver.

Similarly, the first rewrite was previously not counted towards `config.maxNumRewrites`.

For consistency, `OpPatternRewriteDriver` now uses `config.maxNumRewrites` instead of `config.maxIterations`; this driver does not have "iterations", it consists of a single loop (corresponding to the inner loop in the GreedyPatternRewriteDriver).

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

18 months agoReapply [Dominators] Add findNearestCommonDominator() for Instructions (NFC)
Nikita Popov [Fri, 6 Jan 2023 15:56:34 +0000 (16:56 +0100)]
Reapply [Dominators] Add findNearestCommonDominator() for Instructions (NFC)

Reapply with checks for instructions in unreachable blocks. A test
case for this was added in 1ee4a93b15bb.

-----

This is a recurring pattern: We want to find the nearest common
dominator (instruction) for two instructions, but currently only
provide an API for the nearest common dominator of two basic blocks.

Add an overload that accepts and return instructions.

18 months ago[DSE] Add test with different unreachable block order (NFC)
Nikita Popov [Tue, 10 Jan 2023 11:12:52 +0000 (12:12 +0100)]
[DSE] Add test with different unreachable block order (NFC)

18 months ago[lld][WebAssembly] Fix memory.fill argument in 64-bit mode
Sam Clegg [Wed, 4 Jan 2023 19:28:55 +0000 (11:28 -0800)]
[lld][WebAssembly] Fix memory.fill argument in 64-bit mode

This only effects folks building with wasm64 + shared memory which
is not currently a supported configuration in emscripten or any other
wasm toolchain.

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

18 months ago[UpdateTestChecks] Add wasm64 target
Luke Lau [Fri, 6 Jan 2023 13:55:28 +0000 (13:55 +0000)]
[UpdateTestChecks] Add wasm64 target

wasm32 was already supported, so here I've just reused the same regex. I'm not sure if this is actually correct: I don't know for certain if wasm32 and wasm64 have different output formats, but it seems to work.

Reviewed By: dschuff, asb

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

18 months agoRevert "[JumpThreading] Preserve profile metadata during select unfolding"
Dmitri Gribenko [Tue, 10 Jan 2023 10:37:49 +0000 (11:37 +0100)]
Revert "[JumpThreading] Preserve profile metadata during select unfolding"

This reverts commit 957952dbf2f34ed552e8e1f8c35eed17eee2ea38.

Addition in the newly added code can overflow.  As a result, the
constructor of `BranchProbability()` can trigger an assertion. See
the discussion on https://reviews.llvm.org/D138132 for more details.