platform/upstream/llvm.git
19 months ago[X86] Remove unnecessary x87 overrides from znver1/znver2 model
Simon Pilgrim [Mon, 5 Dec 2022 21:12:07 +0000 (21:12 +0000)]
[X86] Remove unnecessary x87 overrides from znver1/znver2 model

Reported by D138359 - the overrides matched the base class schedule WriteMicrocoded definition

19 months ago[lld-macho] Canonicalize LSDA pointers
Jez Ng [Mon, 5 Dec 2022 21:18:15 +0000 (16:18 -0500)]
[lld-macho] Canonicalize LSDA pointers

This was causing an uncaught exception issue in one of our programs. The
issue was fairly subtle / rare as it required two identical LSDAs that were
referenced by a pair of non-identical compact unwind encodings.

Reviewed By: #lld-macho, smeenai

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

19 months ago[mlir][tosa] Handle tosa.resize nearest rounding correctly
Rob Suderman [Mon, 5 Dec 2022 20:45:06 +0000 (12:45 -0800)]
[mlir][tosa] Handle tosa.resize nearest rounding correctly

Rounding of tosa.resize did not handle rounding to the nearest pixel correctly.
Rather than dividing the scale by 2 we should double the partial pixel to
guarantee we include a check on the lowest bit.

Reviewed By: NatashaKnk

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

19 months ago[Clang] Don't consider default constructors ineligible if the more constrained constr...
Roy Jacobson [Sun, 4 Dec 2022 19:02:57 +0000 (21:02 +0200)]
[Clang] Don't consider default constructors ineligible if the more constrained constructor is a template

Partially solves https://github.com/llvm/llvm-project/issues/59206:

We now mark trivial constructors as eligible even if there's a more constrained templated default constructor. Although technically non-conformant, this solves problems with pretty reasonable uses cases like
```
template<int n>
struct Foo {
constexpr Foo() = default;

template<class... Ts>
Foo(Ts... vals) requires(sizeof...(Ts) == n) {}
};
```
where we currently consider the default constructor to be ineligible and therefor inheriting/containing classes have non trivial constructors. This is aligned with GCC: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c75ebe76ae12ac4020f20a24f34606a594a40d15

This doesn't change `__is_trivial`. Although we're technically standard conformant in this regard, GCC/MSVC exhibit different behaviors that seem to make more sense. An issue has been filed to CWG and we await their response.

Reviewed By: erichkeane, #clang-language-wg

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

19 months ago[flang] Lower F08 NORM2 intrinsic
Tarun Prabhu [Mon, 5 Dec 2022 20:50:33 +0000 (13:50 -0700)]
[flang] Lower F08 NORM2 intrinsic

The implementation follows the pattern used in comparable intrinsics.
Change the runtime API for Norm2 so it does not expect a mask argument
since the Norm2 intrinsic does not accept a mask in Fortran.

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

19 months ago[Hexagon] Remove leftover debug messages after 87a3f1ab
Krzysztof Parzyszek [Mon, 5 Dec 2022 20:45:03 +0000 (12:45 -0800)]
[Hexagon] Remove leftover debug messages after 87a3f1ab

19 months ago[gn build] Fix build of merge-fdata in a clean build dir
Nico Weber [Mon, 5 Dec 2022 20:42:42 +0000 (15:42 -0500)]
[gn build] Fix build of merge-fdata in a clean build dir

merge-fdata doesn't depend on any libraries except Support,
but it includes headers that require Attributes.inc to exist.
Add a dep that ensures that it does exist.
Corresponds to the intrinsics_gen dep in CMake.

19 months ago[SDAG] Allow scalable vectors in SimplifyDemanded routines
Philip Reames [Mon, 5 Dec 2022 19:59:06 +0000 (11:59 -0800)]
[SDAG] Allow scalable vectors in SimplifyDemanded routines

This is a continuation of the series of patches adding lane wise support for scalable vectors in various knownbit-esq routines.

The basic idea here is that we track a single lane for scalable vectors which corresponds to an unknown number of lanes at runtime. This is enough for us to perform lane wise reasoning on many arithmetic operations.

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

19 months ago[Hexagon] Better detection of impossible completions to perfect shuffles
Krzysztof Parzyszek [Mon, 5 Dec 2022 20:21:21 +0000 (12:21 -0800)]
[Hexagon] Better detection of impossible completions to perfect shuffles

If there is an entry P that has C bits set, it could become one of C
different possibilities. If P occurs more than C times, then there are
no valid completions.

19 months ago[Flang] Restore Flang cmake configuration data
Peter Steinfeld [Mon, 5 Dec 2022 19:50:14 +0000 (11:50 -0800)]
[Flang] Restore Flang cmake configuration data

Patch D138274 removed some Flang cmake configuration information that we
need for our internal builds.  This change restores them.

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

19 months agotest/Transforms/Scalarizer: re-run update_test_checks.py
Nicolai Hähnle [Mon, 5 Dec 2022 09:40:59 +0000 (10:40 +0100)]
test/Transforms/Scalarizer: re-run update_test_checks.py

Goal is to get a cleaner diff in an upcoming functional change.

19 months ago[llvm-objdump][docs] Mention --show-all-symbols
Fangrui Song [Mon, 5 Dec 2022 20:01:01 +0000 (20:01 +0000)]
[llvm-objdump][docs] Mention --show-all-symbols

after D131589

Reviewed By: jhenderson

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

19 months agomlir/TosaToLinalg: improve debugging during conversion
Ramkumar Ramachandra [Mon, 5 Dec 2022 19:15:57 +0000 (11:15 -0800)]
mlir/TosaToLinalg: improve debugging during conversion

Make systematic use of notifyMatchFailure.

Signed-off-by: Ramkumar Ramachandra <r@artagnon.com>
Reviewed By: rsuderman

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

19 months ago[mlir] Fix alias printing for dialect attribute self types
River Riddle [Mon, 5 Dec 2022 19:12:54 +0000 (11:12 -0800)]
[mlir] Fix alias printing for dialect attribute self types

This was donked up in the last patch that only considered
aliases for things actually getting printed.

19 months ago[mlir] Slightly optimize getRegions checks by inlining size check
River Riddle [Mon, 5 Dec 2022 18:40:28 +0000 (10:40 -0800)]
[mlir] Slightly optimize getRegions checks by inlining size check

Calculating the position of the region trailing objects isn't free,
given that it's the last trailing object, and inlining the size check
removes the need for users to explicitly add size checks for
micro-optimization.

19 months ago[NFC] Port all runlines for LoopVectorize pass tests to -passes syntax
Roman Lebedev [Mon, 5 Dec 2022 18:44:25 +0000 (21:44 +0300)]
[NFC] Port all runlines for LoopVectorize pass tests to -passes syntax

19 months agoFix DirectX test build
Chris Bieneman [Mon, 5 Dec 2022 19:12:13 +0000 (13:12 -0600)]
Fix DirectX test build

This broke when some headers got moved aorund.

19 months agoReland "A new hidden option exec-on-ir-change=exe that calls exe each time IR changes"
Jamie Schmeiser [Mon, 5 Dec 2022 19:11:15 +0000 (14:11 -0500)]
Reland "A new hidden option exec-on-ir-change=exe that calls exe each time IR changes"

Summary:
This relands commit dff0e8b4ff13af311512c369d059f1e095e83a60.  The test is now
guarded with a lit.local.cfg that ensures /bin/cat is available.  Also, the
code has been updated to match changes made to relevant code.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By:aeubanks (Arthur Eubanks)
Differential Revision: https://reviews.llvm.org/D110776

19 months ago[gn build] Port 5ecd36329508
LLVM GN Syncbot [Mon, 5 Dec 2022 18:56:16 +0000 (18:56 +0000)]
[gn build] Port 5ecd36329508

19 months agoReapply "[CodeGen] Add new pass for late cleanup of redundant definitions."
Jonas Paulsson [Mon, 5 Dec 2022 14:14:40 +0000 (08:14 -0600)]
Reapply "[CodeGen] Add new pass for late cleanup of redundant definitions."

This reverts commit 122efef8ee9be57055d204d52c38700fe933c033.

- Patch fixed to not reuse definitions from predecessors in EH landing pads.
- Late review suggestions (by MaskRay) have been addressed.
- M68k/pipeline.ll test updated.
- Init captures added in processBlock() to avoid capturing structured bindings.
- RISCV has this disabled for now.

Original commit message:

A new pass MachineLateInstrsCleanup is added to be run after PEI.

This is a simple pass that removes redundant and identical instructions
whenever found by scanning the MF once while keeping track of register
definitions in a map. These instructions are typically immediate loads
resulting from rematerialization, and address loads emitted by target in
eliminateFrameInde().

This is enabled by default, but a target could easily disable it by means of
'disablePass(&MachineLateInstrsCleanupID);'.

This late cleanup is naturally not "optimal" in removing instructions as it
is done by looking at phys-regs, but still quite effective. It would be
desirable to improve other parts of CodeGen and avoid these redundant
instructions in the first place, but there are no ideas for this yet.

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

Reviewed By: RKSimon, foad, craig.topper, arsenm, asb

19 months ago[flang] Catch attempts to copy pointers in allocatables in PURE
Peter Klausler [Fri, 18 Nov 2022 00:30:49 +0000 (16:30 -0800)]
[flang] Catch attempts to copy pointers in allocatables in PURE

In a pure context, a pointer acquired from an INTENT(IN) dummy argument
may not be copied.  Catch the case in which the pointer is a component
of an allocatable component at some depth of nesting.

(This patch adds a new component iterator kind that is a variant of
a potential subobject component iterator; it visits all potential
subobject components, plus pointers, into which it does not descend.)

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

19 months ago[lldb][Test] TestRerunAndExprDylib.py on Linux: dlclose solib to force destruction...
Michael Buch [Mon, 5 Dec 2022 18:12:56 +0000 (18:12 +0000)]
[lldb][Test] TestRerunAndExprDylib.py on Linux: dlclose solib to force destruction module

Previously we didn't properly trigger the destructor of
the `lldb_private::Module` backing `libfoo.so`. So the newly
rebuilt version wouldn't actually be loaded on a program re-run.
The test expects the fresh module to be loaded.

19 months ago[NFC] Port all runlines for SimplifyCFG pass tests to -passes syntax
Roman Lebedev [Mon, 5 Dec 2022 18:10:54 +0000 (21:10 +0300)]
[NFC] Port all runlines for SimplifyCFG pass tests to -passes syntax

19 months agoAMDGPU: Convert a test to generated checks
Matt Arsenault [Fri, 25 Nov 2022 21:52:01 +0000 (16:52 -0500)]
AMDGPU: Convert a test to generated checks

Also switch to not using kernels to test, since it shouldn't matter
for these addressing modes. This should reduce some of the diffs
between subtargets, but it's still not enough to share the same
checks.

The test could use some additional modernization. Probably should also
round this out with the new maximium offsets.

19 months ago[flang] Fold the RHS of assignment
Peter Klausler [Wed, 16 Nov 2022 00:23:13 +0000 (16:23 -0800)]
[flang] Fold the RHS of assignment

In order to emit overflow warnings from assignment statements whose
right-hand sides are constants that undergo conversions, run the
right-hand sides of assignments through constant folding after the
conversions have been made explicit in expression analysis.

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

19 months ago[flang] Fix pointer association with remap on polymorphic entities
Valentin Clement [Mon, 5 Dec 2022 17:28:13 +0000 (18:28 +0100)]
[flang] Fix pointer association with remap on polymorphic entities

Runtime is expecting a 1d array. This patch fixes the generation
of the array holding the bounds to be passed to the runtime function call.

Reviewed By: jeanPerier, PeteSteinfeld

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

19 months ago[flang] Retrieve rank before updating the pointer
Valentin Clement [Mon, 5 Dec 2022 17:26:16 +0000 (18:26 +0100)]
[flang] Retrieve rank before updating the pointer

The code is iterating on the rank of the pointer to set the bounds.
If the rank is retrieved after the `pointer = target` it does not
reflect the actual rank of the pointer.

This could happen in code like the following:

```
type t1
  integer :: a
end type

type(t), pointer :: p(:)
class(t), pointer :: q(:,:)
q(0:1,-2:2) => p(10:1:-1)
```

Reviewed By: klausler

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

19 months agoExpand loop peeling phi computation to handle binary ops and casts
Jamie Schmeiser [Mon, 5 Dec 2022 17:10:53 +0000 (12:10 -0500)]
Expand loop peeling phi computation to handle binary ops and casts

Summary:
Expand the capabilities of the code for computing how many peels are
needed to make phis determined.  A cast gets the peel count for the
value being casted while a binary op gets the maximum of the operands.

Respond to review comments: remove redundant asserts.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By:mkazantsev (Max Kazantsev),syzaara (Zaara Syeda)
Differential Revision: https://reviews.llvm.org/D138719

19 months agoSupport `transpose` mode for `gpu.subgroup` WMMA ops
Navdeep Katel [Mon, 5 Dec 2022 10:44:56 +0000 (16:14 +0530)]
Support `transpose` mode for `gpu.subgroup` WMMA ops

Add support for loading, computing, and storing `gpu.subgroup` WMMA ops
in transpose mode as well. Update the GPU to NVVM lowerings to support
`transpose` mode and update integration tests as well.

Reviewed By: ThomasRaoux

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

19 months ago[InstCombine] Increase test coverage of vector.reverse ready for follow on work.
Paul Walker [Mon, 21 Nov 2022 16:56:55 +0000 (16:56 +0000)]
[InstCombine] Increase test coverage of vector.reverse ready for follow on work.

19 months agoAMDGPU: Bulk update memory legalizer tests to use opaque pointers
Matt Arsenault [Mon, 5 Dec 2022 16:45:17 +0000 (11:45 -0500)]
AMDGPU: Bulk update memory legalizer tests to use opaque pointers

19 months agoReland "[lldb][Target] Flush the scratch TypeSystem when owning lldb_private::Module...
Michael Buch [Fri, 25 Nov 2022 14:45:09 +0000 (14:45 +0000)]
Reland "[lldb][Target] Flush the scratch TypeSystem when owning lldb_private::Module gets unloaded"

This relands commit `71f3cac7895ad516ec25438f803ed3c9916c215a`

Fixes LLDB Linux bots and improves TypeSystem flushing for shared libraries.

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

19 months agoDAG: ComputeNumSignBits from load range metadata
Matt Arsenault [Mon, 4 Jun 2018 10:12:39 +0000 (13:12 +0300)]
DAG: ComputeNumSignBits from load range metadata

The cases where the result type doesn't match the range type
are inadequately tested, but I'm not sure how to write such a
test. During the pre-legalize combine, any obviously optimizable
code gets handled so it's harder to test legalized extloads.

19 months agoAMDGPU: Add baseline tests for known sign bits of load range metadata
Matt Arsenault [Sat, 12 Nov 2022 18:55:48 +0000 (10:55 -0800)]
AMDGPU: Add baseline tests for known sign bits of load range metadata

19 months ago[SDAG] Allow scalable vectors in ComputeKnownBits (try 2)
Philip Reames [Mon, 5 Dec 2022 16:49:42 +0000 (08:49 -0800)]
[SDAG] Allow scalable vectors in ComputeKnownBits (try 2)

This was previously reverted due to a hang on a Hexagon bot.  This turned out to be a bug in the Hexagon backend around how splat_vectors are legalized (which they're using for fixed length vectors!).  I adjusted this patch to remove the implicit truncate support.  This hides the hexagon bug for now, and unblocks the rest of the change.

Original commit message:

This is the SelectionDAG equivalent of D136470, and is thus an alternate patch to D128159.

The basic idea here is that we track a single lane for scalable vectors which corresponds to an unknown number of lanes at runtime. This is enough for us to perform lane wise reasoning on many arithmetic operations.

This patch also includes an implementation for SPLAT_VECTOR as without it, the lane wise reasoning has no base case. The original patch which inspired this (D128159), also included STEP_VECTOR. I plan to do that as a separate patch.

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

19 months ago[ConstraintElim] Queue facts and checks directly.
Florian Hahn [Mon, 5 Dec 2022 16:44:19 +0000 (16:44 +0000)]
[ConstraintElim] Queue facts and checks directly.

This allows interleaving facts and checks in a single block. In
particular this enables using facts from assumes for conditions in the
same block that come after the assume.

This could be extended to only try to simplify checks at the point where
a condition is used.

Reviewed By: nikic

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

19 months agoPGOProfile: Only keep opaque pointer tests
Matt Arsenault [Sat, 26 Nov 2022 22:23:01 +0000 (17:23 -0500)]
PGOProfile: Only keep opaque pointer tests

The typed pointer tests were already converted, these were identical
now.

19 months agoPredicateInfo: Convert test to opaque pointers
Matt Arsenault [Sat, 26 Nov 2022 20:43:31 +0000 (15:43 -0500)]
PredicateInfo: Convert test to opaque pointers

Drops the "has predicate info" for the first block.

19 months ago[NFC][PatternMatch] Add helper for m_Intrinsic<Intrinsic::experimental_vector_reverse>.
Paul Walker [Mon, 21 Nov 2022 17:35:49 +0000 (17:35 +0000)]
[NFC][PatternMatch] Add helper for m_Intrinsic<Intrinsic::experimental_vector_reverse>.

19 months ago[ConstraintElim] Add test subtracting SIGNED_MIN.
Florian Hahn [Mon, 5 Dec 2022 16:32:45 +0000 (16:32 +0000)]
[ConstraintElim] Add test subtracting SIGNED_MIN.

19 months ago[Instcombine] Precommit tests for some or canonicalization; NFC
chenglin.bi [Mon, 5 Dec 2022 16:31:58 +0000 (00:31 +0800)]
[Instcombine] Precommit tests for some or canonicalization; NFC
~((A & B) ^ (A | ?)) -> (A & B) | ~(A | ?)
~(A & B) ^ (A | ?) -> (A & B) | ~(A | ?)

19 months ago[clang][Interp][NFC] Move to std::optional
Timm Bäder [Mon, 5 Dec 2022 16:30:24 +0000 (17:30 +0100)]
[clang][Interp][NFC] Move to std::optional

19 months ago[Instcombine] Precommit tests for D139080; NFC
chenglin.bi [Mon, 5 Dec 2022 16:23:28 +0000 (00:23 +0800)]
[Instcombine] Precommit tests for D139080; NFC
Test pattern for
(C & X) | ~(C | Y) -> C ? X : ~Y

19 months ago[NFC][WebAssembly] Add codegen tests
Samuel Parker [Mon, 5 Dec 2022 16:01:36 +0000 (16:01 +0000)]
[NFC][WebAssembly] Add codegen tests

19 months agoExecutionEngine: Convert tests to opaque pointers
Matt Arsenault [Sun, 27 Nov 2022 18:47:09 +0000 (13:47 -0500)]
ExecutionEngine: Convert tests to opaque pointers

19 months ago[InstCombine] Precommit tests for D139253; NFC
chenglin.bi [Mon, 5 Dec 2022 16:00:54 +0000 (00:00 +0800)]
[InstCombine] Precommit tests for D139253; NFC

19 months ago[lld/mac] Fix --start-lib/--end-lib with split thinlto inputs
Nico Weber [Fri, 2 Dec 2022 14:29:18 +0000 (09:29 -0500)]
[lld/mac] Fix --start-lib/--end-lib with split thinlto inputs

Fixes #59162. The test has a comment explaining what's going on.
See also Symbol::extract() in lld/ELF/Symbols.cpp.

The included test sadly also passes if I pass just bd448f01a62,
while doing that isn't enough to make my bigger repro case work
(if I port just that, something else asserts later on, but with
this fix here everything's fine in my bigger repro).

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

19 months agoRevert "[test] Fix CodeGen/M68k/pipeline.ll after D123394 MachineLateInstrsCleanupPass"
Michał Górny [Mon, 5 Dec 2022 15:47:17 +0000 (16:47 +0100)]
Revert "[test] Fix CodeGen/M68k/pipeline.ll after D123394 MachineLateInstrsCleanupPass"

This reverts commit f55880e830e150d98e5340cdc3c4c41867a5514d.
The original change was reverted.

19 months ago[LoopFlatten] Precommit test for GH issue #59339. NFC.
Sjoerd Meijer [Mon, 5 Dec 2022 15:36:24 +0000 (15:36 +0000)]
[LoopFlatten] Precommit test for GH issue #59339. NFC.

19 months ago[LoopFlatten] Add some LLVM_DEBUG messages. NFC.
Sjoerd Meijer [Mon, 5 Dec 2022 15:34:23 +0000 (15:34 +0000)]
[LoopFlatten] Add some LLVM_DEBUG messages. NFC.

19 months ago[flang] Map symbols in expressions when copying interface symbols
Peter Klausler [Fri, 2 Dec 2022 15:19:49 +0000 (07:19 -0800)]
[flang] Map symbols in expressions when copying interface symbols

Given a MODULE SUBROUTINE or MODULE FUNCTION interface followed
later by a corresponding separate module subprogram definition in a
MODULE PROCEDURE, the copies of the interface's dummy argument and
function result symbols that populate the initial scope of that
MODULE PROCEDURE need to have any symbol references in their types
or bounds adjusted to point to their new counterparts.

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

19 months ago[flang][NFC] Add a no-arg constructor for `Verbatim`.
Samira Bazuzi [Mon, 5 Dec 2022 15:30:29 +0000 (07:30 -0800)]
[flang][NFC] Add a no-arg constructor for `Verbatim`.

In C++20, types that declare or delete any constructors are no longer aggregates, breaking compilation of many existing uses of aggregate initialization.

Although `Verbatim` declares itself to not have a no-arg default constructor, this is circumvented in `basic-parsers.h` which returns a `RESULT{}` a.k.a. `Verbatim{}`. Adding the no-arg constructor while still deleting the copy/assignment constructors maintains the current state and also supports eventually building this in c++20 mode.

Fix suggested in https://discourse.llvm.org/t/build-failure-when-attempting-to-build-flang-with-c-20/66953.

Reviewed By: klausler

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

19 months ago[ConstraintElim] Add test with implicit/explicit GEP index truncate.
Florian Hahn [Mon, 5 Dec 2022 15:25:07 +0000 (15:25 +0000)]
[ConstraintElim] Add test with implicit/explicit GEP index truncate.

The implicit index truncate example is currently being miscompiled.

19 months agoRevert "Recommit "[LoopFlatten] Enable it by default""
Sjoerd Meijer [Mon, 5 Dec 2022 14:52:40 +0000 (14:52 +0000)]
Revert "Recommit "[LoopFlatten] Enable it by default""

This reverts commit 3ea6a9a469fde168c527b1c34c09f6d684ec86af because of the
reported miscompilation in: https://github.com/llvm/llvm-project/issues/59339

19 months ago[AAch64] Optimize muls with operands having enough sign bits.
bipmis [Mon, 5 Dec 2022 15:08:31 +0000 (15:08 +0000)]
[AAch64] Optimize muls with operands having enough sign bits.

Muls with 64bit operands where each of the operand is having more than 32 sign bits, we can generate a single smull instruction on a 32bit operand.

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

19 months agoValueTracking: Teach canCreateUndefOrPoison about more intrinsics
Matt Arsenault [Sun, 4 Dec 2022 00:40:06 +0000 (19:40 -0500)]
ValueTracking: Teach canCreateUndefOrPoison about more intrinsics

I tried to test the fallthrough to noundef callsite return attribute
case, but it seems that folds out as-is.

19 months ago[LLDB][RISCV] Add RV64F instruction support for EmulateInstructionRISCV
Emmmer [Sat, 3 Dec 2022 13:49:50 +0000 (21:49 +0800)]
[LLDB][RISCV] Add RV64F instruction support for EmulateInstructionRISCV

Reviewed By: DavidSpickett

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

19 months agoValueTracking: Add some baseline intrinsic with freeze tests
Matt Arsenault [Sun, 4 Dec 2022 00:37:57 +0000 (19:37 -0500)]
ValueTracking: Add some baseline intrinsic with freeze tests

19 months ago[gn build] Port dbe8c2c316c4
LLVM GN Syncbot [Mon, 5 Dec 2022 14:27:33 +0000 (14:27 +0000)]
[gn build] Port dbe8c2c316c4

19 months agocompiler-rt/test/metadata: restrict tests to x86_64
Dmitry Vyukov [Mon, 5 Dec 2022 14:12:37 +0000 (15:12 +0100)]
compiler-rt/test/metadata: restrict tests to x86_64

aarch64 builder broke with:

-- Supported architectures for crt: aarch64
CMake Error at compiler-rt/cmake/config-ix.cmake:244 (message):
  Unsupported architecture: x86_64
Call Stack (most recent call first):
  compiler-rt/cmake/config-ix.cmake:280 (get_target_flags_for_arch)
  compiler-rt/test/metadata/CMakeLists.txt:7 (get_test_cc_for_arch)
-- Configuring incomplete, errors occurred!

https://lab.llvm.org/buildbot/#/builders/223/builds/11423

Restrict the tests to x86_64 only.

Reviewed By: melver

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

19 months ago[NFC] Fix test/CodeGen/PowerPC/O0-pipeline.ll
Roman Lebedev [Mon, 5 Dec 2022 14:21:29 +0000 (17:21 +0300)]
[NFC] Fix test/CodeGen/PowerPC/O0-pipeline.ll

19 months agoclang: Convert builtins test to opaque pointers
Matt Arsenault [Sat, 3 Dec 2022 19:25:43 +0000 (14:25 -0500)]
clang: Convert builtins test to opaque pointers

19 months ago[LinkerWrapper] Fix use-after-free when using JIT
Joseph Huber [Mon, 5 Dec 2022 13:48:30 +0000 (07:48 -0600)]
[LinkerWrapper] Fix use-after-free when using JIT

Summary:
This portion of the code was unused until now and wasn't properly
updated after we moved to using `StringRef`.

19 months agoUse-after-return sanitizer binary metadata
Dmitry Vyukov [Mon, 17 Oct 2022 13:13:56 +0000 (15:13 +0200)]
Use-after-return sanitizer binary metadata

Currently per-function metadata consists of:
(start-pc, size, features)

This adds a new UAR feature and if it's set an additional element:
(start-pc, size, features, stack-args-size)

Reviewed By: melver

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

19 months agoValueTracking: Teach CannotBeOrderedLessThanZero about trivial ops
Matt Arsenault [Sun, 4 Dec 2022 03:49:47 +0000 (22:49 -0500)]
ValueTracking: Teach CannotBeOrderedLessThanZero about trivial ops

Handle canonicalize and arithmetic.fence

19 months agoValueTracking: Teach isKnownNeverNaN about arithmetic_fence
Matt Arsenault [Sun, 4 Dec 2022 03:28:57 +0000 (22:28 -0500)]
ValueTracking: Teach isKnownNeverNaN about arithmetic_fence

19 months agoValueTracking: Teach isKnownNeverInfinity about arithmetic.fence
Matt Arsenault [Sun, 4 Dec 2022 03:25:34 +0000 (22:25 -0500)]
ValueTracking: Teach isKnownNeverInfinity about arithmetic.fence

19 months agoIntrinsics: Fix not speculating llvm.fptrunc.round
Matt Arsenault [Sun, 4 Dec 2022 15:54:44 +0000 (10:54 -0500)]
Intrinsics: Fix not speculating llvm.fptrunc.round

Move its definition to be with the other FP rounding intrinsics.

19 months ago[GlobalISel][DebugInfo] Propagate debug location for localized constants
Vladislav Dzhidzhoev [Mon, 20 Jun 2022 12:49:08 +0000 (15:49 +0300)]
[GlobalISel][DebugInfo] Propagate debug location for localized constants

After IRTranslator pass, constants are deduplicated and translated into instructions at entry block, having debug locations lost.
Localization of constants may cause emission of extra zero lines in debug_line section, like here https://godbolt.org/z/ecvsxxfKn. In this example, constant gets placed as
a first instruction in entry block, and despite it has no debug location, AsmPrinter emits zero line for it.

If a localized constant has the only user, we can assume that it has the same debug location as its user, since they are placed consequently.

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

19 months ago[NFC][Clang][Driver][AMDGPU] Avoid temporary copies of std::string by using Twine...
Juan Manuel MARTINEZ CAAMAÑO [Mon, 5 Dec 2022 12:30:51 +0000 (06:30 -0600)]
[NFC][Clang][Driver][AMDGPU] Avoid temporary copies of std::string by using Twine and StringRef

Reviewed By: tra

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

19 months ago[AMDGPU][MC] Correct handling of mandatory literals
Dmitry Preobrazhensky [Mon, 5 Dec 2022 13:03:17 +0000 (16:03 +0300)]
[AMDGPU][MC] Correct handling of mandatory literals

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

19 months agoAn iwyu cleanup in flang/Frontend/TargetOptions.h
Haojian Wu [Mon, 5 Dec 2022 13:18:33 +0000 (14:18 +0100)]
An iwyu cleanup in flang/Frontend/TargetOptions.h

19 months ago[AArch64][SME] Avoid going through memory for streaming-compatible splats
Sander de Smalen [Mon, 5 Dec 2022 12:06:10 +0000 (12:06 +0000)]
[AArch64][SME] Avoid going through memory for streaming-compatible splats

Reviewed By: david-arm, paulwalker-arm

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

19 months ago[ConstraintElim] Update comment after recent changes.
Florian Hahn [Mon, 5 Dec 2022 12:19:09 +0000 (12:19 +0000)]
[ConstraintElim] Update comment after recent changes.

Update the comment to reflect the current code.

19 months ago[mlir] Fix infinite loop in collapse
Guray Ozen [Fri, 2 Dec 2022 15:34:58 +0000 (16:34 +0100)]
[mlir] Fix infinite loop in collapse

Incrementing `counter` variable is inside the if statement. If the code does not enter there, the while loop will iterate infinitely. This revision moves the codes outside of if statement.

Reviewed By: mravishankar

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

19 months ago[SCCP] Propagate equality of a not-constant
luxufan [Mon, 5 Dec 2022 11:38:25 +0000 (19:38 +0800)]
[SCCP] Propagate equality of a not-constant

The equality state of a not-constant can be used to do constant
propagation. For example,
```
define i32 @equal_not_constant(ptr noundef %p, ptr noundef %q) {
entry:
  %cmp = icmp ne ptr %p, null
  br i1 %cmp, label %if.then, label %if.end

if.then:                                          ; preds = %entry
  %cmp.then = icmp eq ptr %p, %q
  br i1 %cmp.then, label %if.then1, label %if.end

if.then1:                                         ; preds = %if.then
  %cmp.then1 = icmp ne ptr %q, null
  call void @use(i1 %cmp.then1)
  br label %if.end

if.end:
  ret i32 0
}

```
In this case, we can fold `%cmp.then1` as `true`.

Reviewed By: nikic

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

19 months agoAMDGPU/MC: Simplify AsmParser for VOP3P
Petar Avramovic [Mon, 5 Dec 2022 10:49:20 +0000 (11:49 +0100)]
AMDGPU/MC: Simplify AsmParser for VOP3P

Remove check that instruction has src_modifiers because
isRegOrImmWithInputMods essentially includes this check.
isMod is no longer used after the refactor. Also, was unreachable case
inside for loop. clamp and omod operands are handled after the loop.

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

19 months ago[LLVM][Runtimes] Surround unknown runtime with ""
David Spickett [Mon, 5 Dec 2022 11:33:29 +0000 (11:33 +0000)]
[LLVM][Runtimes] Surround unknown runtime with ""

So that when you do something like:
-DLLVM_ENABLE_RUNTIMES=;compiler-rt;libcxx;libcxxabi;libunwind

You get:
Runtime "" is not a supported runtime.  Supported runtimes are:

Instead of:
Runtime is not a supported runtime.  Supported runtimes are:

Which implies that "Runtime" is the name of the runtime you
tried to build, but in fact it was "".

19 months ago[include-cleaner] Add two command-line flags to the include-cleaner
Haojian Wu [Mon, 5 Dec 2022 11:18:58 +0000 (12:18 +0100)]
[include-cleaner] Add two command-line flags to the include-cleaner
category.

19 months agoRevert "[AArch64] Improve TargetParser API"
Tomas Matheson [Mon, 5 Dec 2022 11:09:03 +0000 (11:09 +0000)]
Revert "[AArch64] Improve TargetParser API"

This reverts commit e83f1502f1be7a2a3b9a33f5a73867767e78ba6b.

Did not build with C++20 and caused problems with dynamic libs.

19 months ago[SCCP] Add support for with.overflow intrinsics
Nikita Popov [Wed, 9 Nov 2022 11:09:03 +0000 (12:09 +0100)]
[SCCP] Add support for with.overflow intrinsics

This adds SCCP support for extractvalues of with.overflow.
We compute both the range of the result value and determine when
the overflow value is always false.

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

19 months ago[lldb][Test] TestModulesCompileError.py: fix expected error string
Michael Buch [Mon, 5 Dec 2022 10:47:08 +0000 (10:47 +0000)]
[lldb][Test] TestModulesCompileError.py: fix expected error string

19 months ago[NFC] Rename variable MaxBECount -> ConstantMaxBECount
Max Kazantsev [Mon, 5 Dec 2022 09:35:18 +0000 (16:35 +0700)]
[NFC] Rename variable MaxBECount -> ConstantMaxBECount

Just to distinguish it from symbolic max which we plan to compute
here as well.

19 months agoFix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Mon, 5 Dec 2022 10:39:49 +0000 (10:39 +0000)]
Fix MSVC "not all control paths return a value" warning. NFC.

19 months ago[mlir][Tensor] Apply ClangTidy performance finding (NFC)
Adrian Kuegel [Mon, 5 Dec 2022 10:22:20 +0000 (11:22 +0100)]
[mlir][Tensor] Apply ClangTidy performance finding (NFC)

19 months ago[AArch64][SVE2] Add patterns for eor3
Tiehu Zhang [Mon, 5 Dec 2022 07:50:30 +0000 (15:50 +0800)]
[AArch64][SVE2] Add patterns for eor3

Add patterns for:
    eor x, (eor y, z) -> eor3 x, y, z

Reviewed By: dmgreen, sdesmalen
Differential Revision: https://reviews.llvm.org/D138793

19 months ago[NFC][clang] Strengthen checks in matrix-type-operators.c
John McIver [Mon, 5 Dec 2022 10:13:18 +0000 (10:13 +0000)]
[NFC][clang] Strengthen checks in matrix-type-operators.c

* Add tbaa attribute checks
* Add end-of-line check to load instructions

19 months ago[NFC][clang] Strengthen checks in matrix-type-operators.cpp
John McIver [Mon, 5 Dec 2022 10:12:08 +0000 (10:12 +0000)]
[NFC][clang] Strengthen checks in matrix-type-operators.cpp

* Add tbaa attribute checks
* Add end-of-line check to load instructions

19 months ago[flang][NFC] Remove implemented TODOs
Valentin Clement [Mon, 5 Dec 2022 09:32:08 +0000 (10:32 +0100)]
[flang][NFC] Remove implemented TODOs

19 months ago[Test] Add 2 more simplified test with missing opts
Max Kazantsev [Mon, 5 Dec 2022 08:56:23 +0000 (15:56 +0700)]
[Test] Add 2 more simplified test with missing opts

These are simplified versions of one existing test, but we cannot deal
with them either.

19 months ago[flang] Pointer assignment with remapping involcing polymorphic entities
Valentin Clement [Mon, 5 Dec 2022 08:35:50 +0000 (09:35 +0100)]
[flang] Pointer assignment with remapping involcing polymorphic entities

Lower pointer assignment with remapping involving polymorphic entities
to runtime call to PointerAssociateRemapping.
For the time being all pointer assignment involcing polymorphic entities are
done with the runtime call. When lhs is not unlimited polymorphic
we might be able to do it inlined as well.

Reviewed By: jeanPerier, PeteSteinfeld

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

19 months ago[LAA] Use cross-iteration alias analysis
Nikita Popov [Mon, 14 Nov 2022 15:13:51 +0000 (16:13 +0100)]
[LAA] Use cross-iteration alias analysis

LAA analyzes cross-iteration memory dependencies, as such AA should
not make assumptions about equality of values inside the loop, as
they may come from different iterations.

Fix this by exposing the MayBeCrossIteration AA flag and enabling
it for LAA.

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

19 months ago[mlir][tensor] Fold rank-reducing insert_slice with inverse collapse_shape
Matthias Springer [Mon, 5 Dec 2022 08:16:05 +0000 (09:16 +0100)]
[mlir][tensor] Fold rank-reducing insert_slice with inverse collapse_shape

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

19 months ago[mlir][tensor] Fold rank-reducing extract_slice with inverse expand_shape
Matthias Springer [Mon, 5 Dec 2022 08:15:52 +0000 (09:15 +0100)]
[mlir][tensor] Fold rank-reducing extract_slice with inverse expand_shape

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

19 months ago[LegacyPM] Remove dead declarations
Fangrui Song [Mon, 5 Dec 2022 08:09:23 +0000 (08:09 +0000)]
[LegacyPM] Remove dead declarations

19 months ago[flang] Lower function return to HLFIR
Jean Perier [Mon, 5 Dec 2022 08:05:37 +0000 (09:05 +0100)]
[flang] Lower function return to HLFIR

The only special thing that is needed is to update the bridge symbol
lookup to deal with the HLFIR symbol lookup (symbols are mapped to
fir::FortranVariableInterface operations, not Fortran::Lower::SymbolBox).

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

19 months ago[PowerPC] Remove unused MacOSX check
Fangrui Song [Mon, 5 Dec 2022 07:54:11 +0000 (07:54 +0000)]
[PowerPC] Remove unused MacOSX check

PPC Darwin support was removed long ago.

19 months ago[LegacyPM] Remove AnnotationRemarksLegacyPass
Fangrui Song [Mon, 5 Dec 2022 07:51:17 +0000 (07:51 +0000)]
[LegacyPM] Remove AnnotationRemarksLegacyPass

Following recent changes to remove non-core features of the legacy
PM/optimization pipeline. This is a new pass (2020-11) to generate remarks from
!annotation metadata (e.g. -ftrivial-auto-var-init=).

19 months ago[PowerPC] Use default attributes for intrinsics
Nikita Popov [Tue, 8 Nov 2022 11:26:34 +0000 (12:26 +0100)]
[PowerPC] Use default attributes for intrinsics

This switches a large subset of PowerPC intrinsics to use default
attributes (nosync, nofree, nocallback and willreturn). In
particular the presence of willreturn is important to avoid
optimization regression in the future.

This patch primarily covers readnone/readonly intrinsics.

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

19 months ago[llvm-c] Remove C API functions that are incompatible with opaque pointers
Nikita Popov [Wed, 5 Oct 2022 15:13:25 +0000 (17:13 +0200)]
[llvm-c] Remove C API functions that are incompatible with opaque pointers

These deprecated functions are incompatible with opaque pointers,
and have replacements that accept an explicit type. Drop them now
as a final warning to consumers of the C API to migrate their code
(while LLVMGetElementType still exists as a temporary workaround).

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