platform/upstream/llvm.git
18 months ago[NFC][DAG] Move `getOpcode_EXTEND*()` helpers from X86 into SelectionDAG
Roman Lebedev [Wed, 4 Jan 2023 21:06:41 +0000 (00:06 +0300)]
[NFC][DAG] Move `getOpcode_EXTEND*()` helpers from X86 into SelectionDAG

To be used in an upcoming patch.

18 months ago[NFC][X86] Make vec_anyext.ll test non-useless
Roman Lebedev [Wed, 4 Jan 2023 20:06:20 +0000 (23:06 +0300)]
[NFC][X86] Make vec_anyext.ll test non-useless

18 months ago[MLIR][TOSA] Switch Tosa_IntArrayAttr[N], Tosa_IntArrayAttrUpto[N] to DenseI64ArrayAttr
Alexander Shaposhnikov [Wed, 4 Jan 2023 21:50:46 +0000 (21:50 +0000)]
[MLIR][TOSA] Switch Tosa_IntArrayAttr[N], Tosa_IntArrayAttrUpto[N] to DenseI64ArrayAttr

Switch Tosa_IntArrayAttr[N], Tosa_IntArrayAttrUpto[N] to DenseI64ArrayAttr.

Test plan: ninja check-mlir check-all

Differential revision: https://reviews.llvm.org/D140748 https://reviews.llvm.org/D140829, https://reviews.llvm.org/D140832, https://reviews.llvm.org/D140833, https://reviews.llvm.org/D140834

18 months agoDon't read off end of GPR register array to access fp/sp/lr/pc
Jason Molenda [Wed, 4 Jan 2023 21:48:10 +0000 (13:48 -0800)]
Don't read off end of GPR register array to access fp/sp/lr/pc

The arm64 register context on Darwin has the 29 general purpose
registers, then pc/sp/lr/fp with different field names depending
on compile-time flags.  Instead of accessing beyond the end of
the uint64_t[29] array, and upsetting the sanitizers, access those
registers correctly with the correct name.

Fixes a test failure on the ASAN CI bot, currently being
skipped, in TestEarlyProcessLaunch.py.

Differential Revision: https://reviews.llvm.org/D140067
rdar://103359354

18 months ago[DWARF] Store CFA value on DW_CFA_remember_state
Alexis Engelke [Wed, 4 Jan 2023 21:51:14 +0000 (13:51 -0800)]
[DWARF] Store CFA value on DW_CFA_remember_state

Previously, CFA_remember_state stored only the register locations but ignored the CFA value. This needs also to be remembered and restored for correct behavior. The problem occurs, e.g., on functions with multiple epilogues, where the CFA value after the first epilogue is becomes wrong.

Reviewed By: #debug-info, MaskRay

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

18 months agoRevert "[VPlan] Also consider operands of sink candidates in same block."
Augie Fackler [Wed, 4 Jan 2023 21:17:13 +0000 (16:17 -0500)]
Revert "[VPlan] Also consider operands of sink candidates in same block."

This reverts commit aa2414729ebbcb2d8f162e9002a3a6aa768b1f9d.

Previously-valid IR from a tensorflow test case (as shown on the
Diffusion revision for aa2414729ebbcb2d8f162e9002a3a6aa768b1f9d) started
hanging in the loop-vectorize pass. Reverting to keep everyone working.

18 months ago[SLP]Fix incorrect shuffle results because of missing shuffle mask
Alexey Bataev [Wed, 4 Jan 2023 16:32:25 +0000 (08:32 -0800)]
[SLP]Fix incorrect shuffle results because of missing shuffle mask
analysis.

Missed the analysis of the shuffle mask when trying to analyze the
operands of the shuffle instruction during peeking through shuffle
instructions.

18 months ago[MLIR][Tensor] Canonicalize expand/collapse_shape of splat to splat
liqinweng [Wed, 4 Jan 2023 21:05:57 +0000 (13:05 -0800)]
[MLIR][Tensor] Canonicalize expand/collapse_shape of splat to splat

Collapsing / expanding a splatted value can be replaced with a single `tensor.splat` operation. Replace
these cases with a simple `tensor.splat` operation.

Reviewed By: rsuderman

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

18 months ago[mlir][sparse] Move some member functions from SparseTensorDescriptorImpl to MutSpars...
bixia1 [Wed, 4 Jan 2023 19:35:45 +0000 (11:35 -0800)]
[mlir][sparse] Move some member functions from SparseTensorDescriptorImpl to MutSparseTensorDescriptor.

This is to prepare for implementing AOS optimization.

Reviewed By: aartbik

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

18 months agoApply clang-tidy fixes for llvm-else-after-return in GPUToSPIRV.cpp (NFC)
Mehdi Amini [Tue, 3 Jan 2023 11:12:42 +0000 (11:12 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in GPUToSPIRV.cpp (NFC)

18 months ago[mlir][tosa] Fix floating point offset for tosa.resize
Robert Walker [Wed, 4 Jan 2023 19:26:12 +0000 (11:26 -0800)]
[mlir][tosa] Fix floating point offset for tosa.resize

Offset is a signed value, so use `arith.sitofp`

See also https://github.com/llvm/llvm-project/issues/59585

Reviewed By: NatashaKnk, jpienaar

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

18 months agoRevert "[Sema] Don't mark deleted special member functions as non-trivial"
Roy Jacobson [Wed, 4 Jan 2023 20:39:04 +0000 (22:39 +0200)]
Revert "[Sema] Don't mark deleted special member functions as non-trivial"

This reverts commit d5dd37ac139a74701e16f084eb2609ff58893770.

Apparently there's some ABI difference in the Sony builder that fails a test.
Will hopefully investigate tomorrow. https://lab.llvm.org/buildbot/#/builders/139/builds/33769

18 months ago[LowerTypeTests] Add ENDBR to .cfi.jumptable for x86 Indirect Branch Tracking
Fangrui Song [Wed, 4 Jan 2023 20:28:07 +0000 (12:28 -0800)]
[LowerTypeTests] Add ENDBR to .cfi.jumptable for x86 Indirect Branch Tracking

Similar to D81251 for AArch64 BTI. This fixes `./a.out test` for

```
void foo(void) {}
void bar(void) {}
static void (*fptr)(void);
int main(int argc, char **argv) {
  if (argv[1]) fptr = foo;
  else fptr = bar;
  fptr();
}
```

`clang -flto=thin -fvisibility=hidden -fsanitize=cfi-icall -fcf-protection=branch -fuse-ld=lld a.cc`

Reviewed By: tejohnson

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

18 months ago[X86] Regen a couple tests so they are autogen clean [nfc]
Philip Reames [Wed, 4 Jan 2023 20:08:59 +0000 (12:08 -0800)]
[X86] Regen a couple tests so they are autogen clean [nfc]

These appear to have had 32 bit check lines manually deleted - presumably since the checks are verbose.  Please don't do this!  Split the test file if you want, but manually deleting test lines makes the diffs for later autogen changes really confusing.

18 months ago[mlir][sparse] add test that combines sparse codegen and lowering to llvm struct
Aart Bik [Wed, 4 Jan 2023 19:33:51 +0000 (11:33 -0800)]
[mlir][sparse] add test that combines sparse codegen and lowering to llvm struct

Reviewed By: bixia

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

18 months ago[sanitizer] Move {,__}pthread_mutex_{lock,unlock} interceptors to tsan
Fangrui Song [Wed, 4 Jan 2023 20:04:19 +0000 (12:04 -0800)]
[sanitizer] Move {,__}pthread_mutex_{lock,unlock} interceptors to tsan

These interceptors are pure forwarders for other sanitizers. Move them beside
tsan-specific pthread_mutex_{trylock,timedlock} interceptors.

While here, guard `__pthread_mutex_{lock,unlock}` (D46793) under `#if !__GLIBC_PREREQ(2, 34)`.

In glibc>=2.34 [1], `__pthread_mutex_{lock,unlock}` only have non-default-version definitions
(unversioned `__pthread_mutex_lock` causes a linker error. Program preloading is not expected).
In glibc>=2.36 [2], `dlsym(RTLD_NEXT, "__pthread_mutex_lock")` returns nullptr, so the interceptor won't work.

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

[1]: https://sourceware.org/git/?p=glibc.git;a=commit;h=99f841c441feeaa9a3d97fd91bb3d6ec8073c982
[2]: https://sourceware.org/git/?p=glibc.git;a=commit;h=efa7936e4c91b1c260d03614bb26858fbb8a0204

Reviewed By: melver, vitalybuka

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

18 months ago[llvm][CUDA] Allow NVVMREflect to process OpenCL-specific __nvvm_reflect_ocl()
Hugh Delaney [Wed, 4 Jan 2023 19:52:08 +0000 (11:52 -0800)]
[llvm][CUDA] Allow NVVMREflect to process OpenCL-specific __nvvm_reflect_ocl()

OpenCL requires constant string arguments to be in a particular address space,
so OpenCL sources can't use the regular `__nvvm_reflect()`.

Allow NVVMReflect pass to accept an Open_CL specific variant with a constant
string in a non-default address space.

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

18 months ago[X86] Autogen tests for ease of update in upcoming change [nfc]
Philip Reames [Wed, 4 Jan 2023 19:59:05 +0000 (11:59 -0800)]
[X86] Autogen tests for ease of update in upcoming change [nfc]

18 months agollvm-objdump: Fix --build-id documentation string
Roland McGrath [Wed, 4 Jan 2023 19:39:51 +0000 (11:39 -0800)]
llvm-objdump: Fix --build-id documentation string

The argument is hex digits, so <dir> doesn't make a lot of sense.

Reviewed By: phosek

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

18 months agoRevert "[clang] Add the check of membership in decltype for the issue #58674#"
Erich Keane [Wed, 4 Jan 2023 19:43:40 +0000 (11:43 -0800)]
Revert "[clang] Add the check of membership in decltype for the issue #58674#"

This reverts commit 85960043d594fc12d340ccb66a30861b023ab496.

The powerpc64le self-built buildbot had an assertion during self-build,
that seems like it is possibly related here, reverting so the author can
take a look.

18 months ago[DAG] `tryToFoldExtendOfConstant()`: `sext undef` is not `undef`
Roman Lebedev [Wed, 4 Jan 2023 19:31:33 +0000 (22:31 +0300)]
[DAG] `tryToFoldExtendOfConstant()`: `sext undef` is not `undef`

https://alive2.llvm.org/ce/z/cLGpWV, but https://alive2.llvm.org/ce/z/TGNH4P

18 months ago[X86] Autogen tests for ease of update in upcoming change [nfc]
Philip Reames [Wed, 4 Jan 2023 19:30:42 +0000 (11:30 -0800)]
[X86] Autogen tests for ease of update in upcoming change [nfc]

18 months ago[Sema] Don't mark deleted special member functions as non-trivial
Roy Jacobson [Sun, 25 Dec 2022 21:48:13 +0000 (23:48 +0200)]
[Sema] Don't mark deleted special member functions as non-trivial

As noted in https://github.com/llvm/llvm-project/issues/59624, we sometimes mark implicitly
deleted special member functions as non-trivial. This is unnecessary work and leads to some
weird type traits errors.

This fixes the problem by making the implicitly deleted special member functions always
trivial.

Reviewed By: #clang-language-wg, erichkeane

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

18 months ago[mlir][spirv] Relax instruction order checks in test
Jakub Kuderski [Wed, 4 Jan 2023 19:06:47 +0000 (14:06 -0500)]
[mlir][spirv] Relax instruction order checks in test

Fix a windows buildbot failure: https://lab.llvm.org/buildbot#builders/13/builds/30439.

18 months ago[PowerPC] Materialize floats in the range [-16.0, 15.0].
Stefan Pintilie [Wed, 21 Dec 2022 14:47:55 +0000 (08:47 -0600)]
[PowerPC] Materialize floats in the range [-16.0, 15.0].

Previous to this patch we only materialized 0.0 and all other floating point
values would be loaded from the TOC. This patch adds materialization for the
floating point values that can be represented as integers in [-16.0, 15.0].

For example we will now materialize 3.0 and -5.0 but not 4.7.

Reviewed By: nemanjai, lei, #powerpc

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

18 months ago[MachineCombine] Reorganize code for readability and tracing [nfc]
Philip Reames [Wed, 4 Jan 2023 18:45:56 +0000 (10:45 -0800)]
[MachineCombine] Reorganize code for readability and tracing [nfc]

18 months ago[SLP][NFC]Add a pass.
Alexey Bataev [Wed, 4 Jan 2023 18:26:53 +0000 (10:26 -0800)]
[SLP][NFC]Add a pass.

18 months ago[mlir][spirv] Add pattern to expand UMulExtended for WebGPU
Jakub Kuderski [Wed, 4 Jan 2023 18:29:46 +0000 (13:29 -0500)]
[mlir][spirv] Add pattern to expand UMulExtended for WebGPU

This is needed because WGSL does not yet support extended multiplication
ops.

Set up pattern/pass stuff and handle the first op: `UMulExtended`.
`SMulExtended` handling will go to a separate patch.

Issue: https://github.com/llvm/llvm-project/issues/59563

Reviewed By: antiagainst

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

18 months ago[SLP][NFC]Add a test for incorrect skipping of shuffle instruction at
Alexey Bataev [Wed, 4 Jan 2023 18:11:47 +0000 (10:11 -0800)]
[SLP][NFC]Add a test for incorrect skipping of shuffle instruction at
peek-through-shuffles, NFC.

18 months ago[exegesis] Analysis: filtering for benchmark results
Roman Lebedev [Wed, 4 Jan 2023 18:13:48 +0000 (21:13 +0300)]
[exegesis] Analysis: filtering for benchmark results

By default, all benchmark results are analysed, but sometimes it may be useful
to only look at those that to not involve memory, or vice versa. This option
allows to either keep all benchmarks, or filter out (ignore) either all the
ones that do involve memory (involve instructions that may read or write to
memory), or the opposite, to only keep such benchmarks.

Personally, so far i have found the benchmarks that do involve memory
to have dubious results. But the ones that do not involve memory,
are generally actionable. So i would like to have a toggle to declutter results.

Reviewed By: courbet

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

18 months ago[Codegen][X86] `LowerBUILD_VECTOR()`: improve lowering w/ multiple FREEZE-UNDEF ops
Roman Lebedev [Wed, 4 Jan 2023 17:43:42 +0000 (20:43 +0300)]
[Codegen][X86] `LowerBUILD_VECTOR()`: improve lowering w/ multiple FREEZE-UNDEF ops

While we have great handling for UNDEF operands,
FREEZE-UNDEF operands are effectively normal operands.

We are better off "interleaving" such BUILD_VECTORS into a blend
between a splat of FREEZE-UNDEF, and "thawed" source BUILD_VECTOR,
both of which are more natural for us to handle.

Refs. https://github.com/llvm/llvm-project/commit/f738ab9075f838dd4365adf3a92ca1acced114d7#r95017306

18 months ago[NFC][X86] Add few more tests for freezing BUILD_VECTOR
Roman Lebedev [Wed, 4 Jan 2023 17:34:24 +0000 (20:34 +0300)]
[NFC][X86] Add few more tests for freezing BUILD_VECTOR

18 months ago[OpenMP][JIT] Introduce support for AMDGPU
Johannes Doerfert [Wed, 28 Dec 2022 06:31:28 +0000 (22:31 -0800)]
[OpenMP][JIT] Introduce support for AMDGPU

To JIT kernels for AMDGPUs we need to provide the architecture, the
triple, and a post-link callback. The first two are simple, the last one
is a little more complicated since we need to invoke `lld`. There is
some library interface but for that we need the lld library, which is
not generally available, thus we go with the executable for now. In
either way we need to manifest the (amdgcn) object file and read the
output from another file. We should try to avoid that in the future.
The options for `lld` are copied from the way clang invokes it.

Reviewed By: tianshilei1992

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

18 months ago[InstCombine] don't let 'exact' inhibit demanded bits folds for udiv
Sanjay Patel [Wed, 4 Jan 2023 17:43:30 +0000 (12:43 -0500)]
[InstCombine] don't let 'exact' inhibit demanded bits folds for udiv

We shouldn't penalize instructions that have extra flags.

Drop the poison-generating flags if needed instead of bailing out.
This makes canonicalization/optimization more uniform.

There is a chance that dropping flags will cause some
other transform to not fire, but we added a preliminary
patch to avoid that with:
f0faea571403

See D140665 for more details.

18 months ago[SelectionDAG][GlobalISel] Don't use UnsignedDivisionByConstantInfo for divisor of 1.
Craig Topper [Wed, 4 Jan 2023 02:36:14 +0000 (18:36 -0800)]
[SelectionDAG][GlobalISel] Don't use UnsignedDivisionByConstantInfo for divisor of 1.

The magic algorithm sets IsAdd indication for division by 1 that
the caller had to ignore.

I considered folding the ignore into UnsignedDivisionByConstantInfo,
but we only allow 1 for vectors of mixed visiors. And really what we
want to end up with is undef. Currently, we get to undef via
DemandedElts optimizations using the select instruction. We could
directly emit undef.

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

18 months ago[ConstraintElim] Enable pass by default.
Florian Hahn [Wed, 4 Jan 2023 18:00:36 +0000 (18:00 +0000)]
[ConstraintElim] Enable pass by default.

The pass should help to close a functional gap when it comes to
reasoning about related conditions in a relatively general way.

It addresses multiple existing issues (linked below) and the need for a
more powerful reasoning system was also discussed recently in
https://discourse.llvm.org/t/rfc-alternative-approach-of-dealing-with-implications-from-comparisons-through-pos-analysis/65601/7

On AArch64, the new pass performs ~2000 simplifications on
MultiSource,SPEC2006,SPEC2017 with -O3.

Compile-time impact:

NewPM-O3: +0.20%
NewPM-ReleaseThinLTO: +0.32%
NewPM-ReleaseLTO-g: +0.28%

https://llvm-compile-time-tracker.com/compare.php?from=f01a3a893c147c1594b9a3fbd817456b209dabbf&to=577688758ef64fb044215ec3e497ea901bb2db28&stat=instructions:u

Fixes #49344.
Fixes #47888.
Fixes #48253.
Fixes #49229.
Fixes #58074.

Reviewed By: asbirlea

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

18 months ago[mlir][sparse] minor code layout edits
Aart Bik [Wed, 4 Jan 2023 02:06:54 +0000 (18:06 -0800)]
[mlir][sparse] minor code layout edits

Reviewed By: bixia

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

18 months ago[AMDGPU] Unify divergent nodes if the PostDom tree has one root
Anshil Gandhi [Wed, 4 Jan 2023 17:10:40 +0000 (10:10 -0700)]
[AMDGPU] Unify divergent nodes if the PostDom tree has one root

This patch allows AMDGPUUnifyDivergenceExitNodes pass
to transform a function whose PDT has exactly one root
and ends in a branch instruction. Fixes
https://github.com/llvm/llvm-project/issues/58861.

Reviewed By: ruiling, arsenm

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

18 months ago[lld-macho][nfc] Re-enable previously disabled test.
Vy Nguyen [Wed, 4 Jan 2023 14:43:34 +0000 (09:43 -0500)]
[lld-macho][nfc] Re-enable previously disabled test.

This check was previous disabled because the test kept failing on ARM64. The output from reported failure message
gave the impression that the bundle was created as an x86-64 bundle but upon further inspection, I believe that's
a bug in llvm-otool where it prints both -h and -f for both input files on ARM64.

So the "fix" here is to rewrite the test to run the two otool commands separately but concatenate the
output into one file for checking.

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

18 months ago[NFC] Update parseDimensionList comments for dynamic size from -1 to kDynamic
Kevin Gleason [Wed, 4 Jan 2023 17:09:27 +0000 (18:09 +0100)]
[NFC] Update parseDimensionList comments for dynamic size from -1 to kDynamic

Comment is stale now that kDynamic is defined as intmin instead of -1.

Confirmed that implementation in `parseDimensionListRanked` uses kDynamic.

Reviewed By: ftynse

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

18 months agoFix to D140567
Blue Gaston [Wed, 4 Jan 2023 16:49:34 +0000 (09:49 -0700)]
Fix to D140567

18 months ago[NFC] Autogenerate CodeGen/X86/sdiv-pow2.ll
Amaury Séchet [Wed, 4 Jan 2023 16:43:47 +0000 (16:43 +0000)]
[NFC] Autogenerate CodeGen/X86/sdiv-pow2.ll

18 months agoIROutliner: Fix assert with non-0 alloca addrspace
Matt Arsenault [Wed, 4 Jan 2023 16:07:34 +0000 (11:07 -0500)]
IROutliner: Fix assert with non-0 alloca addrspace

The arguments are passed as stored to new allocas so the address space
needs to match.

18 months ago[LoopVectorize] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 16:18:17 +0000 (17:18 +0100)]
[LoopVectorize] Convert some tests to opaque pointers (NFC)

Check lines for some of these tests were regenerated. The difference
is that with opaque pointers SCEVExpander always emits i8 GEPs,
making the address calculation explicit. This is a known problem
that will be solved long term by making all address calculations
explicit.

18 months ago[LoopVersioningLICM] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 16:13:32 +0000 (17:13 +0100)]
[LoopVersioningLICM] Convert tests to opaque pointers (NFC)

18 months ago[mlir][llvm] Modernize the import of LLVM IR globals.
Tobias Gysi [Wed, 4 Jan 2023 16:04:14 +0000 (17:04 +0100)]
[mlir][llvm] Modernize the import of LLVM IR globals.

Return failure if the import of a global variable fails and add a
test case to check the emitted error message. Additionally, convert
the globals in iteration order and do not process them recursively
when translating a constant expression referencing it. Additionally,
use the module location rather unknown location.

Reviewed By: Dinistro

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

18 months ago[LowerTypeTests] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 16:09:46 +0000 (17:09 +0100)]
[LowerTypeTests] Convert tests to opaque pointers (NFC)

18 months ago[MakeGuardsExplicit] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 16:09:13 +0000 (17:09 +0100)]
[MakeGuardsExplicit] Convert test to opaque pointers (NFC)

18 months ago[MergeFunc] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 16:05:13 +0000 (17:05 +0100)]
[MergeFunc] Convert tests to opaque pointers (NFC)

18 months ago[MergeICmps] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 16:03:43 +0000 (17:03 +0100)]
[MergeICmps] Convert tests to opaque pointers (NFC)

18 months ago[MetaRenamer] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 16:02:50 +0000 (17:02 +0100)]
[MetaRenamer] Convert tests to opaque pointers (NFC)

18 months ago[OpenMP] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:46:03 +0000 (16:46 +0100)]
[OpenMP] Convert some tests to opaque pointers (NFC)

18 months ago[NFC] Regenerate reduction-inloop.ll check lines. NFC
David Green [Wed, 4 Jan 2023 16:02:20 +0000 (16:02 +0000)]
[NFC] Regenerate reduction-inloop.ll check lines. NFC

18 months ago[llgdb-tests] Convert test to check 'target=...'
Paul Robinson [Wed, 4 Jan 2023 15:56:37 +0000 (07:56 -0800)]
[llgdb-tests] Convert test to check 'target=...'

Part of the project to eliminate special handling for triples in lit
expressions.

18 months ago[clang] Add the check of membership in decltype for the issue #58674#
Liming Liu [Wed, 4 Jan 2023 15:46:03 +0000 (07:46 -0800)]
[clang] Add the check of membership in decltype for the issue #58674#

Originally, the code would take a lookup result as a member in the
current scope and build a member expression accordingly, if the lookup
result was not an operand of the address operator, or it was a field
declaration. However, a field declaration may come from another class,
and cause the issue #58674.

Thus, this patch fixes the issue via checking where does the field
declaration comes from, and if it comes from another class, then marks
it as not member in the current scope. The parent scopes of the current
scope are also checked, as the current scope may be associated to a
lambda or friend declaration.

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

18 months ago[NewGVN] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:43:14 +0000 (16:43 +0100)]
[NewGVN] Convert some tests to opaque pointers (NFC)

18 months ago[Reg2Mem] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:42:45 +0000 (16:42 +0100)]
[Reg2Mem] Convert test to opaque pointers (NFC)

18 months ago[SLPVectorizer] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:39:32 +0000 (16:39 +0100)]
[SLPVectorizer] Convert test to opaque pointers (NFC)

18 months ago[mlir][sparse] Add layout to the memref for the indices buffers to prepare for the...
bixia1 [Tue, 3 Jan 2023 23:16:12 +0000 (15:16 -0800)]
[mlir][sparse] Add layout to the memref for the indices buffers to prepare for the AOS storage optimization for COO regions.

Fix relevant FileCheck tests.

Reviewed By: aartbik

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

18 months ago[SLPVectorizer] Name instructions in test (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:35:45 +0000 (16:35 +0100)]
[SLPVectorizer] Name instructions in test (NFC)

18 months ago[SLPVectorizer] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:32:48 +0000 (16:32 +0100)]
[SLPVectorizer] Convert some tests to opaque pointers (NFC)

18 months ago[SCCP] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:30:34 +0000 (16:30 +0100)]
[SCCP] Convert test to opaque pointers (NFC)

18 months agoFix the LLVM sphinx build
Aaron Ballman [Wed, 4 Jan 2023 15:29:43 +0000 (10:29 -0500)]
Fix the LLVM sphinx build

This should address the issue found in:
https://lab.llvm.org/buildbot/#/builders/30/builds/30330

18 months agoCoroFrame: Put escaped variables with multiple lifetimes on coroutine frame
Matthias Braun [Fri, 16 Dec 2022 15:21:41 +0000 (07:21 -0800)]
CoroFrame: Put escaped variables with multiple lifetimes on coroutine frame

The llvm.lifetime.start intrinsic guarantees that the address for a
given alloca is always the same. So variables with escaped addresses
reaching reaching a lifetime start/end block before and after a suspend
must be placed onto the coroutine frame even if the variable itself
is not alive across the suspend point.

This computes a new `LoopKill` flag in the suspend crossing data flow
anaysis to catch the case where a lifetime marker can reach itself
via suspend-crossing path.

This fixes https://llvm.org/PR52501

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

18 months ago[SimpleLoopUnswitch] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:28:13 +0000 (16:28 +0100)]
[SimpleLoopUnswitch] Convert tests to opaque pointers (NFC)

18 months ago[SimplifyCFG] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:27:23 +0000 (16:27 +0100)]
[SimplifyCFG] Convert some tests to opaque pointers (NFC)

18 months ago[libc][NFC] Remove unused variable
Guillaume Chatelet [Wed, 4 Jan 2023 15:25:48 +0000 (15:25 +0000)]
[libc][NFC] Remove unused variable

18 months ago[TypePromotion] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:26:13 +0000 (16:26 +0100)]
[TypePromotion] Convert tests to opaque pointers (NFC)

18 months ago[Annotation2Metadata] Support opaque pointers
Nikita Popov [Wed, 4 Jan 2023 15:21:56 +0000 (16:21 +0100)]
[Annotation2Metadata] Support opaque pointers

Strip pointer casts instead of matching specific constant
expressions.

18 months ago[UnifyLoopExits] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:13:56 +0000 (16:13 +0100)]
[UnifyLoopExits] Convert test to opaque pointers (NFC)

18 months ago[WebAssembly] Replace LOAD_SPLAT with SPLAT_VECTOR
Luke Lau [Mon, 12 Dec 2022 19:53:27 +0000 (19:53 +0000)]
[WebAssembly] Replace LOAD_SPLAT with SPLAT_VECTOR

Splats were selected by matching on uses of `build_vector` with
identical elements, but a while back a target independent node for
vector splatting was added.
This removes the WebAssembly specific LOAD_SPLAT intrinsic, and instead
makes SPLAT_VECTOR legal and adds patterns for splat loads.

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

18 months ago[Driver] Convert test to check 'target=...'
Paul Robinson [Wed, 4 Jan 2023 14:41:59 +0000 (06:41 -0800)]
[Driver] Convert test to check 'target=...'

Part of the project to eliminate special handling for triples in lit
expressions.

18 months ago[ConstraintElim] Add option to limit number of rows tracked in system.
Florian Hahn [Wed, 4 Jan 2023 13:59:22 +0000 (13:59 +0000)]
[ConstraintElim] Add option to limit number of rows tracked in system.

Once the constraint system grows too large in terms of number of rows,
queries can become very slow. This patch adds a new option to limit the
number of rows tracked.

The python script below can be used to generate worst-case IR with a
chain of conditional branches with N branches.

With this limit, we get the following runtimes:
* python3 generate.py 100:   0.1s
* python3 generate.py 1000:  2s
* python3 generate.py 10000: 4s

Without the limit, the case with 1000 chained conditions takes 20+
seconds.

generate.py:
    import sys

    N = int(sys.argv[1])

    args = []
    checks = []

    for i in range(0, N):
        args.append('i32 %l{}'.format(i))
        checks.append("""
    bb{0}:
      %c{0} = icmp uge i32 %l{0}, 100
      br i1 %c{0}, label %bb{1}, label %exit
    """.format(i, i+1))

    print("""
    define i1 @foo({0}) {{
    {1}

    bb{2}:
      %c{2} = icmp uge i32 %l0, 100
      ret i1 %c{2}

    exit:
      ret i1 false
    }}
    """.format(' ,'.join(args), '\n'.join(checks), N))

Reviewed By: nikic

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

18 months ago[MC] Consistently use MCInstrDesc::getImplicitUses and getImplicitDefs. NFC.
Jay Foad [Wed, 4 Jan 2023 13:15:09 +0000 (13:15 +0000)]
[MC] Consistently use MCInstrDesc::getImplicitUses and getImplicitDefs. NFC.

18 months ago[AArch64] Alter arm_neon_sve_bridge.h to be target-based, not preprocessor based.
David Green [Wed, 4 Jan 2023 13:09:26 +0000 (13:09 +0000)]
[AArch64] Alter arm_neon_sve_bridge.h to be target-based, not preprocessor based.

Similar to D131064, this alters the arm_neon_sve_bridge.h header to use
target-based intrinsics that give an error if used in a function that
does not have the sve features, but are not preprocessed out. This
header is simpler than the arm_sve.h and other headers, not including
any tablegen'd content. The main change is altering the builtin
definitions from using BUILTIN to TARGET_BUILTIN.

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

18 months agoMachineIRBuilder.h: Fix typo. NFC
Diana Picus [Wed, 4 Jan 2023 13:07:35 +0000 (14:07 +0100)]
MachineIRBuilder.h: Fix typo. NFC

18 months ago[JITLink][RISCV] Add R_RISCV_RVC_BRANCH and R_RISCV_RVC_JUMP
Jonas Hahnfeld [Sun, 1 Jan 2023 22:08:18 +0000 (23:08 +0100)]
[JITLink][RISCV] Add R_RISCV_RVC_BRANCH and R_RISCV_RVC_JUMP

These are the compressed equivalents of the relocations R_RISCV_BRANCH
and R_RISCV_JAL with slightly more complex immediate handling.

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

18 months ago[clangd] Disable backend-releated filelist compiler options.
Haojian Wu [Wed, 4 Jan 2023 09:42:24 +0000 (10:42 +0100)]
[clangd] Disable backend-releated filelist compiler options.

These options doesn't affect the AST generation, and clang will crash
(CreateOrDie in ASTContext) immedidately when the provided file are not existed.

Disable them in clangd to make clangd more robust.

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

18 months ago[NFC] Add x86 triple to lower-offset-expression.ll
Pavel Kopyl [Wed, 4 Jan 2023 11:56:24 +0000 (14:56 +0300)]
[NFC] Add x86 triple to lower-offset-expression.ll

This prevents failing the test on targets other than X86 that are set
as default when X86 one is also supported.

18 months ago[NVPTX] Replace PTX's ManagedStringPool with StringSaver
Luke Drummond [Tue, 20 Dec 2022 00:57:54 +0000 (00:57 +0000)]
[NVPTX] Replace PTX's ManagedStringPool with StringSaver

In use ManagedStringPool caused a lot of heap allocations. At least one
for every register name lookup in NVPTXTargetRegisterInfo and one for
every symbol lookup in the target machine and isel lowering. There
already exists an llvm/Support string interning-class that has better
memory performance. Use LLVM's and delete ManagedStringPool which was
unique to PTX

llc Binary Size (.text only; bss and data were unchanged):
  MinsizeRel:
    Before: 31219884
    After: 31219796
  Release:
    Before: 42961872
    After: 42960656

Total heap allocations by the NVPTX string saving code running
check-llvm-codegen-nvptx

Total bytes allocated:
  Before: 2431825
  After: 2288151

(All numbers on x86-64-linux-gnu / gcc-12 / lld14)

I didn't see obvious time differences when running the tests.

Reviewers: tra, avasonic
Differential Revision: https://reviews.llvm.org/D140704

18 months ago[runtimes] Only depend on builtins for same target
Shoaib Meenai [Tue, 13 Dec 2022 05:51:14 +0000 (21:51 -0800)]
[runtimes] Only depend on builtins for same target

We don't need to have built all the builtins before building the
runtimes for a particular target, only the builtins for that target.
While I'm here, rename the variable that stores the builtins dep to
something less generic than `deps`, to minimize the chances of
accidentally using a variable with the same name from an outer scope.

Reviewed By: phosek

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

18 months ago[AAPointerInfo] fix assertion at the pass-through use of a pointer
Sameer Sahasrabuddhe [Tue, 3 Jan 2023 05:55:14 +0000 (11:25 +0530)]
[AAPointerInfo] fix assertion at the pass-through use of a pointer

HandlePassthroughUser may sometimes create a new entry for the OffsetInfo of a
user in the OffsetInfoMap. This can invalidate outstanding references into the
map, including the one which needs to be copied into the new entry. This
produces invalid offset info that can trigger assertions.

Fixed this by not using references at this point. The bug was originally
introduced in commit ID 0dc0a441323d41b4860668f38d290579e0de130c.

Reviewed By: ronlieb

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

18 months ago[AArch64] Alter arm_sve.h to be target-based, not preprocessor based.
David Green [Wed, 4 Jan 2023 11:22:20 +0000 (11:22 +0000)]
[AArch64] Alter arm_sve.h to be target-based, not preprocessor based.

This patch makes SVE intrinsics more useable by gating them on the
target, not by ifdef preprocessor macros. See #56480. This alters the
SVEEmitter for arm_sve.h to remove the #ifdef guards and instead use
TARGET_BUILTIN with the correct features so that the existing "'func'
needs target feature sve" error will be generated when sve is not
present.

The ArchGuard containing defines in the SVEEmitter are changed to
TargetGuard containing target features. In the arm_neon.h emitter there
are both existing ArchGuard ifdefs mixed with new TargetGuard target
feature guards, so the name is change in the SVE too for consistency.
The few functions that are present in arm_sve.h (as opposed to builtin
aliases) have __attribute__((target("sve"))) added. Some of the tests
needed to be rejigged a little, as well as updating the error message,
as the error now happens at a later point.

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

18 months ago[ConstraintElim] Remove legacy pass implementation.
Florian Hahn [Wed, 4 Jan 2023 11:21:12 +0000 (11:21 +0000)]
[ConstraintElim] Remove legacy pass implementation.

The pass is exclusively used with the new pass manager now, so remove
the legacy PM implementation.

18 months ago[mlir] Add `test-convergence` option to Canonicalizer tests
Matthias Springer [Wed, 4 Jan 2023 10:39:41 +0000 (11:39 +0100)]
[mlir] Add `test-convergence` option to Canonicalizer tests

This new option is set to `false` by default. It should  be set only in Canonicalizer tests to detect faulty canonicalization patterns. I.e., patterns that prevent the canonicalizer from converging. The canonicalizer should always convergence on such small unit tests that we have in `canonicalize.mlir`.

Two faulty canonicalization patterns were detected and fixed with this change.

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

18 months ago[NFC] let FunctionDecl::isReservedGlobalPlacementOperator return false when the funct...
Chuanqi Xu [Wed, 4 Jan 2023 10:57:33 +0000 (18:57 +0800)]
[NFC] let FunctionDecl::isReservedGlobalPlacementOperator return false when the function decl is not allocation functions

Currently `FunctionDecl::isReservedGlobalPlacementOperator` will crash
if the function is not an allocation/deallocation function, which is
surprising. Also, its semantics is not consistent with
isReplaceableGlobalAllocationFunction, which will return false if the
function is not an allocation/deallocation function.

This patch make FunctionDecl::isReservedGlobalPlacementOperator not
crash if the function is not an allocation/deallocation function, which
is consistent with isReplaceableGlobalAllocationFunction too.

18 months ago[llvm-exegesis] Allow building llvm_exegesis_tests on builtkite
Guillaume Chatelet [Wed, 4 Jan 2023 10:42:43 +0000 (10:42 +0000)]
[llvm-exegesis] Allow building llvm_exegesis_tests on builtkite

18 months ago[gn build] Port ba874483137d
LLVM GN Syncbot [Wed, 4 Jan 2023 10:40:23 +0000 (10:40 +0000)]
[gn build] Port ba874483137d

18 months ago[llvm-exegesis] Remove functional test from unit tests
Guillaume Chatelet [Tue, 3 Jan 2023 16:17:30 +0000 (16:17 +0000)]
[llvm-exegesis] Remove functional test from unit tests

As discussed offline, let's remove this one as it's hard to test on the build bots.

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

18 months ago[mlir][llvm] Support importing magic globals
Christian Ulmann [Wed, 4 Jan 2023 10:16:11 +0000 (11:16 +0100)]
[mlir][llvm] Support importing magic globals

This commit adds support for importing the magic globals "global_ctors"
and "global_dtors" from LLVM IR to the LLVM IR dialect. The import
fails when these globals have a non-null data pointer, as this can
currently not be represented in the corresponding MLIR operations.

Reviewed By: gysit

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

18 months ago[mlir][affine][NFC] Extract core functionality of `canonicalizeMinMaxOp`
Matthias Springer [Wed, 4 Jan 2023 09:56:43 +0000 (10:56 +0100)]
[mlir][affine][NFC] Extract core functionality of `canonicalizeMinMaxOp`

Move code from SCF to Affine: Add a new helper function `simplifyConstrainedMinMaxOp` to Affine/Analysis/Utils.h. `canonicalizeMinMaxOp` was originally designed for loop peeling, but it is not SCF-specific and can be used to simplify any affine.min/max ops.

Various functions in SCF/Transforms are simplified by dropping unnecessary parameters.

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

18 months ago[mlir] Allow overriding AbstractDenseDataFlowAnalysis::visitOperation
Tom Eccles [Fri, 23 Dec 2022 21:03:14 +0000 (21:03 +0000)]
[mlir] Allow overriding AbstractDenseDataFlowAnalysis::visitOperation

AbstractDenseDataFlowAnalysis::visitOperation controls how the dataflow
analysis proceeds around control flow. In particular, conservative
assumptions are made about call operations which can prevent some
analysis from succeeding.

The motivating case for this change is https://reviews.llvm.org/D140415,
for which it is correct and necessary for the lattice to be preserved
after call operations.

Some renaming was necessary to avoid confusion with
DenseDataFlowAnalysis::visitOperation.
AbstractDenseDataFlowAnalysis::visitRegionBranchOperation and
DenseDataFlowAnalysis::visitOperationImpl are also made protected
to allow implementation of AbstractDenseDataFlowAnalysis::visitOperation,
although I did not need these to be virtual.

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

18 months ago[InstCombine] add more tests into select-factorize; NFC
chenglin.bi [Wed, 4 Jan 2023 09:49:40 +0000 (17:49 +0800)]
[InstCombine] add more tests into select-factorize; NFC

18 months ago[clang-tidy] Don't emit misc-unused-using-decl warnings for header files.
Haojian Wu [Mon, 2 Jan 2023 11:04:49 +0000 (12:04 +0100)]
[clang-tidy] Don't emit misc-unused-using-decl warnings for header files.

Using decls in header files are special, usually as part of the
public API, the check should not emit warnings on these.

The check already detects unused using-decls which are in the current main
file, but if the main file happens to be a header file, we still
emit warnings, this patch suppresses that.

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

18 months ago[Instcombine] Regenerate tests for logical-select; NFC
chenglin.bi [Wed, 4 Jan 2023 08:31:42 +0000 (16:31 +0800)]
[Instcombine] Regenerate tests for logical-select; NFC

18 months ago[libcxx] Fix build with GLIBC
Vitaly Buka [Wed, 4 Jan 2023 03:30:43 +0000 (19:30 -0800)]
[libcxx] Fix build with GLIBC

Reviewed By: #libc, philnik

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

18 months agoMove from llvm::makeArrayRef to ArrayRef deduction guides
serge-sans-paille [Wed, 4 Jan 2023 07:14:42 +0000 (08:14 +0100)]
Move from llvm::makeArrayRef to ArrayRef deduction guides

Since we're now requiring C++17, Let's get rid of makeXXX functions like
makeArrayRef, and use deduction guides instead.

This is a first step: Introduce the deduction guide. Following steps
will be a) use them and b) deprecate makeArrayRef.

Apart from codebase modernization, there isn't much benefit from that
move, but I can still mention that it would slightly (probably
negligibly) decrease the number of symbols / debug info, as deduction
guides don't generate new code.

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

18 months ago[VP][RISCV] Add vp.ctlz/cttz and RISC-V support.
Yeting Kuo [Tue, 20 Dec 2022 05:24:01 +0000 (13:24 +0800)]
[VP][RISCV] Add vp.ctlz/cttz and RISC-V support.

The patch also adds expandVPCTLZ and expandVPCTTZ to expand vp.ctlz/cttz nodes
and the cost model of vp.ctlz/cttz.

Reviewed By: craig.topper

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

18 months ago[LoongArch] Add intrinsics for MOVFCSR2GR and MOVGR2FCSR instructions
Xiaodong Liu [Wed, 4 Jan 2023 06:10:43 +0000 (14:10 +0800)]
[LoongArch] Add intrinsics for MOVFCSR2GR and MOVGR2FCSR instructions

Instruction formats:
`movgr2fcsr fcsr, rj`
`movfcsr2gr rd, fcsr`
MOVGR2FCSR modifies the value of the software writable field
corresponding to the FCSR (floating-point control and status
register) `fcsr` according to the value of the lower 32 bits of
the GR (general purpose register) `rj`.
MOVFCSR2GR sign extends the 32-bit value of the FCSR `fcsr`
and writes it into the GR `rd`.

Add "i32 @llvm.loongarch.movfcsr2gr(i32)" intrinsic for MOVFCSR2GR
instruction. The argument is FCSR register number. The return value
is the value in the FCSR.
Add "void @llvm.loongarch.movgr2fcsr(i32, i32)" intrinsic for MOVGR2FCSR
instruction. The first argument is the FCSR number, the second argument
is the value in GR.

Reviewed By: SixWeining, xen0n

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

18 months ago[NFC] Autogenerate test/Transforms/InstCombine/fls.ll
Amaury Séchet [Wed, 4 Jan 2023 02:05:30 +0000 (02:05 +0000)]
[NFC] Autogenerate test/Transforms/InstCombine/fls.ll