Commit Graph

425148 Commits

Author SHA1 Message Date
eopXD 2cadf84fc8 [RISCV] Pass OptLevel to `RISCVDAGToDAGISel` correctly
Originally, `OptLevel` isn't passed into the `MachineFunctionPass`.
This lets the default parameter of `SelectionDAGISel`, which is
`CodeGenOpt::Default`, be passed in. OptLevelChanger captures the
optimization level with the parameter, and rather not the value
within `TargetMachine`. This lets the optimization be
unintentionally overwriten if other value than `CodeGenOpt::Default`
passed.

This patch fixes this by passing the optimization level rather
than using the default value.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D126641
2022-05-30 17:22:50 -07:00
Joe Loser 40e52d3033
[libc++][test] Enable some ADL robust algorithm tests
Some algorithm ADL robustness tests are commented out, but work as is. Uncomment
them.

Differential Revision: https://reviews.llvm.org/D126670
2022-05-30 17:50:08 -06:00
eopXD 51002bdb5e [RISCV] Precommit test case to show bug in RISCVISelDagToDag
The optimization level should not be restored into O2.
This is a pre-commit test case to show fix in D126641.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D126677
2022-05-30 15:59:20 -07:00
Matheus Izvekov c825abd6b0
[clang] NFC: introduce test for D126620
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Reviewed By: v.g.vassilev

Differential Revision: https://reviews.llvm.org/D126674
2022-05-30 22:45:57 +02:00
Keno Fischer 167fb106d2 compiler-rt/cpu_model: Ensure constructor priority is set and align with GCC
GCC recently started setting constructor priority on init_have_lse_atomics [1]
to avoid undefined initialization order with respect to other initializers,
causing accidental use of ll/sc intrinsics on targets where this was not
intended (which presents a minor performance problem as well as a
compatibility problem for users wanting to use the rr debugger). I initially
thought compiler-rt does not have the same issue as libgcc, since it looks
like we're already setting init priority on the constructor.

Unfortuantely, it does not appear that the HAVE_INIT_PRIORITY check is ever
performed anyway, so despite appearances the init priority was not actually
applied. Fix that by applying the init priority unconditionally. It has been
supported in clang ever since it was first introduced and in any case for
more than 14 years in both gcc and clang. MSVC is already excluded from this
code path and we're already using constructors with init priority elsewhere
in compiler-rt without additional check (though mostly in the sanitizer
runtime, which may have more narrow target support). Regardless, I believe
that for our supported compilers, if they support the constructor attribute,
they should also support init priorities.

While we're here, change the init priority from 101, which is the highest
priority for end user applications, to instead use one of the priority levels
reserved for implementations (1-100; lower integers are higher priority).
GCC ended up using `90`, so this commit aligns the value in compiler-rt
to the same value to ensure that there are no subtle initialization order
differences between libgcc and compiler-rt.

[1] 75c4e4909a

Differential Revision: https://reviews.llvm.org/D126424
2022-05-30 20:31:49 +00:00
Joel E. Denny 0dbaff2a49 [FileCheck] Use %ProtectFileCheckOutput in recently added test 2022-05-30 16:27:24 -04:00
Louis Dionne fe7cd1d199 [libc++][NFC] Improve comment about vector and string base class ABI flags 2022-05-30 16:26:49 -04:00
Krzysztof Parzyszek d65fa2c43c [Hexagon] Widen vector types with non-power-of-2 element counts
Such vector types cannot be split at the moment, because splitting expects
an even number of elements in the source type. If a target marks such a type
as "split", TargetLoweringBase::computeRegisterProperties will override it
with widening to the next power of 2. This could lead to issues during
instruction selection when conflicting information about how to handle this
type is present.
2022-05-30 12:57:48 -07:00
Matheus Izvekov 93319128d0
cmake: fix clang standalone build
D126308 broke building clang standalone, as LLVM_UTILS_INSTALL_DIR is
not exported.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D126671
2022-05-30 21:56:38 +02:00
Sanjay Patel a0c3c60728 [InstCombine] fold shift-right-by-constant with shift-right-of-constant operand
(C2 >> X) >> C1 --> (C2 >> C1) >> X

The shift-left form of this transform has existed since:
16f18ed7b5

...but it applies to matching shift right opcodes too:
https://alive2.llvm.org/ce/z/c5eQms
2022-05-30 15:30:01 -04:00
Sanjay Patel c5d942a4fb [InstCombine] remove unnecessary one-use check from (C2 << X) << C1 fold
The restriction goes back to:
16f18ed7b5
...but the fold only replaces a shift with a shift, so that's not necessary.
Generalizing to other opcodes is planned as a follow-up.
2022-05-30 15:17:54 -04:00
Sanjay Patel a004438959 [InstCombine] add/move tests for shift-of-constant-by-same-shift-by-constant; NFC 2022-05-30 15:17:54 -04:00
Mehdi Amini 940e290860 Apply clang-tidy fixes for performance-unnecessary-value-param in OneShotModuleBufferize.cpp (NFC) 2022-05-30 18:44:28 +00:00
Mehdi Amini 118d9ebd52 Apply clang-tidy fixes for llvm-else-after-return in OpenMPToLLVM.cpp (NFC) 2022-05-30 18:44:28 +00:00
Nuno Lopes 8c55de9ee7 fix tests after my commit 80b3dcc045
doesn't like exit code 126 I'm afraid
2022-05-30 19:44:06 +01:00
Nuno Lopes 80b3dcc045 [Support] Make report_fatal_error respect its GenCrashDiag argument so it doesn't generate a backtrace
There are a few places where we use report_fatal_error when the input is broken.
Currently, this function always crashes LLVM with an abort signal, which
then triggers the backtrace printing code.
I think this is excessive, as wrong input shouldn't give a link to
LLVM's github issue URL and tell users to file a bug report.
We shouldn't print a stack trace either.

This patch changes report_fatal_error so it uses exit() rather than
abort() when its argument GenCrashDiag=false.

Reviewed by: nikic, MaskRay, RKSimon

Differential Revision: https://reviews.llvm.org/D126550
2022-05-30 19:19:23 +01:00
Nico Weber c4eb8035ed Revert "[HLSL] Enable vector types for hlsl."
This reverts commit e576280380.
Breaks tests on mac/arm, see comment on https://reviews.llvm.org/D125052

Also revert follow-up "[gn build] Port e576280380d3"
This reverts commit 1e01b1ec72.
2022-05-30 14:11:07 -04:00
Florian Hahn b7d2b160c3
[VPlan] Add test for printing VPlan for outer loop vectorization.
Test coverage for D123005.
2022-05-30 18:19:52 +01:00
Volodymyr Sapsai f3defc2348 [ODRHash][NFC] Add missing 'select' case for `ODRMismatchDecl`.
No test changes because `err_module_odr_violation_mismatch_decl_unknown`
is a catch-all when custom diagnostic is missing. And missing custom
diagnostic we should fix by implementing it, not by improving the
general case. But if we pass enum value not covered by 'select', clang
can crash, so protect against that.

Differential Revision: https://reviews.llvm.org/D126566
2022-05-30 10:07:03 -07:00
Mehdi Amini aff271930e Fix warning for unused variable in the non-assert build (NFC) 2022-05-30 16:21:38 +00:00
LLVM GN Syncbot 1e01b1ec72 [gn build] Port e576280380 2022-05-30 16:11:40 +00:00
Denis Antrushin 85322e82be [TwoAddressInstructionPass] Special processing of STATEPOINT instruction.
STATEPOINT is a special pseudo instruction which represent Moving GC semantic to LLVM.
Every tied def/use VReg pair in STATEPOINT represent same physical register which can
'magically' change during call wrapped by statepoint.
(By construction, tied use operand  is not live across  STATEPOINT).

This means that when converting into two-address form, there is not need to insert COPY
instruction before stateppoint, what TwoAddressInstruction pass does for 'regular'
instructions.

Reviewed By: MatzeB

Differential Revision: https://reviews.llvm.org/D124631
2022-05-30 19:07:30 +03:00
Xiang Li e576280380 [HLSL] Enable vector types for hlsl.
Vector types in hlsl is using clang ext_vector_type.
Declaration of vector types is in builtin header hlsl.h.
hlsl.h will be included by default for hlsl shader.

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D125052
2022-05-30 09:05:29 -07:00
Louis Dionne f8239eec8d [libc++] Reduce the verbosity when running the libc++ Lit configuration
We print the same information as before, however we do it with less
verbosity unless `--debug` is used.
2022-05-30 12:03:24 -04:00
Pierre Gousseau 4278b7e16a [sanitizers] Fixes strndup API behaviour when intercepted by sanitizers
Sanitizers ignore flag allocator_may_return_null=1 in strndup() calls.
When OOM is emulated, this causes to the unexpected crash.

Committed by pgousseau on behalf of "Kostyantyn Melnik, kmnls.kmnls@gmail.com"

Reviewed by: pgousseau

Differential Revision: https://reviews.llvm.org/D126452
2022-05-30 17:00:10 +01:00
Alex Zinenko 3f71765a71 [mlir] provide Python bindings for the Transform dialect
Python bindings for extensions of the Transform dialect are defined in separate
Python source files that can be imported on-demand, i.e., that are not imported
with the "main" transform dialect. This requires a minor addition to the
ODS-based bindings generator. This approach is consistent with the current
model for downstream projects that are expected to bundle MLIR Python bindings:
such projects can include their custom extensions into the bundle similarly to
how they include their dialects.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D126208
2022-05-30 17:37:52 +02:00
Alex Zinenko cc6c159203 [mlir] add VectorizeOp to structured transform ops
Vectorization is a key transformation to achieve high performance on most
architectures. In the transform dialect, vectorization is implemented as a
parameterizable transform op. It currently applies to a scope of payload IR
delimited by some isolated-from-above op, mainly because several enabling
transformations (such as affine simplification) are needed to perform
vectorization and these transformation would apply to ops other than the "main"
computational payload op. A separate "navigation" transform op that obtains the
isolated-from-above ancestor of an op is introduced in the core transform
dialect. Even though it is currently only useful for vectorization,
isolated-from-above ops are a common anchor for transformations (usually
implemented as passes) that is likely to be reused in the future.

Depends On D126374

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D126542
2022-05-30 17:37:50 +02:00
Hans Wennborg b2719349d2 Change build_llvm_package.bat to build_llvm_release.bat
We don't build snapshot packages anymore, so repurpose this
for doing release builds instead.
2022-05-30 17:08:01 +02:00
Nikita Popov a770f534e6 [InstCombine] When swapping GEPs, only keep inbounds if both are
If only one of the GEPs is inbounds, then after swapping, there is
no guarantee that one of them will be inbounds as well
(see e.g. https://alive2.llvm.org/ce/z/agaCnp).

This is only a partial fix, because even if both are inbounds, the
result is not necessarily inbounds (if the offsets have different
signs).
2022-05-30 17:04:42 +02:00
Joel E. Denny d2e3cb7374 [OpenMP][Clang] Fix atomic compare for signed vs. unsigned
Without this patch, arguments to the
`llvm::OpenMPIRBuilder::AtomicOpValue` initializer are reversed.

Reviewed By: ABataev, tianshilei1992

Differential Revision: https://reviews.llvm.org/D126619
2022-05-30 11:02:20 -04:00
Arnamoy Bhattacharyya 314abe3922 [flang][OpenMP] Check for occurrence of multiple list items in nontemporal clause for simd directive
This patch implements the following semantic check:

A list-item cannot appear in more than one nontemporal clause.

Reviewed By: kiranchandramohan, shraiysh

Differential Revision: https://reviews.llvm.org/D110270
2022-05-30 10:59:23 -04:00
Nikita Popov 2d7bab666f [InstCombine] Always create new GEPs when swapping GEPs
As the long explanatory comment attests, performing the modification
in place is pretty tricky. Drop this unnecessary complexity and
always create new instructions.

This should be NFC-ish, but can probably cause difference due to
worklist order.
2022-05-30 16:48:52 +02:00
Nikita Popov 590fd54ca1 [InstCombine] Add tests for inbounds handling in loop invariant GEP fold (NFC) 2022-05-30 16:40:18 +02:00
Nikita Popov 2e101cca69 [Local] Don't remove invoke of non-willreturn function
The code was only checking for memory side-effects, but not for
divergence side-effects. Replace this with a generic check.
2022-05-30 15:37:46 +02:00
Nikita Popov 1f1de06165 [SimplifyCFG] Add test for invoke of nounwind non-willreturn function (NFC)
Test both the case with and without willreturn attribute.
2022-05-30 15:36:33 +02:00
Jake Egan be3fc66f83 Revert "[clang][test] mark tests added in ee8524087c as unsupported on AIX"
The tests pass now on a clean build.

This reverts commit 1b34f1e996.
2022-05-30 09:35:26 -04:00
zhongyunde 3e6ba89055 [InstCombine] Fold a mul with bool value into and
Fixes https://github.com/llvm/llvm-project/issues/55599
  X * Y --> X & Y, iff X, Y can be only {0, 1}.
https://alive2.llvm.org/ce/z/_RsTKF

Reviewed By: spatel, nikic

Differential Revision: https://reviews.llvm.org/D126040
2022-05-30 21:05:00 +08:00
Simon Moll 18c1ee04de Re-land "[VP] vp intrinsics are not speculatable" with test fix
Update the llvmir-intrinsics.mlir test to account for the modified
attribute sets.

This reverts commit 2e2a8a2d90.
2022-05-30 14:41:15 +02:00
Mehdi Amini 2e2a8a2d90 Revert "[VP] vp intrinsics are not speculatable"
This reverts commit 78a18d2b54.

Break MLIR bot: https://lab.llvm.org/buildbot/#/builders/61/builds/27127
2022-05-30 12:26:16 +00:00
Mehdi Amini eacfd04744 Apply clang-tidy fixes for llvm-else-after-return in OpPythonBindingGen.cpp (NFC) 2022-05-30 12:25:58 +00:00
Mehdi Amini 0f68c959d2 Apply clang-tidy fixes for modernize-use-override in SparseTensorUtils.cpp (NFC) 2022-05-30 12:25:55 +00:00
Hans Wennborg bac4934c84 Revert "build_llvm_package.bat: Produce zip files in addition to the installers"
The zip files were too large to be practical, so they were never
shipped. Reverting to reduce build time and complexity of the script.

This reverts commit 4486aa03c5.
2022-05-30 13:55:54 +02:00
Mats Petersson 820146abe9 [OpenMP] Pass chunk-size to MLIR while lowering from parse-tree
Test that chunk size is passed to the static init function.
Using three different variations:
1. Single constant.
2. Expression with constants.
3. Variable value.

Reviewed By: peixin, shraiysh

Differential Revision: https://reviews.llvm.org/D126383
2022-05-30 12:14:31 +01:00
Max Kazantsev 7e5a730473 [MemDep][NFC] Remove duplicating check in `if` and `else` branch
Same check is done whether the condition is true or false. Just hoist
it out of conditional.
2022-05-30 17:43:00 +07:00
Simon Moll 78a18d2b54 [VP] vp intrinsics are not speculatable
VP intrinsics show UB if the %evl parameter is out of bounds - they must
not carry the speculatable attribute.  The out-of-bounds UB disappears
when the %evl parameter is expanded into the mask or expansion replaces
the entire VP intrinsic with non-VP code.

This patch
- Removes the speculatable attribute on all VP intrinsics.
- Generalizes the isSafeToSpeculativelyExecute function to let VP
  expansion know whether the VP intrinsic replacement will be
  speculatable.  VP expansion may only discard %evl where this is the
  case.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D125296
2022-05-30 12:20:05 +02:00
Max Kazantsev 180d3f251d [MemDep][NFCI] Remove redundant dyn_cast, replace with cast
When `IsLoad` is `true`, we don't need to check if the instruction
is actually a load with dyn_cast. Saves some petty amount of CT.
2022-05-30 17:17:55 +07:00
Hans Wennborg 10d2195305 Update the Windows packaging script
Check in updates based on how the latest release was built [0] and add
the bug fix from [1] which allows LLDB to start.

Other changes which had accumulated in the local release script:
- Don't build the clang format plugin (VS has the functionality built
  in now)
- Disable tests that have been failing (I'll try to follow up and
  re-enable them)
- Switch to Python 3.10
- Jump through more hoops to make LLDB pick the right Python.

0. https://discourse.llvm.org/t/14-0-4-final-has-been-tagged/62750/3
1. https://github.com/llvm/llvm-project/issues/54589
2022-05-30 11:58:13 +02:00
Edd Barrett d245974e1a Test stackmap support for floating point types.
It appears that float support is complete, or at least, the stackmap records
emitted are not inconceivable (I must admit that I don't know about many of the
architectures under test here).

One curiosity, the SystemZ tests highlight an undocumented (or maybe incorrect)
quirk of the stackmap format: in the case of a Register record, the Offset or
SmallConstant field can encode a sub-register index! I've only ever seen this
field zero for Register entries up until now.
2022-05-30 10:49:32 +01:00
Sven van Haastregt a5cf17f8ae [OpenCL] Expose wg collective functions for CL3 SPIR targets
Since the SPIR/SPIR-V targets enable all known features, we must
ensure the Work-group Collective Functions feature macro is set for
OpenCL 3.0.

Fixes https://github.com/llvm/llvm-project/issues/55770
2022-05-30 10:48:49 +01:00
David Green 99b0078064 [AArch64] Tests for showing MachineCombiner COPY patterns. NFC 2022-05-30 10:47:44 +01:00