Lorenzo Chelini [Sun, 8 Jan 2023 13:04:18 +0000 (14:04 +0100)]
[MLIR] Fold outer dims permutation to pack when propagating
Instead of folding the transpose into the linalg.generic keep the
transposition in the packing operation, effectively making the
linalg.generic transparent to the propagation. Additionally, if the init
operand of the generic has users pack the init and pass it as the
operand to the generic.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D141483
Nikita Popov [Fri, 13 Jan 2023 15:07:06 +0000 (16:07 +0100)]
[LVI] Check for non-speculatable instructions
When constraining an operand based on a condition at a (potentially
transitive) use site, make sure we don't skip over non-speculatable
instructions. While the result is only used under the condition,
the non-speculatable instruction may have a side-effect or UB.
Demonstrating this issue requires raising the limit on the walk,
so do that.
Guillaume Chatelet [Fri, 13 Jan 2023 15:05:24 +0000 (15:05 +0000)]
Deprecate DataLayout::getPrefTypeAlignment
Guillaume Chatelet [Fri, 13 Jan 2023 15:04:06 +0000 (15:04 +0000)]
[lldb][NFC] Remove dependency on DataLayout::getPrefTypeAlignment
Guillaume Chatelet [Fri, 13 Jan 2023 15:03:52 +0000 (15:03 +0000)]
[mlir][NFC] Remove dependency on DataLayout::getPrefTypeAlignment
Guillaume Chatelet [Fri, 13 Jan 2023 15:01:09 +0000 (15:01 +0000)]
[clang][NFC] Remove dependency on DataLayout::getPrefTypeAlignment
Nikita Popov [Fri, 13 Jan 2023 14:59:17 +0000 (15:59 +0100)]
[CVP] Add additional tests for use-site conditions (NFC)
For longer chains, we need to consider non-speculatable instructions.
Paul Robinson [Fri, 13 Jan 2023 14:52:14 +0000 (06:52 -0800)]
[compiler-rt] fix typo in #
95507c82
Erich Keane [Fri, 13 Jan 2023 14:50:35 +0000 (06:50 -0800)]
Revert "Workaround an assertion failure during module build"
This reverts commit
e77e14ecf17bba5f9e2ef43d8c3dbc9c86685287.
According to @rsmith on https://reviews.llvm.org/D131858, he believes
the reason for this workaround in the firstplace has been fixed.
Reverting the workaround to hopefully confirm that is the case.
Nikita Popov [Fri, 13 Jan 2023 14:44:27 +0000 (15:44 +0100)]
[CVP] Handle use-site conditions in urem folds
Nikita Popov [Fri, 13 Jan 2023 14:40:40 +0000 (15:40 +0100)]
[CVP] Add additional tests for use-site conditions (NFC)
Paul Robinson [Fri, 13 Jan 2023 14:16:33 +0000 (06:16 -0800)]
[compiler-rt] Fix XFAIL conditions after converting to 'target=...'
Fixes #60002.
Alexandros Lamprineas [Wed, 11 Jan 2023 11:50:32 +0000 (11:50 +0000)]
[IPSCCP] Enable specialization of functions.
Re-enable the optimization after having fixed the compilation error
found in SPEC/CINT2017rate/502.gcc_r when both LTO and PGO are in use
(see https://reviews.llvm.org/D141474).
Differential Revision: https://reviews.llvm.org/D140210
Dmitri Gribenko [Fri, 13 Jan 2023 14:02:39 +0000 (15:02 +0100)]
[lld][MachO] Store test outputs in %t
Nikita Popov [Fri, 13 Jan 2023 13:56:07 +0000 (14:56 +0100)]
[CVP] Avoid duplicate range fetch (NFC)
In preparation for switching this to use getConstantRangeAtUse().
Takuya Shimizu [Fri, 13 Jan 2023 13:20:14 +0000 (08:20 -0500)]
Fix -Wlogical-op-parentheses warning inconsistency for const and constexpr values
When using the && operator within a || operator, both Clang and GCC
produce a warning for potentially confusing operator precedence.
However, Clang avoids this warning for certain patterns, such as
a && b || 0 or a || b && 1, where the operator precedence of && and ||
does not change the result.
However, this behavior appears inconsistent when using the const or
constexpr qualifiers. For example:
bool t = true;
bool tt = true || false && t; // Warning: '&&' within '||'
const bool t = true;
bool tt = true || false && t; // No warning
const bool t = false;
bool tt = true || false && t; // Warning: '&&' within '||'
The second example does not produce a warning because
true || false && t matches the a || b && 1 pattern, while the third one
does not match any of them.
This behavior can lead to the lack of warnings for complicated
constexpr expressions. Clang should only suppress this warning when
literal values are placed in the place of t in the examples above.
This patch adds the literal-or-not check to fix the inconsistent
warnings for && within || when using const or constexpr.
Guillaume Chatelet [Fri, 13 Jan 2023 13:18:45 +0000 (13:18 +0000)]
[clang][NFC] Remove dependency on DataLayout::getPrefTypeAlignment
Paul Walker [Sun, 18 Dec 2022 16:22:39 +0000 (16:22 +0000)]
[SVE] Restrict SVE fixed length extload/truncstore combine to float and double types.
Prior to this patch we would create floating point extending load
and truncating store operations involving fp128 types, which we
cannot lower.
Fixes #58530
Differential Revision: https://reviews.llvm.org/D140318
Freddy Ye [Fri, 13 Jan 2023 13:09:13 +0000 (21:09 +0800)]
[X86][test] Add pre-commit test for D141657.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D141677
Quentin Colombet [Fri, 13 Jan 2023 10:32:54 +0000 (10:32 +0000)]
Re-apply "[mlir][SparseTensor] Add a few more tests for sparse vectorization"
This reverts commit
93f40c983e0adbb63cbb7c59814090134d691dd1.
Update the tests to also work on window.
The order in which the `arith.constant`s appear in the output IR is
slightly different between window and linux.
Use CHECK.*-DAG for the constants.
Original message:
These tests cover muli, xor, and, addf, subf, and addi.
The tests themselves are not that interesting, their goal is to provide
code coverage for all the types of reductions currently supported.
NFC
Differential Revision: https://reviews.llvm.org/D141369
LiaoChunyu [Thu, 12 Jan 2023 13:58:38 +0000 (21:58 +0800)]
[RISCV] Optimize (brcond (seteq (and X, (1 << C)-1), 0))
Inspired by gcc's assembly: https://godbolt.org/z/54hbzsGYn, while referring to D130203
Replace AND+IMM{32,64} with a slli.
But gcc does not handle 0xffff and 0xffffffff, which also seem to be optimizable.
The testcases copies all the bits in D130203 and adds 16, 32, and 64 bits.
Differential Revision: https://reviews.llvm.org/D141607
Emmmer [Wed, 4 Jan 2023 09:31:10 +0000 (17:31 +0800)]
[LLDB][RISCV] Add RVDC instruction support for EmulateInstructionRISCV
RVC is the RISC-V standard compressed instruction-set extension, named "C", which reduces static and dynamic code size by adding short 16-bit instruction encodings for common operations, and RVCD is the compressed "D extension".
And "D extension" is a double-precision floating-point instruction-set extension, which adds double-precision floating-point computational instructions compliant with the IEEE 754-2008 arithmetic standard.
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D140961
Peixin Qiao [Fri, 13 Jan 2023 12:40:51 +0000 (20:40 +0800)]
[flang] Initial support of allocate statement with source
Support allocate statement with source in runtime version. The source
expression is evaluated only once for each allocate statement. When the
source expression has shape-spec, uses it for bounds. Otherwise, get
the bounds from the source expression. Get the length if the source
expression has deferred length parameter.
Reviewed By: clementval, jeanPerier
Differential Revision: https://reviews.llvm.org/D137812
Ties Stuij [Fri, 13 Jan 2023 10:00:23 +0000 (10:00 +0000)]
[lld][ARM] support position independent thunks for Armv4(T)
- Position independent thunks now work for both Armv4 and Armv4T
- Armv4 arm->arm thunks don't emit a BX anymore, which doesn't exist for the
arch. This fixes https://github.com/llvm/llvm-project/issues/50764.
- Armv4 and Armv4T both have the same arm->arm behaviour. Which also is
desirable for the above ticket.
Reviewed By: MaskRay, peter.smith
Differential Revision: https://reviews.llvm.org/D141272
Jay Foad [Fri, 13 Jan 2023 11:12:17 +0000 (11:12 +0000)]
[TableGen] Use raw_ostream::write_escaped instead of reinventing it. NFCI.
Francesco Petrogalli [Fri, 13 Jan 2023 10:16:37 +0000 (11:16 +0100)]
Recommit [SchedBoundary] Add dump method for resource usage.
Summary:
As supporting information, I have added an example that describes how
the indexes of the vector of resources SchedBoundary::ReservedCycles
are tracked by the field SchedBoundary::ReservedCyclesIndex.
This has a minor rework of
https://github.com/llvm/llvm-project/commit/
b39a9a94f420a25a239ae03097c255900cbd660e
which was reverted in
https://github.com/llvm/llvm-project/commit/
df6ae1779fafd9984e144a27315d6dd65b32c325
becasue the llc invocation of the test was missing the argument
`-mtriple`.
See for example the failure at
https://lab.llvm.org/buildbot#builders/231/builds/7245 that reported
the following when targeting a non-aarch64 native build:
'cortex-a55' is not a recognized processor for this target (ignoring processor)
Reviewers: jroelofs
Subscribers:
Differential Revision: https://reviews.llvm.org/D141367
Joshua Cao [Thu, 12 Jan 2023 06:19:30 +0000 (22:19 -0800)]
[SCEV] Support all Min/Max SCEVs for GetMinTrailingZeros
There is already support for U/SMax. No reason why Min and SequentialMin
should not be supported.
NFC: code in GetMinTrailingZeroes is copied for a couple node types.
Refactor them into a single code block.
Differential Revision: https://reviews.llvm.org/D141568
Quentin Colombet [Fri, 13 Jan 2023 10:30:09 +0000 (10:30 +0000)]
Revert "[mlir][SparseTensor] Add a few more tests for sparse vectorization"
This reverts commit
904f2ccc3ba1d3aaf94140aa4595fd41af67d897.
This breaks a window bot. Reverting while I investigate.
https://lab.llvm.org/buildbot/#/builders/13/builds/30748
Quentin Colombet [Fri, 13 Jan 2023 10:09:10 +0000 (10:09 +0000)]
[mlir][memref] Add details on the semantic of reinterpret_cast
Make it clearer what the semantic of reinterpret_cast is.
In particular, call out that this instruction is not a no-op.
NFC
Related to https://github.com/llvm/llvm-project/issues/59896
Differential Revision: https://reviews.llvm.org/D141662
Francesco Petrogalli [Fri, 13 Jan 2023 10:12:15 +0000 (11:12 +0100)]
Revert "[SchedBoundary] Add dump method for resource usage."
Reverting because of https://lab.llvm.org/buildbot#builders/16/builds/41860
When building on x86, I need to specify also -mtriple in the
invocation of llc otherwise the folllowing error shows up:
'cortex-a55' is not a recognized processor for this target (ignoring processor)
This reverts commit
b39a9a94f420a25a239ae03097c255900cbd660e.
Jean Perier [Fri, 13 Jan 2023 09:58:03 +0000 (10:58 +0100)]
[flang] Implement codegen of hlfir.designate with component refs
Lower all the different kinds of hlfir.designate component refs to
FIR.
Differential Revision: https://reviews.llvm.org/D141476
Nikita Popov [Fri, 13 Jan 2023 10:04:03 +0000 (11:04 +0100)]
[InstCombine] Regenerate test checks (NFC)
Pick up changes in variables names.
Dmitri Gribenko [Fri, 13 Jan 2023 09:55:26 +0000 (10:55 +0100)]
[bazel] Updates for https://github.com/llvm/llvm-project/commit/
aa0883b59ae17e5465906dad51b5561b5292a28d
Matthias Springer [Fri, 13 Jan 2023 09:42:01 +0000 (10:42 +0100)]
[mlir] GreedyPatternRewriter: Add ancestors to worklist
When adding an op to the worklist, also add its ancestors to the worklist. This allows for RewritePatterns to match an op `a` based on what is inside of the body of `a`.
This change fixes a problem that became apparent with `vector.warp_execute_on_lane_0`, but could probably be triggered with similar patterns. The pattern extracts an op `b` with `eligible = true` from the body of an op `a`:
```
test.a {
%0 = test.b() {eligible = true}
yield %0
}
```
Afterwards:
```
%0 = test.b() {eligible = true}
test.a {
yield %0
}
```
The pattern is an `OpRewritePattern<OpA>`. For some reason, `test.a` is not on the GreedyPatternRewriter's worklist. E.g., because no pattern could be applied and it was removed. Now, another pattern updates `test.b`, so that `eligible` is changed from `true` to `false`. The `OpRewritePattern<OpA>` could now be applied, but (without this revision) `test.a` is still not on the worklist.
Note: In the above example, an `OpRewritePattern<OpB>` could have been used instead of an `OpRewritePattern<OpA>`. With such a design, we can run into the same problem (when the `eligible` attr is on `test.a` and `test.b` is removed from the worklist because no patterns could be applied).
Note: This change uncovered an unrelated bug in TestSCFUtils.cpp that was triggered due to a change in the order in which ops are processed. A TODO is added to the broken code and test cases are adapted so that the bug is no longer triggered.
Differential Revision: https://reviews.llvm.org/D140304
Ivan Kosarev [Fri, 13 Jan 2023 09:33:11 +0000 (09:33 +0000)]
[AMDGPU][AsmParser][NFC] Refine defining i8- and i16-typed custom operands.
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D140799
Quentin Colombet [Tue, 10 Jan 2023 10:58:01 +0000 (10:58 +0000)]
[mlir][SparseTensor] Add a few more tests for sparse vectorization
These tests cover muli, xor, and, addf, subf, and addi.
The tests themselves are not that interesting, their goal is to provide
code coverage for all the types of reductions currently supported.
NFC
Differential Revision: https://reviews.llvm.org/D141369
Nikita Popov [Thu, 15 Dec 2022 13:05:00 +0000 (14:05 +0100)]
[MemDep] Reduce block limit
The non-local MemDep analysis has a limit on the number of blocks
it will scan trying to find dependencies. The current limit of 1000
is very high, especially when we consider that each block scan can
also visit up to 100 instructions. In degenerate cases (where we
actually scan that many blocks) MemDep/GVN dominate overall
compile-time, for little benefit.
This patch reduces the limit to 200, which is probably still too
large, but at least mitigates some of the more catastrophic cases.
(For comparison, MSSA clobber walks consider up to 100
MemoryDefs/MemoryPhis, rather than 200 blocks * 100 instructions,
but these limits aren't directly comparable.)
I know that we were kind of hoping that this issue would resolve
itself in time, either by a switch to NewGVN or use of MSSA in GVN.
But I think we should still address this in the meantime.
Additionally, a switch to an MSSA-based implementation will
effectively be doing this as well, in a roundabout way (by dint of
MSSA having lower cutoffs than MDA).
Differential Revision: https://reviews.llvm.org/D140097
Francesco Petrogalli [Fri, 13 Jan 2023 09:04:39 +0000 (10:04 +0100)]
[SchedBoundary] Add dump method for resource usage.
As supporting information, I have added an example that describes how
the indexes of the vector of resources SchedBoundary::ReservedCycles
are tracked by the field SchedBoundary::ReservedCyclesIndex.
Reviewed By: jroelofs
Differential Revision: https://reviews.llvm.org/D141367
Nikita Popov [Thu, 12 Jan 2023 11:04:56 +0000 (12:04 +0100)]
[Mips] Convert some tests to opaque pointers (NFC)
I'm not sure why, but the absence of bitcasts / no-op GEPs causes
the branch delay slot to be used.
Differential Revision: https://reviews.llvm.org/D141593
Matthias Springer [Fri, 13 Jan 2023 09:23:51 +0000 (10:23 +0100)]
[mlir][affine][transform] Simplify affine.min/max ops with given constraints
This transform op uses `mlir::simplifyConstrainedMinMaxOp` to simplify `affine.min` and `affine.max` ops based on a given constraints.
Differential Revision: https://reviews.llvm.org/D140997
Sergey Kachkov [Fri, 13 Jan 2023 08:21:55 +0000 (11:21 +0300)]
[GVN][NFC] Refactor GVN::AnalyzeLoadAvailability method
Simplify AnalyzeLoadAvailability code:
1. Use std::optional for return value
2. Use range-based loop for non-local dependencies
Differential Revision: https://reviews.llvm.org/D141664
Tobias Gysi [Fri, 13 Jan 2023 09:14:21 +0000 (10:14 +0100)]
Reland "[mlir][llvm] Add an explicit void type debug info attribute."
Previously, the DISubroutineType attribute used an optional result
parameter and an optional argument types array to model the subroutine
signature. LLVM IR debug metadata, on the other hand, has one types
list whose first entry maps to the result type. That entry may be
null to model a void result type. The type list may also be entirely
empty not specifying any type information. The latter is problematic
since the current DISubroutineType attribute cannot express it.
The revision changes DISubroutineTypeAttr to closely follow the
LLVM metadata design. In particular, it uses a single types parameter
array to model the subroutine signature and introduces an explicit
DIVoidResultTypeAttr to model the null entries.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D141261
This reverts commit 81f57b6
and relands commit a960547
Fixes flang build and drop_begin on an empty array ref.
Ben Shi [Thu, 12 Jan 2023 11:58:53 +0000 (19:58 +0800)]
[clang] Redefine some AVR specific macros
Fixes https://github.com/llvm/llvm-project/issues/58855
Reviewed By: aykevl, Miss_Grape
Differential Revision: https://reviews.llvm.org/D141598
Rainer Orth [Fri, 13 Jan 2023 09:08:33 +0000 (10:08 +0100)]
[Driver] Add crtfastmath.o on Solaris if appropriate
`Flang :: Driver/fast_math.f90` `FAIL`s on Solaris because `crtfastmath.o`
is missing from the link line.
This patch adds it as appropriate.
Tested on `amd64-pc-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D141596
Diana Picus [Mon, 9 Jan 2023 08:21:41 +0000 (09:21 +0100)]
MachineIRBuilder: Add buildMergeValues. NFC
Add a `buildMergeValues` method that unconditionally builds a
G_MERGE_VALUES instruction, as opposed to `buildMergeLikeInstr` which
may decide on a different opcode based on the input types.
I haven't audited all the uses of `buildMergeLikeInstr` to see if they
can be replaced with `buildMergeValues`, but I did find a couple of
obvious ones where we check that we're merging scalars right before
calling `buildMerge`.
This is a follow-up suggested in https://reviews.llvm.org/D140964
Differential Revision: https://reviews.llvm.org/D141373
Diana Picus [Mon, 9 Jan 2023 10:59:00 +0000 (11:59 +0100)]
MachineIRBuilder: Rename buildMerge. NFC
`buildMerge` may build a G_MERGE_VALUES, G_BUILD_VECTOR or
G_CONCAT_VECTORS. Rename it to `buildMergeLikeInstr`.
This is a follow-up suggested in https://reviews.llvm.org/D140964
Differential Revision: https://reviews.llvm.org/D141372
Diana Picus [Thu, 12 Jan 2023 10:01:54 +0000 (11:01 +0100)]
GlobalISel: s/Op/Instr in some places. NFC
This patch replaces `GMergeLikeOp` with `GMergeLikeInstr` and
`MachineIRBuilder::buildAssertOp` with `buildAssertInstr` in order to
remove ambiguity. Discussed in: https://reviews.llvm.org/D141372
Jean Perier [Fri, 13 Jan 2023 08:15:52 +0000 (09:15 +0100)]
[flang] Lower elemental intrinsics to hlfir.elemental
- Move the core code generating hlfir.elemental for user calls from
genUserElementalCall into a new ElementalCallBuilder class and use
C++ CRTP (curiously recursive template pattern) to implement the
parts specific to user and intrinsic call into ElementalUserCallBuilder
and ElementalIntrinsicCallBuilder. This allows sharing the core logic
to lower elemental procedures for both user defined and intrinsics
procedures.
- To allow using ElementalCallBuilder, split the intrinsic lowering code
into two parts: first lower the arguments to hlfir::Entity regardless
of the interface of the intrinsics, and then, in a different function
(genIntrinsicProcRefCore), prepare the hlfir::Entity according to the
interface. This allows using the same core logic to prepare "normal"
arguments for non-elemental intrinsics, and to prepare the elements of
array arguments inside elemental call (ElementalIntrinsicCallBuilder
calls genIntrinsicProcRefCore once it has computed the scalar actual
arguments).
To allow this split, genExprBox/genExprAddr/genExprValue logic had to
be split in ConvertExprToHlfir.[cpp/h].
- Add missing statement context pushScope/finalizeAndPop around the
code generation inside the hlfir.elemental so that any temps created
while lowering the call at the element level is correctly cleaned-up.
- One piece of code in hlfir::Entity::hasNonDefaultLowerBounds() was wrong for assumed shape arrays (returned true when an assumed shaped array had no explicit lower bounds). This caused the added test to hit a bogus TODO, so fix it.
Elemental intrinsics returning are still TODO (e.g., adjustl). I will implement this in a next patch, this one is big enough.
Differential Revision: https://reviews.llvm.org/D141612
Siva Chandra Reddy [Fri, 13 Jan 2023 07:42:49 +0000 (07:42 +0000)]
[libc][NFC] Use C headers in host CPU sniffing code.
Yingchi Long [Fri, 16 Sep 2022 14:13:54 +0000 (22:13 +0800)]
[C2x] reject type definitions in offsetof
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm made very
clear that it is an UB having type definitions with in offsetof. After
this patch clang will reject any type definitions in __builtin_offsetof.
Fixes https://github.com/llvm/llvm-project/issues/57065
```
local/offsetof.c:10:38: error: 'struct S' cannot be defined in '__builtin_offsetof'
return __builtin_offsetof(struct S{ int a, b;}, a);
^
```
Reviewed By: aaron.ballman, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D133574
chenglin.bi [Fri, 13 Jan 2023 07:31:19 +0000 (15:31 +0800)]
[Instcombine] Add precommit tests for pattern xor(and, or); NFC
Carlos Galvez [Thu, 12 Jan 2023 10:10:48 +0000 (10:10 +0000)]
[clang-tidy][doc] Deprecate the AnalyzeTemporaryDtors option
It's not used anywhere, and we should not keep it
for eternity. Document it as deprecated and announce
its removal 2 releases later, so people have time
to update their .clang-tidy files.
Differential Revision: https://reviews.llvm.org/D141583
Yingchi Long [Fri, 9 Dec 2022 13:05:37 +0000 (21:05 +0800)]
[RISCV][VP] expand vp intrinsics if no +zve32x feature
If the subtarget does not support VInstructions, expand vp intrinscs to scalar instructions.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D139706
Ben Shi [Thu, 12 Jan 2023 09:21:55 +0000 (17:21 +0800)]
[AVR] Fix a bug in AsmPrinter when printing inline-asm operands
Fixes https://github.com/llvm/llvm-project/issues/58878
Reviewed By: aykevl, Miss_Grape
Differential Revision: https://reviews.llvm.org/D141589
Vitaly Buka [Fri, 13 Jan 2023 05:46:51 +0000 (21:46 -0800)]
[X86] Remove unused variable after D140087
Joshua Cao [Fri, 6 Jan 2023 04:48:13 +0000 (20:48 -0800)]
[LoopReroll] Allow for multiple loop control only induction vars
Before this, LoopReroll would fail an assertion, falsely assuming that
there can only possibly a single loop control only induction variable.
For example:
```
%a = phi i16 [ %dec2, %for.body ], [ 0, %entry ]
%b = phi i16 [ %dec1, %for.body ], [ 0, %entry ]
%a.next = add nsw i16 %1, -1
%b.next = add nsw i16 %0, -1
%add = add nsw i16 %a, %b
; ... rerollable code
%cmp.not = icmp eq i16 -10, %add
br i1 %cmp.not, label %exit, label %loop
```
Both %a and %b are valid loop control only induction vars
Additionally, some NFC changes to remove unnecessary isa<PHINode> check
Updated complex_reroll checks
Differential Revision: https://reviews.llvm.org/D141109
Noah Goldstein [Fri, 13 Jan 2023 02:30:00 +0000 (18:30 -0800)]
[X86] Improve mul x, 2^N +/- 2 pattern by making the +/- 2x compute independently to x << N
Previous pattern was omitting ops in sequence which just increases the
latency (to 3c, same as imul!) i.e:
`(add/sub (add/sub (shl x, N), x), x)`
Better is to compute 2x indepedently so x << N for better ULP i.e:
`(add/sub (shl x, N), (add x, x))`
Reviewed By: pengfei, RKSimon
Differential Revision: https://reviews.llvm.org/D141113
Noah Goldstein [Fri, 13 Jan 2023 02:24:43 +0000 (18:24 -0800)]
[X86] Replace (31/63 -/^ X) with (NOT X) and ignore (32/64 ^ X) when computing shift count
Shift count is masked by hardware so these peepholes just extend
common patterns for NOT to the lower bits of shift count.
As well (32/64 ^ X) is masked off by the shift so can be safely
ignored.
Reviewed By: pengfei, lebedev.ri
Differential Revision: https://reviews.llvm.org/D140087
Matt Arsenault [Fri, 30 Dec 2022 14:21:49 +0000 (09:21 -0500)]
AMDGPU/GlobalISel: Make regbankselect of implicit_def consistent with constants
LiDongjin [Fri, 13 Jan 2023 03:48:22 +0000 (11:48 +0800)]
[RISCV] Change the return type of getStreamer() to support the use of overloading and other functions in RISCVELFStreamer
Move the declaration of RISCVELFStreamer from RISCVELFStreamer.cpp to RISCVELFStreamer.h.
Change the return type of getStreamer() to support the use of overloading and other functions in RISCVELFStreamer.
Differential Revision: https://reviews.llvm.org/D138500
Med Ismail Bennani [Wed, 11 Jan 2023 00:28:25 +0000 (16:28 -0800)]
[lldb/test] Fix data racing issue in TestStackCoreScriptedProcess
This patch should fix an nondeterministic error in TestStackCoreScriptedProcess.
In order to test both the multithreading capability and shared library
loading in Scripted Processes, the test would create multiple threads
that would take the same variable as a reference.
The first thread would alter the value and the second thread would
monitor the value until it gets altered. This assumed a certain ordering
regarding the `std::thread` spawning, however the ordering was not
always guaranteed at runtime.
To fix that, the test now makes use of a `std::condition_variable`
shared between the each thread. On the former, it will notify the other
thread when the variable gets initialized or updated and on the latter,
it will wait until the variable it receives a new notification.
This should fix the data racing issue while preserving the testing
coverage.
rdar://
98678134
Differential Revision: https://reviews.llvm.org/D139484
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 12 Jan 2023 23:30:24 +0000 (15:30 -0800)]
[lldb] Update custom commands to always be overrriden
This is a follow-up patch to
6f7835f309b9.
As explained previously, when running from an IDE, it can happen that
the IDE imports some lldb scripts by itself. If the user also tries to
import these commands, lldb will show the following message:
```
error: cannot add command: user command exists and force replace not set
```
This message is confusing to the user, because it suggests that the
command import failed and that the execution should stop. However, in
this case, lldb will continue the execution with the command added
previously by the user.
To prevent that, this patch updates every first-party lldb-packaged
custom commands to override commands that were pre-imported in lldb.
Differential Revision: https://reviews.llvm.org/D140293
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 12 Jan 2023 23:29:19 +0000 (15:29 -0800)]
[lldb] Force override when adding crashlog command
When using interactive crashlog from an IDE, it can happen that the user
already have the `command script import lldb.macosx.crashlog` command on
their `lldbinit` file.
That leads to showing some message:
```
error: cannot add command: user command exists and force replace not set
error: cannot add command: user command exists and force replace not set
```
This leads to confusion because the crashlog symbolication continues and
succeeds even after these errors.
To address that, the crashlog commands get overridden everytime the
script get re-imported.
rdar://
103403943
Differential Revision: https://reviews.llvm.org/D140113
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 12 Jan 2023 23:27:45 +0000 (15:27 -0800)]
[lldb/Process] Populate queues in Scripted Process
This patch enhances queue support in Scripted Processes.
Scripted Threads could already report their queue name if they had one,
but this information was only surfaced when getting the process and
thread status.
However, no queue was create and added to the scripted process queue
list. This patch improves that by creating a queue from the scripted
thread queue name. For now, it uses an invalid queue id, since the
scripted thread doesn't expose this capability yet, but this could
easily be supported if the queue id information is available.
rdar://
98844004
Differential Revision: https://reviews.llvm.org/D139853
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 12 Jan 2023 23:26:49 +0000 (15:26 -0800)]
[lldb/crashlog] Refactor CrashLogParser into a Factory pattern
This patch should fix an undefined behaviour that's happening when
parsing a crash report from an IDE. In the previous implementation, the
CrashLogParser base class would use the `__new__` static class method to
create the right parser instance depending on the crash report type.
For some reasons, the derived parser initializer wouldn't be called when
running the command from an IDE, so this patch refactors the
CrashLogParser code to replace the use of the `__new__` method with a
factory `create` static method.
rdar://
100527640
Differential Revision: https://reviews.llvm.org/D139951
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Owen Anderson [Thu, 12 Jan 2023 04:53:30 +0000 (21:53 -0700)]
Remove a workaround for libstdc++4.8
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D141564
Nico Weber [Fri, 13 Jan 2023 03:04:20 +0000 (22:04 -0500)]
[gn] Reformat all build files
Ran:
git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
Joseph Huber [Fri, 13 Jan 2023 02:35:51 +0000 (20:35 -0600)]
[LinkerWrapper] Adjust test after a previous change in temp file names
Summary:
This patch adjusts the test to correctly search for the temp files
created after a previous patch changed the name. This wasn't caught
because it still technically worked.
v1nh1shungry [Fri, 13 Jan 2023 02:15:13 +0000 (03:15 +0100)]
[clangd] support expanding `decltype(expr)`
Enable the existing tweak `ExpandAutoType` to expand
`decltype(expr)`, e.g.
```
decltype(0) i;
```
will expand to
```
int i;
```
Therefore, rename the tweak `ExpandAutoType` to `ExpandDeducedType`.
This patch also fixes some nits,
* avoid replacing reference to a function
* avoid replacing array types and reference to an array
Fixes https://github.com/clangd/clangd/issues/1456
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D141226
Hui Li [Fri, 13 Jan 2023 02:17:48 +0000 (10:17 +0800)]
[LLDB][LoongArch] Add unittests for EmulateInstructionLoongArch
Add unit tests For EmulateInstructionLoongArch existing branch instruction.
Add 19 test cases in total.
Without this patch:
```
$ ninja check-lldb-unit
[0/1] Running lldb unit test suite
Testing Time: 10.55s
Passed: 1025
```
With this patch:
```
$ ninja check-lldb-unit
[0/1] Running lldb unit test suite
Testing Time: 10.45s
Passed: 1044
```
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D140386
Hui Li [Fri, 13 Jan 2023 02:16:29 +0000 (10:16 +0800)]
[LLDB][LoongArch] ObjectFile: add a case for `EM_LOONGARCH`
This adds the jump slot mapping for LoongArch. This is a simple
change that ensures lldb running properly.
Note that this problem was found only when CMake variables
"DLLVM_ENABLE_ASSERTIONS=ON" is selected.
Without this patch,
```
$ build/bin/lldb test
../ELFHeader::GetRelocationJumpSlotType() const: Assertion `false && "architecture not supported"' fail
```
With this patch
```
$ build/bin/lldb test
(lldb) target create "test"
Current executable set to '../test' (loongarch64).
```
Reviewed By: SixWeining, DavidSpickett
Differential Revision: https://reviews.llvm.org/D141245
Vitaly Buka [Fri, 13 Jan 2023 02:09:15 +0000 (18:09 -0800)]
Revert "[MergeICmps] Adapt to non-eq comparisons"
Breaks ubsan build, details in D141188.
This reverts commit
3ac2b3a4f9effc9f79822e770f209fd70ff66362.
Tony Tye [Thu, 5 Jan 2023 00:34:02 +0000 (00:34 +0000)]
[AMDGPU][NFC] Heterogeneous DWARF extensions update
- Clarify CFI rules in heterogeneous DWARF extensions
- Added DWARF source language memory spaces.
- Added DWARF architecture address spaces.
- Other minor corrections.
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D141548
Ben Shi [Fri, 13 Jan 2023 01:25:42 +0000 (09:25 +0800)]
[clang][test] Remove unnecessary 'REQUIRES'
The test 'Preprocessor/predefined-arch-macros.c' contains many
target tests than 'amdgpu'. If clang is built without 'amdgpu',
then failures in other target tests will not be reported.
Reviewed By: aaron.ballman, MaskRay
Differential Revision: https://reviews.llvm.org/D141647
Kirill Stoimenov [Thu, 12 Jan 2023 21:31:49 +0000 (13:31 -0800)]
[LSAN] More LSAN interface tweaking.
Main goal is to remove thread registry dependency from the interface because HWASAN is using its own code to manage threads.
Reviewed By: vitalybuka, kstoimenov
Differential Revision: https://reviews.llvm.org/D140039
Joseph Huber [Fri, 13 Jan 2023 01:56:24 +0000 (19:56 -0600)]
[LinkerWrapper] Fix test on Windows
Summary:
`clang` is called `clang.exe` on windows, we need to glob the text
inbetween.
Richard Smith [Fri, 13 Jan 2023 01:21:45 +0000 (17:21 -0800)]
Remove a bogus assertion.
The result of recomputing the type of an LValue may be different from
the type we find serialized with that LValue, either due to differing
type sugar in a redeclaration, or more significantly due to a later
declaration of a variable having an array bound that a prior declaration
did not have. Therefore this assertion was attempting to verify a
property that isn't necessarily true.
Nico Weber [Sun, 20 Nov 2022 16:59:16 +0000 (11:59 -0500)]
[lld/mac] Add support for distributed ThinLTO
Adds support for the following flags:
* --thinlto-index-only, --thinlto-index-only=
* --thinlto-emit-imports-files
* --thinlto-emit-index-files
* --thinlto-object-suffix-replace=
* --thinlto-prefix-replace=
See https://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html
for some words on --thinlto-index-only.
I don't really need the other flags, but they were in the vicinity
and _someone_ might need them, so I figured I'd add them too.
`-object_path_lto` now sets `c.AlwaysEmitRegularLTOObj` as in the other ports,
which means it can now only point to a filename for non-thin LTO.
I think that was the intent of D129705 anyways, so update
test/MachO/lto-object-path.ll to use a non-thin bitcode file for that test.
Differential Revision: https://reviews.llvm.org/D138451
Teresa Johnson [Thu, 12 Jan 2023 01:16:03 +0000 (17:16 -0800)]
[MemProf] Collect access density statistics during profiling
Track min/max/avg access density (accesses per byte and accesses per
byte per lifetime second) metrics directly during profiling. This allows
more accurate use of these metrics in profile analysis and use, instead
of trying to compute them from already aggregated data in the profile.
This required regenerating some of the raw profile and executable inputs
for a few tests. While here, make the llvm-profdata memprof tests more
resilient to differences in things like memory mapping, timestamps and
cpu ids to make future test updates easier.
Differential Revision: https://reviews.llvm.org/D141558
Yeting Kuo [Thu, 12 Jan 2023 10:14:24 +0000 (18:14 +0800)]
[RISCV] Custom lower vector ISD::CTLZ to the minimum of ISD::CTLZ_ZERO_UNDEF and element size.
D111904 made RISC-V customized lower ISD::CTLZ_ZERO_UNDEF by converting to float
and using the float result. The expected value of CTLZ with zero input is the
element size of input type. Since the result of above method with zero input
must be greater than the element size, for ISD::CTLZ, we could use the minimum
of element size and the result of CTLZ_ZERO_UNDER with same input.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D141585
Vitaly Buka [Fri, 13 Jan 2023 01:30:26 +0000 (17:30 -0800)]
Revert "[LSAN] More LSAN interface tweaking."
Breaks bots.
Also it's missing changes we discussed on review.
This reverts commit
f001e50f955c3cdf2deb79e38a9fd19c9a781882.
This reverts commit
2924189233fdb724453ead4b94595107b1ce9cfa.
eopXD [Tue, 27 Dec 2022 09:12:51 +0000 (01:12 -0800)]
[Clang][RISCV] Update operand order for vmerge and vcompress
From:
vint32m1_t vmerge_vvm_i32m1 (vbool32_t mask, vint32m1_t op1, vint32m1_t op2, size_t vl);
vint32m1_t vcompress_vm_i32m1 (vbool32_t mask, vint32m1_t src, size_t vl);
To:
vint32m1_t vmerge_vvm_i32m1 (vint32m1_t op1, vint32m1_t op2, vbool32_t selector, size_t vl);
vint32m1_t vcompress_vm_i32m1 (vint32m1_t src, vbool32_t selector, size_t vl);
Address issues:
riscv-non-isa/rvv-intrinsic-doc#140
riscv-non-isa/rvv-intrinsic-doc#167
Pull request:
riscv-non-isa/rvv-intrinsic-doc#185
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D140686
Nico Weber [Fri, 13 Jan 2023 01:07:55 +0000 (20:07 -0500)]
[gn] port
3432f4bf86e7 (//llvm/lib/Testing/Annotations)
v1nh1shungry [Thu, 12 Jan 2023 23:40:05 +0000 (23:40 +0000)]
[clang-tidy] don't warn when returning the result for bugprone-standalone-empty
Relevant issue: https://github.com/llvm/llvm-project/issues/59517
Currently this check will warn when the result is used in a `return`
statement, e.g.
```
bool foobar() {
std::vector<int> v;
return v.empty();
// will get a warning here, which makes no sense IMO
}
```
Reviewed By: cjdb, denik
Differential Revision: https://reviews.llvm.org/D141107
Keith Smiley [Thu, 12 Jan 2023 22:43:12 +0000 (14:43 -0800)]
[lld-macho] Downgrade missing fat arch to warning
This mirrors ld64's behavior. In many cases this likely still leads to a
link failure but if you didn't actually use anything from the library
it can be ignored. If you care about these invalid cases -fatal_warnings
still upgrades it back to an error.
Example: https://github.com/keith/ld64.lld/issues/3
Differential Revision: https://reviews.llvm.org/D141638
Alex Brachet [Fri, 13 Jan 2023 00:47:46 +0000 (00:47 +0000)]
[lsan] Fix build for Fuchsia after D140039
Xiang1 Zhang [Wed, 11 Jan 2023 08:54:07 +0000 (16:54 +0800)]
Add -disable-check-noreturn-call for stack protect
Differential Revision: https://reviews.llvm.org/D141556
Reviewed By: lanza
Matt Arsenault [Thu, 12 Jan 2023 01:34:00 +0000 (20:34 -0500)]
OpenMP: Use inbounds in EmitOMPAggregateAssign
This looked like a plausibly correct out of tree patch.
The changed testcases with the pragmas stripped out only use
inbounds GEPs so I assume this is correct.
Mitch Phillips [Thu, 12 Jan 2023 23:58:36 +0000 (15:58 -0800)]
Revert "[GWP-ASan] Add recoverable mode."
This reverts commit
90a9beb7cc9755791caa23dfc4e36bc544e98ed3.
Reason: Broke an internal build.
Mitch Phillips [Thu, 12 Jan 2023 23:58:10 +0000 (15:58 -0800)]
Revert "[GWP-ASan] Fix test to work with Fuchsia's zxtest"
This reverts commit
64138725e4cf0ab5e3f9c0dba38e11ce3d3b4017.
Parent change https://reviews.llvm.org/D140173 broke an internal build.
I'll land this bit as part of the re-land for
https://reviews.llvm.org/D140173.
Mitch Phillips [Thu, 12 Jan 2023 23:57:27 +0000 (15:57 -0800)]
Revert "[GWP-ASan] Fix 6413872"
This reverts commit
df87e62cbd4b5090b5349247d29457706d2ac4e8.
Parent change https://reviews.llvm.org/D140173 broke an internal build.
I'll integrate this patch into the re-land for
https://reviews.llvm.org/D140173.
Kirill Stoimenov [Thu, 12 Jan 2023 00:03:41 +0000 (00:03 +0000)]
[LSAN] More LSAN interface tweaking.
Main goal is to remove thread registry dependency from the interface because HWASAN is using its own code to manage threads.
Reviewed By: vitalybuka, kstoimenov
Differential Revision: https://reviews.llvm.org/D140039
Johannes Doerfert [Thu, 12 Jan 2023 23:29:55 +0000 (15:29 -0800)]
[OpenMP][FIX] The thread limit is the block, not grid size
Artem Belevich [Thu, 12 Jan 2023 01:09:21 +0000 (17:09 -0800)]
[CUDA] added cmath wrappers to unbreak CUDA compilation after D79555
libc++ introduced a handful of internal functions that may or may not be
constexpr, depending on C++ version. For pre-constexpr variants we must declare
__device__ counterparts. Otherwise the code fails to compile on the GPU side.
See https://reviews.llvm.org/D79555
Differential Revision: https://reviews.llvm.org/D141555
Diego Caballero [Thu, 12 Jan 2023 23:11:45 +0000 (23:11 +0000)]
[mlir][linalg] Fix incorrect reduction detection in Vectorizer
When detecting reductions, make sure the block argument is from the linalg generic op.
This fixes https://github.com/iree-org/iree/issues/11779.
Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D141413
bixia1 [Thu, 12 Jan 2023 00:25:50 +0000 (16:25 -0800)]
[mlir][sparse] Minor code clean up (NFC).
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D141554
Johannes Doerfert [Thu, 12 Jan 2023 23:19:35 +0000 (15:19 -0800)]
[Attributor][FIX] Consistently use the access/remote instruction
We use the actual access (=remote) instruction when reasoning about
accesses, except for one leftover use case of the local instruction.
This caused us to potentially ignore the dominating write if the read
and write were in a different function than the (stack) allocation.
Reported by @ye-luo
Nikolas Klauser [Mon, 9 Jan 2023 00:39:58 +0000 (01:39 +0100)]
[libc++] Add clang-tidy to the list of possible substitutions for %{clang-tidy}
Most people don't have a versioned clang-tidy locally. This allows them to still run the clang-tidy test if they have a suitable version.
Reviewed By: ldionne, #libc
Spies: libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D141241
River Riddle [Thu, 12 Jan 2023 22:43:32 +0000 (14:43 -0800)]
[mlir][NFC] Use explicit ArrayRef construction in OptionalArrayRefParameter
GCC was barfing on template deduction for ArrayRef parameters in
some situations.
River Riddle [Thu, 12 Jan 2023 22:20:00 +0000 (14:20 -0800)]
[mlir][AttrType] Emit unbalanced character errors using the last punctuation used
This gives a better diagnostic in general, because it indicates that the user didn't
close out the last open puncutation range. For example:
```
foo.op {
some.op -> !blah.pointer<
}
```
We want the error to hint about the unclosed `<`, not the `}` (which isn't really in the context of the type).
Differential Revision: https://reviews.llvm.org/D141635