Matthew Voss [Tue, 11 Apr 2023 17:13:58 +0000 (10:13 -0700)]
[PS4][clang] Pass -flto-jobs argument to orbis-ld
Pass -flto-jobs to orbis-ld correctly.
Differential Revision: https://reviews.llvm.org/D147660
OCHyams [Tue, 11 Apr 2023 17:03:51 +0000 (18:03 +0100)]
[Assignment Tracking] Trunc fragments for stores to vars smaller than the alloca
In D147777 emitDbgAssign was fixed to discard assignments which touched any
bits outside the bounds of a variable. This patch changes emitDbgAssign to
discard assignments which touch bits only outside the variable bounds, and
creates a truncated fragment expression for stores partially overlapping the
variable. This is necessary because the alloca is interpreted as a store (of
undef), meaning without this patch emitDbgAssign would discard the inital
dbg.assign for a variable that is smaller than the alloca.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D148018
OCHyams [Tue, 11 Apr 2023 16:36:39 +0000 (17:36 +0100)]
[Assignment Tracking][SROA] Don't un-poison dbg.assigns using multiple loc ops
Some dbg.assigns using poison become un-poisoned in SROA. The reason this
happens at all is because dbg.assigns linked to memory intrinsics use poison to
indicate they can't describe the stored value, but the value becomes available
after some optimisations. This needs reworking eventually, but for now we need
to ensure that when it does occur we don't create invalid expressions.
D147312 prevented this occuring when the dbg.assign uses DIArgLists, but that
wasn't a complete fix. We also need to ensure we avoid un-poisoning when the
existing expression uses more than one location operand (DW_OP_arg, n).
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D148020
Simon Pilgrim [Tue, 11 Apr 2023 17:01:32 +0000 (18:01 +0100)]
[X86] widen-load-of-small-alloca tests - use X86 check prefix for i686 triples
We try to use X32 just for gnux32 triples
Florian Hahn [Tue, 11 Apr 2023 16:51:10 +0000 (17:51 +0100)]
[LV] Use std::make_optional to fix build failure after
082a0046.
Some compilers require std::make_optional(std::move()) to force construction
of the std::optional return value. This should fix the build failure in
https://lab.llvm.org/buildbot#builders/67/builds/10991
Mark de Wever [Sun, 9 Apr 2023 11:24:21 +0000 (13:24 +0200)]
[libc++][format] Mark range formaters as complete.
The __cpp_lib_format_ranges feature-test macro only depends on P2286R8
and P2585R0. Note since LWG3750 only affects these two C++23 papers
there is nothing to do for older language versions.
(The __cpp_lib_format feature-test macro depends on the incomplete
formatting for chrono. So this part can't be marked as complete yet.)
This completes
- P2286R8 Formatting ranges
- P2585R0 Improving default container formatting
This partly implements
- LWG3750 Too many papers bump __cpp_lib_format
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D147880
Louis Dionne [Tue, 11 Apr 2023 16:44:58 +0000 (17:44 +0100)]
[libc++][NFC] Update precondition comments when testing subspan assertions
Mark de Wever [Sun, 9 Apr 2023 15:19:17 +0000 (17:19 +0200)]
[libc++][format] Improves tests.
This is based on the last open review comment in D144331 and is applied
to all occurrences.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D147885
Mark de Wever [Wed, 15 Mar 2023 07:07:05 +0000 (08:07 +0100)]
[libc++][CI] Prepares building C++ modules.
D144994 adds modules to libc++. In order to test them some newer and
additional tools are required.
CMake 3.26
This is in combination with Clang 16 or newer makes it possible to
conveniently build modules with CMake. Unfortunately CMake 3.26 in our
setup has an issue with unused linker flags. This causes libunwind not
to compile at all. D145596 contains a quick-fix which is in the module
patch. The patch D142957 and followups will contain a proper fix.
Therefore install CMake 3.26 in a separate location, allowing to test
the module patch in the CI.
Ninja 1.11
Building modules requires dynamic rules, which requires this version.
This is a CMake 3.26 requirement to use modules. Note that without using
modules CMake still accepts older Ninja versions.
clang-scan-deps (in the tools package)
This tool is used by CMake to get the module dependencies. Note
strictly this currently will only be used for Clang 16 and Clang 17.
Clang 15 and Clang 14 are not needed. They are installed to keep
updating to Clang 18 and later easier.
(In the future we might not test modular build with all Clang versions,
however at the moment the feature is still in development in both Clang
and libc++ so it would be good to detect regressions.)
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D146822
Mark de Wever [Sun, 9 Apr 2023 16:00:01 +0000 (18:00 +0200)]
[libc++] Formats the sytem_error headers.
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D147886
OCHyams [Tue, 11 Apr 2023 15:56:05 +0000 (16:56 +0100)]
[Assignment Tracking] Fix replaceVariableLocationOp for dbg.assign with DIArgList
The last time this function was updated DIArgLists were not supported for
dbg.assigns. Without this patch it's possible to now dereference an invalid
(the end) iterator. This occurs when the Address component gets replaced and
there's a DIArgList for the Value component (the contained values are
irrelevant).
The added unittest crashes without the code change in this patch.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D147922
Quinn Dawkins [Sat, 1 Apr 2023 19:17:45 +0000 (15:17 -0400)]
[mlir][linalg] Enable propagation of pack/unpack ops through non-elementwise
Allows pack propagation through non-elementwise generics as long as all
tiled dimensions have parallel iterator types and are only indexed with
affine dim expressions by any of the operands.
This enables unpack propagation cases where the result type is different
from the current unpack destination tensor and thus motivates a similar
helper as the for pack for creating a destination tensor based on
pack information.
Outer dim permutations are allowed to permute reduction dims, however
remains unsupported for non-affine dim indexing map results.
Additionally ops with gather semantics now explicitly prohibit propagation.
Pack/unpack propagation through reductions may not always be beneficial
so user control over propagation decisions is made available through
a control function similar to the one for fusion.
Differential Revision: https://reviews.llvm.org/D147508
Michael Liao [Thu, 23 Mar 2023 20:29:14 +0000 (16:29 -0400)]
[InstCombine] Teach alloca replacement to handle `addrspacecast`
- As the address space cast may not be valid on a specific target,
`addrspacecast` is not handled when an `alloca` is able to be replaced
with the source of memcpy/memmove. This patch addresses that by
querying a target hook on whether that address space cast is valid.
For example, on most GPU targets, the cast from a global pointer to a
generic pointer is valid.
- If that cast is allowedd (by querying `isValidAddrSpaceCast`), the
replacement is enhanced to handle that `addrspacecast` as well.
Reviewed By: yaxunl
Differential Revision: https://reviews.llvm.org/D147025
Felix Schneider [Tue, 11 Apr 2023 15:36:41 +0000 (17:36 +0200)]
[mlir][MemRef] fix error message in ReinterpretCastOp::verify
The error message that is displayed when the offset in the MemRefType of
the Op's result is unexpected was the wrong way around, mixing up
expected and actual offset.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D148009
Akash Banerjee [Tue, 11 Apr 2023 15:36:57 +0000 (16:36 +0100)]
[MLIR][OpenMP] Add conversion support from FIR to LLVM Dialect for OMP Target
This enables conversion of OpenMP Target op with region from FIR Dialect to LLVM IR Dialect.
Differential Revision: https://reviews.llvm.org/D147439
Alex Zinenko [Tue, 11 Apr 2023 13:23:13 +0000 (13:23 +0000)]
[mlir] fix a crash in linalg.generic parser
Report an error when the `iterator_types` attribute is missing.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D148015
Akash Banerjee [Tue, 11 Apr 2023 15:34:56 +0000 (16:34 +0100)]
[Flang][OpenMP] Add Fortran lowering support for Target directive
This patch adds Fortran lowering support for OMP Target directive along with tests.
Differential Revision: https://reviews.llvm.org/D147339
Alex Zinenko [Tue, 11 Apr 2023 13:25:37 +0000 (13:25 +0000)]
[mlir] make transform interpreter debug spew less verbose
In particular, move the printing of the top-level payload after each
transform under the "full output" debug flag, it is rarely useful and
excessively long. Also don't print the regions of the transform
operation being applied as each individual operation in the region is
likely going to be applied later by itself and therefore printed.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D148014
Akash Banerjee [Tue, 11 Apr 2023 12:49:19 +0000 (13:49 +0100)]
[MLIR][OpenMP] Added map clause support for Target
Added map clause support for the OMP Target directive with test.
Differential Revision: https://reviews.llvm.org/D147247
Ellis Hoag [Tue, 11 Apr 2023 14:58:47 +0000 (07:58 -0700)]
[InstrProf] Temporal Profiling
As described in [0], this extends IRPGO to support //Temporal Profiling//.
When `-pgo-temporal-instrumentation` is used we add the `llvm.instrprof.timestamp()` intrinsic to the entry of functions which in turn gets lowered to a call to the compiler-rt function `INSTR_PROF_PROFILE_SET_TIMESTAMP()`. A new field in the `llvm_prf_cnts` section stores each function's timestamp. Then in `llvm-profdata merge` we convert these function timestamps into a //trace// and add it to the indexed profile.
Since these traces could significantly increase the profile size, we've added `-max-temporal-profile-trace-length` and `-temporal-profile-trace-reservoir-size` to limit the length of a trace and the number of traces in a profile, respectively.
In a future diff we plan to use these traces to construct an optimized function order to reduce the number of page faults during startup.
Special thanks to Julian Mestre for helping with reservoir sampling.
[0] https://discourse.llvm.org/t/rfc-temporal-profiling-extension-for-irpgo/68068
Reviewed By: snehasish
Differential Revision: https://reviews.llvm.org/D147287
Nikita Popov [Tue, 11 Apr 2023 15:16:10 +0000 (17:16 +0200)]
[Attributor] Name instructions in tests (NFC)
Anna Thomas [Thu, 6 Apr 2023 21:04:52 +0000 (17:04 -0400)]
[GuardUtils] Add asserts about loop varying widenable conditions
We have now seen two miscompiles because of widening widenable
conditions at incorrect IR points and thereby changing a branch's loop
invariant condition to a loop-varying one (see PR60234 and PR61963).
This patch adds asserts in common guard utilities that we use for
widening to proactively catch these bugs in future.
Note that these asserts will not fire if we were to sink a widenable
condition from out of a loop into a loop (that's also incorrect for the
same reason as above).
Tested this without the fix for PR60234 (guard widening miscompile) and
confirmed the assert fires.
WARNING: Sometimes, the assert can fire if we failed to hoist the
invariant condition out of the loop. This is a pass-ordering issue or a
limitation in LICM, which would need an investigation. See details in
review.
Differential Revision: https://reviews.llvm.org/D147752
Nikita Popov [Tue, 11 Apr 2023 14:41:33 +0000 (16:41 +0200)]
[Transforms] Convert some tests to opaque pointers (NFC)
Florian Hahn [Tue, 11 Apr 2023 14:41:17 +0000 (15:41 +0100)]
[VPlan] Allow building a VPlan to may fail.
Update the planning code constructing VPlan to allow building VPlans to
fail. This allows us to gradually shift some legality checks to VPlan
construction. The first candidate is checking if all users of
first-order recurrence phis can be sunk past the recipe computing the
previous value.
The new functionality will be used by D142886 which is approved and will
be landed shortly.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D142885
Nikita Popov [Tue, 11 Apr 2023 14:30:09 +0000 (16:30 +0200)]
[FunctionAttrs] Add cleanuppad test (NFC)
Joe Nash [Mon, 10 Apr 2023 18:23:42 +0000 (14:23 -0400)]
[AMDGPU] NFC. Clean up check prefixes in fcmp test
Fix the test introduced in D136592 which appeared to have a few check lines
containing an un-checked prefix "GISEL-GFX".
Also canonicalize the other prefixes to minimize churn if SDag and GISel
diverge.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D147958
Balaji V. Iyer [Tue, 11 Apr 2023 13:43:15 +0000 (13:43 +0000)]
[mlir][math] Expand math.ceilf to truncate, compares and increments
Ceilf are pushed directly to libm. This is problematic for
situations where libm is not available. This patch will break down
a ceilf function to truncate followed by an increment if the
truncated value is smaller than the input value.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D147974
David Green [Tue, 11 Apr 2023 13:49:46 +0000 (14:49 +0100)]
[ARM] Increase the Scalarized cost of masked gather/scatter operations
If a gather/scatter is masked and will need to be scalarized then the cost
should be higher than we currently produce. An additional cost for scalarizing
the mask, extracting i1s and branching on the result needs to be added, which
this patch gives a cost of 5.
Differential Revision: https://reviews.llvm.org/D147331
Amaury Séchet [Fri, 7 Apr 2023 23:31:13 +0000 (23:31 +0000)]
[DAG] Peek through zext/trunc when matching (or (and X, (not Y)), Y).
This shows up in the wild, notably as a regression in D127115 .
Depends on D147821
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D147827
Tue Ly [Fri, 7 Apr 2023 02:38:04 +0000 (22:38 -0400)]
[libc][math] Update range reduction step for log2f and improve its performance.
Simplify the range reduction steps by choosing the reduction constants
carefully so that the reduced arguments v = r*m_x - 1 and v^2 are exact in double
precision, even without FMA instructions, and -2^-8 <= v < 2^-7.
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D147759
Congcong Cai [Tue, 11 Apr 2023 13:41:28 +0000 (15:41 +0200)]
[NFC] format llvm/lib/Target/WebAssembly/AsmParser
Reviewed By: aheejin
Differential Revision: https://reviews.llvm.org/D147884
Nicolas Vasilache [Tue, 11 Apr 2023 12:52:48 +0000 (05:52 -0700)]
[mlir][Linalg] NFC - Improve debug messages around padding
Simon Pilgrim [Tue, 11 Apr 2023 13:18:35 +0000 (14:18 +0100)]
[X86] Remove unnecessary OneUse limit from combineToExtendBoolVectorInReg (vXi1 bitcast(iX Cond)) select expansion
We already allow multiple uses when calling from combineSext/combineZext - adding hasOneUse seems to have been a copy+paste from some of the similar AVX512 vselect folds.
Fixes #62014
Amaury Séchet [Tue, 11 Apr 2023 12:51:08 +0000 (12:51 +0000)]
[NFC] Add test cases for D147827
Amaury Séchet [Tue, 11 Apr 2023 13:13:17 +0000 (13:13 +0000)]
[NFC] Autogenerate CodeGen/X86/and-or-fold.ll .
Felipe de Azevedo Piovezan [Thu, 16 Mar 2023 20:35:24 +0000 (16:35 -0400)]
[DbgHistoryCalculator] Improve debug messages
I've found that a frequent source of debug information loss in optimized
code is due to DEBUG_VALUE intrinsics in a position of the instruction
stream that is outside the scope of the variable it describes.
Tracking these is pretty difficult with the existing debug messages of
the history calculator; this patch addresses the issue by making it
obvious when this event happens.
Differential Revision: https://reviews.llvm.org/D147718
skc7 [Tue, 11 Apr 2023 12:24:22 +0000 (17:54 +0530)]
[AMDGPU][NFC] Regenerate test checks for sub.ll
Guillaume Chatelet [Tue, 11 Apr 2023 12:21:11 +0000 (12:21 +0000)]
[libc] remove unsupported GCC attribute
This is ok as we build the libraries with `-ffreestanding` which implies `-fno-builtin` on all functions.
Nico Weber [Tue, 11 Apr 2023 12:17:32 +0000 (08:17 -0400)]
Revert "[X86][mem-fold] Speed up test by not re-generating the .inc file"
This reverts commit
070233dab0fdc6098a8b645774003fb0511e5962.
It also reverts follow-ups
2588e831af4a2240825215670c53717f07a95b3a and
027f60a6e9fa0b2ddf9eecc65aab8fde0b527f51.
Guillaume Chatelet [Tue, 11 Apr 2023 11:53:11 +0000 (11:53 +0000)]
[libc][NFC] Use new approach based on types to code memmove
Sjoerd Meijer [Tue, 11 Apr 2023 11:40:14 +0000 (12:40 +0100)]
Recommit "[AArch64][TTI] Cost model FADD/FSUB/FNEG""
Fixed two test cases that relied on Asserts, and added a fallthrough
annotation to the switch case.
Igor Kirillov [Wed, 5 Apr 2023 20:43:36 +0000 (20:43 +0000)]
[CodeGen] Add Pre-commit tests for D146988
Differential Revision: https://reviews.llvm.org/D147659
Amaury Séchet [Fri, 7 Apr 2023 21:32:31 +0000 (21:32 +0000)]
[DAG] Peek through zext/trunc in haveNoCommonBitsSet.
This limitation was discovered thanks to some regression in D127115 .
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D147821
Simon Pilgrim [Tue, 11 Apr 2023 11:18:56 +0000 (12:18 +0100)]
[X86] Improve test coverage for Issue #62014
Ensure we test different vector element sizes
Simon Pilgrim [Tue, 11 Apr 2023 10:57:23 +0000 (11:57 +0100)]
[X86] Split off test coverage for Issue #62014
vector-bo-select.ll should only be used for binop identity select tests
Nikita Popov [Tue, 11 Apr 2023 11:34:20 +0000 (13:34 +0200)]
[Pipelines] Drop outdated comments about O0 (NFC)
These methods can be called with an O0 level nowadays.
Guillaume Chatelet [Tue, 11 Apr 2023 11:31:38 +0000 (11:31 +0000)]
[libc][NFC] Use new approach based on types to code memset
Martin Braenne [Tue, 11 Apr 2023 10:21:25 +0000 (10:21 +0000)]
[clang][dataflow][NFC] Remove unused parameter from `insertIfGlobal()`.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D148004
Nikita Popov [Tue, 11 Apr 2023 11:19:06 +0000 (13:19 +0200)]
[Pipelines] Move AddDescriminators to consistent position
In the non-ThinLTO pipeline this was directly before PipelineStartEP,
in the ThinLTO pipeline it was directly after. I don't think the
specific position matters here, just make sure it's the same for
both pipelines.
Nikita Popov [Tue, 11 Apr 2023 11:08:00 +0000 (13:08 +0200)]
[Pipelines] Use isLTOPreLink() helper in more places (NFC)
Nikita Popov [Tue, 11 Apr 2023 11:05:56 +0000 (13:05 +0200)]
[Pipelines] Remove redundant O0 check (NFC)
buildModuleSimplificationPipeline() is not used for O0.
Matt Arsenault [Thu, 26 Jan 2023 19:46:00 +0000 (15:46 -0400)]
AMDGPU: Fold fneg into bitcast of build_vector
The math libraries have a lot of code that performs
manual sign bit operations by bitcasting doubles to int2
and doing bithacking on them. This is a bad canonical form
we should rewrite to use high level sign operations directly
on double. To avoid codegen regressions, we need to do a better
job moving fnegs to operate only on the high 32-bits.
This is only halfway to fixing the real case.
Simon Pilgrim [Tue, 11 Apr 2023 10:36:03 +0000 (11:36 +0100)]
[X86] Add test coverage for Issue #62014
Added multiuse checks for v8i16 and v8f32 cases
Alex Zinenko [Tue, 11 Apr 2023 10:35:46 +0000 (12:35 +0200)]
[mlir] rename Math/dependent-dialect.mlir to depends-on-arith.mlir
Alex Zinenko [Tue, 11 Apr 2023 08:41:29 +0000 (10:41 +0200)]
[mlir] make Math dialect depend on Arith dialect
Ops from the Math dialect use fastmath attributes defined in Arith.
Therefore Math dialect must declare a dependency on Arith for proper
construction and parsing.
Reviewed By: tpopp
Differential Revision: https://reviews.llvm.org/D147999
Simon Pilgrim [Tue, 11 Apr 2023 10:26:00 +0000 (11:26 +0100)]
[X86] vector-bo-select.ll - add SSE test coverage
Max Kazantsev [Tue, 11 Apr 2023 10:18:57 +0000 (17:18 +0700)]
[LICM][NFC] Unify arithmetic statistics collection
Avoid divergence b/w different kinds of hoisting with reassociation.
Make them all collect general stat NumHoisted and also specific stats
for each particular transform.
Momchil Velikov [Tue, 11 Apr 2023 08:45:15 +0000 (09:45 +0100)]
[LiveInterval] Fix live range overlap check
Reviewed By: MatzeB
Differential Revision: https://reviews.llvm.org/D145707
Max Kazantsev [Tue, 11 Apr 2023 10:06:20 +0000 (17:06 +0700)]
[LICM][NFC] Do not forward declaration of hoistMinMax
They all are now handled by hoistArithmetics, and only it should be
forwarded.
Max Kazantsev [Tue, 11 Apr 2023 10:03:00 +0000 (17:03 +0700)]
[Test] Precommit negative test on add/sub hoisting
Should not optimize here because no-overflow is not proved.
Nikita Popov [Tue, 11 Apr 2023 09:54:42 +0000 (11:54 +0200)]
[LICM] Fix assert failure in no-allowspeculation mode
In this case the source GEP might not be hoisted even though it
has invariant operands. For now just bail out, but we might need
additional checks for AllowSpeculation in these special-case
reassociation folds.
Alexis Engelke [Fri, 10 Mar 2023 14:23:22 +0000 (15:23 +0100)]
[X86][MC] Emit instructions into SmallVector
Depends on D145791
Storing instruction bytes directly in a SmallVector instead of a
raw_ostream yields better encoding performance (in some applications,
the improvment is ~1% of the complete back-end time).
Reviewed By: MaskRay, Amir
Differential Revision: https://reviews.llvm.org/D145792
Alexis Engelke [Thu, 9 Mar 2023 18:15:24 +0000 (19:15 +0100)]
[FastISel] Correctly report prototype on miss
The type of a function is nowadays just an opaque pointer, which is not
helpful when analyzing FastISel misses. Instead print the actual
function type of the function.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D147716
Jon Chesterfield [Tue, 11 Apr 2023 09:47:53 +0000 (10:47 +0100)]
[amdgpu][nfc] Update comments on LDS lowering
David Spickett [Tue, 11 Apr 2023 09:34:01 +0000 (09:34 +0000)]
[llvm][clang] Correct example in -mcpu-help text
This used to say:
For example, clang --target=aarch64-unknown-linux-gui -mcpu=cortex-a35
Which works but I think it was meant to be `-gnu` not `-gui`. From my
AArch64 Linux build:
```
$ ./bin/clang --version
clang version 17.0.0 <...>
Target: aarch64-unknown-linux-gnu
```
Originally added in
af857b93df36a983a27a82455c0dea39f53da5b1.
Sjoerd Meijer [Tue, 11 Apr 2023 09:04:38 +0000 (10:04 +0100)]
Revert "[AArch64][TTI] Cost model FADD/FSUB/FNEG"
This reverts commit
d0027e0be990df60f6f826123f035286a168f288.
Need to look at 2 test failures.
Diana Picus [Mon, 13 Mar 2023 15:37:44 +0000 (16:37 +0100)]
[AMDGPU] Add MMOs for GFX11 Streamout Instructions
The GFX11 NGG Streamout Instructions perform atomic operations on
dedicated registers. At the moment, they lack machine memory operands,
which causes the si-memory-legalizer pass to treat them conservatively
and introduce several unnecessary waits and cache invalidations.
This patch introduces a new address space to represent these special
registers and teaches instruction selection to add memory operands with
this new address space to DS_ADD/SUB_GS_REG_RTN.
Since this address space is meant to be compiler-internal, we move it
up a bit from the other address spaces and give it the number 128.
According to the LLVM Language Reference, address space numbers can go
all the way up to 2^24, but I'm not sure how well this is supported in
practice [1], so using a smaller number seems safer.
[1] https://github.com/llvm/llvm-project/blob/
0107513fe79da7670e37c29c0862794a2213a89c/llvm/utils/TableGen/IntrinsicEmitter.cpp#L401
Differential Revision: https://reviews.llvm.org/D146031
Diana Picus [Tue, 11 Apr 2023 08:23:51 +0000 (10:23 +0200)]
clang-format file I'm about to touch. NFCI
Heejin Ahn [Sun, 9 Apr 2023 10:28:15 +0000 (03:28 -0700)]
[WebAssembly] Correctly check end_if/end_try with else/catch
When we encounter an `else`, `catch`, or `catch_all`, we currently just
push the structure `NestingType` and don't preserve the original `if`
and `try`'s signature. So after we pass `else`/`catch`/`catch_all`, we
can't check if the values on stack have the correct types when we
encounter `end_if` or `end_try`. This CL fixes the issue, and modifies
the existing test to be correct (some of them had `try` without
`catch`).
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D147881
Heejin Ahn [Sat, 8 Apr 2023 14:11:43 +0000 (07:11 -0700)]
[WebAssembly] Handle block-like structures consistently in type checker
We disable type check in unreachable code, but when the unreachable code
is enclosed within a block-like structure, the block as a whole has a
valid type and we should continue type checking after the block. But it
looks we currently only do that for blocks and not other block-like
structures (`loop`s, `try`s, and `if`s). Also unreachable code within
`if`'s true body shouldn't disable type checking in `else` body, and
that in `try` body shouldn't disable type checking in `catch/catch_all`
body.
This also causes the values/types on the stack to be correctly checked
when encounterint `catch`, `catch_all`, and `delegate`.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D147852
Heejin Ahn [Sat, 8 Apr 2023 03:29:25 +0000 (20:29 -0700)]
[WebAssembly] Fix type index block type handling in type checker
The current code is
```
ExpectBlockType = false;
TC.setLastSig(*Signature.get());
if (ExpectBlockType)
NestingStack.back().Sig = *Signature.get();
```
Because of the first line, the third line's `if (ExpectBlockType)` is
always false and we don't get to update `NestingStack.back().Sig`. This
results in not correctly erroring out when the types of remaining values
on the stack do not match the block type if the block type is written in
the form of a function type. We should set `ExpectBlockType` to false
after the `if`.
Reviewed By: sbc100
Differential Revision: https://reviews.llvm.org/D147837
Sjoerd Meijer [Tue, 11 Apr 2023 08:37:37 +0000 (09:37 +0100)]
[AArch64][TTI] Cost model FADD/FSUB/FNEG
This lowers the cost for FADD, FSUB, and FNEG. The motivation is to avoid
over-eager SLP vectorisation, that makes it look like SLP vectorisation is
profitable but results in significant slow downs. Lowering the cost for scalar
FADD/FSUB costs helps the profitability decision to favour the scalar
version where vectorisation isn't beneficial.
Lowering the cost for these floating point operations makes sense because a lot
of other instructions including many shuffles have only a cost of 1; these
FADD/FSUB/FNEG instructions should not be twice the cost.
Performance results show a 7% improvement for Imagick from SPEC FP 2017, a
small improvement in Blender, and unchanged results for the other apps in SPEC.
RAJAPerf is neutral and mostly shows no changes.
Differential Revision: https://reviews.llvm.org/D146033
wanglei [Tue, 11 Apr 2023 08:24:13 +0000 (16:24 +0800)]
[LoongArch] Fix typos in file description. NFC
Nikita Popov [Fri, 24 Mar 2023 14:10:53 +0000 (15:10 +0100)]
[LICM] Reassociate GEPs to allow hoisting
Reassociate gep (gep ptr, idx1), idx2 to gep (gep ptr, idx2), idx1
if this would make the inner GEP loop invariant and thus hoistable.
This is intended to replace an InstCombine fold that does this (in
https://github.com/llvm/llvm-project/blob/
04f61fb73dc6a994ab267d431f2fdaedc67430ff/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp#L2006).
The problem with the InstCombine fold is that LoopInfo is an optional
dependency, so it is not performed reliably.
Differential Revision: https://reviews.llvm.org/D146813
Nikita Popov [Tue, 4 Apr 2023 09:27:43 +0000 (11:27 +0200)]
[ARM] Convert test to opaque pointers
When converting this test to opaque pointers, we get a register
move between the call and the inline asm. However, the test
comment specifically says that there should be nothing between them.
As far as I can tell, this is fine, both in that the inline asm
doesn't use the relevant registers, but also more generally
because the inline asm doesn't declare any clobbers, so really
LLVM can do whatever, side effects or not. The test was added
by
618ce3e85ed1c68e89dc696b7c9ab94a6a910797 with only a reference
to Apple's internal issue tracker.
Differential Revision: https://reviews.llvm.org/D147512
Vlad Serebrennikov [Tue, 11 Apr 2023 08:07:00 +0000 (11:07 +0300)]
[clang] Add test for CWG1822
[[https://wg21.link/p1787 | P1787]]: CWG1822 is resolved by specifying that the body of a lambda remains in the surrounding (function parameter) scope.
Wording: A parameter-declaration-clause P introduces a function parameter scope that includes P. <...> If P is associated with a lambda-declarator, its scope extends to the end of the compound-statement in the lambda-expression. ([basic.scope.param])
Reviewed By: #clang-language-wg, shafik
Differential Revision: https://reviews.llvm.org/D147836
John McIver [Tue, 11 Apr 2023 08:03:01 +0000 (09:03 +0100)]
[InstCombine] Allow splats with poison/undef in llvm::decomposeBitTestICmp
This change is made to enable conversion of a masked icmp splat vector
containing poison/undef to an equality expression.
llvm::decomposeBitTestICmp Alive2 correctness examples using splat/masking vectors:
SLT < https://alive2.llvm.org/ce/z/pPTTHh
SLE <= https://alive2.llvm.org/ce/z/qQhAmU
SGT > https://alive2.llvm.org/ce/z/koFHzF
SGE >= https://alive2.llvm.org/ce/z/3SNz2S
ULT <u https://alive2.llvm.org/ce/z/W8ktzQ
ULE <=u https://alive2.llvm.org/ce/z/G5SdUY
UGT >u https://alive2.llvm.org/ce/z/WFwYxq
UGE >=u https://alive2.llvm.org/ce/z/DzJszP
Tests have been verified using Alive2:
icmp-logical.ll: @nomask_splat_and_B_allones https://alive2.llvm.org/ce/z/zmJwQU
icmp-logical.ll: @nomask_splat_and_B_mixed https://alive2.llvm.org/ce/z/ktzgzd
signed-truncation-check.ll: @positive_vec_undef0 https://alive2.llvm.org/ce/z/-sTRLD
Differential Revision: https://reviews.llvm.org/D143032
John McIver [Tue, 11 Apr 2023 07:59:34 +0000 (08:59 +0100)]
[InstCombine][NFC] Add tests with icmp splat vectors and B masks
Add tests to verifying future support for splat vectors containing poison/undef in llvm::decomposeBitTestICmp.
Differential Revision: https://reviews.llvm.org/D143031
Max Kazantsev [Tue, 11 Apr 2023 07:28:39 +0000 (14:28 +0700)]
[Test] Fix tests according to initial intent, add more tests & comments
Shivam Gupta [Tue, 11 Apr 2023 06:30:11 +0000 (12:00 +0530)]
Reland "[MLIR] Add an assert in Operation::getOpResultImpl for out of range result"
This reverts commit
e08af170736271f022b2cab44d58326356ce1db8.
Job Noorman [Tue, 11 Apr 2023 07:28:18 +0000 (09:28 +0200)]
[RISCV] Remove is*Branch instruction flags from C_JR
As discussed in
1d1b3c49531b, instruction flags set in the *.td files
are under-approximations. For C_JR, isBranch and isConditionalBranch are
set even though it is used for for returns which are not considered
branches.
This patch proposes to remove those flags from C_JR. More detailed
analysis can be implemented in RISCVMCInstrAnalysis.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147784
pvanhout [Thu, 6 Apr 2023 12:07:41 +0000 (14:07 +0200)]
[AMDGPU] Hide "removing function" diagnostics by default
Use an `OptimizationRemark` for them even though it's not really an
optimization. It just integrates better with the other diagnostics
(enabling is easy with `-pass-remark`).
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D147703
Max Kazantsev [Tue, 11 Apr 2023 06:27:48 +0000 (13:27 +0700)]
[NFC] Fix typo in statistic description
Max Kazantsev [Tue, 11 Apr 2023 06:14:17 +0000 (13:14 +0700)]
[LICM][NFC] Restructure code to have one entry point for reassociation-based hoistings
We already hoist min/max functions and want to do more of this kind. Some
refactoring to make growth points for it.
Max Kazantsev [Tue, 11 Apr 2023 06:09:41 +0000 (13:09 +0700)]
[LICM] Add test showing subtraction hoisting opportunity
Craig Topper [Tue, 11 Apr 2023 07:07:57 +0000 (00:07 -0700)]
[TableGen] Call std::vector::reserve to preallocate memory before a loop of push_back. NFC
Douglas Chen [Tue, 11 Apr 2023 06:10:57 +0000 (06:10 +0000)]
[clang-tidy] Fix hungarian notation failed to indicate the number of asterisks in check-clang-extra-clang-tidy-checkers-readability
Fix hungarian notation failed to indicate the number of asterisks for the pointers of multiple word types.
- WRONG: `unsigned char* value` : `value` --> `ucValue`
- RIGHT: `unsigned cahr* value` : `value` --> `pucValue`
- RIGHT: `unsigned char** value` : `value` --> `ppucValue`
Reviewed By: amurzeau, PiotrZSL
Differential Revision: https://reviews.llvm.org/D147779
Bing1 Yu [Tue, 11 Apr 2023 06:42:03 +0000 (14:42 +0800)]
[NFC] add check for potentially dereferencing null return value
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D147771
Tobias Gysi [Tue, 11 Apr 2023 06:16:12 +0000 (06:16 +0000)]
[mlir] Make the inliner arg/res handlers more concise.
The revision ensures the newly introduced argument
and result handlers cannot be used for type conversion.
Instead use the existing materializeCallConversion hook to
perform type conversions.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D147605
Kazu Hirata [Tue, 11 Apr 2023 06:33:47 +0000 (23:33 -0700)]
[clang-tidy] Use StringRef::contains (NFC)
sgokhale [Tue, 11 Apr 2023 06:14:28 +0000 (11:44 +0530)]
[CodeGen][ShrinkWrap] Split restore point
This patch splits a restore point to allow it to only post-dominate blocks reachable by use
or def of CSRs(Callee Saved Registers)/FI(Frame Index).
Benchmarking this on SPEC2017, this gives around 4% improvement on povray and no significant change
for others.
Co-authored-by: junbuml
Differential Revision: https://reviews.llvm.org/D42600
Mehdi Amini [Tue, 11 Apr 2023 04:50:19 +0000 (22:50 -0600)]
Fix use-after-free in help message: this cl::opt was binding a StringRef to a temporary string
Caught by ASAN on a bot: https://lab.llvm.org/buildbot/#/builders/168/builds/12872/steps/14/logs/stdio
Shengchen Kan [Tue, 11 Apr 2023 06:06:04 +0000 (14:06 +0800)]
[X86][mem-fold] Use x86-registered-target in the tablgen test, NFCI
Craig Topper [Tue, 11 Apr 2023 06:01:15 +0000 (23:01 -0700)]
[TableGen] Avoid vector copy in TreePatter::InlinePatternFragments. NFC
Instead of copying a vector and clearing the original, we can swap
with an empty vector.
Joshua Cao [Tue, 11 Apr 2023 05:39:40 +0000 (22:39 -0700)]
[SCEV][NFC] GetMinTrailingZeros switch case and naming cleanup
* combine zext and sext into the one switch case
* combine vscale and udiv into one switch case
* renames according to LLVM style
Max Kazantsev [Tue, 11 Apr 2023 05:31:57 +0000 (12:31 +0700)]
[Test] Add some more IndVars canonicalization tests
Bing1 Yu [Mon, 10 Apr 2023 09:09:35 +0000 (17:09 +0800)]
[X86][AMX] Add check for potentially dereferencing null return value
Reviewed By: xiangzhangllvm
Differential Revision: https://reviews.llvm.org/D147921
Shengchen Kan [Tue, 11 Apr 2023 04:32:37 +0000 (12:32 +0800)]
[X86][mem-fold] Only run x86-fold-tables.test when target x86 is built
Avoid the LIT fail when only arm/aarch64 is built.
Alex Brachet [Tue, 11 Apr 2023 04:41:14 +0000 (04:41 +0000)]
[libc] Correctly add new files
Alex Brachet [Tue, 11 Apr 2023 04:30:50 +0000 (04:30 +0000)]
Reland "[libc] Add {,r}index"
Differential Revision: https://reviews.llvm.org/D147464