platform/upstream/llvm.git
22 months agollvm-reduce: Don't remove strictfp
Matt Arsenault [Tue, 3 Jan 2023 13:00:03 +0000 (08:00 -0500)]
llvm-reduce: Don't remove strictfp

The verifier should fail if constrained intrinsics are used in
functions with strictfp, but that patch hasn't been pushed yet.

Ideally we would be able to analyze the function body to see if any
constrained intrinsics were used, but we seem to be missing a utility
function to check for any constrained ops.

22 months agollvm-reduce: Avoid invalid attribute reduction on optnone functions
Matt Arsenault [Mon, 2 Jan 2023 15:55:59 +0000 (10:55 -0500)]
llvm-reduce: Avoid invalid attribute reduction on optnone functions

We have this ridiculous restriction that optnone requires noinline,
so the pair needs to be removed if we want to remove noinline.

22 months agoRecommit "[M68k] Regenerate divide-by-constant.ll. NFC"
Craig Topper [Tue, 3 Jan 2023 20:24:14 +0000 (12:24 -0800)]
Recommit "[M68k] Regenerate divide-by-constant.ll. NFC"

Division algorithm was improved in D140750.

Fixes #59802.

22 months agoRevert "[M68k] Regenerate divide-by-constant.ll. NFC"
Craig Topper [Tue, 3 Jan 2023 20:23:53 +0000 (12:23 -0800)]
Revert "[M68k] Regenerate divide-by-constant.ll. NFC"

This reverts commit 0277f849c36ab6fe122b4fa1ae739e82869b5613.

I pasted the wrong bug number.

22 months ago[M68k] Regenerate divide-by-constant.ll. NFC
Craig Topper [Tue, 3 Jan 2023 20:17:46 +0000 (12:17 -0800)]
[M68k] Regenerate divide-by-constant.ll. NFC

Division algorithm was improved by D140750.

Fixes #59791.

22 months ago[OpenMP][2/2] Make device functions have hidden visibility
Johannes Doerfert [Wed, 28 Dec 2022 19:19:27 +0000 (11:19 -0800)]
[OpenMP][2/2]  Make device functions have hidden visibility

Similar to https://reviews.llvm.org/D136111, this time for class
methods.

D136111 summary:

In OpenMP target offloading an in other offloading languages, we
maintain a difference between device functions and kernel functions.
Kernel functions must be visible to the host and act as the entry point
to the target device. Device functions however cannot be called directly
by the host and must be called by a kernel function. Currently, we make
all definitions on the device protected by default. Because device
functions cannot be called or used by the host they should have hidden
visibility. This allows for the definitions to be better optimized via
LTO or other passes.

This patch marks every device class methods in the AST as having hidden
visibility. The kernel function is generated later at code-gen and we
set its visibility explicitly so it should not be affected. This
prevents the user from overriding the visibility, but since the user
can't do anything with these symbols anyway there is no point exporting
them right now.

22 months ago[Clang] Fix a crash when encountering an ill-formed delimited UCN.
Corentin Jabot [Mon, 12 Dec 2022 23:26:13 +0000 (00:26 +0100)]
[Clang] Fix a crash when encountering an ill-formed delimited UCN.

\u<DIGIT>{...} was incorrectly parsed as a valid UCN instead
of emitting a diagnostic, causing an assertion failure.

Reviewed By: tahonermann

Differential Revision: https://reviews.llvm.org/D139889

22 months ago[mlir][tosa] Fix out-of-boundaries iteration for tosa-to-linalg
a.puschin [Tue, 3 Jan 2023 19:37:59 +0000 (11:37 -0800)]
[mlir][tosa] Fix out-of-boundaries iteration for tosa-to-linalg

When the number of elements of two shapes are not equal, a Reshape operation cannot be used to transfer one into another

Function findIntermediateShape(...) can cause out-of-boundaries operator[] call if the abovementioned condition strikes

The test-case I used now causes no error as its root-cause was an issue in Tosa dialect with padded Conv2D operations lowering which is already solved in commit 69c984b6

Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D140013

22 months ago[SLP][AArch64] Incorrectly estimated intrinsic as a function call.
Dinar Temirbulatov [Tue, 3 Jan 2023 19:45:24 +0000 (19:45 +0000)]
[SLP][AArch64] Incorrectly estimated intrinsic as a function call.

We incorrectly assume intrinsic as a function call and it prevents us from
the opportunity to vectorize. On Aarch64 Cortex-A53 we think that
llvm.fmuladd.f64 is a function call which is wrong.

Differential Revision: https://reviews.llvm.org/D140392

22 months ago[mlir][tosa] Fix tosa.transpose_conv2d decompositions for new version
Rob Suderman [Tue, 3 Jan 2023 19:21:25 +0000 (11:21 -0800)]
[mlir][tosa] Fix tosa.transpose_conv2d decompositions for new version

The decomposition was no longer correct for transpose_conv2d to conv2d
after the updated TOSA specification. Specifically the behavior for
padding was changed to refer to padding the tranpsose_conv2d instead
of referencing the conv applied to the inverse transform.

Test was validated using the TOSA conformance tests.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D140503

22 months ago[Sanitizers] Fix procmap tests for apple arm64
Blue Gaston [Thu, 22 Dec 2022 19:06:59 +0000 (14:06 -0500)]
[Sanitizers] Fix procmap tests for apple arm64

As part of effort to enable sanitizer common unit tests on arm64 apple devices.
Add kModuleArchARM64 as expected Arch

Differential Revision: https://reviews.llvm.org/D140567

22 months ago[llvm-profdata] Remove unnecessary file size check
William Huang [Wed, 28 Dec 2022 21:26:16 +0000 (21:26 +0000)]
[llvm-profdata] Remove unnecessary file size check

Unsure why profile reader checks profile size to be less than 4 GB. This breaks builds using a very large profile.
The limit is not seen anywhere else, so I am not sure why is it there in the first place.

Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D140741

22 months ago[mlir][tosa] Canonicalize tosa.transpose to tosa.reshape
Rob Suderman [Tue, 3 Jan 2023 19:06:04 +0000 (11:06 -0800)]
[mlir][tosa] Canonicalize tosa.transpose to tosa.reshape

Added tosa.transpose canonicalization for case where a tosa.transpose is
equivalent to a tosa.reshape. This occurs when the permutation does not
permutate non-unary dimensions.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D140356

22 months ago[mlir][python] Expose fp8 types with pybind.
Qiao Zhang [Tue, 3 Jan 2023 19:06:30 +0000 (19:06 +0000)]
[mlir][python] Expose fp8 types with pybind.

Expose fp8 types with pybind.

Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D140746

22 months ago[WebAssembly][NFC] Add test case for {u,s}itofp on SIMD types
Luke Lau [Tue, 3 Jan 2023 19:06:14 +0000 (19:06 +0000)]
[WebAssembly][NFC] Add test case for {u,s}itofp on SIMD types

These test cases should be updated in a following patch once fixed
Part of https://github.com/llvm/llvm-project/issues/57182

22 months ago[clangd] show underlying type in type hint for `decltype(expr)`
v1nh1shungry [Tue, 3 Jan 2023 08:12:39 +0000 (03:12 -0500)]
[clangd] show underlying type in type hint for `decltype(expr)`

Reviewed By: nridge

Differential Revision: https://reviews.llvm.org/D140814

22 months ago[mlir][shape] Fix overridden arguments and fit to 80 col (NFC)
Jacques Pienaar [Tue, 3 Jan 2023 18:55:07 +0000 (10:55 -0800)]
[mlir][shape] Fix overridden arguments and fit to 80 col (NFC)

Noticed one of the ops had its arguments overridden (two consecutive let
statements) so fixed that and then went through fitting to file to 80
col/making document paragraphs more consistent.

22 months ago[DX] Improve parse error messages
Chris Bieneman [Tue, 3 Jan 2023 18:32:58 +0000 (12:32 -0600)]
[DX] Improve parse error messages

This change refactors the parte parsing logic to operate on StringRefs
of the part data rather than starting from an offset and splicing down.
It also improves some of the error reporting around part layout.

Specifically, this code now reports a distinct error if there isn't
enough data in the buffer to store the part size and it reports an
error if the parts overlap.

Reviewed By: bob80905

Differential Revision: https://reviews.llvm.org/D139681

22 months agoApply clang-tidy fixes for readability-identifier-naming in TestBackwardDataFlowAnaly...
Mehdi Amini [Thu, 22 Dec 2022 22:30:51 +0000 (22:30 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in TestBackwardDataFlowAnalysis.cpp (NFC)

22 months agoApply clang-tidy fixes for llvm-qualified-auto in TestBackwardDataFlowAnalysis.cpp...
Mehdi Amini [Thu, 22 Dec 2022 22:30:16 +0000 (22:30 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in TestBackwardDataFlowAnalysis.cpp (NFC)

22 months ago[RISCV] Remove some non-Zfh instructions from rv64zfh-invalid.s. NFC
Craig Topper [Tue, 3 Jan 2023 18:46:26 +0000 (10:46 -0800)]
[RISCV] Remove some non-Zfh instructions from rv64zfh-invalid.s. NFC

22 months agoFix initializer name.
Doru Bercea [Tue, 3 Jan 2023 18:19:59 +0000 (12:19 -0600)]
Fix initializer name.

22 months ago[clang][dataflow] Treat unions as structs.
Dani Ferreira Franco Moura [Fri, 30 Dec 2022 14:09:40 +0000 (14:09 +0000)]
[clang][dataflow] Treat unions as structs.

This is a straightfoward way to handle unions in dataflow analysis. Without this change, nullability verification crashes on files that contain unions.

Reviewed By: gribozavr2, ymandel

Differential Revision: https://reviews.llvm.org/D140696

22 months ago[YAML] Support serializing MutableArrayRef
Chris Bieneman [Tue, 20 Dec 2022 20:09:42 +0000 (14:09 -0600)]
[YAML] Support serializing MutableArrayRef

While the YAML format itself doesn't support fixed-sized arrays, some
of the data structures we encode in and out of YAML (specifically in
ObjectYAML) are actually fixed-sized arrays which we end up expressing
as resizable arrays.

Enabling the YAML tooling to support reading and writing from
fixed-sized arrays using MutableArrayRef can simplify some of the error
reporting and use logic for cases where the sizes of arrays are defined
by the target format.

Note: my SFINAE-foo isn't the best, so if there is a cleaner way to
implement the traits please advise.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D140427

22 months agoRevert "[libomptarget][plugin-nextgen] fix for [TypePromotion] NewPM support."
Ron Lieberman [Tue, 3 Jan 2023 18:26:39 +0000 (12:26 -0600)]
Revert "[libomptarget][plugin-nextgen] fix for  [TypePromotion] NewPM support."

This reverts commit 135f6a1ee8b20bb392ebad2fa5aef78e3a30ddb4.

22 months ago[libc][NFC] Remove a constexpr marking to fix GCC build.
Siva Chandra Reddy [Tue, 3 Jan 2023 18:00:57 +0000 (18:00 +0000)]
[libc][NFC] Remove a constexpr marking to fix GCC build.

22 months ago[SLP]Fix crash on casting non-instruction extractelement.
Alexey Bataev [Tue, 3 Jan 2023 16:44:51 +0000 (08:44 -0800)]
[SLP]Fix crash on casting non-instruction extractelement.

Need to check if the extractelement operation is an extraction before
trying to move it around the buildblocks to avoid crash on cast.

22 months ago[dfsan] Remove injectMetadataGlobals
Fangrui Song [Tue, 3 Jan 2023 17:23:55 +0000 (09:23 -0800)]
[dfsan] Remove injectMetadataGlobals

D97409 added injectMetadataGlobals to differentiate the shadow mode.
This feature has been unused and is unneeded after D103745 removed fast16 mode.

Reviewed By: browneee

Differential Revision: https://reviews.llvm.org/D140797

22 months ago[ConstraintElim] Adjust position in LTO pipeline.
Florian Hahn [Tue, 3 Jan 2023 17:07:43 +0000 (17:07 +0000)]
[ConstraintElim] Adjust position in LTO pipeline.

This runs ConstraintElim earlier during LTO, similar to non-LTO.
Discussed and split off from D135915.

22 months ago[libomptarget][plugin-nextgen] fix for [TypePromotion] NewPM support.
Ron Lieberman [Tue, 3 Jan 2023 17:04:13 +0000 (11:04 -0600)]
[libomptarget][plugin-nextgen] fix for  [TypePromotion] NewPM support.

22 months ago[MCDwarf][NFC] Typo in function documentation
Juan Manuel MARTINEZ CAAMAÑO [Tue, 3 Jan 2023 12:56:48 +0000 (13:56 +0100)]
[MCDwarf][NFC] Typo in function documentation

22 months agollvm-reduce: Reduce individual operands of named metadata
Matt Arsenault [Sun, 1 Jan 2023 15:52:02 +0000 (10:52 -0500)]
llvm-reduce: Reduce individual operands of named metadata

The current reduction tries all or nothing elimination of named
metadata. I noticed in one case where one of the module flags was
necessary, but it left the rest. Reduce the individual operands of
named metadata nodes that are known to behave like lists. Be
conservative since some named metadata may have more specific verifier
requirements for the operands.

22 months agoOpenMPOpt: Use getFnAttributeAsParsedInteger
Matt Arsenault [Sun, 1 Jan 2023 19:12:55 +0000 (14:12 -0500)]
OpenMPOpt: Use getFnAttributeAsParsedInteger

22 months ago[lldb] Remove spurious `n` at the end of option error message
Jonas Devlieghere [Tue, 3 Jan 2023 16:31:05 +0000 (08:31 -0800)]
[lldb] Remove spurious `n` at the end of option error message

When migrating to `ReportError` the newline (`\n`) at the end of the
error message was meant to be removed, but instead only the backslash
got deleted.

22 months agoAMDGPU: Create alloca wide load/store with explicit alignment
Matt Arsenault [Tue, 3 Jan 2023 15:37:08 +0000 (10:37 -0500)]
AMDGPU: Create alloca wide load/store with explicit alignment

This was introducing transient UB by using the default alignment of a
larger vector type.

22 months ago[InstCombine] Convert some tests to opaque pointers (NFC)
Nikita Popov [Tue, 3 Jan 2023 15:58:25 +0000 (16:58 +0100)]
[InstCombine] Convert some tests to opaque pointers (NFC)

These involved regenerating test checks. There are two significant
differences here:

1. With typed pointers we sometimes swapped gep and addrspacecast,
   as a side-effect of other transforms. However, the current
   direction is likely undesirable, and we should canonicalize in
   the reverse direction instead (gep of ac, instead of ac of gep).
   This should be done after typed pointers are removed, to avoid
   conflicting transforms.

2. The "descaling" optimization isn't really compatible with
   opaque pointers. This will be addressed longer-term by moving
   away from type-based GEP, at which point the form with explicit
   multiplications will be the canonical one.

22 months ago[JITLink][RISCV] Homogenize immediate handling
Jonas Hahnfeld [Sun, 1 Jan 2023 18:07:32 +0000 (19:07 +0100)]
[JITLink][RISCV] Homogenize immediate handling

Name the variables based on which part of the immediate value is
extracted, as it was already done for R_RISCV_JAL. This makes it
much easier to compare the logic with the spec.

Differential Revision: https://reviews.llvm.org/D140820

22 months ago[JITLink][RISCV] Improve R_RISCV_JAL
Jonas Hahnfeld [Sun, 1 Jan 2023 18:07:32 +0000 (19:07 +0100)]
[JITLink][RISCV] Improve R_RISCV_JAL

Only take the lower 12 bits of RawInstr.

Differential Revision: https://reviews.llvm.org/D140820

22 months ago[APInt] Add APInt::isOneBitSet helper.
Simon Pilgrim [Tue, 3 Jan 2023 16:10:06 +0000 (16:10 +0000)]
[APInt] Add APInt::isOneBitSet helper.

Equivalent tester for the APInt::getOneBitSet builder.

This should allow us to remove a number of cases where we're doing "Val == (1 << BitNo)" style code patterns.

22 months agollvm-reduce: Reduce prologue data
Matt Arsenault [Mon, 2 Jan 2023 14:38:22 +0000 (09:38 -0500)]
llvm-reduce: Reduce prologue data

Identical to the prefix data handling, and also had broken cloning.

22 months agollvm-reduce: Reduce prefix data
Matt Arsenault [Mon, 2 Jan 2023 13:51:38 +0000 (08:51 -0500)]
llvm-reduce: Reduce prefix data

Also fixes broken cloning.

22 months agollvm-reduce: Add reduction for function personalities
Matt Arsenault [Mon, 2 Jan 2023 13:25:26 +0000 (08:25 -0500)]
llvm-reduce: Add reduction for function personalities

Fixes second piece of #58815

22 months agoAMDGPU: Use cast instead of unchecked dyn_cast
Matt Arsenault [Tue, 3 Jan 2023 15:03:58 +0000 (10:03 -0500)]
AMDGPU: Use cast instead of unchecked dyn_cast

22 months agoOpenMPOpt: Fix introducing empty nvvm.annotations into module
Matt Arsenault [Sun, 1 Jan 2023 19:33:15 +0000 (14:33 -0500)]
OpenMPOpt: Fix introducing empty nvvm.annotations into module

22 months ago[LoopFusion] Exit early if one of fusion candidate has guarded branch but the another...
luxufan [Tue, 3 Jan 2023 15:05:18 +0000 (23:05 +0800)]
[LoopFusion] Exit early if one of fusion candidate has guarded branch but the another has not

Fixes: https://github.com/llvm/llvm-project/issues/59024

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D138269

22 months agollvm-reduce: Avoid push_back for constant array
Matt Arsenault [Mon, 2 Jan 2023 21:47:08 +0000 (16:47 -0500)]
llvm-reduce: Avoid push_back for constant array

22 months agollvm-reduce: Remove unused class
Matt Arsenault [Mon, 2 Jan 2023 19:11:47 +0000 (14:11 -0500)]
llvm-reduce: Remove unused class

22 months agollvm-reduce: Restrict set of run delta passes in invoke test
Matt Arsenault [Sun, 1 Jan 2023 23:06:33 +0000 (18:06 -0500)]
llvm-reduce: Restrict set of run delta passes in invoke test

Also stop using cat

22 months agoUtils: Fix comment typos
Matt Arsenault [Mon, 2 Jan 2023 03:39:08 +0000 (22:39 -0500)]
Utils: Fix comment typos

22 months ago[TypePromotion] NewPM support.
Samuel Parker [Tue, 3 Jan 2023 14:42:25 +0000 (14:42 +0000)]
[TypePromotion] NewPM support.

Differential Revision: https://reviews.llvm.org/D140893

22 months ago[NFC] Formatting
Samuel Parker [Tue, 3 Jan 2023 15:03:41 +0000 (15:03 +0000)]
[NFC] Formatting

Format opt PassNameExact vector to make diffs, that remove strings,
cleaner.

22 months agoReapply "[NFC] Update CXXSTatus to show we implement CWG 2061""
Erich Keane [Tue, 3 Jan 2023 14:27:07 +0000 (06:27 -0800)]
Reapply "[NFC] Update CXXSTatus to show we implement CWG 2061""

This reverts commit a5ae5afa521f75e87f9018d8361aa5a1cadc7a86.

FIx the test that didn't consider the test was running in pre-C++11
mode.

22 months agollvm-reduce: Try to fix error message test on windows
Matt Arsenault [Tue, 3 Jan 2023 14:56:19 +0000 (09:56 -0500)]
llvm-reduce: Try to fix error message test on windows

It seems the execute implementations have gone out of their way to
produce inconsistent error messages. The unix version explicitly
checks if the file exists before trying to execute. The windows
version checks if it's executable. I don't understand why they
wouldn't just try the execution and check the error code.

22 months ago[CVP] Simplify SRem when constantrange abs(lhs) < abs(rhs)
luxufan [Tue, 20 Dec 2022 15:03:04 +0000 (23:03 +0800)]
[CVP] Simplify SRem when constantrange abs(lhs) < abs(rhs)

For `srem x, y`, if abs(constant range of x) less than abs(constant
range of y), we can simplify it as:
`srem x, y => x` if y is guaranteed to be positive.
'srem x, y => -x' if y is guaranteed to be negative.

Differential Revision: https://reviews.llvm.org/D140405

22 months ago[NFC][AArch64] Adjust comments in tablegen file
Lucas Prates [Tue, 20 Dec 2022 14:23:28 +0000 (14:23 +0000)]
[NFC][AArch64] Adjust comments in tablegen file

22 months ago[LLDB] Skip python exception unit test on AArch64/Windows
Muhammad Omair Javaid [Tue, 3 Jan 2023 14:40:57 +0000 (18:40 +0400)]
[LLDB] Skip python exception unit test on AArch64/Windows

This patch marks python exception test as skipped for AArch64/Windows
platform. This is temporary to make LLDB WoA buildbot happy until a proper
fix is found.

22 months ago[LLDB] Skip TestThreadSpecificBreakpoint.py on AArch64/Windows
Muhammad Omair Javaid [Tue, 3 Jan 2023 14:38:30 +0000 (18:38 +0400)]
[LLDB] Skip TestThreadSpecificBreakpoint.py on AArch64/Windows

TestThreadSpecificBreakpoint.py is flaky on AArch64/Windows buildbot
and results in timeout randomly. This patch marks the test skipped.

22 months ago[CVP] Add baseline tests of abs(lhs) < abs(rhs) in srem
luxufan [Tue, 20 Dec 2022 16:04:18 +0000 (00:04 +0800)]
[CVP] Add baseline tests of abs(lhs) < abs(rhs) in srem

22 months agoAMDGPU: Diagnose which LDS global failed to lower
Matt Arsenault [Tue, 3 Jan 2023 14:21:56 +0000 (09:21 -0500)]
AMDGPU: Diagnose which LDS global failed to lower

Also lowercase the message to start since that seems to be the
prevailing convention for error messages.

22 months ago[TLI] Fix signature for fprintf (PR59757)
Nikita Popov [Tue, 3 Jan 2023 14:26:31 +0000 (15:26 +0100)]
[TLI] Fix signature for fprintf (PR59757)

fprintf() requires two pointer arguments.

Fixes https://github.com/llvm/llvm-project/issues/59757.

22 months agoRevert "[NFC] Update CXXSTatus to show we implement CWG 2061"
Erich Keane [Tue, 3 Jan 2023 14:26:29 +0000 (06:26 -0800)]
Revert "[NFC] Update CXXSTatus to show we implement CWG 2061"

This reverts commit 80a78033cf5f21c082aa30bfc692df76d296573c.

Fails thanks to an inline-ns warning

22 months ago[NFC] Update CXXSTatus to show we implement CWG 2061
Erich Keane [Tue, 3 Jan 2023 14:18:08 +0000 (06:18 -0800)]
[NFC] Update CXXSTatus to show we implement CWG 2061

Looking through the list, I discovered this was implemented and has been
for as long as Clang shows up on godbolt, so this patch updates the
  CXXStatus list and adds a test.

22 months agollvm-reduce: Fix missing newline after error message
Matt Arsenault [Sun, 1 Jan 2023 15:01:21 +0000 (10:01 -0500)]
llvm-reduce: Fix missing newline after error message

Fixes missing test coverage for the failed to execute case. However,
this test fails to verify the newline is printed. I can't figure out
how to get FileCheck to match the trailing newline.

22 months ago[OpenMP] Convert some tests to opaque pointers (NFC)
Nikita Popov [Tue, 3 Jan 2023 14:00:22 +0000 (15:00 +0100)]
[OpenMP] Convert some tests to opaque pointers (NFC)

22 months ago[CGP] Avoid branch on poison UB in test (NFC)
Nikita Popov [Tue, 3 Jan 2023 13:52:15 +0000 (14:52 +0100)]
[CGP] Avoid branch on poison UB in test (NFC)

22 months ago[SimplifyCFG] Add test for branch on undef/poison (NFC)
Nikita Popov [Tue, 3 Jan 2023 13:51:13 +0000 (14:51 +0100)]
[SimplifyCFG] Add test for branch on undef/poison (NFC)

22 months ago[mlir][llvm] Make the import of LLVM IR metadata extensible.
Tobias Gysi [Tue, 3 Jan 2023 12:46:08 +0000 (13:46 +0100)]
[mlir][llvm] Make the import of LLVM IR metadata extensible.

This revision extends the LLVMImportDialectInterface to make the import
of LLVM IR instruction-level metadata extensible. It extends the
signature of the existing dialect interface to provide a method to
import specific metadata kinds and attach them to the imported
operation. The conversion function can rely on the ModuleImport class
to perform support tasks.

The revision implements the second part of the
"extensible llvm ir import" rfc:
https://discourse.llvm.org/t/rfc-extensible-llvm-ir-import/67256/6

The interface method names changed a bit compared to the suggested
design. The hook to set the instruction level metadata is now called
setMetadataAttrs and takes the metadata kind as an additional parameter.
We do not hand in the original LLVM IR instruction since it is not used
at this point. Importing named module-level meta data can be added in a
later stage after gaining some experience with this extension mechanism.

Depends on D140374

Reviewed By: ftynse, Dinistro

Differential Revision: https://reviews.llvm.org/D140556

22 months ago[LSR] Convert test to check IR (NFC)
Nikita Popov [Tue, 3 Jan 2023 13:35:10 +0000 (14:35 +0100)]
[LSR] Convert test to check IR (NFC)

Convert this llc -O3 test to instead check the IR after -loop-reduce.

22 months ago[RewriteStatepointsForGC] Avoid branch on undef UB in tests (NFC)
Nikita Popov [Tue, 3 Jan 2023 13:28:22 +0000 (14:28 +0100)]
[RewriteStatepointsForGC] Avoid branch on undef UB in tests (NFC)

22 months ago[RewriteStatepointsForGC] Convert some tests to opaque pointers (NFC)
Nikita Popov [Tue, 3 Jan 2023 13:24:54 +0000 (14:24 +0100)]
[RewriteStatepointsForGC] Convert some tests to opaque pointers (NFC)

22 months ago[ConstraintElim] Move after first instcombine run.
Florian Hahn [Tue, 3 Jan 2023 13:25:00 +0000 (13:25 +0000)]
[ConstraintElim] Move after first instcombine run.

Running ConstraintEliminiation after the first InstCombine run results
in slightly more simplifications on average.

There are is a tiny number of regressions, mostly due to CVP eliminating
a condition that ConstraintElimination would use, but in most cases
there's a slight improvement or no change.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D140853

22 months ago[SampleProfile] Avoid branch on undef UB in tests (NFC)
Nikita Popov [Tue, 3 Jan 2023 13:23:25 +0000 (14:23 +0100)]
[SampleProfile] Avoid branch on undef UB in tests (NFC)

22 months ago[SafepointIRVerifier] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 3 Jan 2023 13:14:16 +0000 (14:14 +0100)]
[SafepointIRVerifier] Convert tests to opaque pointers (NFC)

22 months ago[lldb][Test] TestDataFormatterLibcxxRangesRefView.py: skip on old compiler versions
Michael Buch [Tue, 3 Jan 2023 13:11:16 +0000 (13:11 +0000)]
[lldb][Test] TestDataFormatterLibcxxRangesRefView.py: skip on old compiler versions

`std::ranges` are only available in libcxx shipped with Clang > 15.0

22 months ago[PlaceSafepoints] Avoid branch on undef UB in test (NFC)
Nikita Popov [Tue, 3 Jan 2023 13:08:35 +0000 (14:08 +0100)]
[PlaceSafepoints] Avoid branch on undef UB in test (NFC)

22 months ago[HotColdSplit] Avoid branch on undef UB in test (NFC)
Nikita Popov [Tue, 3 Jan 2023 13:07:07 +0000 (14:07 +0100)]
[HotColdSplit] Avoid branch on undef UB in test (NFC)

22 months ago[Coroutines] Convert some tests to opaque pointers (NFC)
Nikita Popov [Tue, 3 Jan 2023 12:54:06 +0000 (13:54 +0100)]
[Coroutines] Convert some tests to opaque pointers (NFC)

22 months ago[Coroutines] Avoid branch on undef UB in test (NFC)
Nikita Popov [Tue, 3 Jan 2023 12:53:10 +0000 (13:53 +0100)]
[Coroutines] Avoid branch on undef UB in test (NFC)

22 months ago[llvm] XFAIL X86 tests failing on AArch64/Windows
Muhammad Omair Javaid [Tue, 3 Jan 2023 12:42:03 +0000 (16:42 +0400)]
[llvm] XFAIL X86 tests failing on AArch64/Windows

coff-alignment.ll and merge-equivalent-ranges.ll depend on X86 target.
This patch marks them as XFAIL for AArch64/Windows target.

22 months ago[CodeGenPrepare] Avoid branch on undef UB in tests (NFC)
Nikita Popov [Tue, 3 Jan 2023 12:45:52 +0000 (13:45 +0100)]
[CodeGenPrepare] Avoid branch on undef UB in tests (NFC)

22 months agoFix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning.
Simon Pilgrim [Tue, 3 Jan 2023 12:23:06 +0000 (12:23 +0000)]
Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning.

22 months ago[CodeExtractor] Avoid branch on undef UB in tests (NFC)
Nikita Popov [Tue, 3 Jan 2023 12:01:44 +0000 (13:01 +0100)]
[CodeExtractor] Avoid branch on undef UB in tests (NFC)

22 months ago[CodeExtractor] Convert some tests to opaque pointers (NFC)
Nikita Popov [Tue, 3 Jan 2023 11:52:47 +0000 (12:52 +0100)]
[CodeExtractor] Convert some tests to opaque pointers (NFC)

22 months ago[CallSiteSplitting] Avoid branch on undef UB in test (NFC)
Nikita Popov [Tue, 3 Jan 2023 11:51:01 +0000 (12:51 +0100)]
[CallSiteSplitting] Avoid branch on undef UB in test (NFC)

22 months ago[Inline] Avoid branch on undef UB in tests (NFC)
Nikita Popov [Tue, 3 Jan 2023 11:44:01 +0000 (12:44 +0100)]
[Inline] Avoid branch on undef UB in tests (NFC)

22 months ago[mlir][transforms][NFC] Expand CanonicalizerPass documentation
Matthias Springer [Tue, 3 Jan 2023 10:48:38 +0000 (11:48 +0100)]
[mlir][transforms][NFC] Expand CanonicalizerPass documentation

Mention that canonicalization is best-effort and that pass pipelines should not rely on it for correctness.

RFC: https://discourse.llvm.org/t/rfc-canonicalizerpass-convergence-error-handling/67333

Differential Revision: https://reviews.llvm.org/D140729

22 months ago[SimplifyCFG] Avoid branch on undef UB in test (NFC)
Nikita Popov [Tue, 3 Jan 2023 11:38:05 +0000 (12:38 +0100)]
[SimplifyCFG] Avoid branch on undef UB in test (NFC)

22 months ago[SLP][AArch64] Add fmuladd test coverage
Dinar Temirbulatov [Tue, 3 Jan 2023 11:28:18 +0000 (11:28 +0000)]
[SLP][AArch64] Add fmuladd test coverage

22 months ago[compiler-rt] XFAIL builtins unit tests on WoA
Muhammad Omair Javaid [Mon, 2 Jan 2023 19:26:18 +0000 (23:26 +0400)]
[compiler-rt] XFAIL builtins unit tests on WoA

Following tests are marked XFAIl because they are dependent on native
C complex numbers but they are not a native type for Microsoft ABI [1].

Builtins-aarch64-windows :: divmodti4_test.c
Builtins-aarch64-windows :: fixunstfdi_test.c
Builtins-aarch64-windows :: multc3_test.c

Also trampoline_setup_test.c as it runs with only non-clang compiler while
WoA LLVM buildbots use clang.

[1] https://learn.microsoft.com/en-us/cpp/c-runtime-library/complex-math-support?view=msvc-170

22 months ago[TypePromotion] Add truncate in ConvertTruncs when the original truncate type is...
chenglin.bi [Tue, 3 Jan 2023 10:12:15 +0000 (18:12 +0800)]
[TypePromotion] Add truncate in ConvertTruncs when the original truncate type is not extend type

If the src type is not extend type, after convert the truncate to and we need to truncate the and also to make sure the all user is legal.

The old fix D137613 doesn't work when the truncate convert to and have the other users. So this time I try to add the truncate after and to avoid all these potential issues.

Fix: #59554

Reviewed By: samparker

Differential Revision: https://reviews.llvm.org/D140869

22 months agoApply clang-tidy fixes for llvm-else-after-return in TestBackwardDataFlowAnalysis...
Mehdi Amini [Thu, 22 Dec 2022 22:29:41 +0000 (22:29 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in TestBackwardDataFlowAnalysis.cpp (NFC)

22 months agoApply clang-tidy fixes for performance-move-const-arg in Utils.cpp (NFC)
Mehdi Amini [Thu, 22 Dec 2022 21:23:47 +0000 (21:23 +0000)]
Apply clang-tidy fixes for performance-move-const-arg in Utils.cpp (NFC)

22 months ago[clang-tidy] Fix all broken links in the comment.
Haojian Wu [Mon, 2 Jan 2023 22:51:35 +0000 (23:51 +0100)]
[clang-tidy] Fix all broken links in the comment.

22 months agoLink the default GC strategies everywhere getGCStrategy is used.
Campbell Suter [Thu, 22 Dec 2022 14:29:58 +0000 (21:29 +0700)]
Link the default GC strategies everywhere getGCStrategy is used.

GC strategies are registered using a system of global constructors: any
object can include a GCRegistry::Add stataic variable to register a
strategy, and that will generate a static constructor which registers
this strategy into a global list.

This allows shared libraries to easily register their own strategies,
but poses a problem related to linking: the default GC strategies
(defined and registered in their own file) must obviously be included in
LLVM binaries.

The previous solution was to define an empty functon in BuiltinGCs.cpp,
and call it from LinkAllCodegenComponents.h - this is the solution used
for many other codegen components. This header is then included into the
llc and lli main source files, ensuring everything gets linked into
those binaries.

This isn't great for GCStrategy, which we'd like [1] to use in other
binaries, notably opt for the RS4GC [2] pass. Instead of doing something
specific to opt (for example, adding a call in LinkAllIR), this patch
links to the registry function from getGCStrategy, in the assumption
that anything that might look up a GC strategy probably also expects
the default strategies to exist.

[1] https://reviews.llvm.org/D140458
[2] RewriteStatepointsForGC

Differential Revision: https://reviews.llvm.org/D140504

22 months agoAdd a math.cbrt instruction and lowering to libm.
Johannes Reifferscheid [Mon, 2 Jan 2023 14:23:12 +0000 (15:23 +0100)]
Add a math.cbrt instruction and lowering to libm.

There's currently no way to get accurate cube roots in the math dialect.
powf(x, 1/3.0) is too inaccurate in some cases.

Reviewed By: akuegel

Differential Revision: https://reviews.llvm.org/D140842

22 months ago[C++20] [Modules] Emit full specialization of variable template as available external...
Chuanqi Xu [Tue, 3 Jan 2023 06:37:56 +0000 (14:37 +0800)]
[C++20] [Modules] Emit full specialization of variable template as available externally in importers

Closes https://github.com/llvm/llvm-project/issues/59780.

In this issue report, when we use full specialization of variable
templates in modules, we will meet the multiple definition errors.

The root cause of the problem is that when we see the full
specialization of the variable template in the importers, we will find
if it is already defined in the external sources and we failed to find
such definitions from external sources. So we generate the definition in
the current TU. We failed to find the definition in the external sources
because we restricted to not write it during writing. However, we don't
know why we restricted it and it doesn't make a lot sense to do such
restriction. Then no test fails after we remove such limitations. So
let's remove it now and add it back later if we found it is necessary
then we can add the corresponding test that time.

Note that the code is only applied to named modules and
PCHWithObjectFiles. So it won't affect the normal clang modules and
header units.

22 months ago[gn build] Port c570287fbf4d
LLVM GN Syncbot [Tue, 3 Jan 2023 05:56:22 +0000 (05:56 +0000)]
[gn build] Port c570287fbf4d

22 months ago[RISCV][NFC] Move RISCVISAInfo back to Support
wangpc [Tue, 3 Jan 2023 05:55:12 +0000 (13:55 +0800)]
[RISCV][NFC] Move RISCVISAInfo back to Support

So that there is no cyclic dependency if we want to use it in
tablegen.

Reviewed By: fpetrogalli

Differential Revision: https://reviews.llvm.org/D140529

22 months ago[C++20] [Modules] Fix a crash when instantiate hidden friends
Chuanqi Xu [Tue, 3 Jan 2023 05:35:45 +0000 (13:35 +0800)]
[C++20] [Modules] Fix a crash when instantiate hidden friends

Closes https://github.com/llvm/llvm-project/issues/54457.

This removes a FIXME we found previously. But we didn't remove the FIXME
that time due to the lack of the corresponding test. And now we found
the corresponding test so we can remove it.

22 months ago[llvm] Use std::optional instead of llvm::Optional (NFC)
Kazu Hirata [Tue, 3 Jan 2023 05:17:15 +0000 (21:17 -0800)]
[llvm] Use std::optional instead of llvm::Optional (NFC)

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