platform/upstream/llvm.git
23 months ago[NFC] Fix typo in comment
Louis Dionne [Tue, 20 Sep 2022 21:22:00 +0000 (17:22 -0400)]
[NFC] Fix typo in comment

23 months ago[flang] Add semantics test for atomic_add subroutine
Naje George [Tue, 9 Aug 2022 00:07:42 +0000 (17:07 -0700)]
[flang] Add semantics test for atomic_add subroutine

Reviewed By: ktras

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

23 months ago[HLSL] remove unnecessary abs attributes
Joshua Batista [Tue, 20 Sep 2022 21:04:08 +0000 (16:04 -0500)]
[HLSL] remove unnecessary abs attributes

remove abs non-elementwise attribute statements, stick to elementwise.

Reviewed By: beanz

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

23 months ago[GISel] TreeMatcher: always skip leaves if they don't care
Kai Nacke [Mon, 19 Sep 2022 16:03:32 +0000 (16:03 +0000)]
[GISel] TreeMatcher: always skip leaves if they don't care

In `GIMatchTreeOpcodePartitioner::applyForPartition()`, the loop over
the possible leaves skip a leaf if the instruction does not care
about the instruction.
When processing the referenced operands in the next loop the same
leaves need to be skipped.

Later, when these leaves are added to all partitions, the bit vector
must be resized first before the bit representing the leaf is set.

This fixes a crash in llvm-tblgen.

Reviewed By: arsenm

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

23 months agoAtomicExpand: Use correct pointer size for integer
Matt Arsenault [Tue, 20 Sep 2022 18:58:52 +0000 (14:58 -0400)]
AtomicExpand: Use correct pointer size for integer

This was using the default address space.

23 months agoAMDGPU: Add baseline test for expansion of 16-bit local atomics
Matt Arsenault [Tue, 20 Sep 2022 18:51:33 +0000 (14:51 -0400)]
AMDGPU: Add baseline test for expansion of 16-bit local atomics

The expansion is currently using the wrong pointer size.

23 months agoAtomicExpand: Switch test to generated checks
Matt Arsenault [Tue, 20 Sep 2022 20:03:13 +0000 (16:03 -0400)]
AtomicExpand: Switch test to generated checks

23 months agoVE: Use generated checks for a copy-pasted output test
Matt Arsenault [Tue, 20 Sep 2022 20:32:08 +0000 (16:32 -0400)]
VE: Use generated checks for a copy-pasted output test

23 months ago[clangd] Return earlier when snippet is empty
Tom Praschan [Sun, 18 Sep 2022 16:48:11 +0000 (18:48 +0200)]
[clangd] Return earlier when snippet is empty

Fixes github.com/clangd/clangd/issues/1216

If the Snippet string is empty, Snippet.front() would trigger a crash.
Move the Snippet->empty() check up a few lines to avoid this. Should not
break any existing behavior.

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

23 months ago[HLSL] add sqrt library function
Joshua Batista [Tue, 20 Sep 2022 19:46:06 +0000 (14:46 -0500)]
[HLSL] add sqrt library function

This change exposes the sqrt library function for HLSL scalar types,
excluding long and long long doubles. Sqrt is supported for all scalar, vector,
and matrix types. This patch only adds a subset of scalar type support.

Long and long long double support is missing in this patch because that type
doesn't exist in HLSL.

The full documentation of the HLSL asin function is available here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-sqrt

Reviewed By: beanz

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

23 months ago[LLDB][NativePDB] Pass register_kind as reference (an oversight in 71d778f).
Zequan Wu [Tue, 20 Sep 2022 20:38:18 +0000 (13:38 -0700)]
[LLDB][NativePDB] Pass register_kind as reference (an oversight in 71d778f).

Fix #57799

23 months ago[NFC][AMDGPU] Refactor AMDGPUDisassembler
Scott Linder [Tue, 20 Sep 2022 20:05:19 +0000 (20:05 +0000)]
[NFC][AMDGPU] Refactor AMDGPUDisassembler

Clean up ahead of a patch to fix bugs in the AMDGPUDisassembler.

Use lit.local.cfg substitutions and more idiomatic use of split-file to
simplify and extend existing kernel-descriptor disassembly tests.

Add a comment to AMDHSAKernelDescriptor.h, as at least one small set
towards keeping all kernel-descriptor sensitive code in sync.

Reviewed By: kzhuravl, arsenm

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

23 months ago[RISCV] Support -mno-implicit-float.
Craig Topper [Tue, 20 Sep 2022 19:13:01 +0000 (12:13 -0700)]
[RISCV] Support -mno-implicit-float.

This can be used to disable vectorization and memcpy/memset
expansion for things like OS kernels. It also disables implicit
uses of scalar FP, but I don't know if we have any of those for
RISC-V.

NOTE: Without this patch you can still do -Xclang -no-implicit-float

Reviewed By: rui.zhang

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

23 months ago[AMDGPU] Fix size of SOPK instructions to 4 bytes
Anshil Gandhi [Tue, 20 Sep 2022 20:23:46 +0000 (14:23 -0600)]
[AMDGPU] Fix size of SOPK instructions to 4 bytes

Instructions in SOPK format may not have 32-bit
literal constants following the instruction.

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

23 months ago[InstCombine] Handle integer extension in `select` patterns using the condition as...
Markus Böck [Tue, 20 Sep 2022 20:12:10 +0000 (22:12 +0200)]
[InstCombine] Handle integer extension in `select` patterns using the condition as value

These patterns were previously only implemented for i1 type but can be extended for any integer type by also handling zext and sext operands.

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

23 months ago[clangd] Remove second tracer (which breaks threading contract)
Sam McCall [Tue, 20 Sep 2022 20:17:02 +0000 (22:17 +0200)]
[clangd] Remove second tracer (which breaks threading contract)

23 months ago[mlir][standalone] Specify python path when configuring
rkayaith [Tue, 20 Sep 2022 02:14:45 +0000 (22:14 -0400)]
[mlir][standalone] Specify python path when configuring

Specifying the python path here ensures that the python binary used matches the
one used by the main MLIR tests. This is useful when cmake's automatic detection
has to be overridden.

Reviewed By: stellaraccident, bondhugula

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

23 months ago[MLIR] Update bazel build files after 242d558658cd5a480b02883e2982d7246342e0d0
Frederik Gossen [Tue, 20 Sep 2022 19:11:12 +0000 (15:11 -0400)]
[MLIR] Update bazel build files after 242d558658cd5a480b02883e2982d7246342e0d0

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

23 months ago[LLDB]Initialize accept_socket with nullptr
George Hu [Tue, 20 Sep 2022 17:56:16 +0000 (10:56 -0700)]
[LLDB]Initialize accept_socket with nullptr

Fix high impact issue of illegal access of memory.
Initialize accept_socket with nullptr.

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

23 months ago[clang-format] Wrap inserted braces only if preceded by comments
owenca [Mon, 19 Sep 2022 22:28:18 +0000 (15:28 -0700)]
[clang-format] Wrap inserted braces only if preceded by comments

Fixes #57805.

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

23 months ago[InstCombine] Matrix multiplication negation optimisation
Zain Jaffal [Tue, 20 Sep 2022 18:45:02 +0000 (19:45 +0100)]
[InstCombine] Matrix multiplication negation optimisation

If one of the operands in a matrix multiplication is negated we can optimise the equation by moving the negation to the smallest element of the operands or the result.

Reviewed By: spatel, fhahn

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

23 months agoAMDGPU: Fix expansion of 16-bit atomicrmw
Matt Arsenault [Mon, 19 Sep 2022 21:50:36 +0000 (17:50 -0400)]
AMDGPU: Fix expansion of 16-bit atomicrmw

Fixes issue 57830

23 months agoAdd explicit tests for the PS4/PS5 C/C++ standards version defaults.
Douglas Yung [Tue, 20 Sep 2022 18:23:47 +0000 (11:23 -0700)]
Add explicit tests for the PS4/PS5 C/C++ standards version defaults.

23 months ago[Driver] Make --execute-only the default for aarch64-fuchsia
Alex Brachet [Tue, 20 Sep 2022 18:25:16 +0000 (18:25 +0000)]
[Driver] Make --execute-only the default for aarch64-fuchsia

Clang already generates code that doesn't use writeable data in executable
sections so the linker flag is all that is necessary.

-Wl,--no-execute-only can be used to turn this default off.

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

23 months ago[flang] Write semantics test for atomic_or
Katherine Rasmussen [Mon, 19 Sep 2022 17:53:10 +0000 (10:53 -0700)]
[flang] Write semantics test for atomic_or

Write a semantics test for the atomic intrinsic subroutine,
atomic_or.

Reviewed By: rouson

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

23 months ago[ELF] Name ctx->objectFiles[0] in the EF_RISCV_FLOAT_ABI mismatch error
Fangrui Song [Tue, 20 Sep 2022 18:14:04 +0000 (11:14 -0700)]
[ELF] Name ctx->objectFiles[0] in the EF_RISCV_FLOAT_ABI mismatch error

Reviewed By: compnerd

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

23 months ago[mlir][scf] Support simple symbolic expression without depending on AffineDialect...
Peiming Liu [Tue, 20 Sep 2022 17:50:34 +0000 (17:50 +0000)]
[mlir][scf] Support simple symbolic expression without depending on AffineDialect to simply trivial loops.

Remove dependence of AffineDialect

Reviewed By: mehdi_amini

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

23 months ago[mlir][ods] Allow empty array ref parameter
Jeff Niu [Wed, 14 Sep 2022 00:19:19 +0000 (17:19 -0700)]
[mlir][ods] Allow empty array ref parameter

This patch "fixes" a longstanding issue where the assembly format for
ArrayRefParameter could not handle an empty list. This is because there
was no way to generically optionally parse the first element of the
array. The only solution was to write a (relatively simple) custom parser.

This patch implements "empty" ArrayRefParameters by using
inverted optional groups and an optional ArrayRefParameter.

Depends on D133816

Reviewed By: rriddle

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

23 months ago[mlir][ods] Generalize default/optional parameters
Jeff Niu [Tue, 13 Sep 2022 23:16:20 +0000 (16:16 -0700)]
[mlir][ods] Generalize default/optional parameters

This patch consolidates the notions of an optional parameter and a
default parameter. An optional parameter is a parameter equal to its
default value, which for a "purely optional" parameter is its "null"
value.

This allows the existing `comparator` and `defaultValue` fields to be
used enabled more complex "optional" parameters, such as empty arrays.

Depends on D133812

Reviewed By: rriddle

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

23 months ago[mlir][ods] Format: allow anchors in the else elements
Jeff Niu [Tue, 13 Sep 2022 22:08:39 +0000 (15:08 -0700)]
[mlir][ods] Format: allow anchors in the else elements

This patch changes optional groups to allow anchors in the 'else'
element group. When printing, the optional condition is inverted to
decide which group to print. This is useful for parsing concrete
optional elements that don't have a `parseOptional*` method or some
other way to test whether it's present.

Depends on D133805

Reviewed By: rriddle

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

23 months ago[mlir][ods] Store the pointer to the anchor element (NFC)
Jeff Niu [Tue, 13 Sep 2022 20:15:06 +0000 (13:15 -0700)]
[mlir][ods] Store the pointer to the anchor element (NFC)

Instead of its index. There is no benefit to storing the index instead
of the pointer.

Reviewed By: rriddle

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

23 months ago[clang-doc] Centralize TypeInfo creation.
Brett Wilson [Tue, 20 Sep 2022 17:54:28 +0000 (17:54 +0000)]
[clang-doc] Centralize TypeInfo creation.

Several different places in the code had similar computations for the parameters that were eventually passed to the TypeInfo constructor.

This centralizes that code in one function, and allows passing TypeInfo to the various other *Info structures that need it.

Remove some "auto" types and replace with the real type for getting declarations. This was making some duplicate checking difficult to see.

Reviewed By: paulkirth

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

23 months ago[NFCI] Clean up enum FormatCategoryItem.
Jorge Gorbe Moya [Mon, 19 Sep 2022 23:35:24 +0000 (16:35 -0700)]
[NFCI] Clean up enum FormatCategoryItem.

- Merge pairs like `eFormatCategoryItemSummary` and
  `eFormatCategoryItemRegexSummary` into a single value. See explanation
  below.

- Rename `eFormatCategoryItemValue` to `eFormatCategoryItemFormat`. This
  makes the enum match the names used elsewhere for formatter kinds
  (format, summary, filter, synth).

- Delete unused values `eFormatCategoryItemValidator` and
  `eFormatCategoryItemRegexValidator`.

This enum is only used to reuse some code in CommandObjectType.cpp.  For
example, instead of having separate implementations for `type summary
delete`, `type format delete`, and so on, there's a single generic
implementation that takes an enum value, and then the specific commands
derive from it and set the right flags for the specific kind of
formatter.

Even though the enum distinguishes between regular and regex matches for
every kind of formatter, this distinction is never used: enum values are
always specified in pairs like
`eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary`.

This causes some ugly code duplication in TypeCategory.cpp. In order to
handle every flag combination some code appears 8 times:

{format, summary, synth, filter} x {exact, regex}

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

23 months ago[NFC][RISCV] Move calculations of SDNode policy operand idx to a separate function
Anton Sidorenko [Tue, 20 Sep 2022 17:22:16 +0000 (10:22 -0700)]
[NFC][RISCV] Move calculations of SDNode policy operand idx to a separate function

Since there is no guaranteed correspondence of SDNode and MI operands, we need
getters simular to RISCVII::get*OpNum for SDNodes.

More uses of getVecPolicyOpIdx will be added in D130895.

Reviewed By: craig.topper, arcbbb

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

23 months ago[RISCV][MC] Add support for experimental Zawrs extension
Philip Reames [Tue, 20 Sep 2022 17:01:37 +0000 (10:01 -0700)]
[RISCV][MC] Add support for experimental Zawrs extension

This implements experimental support for the Zawrs extension as specified here: https://github.com/riscv/riscv-zawrs/releases/download/V1.0-rc3/Zawrs.pdf. Despite the 1.0 version name, this has not been ratified and there was a major change to proposed specification between rc2 and rc3.  Once this is ratified, it'll move out of experimental status.

This change adds assembly support, but does not include C language or IR intrinsics. We can decide if we want them, and handle that in a separate patch.

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

23 months ago[gn build] Port 00798e500644
LLVM GN Syncbot [Tue, 20 Sep 2022 17:07:57 +0000 (17:07 +0000)]
[gn build] Port 00798e500644

23 months ago[AArch64] Define __ARM_FEATURE_RCPC
Mingming Liu [Tue, 14 Jun 2022 21:04:49 +0000 (14:04 -0700)]
[AArch64] Define __ARM_FEATURE_RCPC

This patch implements the definition of __ARM_FEATURE_RCPC when clang
command specifies +rcpc.

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

23 months ago[libc++] Applies P0602R4 retro-actively.
Mark de Wever [Mon, 5 Sep 2022 17:01:50 +0000 (19:01 +0200)]
[libc++] Applies P0602R4 retro-actively.

While testing a test failure of C++17 with Clang ToT it was noticed the
paper
  P0602R4 variant and optional should propagate copy/move triviality
was not applied as a DR in libc++.

This was discovered while investigating the issue "caused by" D131479.

Reviewed By: #libc, ldionne

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

23 months ago[InstrProfiling] Emit runtime hook only once
Gulfem Savrun Yeniceri [Fri, 16 Sep 2022 18:19:06 +0000 (18:19 +0000)]
[InstrProfiling] Emit runtime hook only once

This patch fixes the issue about calling emitRuntimeHook() twice
when we need to unconditionally emit runtime hook as discussed in
https://reviews.llvm.org/rGd6aed77f0d19.

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

23 months ago[NFC][libc++][format] Uses ranges algorithm.
Mark de Wever [Fri, 16 Sep 2022 18:47:01 +0000 (20:47 +0200)]
[NFC][libc++][format] Uses ranges algorithm.

Reviewed By: #libc, ldionne

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

23 months ago[libc++][test] Adds format string helper.
Mark de Wever [Thu, 5 May 2022 06:03:58 +0000 (08:03 +0200)]
[libc++][test] Adds format string helper.

Update the formatter day tests to the new style.
Other test will be done separately.

Reviewed By: #libc, ldionne

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

23 months ago[libc++][chrono] Removes format include.
Mark de Wever [Tue, 13 Sep 2022 18:10:26 +0000 (20:10 +0200)]
[libc++][chrono] Removes format include.

Switch to the new granular format_functions header. Since the chrono's
format dependency in C++20 hasn't been in a release it's save to remove
it.

Depends on D133665

Reviewed By: #libc, ldionne

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

23 months ago[libc++][format] Granularizes the format header.
Mark de Wever [Sun, 11 Sep 2022 11:05:26 +0000 (13:05 +0200)]
[libc++][format] Granularizes the format header.

Moves the last pieces of code to its own header.

Reviewed By: ldionne, #libc

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

23 months ago[AMDGPU] Disable fp atomic to s_denorm_mode hazard for GFX11
Jay Foad [Tue, 20 Sep 2022 12:29:39 +0000 (13:29 +0100)]
[AMDGPU] Disable fp atomic to s_denorm_mode hazard for GFX11

This hazard only exists on GFX10.

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

23 months agoFix __builtin_assume_aligned incorrect type descriptor and C++ object polymorphic...
yronglin [Tue, 20 Sep 2022 16:35:18 +0000 (12:35 -0400)]
Fix __builtin_assume_aligned incorrect type descriptor and C++ object polymorphic address

Fix __builtin_assume_aligned incorrect type descriptor

example from @rsmith

struct A { int n; };
struct B { int n; };
struct C : A, B {};

void *f(C *c) {
  // Incorrectly returns `c` rather than the address of the B base class.
  return __builtin_assume_aligned((B*)c, 8);
}

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

23 months ago[IPO] Reorder parameters of InlineFunction (NFC)
Kazu Hirata [Tue, 20 Sep 2022 16:09:38 +0000 (09:09 -0700)]
[IPO] Reorder parameters of InlineFunction (NFC)

With the recent addition of new parameter MergeAttributes (D134117),
callers need to specify several default parameters before getting to
specify the new parameter.

This patch reorders the parameters so that callers do not have to
specify as many default parameters.

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

23 months ago[AArch64] Enable LSLFast for modern OoO cpus
David Green [Tue, 20 Sep 2022 16:09:14 +0000 (17:09 +0100)]
[AArch64] Enable LSLFast for modern OoO cpus

This patch enables the LSLFast feature for Cortex-A76, Cortex-A77,
Cortex-A78, Cortex-A78C, Cortex-A710, Cortex-X1, Cortex-X2, Neoverse N1,
Neoverse N2, Neoverse V1 and the Neoverse 512TB pseudo-cpu, in-line with
the software optimization guides for those CPUs.

Differntial revision: https://reviews.llvm.org/D134273

23 months ago[HLSL] Pass flags to cc1 based on language
Chris Bieneman [Tue, 20 Sep 2022 15:41:43 +0000 (10:41 -0500)]
[HLSL] Pass flags to cc1 based on language

Having the flags only pass through if you're using the dxc-driver means
that the clang driver doesn't work for HLSL, which is undesirable. This
change switches to instead passing flags based on the language mode
similar to how OpenCL does it. This allows the clang driver to be used
for HLSL source files as well.

Reviewed By: python3kgae

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

23 months agoRevert "[Utils] Refactor update_cc_test_checks.py to use shutil"
Ben Dunbobbin [Tue, 20 Sep 2022 15:50:18 +0000 (16:50 +0100)]
Revert "[Utils] Refactor update_cc_test_checks.py to use shutil"

This reverts commit 2e6c50855b7d879ded3776ba87b3d960e2035b89.

This caused failures on windows bots:
- https://lab.llvm.org/buildbot/#/builders/216/builds/10030
- https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-windows-x64/b8802513693562827489/overview

23 months ago[InstCombine] Fold ult(add(x,-1),c) -> ule(x,c) iff x != 0 (PR57635)
Simon Pilgrim [Tue, 20 Sep 2022 15:44:26 +0000 (16:44 +0100)]
[InstCombine] Fold ult(add(x,-1),c) -> ule(x,c) iff x != 0 (PR57635)

Alive2: https://alive2.llvm.org/ce/z/sZ6wwS

As detailed on Issue #57635 and #37628 - for unsigned comparisons, we can compare prior to a decrement iff the value is known never to be zero.

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

23 months ago[CMake] [NFC] Add clang headers to IDE projects
Chris Bieneman [Mon, 19 Sep 2022 15:22:33 +0000 (10:22 -0500)]
[CMake] [NFC] Add clang headers to IDE projects

This just adds the clang headers into a source group so that they get
collected and added into generated IDE projects.

23 months ago[GlobalISel][Legalizer] Fix lowerSelect() not sign-extending the mask value.
Amara Emerson [Mon, 19 Sep 2022 23:21:55 +0000 (00:21 +0100)]
[GlobalISel][Legalizer] Fix lowerSelect() not sign-extending the mask value.

I'm not sure why the SEXT_INREG was gated on a bitwidth check of the mask
vs element size.

This fixes a miscompile in chromium's skia library.

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

23 months ago[mlir][arith] Add comparison-based integration tests
Jakub Kuderski [Tue, 20 Sep 2022 15:37:26 +0000 (11:37 -0400)]
[mlir][arith] Add comparison-based integration tests

Introduces a simple framework for runtime tests of the wide integer emulation.

In these tests, we are only interested in checking that both wide and narrow calculation
produce the same results, and do not check for exact results. This allows us to cover
more of the input space, as we do not have to hardcode each of the expected outputs.

Introduce common helper functions to check the results, print a message on mismatch,
and sample the input space.

Implement runtime comparrison tests for `arith.muli` and `arith.shrui`.

Reviewed By: antiagainst

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

23 months ago[mlir][arith] Add integration test for shrui emulation
Jakub Kuderski [Tue, 20 Sep 2022 15:27:48 +0000 (11:27 -0400)]
[mlir][arith] Add integration test for shrui emulation

The new test cases focus on known edge cases in the current implementation.
Specifically, we check for low (0, 1), mid (7, 8, 9) and high (15) shift amounts with i16 operands.

Reviewed By: antiagainst

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

23 months ago[mlir][arith] Add test pass for wide integer emulation
Jakub Kuderski [Tue, 20 Sep 2022 15:03:37 +0000 (11:03 -0400)]
[mlir][arith] Add test pass for wide integer emulation

The new test pass allows for running wide integer emulation conversion
within specified functions only.

I intend to use it in integration tests in a way that allows me print both
original and emulated results in the same format, or even compare both results
at runtime and print on mismatch only.

Reviewed By: antiagainst

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

23 months ago[llvm] Remove libcxx, libcxxabi and libunwind from supported LLVM_ENABLE_PROJECTS
Louis Dionne [Tue, 23 Aug 2022 15:22:55 +0000 (11:22 -0400)]
[llvm] Remove libcxx, libcxxabi and libunwind from supported LLVM_ENABLE_PROJECTS

This is a breaking change. If you were passing one of those three runtimes
in LLVM_ENABLE_PROJECTS, you need to start passing them in LLVM_ENABLE_RUNTIMES
instead. The runtimes in LLVM_ENABLE_RUNTIMES will start being built using
the "bootstrapping build" instead, which means that they will be built
using the just-built Clang. This is usually what you wanted anyway.

If you were using LLVM_ENABLE_PROJECTS=all with the explicit goal of
building these three runtimes, you can now use LLVM_ENABLE_RUNTIMES=all
and these runtimes will be built using the bootstrapping build.

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

23 months ago[Support][NFC] Clarify function comment
Eric Li [Tue, 20 Sep 2022 15:10:16 +0000 (11:10 -0400)]
[Support][NFC] Clarify function comment

Follow-up to 86118ec2 that addresses the comments in D134072, which
were accidentally left off of the commit.

23 months ago[Support] Provide access to the full mapping in llvm::Annotations
Eric Li [Fri, 16 Sep 2022 20:07:26 +0000 (16:07 -0400)]
[Support] Provide access to the full mapping in llvm::Annotations

Providing access to the mapping of annotations allows test helpers to
be expressive by using the annotations as expectations. For example, a
matcher could verify that all annotated points were matched by a
matcher, or that an refactoring surgically modifies specific ranges.

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

23 months ago[AMDGPU][GFX11] Use VGPR_32_Lo128 for VOP1,2,C
Joe Nash [Wed, 13 Jul 2022 18:14:48 +0000 (14:14 -0400)]
[AMDGPU][GFX11] Use VGPR_32_Lo128 for VOP1,2,C

    Due to the encoding changes in GFX11, we had a hack in place that
    disables the use of VGPRs above 128. This patch removes the need for
    that hack.

    We introduce a new register class VGPR_32_Lo128 which is used for 16-bit
    operands of VOP1, VOP2, and VOPC instructions. This register class only has the
    low 128 VGPRs, but is otherwise identical to VGPR_32. Therefore, 16-bit VOP1,
    VOP2, and VOPC instructions are correctly limited to use the first 128
    VGPRs, while the other instructions can freely use all 256.

    We introduce new pseduo-instructions used on GFX11 which have the suffix
    t16 (True 16) to use the VGPR_32_Lo128 register class.

Reviewed By: foad, rampitec, #amdgpu

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

23 months ago[libc] Fix TWS issues in .td files
Jeff Bailey [Tue, 20 Sep 2022 14:25:16 +0000 (14:25 +0000)]
[libc] Fix TWS issues in .td files

Reviewed By: sivachandra

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

23 months ago[libc] Remove unneeded extra include
Jeff Bailey [Tue, 20 Sep 2022 14:24:21 +0000 (14:24 +0000)]
[libc] Remove unneeded extra include

Reviewed By: sivachandra

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

23 months ago[LV] Remove unused widenCallInstruction declaration (NFC).
Florian Hahn [Tue, 20 Sep 2022 14:20:27 +0000 (15:20 +0100)]
[LV] Remove unused widenCallInstruction declaration (NFC).

The definition and uses have been removed a while ago. Clean up the
unused declaration.

23 months ago[lld-macho] Support -dyld_env
Vy Nguyen [Fri, 16 Sep 2022 17:38:20 +0000 (13:38 -0400)]
[lld-macho] Support -dyld_env

This arg is undocumented but from looking at the code + experiment, it's used to add additional DYLD_ENVIRONMENT load commands to the output.

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

23 months agoAnalysis: Remove redundant assertion
Matt Arsenault [Tue, 20 Sep 2022 13:26:32 +0000 (09:26 -0400)]
Analysis: Remove redundant assertion

This assert guards the same assertion inside getTypeStoreSizeInBits

23 months agoAnalysis: Pass AssumptionCache through isKnownNonZero
Matt Arsenault [Tue, 20 Sep 2022 12:53:25 +0000 (08:53 -0400)]
Analysis: Pass AssumptionCache through isKnownNonZero

Pass this through now that isDereferenceableAndAlignedPointer has
access to this.

23 months agoFix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.
Simon Pilgrim [Tue, 20 Sep 2022 13:23:59 +0000 (14:23 +0100)]
Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.

23 months ago[InstCombine] Precommit test for D134142
Markus Böck [Tue, 20 Sep 2022 12:37:05 +0000 (14:37 +0200)]
[InstCombine] Precommit test for D134142

23 months ago[InstCombine] Add test coverage for D134172 / Issue #57635
Simon Pilgrim [Tue, 20 Sep 2022 12:36:09 +0000 (13:36 +0100)]
[InstCombine] Add test coverage for D134172 / Issue #57635

23 months ago[LLVM][AArch64] Replace aarch64.sve.ld by aarch64.sve.ldN.sret
Caroline Concatto [Tue, 30 Aug 2022 10:17:08 +0000 (11:17 +0100)]
[LLVM][AArch64] Replace aarch64.sve.ld by aarch64.sve.ldN.sret

This patch removes the intrinsic aarch64.sve.ldN from tablegen in favour of
using arch64.sve.ldN.sret.

Depends on: D133023

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

23 months ago[LoongArch] Add codegen support for fmaxnum_ieee and fminnum_ieee
gonglingqin [Tue, 20 Sep 2022 11:05:08 +0000 (19:05 +0800)]
[LoongArch] Add codegen support for fmaxnum_ieee and fminnum_ieee

Thanks for @xry111's previous bug fixes.
See https://github.com/loongson/llvm-project/pull/1 for more details.

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

23 months agoRecommit "[AggressiveInstCombine] Lower Table Based CTTZ
Djordje Todorovic [Tue, 13 Sep 2022 13:13:58 +0000 (15:13 +0200)]
Recommit "[AggressiveInstCombine] Lower Table Based CTTZ

The bug reported on the [0] has been fixed.
The issue was we have not checked if the global variables that
represent cttz tables was constant.
There is a new negative test added in negative-lower-table-based-cttz.ll
that represents this.

[0] https://reviews.llvm.org/rGdf868edee561eb973edd85ec9df41c67aa0bff6b

23 months ago[LICM] Add test for PR57780 (NFC)
Nikita Popov [Tue, 20 Sep 2022 11:06:35 +0000 (13:06 +0200)]
[LICM] Add test for PR57780 (NFC)

23 months ago[Sanitizer] Bump macOS deployment target for sanitizer unit test binary to support...
Blue Gaston [Fri, 16 Sep 2022 22:49:44 +0000 (15:49 -0700)]
[Sanitizer] Bump macOS deployment target for sanitizer unit test binary to support C++17 requirements.

This patch fixes a test failure on Apple caused by changing standard to c++17.
sanitizer_allocator_test.cpp requires language features introducied in 10.13 for c++17.
After initial investigation, it was not clear how to add this flag to a single file:
https://reviews.llvm.org/D133878

Becuase of this, we have upped the min version of this test suite to 10.13, the min version necessary to support necessary language features.

We felt this was a better option than upping the min version of the product to support a single test.
We are raising deployment target for a single test suite, rather than the product.

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

rdar://98737270

23 months agoAAArch64: disable asynchronous unwind by default for MachO.
Tim Northover [Fri, 9 Sep 2022 09:46:23 +0000 (10:46 +0100)]
AAArch64: disable asynchronous unwind by default for MachO.

AArch64 MachO has a compact unwind format where most functions' unwind info can
be represented in just 4 bytes. But this cannot represent any asynchronous CFI
function, so it's essentially disabled when that's used. This is a large
code-size hit that we'd rather not take unless explicitly requested.

23 months agoRefactor unwind table driver interface to expose default level. NFC.
Tim Northover [Fri, 9 Sep 2022 09:01:02 +0000 (10:01 +0100)]
Refactor unwind table driver interface to expose default level. NFC.

23 months ago[LLD] [test] Add a missing REQUIRES: x86
Martin Storsjö [Tue, 20 Sep 2022 09:38:37 +0000 (12:38 +0300)]
[LLD] [test] Add a missing REQUIRES: x86

This was missed in 365d0a5cd867cdf414b70c9f4fd5122146287b01.

23 months agoFix MSVC "result of 32-bit shift implicitly converted to 64 bits" warnings. NFCI.
Simon Pilgrim [Tue, 20 Sep 2022 09:33:29 +0000 (10:33 +0100)]
Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warnings. NFCI.

23 months agoFix an unused warning in release build
Dmitri Gribenko [Tue, 20 Sep 2022 09:28:20 +0000 (11:28 +0200)]
Fix an unused warning in release build

23 months ago[lldb] Log when we cannot find an equivalent for a gdb register type
David Spickett [Thu, 12 May 2022 15:38:43 +0000 (15:38 +0000)]
[lldb] Log when we cannot find an equivalent for a gdb register type

This happens if the type is described elsewhere in target xml as a
<flags> or <struct>.

Also hardcode the function names into the log messages because
if you use __FUNCTION__ in a lambda you just get "operator()".

Reviewed By: clayborg

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

23 months ago[LLDB] Make instruction emulation context type private
David Spickett [Mon, 1 Aug 2022 10:17:02 +0000 (10:17 +0000)]
[LLDB] Make instruction emulation context type private

This is the first step to being able to handle non
trivial types in the union.

info_type effects the lifetime of the objects in the union,
so making it private means we know you have to call one of the
Set<...> functions to change it.

Reviewed By: clayborg

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

23 months ago[clang] Update ReleaseNotes about a crash fix (Issue 53628)
Dmitry Polukhin [Sat, 17 Sep 2022 15:30:30 +0000 (08:30 -0700)]
[clang] Update ReleaseNotes about a crash fix (Issue 53628)

Update ReleaseNotes about a crash fix (Issue 53628)

Test Plan: none

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

23 months ago[LLDB] Format lldb-server's target XML
David Spickett [Wed, 17 Aug 2022 13:58:28 +0000 (13:58 +0000)]
[LLDB] Format lldb-server's target XML

So that the XML isn't one giant line. Which wasn't
a problem for lldb but was for me trying to troubleshoot
it using the logs.

It now looks like:
```
<?xml version="1.0"?>
<target version="1.0">
  <architecture>aarch64</architecture>
  <feature>
    <...>
    <reg name="fpcr" .../>
  </feature>
</target>
```

Reviewed By: labath

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

23 months ago[AArch64][NFC] Correctly rename mangling name for ldN.sret
Caroline Concatto [Wed, 31 Aug 2022 13:05:03 +0000 (14:05 +0100)]
[AArch64][NFC] Correctly rename mangling name for ldN.sret

Remove from the function name the predicate type and pointer type, because:
 The predicate type in the name(nxvNi1)  can be deduced from the overloaded
element count(nxvNEltTy).
 The pointer type(p0EltTy) can be deduced from the overloaded element type.

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

23 months ago[Utils] Refactor update_cc_test_checks.py to use shutil
John McIver [Tue, 20 Sep 2022 08:39:40 +0000 (09:39 +0100)]
[Utils] Refactor update_cc_test_checks.py to use shutil

The package distutils is deprecated and removal is planned for Python 3.12.
All calls to distutils.spawn.find_executable are replaced with shutil.which.

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

23 months ago[flang] Deallocate WHERE masks after all assignments
Jean Perier [Tue, 20 Sep 2022 08:39:39 +0000 (10:39 +0200)]
[flang] Deallocate WHERE masks after all assignments

Allocatable assignments were triggering lowering to clean-up
any WHERE mask temporaries, even if some assignments where left
in the WHERE construct.

This is because allocatable assignments lowering was being passed the
wrong statement context. Fix this by selecting the where/forall statement
context instead of a local one when there is one.

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

23 months ago[LSR] Fold terminating condition to other IV when possible
eopXD [Tue, 20 Sep 2022 02:07:43 +0000 (19:07 -0700)]
[LSR] Fold terminating condition to other IV when possible

When the IV is only used by the terminating condition (say IV-A) and the loop
has a predictable back-edge count and we have another IV (say IV-B) that is an
affine add recursion, we will be able to calculate the terminating value of
IV-B in the loop pre-header. This patch adds attempts to replace IV-B as the
new terminating condition and remove IV-A. It is safe to do so since IV-A is
only used as the terminating condition.

This transformation is suitable to be appended after LSR as it may optimize the
loop into the situation mentioned above. The transformation can reduce number of
IV-s in the loop by one.

A cli option `lsr-term-fold` is added and default disabled.

Reviewed By: mcberg2021, craig.topper

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

23 months ago[flang] fix optional pointer TARGET argument lowering in ASSOCIATED
Jean Perier [Tue, 20 Sep 2022 08:15:15 +0000 (10:15 +0200)]
[flang] fix optional pointer TARGET argument lowering in ASSOCIATED

The TARGET argument of ASSOCIATED has a special lowering to deal with
POINTER and ALLOCATABLE optional actual arguments because they may be
dynamically absent. The previous code was doing a ternary
(mlir::SelectOp) to deal with this case, but generated invalid
code for the unused argument (loading a nullptr fir.ref<fir.box>). This
was not detected until D133779 was merged and modified how fir.load are
lowered to LLVM for fir.box types.

Replace the select by a proper if to prevent the fir.load from being
reachable in context where it should not.

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

23 months ago[gn build] Port 55158efe1045
LLVM GN Syncbot [Tue, 20 Sep 2022 08:12:06 +0000 (08:12 +0000)]
[gn build] Port 55158efe1045

23 months ago[libc++] Remove MSVC code
Nikolas Klauser [Tue, 30 Aug 2022 12:57:17 +0000 (14:57 +0200)]
[libc++] Remove MSVC code

It's been one and a half months now and nobody said anything, so I guess this code can be removed.

Reviewed By: ldionne, #libc

Spies: Mordante, libcxx-commits, mgorny, mstorsjo

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

23 months ago[libc++][NFC] Refactor enable_ifs in vector
Nikolas Klauser [Mon, 15 Aug 2022 12:09:49 +0000 (14:09 +0200)]
[libc++][NFC] Refactor enable_ifs in vector

Using the `enable_if_t<..., int> = 0` style has the benefit that it works in all cases and makes function declarations easier to read because the function arguments and return type and SFINAE are separated. Unifying the style also makes it easier for people not super familiar with SFINAE to make sense of the code.

Reviewed By: Mordante, var-const, #libc, huixie90

Spies: huixie90, libcxx-commits

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

23 months ago[TargetLibraryInfo] Mark memrchr as unavailable on Windows
Mateusz Mikuła [Tue, 20 Sep 2022 07:49:41 +0000 (10:49 +0300)]
[TargetLibraryInfo] Mark memrchr as unavailable on Windows

Otherwise LLVM will optimise strrchr into memrchr on Windows resulting in linker error:
```
$ cat memrchr_test.c
int main(int argc, char **argv) {
    return (long)strrchr("KkMm", argv[argc-1][0]);
}

$ clang memrchr_test.c -O
memrchr_test.c:3:12: warning: cast to smaller integer type 'long' from 'char *' [-Wpointer-to-int-cast]
    return (long)strrchr("KkMm", argv[argc-1][0]);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
ld.lld: error: undefined symbol: memrchr
>>> referenced by D:/msys64/tmp/memrchr_test-e7aabd.o:(main)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

Example taken from MSYS2 Discord and tested with windows-gnu target.

Reviewed By: aeubanks

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

23 months ago[LLD][COFF] Add load config checks to warn if incorrect for CFGuard
Alvin Wong [Tue, 20 Sep 2022 07:49:01 +0000 (10:49 +0300)]
[LLD][COFF] Add load config checks to warn if incorrect for CFGuard

Control Flow Guard requires specific flags and VA's be included in the
load config directory to be functional. In case CFGuard is enabled via
linker flags, we can check to make sure this is the case and give the
user a warning if otherwise.

MSVC provides a proper `_load_config_used` by default, so this is more
relevant for the MinGW target in which current versions of mingw-w64
does not provide this symbol.

The checks (only if CFGuard is enabled) include:

- The `_load_config_used` struct shall exist.
- Alignment of the `_load_config_used` struct (shall be aligned to
  pointer size.)
- The `_load_config_used` struct shall be large enough to contain the
  required fields.
- The values of the following fields are checked against the expected
  values:
  - GuardCFFunctionTable
  - GuardCFFunctionCount
  - GuardFlags
  - GuardAddressTakenIatEntryTable
  - GuardAddressTakenIatEntryCount
  - GuardLongJumpTargetTable
  - GuardLongJumpTargetCount
  - GuardEHContinuationTable
  - GuardEHContinuationCount

Reviewed By: rnk

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

23 months ago[LLD][COFF] Improve symbol table info for import thunk
Alvin Wong [Tue, 20 Sep 2022 07:44:45 +0000 (10:44 +0300)]
[LLD][COFF] Improve symbol table info for import thunk

Import thunks themselves contain a jump or branch, which is code by
nature. Therefore the import thunk symbol should be marked as function
type in the symbol table to help with debugging.

The `__imp_` import symbol associated to the import thunk is also useful
for debugging. However, when the import symbol isn't directly referenced
outside of the import thunk, it doesn't normally get added to the symbol
table. This change teaches LLD to add the import symbol explicitly.

Reviewed By: mstorsjo

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

23 months ago[llvm-rc] [test] Fix the windres-preproc test with other mingw triple forms. NFC.
Martin Storsjö [Sun, 18 Sep 2022 21:08:41 +0000 (00:08 +0300)]
[llvm-rc] [test] Fix the windres-preproc test with other mingw triple forms. NFC.

When invoking the preprocessor, llvm-windres produces a mingw
triple; if the llvm default target triple is a mingw target, it
is used as is - if not, a mingw style triple is generated.

Relax the testcase, to not strictly require "w64" as vendor (allow
the vendor field to be missing entirely), and allow both
"mingw32" and "windows-gnu" as OS/environment (where both forms are
common, while the latter is the normalized form).

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

23 months ago[clang] [Driver] Do not transform explicit --config filename
Michał Górny [Mon, 19 Sep 2022 18:23:44 +0000 (20:23 +0200)]
[clang] [Driver] Do not transform explicit --config filename

Disable transformations (e.g. attempting to replace target architecture)
in the config filename that is passed explicitly via `--config`.  This
behavior is surprising and confusing -- if user passes an explicit
config filename, Clang should use it as is.  The transformations are
still applied when the name is deduced from filename.

Update the tests accordingly.  This primarily ensures that full filename
with .cfg suffix is passed to --config (appending `.cfg` implicitly is
not documented, and would collide with use of filenames with other
suffixes).  The config-file2.c suite is removed entirely as it tested
the transformations on the argument to --config.  However, the aspects
of that that were not tested as part of config-file3.c are now added
there (based on config filename deduced from executable).

This change streamlines the code in Driver::loadConfigFile(), opening
the possibility of further changes, including support for handling
multiple --config options and refactoring of filename deduction.

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

23 months agoremove the internal signatures from perf binaries
wlei [Tue, 20 Sep 2022 05:30:24 +0000 (22:30 -0700)]
remove the internal signatures from perf binaries

23 months ago[lldb] Actually support more than 32 logging categories
Jonas Devlieghere [Mon, 19 Sep 2022 23:20:50 +0000 (16:20 -0700)]
[lldb] Actually support more than 32 logging categories

In January, Greg put up a patch (D117382) to support, among other
things, more than 32 log categories. That led to a bunch of nice
cleanups, but categories remained constrained because different parts of
the code were still using uint32_t. This patch fixes the remaining
issues and makes it possible to add a 32nd log category.

Differential revision: https://reviews.llvm.org/D134245

23 months ago[X86][GlobalISel] Add support for sret demotion
Serge Pavlov [Mon, 19 Sep 2022 07:14:00 +0000 (14:14 +0700)]
[X86][GlobalISel] Add support for sret demotion

The change add support for the cases when return value is passed in
memory rathen than in registers.

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

23 months ago[flang] Give explicit convert= specifiers precedence over FORT_CONVERT
Jonathon Penix [Fri, 2 Sep 2022 03:04:18 +0000 (20:04 -0700)]
[flang] Give explicit convert= specifiers precedence over FORT_CONVERT

Currently, the FORT_CONVERT environment variable has the highest priority when
setting the endianness conversion for unformatted files. In discussing the
appropriate priority for the fconvert option, convert specifiers were decided
to take highest priority.

This patch also initializes the open statement convert state to unknown
to disambiguate cases where the convert specifier was not provided from
cases where convert=native was set. This makes it possible to defer to the
environment setting where appropriate.

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

23 months ago[MemorySSA] Add test that all incoming values of phi node could be translated
luxufan [Mon, 19 Sep 2022 02:02:49 +0000 (02:02 +0000)]
[MemorySSA] Add test that all incoming values of phi node could be translated

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