447251 Commits

Author SHA1 Message Date
Shoaib Meenai
72f3f6838f [runtimes] Only depend on builtins for same target
We don't need to have built all the builtins before building the
runtimes for a particular target, only the builtins for that target.
While I'm here, rename the variable that stores the builtins dep to
something less generic than `deps`, to minimize the chances of
accidentally using a variable with the same name from an outer scope.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D139913
2023-01-04 03:26:02 -08:00
Sameer Sahasrabuddhe
a73e0c306c [AAPointerInfo] fix assertion at the pass-through use of a pointer
HandlePassthroughUser may sometimes create a new entry for the OffsetInfo of a
user in the OffsetInfoMap. This can invalidate outstanding references into the
map, including the one which needs to be copied into the new entry. This
produces invalid offset info that can trigger assertions.

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

Reviewed By: ronlieb

Differential Revision: https://reviews.llvm.org/D140837
2023-01-04 16:53:55 +05:30
David Green
6cac7c285e [AArch64] Alter arm_sve.h to be target-based, not preprocessor based.
This patch makes SVE intrinsics more useable by gating them on the
target, not by ifdef preprocessor macros. See #56480. This alters the
SVEEmitter for arm_sve.h to remove the #ifdef guards and instead use
TARGET_BUILTIN with the correct features so that the existing "'func'
needs target feature sve" error will be generated when sve is not
present.

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

Differential Revision: https://reviews.llvm.org/D131064
2023-01-04 11:22:20 +00:00
Florian Hahn
f8d008d19f
[ConstraintElim] Remove legacy pass implementation.
The pass is exclusively used with the new pass manager now, so remove
the legacy PM implementation.
2023-01-04 11:21:12 +00:00
Matthias Springer
e7790fbed3 [mlir] Add test-convergence option to Canonicalizer tests
This new option is set to `false` by default. It should  be set only in Canonicalizer tests to detect faulty canonicalization patterns. I.e., patterns that prevent the canonicalizer from converging. The canonicalizer should always convergence on such small unit tests that we have in `canonicalize.mlir`.

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

Differential Revision: https://reviews.llvm.org/D140873
2023-01-04 12:02:21 +01:00
Chuanqi Xu
8a06b2362a [NFC] let FunctionDecl::isReservedGlobalPlacementOperator return false when the function decl is not allocation functions
Currently `FunctionDecl::isReservedGlobalPlacementOperator` will crash
if the function is not an allocation/deallocation function, which is
surprising. Also, its semantics is not consistent with
isReplaceableGlobalAllocationFunction, which will return false if the
function is not an allocation/deallocation function.

This patch make FunctionDecl::isReservedGlobalPlacementOperator not
crash if the function is not an allocation/deallocation function, which
is consistent with isReplaceableGlobalAllocationFunction too.
2023-01-04 18:57:36 +08:00
Guillaume Chatelet
8ec0a36967 [llvm-exegesis] Allow building llvm_exegesis_tests on builtkite 2023-01-04 10:43:03 +00:00
LLVM GN Syncbot
37228b1baa [gn build] Port ba874483137d 2023-01-04 10:40:23 +00:00
Guillaume Chatelet
ba87448313 [llvm-exegesis] Remove functional test from unit tests
As discussed offline, let's remove this one as it's hard to test on the build bots.

Differential Revision: https://reviews.llvm.org/D140898
2023-01-04 10:39:39 +00:00
Christian Ulmann
9b76a3020e [mlir][llvm] Support importing magic globals
This commit adds support for importing the magic globals "global_ctors"
and "global_dtors" from LLVM IR to the LLVM IR dialect. The import
fails when these globals have a non-null data pointer, as this can
currently not be represented in the corresponding MLIR operations.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D140877
2023-01-04 11:25:55 +01:00
Matthias Springer
3a5811a337 [mlir][affine][NFC] Extract core functionality of canonicalizeMinMaxOp
Move code from SCF to Affine: Add a new helper function `simplifyConstrainedMinMaxOp` to Affine/Analysis/Utils.h. `canonicalizeMinMaxOp` was originally designed for loop peeling, but it is not SCF-specific and can be used to simplify any affine.min/max ops.

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

Differential Revision: https://reviews.llvm.org/D140962
2023-01-04 11:25:44 +01:00
Tom Eccles
5bedd675d7 [mlir] Allow overriding AbstractDenseDataFlowAnalysis::visitOperation
AbstractDenseDataFlowAnalysis::visitOperation controls how the dataflow
analysis proceeds around control flow. In particular, conservative
assumptions are made about call operations which can prevent some
analysis from succeeding.

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

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

Differential Revision: https://reviews.llvm.org/D140879
2023-01-04 10:23:40 +00:00
chenglin.bi
ec48682ce9 [InstCombine] add more tests into select-factorize; NFC 2023-01-04 17:49:47 +08:00
Haojian Wu
0e11d65a58 [clang-tidy] Don't emit misc-unused-using-decl warnings for header files.
Using decls in header files are special, usually as part of the
public API, the check should not emit warnings on these.

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

Differential Revision: https://reviews.llvm.org/D140894
2023-01-04 10:07:28 +01:00
chenglin.bi
50a1c9b107 [Instcombine] Regenerate tests for logical-select; NFC 2023-01-04 16:31:56 +08:00
Vitaly Buka
d19fbfed47 [libcxx] Fix build with GLIBC
Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D140946
2023-01-03 23:55:55 -08:00
serge-sans-paille
3677ee65d1
Move from llvm::makeArrayRef to ArrayRef deduction guides
Since we're now requiring C++17, Let's get rid of makeXXX functions like
makeArrayRef, and use deduction guides instead.

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

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

Differential Revision: https://reviews.llvm.org/D140896
2023-01-04 08:18:29 +01:00
Yeting Kuo
1e9e1b9cf8 [VP][RISCV] Add vp.ctlz/cttz and RISC-V support.
The patch also adds expandVPCTLZ and expandVPCTTZ to expand vp.ctlz/cttz nodes
and the cost model of vp.ctlz/cttz.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D140370
2023-01-04 15:15:01 +08:00
Xiaodong Liu
63d46869ea [LoongArch] Add intrinsics for MOVFCSR2GR and MOVGR2FCSR instructions
Instruction formats:
`movgr2fcsr fcsr, rj`
`movfcsr2gr rd, fcsr`
MOVGR2FCSR modifies the value of the software writable field
corresponding to the FCSR (floating-point control and status
register) `fcsr` according to the value of the lower 32 bits of
the GR (general purpose register) `rj`.
MOVFCSR2GR sign extends the 32-bit value of the FCSR `fcsr`
and writes it into the GR `rd`.

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

Reviewed By: SixWeining, xen0n

Differential Revision: https://reviews.llvm.org/D140685
2023-01-04 14:11:30 +08:00
Amaury Séchet
86616443bf [NFC] Autogenerate test/Transforms/InstCombine/fls.ll 2023-01-04 02:05:30 +00:00
Amir Ayupov
be08bb7755 [BOLT][CMake] Add merge-fdata to bolt component
Build and install `merge-fdata` tool as part of `bolt` component:
```
$ ninja bolt
# builds llvm-bolt, perf2bolt and merge-fdata

$ cmake --install . --component bolt --prefix $HOME/test-install-bolt
-- Install configuration: "Release"
-- Install configuration: "Release"
-- Installing: /home/aaupov/test-install-bolt/lib/libbolt_rt_instr.a
-- Installing: /home/aaupov/test-install-bolt/lib/libbolt_rt_hugify.a
-- Installing: /home/aaupov/test-install-bolt/lib/libbolt_rt_instr_osx.a
-- Installing: /home/aaupov/test-install-bolt/bin/llvm-bolt
-- Installing: /home/aaupov/test-install-bolt/bin/perf2bolt
-- Installing: /home/aaupov/test-install-bolt/bin/llvm-boltdiff
-- Installing: /home/aaupov/test-install-bolt/bin/merge-fdata
```

Fixes #57249.

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D139972
2023-01-03 17:40:36 -08:00
Amir Ayupov
75c069584a [BOLT][Docs] Add Sphinx documentation
Add stub Sphinx documentation, with configuration copy-pasted from lld and
index page converted from bolt/README.md.

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D140156
2023-01-03 17:39:09 -08:00
Amir Ayupov
f40d25dd8d [BOLT][NFC] Use llvm::reverse
Use llvm::reverse instead of `for (auto I = rbegin(), E = rend(); I != E; ++I)`

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D140516
2023-01-03 17:32:11 -08:00
Matt Arsenault
bf4596bf58 CodeGen: Clean up some tests with broken "strictfp" attribute 2023-01-03 20:26:57 -05:00
Johannes Doerfert
93e75714cd [OpenMP][AMDGPU][NFC] Improve error message for errors 2023-01-03 17:09:32 -08:00
Johannes Doerfert
5524952c14 [OpenMP][JIT][FIX] Create the default O0 pipeline for -O0 2023-01-03 17:07:52 -08:00
Johannes Doerfert
428bc510bf [OpenMP] Unify "exec_mode" query code and default to SPMD
Defaulting to Generic mode doesn't make much sense as the kernel needs
to be prepared for it. SPMD mode is the "native" execution, e.g., for
"bare" kernels. It also is the execution method for constructors and
destructors (as we might otherwise throw an extra warp onto them).

Differential Revision: https://reviews.llvm.org/D140718
2023-01-03 16:58:13 -08:00
Matt Arsenault
ce6ae0b2a2 clang: Don't emit "frame-pointer"="none"
This is the default behavior and cuts down on attribute spam.
Probably should also do something to consolidate the option spellings;
printing and parsing it is repeated in at least 3 different places.

In the OpenMP tests, I had to manually delete some metadata check
lines update_cc_test_checks was inserting that included the local
build revision.
2023-01-03 19:42:46 -05:00
Craig Topper
84daed7fd4 [SelectionDAG][GlobalISel] Move even divisor optimization for division by constant into UnsignedDivideUsingMagic implementation. NFC
I've added a bool to UnsignedDivideUsingMagic so we can continue
testing it in the unit test with and without this optimization in
the unit test.

This is a step towards supporting "uncooperative" odd divisors.
See https://ridiculousfish.com/blog/posts/labor-of-division-episode-iii.html

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D140924
2023-01-03 16:34:13 -08:00
Tony Tye
817f64e7ce [AMDGPU][NFC] DWARF extensions minor update
1. Minor editorial corrections.
2. Allow different call frames to be associated with different target
   architectures in a single thread.

Reviewed By: scott.linder

Differential Revision: https://reviews.llvm.org/D140646
2023-01-03 23:49:12 +00:00
Fangrui Song
1f3bb2d483 [ELF] Improve --obj-path tests
Combine two ThinLTO --obj-path tests and improve checks.
Add a --obj-path test for regular LTO.
2023-01-03 15:48:17 -08:00
Fangrui Song
b5ab42af84 [ELF] Simplify --thinlto-index-only tests 2023-01-03 15:06:43 -08:00
James Y Knight
7ff64d44b9 [AMDGPU] Fix useDeprecatedPositionallyEncodedOperands errors.
This is a follow-on to https://reviews.llvm.org/D134073.

The errors in the R600 half were fixed previously in
https://reviews.llvm.org/D134078. Originally, I thought that the fixes
to the AMDGPU half would be tricky, but upon taking another look,
there were only a couple minor issues that needed fixing:

1. Previously, buffer load instructions (`BUFFER_LOAD_*_LDS_*`) were
populating the `vdata` field in the instruction from the `swz`
operand. This was incorrect, but harmless, as when the LDS option is
set, the instruction does not use the vdata field.

2. The `BUFFER_STORE_LDS_DWORD_gfx90a` instruction was populating
`acc` from the `swz` operand, because `acc` was set to `?`. (I believe
that the intent here was to leave the instruction bit as an "unknown
value", but you can't do that except by setting the bits on `Inst`
directly). Also harmless, for the same reason.

Differential Revision: https://reviews.llvm.org/D140918
2023-01-03 17:52:10 -05:00
Philip Reames
46dee4a3a3 [RISCV][InsertVSETVLI] Split out demanded property for zero/non-zero of VL
The scalar move instructions (vmv.s.x, and fvmv.s.f) depend solely on whether the VL is 0 or non-zero. By tracking the fact we only demand the zeroness and not the whole VL value, we can allow changing VL over a scalar move. This helps to eliminate vsetvli toggles.

Differential Revision: https://reviews.llvm.org/D140157
2023-01-03 14:47:13 -08:00
V Donaldson
609b789170 [flang] Control flow graph issues
Address several issues involving control flow graph generation and
structured code ops.

 - Fix a problem with constructs nested inside unstructured selection
   constructs. This is a general problem involving branches that are
   implied rather than explicit. It is addressed in the generic genFIR
   "wrapper" function that calls individual statement-specific genFIR calls.

 - The previous fix requires some compensating changes in IF and DO
   construct code lowering.

 - Streamline the code to generate explicit DO loop variable updates.

 - Fix a problem with the individual detailed genFIR calls made in the
   genFIR(SelectTypeConstruct) call.

 - Modify control flow graph generation to support the insertion of
   deallocation and finalization code when lowering most END <construct>
   statements.
2023-01-03 14:46:25 -08:00
Amir Ayupov
6b05a62a6b [BOLT] Check no-LBR samples in mayHaveProfileData
No-LBR mode wasn't tested and slipped when mayHaveProfileData was added for
Lite mode. This enables processing of profiles collected without LBR and
converted with `perf2bolt -nl` option.

Test Plan:
bin/llvm-lit -a tools/bolt/test/X86/nolbr.s
https://github.com/rafaelauler/bolt-tests/pull/20

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D140256
2023-01-03 14:43:36 -08:00
Rob Suderman
b5a1de9c98 [mlir][tosa] Add broadcasting case for tosa.resize to linalg implementation
When lowering tosa.resize it is possible there is an unary input dimension.
Lowering to a new tosa.resize and explicit broadcast simplifies the
tosa.resize operation to avoid recomputing the identical broadcasted values.

This change reworks the broadcast optimization reuse the tosa.resize generic
implementation.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D139963
2023-01-03 14:29:06 -08:00
Owen Anderson
ec40c8f6fe [ValueTracking] Improve ComputeNumSignBits to handle Trunc
Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D140796
2023-01-03 15:26:21 -07:00
Philip Reames
6df5464a46 [RISCV] Minor type fix [nfc] 2023-01-03 14:22:38 -08:00
Philip Reames
460c1bd344 [RISCV][InsertVSETVLI] Rewrite scalar insert forward rule in terms of demanded fields
This is mostly geared at consolidating logic into one form to reduce code duplication, but also has the effect of being a slight generalization. Since these operations aren't masked, we can ignore the mask policy bit when deciding on compatibility. The previous code was overly strict in checking that both policy bits matched.

Note: There's a slight difference from the reviewed version.  The reviewed version was based on a local revision which included the isCompatible change to only check AVL if VL is used.  I apparently never landed that change, and while functional, the functional change isn't visible without this one.  I chose to role the extra change into this patch.

Differential Revision: https://reviews.llvm.org/D140147
2023-01-03 14:19:52 -08:00
LLVM GN Syncbot
2a2b954434 [gn build] Port a455c91601a8 2023-01-03 22:08:13 +00:00
Matt Arsenault
a455c91601 llvm-reduce: Add reduction for invokes
Main thing I was unsure about was to whether try to delete the now
dead landing blocks, or leave that for the unreachable block reduction.

Personality function is not reduced, but that should be a separate
reduction on the function.

Fixes #58815
2023-01-03 17:03:44 -05:00
Matt Arsenault
f4cb935ce8 llvm-reduce: Fix invalid reductions for exceptions, tokens and swifterror
Copies the same special cases that bugpoint uses. Technically the
token condition is stricter than what the verifier enforces.

Part 1 of #58815
2023-01-03 17:03:20 -05:00
Matt Arsenault
84e888e5e4 llvm-reduce: Speculative fix for windows build bot
I'm guessing grep wasn't matching the backtick in the message for some
reason.
2023-01-03 17:00:35 -05:00
Matt Arsenault
0008afc632 llvm-reduce: Remove leftover comment 2023-01-03 17:00:35 -05:00
Yitzhak Mandelbaum
0086a3555a [clang][dataflow] Fix bug in optional-checker's handling of nullopt constructor.
Currently, the checker only recognizes the nullopt constructor when it is called
without sugar, resulting in a crash in the (rare) case where it has been wrapped
in sugar. This relaxes the constraint by checking the constructor decl directly
(which always contains the same, desugared form) rather than the construct
expression (where the spelling depends on the context).

Differential Revision: https://reviews.llvm.org/D140921
2023-01-03 21:57:39 +00:00
Philip Reames
d36936fdb4 [RISCV][InsertVSETVLI] Add debug output capability to DemandedFields [nfc] 2023-01-03 13:56:57 -08:00
JP Lehr
263962545d [OpenMP] Solve potential VERSION script error w/ OMPT symbols
The patch adds the symbols if OMPT_SUPPORT is not defined.
Github issue: https://github.com/llvm/llvm-project/issues/59660

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D140591
2023-01-03 16:47:12 -05:00
Matt Arsenault
2e7640e6dc OpenMPOpt: Fix null dereference on missing declaration cache
Found by llvm-reduce fuzzing.
2023-01-03 16:26:37 -05:00
Matt Arsenault
c3054aeb5a OpenMPOpt: Fix using wrong address space for alloca
Using the function's address space makes no sense. Copied from the
existing test, with more addrspace variation. Could just replace the
existing one with this version if it's redundant.
2023-01-03 16:26:37 -05:00