Lei Huang [Tue, 20 Dec 2022 16:11:55 +0000 (10:11 -0600)]
[PowerPC] Implement P10 Byte Reverse Insructions
Generate brh, brw and brd instructions for byte-swap operations
on P10 and generating a single instruction for a 32-bit swap followed
by a 16-bit right shift.
Reviewed By: stefanp
Differential Revision: https://reviews.llvm.org/D140414
David Green [Wed, 21 Dec 2022 14:59:59 +0000 (14:59 +0000)]
[AArch64] Combine Trunc(DUP) -> DUP
This adds a simple fold of TRUNCATE(AArch64ISD::DUP) -> AArch64ISD::DUP,
which can help generate more optimal UMULL sequences, and seems useful
in general.
Differential Revision: https://reviews.llvm.org/D140289
Nikita Popov [Wed, 21 Dec 2022 14:41:54 +0000 (15:41 +0100)]
[InstCombine] Recursively replace select value equivalence
In the X == C ? f(X) : Y -> X == C ? f(C) : Y fold, perform the
replacement in f(X) recursively. For now, this just goes two
instructions up rather than one instruction up.
luxufan [Wed, 21 Dec 2022 14:47:12 +0000 (22:47 +0800)]
[InstCombine] Combine ZExt (B - A) + ZExt(A) to ZExt(B)
Combine ZExt (B - A) + ZExt(A) to ZExt(B)
https://alive2.llvm.org/ce/z/ESUwPi
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D139930
Florian Hahn [Wed, 21 Dec 2022 14:36:24 +0000 (14:36 +0000)]
[LV] Move SCEV caching workaround to executePlan (NFC).
As suggested by @Ayal in D92132.
This avoids having to duplicate the workaround in multiple places.
Nikita Popov [Wed, 21 Dec 2022 14:46:51 +0000 (15:46 +0100)]
[InstCombine] Add additional tests for select value equivalence fold (NFC)
Nikolas Klauser [Tue, 20 Dec 2022 19:21:31 +0000 (20:21 +0100)]
[libc++] Also install libclang in the Docker image
This is now everything that is required for clang-tidy checks.
Reviewed By: #libc, ldionne
Spies: libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D140424
Matt Arsenault [Tue, 20 Dec 2022 13:20:28 +0000 (08:20 -0500)]
SCCPSolver: Remove unnecessary set empty check
Hans Wennborg [Wed, 21 Dec 2022 14:21:04 +0000 (15:21 +0100)]
Revert "Reland "[pgo] Avoid introducing relocations by using private alias""
This caused lld on mac to assert when building instrumented clang (or
instrumented code in general). See comment on the code review for
reproducer.
> In many cases, we can use an alias to avoid a symbolic relocations,
> instead of using the public, interposable symbol. When the instrumented
> function is in a COMDAT, we can use a hidden alias, and still avoid
> references to discarded sections.
>
> New compiler-rt tests are Linux only for now.
>
> Previous versions of this patch allowed the compiler to name the
> generated alias, but that would only be valid when the functions were
> local. Since the alias may be used across TUs we use a more
> deterministic naming convention, and add a `.local` suffix to the alias
> name just as we do for relative vtables aliases.
>
> Reviewed By: phosek
>
> Differential Revision: https://reviews.llvm.org/D137982
This reverts commit
c42e50fede53bbcce79095e7c8115f26826c81ae.
Mirko Brkusanin [Wed, 21 Dec 2022 14:05:30 +0000 (15:05 +0100)]
[AMDGPU][GlobalISel] Fix mapping G_FREEZE
Differential Revision: https://reviews.llvm.org/D140416
Peter Waller [Mon, 12 Dec 2022 15:49:58 +0000 (15:49 +0000)]
[AArch64][SVE][CodeGen] Prefer ld1r* over indexed-load when consumed by a splat
If a load is consumed by a single splat, don't consider indexed loads.
This is an alternative implementation to D138581.
Depends on D139637.
Differential Revision: https://reviews.llvm.org/D139850
Alexey Bataev [Tue, 13 Dec 2022 20:45:16 +0000 (12:45 -0800)]
[SLP]Integrate looking through shuffles logic into ShuffleInstructionBuilder.
Added BaseShuffleAnalysis as a base class for ShuffleInstructionBuilder
and integrated shuffle logic from shuffles for externally used scalars
into this class. This class is used as the main container that
implements smart shuffle instruction builder logic.
ShuffleInstructionBuilder uses this logic.
ShuffleInstructionBuilder is also used in building of the shuffle for
the externally used scalars instead of lambdas, which are now part of BaseShuffleAnalysis class.
Differential Revision: https://reviews.llvm.org/D140100
Paul Robinson [Mon, 12 Dec 2022 19:51:41 +0000 (11:51 -0800)]
[lit] Document the 'target=<triple>' feature
Differential Revision: https://reviews.llvm.org/D139869
Florian Hahn [Wed, 21 Dec 2022 13:58:50 +0000 (13:58 +0000)]
[LV] Support widened induction variables in epilogue vectorization.
Code generation now uses the start VPValue of induction recipes.
This makes it possible to adjust the start value of the epilogue
vector loop to use the 'resume' value of the main vector loop.
Fixes #59459.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D92132
Yingchi Long [Sat, 10 Dec 2022 15:03:26 +0000 (23:03 +0800)]
[JT] check xor operand is exactly the same in processBranchOnXOR
Reproducer:
; RUN: opt -S -jump-threading < %s
define void @test() {
entry:
br i1 false, label %loop, label %exit
loop:
%bool = phi i1 [ %xor, %loop.latch ], [ false, %entry ]
%cmp = icmp eq i16 0, 1
%xor = xor i1 %cmp, %bool
br i1 %bool, label %loop.latch, label %exit
loop.latch:
%dummy = phi i16 [ 0, %loop ]
br label %loop
exit:
ret void
}
On this occassion, phi node %bool is actually %xor, and doing substitution causes assertion failure.
Fixes: https://github.com/llvm/llvm-project/issues/58812
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D139783
Paul Robinson [Wed, 21 Dec 2022 13:41:00 +0000 (05:41 -0800)]
[hwasan] Convert tests to check 'target=...'
Part of the project to eliminate special handling for triples in lit
expressions.
Aliia Khasanova [Wed, 21 Dec 2022 13:37:25 +0000 (14:37 +0100)]
BEGIN_PUBLIC
Add a shortened printing/parsing form for linalg.map and linalg.reduce.
END_PUBLIC
Differential Revision: https://reviews.llvm.org/D140406
Paul Robinson [Wed, 21 Dec 2022 13:31:38 +0000 (05:31 -0800)]
[compiler-rt] Simplify lit test thumb checks
Matt Arsenault [Wed, 21 Dec 2022 13:09:56 +0000 (08:09 -0500)]
clang: Respect function address space for __builtin_function_start
Fixes assertion.
Matt Arsenault [Wed, 21 Dec 2022 12:57:49 +0000 (07:57 -0500)]
clang: Fix another assert from not respecting function address spaces
Matt Arsenault [Wed, 21 Dec 2022 12:33:18 +0000 (07:33 -0500)]
clang: Use correct address space for redeclared functions
Fixes assert/verifier error with AVR.
Florian Hahn [Wed, 21 Dec 2022 13:23:25 +0000 (13:23 +0000)]
[LV] Add test for #59459.
Paul Robinson [Wed, 21 Dec 2022 13:22:10 +0000 (05:22 -0800)]
[libcxxabi] Use 'target=' consistently
Paul Robinson [Wed, 21 Dec 2022 13:17:56 +0000 (05:17 -0800)]
[clang/xray] Convert tests to check 'target=...'
Part of the project to eliminate special handling for triples in lit
expressions.
Ivan Butygin [Mon, 19 Dec 2022 21:26:07 +0000 (22:26 +0100)]
[mlir] Make `LocalAliasAnalysis` extesible
This is an alternative to https://reviews.llvm.org/D138761 . Instead of adding ad-hoc attributes to existing `LocalAliasAnalysis`, expose `aliasImpl` method so user can override it.
Differential Revision: https://reviews.llvm.org/D140348
Alexey Lapshin [Fri, 23 Sep 2022 06:34:26 +0000 (09:34 +0300)]
[DWARFv4][DWARFv5][DWARFLinker] support debug_macinfo/debug_macro tables.
This patch adds handling of debug_macinfo/debug_macro tables to the DWARFLinker.
It uses already existing code for reading tables from DWARFDebugMacro.h.
It adds new code writing tables into the DwarfStreamer::emitMacroTables.
Differential Revision: https://reviews.llvm.org/D140223
Ben Shi [Tue, 13 Dec 2022 04:07:40 +0000 (12:07 +0800)]
[clang] Do not extend i8 return values to i16 on AVR.
Reviewed By: Miss_Grape, aykevl
Differential Revision: https://reviews.llvm.org/D139908
Evgenii Kudriashov [Wed, 21 Dec 2022 11:58:25 +0000 (19:58 +0800)]
[X86] combine-and.ll - add 256 and 512 bit test coverage for scalar broadcast
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D139991
Matthias Springer [Wed, 21 Dec 2022 11:39:19 +0000 (12:39 +0100)]
[mlir][bufferize] Fix tensor copy insertion for dynamic tensors
TensorCopyInsertion inserts bufferization.alloc_tensor ops in case of RaW conflicts. If such a tensor is dynamically shaped, tensor.dim ops are inserted. There is an optimization for ops such as tensor.extract_slice: A copy of the result is created instead of the operand. Afterwards, all uses of the result are updated. E.g.:
```
%0 = tensor.extract_slice ... : tensor<?xf32> to tensor<?xf32>
%1 = tensor.dim %0, %c0 : tensor<?xf32>
%2 = bufferization.alloc_tensor(%dim) : tensor<?xf32>
```
All uses of %0, except for tensor.dim and bufferization.alloc_tensor (if any), should be replaced. Before this change, the use in tensor.dim was also replaced, resulting in IR that had a dominance error.
Note: There is no test case for this fix because the bug cannot be triggered with tensor.extract_slice, which implements an interface to reify result shapes. This bug appeared in an external project with a tensor.extract_slice-like op that does not implement that interface, in which case tensor.dim ops must be created. We do not have such an op in MLIR to trigger this bug.
Differential Revision: https://reviews.llvm.org/D140471
Nikita Popov [Wed, 21 Dec 2022 11:36:15 +0000 (12:36 +0100)]
[ARM] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 21 Dec 2022 11:32:56 +0000 (12:32 +0100)]
[ARM] Regenerate test checks (NFC)
Ties Stuij [Wed, 21 Dec 2022 11:08:55 +0000 (11:08 +0000)]
[AArch64] GlobalIsel codegen for gpr CTZ
If feature CSSC is available, CTTZ intrinsics are lowered using the CTZ
instruction when using GlobalIsel.
spec:
https://developer.arm.com/documentation/ddi0602/2022-09/Base-Instructions/CTZ--Count-Trailing-Zeros-
Reviewed By: paquette
Differential Revision: https://reviews.llvm.org/D139418
Elena Lepilkina [Wed, 14 Dec 2022 15:37:44 +0000 (18:37 +0300)]
[RISCV] Omit SRA in case of setlt or setge with zero constant
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D140206
Elena Lepilkina [Fri, 16 Dec 2022 06:49:11 +0000 (09:49 +0300)]
[Precommit][RISCV] Test folding for RISCVISD::BR_CC node
Precommit test for https://reviews.llvm.org/D140206
bipmis [Wed, 21 Dec 2022 11:14:45 +0000 (11:14 +0000)]
[AAch64] Optimize muls with operands having enough zero bits.
Fix the regression in the reported test case lagarith-preproc.c.
Specfic to the incorrect umsubl generation.
Differential Revision: https://reviews.llvm.org/D139411
Max Kazantsev [Wed, 21 Dec 2022 05:47:36 +0000 (12:47 +0700)]
[SCEV] Help getLoopInvariantExitCondDuringFirstIterations deal with complex `umin` exit counts. PR59615
Recent improvements in symbolic exit count computation revealed some problems with
SCEV's ability to find invariant predicate during first iterations. Ultimately it is based on its
ability to prove some facts for value on the last iteration. This last value, when it includes
`umin` as part of exit count, isn't always simplified enough. The motivating example is following:
https://github.com/llvm/llvm-project/issues/59615
Could not prove:
```
Pred = 36, LHS = (-1 + (-1 * (
2147483645 umin (-1 + %var)<nsw>))<nsw> + %var), RHS = %var
FoundPred = 36, FoundLHS = {1,+,1}<nuw><nsw><%bb3>, FoundRHS = %var
```
Can prove:
```
Pred = 36, LHS = (-1 + (-1 * (-1 + %var)<nsw>)<nsw> + %var), RHS = %var
FoundPred = 36, FoundLHS = {1,+,1}<nuw><nsw><%bb3>, FoundRHS = %var
```
Here ` (
2147483645 umin (-1 + %var)<nsw>)` is exit count composed of two parts from
two different exits: `
2147483645 ` and `(-1 + %var)<nsw>`. When it was only one (latter)
analyzeable exit, for it everything was easily provable. Unfortunately, in general case `umin`
in one of `add`'s operands doesn't guarantee that the whole sum reduces, especially in presence
of negative steps and lack of `nuw`. I don't think there is a generic legal way to somehow play
around this `umin`.
So the ad-hoc solution is following: if we failed to find an equivalent predicate that is invariant
during first `MaxIter` iterations, and `MaxIter = umin(a, b, c...)`, try to find solution for at least one
of `a`, `b`, `c`... Because they all are `uge` than `MaxIter`, whatever is true during `a (b, c)` iterations
is also true during `MaxIter` iterations.
Differential Revision: https://reviews.llvm.org/D140456
Reviewed By: nikic
Ties Stuij [Wed, 21 Dec 2022 10:08:19 +0000 (10:08 +0000)]
[lld][ARM] support absolute thunks for Armv4T Thumb and interworking
changes:
- BLX: The Arm architecture versions that support the branch and link
instruction (BLX), can rewrite BLs in place when a state change from Arm<->Thumb
is required. Armv4T does not have BLX and so needs thunks for state changes.
- v4T Thumb long branches needed their own thunk. We could have used the v6M
implementation, but v6M doesn't have Arm state and must resolve to rather
inefficient stack reshuffling. We also can't reuse v7 thumb thunks as they use
MOVV/MOVT, which wasn't available yet for v4T.
- Remove the `lack of BLX' warning. LLVM only supports Arm Architecture versions
upwards of v4, which we now all support in LLD.
- renamed existing thunks to better reflect their use:
ARMV5ABSLongThunk -> ARMV5LongLdrPcThunk,
ARMV5PILongThunk -> ARMV4PILongThunk
- removed isCompatibleWith method from ARMV5ABSLongThunk and ARMV5PILongThunk,
as they were identical to the ARMThunk parent class implementation.
Support for (efficient) position independent thunks for v4T will be added in a
follow-up patch, including possible related thunk renaming and code comment
cleanup.
Reviewed By: MaskRay, peter.smith
Differential Revision: https://reviews.llvm.org/D139888
Christudasan Devadasan [Wed, 21 Dec 2022 10:41:30 +0000 (16:11 +0530)]
Revert "[AMDGPU][SILowerSGPRSpills] Spill SGPRs to virtual VGPRs"
This reverts commit
40ba0942e2ab1107f83aa5a0ee5ae2980bf47b1a.
Jay Foad [Tue, 20 Dec 2022 17:19:01 +0000 (17:19 +0000)]
[SelectionDAG] Fix EmitCopyFromReg for cloned nodes
Change EmitCopyFromReg to check all users of cloned nodes (as well as
non-cloned nodes) instead of assuming that they all copy the defined
value back to the same physical register.
This partially reverts
968e2e7b3db1 (svn r62356) which claimed:
CreateVirtualRegisters does trivial copy coalescing. If a node def is
used by a single CopyToReg, it reuses the virtual register assigned to
the CopyToReg. This won't work for SDNode that is a clone or is itself
cloned. Disable this optimization for those nodes or it can end up
with non-SSA machine instructions.
This is true for CreateVirtualRegisters but r62356 also updated
EmitCopyFromReg where it is not true. Firstly EmitCopyFromReg only
coalesces physical register copies, so the concern about SSA form does
not apply. Secondly making the loop over users in EmitCopyFromReg
conditional on `!IsClone && !IsCloned` breaks the handling of cloned
nodes, because it leaves MatchReg set to true by default, so it assumes
that all users will copy the defined value back to the same physical
register instead of actually checking.
Differential Revision: https://reviews.llvm.org/D140417
Jay Foad [Tue, 20 Dec 2022 17:51:20 +0000 (17:51 +0000)]
[SelectionDAG] Precommit EmitCopyFromReg test for D140417
Nikita Popov [Wed, 21 Dec 2022 10:40:33 +0000 (11:40 +0100)]
[cmake] Copy llvm-driver-template.cpp.in into build dir as well
We were copying it into the installed version of the directory,
but not into the one in the build directory. Because of that it
was not directly usable as a cmake module by subprojects that
also use the driver functionality.
Sameer Sahasrabuddhe [Wed, 21 Dec 2022 09:55:55 +0000 (15:25 +0530)]
[Attributor] potential constant values for PHI and Load
AAPotentialConstantValues now works for PHI and Load by simply examinig
AAPotentialValues for the instruction itself.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D140371
Matthias Springer [Wed, 21 Dec 2022 09:51:10 +0000 (10:51 +0100)]
[mlir] Add RuntimeVerifiableOpInterface and transform
Static op verification cannot detect cases where an op is valid at compile time but may be invalid at runtime.
An example of such an op is `memref::ExpandShapeOp`.
Invalid at compile time: `memref.expand_shape %m [[0, 1]] : memref<11xf32> into memref<2x5xf32>`
Valid at compile time (because we do not know any better): `memref.expand_shape %m [[0, 1]] : memref<?xf32> into memref<?x5xf32>`. This op may or may not be valid at runtime depending on the runtime shape of `%m`.
Invalid runtime ops such as the one above are hard to debug because they can crash the program execution at a seemingly unrelated position or (even worse) compute an invalid result without crashing.
This revision adds a new op interface `RuntimeVerifiableOpInterface` that can be implemented by ops that provide additional runtime verification. Such runtime verification can be computationally expensive, so it is only generated on an opt-in basis by running `-generate-runtime-verification`. A simple runtime verifier for `memref::ExpandShapeOp` is provided as an example.
Differential Revision: https://reviews.llvm.org/D138576
Dmitry Preobrazhensky [Wed, 21 Dec 2022 09:49:48 +0000 (12:49 +0300)]
[AMDGPU][GFX11][DOC][NFC] Add GFX11 assembler syntax description
Piotr Sobczak [Tue, 20 Dec 2022 16:42:13 +0000 (17:42 +0100)]
[AMDGPU][MC][NFC] MUBUF/MTBUF code cleanup
Refactor code to reduce code duplication and improve maintainability.
- Extract BUF_Pseudo common base class
- Refactor getMUBUFInsDA
- Refactor getMUBUFAtomicInsDA
- Refactor getMTBUFInsDA
- Refactor getMUBUFAsmOps
- Refactor getMTBUFAsmOps
Differential Revision: https://reviews.llvm.org/D140410
Juan Manuel MARTINEZ CAAMAÑO [Wed, 21 Dec 2022 08:38:47 +0000 (03:38 -0500)]
[Clang][CGDebugInfo][ObjC] Mark objc bitfields with the DIFlagBitfield flag
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D140195
Balázs Kéri [Wed, 21 Dec 2022 08:31:29 +0000 (09:31 +0100)]
[clang][AST] Compare UnresolvedLookupExpr in structural equivalence.
Reviewed By: gamesh411
Differential Revision: https://reviews.llvm.org/D136848
LiDongjin [Tue, 22 Nov 2022 09:23:58 +0000 (17:23 +0800)]
[RISCV] Enable the LocalStackSlotAllocation pass support.
Differential Revision: https://reviews.llvm.org/D98101
Co-authored-by: luxufan <luxufan@iscas.ac.cn>
Balázs Kéri [Wed, 21 Dec 2022 08:05:43 +0000 (09:05 +0100)]
[clang-tidy] Fix crash in bugprone-suspicious-realloc-usage.
The problem occurs if a statement is found by the checker that has a null child.
Fixes issue #59518.
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D140194
Craig Topper [Wed, 21 Dec 2022 08:26:27 +0000 (00:26 -0800)]
[DAGCombine] Fix mistake in a comment. NFC
Craig Topper [Wed, 21 Dec 2022 05:31:19 +0000 (21:31 -0800)]
[RISCV] Simplify some code in SELECT_CC combine. NFC
An integer SELECT_CC should have all XLenVT operands, we don't
need to handle other cases.
Max Kazantsev [Wed, 21 Dec 2022 04:38:17 +0000 (11:38 +0700)]
[Test] Precommit test for PR59615
Max Kazantsev [Wed, 21 Dec 2022 04:17:49 +0000 (11:17 +0700)]
Revert "[NFC][SROA] `speculateSelectInstLoads()`: play nice with typed pointers for now"
This reverts commit
9f27f4536e19e93349b0662338408efe6d1cb2fd.
Supposed to be NFC, but broke buildbots (test addrspacecast.ll is failing).
Zi Xuan Wu (Zeson) [Wed, 21 Dec 2022 03:51:06 +0000 (11:51 +0800)]
[CSKY] Fix compiling error due to the interface change
Phoebe Wang [Wed, 21 Dec 2022 03:39:11 +0000 (11:39 +0800)]
[Clang] Emit "min-legal-vector-width" attribute for X86 only
This is an alternative way of D139627 suggested by Craig. Creently only X86 backend uses this attribute. Let's just emit for X86 only.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D139701
Craig Topper [Wed, 21 Dec 2022 03:26:51 +0000 (19:26 -0800)]
[X86] Replace getOperand calls with an existing variable. NFC
yijiagu [Wed, 21 Dec 2022 03:00:26 +0000 (19:00 -0800)]
Replace void* with std::byte* in AsyncRuntime
Replace void* with std::byte* in AsyncRuntime to make it clear that these pointers point to a memory region.
Reviewed By: ezhulenev
Differential Revision: https://reviews.llvm.org/D140428
Nathan Ridge [Tue, 20 Dec 2022 09:31:33 +0000 (04:31 -0500)]
[clangd] Avoid triggering linkage computation for decl with unstable linkage in SymbolRelevanceSignals::computeASTSignals()
Fixes https://github.com/clangd/clangd/issues/1427
Differential Revision: https://reviews.llvm.org/D140379
Yeting Kuo [Tue, 20 Dec 2022 12:28:53 +0000 (20:28 +0800)]
[RISCV][NFC] Add policy operand for RISCVISD::VSLIDEUP_VL and RISCVISD::VSLIDEDOWN_VL.
There is room for optimization to use tail agnostic vslideup/vslidedown to lower
some vector operations. D125546 is an revision for the kind of optimization.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D140393
Craig Topper [Wed, 21 Dec 2022 02:46:07 +0000 (18:46 -0800)]
[RISCV] Add XVentanaCondOps to RISCVSExtWRemoval.
Noah Goldstein [Tue, 20 Dec 2022 09:14:40 +0000 (17:14 +0800)]
Reference: not-shift.ll before new peepholes.
Differential Revision: https://reviews.llvm.org/D140362
Matt Arsenault [Wed, 21 Dec 2022 02:28:58 +0000 (21:28 -0500)]
Revert "llvm-reduce: Try to fix test on windows"
This reverts commit
3b0b0965c4eb603af5d97733775df315ba2241a1.
I hadn't noticed
638b25711540ff7897750ab07592b3d168e65aca
Roman Lebedev [Wed, 21 Dec 2022 02:15:28 +0000 (05:15 +0300)]
[NFC][SROA] `speculateSelectInstLoads()`: play nice with typed pointers for now
As requested in https://reviews.llvm.org/D138238#inline-1356685
Roman Lebedev [Wed, 21 Dec 2022 01:51:52 +0000 (04:51 +0300)]
[X86] avx512fp16: add missing instruction selection patterns for "i16" `VMOVSH`
For all other patterns, we consistently have both I and F variants,
let's not diverge.
Fixes https://github.com/llvm/llvm-project/issues/59628
Roman Lebedev [Wed, 21 Dec 2022 02:03:31 +0000 (05:03 +0300)]
[llvm-extract] Don't forget to link to Analysis component
```
[ 50% 1/2][ 50% 00:01 + 00:01] Linking CXX executable bin/llvm-extract
FAILED: bin/llvm-extract
: && /usr/bin/clang++-15 -O3 -g -ggdb -march=native -UNDEBUG -gsplit-dwarf -gz -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -g -ggdb -march=native -UNDEBUG -gsplit-dwarf -gz -Wl,--gdb-index -Wl,--color-diagnostics -Wl,--gc-sections tools/llvm-extract/CMakeFiles/llvm-extract.dir/llvm-extract.cpp.o -o bin/llvm-extract -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMPasses.so.16git lib/libLLVMIRPrinter.so.16git lib/libLLVMipo.so.16git lib/libLLVMBitWriter.so.16git lib/libLLVMIRReader.so.16git lib/libLLVMCore.so.16git lib/libLLVMSupport.so.16git -Wl,-rpath-link,/builddirs/llvm-project/build-Clang15/lib && :
ld: error: undefined symbol: llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>::AnalysisManager()
>>> referenced by llvm-extract.cpp:326 (/repositories/llvm-project/llvm/tools/llvm-extract/llvm-extract.cpp:326)
>>> tools/llvm-extract/CMakeFiles/llvm-extract.dir/llvm-extract.cpp.o:(main)
>>> referenced by llvm-extract.cpp:373 (/repositories/llvm-project/llvm/tools/llvm-extract/llvm-extract.cpp:373)
>>> tools/llvm-extract/CMakeFiles/llvm-extract.dir/llvm-extract.cpp.o:(main)
>>> referenced by llvm-extract.cpp:394 (/repositories/llvm-project/llvm/tools/llvm-extract/llvm-extract.cpp:394)
>>> tools/llvm-extract/CMakeFiles/llvm-extract.dir/llvm-extract.cpp.o:(main)
ld: error: undefined symbol: llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>::AnalysisManager()
>>> referenced by llvm-extract.cpp:328 (/repositories/llvm-project/llvm/tools/llvm-extract/llvm-extract.cpp:328)
>>> tools/llvm-extract/CMakeFiles/llvm-extract.dir/llvm-extract.cpp.o:(main)
>>> referenced by llvm-extract.cpp:375 (/repositories/llvm-project/llvm/tools/llvm-extract/llvm-extract.cpp:375)
>>> tools/llvm-extract/CMakeFiles/llvm-extract.dir/llvm-extract.cpp.o:(main)
>>> referenced by llvm-extract.cpp:396 (/repositories/llvm-project/llvm/tools/llvm-extract/llvm-extract.cpp:396)
>>> tools/llvm-extract/CMakeFiles/llvm-extract.dir/llvm-extract.cpp.o:(main)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
```
Matt Arsenault [Wed, 21 Dec 2022 01:34:27 +0000 (20:34 -0500)]
llvm-reduce: Try to fix test on windows
It seems to not like the environment variable set syntax.
Douglas Yung [Wed, 21 Dec 2022 01:31:01 +0000 (17:31 -0800)]
Fix test added in 95abdeb to set environment variables in a way that works on both Windows and linux.
This should fix the test failure on Windows bots such as https://lab.llvm.org/buildbot/#/builders/216/builds/14829.
Peiming Liu [Wed, 21 Dec 2022 01:11:14 +0000 (01:11 +0000)]
[mlir][sparse] add initialize() API to LoopEmitter to support post-constructor initialization
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D140444
Mitch Phillips [Wed, 21 Dec 2022 01:16:32 +0000 (17:16 -0800)]
Revert "[AArch64] FMV support and necessary target features dependencies."
This reverts commit
e43924a75145d2f9e722f74b673145c3e62bfd07.
Reason: Patch broke the MSan buildbots. More information is available on
the original phabricator review: https://reviews.llvm.org/D127812
Mitch Phillips [Wed, 21 Dec 2022 01:16:17 +0000 (17:16 -0800)]
Revert "[AArch64][NFC] Fix aarch64 target features test."
This reverts commit
bf94eac6a3f7c5cd8941956d44c15524fa3751bd.
Reason: Depends on reverted change https://reviews.llvm.org/D127812
Mitch Phillips [Wed, 21 Dec 2022 01:15:38 +0000 (17:15 -0800)]
Revert "[AArch64][compiler-rt] Fix HWCAP_CPUID not defined in some cases."
This reverts commit
a43f36142c501e2d3f4797ef938db4e0c5e0eeec.
Reason: Depends on reverted change https://reviews.llvm.org/D127812
Aart Bik [Tue, 20 Dec 2022 23:42:11 +0000 (15:42 -0800)]
[mlir][sparse] refactored codegen environment into its own file
Also, as a proof of concept, all functionality related to reductions
has been refactored into private fields and a clean public API. As a
result, some dead code was found as well. This approach also simplifies
asserting on a proper environment state for each call.
NOTE: making all other fields private and migrating more methods into
this new class is still TBD in yes another next revision!
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D140443
Louis Dionne [Tue, 20 Dec 2022 23:04:53 +0000 (18:04 -0500)]
[clang] Re-apply change to avoid passing -stdlib=libc++ spuriously to CC1 on Darwin
Previously, we would be passing down -stdlib=libc++ from the Driver
to CC1 whenever the default standard library on the platform was libc++,
even if -stdlib= had not been passed to the Driver. This meant that we
would pass -stdlib=libc++ in nonsensical circumstances, such as when
compiling C code.
This logic had been added in
b534ce46bd40 to make sure that header
search paths were set up properly. However, since libc++ is now the
default Standard Library on Darwin, passing this explicitly is not
required anymore. Indeed, if no -stdlib= is specified, CC1 will end
up using libc++ if it queries which standard library to use, without
having to be told.
Not passing -stdlib= at all to CC1 on Darwin should become possible
once CC1 stops relying on it to set up framework search paths.
Furthermore, this commit also removes a diagnostic checking whether the
deployment target is too old to support libc++. Nowadays, all supported
deployment targets use libc++ and compiling with libstdc++ is not
supported anymore. The Driver was the wrong place to issue this
diagnostic since it doesn't know whether libc++ will actually be linked
against (e.g. C vs C++), which would lead to spurious diagnostics.
Given that these targets are not supported anymore, we simply drop
the diagnostic instead of trying to refactor it into CC1.
This is a re-application of
6540f32db09c which had been reverted in
49dd02bd0819 because it broke a compiler-rt test. The test had broken
because we were compiling C code and passing -stdlib=libc++, which Clang
will now warn about.
rdar://
103198514
Differential Revision: https://reviews.llvm.org/D139938
Peiming Liu [Tue, 20 Dec 2022 23:49:17 +0000 (23:49 +0000)]
[mlir][sparse] introduce LevelFormat which do not encoding level properties of a sparse tensor level.
Reviewed By: aartbik, wrengr
Differential Revision: https://reviews.llvm.org/D140442
Roman Lebedev [Wed, 21 Dec 2022 00:38:10 +0000 (03:38 +0300)]
[NFC][llvm-exegesis] Ensure that target options show up in --help
Fixes https://github.com/llvm/llvm-project/issues/59377
Artem Dergachev [Tue, 20 Dec 2022 22:58:35 +0000 (14:58 -0800)]
[-Wunsafe-buffer-usage] Suppress an assertion for visiting VarDecl twice.
The assertion doesn't seem to hold due to ASTMatchers traversing code
inside GNU StmtExpr twice. This can screw up our algorithm's invariants.
We need a further investigation to properly fix this issue, but for now
let's avoid the crash.
Matt Arsenault [Tue, 20 Dec 2022 12:32:55 +0000 (07:32 -0500)]
llvm-reduce: Disable crash reports, symbolization and core dumps
These are going to waste a lot of time and produce clutter when we're
bulk introducing crashes. Add a flag to disable this behavior in case
this matters to a reproducer.
Maksim Panchenko [Tue, 20 Dec 2022 23:16:32 +0000 (15:16 -0800)]
[BOLT][NFC] Remove unused PrintInstructions argument
PrintInstructions was unused in BinaryFunction::print() and dump().
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D140440
Kazu Hirata [Tue, 20 Dec 2022 23:53:38 +0000 (15:53 -0800)]
[llvm] Remove redundant initialization of std::optional (NFC)
Kazu Hirata [Tue, 20 Dec 2022 23:42:32 +0000 (15:42 -0800)]
[llvm] Use std::optional instead of Optional
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Jonas Devlieghere [Tue, 20 Dec 2022 23:35:54 +0000 (15:35 -0800)]
[dsymutil] Require x86 backend for odr-two-units-in-single-file.test
Siva Chandra Reddy [Tue, 20 Dec 2022 23:21:56 +0000 (23:21 +0000)]
[libc][Obvious] Remove the unused cpp::vector class.
This can be easily resurrected if required in future. It calls malloc
directly. So, instead of updating an unused piece to the newer pattern
of using the custom operator new, this patch just deletes it.
Kazu Hirata [Tue, 20 Dec 2022 23:02:48 +0000 (15:02 -0800)]
[ADT] Fix an unused variable warning
This patch fixes:
llvm/include/llvm/ADT/GenericUniformityImpl.h:752:8: error: unused
variable 'printBlockSet' [-Werror,-Wunused-variable]
Roman Lebedev [Tue, 20 Dec 2022 20:57:10 +0000 (23:57 +0300)]
[llvm-exegesis] `AliasingConfigurations`: pay attention to forbidden registers
When trying to measure latency of certain opcodes, e.g.
`./bin/llvm-exegesis --opcode-name=BT32ri8 --mode=latency --repetition-mode=loop --benchmarks-file=- --max-configs-per-opcode=65536`,
we'd pick such an aliasing instruction, and such an aliasing registers,
that would alias with forbidden registers.
And in particular with loop counter in `loop` repetition mode,
which made the measurements never finish.
This does not address all such cases, only the most obvious one.
The added test case fails without the patch.
Fixes https://github.com/llvm/llvm-project/issues/59441
Pavel Iliin [Tue, 20 Dec 2022 22:26:48 +0000 (22:26 +0000)]
[AArch64][NFC] Fix aarch64 target features test.
Nick Desaulniers [Tue, 20 Dec 2022 22:08:37 +0000 (14:08 -0800)]
[llvm][X86ISelDAGToDAG] support -{start|stop}-{before|after}=x86-isel
Follow a similar pattern as AMDGPUDAGToDAGISel's constructor so that we
can use INITIALIZE_PASS to register a pass. This allows for more fine
grain testability of SelectionDAGISel.
Link: https://github.com/llvm/llvm-project/issues/59538
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D140323
Matt Arsenault [Tue, 6 Dec 2022 13:05:54 +0000 (08:05 -0500)]
InstCombine: Fold fneg (copysign x, y) -> copysign x, (fneg y)
Nick Desaulniers [Tue, 20 Dec 2022 22:00:51 +0000 (14:00 -0800)]
[llvm][PassSupport] don't require passes to be default constructible
Quite a few passes are not default constructible. In order to properly
support -{start|stop}-{before|after}= for these passes, we would like to
continue to use INITIALIZE_PASS, but not necessarily provide a default
constructor.
Delete the default constructors of classes derived from
SelectionDAGISel.
Link: https://github.com/llvm/llvm-project/issues/59538
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D140349
Haojian Wu [Tue, 20 Dec 2022 21:27:10 +0000 (22:27 +0100)]
[bazel] Add missing Passes dependency to llvm-extract
Arthur Eubanks [Tue, 20 Dec 2022 21:12:53 +0000 (13:12 -0800)]
[llvm-extract] Add missing IRPrinter dependency
Lei Huang [Tue, 20 Dec 2022 20:57:26 +0000 (14:57 -0600)]
[PowerPC][NFC] Update p10 scheduler
Arthur Eubanks [Tue, 20 Dec 2022 20:55:05 +0000 (12:55 -0800)]
[llvm-extract] Use new pass manager instead of legacy pass manager
Removes some legacy passes specific to llvm-extract
Jonas Devlieghere [Tue, 20 Dec 2022 20:48:00 +0000 (12:48 -0800)]
[dsymutil] Verify the keep chain when asserts are enabled
Verify that every DIE that's marked as kept, has a parent that's kept as
well. This invariant should always hold and is easy to verify when
asserts are enabled.
Differential revision: https://reviews.llvm.org/D140227
Jonas Devlieghere [Tue, 20 Dec 2022 19:28:57 +0000 (11:28 -0800)]
[dsymutil] Track uncloned references in the DIEInfo.
To improve deduplication across CUs within a single object file,
2b747241a6a0 changed the way we track ODR canonical candidates. The
result is that some assumptions no longer hold. Because of the
aforementioned change, the following condition
assert(Ref > InputDIE.getOffset());
in DWARFLinker::DIECloner::cloneDieReferenceAttribute is no longer an
invariant. An example of a situation where this assertion no longer
holds is when we have decided to replace a backward reference in the
current CU with a forward reference in a subsequent CU. The ODR
canonical DIE hasn't been emitted yet, but the references DIE has an
offset smaller than the current DIE. The assertion is only true if the
referenced DIE was the ODR canonical DIE, which is no longer guaranteed
to be part of the same CU.
Big thanks to Alexey for putting a test together.
Differential revision: https://reviews.llvm.org/D138176
Nikolas Klauser [Tue, 20 Dec 2022 17:01:34 +0000 (18:01 +0100)]
[libc++] Granularize <type_traits> includes in <concepts>
Reviewed By: ldionne, Mordante, #libc
Spies: jloser, libcxx-commits
Differential Revision: https://reviews.llvm.org/D139189
Craig Topper [Tue, 20 Dec 2022 19:52:52 +0000 (11:52 -0800)]
[RISCV] Move -riscv-v-vector-bits-max/min options to RISCVTargetMachine.
Split from D139873.
Reviewed By: reames, kito-cheng
Differential Revision: https://reviews.llvm.org/D140283
Craig Topper [Tue, 20 Dec 2022 19:37:51 +0000 (11:37 -0800)]
[BuildLibCalls][RISCV] Sign extend return value of bcmp on riscv64.
riscv64 wants callees to sign extend signed and unsigned int returns.
The caller can use this to avoid a sign extend if the result is
used by a comparison since riscv64 only has 64-bit compares.
InstCombine/SimplifyLibCalls aggressively turn memcmps that are only
used by an icmp eq 0 into bcmp, but we lose the signext attribute that
would have been present on the memcmp. This causes an unneeded sext.w
in the generated assembly.
This looks even sillier if bcmp is implemented alias to memcmp. In
that case, not only did we not get any savings by using bcmp, we added
an instruction.
This probably applies to other functions, this just happens to be
the one I noticed so far.
See also the discussion here https://discourse.llvm.org/t/can-we-preserve-signext-return-attribute-when-converting-memcmp-to-bcmp/67126
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D139901
Siva Chandra Reddy [Tue, 20 Dec 2022 07:11:55 +0000 (07:11 +0000)]
[libc] Add a baremetal config.
The config currently includes ctype, math, stdlib, inttypes and string
functions.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D140378
Joseph Huber [Tue, 20 Dec 2022 19:42:18 +0000 (13:42 -0600)]
[OpenMP] Fix leftover use of removed function
Summary:
Didn't notice this one floating around as it was still cached somewhere.
Delete it.
Guilherme Valarini [Tue, 20 Dec 2022 19:41:26 +0000 (16:41 -0300)]
[OpenMP] Disable libomptarget integration on unsupported platforms
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D140419