platform/upstream/llvm.git
2 years agoAttempt fix for Bazel build from
David Blaikie [Wed, 2 Mar 2022 21:45:25 +0000 (21:45 +0000)]
Attempt fix for Bazel build from
3ba66435d9377cb99ee1718807cbf6a7c4b0d6d3

2 years ago[LLDB] Dump valid ranges of variables
Zequan Wu [Wed, 16 Feb 2022 19:18:54 +0000 (11:18 -0800)]
[LLDB] Dump valid ranges of variables

This allows `image lookup -a ... -v` to print variables only if the given
address is covered by the valid ranges of the variables. Since variables created
in dwarf plugin always has empty scope range, print the variable if it has
empty scope.

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

2 years ago[SDAG] refactor foldSetCCWithRotate; NFC
Sanjay Patel [Wed, 2 Mar 2022 20:03:35 +0000 (15:03 -0500)]
[SDAG] refactor foldSetCCWithRotate; NFC

There are more potential optimizations to make here,
so rearrange to make it easier to append those.

2 years ago[x86] add nounwind attribute to test; NFC
Sanjay Patel [Wed, 2 Mar 2022 19:49:05 +0000 (14:49 -0500)]
[x86] add nounwind attribute to test; NFC

This will avoid some noise in case the register allocation changes.

2 years ago[lldb] Explicitly declare the default constructor in PlatformAndroidRemoteGDBServer
Pavel Labath [Wed, 2 Mar 2022 20:12:49 +0000 (21:12 +0100)]
[lldb] Explicitly declare the default constructor in PlatformAndroidRemoteGDBServer

MSVC does not seem to like the inheriting constructor.

2 years ago[libcxx] [test] Fix en_US money locale formatting tests on Windows
Martin Storsjö [Tue, 18 Jan 2022 10:48:12 +0000 (10:48 +0000)]
[libcxx] [test] Fix en_US money locale formatting tests on Windows

In the en_US locale on Windows, negative currency amounts is formatted
as "($0.01)" instead of "-$0.01".

Adjust the test references accordingly, making these tests pass.

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

2 years ago[mlir][SPIRV] Split up StandardToSPIRV now that the Standard dialect is gone
River Riddle [Tue, 1 Mar 2022 21:30:14 +0000 (13:30 -0800)]
[mlir][SPIRV] Split up StandardToSPIRV now that the Standard dialect is gone

StandardToSPIRV currently contains an assortment of patterns converting from
different dialects to SPIRV. This commit splits up StandardToSPIRV into separate
conversions for each of the dialects involved (some of which already exist).

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

2 years ago[CSSPGO] Even flow distribution
spupyrev [Mon, 31 Jan 2022 17:59:45 +0000 (09:59 -0800)]
[CSSPGO] Even flow distribution

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

2 years ago[flang] Accommodate module subprograms defined in the same module
Peter Klausler [Fri, 18 Feb 2022 22:58:12 +0000 (14:58 -0800)]
[flang] Accommodate module subprograms defined in the same module

The symbol table, name resolution, and semantic checks for module
subprograms -- esp. for MODULE FUNCTION and MODULE SUBROUTINE, but
also MODULE PROCEDURE -- essentially assumed that the subprogram
would be defined in a submodule of the (sub)module containing its
interface.  However, it is conforming to instead declare a module
subprogram in the *same* (sub)module as its interface, and we need
to handle that case.

Since this case involves two symbols in the same scope with the same
name, the symbol table details for subprograms have been extended
with a pointer to the original module interface, rather than relying
on searching in scopes.

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

2 years ago[Hexagon] Recognize "access size" for dcfetch
Krzysztof Parzyszek [Wed, 2 Mar 2022 18:02:52 +0000 (10:02 -0800)]
[Hexagon] Recognize "access size" for dcfetch

Dcfetch doesn't really have an access size, but the immediate
offset is scaled as for an 8-byte access, so treat it as such.

2 years ago[mlir] Add extensible dialects
Mathieu Fehr [Wed, 2 Mar 2022 20:17:06 +0000 (12:17 -0800)]
[mlir] Add extensible dialects

Add support for extensible dialects, which are dialects that can be
extended at runtime with new operations and types.

These operations and types cannot at the moment implement traits
or interfaces.

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

2 years ago[flang] Catch READ/WRITE on direct-access file without REC=
Peter Klausler [Fri, 18 Feb 2022 01:22:09 +0000 (17:22 -0800)]
[flang] Catch READ/WRITE on direct-access file without REC=

A data transfer statement must have REC= in its control list
if (and only if) the unit was opened with ACCESS='DIRECT'.
The runtime wasn't catching this error, but was just silently
advancing to the next record as if the access were sequential.

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

2 years ago[tosa][mlir] Add support for dynamic width/height for Conv2D inputs in tosa-to-linalg
natashaknk [Mon, 28 Feb 2022 23:49:50 +0000 (15:49 -0800)]
[tosa][mlir] Add support for dynamic width/height for Conv2D inputs in tosa-to-linalg

Infers output shape for dynamic width/height inputs.

Reviewed By: jpienaar

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

2 years ago[flang] Honor RECL= in list-directed/namelist output
Peter Klausler [Thu, 17 Feb 2022 23:32:06 +0000 (15:32 -0800)]
[flang] Honor RECL= in list-directed/namelist output

Advancement to new output lines was taking fixed-sized direct-access
and internal character array element lengths into account, but not
RECL= settings from OPEN statements.

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

2 years ago[RISCV] More correctly ignore Zfinx register classes in getRegForInlineAsmConstraint.
Craig Topper [Wed, 2 Mar 2022 18:55:18 +0000 (10:55 -0800)]
[RISCV] More correctly ignore Zfinx register classes in getRegForInlineAsmConstraint.

Until Zfinx is supported in CodeGen we need to convert all Zfinx
register classes to GPR.

Remove the zfinx-types.ll test which didn't test anything meaningful
since -mattr=zfinx isn't implemented completely in llc.

Follow up to D93298.

2 years ago[clang][CGStmt] fix crash on invalid asm statement
Tong Zhang [Wed, 2 Mar 2022 19:18:54 +0000 (11:18 -0800)]
[clang][CGStmt] fix crash on invalid asm statement

Clang is crashing on the following statement

  char var[9];
  __asm__ ("" : "=r" (var) : "0" (var));

This is similar to existing test: crbug_999160_regtest

The issue happens when EmitAsmStmt is trying to convert input to match
output type length. However, that is not guaranteed to be successful all the
time and if the statement itself is invalid like having an array type in
the example, we should give a regular error message here instead of
using assert().

Reviewed By: MaskRay

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

2 years agoRefine error msgs from CommandObject & Disassemble
Jason Molenda [Wed, 2 Mar 2022 19:17:01 +0000 (11:17 -0800)]
Refine error msgs from CommandObject & Disassemble

Make it clearer for end users why a command cannot be used
when a process is not stopped, etc.

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

2 years ago[BOLT] Enable PLT analysis for aarch64
Vladislav Khmelevsky [Tue, 25 Jan 2022 00:22:47 +0000 (03:22 +0300)]
[BOLT] Enable PLT analysis for aarch64

This patch enables PLT analysis for aarch64. It is used by the static
relocations in order to provide final symbol address of PLT entry for some
instructions like ADRP.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

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

2 years agoRevert "[cmake] Prefix gtest and gtest_main with "llvm_"."
Stella Laurenzo [Wed, 2 Mar 2022 19:13:46 +0000 (11:13 -0800)]
Revert "[cmake] Prefix gtest and gtest_main with "llvm_"."

lldb buildbot failure. will investigate and roll forward.

This reverts commit 9f37775472b45986b0ecce5243bd6ce119e5bd69.

2 years agoAdd "REQUIRES: x86" to test as it calls llc with an x86_64 triple.
Douglas Yung [Wed, 2 Mar 2022 19:11:52 +0000 (11:11 -0800)]
Add "REQUIRES: x86" to test as it calls llc with an x86_64 triple.

2 years ago[flang] Fix result type of "procedure(abs) :: f"
Peter Klausler [Wed, 16 Feb 2022 01:04:30 +0000 (17:04 -0800)]
[flang] Fix result type of "procedure(abs) :: f"

Name resolution was properly probing the table of unrestricted
specific intrinsics to find "abs", but failing to capture the
result type and save it in the created symbol table entry.

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

2 years ago[flang] Lower more cases of assignments on allocatable variables
Valentin Clement [Wed, 2 Mar 2022 17:31:12 +0000 (18:31 +0100)]
[flang] Lower more cases of assignments on allocatable variables

This patch enables the lowering of various allocatable assignements
for character type and numeric types.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D120819

Reviewed By: PeteSteinfeld, schweitz

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[cmake] Prefix gtest and gtest_main with "llvm_".
Stella Laurenzo [Wed, 2 Mar 2022 18:17:05 +0000 (10:17 -0800)]
[cmake] Prefix gtest and gtest_main with "llvm_".

The upstream project ships CMake rules for building vanilla gtest/gmock which conflict with the names chosen by LLVM. Since LLVM's build rules here are quite specific to LLVM, prefixing them to avoid collision is the right thing (i.e. there does not appear to be a path to letting someone *replace* LLVM's googletest with one they bring, so co-existence should be the goal).

This allows LLVM to be included with testing enabled within projects that themselves have a dependency on an official gtest release.

Reviewed By: mehdi_amini

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

2 years agoReapply "[SLP] Schedule only sub-graph of vectorizable instructions""
Philip Reames [Wed, 2 Mar 2022 18:40:10 +0000 (10:40 -0800)]
Reapply "[SLP] Schedule only sub-graph of vectorizable instructions""

Root issue which triggered the revert was fixed in 689bab.  No changes in the reapplied patch.

Original commit message follows:

SLP currently schedules all instructions within a scheduling window which stretches from the first instr
uction potentially vectorized to the last. This window can include a very large number of unrelated instruct
ions which are not being considered for vectorization. This change switches the code to only schedule the su
b-graph consisting of the instructions being vectorized and their transitive users.

This has the effect of greatly reducing the amount of work performed in large basic blocks, and thus greatly improves compile time on degenerate examples. To understand the effects, I added some statistics (not planned for upstream contribution). Here's an illustration from my motivating example:

    Before this patch:

    704357 SLP                          - Number of calcDeps actions
     699021 SLP                          - Number of schedule calls
       5598 SLP                          - Number of ReSchedule actions
         59 SLP                          - Number of ReScheduleOnFail actions
      10084 SLP                          - Number of schedule resets
       8523 SLP                          - Number of vector instructions generated

    After this patch:

    102895 SLP                          - Number of calcDeps actions
     161916 SLP                          - Number of schedule calls
       5637 SLP                          - Number of ReSchedule actions
         55 SLP                          - Number of ReScheduleOnFail actions
      10083 SLP                          - Number of schedule resets
       8403 SLP                          - Number of vector instructions generated

I do want to highlight that there is a small difference in number of generated vector instructions. This example is hitting the bailout due to maximum window size, and the change in scheduling is slightly perturbing when and how we hit it. This can be seen in the RescheduleOnFail counter change. Given that, I think we can safely ignore.

The downside of this change can be seen in the large test diff. We group all vectorizable instructions together at the bottom of the scheduling region. This means that vector instructions can move quite far from their original point in code. While maybe undesirable, I don't see this as being a major problem as this pass is not intended to be a general scheduling pass.

For context, it's worth noting that the pre-scheduling that SLP does while building the vector tree is exactly the sub-graph scheduling implemented by this patch.

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

2 years ago[NFC] Fix typo in CMake comment
Louis Dionne [Wed, 2 Mar 2022 18:28:34 +0000 (13:28 -0500)]
[NFC] Fix typo in CMake comment

2 years ago[SLP] Don't try to vectorize allocas
Philip Reames [Wed, 2 Mar 2022 17:58:26 +0000 (09:58 -0800)]
[SLP] Don't try to vectorize allocas

While a collection of allocas are technically vectorizeable - by forming a wider alloca - this was not a transform SLP actually knows how to do.  Instead, we were forming a bundle with missing dependencies, and then relying on the scheduling code to preserve program order if multiple instructions were scheduleable at once.  I haven't been able to write a test case, but I'm 99% sure this was wrong in some edge case.

The unknown op case was flowing down the shufflevector path.  This did result in some splat handling being lost with this change, but the same lack of splat handling is visible in a whole bunch of simple examples for the gather path.  I didn't consider this interesting to fix given how narrow the splat of allocas case is.

2 years ago[AArch64] Add some fp16 conversion cost tests. NFC
David Green [Wed, 2 Mar 2022 18:07:14 +0000 (18:07 +0000)]
[AArch64] Add some fp16 conversion cost tests. NFC

2 years ago[OpenMP] Handle sysroot option in offloading linker wrapper
Joseph Huber [Wed, 2 Mar 2022 17:38:29 +0000 (12:38 -0500)]
[OpenMP] Handle sysroot option in offloading linker wrapper

Summary:
This patch correctly handles the `--sysroot=` option when passed to the
linker wrapper. This allows users to correctly find libraries that may
contain offloading code if using this option.

2 years ago[MLIR] Use Datalayout defaults when importing LLVM
William S. Moses [Wed, 2 Mar 2022 17:40:21 +0000 (12:40 -0500)]
[MLIR] Use Datalayout defaults when importing LLVM

LLVM defines several default datalayouts for integer and floating point types that are not being considered when importing into MLIR. This patch remedies this.

Reviewed By: ftynse

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

2 years agoRevert "[LegalizeTypes][VP] Add splitting and widening support for VP_FNEG."
Craig Topper [Wed, 2 Mar 2022 18:00:11 +0000 (10:00 -0800)]
Revert "[LegalizeTypes][VP] Add splitting and widening support for VP_FNEG."

This reverts commit ac93f95861268c058d3f3bffd447a594a793c6b3.

Committed by accident.

2 years ago[LoopPeel] Add EXPENSIVE_CHECKS ifdef guard around domtree verify call
Stephen Long [Wed, 2 Mar 2022 17:55:35 +0000 (09:55 -0800)]
[LoopPeel] Add EXPENSIVE_CHECKS ifdef guard around domtree verify call

The verify call was taking 50% of the compile time in our internal LLVM
fork when trying to unroll many loops.

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

2 years ago[SelectionDAG][RISCV] Emit a canonical sign bit test from ExpandIntRes_ABS.
Craig Topper [Wed, 2 Mar 2022 17:47:24 +0000 (09:47 -0800)]
[SelectionDAG][RISCV] Emit a canonical sign bit test from ExpandIntRes_ABS.

Instead of emitting 0 > Hi, emit Hi < 0. If Hi needs to be expanded again
this will allow the special case for sign bit tests in ExpandIntOp_SETCC
to trigger.

Reviewed By: RKSimon

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

2 years ago[RISCV] Don't combine ROTR ((GREV x, 24), 16)->(GREV x, 8) on RV64.
Craig Topper [Wed, 2 Mar 2022 17:42:43 +0000 (09:42 -0800)]
[RISCV] Don't combine ROTR ((GREV x, 24), 16)->(GREV x, 8) on RV64.

This miscompile was introduced in D119527.

This was a special pattern for rotate+bswap on RV32. It doesn't
work for RV64 since the rotate needs to be half the bitwidth. The
equivalent pattern for RV64 is ROTR ((GREV x, 56), 32) so match
that instead.

This could be generalized further as noted in the new FIXME.

Reviewed By: Chenbing.Zheng

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

2 years ago[LegalizeTypes][VP] Add splitting and widening support for VP_FNEG.
Craig Topper [Wed, 2 Mar 2022 00:10:22 +0000 (16:10 -0800)]
[LegalizeTypes][VP] Add splitting and widening support for VP_FNEG.

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

2 years ago[MLIR][OpenMP] Place alloca scope within wsloop in scf.parallel to omp lowering
William S. Moses [Tue, 1 Mar 2022 22:02:14 +0000 (17:02 -0500)]
[MLIR][OpenMP] Place alloca scope within wsloop in scf.parallel to omp lowering

https://reviews.llvm.org/D120423 replaced the use of stacksave/restore with memref.alloca_scope, but kept the save/restore at the same location. This PR places the allocation scope within the wsloop, thus keeping the same allocation scope as the original scf.parallel (e.g. no longer over stack allocating).

Reviewed By: ftynse

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

2 years ago[slp] Add tests for cause of D118538 revert
Philip Reames [Wed, 2 Mar 2022 17:42:00 +0000 (09:42 -0800)]
[slp] Add tests for cause of D118538 revert

2 years ago[libc++] Check clang-tidy version
Nikolas Klauser [Wed, 2 Mar 2022 17:40:39 +0000 (18:40 +0100)]
[libc++] Check clang-tidy version

Reviewed By: ldionne, #libc

Spies: libcxx-commits, arichardson

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

2 years ago[AArch64][SME] Don't infer -neon from +streaming-sve.
Sander de Smalen [Wed, 2 Mar 2022 16:03:33 +0000 (16:03 +0000)]
[AArch64][SME] Don't infer -neon from +streaming-sve.

In Streaming SVE mode full NEON is not available, even though this is
implied from armv8-a. LLVM previously inferred that NEON needed to be
disabled when setting +streaming-sve, but there is no need to infer
this from +streaming-sve, because we can explicitly disable NEON using
LLVM's attribute mechanism. This is specifically relevant because
+streaming-sve is not a user-facing feature, but rather an LLVM internal
feature.

Reviewed By: paulwalker-arm

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

2 years ago[X86] Enable v32i16 FSHL/FSHR support
Simon Pilgrim [Wed, 2 Mar 2022 17:29:11 +0000 (17:29 +0000)]
[X86] Enable v32i16 FSHL/FSHR support

Now that we've improved splat detection we no longer see regressions in the funnel-shift-by-splat-amount test cases

2 years ago[MLIR][Arith] Canonicalize cmpi of extui/extsi
William S. Moses [Sat, 26 Feb 2022 19:40:51 +0000 (14:40 -0500)]
[MLIR][Arith] Canonicalize cmpi of extui/extsi

Canonicalize cmpi(eq, ext a, ext b) and cmpi(ne, ext a, ext b)

Reviewed By: ftynse

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

2 years ago[flang] Handle module in lowering pass
Valentin Clement [Wed, 2 Mar 2022 17:26:13 +0000 (18:26 +0100)]
[flang] Handle module in lowering pass

This patch enables the lowering of basic modules and functions/subroutines
in modules.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[libc++] Add missing std:: qualification to __synth_three_way.
Arthur O'Dwyer [Wed, 2 Mar 2022 17:15:19 +0000 (12:15 -0500)]
[libc++] Add missing std:: qualification to __synth_three_way.

This might be unobservable, since __synth_three_way is only ever
called as a result of using an (ADL) operator on std::pair or std::tuple.

2 years ago[flang] Lower inquire statement
Valentin Clement [Wed, 2 Mar 2022 17:02:41 +0000 (18:02 +0100)]
[flang] Lower inquire statement

This patch adds the lowering of the `inquire` statement.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D120822

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[flang] Lower basic IO file statements
Valentin Clement [Wed, 2 Mar 2022 16:58:38 +0000 (17:58 +0100)]
[flang] Lower basic IO file statements

This patches adds lowering for couple of basic io statements such as `flush`,
`endfile`, `backspace` and `rewind`

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D120821

Reviewed By: schweitz

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[MLIR][Arith] Add constant folder for left shift
William S. Moses [Mon, 28 Feb 2022 14:57:35 +0000 (09:57 -0500)]
[MLIR][Arith] Add constant folder for left shift

Add constant folder for left shift

Reviewed By: ftynse

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

2 years ago[NFC][Clang][OpaquePtr] Remove the call to Address::deprecated in
Akira Hatanaka [Wed, 2 Mar 2022 16:55:42 +0000 (08:55 -0800)]
[NFC][Clang][OpaquePtr] Remove the call to Address::deprecated in
CreatePointerBitCastOrAddrSpaceCast

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

2 years ago[flang] Lower IO open and close statements
Valentin Clement [Wed, 2 Mar 2022 16:55:10 +0000 (17:55 +0100)]
[flang] Lower IO open and close statements

This patch adds the lowering of open and close statements

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[clang-format] Recognize "if consteval".
Marek Kurdej [Wed, 2 Mar 2022 08:35:07 +0000 (09:35 +0100)]
[clang-format] Recognize "if consteval".

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

Reviewed By: MyDeveloperDay, JohelEGP

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

2 years ago[CodeGen] Use AdjustStackOffset for Callee Saved Registers in PEI::calculateFrameObje...
Daniel McIntosh [Sat, 22 Jan 2022 00:51:42 +0000 (19:51 -0500)]
[CodeGen] Use AdjustStackOffset for Callee Saved Registers in PEI::calculateFrameObjectOffsets

Also, changes how the CSR loop is indexed, which should avoid bugs like the one fixed by rG4a57bb5a3b74bdad9b0518009a7d7ac7ca2ac650

Reviewed By: arsenm

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

2 years agoRevert "[RISCV] Add cost modelling for masked memory op"
Nikita Popov [Wed, 2 Mar 2022 16:32:10 +0000 (17:32 +0100)]
Revert "[RISCV] Add cost modelling for masked memory op"

This reverts commit 76f243b53b1c4bed5defe8ffac1fd739a39b0097.

The newly added test fails.

2 years ago[X86] Add XOP coverage for vector-popcnt tests
Simon Pilgrim [Wed, 2 Mar 2022 16:19:45 +0000 (16:19 +0000)]
[X86] Add XOP coverage for vector-popcnt tests

2 years ago[VPlan] Remove reliance on underlying instr for ScalarIVSteps (NFCI).
Florian Hahn [Wed, 2 Mar 2022 16:23:19 +0000 (16:23 +0000)]
[VPlan] Remove reliance on underlying instr for ScalarIVSteps (NFCI).

Instead of relying on underlying instructions, this patch updates
VPScalarIVStepsRecipe to only store the required type information.

This removes access to unrelated information, as well as avoiding issues
with the same underlying instruction being shared by multiple recipes.

This change should only change the debug output and not cause any
codegen changes, hence NFCI.

2 years ago[AMDGPU] Fix deleting of move-immediate instructions after folding
Jay Foad [Wed, 2 Mar 2022 15:18:30 +0000 (15:18 +0000)]
[AMDGPU] Fix deleting of move-immediate instructions after folding

SIInstrInfo::FoldImmediate tried to delete move-immediate instructions
after folding them into their only use. This did not work because it was
checking hasOneNonDBGUse after doing the fold, at which point there
should be no uses. This seems to have no effect on codegen, it just
means less stuff for DCE to clean up later.

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

2 years ago[ObjectYAML] WasmWriter::writeSectionContent - use llvm::enumerate to fix 'side effec...
Simon Pilgrim [Wed, 2 Mar 2022 16:09:09 +0000 (16:09 +0000)]
[ObjectYAML] WasmWriter::writeSectionContent - use llvm::enumerate to fix 'side effect in assert' warning

2 years ago[clang] ExprEngine::VisitCXXNewExpr - remove superfluous nullptr tests
Simon Pilgrim [Wed, 2 Mar 2022 15:58:52 +0000 (15:58 +0000)]
[clang] ExprEngine::VisitCXXNewExpr - remove superfluous nullptr tests

FD has already been dereferenced

2 years ago[MachineSink] Disable if there are any irreducible cycles
Nikita Popov [Thu, 24 Feb 2022 09:09:49 +0000 (10:09 +0100)]
[MachineSink] Disable if there are any irreducible cycles

This is an alternative to D120330, which disables MachineSink for
functions with irreducible cycles entirely. This avoids both the
correctness problem, and ensures we don't perform non-profitable
sinks into cycles. At the same time, it may also disable
profitable sinks in the same function. This can be made more
precise by using MachineCycleInfo in the future.

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

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

2 years ago[mlir] Ignore index data layout in translation to LLVM
Alex Zinenko [Wed, 2 Mar 2022 15:56:21 +0000 (16:56 +0100)]
[mlir] Ignore index data layout in translation to LLVM

It can be present, but is irrelevant for the translation.

2 years agoReapply [InstCombine] Remove one-use limitation from X-Y==0 fold
Nikita Popov [Tue, 22 Feb 2022 16:53:14 +0000 (17:53 +0100)]
Reapply [InstCombine] Remove one-use limitation from X-Y==0 fold

This is a recommit without changes. I originally reverted this
due to a significant code-size regression on tramp3d-v4, however
further investigation showed that in the tramp3d-v4 case this
change enables additional optimizations (in particular more
jump threading), which happens to reduce the size of a function
just enough to be eligible for inlining at hot callsites, which
results in the code size increase. As such, this was just bad
luck.

-----

This one-use limitation is artificial, we do not increase
instruction count if we perform the fold with multiple uses. The
motivating case is shown in @sub_eq_zero_select, where the one-use
limitation causes us to miss a subsequent select fold.

I believe the backend is pretty good about reusing flag-producing
subs for cmps with same operands, so I think doing this is fine.

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

2 years ago[DAG] isSplatValue - improve ISD::VECTOR_SHUFFLE splat detection
Simon Pilgrim [Wed, 2 Mar 2022 15:23:33 +0000 (15:23 +0000)]
[DAG] isSplatValue - improve ISD::VECTOR_SHUFFLE splat detection

Currently we only check for splat shuffles, this extends it to see if the source operand is a splat across the demanded elts based upon the shuffle mask

2 years ago[libc++] Explicitly reject URNG types with signed result_types.
Arthur O'Dwyer [Mon, 17 Jan 2022 16:04:01 +0000 (11:04 -0500)]
[libc++] Explicitly reject URNG types with signed result_types.

Fixes #48965.

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

2 years agospeeding up ext-tsp for huge instances
spupyrev [Tue, 1 Mar 2022 23:05:44 +0000 (15:05 -0800)]
speeding up ext-tsp for huge instances

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

2 years ago[mlir] more Bazel changes for 23aa5a744666
Alex Zinenko [Wed, 2 Mar 2022 15:16:14 +0000 (16:16 +0100)]
[mlir] more Bazel changes for 23aa5a744666

2 years ago[NFC] [C++20] [Modules] Simplify ActOnModuleImport by merging Path and Parition
Chuanqi Xu [Wed, 2 Mar 2022 15:06:07 +0000 (23:06 +0800)]
[NFC] [C++20] [Modules] Simplify ActOnModuleImport by merging Path and Parition

Reviewed By: iains

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

2 years agoRevert "[AArch64] Async unwind - function epilogues"
Momchil Velikov [Wed, 2 Mar 2022 14:52:02 +0000 (14:52 +0000)]
Revert "[AArch64] Async unwind - function epilogues"

This reverts commit 74319d67943a4fbef36e81f54273549ce4962f84.

It causes test failures that look like infinite loop in asan/hwasan
unwinding.

2 years ago[LV] Remove dead EntryVal argument from buildScalarSteps (NFC).
Florian Hahn [Wed, 2 Mar 2022 14:59:22 +0000 (14:59 +0000)]
[LV] Remove dead EntryVal argument from buildScalarSteps (NFC).

The EntryVal argument is not needed after recent refactoring. Remove it.

2 years ago[RISCV] Add cost modelling for masked memory op
Alex Tsao [Tue, 25 Jan 2022 16:30:19 +0000 (00:30 +0800)]
[RISCV] Add cost modelling for masked memory op

The patch adds very basic cost model for masked memory op on scalable vector.

Reviewed By: frasercrmck

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

2 years agoRevert "Remove a top-level "using namespace" from TargetTransformInfoImpl.h"
Pavel Labath [Wed, 2 Mar 2022 14:44:22 +0000 (15:44 +0100)]
Revert "Remove a top-level "using namespace" from TargetTransformInfoImpl.h"

Causing failures on many bots.

This reverts commit 31efecfde988a55f70aea97fbc59681f28ef2652.

2 years ago[AArch64] Add some tests for the cost of extending an extract. NFC
David Green [Wed, 2 Mar 2022 14:47:32 +0000 (14:47 +0000)]
[AArch64] Add some tests for the cost of extending an extract. NFC

2 years ago[MLIR][Presburger] Move functionality from IntegerPolyhedron to IntegerRelation
Groverkss [Wed, 2 Mar 2022 14:31:32 +0000 (20:01 +0530)]
[MLIR][Presburger] Move functionality from IntegerPolyhedron to IntegerRelation

This patch moves all functionality from IntegerPolyhedron to IntegerRelation.
IntegerPolyhedron is now implemented as a relation with no domain. All existing
functionality is extended to work on relations.

This patch does not affect external users like FlatAffineConstraints as they
can still continue to use IntegerPolyhedron abstraction.

This patch is part of a series of patches to support relations in Presburger
library.

Reviewed By: arjunp

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

2 years agoRemove a top-level "using namespace" from TargetTransformInfoImpl.h
Pavel Labath [Wed, 2 Mar 2022 14:38:20 +0000 (15:38 +0100)]
Remove a top-level "using namespace" from TargetTransformInfoImpl.h

Move it into the implementation of the function that needs it.

Avoids polluting the namespace of all files including the header.

2 years agoRemove "using namespace llvm" from ReleaseModeModelRunner.h
Pavel Labath [Wed, 2 Mar 2022 14:29:12 +0000 (15:29 +0100)]
Remove "using namespace llvm" from ReleaseModeModelRunner.h

A using directive in a header pollutes the namespace of all files which
include that header. It seems this snuck in in D115764 by moving some
code from a cpp file.

2 years ago[lldb/Platform] Prepare decouple instance and plugin names
Pavel Labath [Mon, 7 Feb 2022 15:21:57 +0000 (16:21 +0100)]
[lldb/Platform] Prepare decouple instance and plugin names

This patch changes the return value of Platform::GetName() to a
StringRef, and uses the opportunity (compile errors) to change some
callsites to use GetPluginName() instead. The two methods still remain
hardwired to return the same thing, but this will change once the ideas
in
<https://discourse.llvm.org/t/multiple-platforms-with-the-same-name/59594>
are implemented.

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

2 years ago[mlir] Add partial support for translating data layout
Alex Zinenko [Tue, 1 Mar 2022 17:21:38 +0000 (18:21 +0100)]
[mlir] Add partial support for translating data layout

Add support for translating data layout specifications for integer and float
types between MLIR and LLVM IR. This is a first step towards removing the
string-based LLVM dialect data layout attribute on modules. The latter is still
available and will remain so until the first-class MLIR modeling can fully
replace it.

Depends On D120739

Reviewed By: wsmoses

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

2 years ago[mlir] Data layout for integer and float types
Alex Zinenko [Tue, 1 Mar 2022 17:21:07 +0000 (18:21 +0100)]
[mlir] Data layout for integer and float types

Add support for integer and float types into the data layout subsystem with
default logic similar to LLVM IR. Given the flexibility of the sybsystem, the
logic can be easily overwritten by operations if necessary. This provides the
connection necessary, e.g., for the GPU target where alignment requirements for
integers and floats differ from those provided by default (although still
compatible with the LLVM IR model). Previously, it was impossible to use
non-default alignment requirements for integer and float types, which could
lead to incorrect address and size calculations when targeting GPUs.

Depends On D120737

Reviewed By: wsmoses

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

2 years ago[mlir] support f80 and f128 in parseOptionalType
Alex Zinenko [Tue, 1 Mar 2022 17:20:32 +0000 (18:20 +0100)]
[mlir] support f80 and f128 in parseOptionalType

This seems to have been forgotten when the types were introduced.

Reviewed By: wsmoses

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

2 years ago[X86] LowerShiftByScalarVariable - remove 32-bit vXi64 bitcast shift amount handling
Simon Pilgrim [Wed, 2 Mar 2022 13:32:18 +0000 (13:32 +0000)]
[X86] LowerShiftByScalarVariable - remove 32-bit vXi64 bitcast shift amount handling

This was handled generically (and better) by D120553

2 years ago[LV] Remove redundant check line from recurrence test.
Florian Hahn [Wed, 2 Mar 2022 13:48:46 +0000 (13:48 +0000)]
[LV] Remove redundant check line from recurrence test.

The removed line matches the previous line, modulo the check prefix.
There is no way to disable sinking instructions as required due to
first-order recurrence and removing the line should be safe.

2 years ago[clang-offload-bundler] Fix typo in a test case
Saiyedul Islam [Wed, 2 Mar 2022 13:31:47 +0000 (13:31 +0000)]
[clang-offload-bundler] Fix typo in a test case

Intermediate file of one of the test was getting overwritten due
to name clash.

2 years ago[InstCombine] Add additional test for phi to switch cond fold (NFC)
Nikita Popov [Wed, 2 Mar 2022 13:32:36 +0000 (14:32 +0100)]
[InstCombine] Add additional test for phi to switch cond fold (NFC)

This test exposes a bug in the edge dominance implementation.

2 years ago[AArch64] Async unwind - function epilogues
Momchil Velikov [Wed, 2 Mar 2022 11:05:40 +0000 (11:05 +0000)]
[AArch64] Async unwind - function epilogues

Counterpart of https://reviews.llvm.org/D111411 this change makes the
unwind information instruction precise in function epilogues.

Reviewed By: MaskRay

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

2 years ago[VE] (masked) load|store v256.32|64 isel
Simon Moll [Wed, 2 Mar 2022 10:06:05 +0000 (11:06 +0100)]
[VE] (masked) load|store v256.32|64 isel

Add `vvp_load|store` nodes. Lower to `vld`, `vst` where possible. Use
`vgt` for masked loads for now.

Reviewed By: kaz7

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

2 years ago[clang][scan-build] Change mode of installation for scan-build.1
Manas [Wed, 2 Mar 2022 12:12:08 +0000 (13:12 +0100)]
[clang][scan-build] Change mode of installation for scan-build.1

Currently, manpage for scan-build is installed as a program, with
permission of 755. This patch makes installation of scan-build.1 as
file, with 644 permission.

Patch by Manas.

Reviewed By: steakhal

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

2 years ago[Flang] NFC: Rearrange conversion patterns in Codegen.cpp
Kiran Chandramohan [Wed, 2 Mar 2022 11:22:07 +0000 (11:22 +0000)]
[Flang] NFC: Rearrange conversion patterns in Codegen.cpp

Minor rearrangment in the order of conversion patterns to identify
differences.

Reviewed By: clementval, schweitz

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

2 years agoRevert "[InstCombine] Support switch in phi to cond fold"
Nikita Popov [Wed, 2 Mar 2022 11:48:54 +0000 (12:48 +0100)]
Revert "[InstCombine] Support switch in phi to cond fold"

This reverts commit 0817ce86b540f909eade6a8d7370e1b47e863a70.

Seeing some ppc64le stage2 failures, reverting to investigate.

2 years ago[Object] Skip section offset checking for /<XFGHASHMAP>/
Pavel Samolysov [Wed, 2 Mar 2022 11:05:46 +0000 (13:05 +0200)]
[Object] Skip section offset checking for /<XFGHASHMAP>/

Starting from Windows SDK for Windows 11 (10.0.22000.x), all the system
libraries (.lib files) contain a section with the '/<XFGHASHMAP>/' name.
This looks like the libraries are built with control flow guard enabled:
https://docs.microsoft.com/en-us/cpp/build/reference/guard-enable-control-flow-guard?view=msvc-170

To let the LLVM tools (llvm-ar, llvm-lib) work with these libraries,
this patch just skips the section offset check for sections with the
'/<XFGHASHMAP>/' name.

Closes: llvm/llvm-project#53814

Signed-off-by: Pavel Samolysov <pavel.samolysov@intel.com>
Reviewed By: jhenderson, thieta

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

2 years ago[DAG] SelectionDAG::isSplatValue - add initial BITCAST handling
Simon Pilgrim [Wed, 2 Mar 2022 11:25:41 +0000 (11:25 +0000)]
[DAG] SelectionDAG::isSplatValue - add initial BITCAST handling

This patch adds support for recognising vector splats by peeking through bitcasts to vectors with smaller element types - if all the offset subelements are splats then the bitcasted vector is a splat as well.

We don't have great coverage for isSplatValue so I've made this pretty specific to the use case I'm trying to fix - regressions in some vXi64 vector shift by splat cases that 32-bit x86 doesn't recognise because the shift amount buildvector has been type legalised to v2Xi32.

We can add further support (floats, bitcast from larger element types, undef elements) when we have actual test coverage.

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

2 years ago[InstCombine] Support switch in phi to cond fold
Nikita Popov [Wed, 2 Mar 2022 09:54:57 +0000 (10:54 +0100)]
[InstCombine] Support switch in phi to cond fold

For conditional branches, we know the value is i1 0 or i1 1 along
the outgoing edges. For switches we can apply exactly the same
optimization, just with the known values determined by the switch
cases.

2 years ago[AMDGPU] Make more use of madmk/fmamk instructions
Jay Foad [Tue, 1 Mar 2022 16:07:43 +0000 (16:07 +0000)]
[AMDGPU] Make more use of madmk/fmamk instructions

In convertToThreeAddress handle VOP2 mac/fmac instructions with a
literal src0 operand, since these are prime candidates for
converting to madmk/fmamk.

Previously this would only happen if src0 (or src1) was a register
defined by a move-immediate instruction, but in many cases these
operands have already been folded because SIFoldOperands runs
before TwoAddressInstructionPass.

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

2 years ago[NFC][Lexer] Remove getLangOpts function from Lexer
Dawid Jurczak [Tue, 1 Mar 2022 16:24:13 +0000 (17:24 +0100)]
[NFC][Lexer] Remove getLangOpts function from Lexer

Given that there is only one external user of Lexer::getLangOpts
we can remove getter entirely without much pain.

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

2 years ago[LV] Modernize test matching hardcoded induction phi name.
Florian Hahn [Wed, 2 Mar 2022 10:12:38 +0000 (10:12 +0000)]
[LV] Modernize test matching hardcoded induction phi name.

2 years ago[InstCombine] Add tests for phi to cond with switch (NFC)
Nikita Popov [Wed, 2 Mar 2022 10:05:40 +0000 (11:05 +0100)]
[InstCombine] Add tests for phi to cond with switch (NFC)

Currently we only handle br but not switch in this fold.

2 years ago[pseudo] fix some comment nits, NFC.
Haojian Wu [Wed, 2 Mar 2022 09:18:25 +0000 (10:18 +0100)]
[pseudo] fix some comment nits, NFC.

2 years ago[VP] vp.sitofp cast intrinsic and docs
Simon Moll [Wed, 2 Mar 2022 09:16:07 +0000 (10:16 +0100)]
[VP] vp.sitofp cast intrinsic and docs

Reviewed By: frasercrmck

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

2 years ago[VP] Fix vp.fptosi LangRef example
Simon Moll [Wed, 2 Mar 2022 09:15:22 +0000 (10:15 +0100)]
[VP] Fix vp.fptosi LangRef example

Reviewed By: frasercrmck

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

2 years ago[pseudo] Add a print-grammar option in the tool
Haojian Wu [Tue, 1 Mar 2022 14:57:13 +0000 (15:57 +0100)]
[pseudo] Add a print-grammar option in the tool

This is helpful for debugging purposes.

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

2 years ago[gn build] Port ae60884dfe16
LLVM GN Syncbot [Wed, 2 Mar 2022 08:58:54 +0000 (08:58 +0000)]
[gn build] Port ae60884dfe16

2 years ago[clang][dataflow] Add flow condition constraints to Environment
Stanislav Gatev [Tue, 1 Mar 2022 11:19:00 +0000 (11:19 +0000)]
[clang][dataflow] Add flow condition constraints to Environment

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D120711

2 years ago[pseudo] Fix an out-of-bound error in LRTable::find.
Haojian Wu [Tue, 1 Mar 2022 14:49:21 +0000 (15:49 +0100)]
[pseudo] Fix an out-of-bound error in LRTable::find.

The linear scan should not escape the TargetedStates range.

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

2 years ago[Object] [COFF] Improve error messages
Martin Storsjö [Mon, 28 Feb 2022 10:25:22 +0000 (12:25 +0200)]
[Object] [COFF] Improve error messages

This aids debugging when working with possibly broken files,
instead of just flat out erroring out without telling what's wrong.

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

2 years ago[libcxx] [test] Make filesystem tests not rely on libc++ internals
Martin Storsjö [Tue, 1 Mar 2022 20:41:49 +0000 (22:41 +0200)]
[libcxx] [test] Make filesystem tests not rely on libc++ internals

As part of https://reviews.llvm.org/D119036
(506cf6dc048835c598b654e43ed8f723a42e39ba), `-DNOMINMAX` was
dropped from the Windows CI configurations, replaced with a
block with `_LIBCPP_PUSH_MACROS`, `#include <__undef_macros>`
and `_LIBCPP_POP_MACROS` (and
`ADDITIONAL_COMPILE_FLAGS: -DNOMINMAX` left in two tests).

However, this workaround breaks the running the libc++ tests
against a different C++ standard library than libc++, as those
macros and that header are libc++ internals.

Therefore, reinstate `-DNOMINMAX` for clang-cl configurations
and remove the libc++ specific bits in filesystem_test_helper.h.

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