platform/upstream/llvm.git
22 months ago[RISCV] Bugfix for 90f91683 noticed in follow up work
Philip Reames [Thu, 15 Dec 2022 16:26:25 +0000 (08:26 -0800)]
[RISCV] Bugfix for 90f91683 noticed in follow up work

I went to extend this locally, and then promptly tripped across a bug which is possible with the landed patch.  The problematic case is:
vsetvli zero, 4, <some vtype>
vmv.x.s x1, v0
vsetvli a0, zero, <same type>

In this case, the naive rewrite - what I had implemented - would form:
vsetvli zero, zero, <same vtype>
vmv.x.s x1, v0

This is, amusingly, correct for the vmv.x.s, but is incorrect for the instructions which follow the sequence and probably rely on VL=VLMAX.  (The VL before the sequence is unknown, and thus doesn't have to be VLMAX.)

I plan to rework the rewrite code to be more robust here, but I wanted to directly fix the bug first.  Sorry for the lack of test; I didn't manage to reproduce this without an additional optimization change after a few minutes of trying.

22 months ago[UpdateTestChecks][PowerPC] Add ppc64 triple support
Kai Nacke [Thu, 15 Dec 2022 15:44:38 +0000 (15:44 +0000)]
[UpdateTestChecks][PowerPC] Add ppc64 triple support

Newer tests use ppc64le-linux triple. It is identical to ppc32.
Some of the PPC GIsel tests were generated by this change.

Reviewed by: RKSimon

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

22 months ago[X86] Add test case for Issue #59526
Simon Pilgrim [Thu, 15 Dec 2022 16:19:35 +0000 (16:19 +0000)]
[X86] Add test case for Issue #59526

22 months ago[ProgressMeter] Remove unnecessary semicolon (NFC)
Nikita Popov [Thu, 15 Dec 2022 16:04:37 +0000 (17:04 +0100)]
[ProgressMeter] Remove unnecessary semicolon (NFC)

Fix compiler warning.

22 months ago[clang][PPC] Supporting -mcpu=405
Qiongsi Wu [Thu, 15 Dec 2022 15:03:05 +0000 (10:03 -0500)]
[clang][PPC] Supporting -mcpu=405

The  ClangBuiltLinux  project relies on `-mcpu=405`. Before https://reviews.llvm.org/D139720, `clang` treated `-mcpu=405` implicitly in the same way as `-mcpu=generic`, because `405` was an unknown value and `clang` did not validate unknown input values. https://reviews.llvm.org/D139720 added the validation of `-mcpu` input value, and `clang` now generates an error with `-mcpu=405`. For further details of the problem, see https://github.com/ClangBuiltLinux/linux/issues/1771.

This patch adds support of `-mcpu=405` explicitly, and treats it as an equivalent of `-mcpu=generic`.

Reviewed By: nemanjai

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

22 months ago[NFC][DebugInfo] Autogenerate check lines in assignment-tracking/sroa/*
Roman Lebedev [Thu, 15 Dec 2022 15:43:36 +0000 (18:43 +0300)]
[NFC][DebugInfo] Autogenerate check lines in assignment-tracking/sroa/*

Manual checklines are generally not welcomed in LLVM tests.
They are really brittle, and really hard to update.
*Please* use scripts!

22 months ago[GVN] reportMayClobberedLoad - avoid repeated cast<> calls. NFCI.
Simon Pilgrim [Thu, 15 Dec 2022 15:44:27 +0000 (15:44 +0000)]
[GVN] reportMayClobberedLoad - avoid repeated cast<> calls. NFCI.

Just perform each cast<Instruction> once - we can make OtherAccess a Instruction* type as we only ever assign it from a known LoadInst/StoreInst

22 months ago[clang-tidy] Add configuration option to bugprone-unchecked-optional-access check.
Yitzhak Mandelbaum [Wed, 14 Dec 2022 14:05:38 +0000 (14:05 +0000)]
[clang-tidy] Add configuration option to bugprone-unchecked-optional-access check.

The underlying model already supports ignoring accesses to optionals through
smart pointers. This patch exposes that option through ClangTidy's configuration
options.

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

22 months ago[MRI] Print more debug infor in clearVirtRegs() (NFC)
Nikita Popov [Thu, 15 Dec 2022 15:42:23 +0000 (16:42 +0100)]
[MRI] Print more debug infor in clearVirtRegs() (NFC)

22 months ago[clang][dataflow] Improve optional model's support for ignoring smart pointers.
Yitzhak Mandelbaum [Wed, 14 Dec 2022 13:54:38 +0000 (13:54 +0000)]
[clang][dataflow] Improve optional model's support for ignoring smart pointers.

The optional model has an option to ignore optionals accessed through smart
pointer types (other than optional itself). This patch improves this feature in
two ways:

1. We extend support to optionals accessed directly through the smart pointer,
like `ptr->value()`. Previously, support was limited to cases that went through
an intermediate field.

2. We clean up the implementation by removing the option from the analysis,
leaving it only in the diagnostic phase (where it is relevant).

3. Adjusts a test which was misleading in what it was testing.

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

22 months agoFix failing test in presence of exceptions D140098
Guillaume Chatelet [Thu, 15 Dec 2022 15:32:21 +0000 (15:32 +0000)]
Fix failing test in presence of exceptions D140098

There is no point in testing this behavior since this is std::optional's semantic.

22 months ago[RISCV][InsertVSETVLI] Mutate prior vsetvli AVL if doing so allows us to remove a...
Philip Reames [Wed, 14 Dec 2022 20:27:53 +0000 (12:27 -0800)]
[RISCV][InsertVSETVLI] Mutate prior vsetvli AVL if doing so allows us to remove a toggle

This extends the backwards walk to allow mutating the previous vsetvl's AVL value if it was not used by any instructions in between. In practice, this mostly benefits vmv.x.s and fvmv.f.s patterns since vector instructions which ignore VL are rare.

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

22 months ago[AArch64] Extending lowering of 'trunc <(8|16) x i64> %x to <(8|16) x i8>' to use...
Nilanjana Basu [Tue, 22 Nov 2022 20:04:26 +0000 (12:04 -0800)]
[AArch64] Extending lowering of 'trunc <(8|16) x i64> %x to <(8|16) x i8>' to use tbl instructions

[AArch64] Patch for lowering trunc instructions to 'tbl' for (8|16)xi32 -> (8|16)xi8 conversions in https://reviews.llvm.org/D133495 is extended to support trunc to tbl lowering for (8|16) x i64 to (8|16) x i8.

A microbenchmark for runtime for these transformations is added in https://reviews.llvm.org/D136274

Reviewed by: fhahn, t.p.northover

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

22 months ago[AArch64] Extra unit tests for trunc lowering of vectors
Nilanjana Basu [Wed, 23 Nov 2022 00:16:44 +0000 (16:16 -0800)]
[AArch64] Extra unit tests for trunc lowering of vectors

These tests show code generation for vectorized trunc lowering from i16 to i8 in AArch64.

Reviewed By: fhahn

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

22 months ago[Hexagon] Record original result type in wide multiplication
Krzysztof Parzyszek [Thu, 15 Dec 2022 00:23:45 +0000 (16:23 -0800)]
[Hexagon] Record original result type in wide multiplication

22 months ago[SelectionDAG] Do not second-guess alignment for alloca
Andrew Savonichev [Thu, 15 Dec 2022 15:16:45 +0000 (18:16 +0300)]
[SelectionDAG] Do not second-guess alignment for alloca

Alignment of an alloca in IR can be lower than the preferred alignment
on purpose, but this override essentially treats the preferred
alignment as the minimum alignment.

The patch changes this behavior to always use the specified
alignment. If alignment is not set explicitly in LLVM IR, it is set to
DL.getPrefTypeAlign(Ty) in computeAllocaDefaultAlign.

Tests are changed as well: explicit alignment is increased to match
the preferred alignment if it changes output, or omitted when it is
hard to determine the right value (e.g. for pointers, some structs, or
weird types).

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

22 months ago[NFC] Use std::optional over llvm::Optional to implement MaybeAlign
Guillaume Chatelet [Thu, 15 Dec 2022 13:52:00 +0000 (13:52 +0000)]
[NFC] Use std::optional over llvm::Optional to implement MaybeAlign

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

22 months agoRevert "[clang][CodeGen] Use base subobject type layout for potentially-overlapping...
Vladislav Dzhidzhoev [Thu, 15 Dec 2022 15:09:06 +0000 (18:09 +0300)]
Revert "[clang][CodeGen] Use base subobject type layout for potentially-overlapping fields"

This reverts commit 731abdfdcc33d813e6c3b4b89eff307aa5c18083.

This commit breaks some tests in libcxx, e.g.
`std/utilities/expected/expected.expected/ctor/ctor.inplace.pass.cpp`

22 months ago[CodeComplete] Complete members of dependent `auto` variables
Sam McCall [Wed, 14 Dec 2022 19:53:18 +0000 (20:53 +0100)]
[CodeComplete] Complete members of dependent `auto` variables

When the initializer of an `auto` variable is dependent, clang doesn't give the
DeclRefExpr a useful dependent type that we can apply heuristics to.
However we can dig one up by looking at the initializer.

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

22 months ago[PowerPC] Simplify PPCSubtarget
Kai Nacke [Wed, 14 Dec 2022 15:55:53 +0000 (15:55 +0000)]
[PowerPC] Simplify PPCSubtarget

The flags, initialization of the flags, and the getter methods for
features defined in PPC.td can be generated by TableGen.

Reviewed By: shchenz

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

22 months ago[PPC] Convert tests to check 'target=<triple>'
Paul Robinson [Tue, 29 Nov 2022 22:41:36 +0000 (14:41 -0800)]
[PPC] Convert tests to check 'target=<triple>'

Two tests checked 'ppc64be' which appears not to exist; the tests
pass on clang-ppc64be-linux-multistage so I assume they are fine
and just removed those UNSUPPORTED lines. All others were converted
to the new target= format, and get the same results on ppc bots as
before.

Part of the project to eliminate special handling for triples in lit
expressions.

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

22 months agoReland "[TargetLowering] Teach DemandedBits about VSCALE"
Benjamin Maxwell [Mon, 12 Dec 2022 16:26:20 +0000 (16:26 +0000)]
Reland "[TargetLowering] Teach DemandedBits about VSCALE"

Reland with a fixup to avoid converting APInts to int64_t which allowed for
overflows (UB) with sufficiently high/low multiplier values.

This allows DemandedBits to see the result of VSCALE will be at most
VScaleMax * some compile-time constant. This relies on the vscale_range()
attribute being present on the function, with a max set. (This is done by
default when clang is targeting AArch64+SVE).

Using this various redundant operations (zexts, sexts, ands, ors, etc)
can be eliminated.

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

22 months ago[MachineCombiner][RISCV] Support inverse instructions reassociation
Anton Sidorenko [Thu, 24 Nov 2022 12:30:01 +0000 (15:30 +0300)]
[MachineCombiner][RISCV] Support inverse instructions reassociation

This patch adds reassociation of FADD/FSUB instruction pairs.

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

22 months ago[NFC][LLDB] Using namespace llvm in EmulateInstructionRISCV
Emmmer [Thu, 15 Dec 2022 11:16:08 +0000 (19:16 +0800)]
[NFC][LLDB] Using namespace llvm in EmulateInstructionRISCV

The `EmulateInstructionRISCV` uses a lot of types and functions in `llvm` and `lldb`, this change is to make the code look cleaner.

PS: This patch should be merged before D140032.

Reviewed By: DavidSpickett

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

22 months ago[InstCombine] limit pair-of-insertelement folds to avoid miscompile
Sanjay Patel [Wed, 14 Dec 2022 22:52:50 +0000 (17:52 -0500)]
[InstCombine] limit pair-of-insertelement folds to avoid miscompile

This transform was added with 4446f71ce392. However, as noted in
the post-commit feedback, the transform is not safe with an
arbitrary base vector because we may leak poison from a narrow
element into an adjacent element when bitcasting.

I made the least invasive code change in case we do figure out
a way to make this safe.

22 months ago[clang-format] make doc for SLS_Inline more clearly
Backl1ght [Thu, 15 Dec 2022 01:08:54 +0000 (09:08 +0800)]
[clang-format] make doc for SLS_Inline more clearly

Reviewed By: HazardyKnusperkeks, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D139937

22 months ago[flang] Lower binary and unary elemental array operations
Jean Perier [Thu, 15 Dec 2022 11:54:56 +0000 (12:54 +0100)]
[flang] Lower binary and unary elemental array operations

Lower binary and unary elemental operations with an array argument
using hlfir.elemental, hlfir.yield_element, and hlfir.apply.

Concat implementation, which is a binary operation, is moved to a
BinaryOp struct so that it can leverage this new code.

This patch implements the "not yet implemented: character array
expression temp with dynamic length" TODO of the current lowering
by splitting the result length computation from the result value
computation. That way, the result length computation can be done
before lowering the operation to an hlfir.elemental, and the length
of the hlfir.elemental is known and storage for it can later be
allocated.

It adds a DesignatorOp builder to make "dumb" indexing (without triplets,
component, substrings or derived type component ref) easier since indexing
needs to be generated for array variables in elemental expression (in
the added hlfir::genElementAt helper).

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

22 months ago[clang][CodeGen] Use base subobject type layout for potentially-overlapping fields
Vladislav Dzhidzhoev [Fri, 9 Dec 2022 18:36:16 +0000 (21:36 +0300)]
[clang][CodeGen] Use base subobject type layout for potentially-overlapping fields

RecordLayoutBuilder assumes the size of a potentially-overlapping field
with non-zero size as the size of the base subobject type corresponding
to the field type.
Make CGRecordLayoutBuilder to acknowledge that in order to avoid incorrect
padding insertion.

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

22 months ago[DAGCombine] Fix always true condition in combineShiftToMULH
Juan Manuel MARTINEZ CAAMAÑO [Thu, 15 Dec 2022 10:33:30 +0000 (11:33 +0100)]
[DAGCombine] Fix always true condition in combineShiftToMULH

Reviewed By: RKSimon

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

22 months ago[AArch64][GlobalISel][Legalizer] Legalize G_SHUFFLE_VECTOR with different lengths
Vladislav Dzhidzhoev [Mon, 15 Aug 2022 18:51:13 +0000 (21:51 +0300)]
[AArch64][GlobalISel][Legalizer] Legalize G_SHUFFLE_VECTOR with different lengths

Legalize G_SHUFFLE_VECTOR having destination vector length greater than
source vector length by reshaping source vectors.

Partial implementation of SelectionDAGBuilder::visitShuffleVector.

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

22 months ago[Clang][CodeGen] Use poison instead of undef in CodeGen for ARM Builtins [NFC]
Manuel Brito [Thu, 15 Dec 2022 11:54:52 +0000 (11:54 +0000)]
[Clang][CodeGen] Use poison instead of undef in CodeGen for ARM Builtins [NFC]

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

22 months ago[PowerPC] Fix MSVC "switch statement contains 'default' but no 'case' labels" warning...
Simon Pilgrim [Thu, 15 Dec 2022 11:53:59 +0000 (11:53 +0000)]
[PowerPC] Fix MSVC "switch statement contains 'default' but no 'case' labels" warning. NFC.

22 months agoRevert "[TargetLowering] Teach DemandedBits about VSCALE"
Benjamin Maxwell [Thu, 15 Dec 2022 11:29:34 +0000 (11:29 +0000)]
Revert "[TargetLowering] Teach DemandedBits about VSCALE"

This reverts commit c165b0553a96394b9bbf3984782703cdae99821d.

22 months ago[mlir][linalg][NFC] Split populateFoldUnitExtentDimsViaReshapesPatterns
Matthias Springer [Thu, 15 Dec 2022 10:44:47 +0000 (11:44 +0100)]
[mlir][linalg][NFC] Split populateFoldUnitExtentDimsViaReshapesPatterns

MoveInitOperandsToInput is put into a separate populate... function because it can interfere with certain transformations.

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

22 months ago[flang] Fix associating entity when selector is an array, pointer or allocatable
Valentin Clement [Thu, 15 Dec 2022 11:02:11 +0000 (12:02 +0100)]
[flang] Fix associating entity when selector is an array, pointer or allocatable

In SELECT TYPE, within the block following TYPE IS, the associating entity is not polymorphic.
It has the type named in the type guard and other properties taken from the
selector. Within the block following a CLASS IS type guard statement, the
associating entity is polymorphic and has the declared type named in the type
guard statement.
This patch makes sure the associating entity matches the selector if it is
an array, a pointer or an allocatable.

Reviewed By: jeanPerier

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

22 months ago[WebAssembly] Use ComplexPattern on remaining memory instructions
Luke Lau [Thu, 15 Dec 2022 10:18:06 +0000 (10:18 +0000)]
[WebAssembly] Use ComplexPattern on remaining memory instructions

This continues the refactoring work of selecting offset + address
operands with the AddrOpsN pattern, previously called LoadOpsN.

This is not an NFC, since constant addresses are now folded into the
offset in more places for v128.storeN_lane.

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

22 months ago[flang][NFC] add builder to simplify fir.shape creation
Jean Perier [Thu, 15 Dec 2022 10:13:54 +0000 (11:13 +0100)]
[flang][NFC] add builder to simplify fir.shape creation

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

22 months ago[flang] Add hlfir.apply definition
Jean Perier [Thu, 15 Dec 2022 10:12:29 +0000 (11:12 +0100)]
[flang] Add hlfir.apply definition

hlfir.apply allows retrieving element values from an array expression
value. See https://github.com/llvm/llvm-project/blob/main/flang/docs/HighLevelFIR.md
for more detail.

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

22 months ago[flang] Add hlfir.elemental and hlfir.yield_element definition
Jean Perier [Thu, 15 Dec 2022 10:09:57 +0000 (11:09 +0100)]
[flang] Add hlfir.elemental and hlfir.yield_element definition

hlfir.elemental is the operation that will allow representing all
Fortran elemental expressions and more as functions of the indices.
See https://github.com/llvm/llvm-project/blob/main/flang/docs/HighLevelFIR.md for
more details about it.

Also add hlfir.yield_elemement which is the hlfir.elemental region terminator.

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

22 months ago[RISCV] Allow conversion of fp divisions to fp multiplications by the reciprocal
Anton Sidorenko [Wed, 30 Nov 2022 14:57:33 +0000 (17:57 +0300)]
[RISCV] Allow conversion of fp divisions to fp multiplications by the reciprocal

If the divisor is repeated at least twice, we will convert the FDIVs to the
calculation of the reciprocal and FMULs.

We perform the transformation only under fast-math mode. FDIVs must have
'arcp' flag.

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

22 months ago[RISCV] Precommit test for D140024
Anton Sidorenko [Wed, 30 Nov 2022 13:57:20 +0000 (16:57 +0300)]
[RISCV] Precommit test for D140024

Simple test to check converson of repeated fp divisors.

22 months agoYAMLParser: llvm::Optional => std::optional
Fangrui Song [Thu, 15 Dec 2022 09:34:31 +0000 (09:34 +0000)]
YAMLParser: llvm::Optional => std::optional

22 months ago[mlir][test] Add expand-strided-metadata to lower-to-llvm
Quentin Colombet [Mon, 12 Dec 2022 14:37:30 +0000 (14:37 +0000)]
[mlir][test] Add expand-strided-metadata to lower-to-llvm

This patch adds the `ExpandStridedMetadataPass` to the LowerToLLVM named
pipeline.
This is required now that "complex" memref operations, like subviews,
need to be expanded before being lowered.

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

22 months agoMIPS: fix build from IR files, nan2008 and FpAbi
YunQiang Su [Thu, 15 Dec 2022 09:04:36 +0000 (09:04 +0000)]
MIPS: fix build from IR files, nan2008 and FpAbi

When we use llc or lld to compiler IR files, the features +nan2008 and +fpxx/+fp64 are not used.
Thus wrong format files are produced.

In IR files, the attributes are only set for function while not the whole compile units.
So we output `.nan 2008` and `.module fp=xx/64` before every function.

`isFPXXDefault`: for o32, the FPXX should always be the default, no matter about the vendors.
Of course some distributions with FP64 default enabled should be listed explicit.
Let's add them in future if we know about one.

Reviewed By: MaskRay

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

22 months ago[SCEV] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 15 Dec 2022 08:59:15 +0000 (09:59 +0100)]
[SCEV] Convert some tests to opaque pointers (NFC)

22 months ago[CostModel] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 15 Dec 2022 08:54:44 +0000 (09:54 +0100)]
[CostModel] Convert some tests to opaque pointers (NFC)

These required some manual fixup.

22 months ago[CostModel] Convert test to opaque pointers (NFC)
Nikita Popov [Thu, 15 Dec 2022 08:52:14 +0000 (09:52 +0100)]
[CostModel] Convert test to opaque pointers (NFC)

Replace GEP index from 0 to 1 so it is not a trivial GEP.

22 months ago[CostModel] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 15 Dec 2022 08:48:57 +0000 (09:48 +0100)]
[CostModel] Convert some tests to opaque pointers (NFC)

22 months ago[AliasSet] Convert tests to opaque pointers (NFC)
Nikita Popov [Thu, 15 Dec 2022 08:47:53 +0000 (09:47 +0100)]
[AliasSet] Convert tests to opaque pointers (NFC)

22 months ago[LoongArch] Undef the macro after using it. NFC.
gonglingqin [Thu, 15 Dec 2022 07:41:37 +0000 (15:41 +0800)]
[LoongArch] Undef the macro after using it. NFC.

22 months ago[MLIR] NFC. Split out code from hasNoInterveningEffect
Uday Bondhugula [Wed, 14 Dec 2022 18:24:31 +0000 (23:54 +0530)]
[MLIR] NFC. Split out code from hasNoInterveningEffect

The `hasNoInterveningEffect` utility is too long with too deeply nested
logic. Split out a part into a helper. NFC.

Reviewed By: springerm

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

22 months ago[NFC] [C++20] [Modules] Add merge-records test for C++20 Modules
Chuanqi Xu [Thu, 15 Dec 2022 07:22:44 +0000 (15:22 +0800)]
[NFC] [C++20] [Modules] Add merge-records test for C++20 Modules

Merging declarations and checking ODR violations are a big part in the
implementation of modules. Currently, the implementation of C++20
Modules share a big part with the Clang modules and the ObjC modules for
the clang's serializer/deserailizer.

This is good. We saved a lot of time by this. And a lot of C++20
Modules's codes can run due to reuse it. However, the bad side is that
we lack a lot of tests about merging declarations and ODR checks for
C++20 Modules. It is not stable on the long run. So the patch tries to
add a test for it. This should be a long-term goal for C++20 modules.
(To add the test we shoudl add).

22 months ago[XCOFF] adjust the Fixedvalue for R_RBR relocations.
esmeyi [Thu, 15 Dec 2022 06:56:53 +0000 (01:56 -0500)]
[XCOFF] adjust the Fixedvalue for R_RBR relocations.

Summary: Currently we get a wrong fixed value for R_RBR relocations when -ffunction-sections enabled. This patch fixes this.

Reviewed By: DiggerLin, shchenz

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

22 months ago[AAPointerInfo] handle multiple offsets in PHI
Sameer Sahasrabuddhe [Thu, 15 Dec 2022 05:52:46 +0000 (11:22 +0530)]
[AAPointerInfo] handle multiple offsets in PHI

Previously reverted in 12696d302d146ffe616eecab3feceba9d29be2db

The arguments to a PHI may represent a recurrence by eventually using the output
of the PHI itself. This is now handled by checking for cycles in the control
flow. If a PHI is not in a recurrence, it is now able to report multiple offsets
instead of conservatively reporting unknown.

Reviewed By: jdoerfert

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

22 months ago[LoopFusion][NFC] Regenerate test checks
luxufan [Thu, 15 Dec 2022 05:52:07 +0000 (13:52 +0800)]
[LoopFusion][NFC] Regenerate test checks

22 months agoDon't include StringSwitch (NFC)
Kazu Hirata [Thu, 15 Dec 2022 05:50:34 +0000 (21:50 -0800)]
Don't include StringSwitch (NFC)

These files do not use llvm::StringSwitch.

22 months agoReturn early if FileID is invalid. NFC
Akira Hatanaka [Thu, 15 Dec 2022 05:28:02 +0000 (21:28 -0800)]
Return early if FileID is invalid. NFC

22 months agoDon't include Optional.h
Kazu Hirata [Thu, 15 Dec 2022 05:16:22 +0000 (21:16 -0800)]
Don't include Optional.h

These files no longer use llvm::Optional.

22 months agoRevert "[AAPointerInfo] handle multiple offsets in PHI"
Sameer Sahasrabuddhe [Thu, 15 Dec 2022 04:44:39 +0000 (10:14 +0530)]
Revert "[AAPointerInfo] handle multiple offsets in PHI"

This reverts commit 88db516af69619d4326edea37e52fc7321c33bb5.

22 months ago[lldb][Test] TestRerunAndExpr.py: explicitly delete a.out before rebuilding it
Michael Buch [Thu, 15 Dec 2022 04:01:21 +0000 (04:01 +0000)]
[lldb][Test] TestRerunAndExpr.py: explicitly delete a.out before rebuilding it

This applies the same fix as in `ad3870d6552305d2d6bd6aa2faca6f0644052d9a`
for `TestRerunAndExpr.py` to this test.

D138724

22 months ago[AAPointerInfo] handle multiple offsets in PHI
Sameer Sahasrabuddhe [Fri, 25 Nov 2022 08:04:57 +0000 (13:34 +0530)]
[AAPointerInfo] handle multiple offsets in PHI

The arguments to a PHI may represent a recurrence by eventually using the output
of the PHI itself. This is now handled by checking for cycles in the control
flow. If a PHI is not in a recurrence, it is now able to report multiple offsets
instead of conservatively reporting unknown.

Reviewed By: jdoerfert

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

22 months ago[mlir][gpu][spirv] Verify elementwise op type as mulf when converting to spirv.Matrix...
Quinn Dawkins [Thu, 15 Dec 2022 03:04:27 +0000 (03:04 +0000)]
[mlir][gpu][spirv] Verify elementwise op type as mulf when converting to spirv.MatrixTimesScalar

Conversion from gpu.subgroup_mma_constant_matrix to spirv.MatrixTimesScalar didn't check that the op type was a multiplication and thus would incorrectly convert other elementwise scalar operations.

Reviewed By: ThomasRaoux

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

22 months ago[llvm][test] Split DW_AT_default_value check out of clang/test/
Michael Buch [Thu, 15 Dec 2022 02:47:44 +0000 (02:47 +0000)]
[llvm][test] Split DW_AT_default_value check out of clang/test/

Followup to D139953 to fix build failure on machines not
configured for x86.

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

22 months ago[lldb] Use llvm::transformOptional (NFC)
Kazu Hirata [Thu, 15 Dec 2022 02:36:49 +0000 (18:36 -0800)]
[lldb] Use llvm::transformOptional (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

22 months agoRevert "Remove the dependency between lib/DebugInfoDWARF and MC."
Shubham Sandeep Rastogi [Thu, 15 Dec 2022 02:31:11 +0000 (18:31 -0800)]
Revert "Remove the dependency between lib/DebugInfoDWARF and MC."

This reverts commit 7dde94251e1c9e4634f5d51d41f2d4a191258fb3.

Because of test failures:

  lldb-shell :: SymbolFile/DWARF/x86/DW_AT_loclists_base.s
  lldb-shell :: SymbolFile/DWARF/x86/debug_loc.s
  lldb-shell :: SymbolFile/DWARF/x86/debug_loc_and_loclists.s
  lldb-shell :: SymbolFile/DWARF/x86/debug_loclists-dwo.s
  lldb-shell :: SymbolFile/DWARF/x86/debug_loclists-dwp.s
  lldb-shell :: SymbolFile/DWARF/x86/dwp.s
  lldb-shell :: SymbolFile/DWARF/x86/unused-inlined-params.test
  lldb-shell :: SymbolFile/NativePDB/inline_sites.test
  lldb-shell :: SymbolFile/NativePDB/local-variables-registers.s
  lldb-shell :: SymbolFile/NativePDB/nested-blocks-same-address.s

22 months ago[mlir] Use llvm::transformOptional (NFC)
Kazu Hirata [Thu, 15 Dec 2022 02:32:09 +0000 (18:32 -0800)]
[mlir] Use llvm::transformOptional (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

22 months ago[clang-tidy] Use llvm::transformOptional (NFC)
Kazu Hirata [Thu, 15 Dec 2022 02:27:39 +0000 (18:27 -0800)]
[clang-tidy] Use llvm::transformOptional (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

22 months ago[clang] Use llvm::transformOptional (NFC)
Kazu Hirata [Thu, 15 Dec 2022 02:19:25 +0000 (18:19 -0800)]
[clang] Use llvm::transformOptional (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

22 months agoRemove the dependency between lib/DebugInfoDWARF and MC.
Shubham Sandeep Rastogi [Thu, 6 Oct 2022 19:15:07 +0000 (12:15 -0700)]
Remove the dependency between lib/DebugInfoDWARF and MC.

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

22 months ago[NFC] Cleanup: Remove unnecessary use of Function::getBasicBlockList()
Vasileios Porpodas [Tue, 13 Dec 2022 23:13:22 +0000 (15:13 -0800)]
[NFC] Cleanup: Remove unnecessary use of Function::getBasicBlockList()

22 months ago[gn build] Port 3ec6c997c67d
LLVM GN Syncbot [Thu, 15 Dec 2022 01:19:28 +0000 (01:19 +0000)]
[gn build] Port 3ec6c997c67d

22 months ago[libc++] Implement P1169R4 (static operator())
Nikolas Klauser [Sat, 1 Oct 2022 19:25:13 +0000 (21:25 +0200)]
[libc++] Implement P1169R4 (static operator())

Reviewed By: ldionne, huixie90, #libc

Spies: EricWF, libcxx-commits, royjacobson

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

22 months agoEmit unwind information in the .debug_frame section when the .cfi_sections .debug_fra...
Shubham Sandeep Rastogi [Thu, 15 Dec 2022 00:44:21 +0000 (16:44 -0800)]
Emit unwind information in the .debug_frame section when the .cfi_sections .debug_frame directive is used.

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

22 months agoRevert "Emit unwind information in the .debug_frame section when the .cfi_sections...
Shubham Sandeep Rastogi [Thu, 15 Dec 2022 00:41:00 +0000 (16:41 -0800)]
Revert "Emit unwind information in the .debug_frame section when the .cfi_sections .debug_frame directive is used."

This reverts commit 28edf3349bd1d595270c17ec73e49999175f1212.

This is because:

The Buildbot has detected a failed build on builder llvm-clang-x86_64-sie-ubuntu-fast while building llvm.

Full details are available at:
   https://lab.llvm.org/buildbot#builders/139/builds/32856

Worker for this Build: sie-linux-worker
Blamelist:
   Shubham Sandeep Rastogi <srastogi22@apple.com>

BUILD FAILED: 40459 expected passes 83 expected failures 26251 unsupported tests 1 unexpected failures (failure)

Step 6 (test-build-unified-tree-check-all) failure: 40459 expected passes 83 expected failures 26251 unsupported tests 1 unexpected failures (failure)
******************** TEST 'LLVM :: DebugInfo/debugframeinfo.s' FAILED ********************
Script:
--
: 'RUN: at line 1';   /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llvm-mc -filetype=obj -triple=arm64-apple-darwin22.1.0 /home/buildbot/buildbot-root/llvm-project/llvm/test/DebugInfo/debugframeinfo.s -o /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/DebugInfo/Output/debugframeinfo.s.tmp.o
: 'RUN: at line 2';   /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llvm-dwarfdump -debug-frame /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/DebugInfo/Output/debugframeinfo.s.tmp.o | /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-project/llvm/test/DebugInfo/debugframeinfo.s
--
Exit Code: 1

Command Output (stderr):
--
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llvm-mc: error: unable to get target for 'arm64-apple-darwin22.1.0', see --version and --triple.

22 months agoEmit unwind information in the .debug_frame section when the .cfi_sections .debug_fra...
Shubham Sandeep Rastogi [Thu, 8 Dec 2022 18:55:52 +0000 (10:55 -0800)]
Emit unwind information in the .debug_frame section when the .cfi_sections .debug_frame directive is used.

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

22 months ago[mlir][arith][spirv] Account for possible type conversion failures
Jakub Kuderski [Thu, 15 Dec 2022 00:32:40 +0000 (19:32 -0500)]
[mlir][arith][spirv] Account for possible type conversion failures

Check results of all type conversions in `--convert-arith-to-spirv`.

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

Reviewed By: antiagainst

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

22 months ago[IR] Adds Function::erase() for erasing a range of basic blocks
Vasileios Porpodas [Wed, 14 Dec 2022 01:04:01 +0000 (17:04 -0800)]
[IR] Adds Function::erase() for erasing a range of basic blocks

This is part of a series of patches that aim at making Function::getBasicBlockList() private.

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

22 months ago[HWASAN] Added dtls_ member variable which is needed by __lsan::GetThreadRangesLocked.
Kirill Stoimenov [Wed, 14 Dec 2022 23:47:25 +0000 (23:47 +0000)]
[HWASAN] Added dtls_ member variable which is needed by __lsan::GetThreadRangesLocked.

Reviewed By: vitalybuka

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

22 months ago[RISCV] Remove Group<m_riscv_Features_Group> from mcmodel_EQ_medlow/mcmodel_EQ_medany...
Craig Topper [Wed, 14 Dec 2022 23:58:02 +0000 (15:58 -0800)]
[RISCV] Remove Group<m_riscv_Features_Group> from mcmodel_EQ_medlow/mcmodel_EQ_medany. NFCI

As far as I can tell m_riscv_Features_Group is for options that
can be passed to cc1's -target-feature. These mcmodel aliases aren't
that.

I think they get treated as aliases and disappear before we get
to processing m_riscv_Features_Group so it didn't cause any problems.

I've left them in m_Group to match mcmodel_EQ.

22 months ago[NFC] Cleanup: Replace Function::getBasicBlockList().splice() with Function::splice()
Vasileios Porpodas [Tue, 13 Dec 2022 23:49:48 +0000 (15:49 -0800)]
[NFC] Cleanup: Replace Function::getBasicBlockList().splice() with Function::splice()

This is part of a series of patches that aim at making Function::getBasicBlockList() private.

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

22 months ago[flang] Lower exponentiation without using pgmath.
Slava Zakharin [Wed, 14 Dec 2022 18:22:00 +0000 (10:22 -0800)]
[flang] Lower exponentiation without using pgmath.

Exponentiation is lowered to either math::FPowI or Fortran runtime
call (in case of --math-runtime=precise).

MathToFuncs convertor will convert math::FPowI operations with
exponent width >32 to calls of outlined implementations and otherwise
will leave the operation to MathToLLVM convertor.

Reviewed By: jeanPerier

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

22 months ago[RISCV][CodeGen][SelectionDAG] Recursively check hasAllNBitUsers for logical machine...
Nitin John Raj [Wed, 14 Dec 2022 22:03:43 +0000 (14:03 -0800)]
[RISCV][CodeGen][SelectionDAG] Recursively check hasAllNBitUsers for logical machine opcodes

We don’t have W versions of AND/OR/XOR/ANDN/ORN/XNOR so we should recursively check their users. We should limit the recursion to SelectionDAG::MaxRecursionDepth levels.

We need to add a Depth argument, all existing callers should pass 0 to the Depth. The new recursive calls should increment it by 1. At the top of the function we should give up and return false if Depth >= SelectionDAG::MaxRecursionDepth.

Reviewed By: craig.topper

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

22 months ago[mlir][sparse] Make the remaining integration tests run with vectorization.
bixia1 [Wed, 14 Dec 2022 22:13:13 +0000 (14:13 -0800)]
[mlir][sparse] Make the remaining integration tests run with vectorization.

Reviewed By: aartbik

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

22 months ago[mlir][sparse] Add another call to ConvertVectorToLLVMPass, to lower the vector opera...
bixia1 [Tue, 13 Dec 2022 18:41:12 +0000 (10:41 -0800)]
[mlir][sparse] Add another call to ConvertVectorToLLVMPass, to lower the vector operations added by ConvertMathToLLVMPass.

Run sparse_tanh with vectorization.

Reviewed By: aartbik

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

22 months ago[NFC] Fixes ModuleMaker example build failure caused by c143b77b30fc23f70aac94be66e41...
Vasileios Porpodas [Wed, 14 Dec 2022 21:29:10 +0000 (13:29 -0800)]
[NFC] Fixes ModuleMaker example build failure caused by c143b77b30fc23f70aac94be66e412651771c0fc

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

22 months ago[Support] Add llvm::transformOptional
Kazu Hirata [Wed, 14 Dec 2022 22:51:05 +0000 (14:51 -0800)]
[Support] Add llvm::transformOptional

llvm::Optional<T> has transform, which is equivalent to
std::optional<T>::transform.  The problem is that
std::optional<T>::transform won't be available until C++23, implying
that we probably cannot use it in our codebase untli 2028 or so.  We
certainly don't want to keep llvm::Optional just for transform.

This patch adds llvm::transformOptional to STLForwardCompat.h so that
we can use transform during the migration to std::optional and beyond.

I've shamelessly borrowed the implementation and test from
llvm/include/llvm/ADT/Optional.h and
llvm/unittests/ADT/OptionalTest.cpp respectively.

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

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

22 months ago[mlir][tensor] Move tiling tensor.pad op tests from Linalg/ to Tensor/
Hanhan Wang [Tue, 13 Dec 2022 23:35:18 +0000 (15:35 -0800)]
[mlir][tensor] Move tiling tensor.pad op tests from Linalg/ to Tensor/

Reviewed By: nicolasvasilache, springerm

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

22 months ago[LV] Add extra test for D139927.
Florian Hahn [Wed, 14 Dec 2022 22:47:05 +0000 (22:47 +0000)]
[LV] Add extra test for D139927.

22 months ago[SPARC][clang] Add SPARC target feature flags
Koakuma [Wed, 14 Dec 2022 22:35:04 +0000 (17:35 -0500)]
[SPARC][clang] Add SPARC target feature flags

This adds some SPARC feature flags to clang, for those that we have in common with GCC:

-m[no-]fpu
-m[no-]fsmuld
-m[no-]popc
-m[no-]vis
-m[no-]vis2
-m[no-]vis3
-m[hard/soft]-quad-float

All have the same meanings as GCC's options (https://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html).

This fixes, among other things, the -mno-fpu part of bug #40792

Reviewed By: nickdesaulniers

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

22 months ago[llvm][DebugInfo] Backport DW_AT_default_value for template args
Michael Buch [Tue, 13 Dec 2022 17:46:04 +0000 (17:46 +0000)]
[llvm][DebugInfo] Backport DW_AT_default_value for template args

**Summary**

Starting with DWARFv5, DW_AT_default_value can be used to indicate
that a template argument has a default value. With this patch LLVM
will emit the this attribute earlier versions of DWARF, unless
compiling with -gstrict-dwarf.

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

22 months ago[clang][DebugInfo] Attach DW_AT_default_value to template arg metadata regardless...
Michael Buch [Tue, 13 Dec 2022 17:40:02 +0000 (17:40 +0000)]
[clang][DebugInfo] Attach DW_AT_default_value to template arg metadata regardless of DwarfVersion

**Summary**

Starting with DWARFv5, DW_AT_default_value can be used to indicate
that a template argument has a default value. With this patch Clang
will attach the attribute to the debug metadata regardless of version.

In a follow-up patch we will change llvm to emit this attribute in
earlier versions of DWARF, unless compiling with -gstrict-dwarf.

**Details**

* Previously the DwarfVersion check in CGDebugInfo was inconsistent:
  For non-type template arguments we attached the attribute to the debug
  metadata in DWARFv5 only. Whereas for type template arguments we didn't
  have such a version restriction. With this patch we attach the attribute
  regardless of DWARF version (and instead offload the check to the AsmPrinter
  in a future patch).

22 months ago[mlir][sparse] Moving/renaming genBuffer to allocaBuffer
wren romano [Wed, 14 Dec 2022 20:58:50 +0000 (12:58 -0800)]
[mlir][sparse] Moving/renaming genBuffer to allocaBuffer

This allows allocaBuffer to be used outside of SparseTensorConversion.cpp, which will be helpful for a some future commits.

Reviewed By: aartbik, Peiming

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

22 months ago[mlir][sparse] introduce sparse_tensor::StorageSpecifierType and related operations...
Peiming Liu [Tue, 13 Dec 2022 19:49:43 +0000 (19:49 +0000)]
[mlir][sparse] introduce sparse_tensor::StorageSpecifierType and related operations on it

Reviewed By: aartbik

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

22 months ago[NFC] Fixes BrainF example build failure caused by c143b77b30fc23f70aac94be66e4126517...
Vasileios Porpodas [Wed, 14 Dec 2022 22:03:47 +0000 (14:03 -0800)]
[NFC] Fixes BrainF example build failure caused by c143b77b30fc23f70aac94be66e412651771c0fc

22 months ago[docs] Updates ProgrammersManual to reflect the change that BasicBlock::getInstList...
Vasileios Porpodas [Wed, 14 Dec 2022 21:45:26 +0000 (13:45 -0800)]
[docs] Updates ProgrammersManual to reflect the change that BasicBlock::getInstList() is private.

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

22 months agoRevert "[profile] Add binary ids into indexed profiles"
Gulfem Savrun Yeniceri [Wed, 14 Dec 2022 21:45:50 +0000 (21:45 +0000)]
Revert "[profile] Add binary ids into indexed profiles"

This reverts commit 7734053fd98e7d5ddc749808ce38134686425fb7
because it broke powerpc64 bot:
https://lab.llvm.org/buildbot#builders/231/builds/6229

22 months agoAMDGPU: Update test
Matt Arsenault [Wed, 14 Dec 2022 21:47:16 +0000 (16:47 -0500)]
AMDGPU: Update test

22 months ago[EarlyIfConversion] Add target hook to allow for multiple ifcvt iterations.
Hendrik Greving [Wed, 14 Dec 2022 00:53:05 +0000 (16:53 -0800)]
[EarlyIfConversion] Add target hook to allow for multiple ifcvt iterations.

Adds a target hook canPredicatePredicatedInstr(const MachineInstr&) that
assumes an instruction is already predicated and returns true if it can
be predicated again, used by the early if-conversion pass in order to
iterate multiple times on architectures supporting predicate logic.

No test added since there is no upstream target that can take advantage.

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

22 months ago[NFC][libc++][format] Uses qualified calls.
Mark de Wever [Wed, 14 Dec 2022 19:10:23 +0000 (20:10 +0100)]
[NFC][libc++][format] Uses qualified calls.

Changes all unqualified calls to __throw_format_error to use a qualified
call.

Reviewed By: #libc, philnik

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

22 months ago[mlir][sparse][simd] only accept proper unit stride subscripts
Aart Bik [Wed, 14 Dec 2022 01:17:45 +0000 (17:17 -0800)]
[mlir][sparse][simd] only accept proper unit stride subscripts

Reviewed By: bixia

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