platform/upstream/llvm.git
2 years ago[compiler-rt] [scudo] Use -mcrc32 on x86 when available
Michał Górny [Thu, 31 Mar 2022 07:55:25 +0000 (09:55 +0200)]
[compiler-rt] [scudo] Use -mcrc32 on x86 when available

Update the hardware CRC32 logic in scudo to support using `-mcrc32`
instead of `-msse4.2`.  The CRC32 intrinsics use the former flag
in the newer compiler versions, e.g. in clang since 12fa608af44a.
With these compilers, passing `-msse4.2` is insufficient to enable
the instructions and causes build failures when `-march` does not enable
CRC32:

    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/scudo_crc32.cpp:20:10: error: always_inline function '_mm_crc32_u32' requires target feature 'crc32', but would be inlined into function 'computeHardwareCRC32' that is compiled without support for 'crc32'
      return CRC32_INTRINSIC(Crc, Data);
             ^
    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/scudo_crc32.h:27:27: note: expanded from macro 'CRC32_INTRINSIC'
    #  define CRC32_INTRINSIC FIRST_32_SECOND_64(_mm_crc32_u32, _mm_crc32_u64)
                              ^
    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/../sanitizer_common/sanitizer_platform.h:132:36: note: expanded from macro 'FIRST_32_SECOND_64'
    #  define FIRST_32_SECOND_64(a, b) (a)
                                       ^
    1 error generated.

For backwards compatibility, use `-mcrc32` when available and fall back
to `-msse4.2`.  The `<smmintrin.h>` header remains in use as it still
works and is compatible with GCC, while clang's `<crc32intrin.h>`
is not.

Originally reported in https://bugs.gentoo.org/835870.

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

2 years ago[libc] Enable threads.h functions on aarch64.
Siva Chandra [Thu, 31 Mar 2022 06:44:57 +0000 (23:44 -0700)]
[libc] Enable threads.h functions on aarch64.

Reviewed By: lntue

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

2 years ago[OpenCL] Set MinVersion for sub_group_barrier with memory_scope
Sven van Haastregt [Thu, 31 Mar 2022 15:41:40 +0000 (16:41 +0100)]
[OpenCL] Set MinVersion for sub_group_barrier with memory_scope

The memory_scope enum is not available before OpenCL 2.0, so ensure
the sub_group_barrier overload with a memory_scope argument is
restricted to OpenCL 2.0 and above.  This is already the case in
opencl-c.h.

Fixes the issue revealed by https://reviews.llvm.org/D120254

Reported-by: Harald van Dijk (hvdijk)
2 years ago[libc++][ci] Installs Japanese locale in Docker.
Mark de Wever [Wed, 30 Mar 2022 15:30:39 +0000 (17:30 +0200)]
[libc++][ci] Installs Japanese locale in Docker.

The alternative outputs of std::put_time and std::strftime are the
easiest to test with the Japanese locale. This is a preparation for the
tests of the chrono formatters.

Note since it takes a while before the Docker file changes propagate to
the build nodes the verification of the locale is done in a separate
patch.

Reviewed By: ldionne, #libc

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

2 years ago[libc++][doc] Update formatting status.
Mark de Wever [Sun, 27 Mar 2022 16:39:24 +0000 (18:39 +0200)]
[libc++][doc] Update formatting status.

Reduced the details of the non-chrono formatting information. This has
been shipped and these details part of P0645 which is still documented.
Removing this information keeps the information up-to-date.

Adds the formatters required for the types chrono namespace.

Reviewed By: ldionne, #libc

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

2 years ago[analyzer] Avoid checking addrspace pointers in cstring checker
Vince Bridgers [Mon, 24 Jan 2022 16:54:24 +0000 (10:54 -0600)]
[analyzer] Avoid checking addrspace pointers in cstring checker

This change fixes an assert that occurs in the SMT layer when refuting a
finding that uses pointers of two different sizes. This was found in a
downstream build that supports two different pointer sizes, The CString
Checker was attempting to compute an overlap for the 'to' and 'from'
pointers, where the pointers were of different sizes.

In the downstream case where this was found, a specialized memcpy
routine patterned after memcpy_special is used. The analyzer core hits
on this builtin because it matches the 'memcpy' portion of that builtin.
This cannot be duplicated in the upstream test since there are no
specialized builtins that match that pattern, but the case does
reproduce in the accompanying LIT test case. The amdgcn target was used
for this reproducer. See the documentation for AMDGPU address spaces here
https://llvm.org/docs/AMDGPUUsage.html#address-spaces.

The assert seen is:

`*Solver->getSort(LHS) == *Solver->getSort(RHS) && "AST's must have the same sort!"'

Ack to steakhal for reviewing the fix, and creating the test case.

Reviewed By: steakhal

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

2 years ago[AArch64][SVE] Mark {CNT*,RDVL,INDEX} as materializable
Peter Waller [Wed, 30 Mar 2022 15:04:59 +0000 (15:04 +0000)]
[AArch64][SVE] Mark {CNT*,RDVL,INDEX} as materializable

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

2 years ago[RISCV][NFC] Minor formatting fix
Fraser Cormack [Thu, 31 Mar 2022 15:15:16 +0000 (16:15 +0100)]
[RISCV][NFC] Minor formatting fix

2 years ago[AMDGPU] Fix typo in RUN line
Jay Foad [Thu, 31 Mar 2022 15:23:21 +0000 (16:23 +0100)]
[AMDGPU] Fix typo in RUN line

2 years ago[NewPM] Add OptimizerEarly module extension point
Wenju He [Thu, 31 Mar 2022 15:12:29 +0000 (08:12 -0700)]
[NewPM] Add OptimizerEarly module extension point

VectorizerStart extension is module callback in old PM, but is function
callback in new PM. We lack a module extension point between end of
buildModuleSimplificationPipeline and the function optimization
(including vectorizer) pipeline. So this patch adds a new module
extension point before the function optimization pipeline.

Reviewed By: aeubanks

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

2 years ago[MLIR][Presburger] Carry IdKind information in LinearTransform::applyTo
Groverkss [Thu, 31 Mar 2022 15:09:39 +0000 (20:39 +0530)]
[MLIR][Presburger] Carry IdKind information in LinearTransform::applyTo

This patch fixes a bug in LinearTransform::applyTo where it did not carry the
IdKind information, and instead treated every id as IdKind::Domain.

Reviewed By: arjunp

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

2 years ago[gn build] (manually) port 19246b0779a2
Nico Weber [Thu, 31 Mar 2022 15:10:18 +0000 (11:10 -0400)]
[gn build] (manually) port 19246b0779a2

2 years agoSerialize PragmaAssumeNonNullLoc to support preambles
David Goldman [Mon, 21 Mar 2022 17:45:21 +0000 (13:45 -0400)]
Serialize PragmaAssumeNonNullLoc to support preambles

Previously, if a `#pragma clang assume_nonnull begin` was at the
end of a premable with a `#pragma clang assume_nonnull end` at the
end of the main file, clang would diagnose an unterminated begin in
the preamble and an unbalanced end in the main file.

With this change, those errors no longer occur and the case above is
now properly handled. I've added a corresponding test to clangd,
which makes use of preambles, in order to verify this works as
expected.

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

2 years agoAMDGPU: Use isLiteralConstantLike to check whether the operand could ever be literal
Changpeng Fang [Thu, 31 Mar 2022 15:06:31 +0000 (08:06 -0700)]
AMDGPU: Use isLiteralConstantLike to check whether the operand could ever be literal

Summary:
  To compute the size of a VALU/SALU instruction, we need to check whether an operand
could ever be literal. Previously isLiteralConstant was used, which missed cases
like global variables or external symbols. These misses lead to under-estimation of
the instruction size and branch offset, and thus incorrectly skip the necessary branch
relaxation when the branch offset is actually greater than what the branch bits can hold.
In this work, we use isLiteralConstantLike to check the operands. It maybe conservative,
but it is safe.

Reviewers: arsenm

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

2 years ago[libc++] Install psutil on the macOS nodes
Louis Dionne [Thu, 31 Mar 2022 14:52:52 +0000 (10:52 -0400)]
[libc++] Install psutil on the macOS nodes

2 years ago[X86] Add test for PR54369 (NFC)
Nikita Popov [Thu, 31 Mar 2022 14:44:45 +0000 (16:44 +0200)]
[X86] Add test for PR54369 (NFC)

2 years ago[compiler-rt] Implement __clear_cache on FreeBSD/powerpc
Carlo Marcelo Arenas Belón [Thu, 31 Mar 2022 13:46:45 +0000 (13:46 +0000)]
[compiler-rt] Implement __clear_cache on FreeBSD/powerpc

dd9173420f06 (Add clear_cache implementation for ppc64. Fix buffer to
meet ppc64 alignment., 2017-07-28), adds an implementation for
__builtin___clear_cache on powerpc64, which was promptly ammended to
also be used with big endian mode in f67036b62c0c (This ppc64 implementation
of clear_cache works for both big and little endian., 2017-08-02)

clang will use this implementation for it's builtin on FreeBSD and result
in an abort() in the cases where 32-bit generation was requested (ex in
macppc or when the big endian powerpc64 build was done with "-m32") and as
reported[1] recently with pcre2, but there is no reason why the same code
couldn't be used in those cases, so use instead the more generic identifier
for the PowerPC architecture.

While at it, update the comment to reflect that POWER8/9 have a 128 byte
wide cache line and so the code could instead use 64 byte windows instead
but that possible optimization has been punted for now.

[1] https://github.com/PhilipHazel/pcre2/issues/92

Reviewed By: jhibbits, #powerpc, MaskRay

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

2 years ago[MLIR][Presburger] IntegerRelation::truncate: fix bug when truncating equalities
Arjun P [Thu, 31 Mar 2022 13:43:44 +0000 (14:43 +0100)]
[MLIR][Presburger] IntegerRelation::truncate: fix bug when truncating equalities

This was truncating inequalities instead of equalities.

Reviewed By: Groverkss

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

2 years ago[Float2Int] Avoid unnecessary lamdbas (NFC)
Nikita Popov [Thu, 31 Mar 2022 14:09:34 +0000 (16:09 +0200)]
[Float2Int] Avoid unnecessary lamdbas (NFC)

Instead of first creating a lambda for calculating the range,
then collecting the ranges for the operands, and then calling the
lambda on those ranges, we can first calculate the operand ranges
and then calculate the result directly in the switch.

2 years ago[Float2Int] Extract calcRange() method (NFC)
Nikita Popov [Thu, 31 Mar 2022 14:06:46 +0000 (16:06 +0200)]
[Float2Int] Extract calcRange() method (NFC)

This avoids the awkward "Abort" flag, because we can simply
early-return instead.

2 years ago[MLIR][Presburger] MultiAffineFunction:eliminateRedundantLocalId: fix bug where local...
Arjun P [Thu, 31 Mar 2022 11:34:33 +0000 (12:34 +0100)]
[MLIR][Presburger] MultiAffineFunction:eliminateRedundantLocalId: fix bug where local offset was not considered

Previously, when updating the outputs matrix, the local offset was not being considered.

Reviewed By: Groverkss

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

2 years agoRecommit "[LV] Remove unneeded createHeaderBranch.(NFCI)"
Florian Hahn [Thu, 31 Mar 2022 12:31:34 +0000 (13:31 +0100)]
Recommit "[LV] Remove unneeded createHeaderBranch.(NFCI)"

This reverts the revert commit 2760cdc9c6.

This version pulls in the code to create the vector loop object in VPlan
from D121624.

This is needed because otherwise existing LoopInfo verification will
fail, as a loop block doesn't have in-loop successors now that we
do not replace the branch.

Now that we do not add new loops during skeleton construction, there's
also no need to verify LI there.

2 years ago[libc++] Remove the __libcpp_version file
Louis Dionne [Wed, 23 Mar 2022 17:17:06 +0000 (13:17 -0400)]
[libc++] Remove the __libcpp_version file

It seems to have been added back in 761e42fa3dd72 for Clang to use it,
however it seems to have never been used for that purpose, so it is
probably fine to remove it.

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

2 years agoRevert "[llvm-readobj][MachO] Add option to sort the symbol table before dumping...
Vy Nguyen [Thu, 31 Mar 2022 13:33:04 +0000 (09:33 -0400)]
Revert "[llvm-readobj][MachO] Add option to sort the symbol table before dumping (MachO only, for now)."

This reverts commit ea9cf2dc96c765773ee574a9189d529175a57751.

Broke LLDB - reverting to investigage

2 years ago[libc++] Add a CI job running MSAN
Louis Dionne [Wed, 2 Mar 2022 22:49:13 +0000 (17:49 -0500)]
[libc++] Add a CI job running MSAN

For some reason, we've been going without a MSAN CI job, even though
even run-buildbot defined a generic-msan job. This must have been an
oversight that went unnoticed. Thanks to @EricWF for the catch.

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

2 years ago[clang][dataflow] Add support for `value_or` in a comparison.
Yitzhak Mandelbaum [Mon, 21 Mar 2022 20:37:04 +0000 (20:37 +0000)]
[clang][dataflow] Add support for `value_or` in a comparison.

This patch adds limited modeling of the `value_or` method. Specifically, when
used in a particular idiom in a comparison to implicitly check whether the
optional holds a value.

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

2 years ago[x86] try to replace 0.0 in fcmp with negated operand
Sanjay Patel [Thu, 31 Mar 2022 12:21:28 +0000 (08:21 -0400)]
[x86] try to replace 0.0 in fcmp with negated operand

This inverts a fold recently added to IR with:
3491f2f4b033

We can put -bidirectional on the Alive2 examples to show that
the reverse transforms work:
https://alive2.llvm.org/ce/z/8iVQwB

The motivation for the IR change was to improve matching to
'fabs' in IR (see https://github.com/llvm/llvm-project/issues/38828 ),
but it regressed x86 codegen for 'not-quite-fabs' patterns like
(X > -X) ? X : -X.
Ie, when there is no fast-math (nsz), the cmp+select is not a proper
fabs operation, but it does map nicely to the unusual NAN semantics
of MINSS/MAXSS.

I drafted this as a target-independent fold, but it doesn't appear to
help any other targets and seems to cause regressions for SystemZ at
least.

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

2 years ago[llvm-readobj][MachO] Add option to sort the symbol table before dumping (MachO only...
Vy Nguyen [Tue, 22 Mar 2022 22:55:15 +0000 (18:55 -0400)]
[llvm-readobj][MachO] Add option to sort the symbol table before dumping (MachO only, for now).

This would help making tests less brittle as the order will be fixed.

(see also PR/53026)

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

2 years ago[AMDGPU] Fix last remaining checks in perfhint.ll
Jay Foad [Tue, 29 Mar 2022 16:06:50 +0000 (17:06 +0100)]
[AMDGPU] Fix last remaining checks in perfhint.ll

Unfortunately this just shows that the test case for D47740 never
really tested what it was supposed to test.

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

2 years ago[RISCV][NFC] Fix formatting on one line
Fraser Cormack [Thu, 31 Mar 2022 12:17:11 +0000 (13:17 +0100)]
[RISCV][NFC] Fix formatting on one line

2 years agoFixed the type of context in type stubs for MLIR Python bindings
Sergei Lebedev [Thu, 31 Mar 2022 12:27:49 +0000 (14:27 +0200)]
Fixed the type of context in type stubs for MLIR Python bindings

Reviewed By: ftynse

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

2 years ago[AMDGPU] Regenerate checks in some mir tests
Abinav Puthan Purayil [Thu, 31 Mar 2022 10:18:50 +0000 (15:48 +0530)]
[AMDGPU] Regenerate checks in some mir tests

2 years agoImplement inlining of strictfp functions
Serge Pavlov [Fri, 1 Nov 2019 13:49:35 +0000 (20:49 +0700)]
Implement inlining of strictfp functions

According to the current design, if a floating point operation is
represented by a constrained intrinsic somewhere in a function, all
floating point operations in the function must be represented by
constrained intrinsics. It imposes additional requirements to inlining
mechanism. If non-strictfp function is inlined into strictfp function,
all ordinary FP operations must be replaced with their constrained
counterparts.

Inlining strictfp function into non-strictfp is not implemented as it
would require replacement of all FP operations in the host function,
which now is undesirable due to expected performance loss.

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

2 years ago[FuncSpec] Constant propagate multiple arguments for recursive functions.
Alexandros Lamprineas [Thu, 31 Mar 2022 11:00:00 +0000 (12:00 +0100)]
[FuncSpec] Constant propagate multiple arguments for recursive functions.

This fixes a TODO in constantArgPropagation() to make it feature complete.
However, I do find myself in agreement with the review comments in
https://reviews.llvm.org/D106426. I don't think we should pursue
specializing such recursive functions as the code size increase becomes
linear to 'max-iters'. Compiling the modified test just with -O3 (no
function specialization) generates the same code.

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

2 years agoFixed minor documentation issues
Priyansh Singh [Thu, 31 Mar 2022 11:35:40 +0000 (07:35 -0400)]
Fixed minor documentation issues

Fixed whitespace and punctuation issues, added a name to a link, and
fixed a typo.

2 years agoRevert "[LV] Remove unneeded createHeaderBranch.(NFCI)"
Florian Hahn [Thu, 31 Mar 2022 11:32:50 +0000 (12:32 +0100)]
Revert "[LV] Remove unneeded createHeaderBranch.(NFCI)"

This reverts commit 32bc83d11e19b8a8c15df81b32fde1f9f8c6156b.

This is causing bots with expensive-checks to fail. Revert while I
investigate.

2 years ago[AMDGPU][GlobalISel] Remove unused variable. NFC.
Abinav Puthan Purayil [Thu, 31 Mar 2022 11:14:54 +0000 (16:44 +0530)]
[AMDGPU][GlobalISel] Remove unused variable. NFC.

2 years ago[X86][AMX] Materialize undef or zero value to tilezero
Luo, Yuanke [Wed, 30 Mar 2022 08:45:15 +0000 (16:45 +0800)]
[X86][AMX] Materialize undef or zero value to tilezero

The AMX combiner would store undef or zero to stack and invoke tileload
to load the data to tile register. To avoid the store/load, we can
materialzie undef or zero value to tilezero.

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

2 years ago[clangd] IncludeCleaner: Add support for IWYU pragma private
Kirill Bobyrev [Thu, 31 Mar 2022 10:49:38 +0000 (12:49 +0200)]
[clangd] IncludeCleaner: Add support for IWYU pragma private

Reviewed By: sammccall

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

2 years ago[LV] Remove unneeded createHeaderBranch.(NFCI)
Florian Hahn [Thu, 31 Mar 2022 10:48:52 +0000 (11:48 +0100)]
[LV] Remove unneeded createHeaderBranch.(NFCI)

The only remaining use was to get the exit block of the loop. Instead of
relying on the loop, use the successor of VectorHeaderBB
(LoopMiddleBlock) directly to set VPTransformState::CFG::ExitB

Depends on D121621.

Reviewed By: Ayal

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

2 years ago[AArch64] Set MaxBytesForLoopAlignment for more targets
Nicholas Guy [Tue, 22 Mar 2022 16:35:12 +0000 (16:35 +0000)]
[AArch64] Set MaxBytesForLoopAlignment for more targets

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

2 years agoAdded an empty __init__.py file to the MLIR Python bindings
Sergei Lebedev [Thu, 31 Mar 2022 09:57:07 +0000 (11:57 +0200)]
Added an empty __init__.py file to the MLIR Python bindings

While not strictly required after PEP-420, it is better to have one, since not
all tooling supports implicit namespace packages.

Reviewed By: ftynse

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

2 years agoFixed mypy type errors in MLIR Python type stubs
Sergei Lebedev [Thu, 31 Mar 2022 09:55:51 +0000 (11:55 +0200)]
Fixed mypy type errors in MLIR Python type stubs

This commit fixes or disables all errors reported by

    python3 -m mypy -p mlir --show-error-codes

Note that unhashable types cannot be currently expressed in a way compatible
with typeshed. See https://github.com/python/typeshed/issues/6243 for details.

Reviewed By: ftynse

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

2 years ago[X86] Extend xor-lea test coverage
Simon Pilgrim [Thu, 31 Mar 2022 09:54:06 +0000 (10:54 +0100)]
[X86] Extend xor-lea test coverage

Add ADD/SUB(XOR(X,MIN_SIGNED_VALUE),Y) tests

2 years ago[VPlan] Remove unneeded Loop variable (NFC).
Florian Hahn [Thu, 31 Mar 2022 09:34:27 +0000 (10:34 +0100)]
[VPlan] Remove unneeded Loop variable (NFC).

Suggested in D121623. The remaining uses of L can be replaced, reducing
the need for the variable.

2 years ago[AddressSanitizer] Allow prefixing memintrinsic calls in kernel mode
Marco Elver [Wed, 30 Mar 2022 14:56:10 +0000 (16:56 +0200)]
[AddressSanitizer] Allow prefixing memintrinsic calls in kernel mode

Allow receiving memcpy/memset/memmove instrumentation by using __asan or
__hwasan prefixed versions for AddressSanitizer and HWAddressSanitizer
respectively when compiling in kernel mode, by passing params
-asan-kernel-mem-intrinsic-prefix or -hwasan-kernel-mem-intrinsic-prefix.

By default the kernel-specialized versions of both passes drop the
prefixes for calls generated by memintrinsics. This assumes that all
locations that can lower the intrinsics to libcalls can safely be
instrumented. This unfortunately is not the case when implicit calls to
memintrinsics are inserted by the compiler in no_sanitize functions [1].

To solve the issue, normal memcpy/memset/memmove need to be
uninstrumented, and instrumented code should instead use the prefixed
versions. This also aligns with ASan behaviour in user space.

[1] https://lore.kernel.org/lkml/Yj2yYFloadFobRPx@lakrids/

Reviewed By: glider

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

2 years ago[MLIR][Presburger] Remove forward declaration to PresburgerLocalSpace
Groverkss [Thu, 31 Mar 2022 08:57:36 +0000 (14:27 +0530)]
[MLIR][Presburger] Remove forward declaration to PresburgerLocalSpace

This patch removes a forward declaration to PresburgerLocalSpace, a
class which does not exist anymore.

2 years ago[flang] Allow user to recover from bad edit descriptor with INTEGER
Jean Perier [Thu, 31 Mar 2022 08:57:01 +0000 (10:57 +0200)]
[flang] Allow user to recover from bad edit descriptor with INTEGER

Runtime was crashing when an INTEGER passed in formatted output with
a bad edit descriptor even when the user did provide IOSTAT. Flang
is already signaling an error when facing similar error with other
types. Do the same with INTEGERs.

The input case is already signaling an error in the related input error
case.

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

2 years ago[flang] Skip `D` when including D debug line
Jean Perier [Thu, 31 Mar 2022 08:54:15 +0000 (10:54 +0200)]
[flang] Skip `D` when including D debug line

When including debug lines as code, the `D` should be considered as
a white space. Currently an error was raised about bad labels because
it the `D` remained a `D` when considering the source line as code.

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

2 years ago[X86] combineCarryThroughADD - recognise X86ISD::ADD(AND(X,1),-1) pattern can be...
Simon Pilgrim [Thu, 31 Mar 2022 08:52:55 +0000 (09:52 +0100)]
[X86] combineCarryThroughADD - recognise X86ISD::ADD(AND(X,1),-1) pattern can be folded to X86ISD::BT

As mentioned on D122482, if we've generated a masked overflow test see if we can fold it to X86ISD::BT to feed a X86ISD::ADC/SBB

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

2 years ago[RISCV][RVV] Add Uses = [FRM] and mayRaiseFPException = true to RVV instructions
ShihPo Hung [Mon, 7 Mar 2022 07:42:49 +0000 (23:42 -0800)]
[RISCV][RVV] Add Uses = [FRM] and mayRaiseFPException = true to RVV instructions

This patch adds Uses = [FRM] and mayRaiseFPException = true to following
instructions:

VFADD, VFSUB, VFRSUB, VFMUL, VFDIV, VFRDIV
VFWADD, VFWSUB, VFWMUL
VFMADD, VFMACC, VFMSAC, VFMSUB
VFNMADD, VFNMACC, VFNMSAC, VVFNMSUB
VFWMACC, VFWMSAC,
VFWNMACC, VFWNMSAC
VFSQRT, VFREC7
VFREDOSUM, VFREDUSUM,
VFWREDOSUM, VFWREDUSUM
and only adds mayRaiseFPException = true to following instructions:

VFRSQRT7,
VFMIN, VFMAX, VFREDMIN, VFREDMAX
VMFEQ, VMFNE, VMFLT,VMFLE, VMFGT, VMFGE

Reviewed By: rogfer01

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

2 years ago[LV] Invalidate widening decisions after maximizing vector bandwidth
David Green [Thu, 31 Mar 2022 08:19:31 +0000 (09:19 +0100)]
[LV] Invalidate widening decisions after maximizing vector bandwidth

When MaximizeVectorBandwidth is enabled, we can end up (via calls to
collectUniformsAndScalars/setCostBasedWideningDecision through
calculateRegisterUsage) making widening decisions before we have decided
whether to fold the tail by masking. These decisions will be wrong if we
later decided to fold the tail, for example when the trip count is very
low. It will use incorrect costs for loads that should get masked, using
standard memory operation costs instead.

This still at the moment uses the EmulatedMaskMemRefHack costs (a bit
unfortunately), but the old costs without this change were 1, leading to
too optimistic vectorization.

This slightly changes the way that the MaximizeVectorBandwidth option
works to make it easier to test, always honouring the option if it is
set.

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

2 years ago[mlir][memref][NFC] Remove unused function
Matthias Springer [Thu, 31 Mar 2022 08:15:31 +0000 (17:15 +0900)]
[mlir][memref][NFC] Remove unused function

This fixes a compiler warning.

2 years ago[AMDGPU] Document the intended semantics of llvm.amdgcn.s.buffer.load
Jay Foad [Tue, 29 Mar 2022 13:30:41 +0000 (14:30 +0100)]
[AMDGPU] Document the intended semantics of llvm.amdgcn.s.buffer.load

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

2 years ago[mlir][tensor] Fix bufferization of CollapseShapeOp / ExpandShapeOp
Matthias Springer [Thu, 31 Mar 2022 08:04:38 +0000 (17:04 +0900)]
[mlir][tensor] Fix bufferization of CollapseShapeOp / ExpandShapeOp

Infer a tighter MemRef type instead of always falling back to the most dynamic MemRef type. This is inefficient and caused op verification errors.

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

2 years ago[RISCV][NFC] Fix comment to refer to correct file
Fraser Cormack [Thu, 31 Mar 2022 07:58:59 +0000 (08:58 +0100)]
[RISCV][NFC] Fix comment to refer to correct file

2 years ago[mlir][memref] Fix CollapseShapeOp verifier
Matthias Springer [Thu, 31 Mar 2022 08:04:15 +0000 (17:04 +0900)]
[mlir][memref] Fix CollapseShapeOp verifier

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

2 years ago[mlir][memref] Fix ExpandShapeOp verifier
Matthias Springer [Thu, 31 Mar 2022 08:03:41 +0000 (17:03 +0900)]
[mlir][memref] Fix ExpandShapeOp verifier

* Complete rewrite of the verifier.
* CollapseShapeOp verifier will be updated in a subsequent commit.
* Update and expand op documentation.
* Add a new builder that infers the result type based on the source type, result shape and reassociation indices. In essence, only the result layout map is inferred.

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

2 years ago[Support/BLAKE3] Re-enable building with the simd-optimized implementations, v2
Argyrios Kyrtzidis [Thu, 31 Mar 2022 07:43:28 +0000 (00:43 -0700)]
[Support/BLAKE3] Re-enable building with the simd-optimized implementations, v2

* Support compiling with clang-5
* Check for `LLVM_DISABLE_ASSEMBLY_FILES` and have it set by
  `compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh`
  which wants to receive and process only bitcode files.

2 years agoRevert "[Clang] Add option to set alternative toolchain path"
Qiu Chaofan [Thu, 31 Mar 2022 07:51:11 +0000 (15:51 +0800)]
Revert "[Clang] Add option to set alternative toolchain path"

--overlay-platform-toolchain inserts a whole new toolchain path with
higher priority than system default, which could be achieved by
composing smaller options. We need to figure out alternative solution
and what is missing among these basic options.

2 years ago[runtimes] Create Tests.cmake if it does not exist
Petr Hosek [Wed, 30 Mar 2022 19:07:41 +0000 (12:07 -0700)]
[runtimes] Create Tests.cmake if it does not exist

This is necessary so that Tests.cmake is always included in the
generated build file and any changes made by subbuilds are detected
without needing to rerun CMake.

This is equivalent to an earlier version of D121647.

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

2 years ago[docs] [tools] Document and alphabetize all llvm-config command-line options
Frances Wingerter [Thu, 31 Mar 2022 07:20:41 +0000 (08:20 +0100)]
[docs] [tools] Document and alphabetize all llvm-config command-line options

Also implements explicit handling for the already-documented --help
flag.

2 years ago[VP][LangRef] Correct select operands in vp.fptosi docs
Fraser Cormack [Thu, 31 Mar 2022 07:30:18 +0000 (08:30 +0100)]
[VP][LangRef] Correct select operands in vp.fptosi docs

2 years ago[RISCV] Add VL patterns for vfwmul/vfwadd/vfwsub
Lian Wang [Thu, 24 Mar 2022 03:26:14 +0000 (03:26 +0000)]
[RISCV] Add VL patterns for vfwmul/vfwadd/vfwsub

Reviewed By: frasercrmck

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

2 years ago[test-release] Added -silent-log flag to test-release.sh
Tobias Hieta [Thu, 31 Mar 2022 06:34:30 +0000 (08:34 +0200)]
[test-release] Added -silent-log flag to test-release.sh

This flag silents the build output of test-release.sh so that
it can be used in CI systems a bit better. It will still log
the build output to the log files but not echo it to stdout.

Reviewed By: tstellar

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

2 years ago[Driver] Move legacy -f[no-]unit-at-a-time to clang_ignored_gcc_optimization_f_Group
Fangrui Song [Thu, 31 Mar 2022 06:20:49 +0000 (23:20 -0700)]
[Driver] Move legacy -f[no-]unit-at-a-time to clang_ignored_gcc_optimization_f_Group

Move to clang_ignored_gcc_optimization_f_Group like other ignored options. This
decreases code size a bit: ~400 bytes on x86-64.

2 years agoMapping of FP operations to constrained intrinsics
Serge Pavlov [Wed, 30 Mar 2022 04:23:49 +0000 (11:23 +0700)]
Mapping of FP operations to constrained intrinsics

A new function 'getConstrainedIntrinsic' is added, which for any gived
instruction returns id of the corresponding constrained intrinsic. If
there is no constrained counterpart for the instruction or the instruction
is already a constrained intrinsic, the function returns zero.

This is recommit of 115b3ace369254f573ca28934ef30ab9d8f497ef, reverted in
8160dd582b67430a5c24c836a57ae3c15cfa973c.

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

2 years ago[LoongArch] Construct codegen infra and generate first add instruction.
wanglei [Thu, 31 Mar 2022 03:48:03 +0000 (11:48 +0800)]
[LoongArch] Construct codegen infra and generate first add instruction.

This patch constructs codegen infra and successfully generate the first
'add' instruction. Add integer calling convention for fixed arguments which
are passed with general-purpose registers.

New test added here:

  CodeGen/LoongArch/ir-instruction/add.ll

The test file is placed in a subdirectory because we will use
subdirctories to distinguish different categories of tests (e.g.
 intrinsic, inline-asm ...)

Reviewed By: MaskRay, SixWeining

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

2 years ago[C++20] [Modules] Use '-' as the separator of partitions when searching
Chuanqi Xu [Thu, 31 Mar 2022 03:21:37 +0000 (11:21 +0800)]
[C++20] [Modules] Use '-' as the separator of partitions when searching
in filesystems

It is simpler to search for module unit by -fprebuilt-module-path
option. However, the separator ':' of partitions is not friendly.
According to the discussion in https://reviews.llvm.org/D118586, I think
we get consensus to use '-' as the separator instead. The '-' is the
choice of GCC too.

Previously I thought it would be better to add an option. But I feel it
is over-engineering now. Another reason here is that there are too many
options for modules (for clang module mainly) now. Given it is not bad
to use '-' when searching, I think it is acceptable to not add an
option.

Reviewed By: iains

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

2 years ago[GVNHoist] drop debug location according to the debug info guide
Aditya Kumar [Wed, 30 Mar 2022 20:20:44 +0000 (13:20 -0700)]
[GVNHoist] drop debug location according to the debug info guide

According to the LLVM debug info update guide: https://llvm.org/docs/HowToUpdateDebugInfo.html,
"Hoisting identical instructions which appear in several successor
blocks into a predecessor block. In this case there is no single
merged instruction. The rule for dropping locations applies".

Thanks to Yuanbo Li for reporting this.

Reviewed By: dblaikie

Reviewers: sebpop, tejohnson, dblaikie

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

2 years ago[mlir][Vector] Fold ShuffleOp if result is identical to one of source vectors.
jacquesguan [Wed, 30 Mar 2022 06:53:47 +0000 (14:53 +0800)]
[mlir][Vector] Fold ShuffleOp if result is identical to one of source vectors.

For example, we could do the following eliminations:
  fold vector.shuffle V1, V2, [0, 1, 2, 3] : <4xi32>, <2xi32> -> V1
  fold vector.shuffle V1, V2, [4, 5] : <4xi32>, <2xi32> -> V2

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

2 years ago[X86] Add test with abs intrinsic for x86-partial-reduction optimization
Wei Xiao [Wed, 30 Mar 2022 14:41:31 +0000 (22:41 +0800)]
[X86] Add test with abs intrinsic for x86-partial-reduction optimization

2 years ago[flang] Correct a typo when parsing format token white space
V Donaldson [Wed, 30 Mar 2022 00:16:39 +0000 (17:16 -0700)]
[flang] Correct a typo when parsing format token white space

A format such as "( D   C, X6. 2  )" is parsed the same as "(DC,X6.2)".

2 years ago[LLDB] Fix NSIndexPathSyntheticFrontEnd::Impl::Clear() to only clear the active union...
Shafik Yaghmour [Thu, 31 Mar 2022 01:00:37 +0000 (18:00 -0700)]
[LLDB] Fix NSIndexPathSyntheticFrontEnd::Impl::Clear() to only clear the active union member

NSIndexPathSyntheticFrontEnd::Impl::Clear() currently calls Clear() on both
unions members regardless of which one is active. I modified it to only call
Clear() on the active member.

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

2 years ago[Utils] Add URL formatting for revert_checker
Jordan R Abrahams-Whitehead [Thu, 31 Mar 2022 00:27:19 +0000 (17:27 -0700)]
[Utils] Add URL formatting for revert_checker

This lets the revert_checker.py get called with the -u option, which
formats the revert and reverted SHAs into handy URLs which point to the
LLVM reviews associated with those SHAs. This is useful for viewers to
look quickly at the changes made by SHAs that were potentially reverted.

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

2 years ago[LoopIdiom] Merge TBAA of adjacent stores when creating memset
Stephen Long [Wed, 30 Mar 2022 23:51:37 +0000 (16:51 -0700)]
[LoopIdiom] Merge TBAA of adjacent stores when creating memset

Factor in the TBAA of adjacent stores instead of just the head store
when merging stores into a memset. We were seeing GVN remove a load that
had a TBAA that matched the 2nd store because GVN determined it didn't
match the TBAA of the memset. The memset had the TBAA of only the first
store.

i.e. Loading the field pi_ of shared_count after memset to create an
array of shared_ptr

template<class T>
class shared_ptr {
  T *p;
  shared_count refcount;
};

class shared_count {
  sp_counted_base *pi_;
};

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

2 years ago[Clang][CodeGen]Beautify dump format, add indent for nested struct and struct members
wangyihan [Wed, 30 Mar 2022 23:38:37 +0000 (07:38 +0800)]
[Clang][CodeGen]Beautify dump format, add indent for nested struct and struct members

Beautify dump format, add indent for nested struct and struct members, also fix test cases in dump-struct-builtin.c
for example:
struct:
```
  struct A {
    int a;
    struct B {
      int b;
      struct C {
        struct D {
          int d;
          union E {
            int x;
            int y;
          } e;
        } d;
        int c;
      } c;
    } b;
  };
```
Before:
```
struct A {
int a = 0
struct B {
    int b = 0
struct C {
struct D {
            int d = 0
union E {
                int x = 0
                int y = 0
                }
            }
        int c = 0
        }
    }
}
```
After:
```
struct A {
    int a = 0
    struct B {
        int b = 0
        struct C {
            struct D {
                int d = 0
                union E {
                    int x = 0
                    int y = 0
                }
            }
            int c = 0
        }
    }
}
```

Reviewed By: erichkeane

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

2 years ago[libc] Improve the performance of expm1f.
Tue Ly [Sun, 27 Mar 2022 04:01:26 +0000 (00:01 -0400)]
[libc] Improve the performance of expm1f.

Improve the performance of expm1f:
- Rearrange the selection logic for different cases to improve the overall
throughput.
- Use the same degree-4 polynomial for large inputs as `expf`
(https://reviews.llvm.org/D122418), reduced from a degree-7 polynomial.

Performance benchmark using perf tool from CORE-MATH project
(https://gitlab.inria.fr/core-math/core-math/-/tree/master):
Before this patch:
```
$ ./perf.sh expm1f

CORE-MATH reciprocal throughput   : 15.362
System LIBC reciprocal throughput : 53.288
LIBC reciprocal throughput        : 54.572

$ ./perf.sh expm1f --latency

CORE-MATH latency   : 57.759
System LIBC latency : 147.146
LIBC latency        : 118.057
```

After this patch:
```
$ ./perf.sh expm1f

CORE-MATH reciprocal throughput   : 15.359
System LIBC reciprocal throughput : 53.188
LIBC reciprocal throughput        : 14.600

$ ./perf.sh expm1f --latency

CORE-MATH latency   : 57.774
System LIBC latency : 147.119
LIBC latency        : 60.280

```

Reviewed By: michaelrj, santoshn, zimmermann6

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

2 years ago[clang-format] Indent import statements in JavaScript.
sstwcw [Wed, 30 Mar 2022 23:17:27 +0000 (23:17 +0000)]
[clang-format] Indent import statements in JavaScript.

[clang-format] Indent import statements in JavaScript.

Take for example this piece of code found at
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import>.

```
for (const link of document.querySelectorAll("nav > a")) {
  link.addEventListener("click", e => {
    e.preventDefault();

    import('/modules/my-module.js')
        .then(module => {
          module.loadPageInto(main);
        })
        .catch(err => {
          main.textContent = err.message;
        });
  });
}
```

Previously the import line would be unindented, looking like this.

```
for (const link of document.querySelectorAll("nav > a")) {
  link.addEventListener("click", e => {
    e.preventDefault();

import('/modules/my-module.js')
        .then(module => {
          module.loadPageInto(main);
        })
        .catch(err => {
          main.textContent = err.message;
        });
  });
}
```

Actually we were going to fix this along with fixing Verilog import
statements.  But the patch got too big.

Reviewed By: MyDeveloperDay, curdeius

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

2 years ago[lldb] Change the way we pick a platform for fat binaries
Jonas Devlieghere [Wed, 30 Mar 2022 17:36:18 +0000 (10:36 -0700)]
[lldb] Change the way we pick a platform for fat binaries

Currently, when creating a target for a fat binary, we error out if more
than one platforms can support the different architectures in the
binary. There are situations where it makes sense for multiple platforms
to support the same architectures: for example the host and
remote-macosx platform on Darwin.

The only way to currently disambiguate between them is to specify the
architecture. This patch changes that to take into account the selected
and host platform. The new algorithm works a follows:

1. Pick the selected platform if it matches any of the architectures.
2. Pick the host platform if it matches any of the architectures.
3. If there's one platform that works for all architectures, pick that.

If none of the above apply then we either have no platform supporting
the architectures in the fat binary or multiple platforms with no good
way to disambiguate between them.

I've added a bunch of unit tests to codify this new behavior.

rdar://90360204

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

2 years agoRevert "[MLIR][Presburger] LexSimplex::addEquality: add equalities as fixed columns"
Arjun P [Wed, 30 Mar 2022 22:24:00 +0000 (23:24 +0100)]
Revert "[MLIR][Presburger] LexSimplex::addEquality: add equalities as fixed columns"

This reverts commit 5630143af33f7e6e0dabdf38982cc9800140bb75. The
implementation in this commit was incorrect. Also, handling this representation
of equalities in the upcoming support for symbolic lexicographic minimization
makes that patch much more complex. It will be easier to review that without
this representaiton and then reintroduce the fixed column representation
later, hence the revert rather than a bug fix.

2 years ago[Debuginfod] Use env to fix debuginfod.test on Win32.
Daniel Thornburgh [Tue, 22 Mar 2022 17:09:51 +0000 (17:09 +0000)]
[Debuginfod] Use env to fix debuginfod.test on Win32.

2 years ago[VPlan] Track current vector loop in VPTransformState (NFC).
Florian Hahn [Wed, 30 Mar 2022 21:16:40 +0000 (22:16 +0100)]
[VPlan] Track current vector loop in VPTransformState (NFC).

Instead of looking up the vector loop using the header, keep track of
the current vector loop in VPTransformState. This removes the
requirement for the vector header block being part of the loop up front.

A follow-up patch will move the code to generate the Loop object for the
vector loop to VPRegionBlock.

Depends on D121619.

Reviewed By: Ayal

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

2 years ago[libcxx] [doc] Update Windows build instructions after deprecating the legacy standal...
Martin Storsjö [Wed, 30 Mar 2022 10:13:45 +0000 (13:13 +0300)]
[libcxx] [doc] Update Windows build instructions after deprecating the legacy standalone builds

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

2 years ago[lldb-vscode] Avoid a -Wunused-but-set-variable warning. NFC.
Martin Storsjö [Wed, 30 Mar 2022 08:57:53 +0000 (11:57 +0300)]
[lldb-vscode] Avoid a -Wunused-but-set-variable warning. NFC.

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

2 years ago[llvm-profgen] Read sample profiles for post-processing.
Hongtao Yu [Wed, 30 Mar 2022 19:27:10 +0000 (12:27 -0700)]
[llvm-profgen] Read sample profiles for post-processing.

Sometimes we would like to run post-processing repeatedly on the original sample profile for tuning. In order to avoid regenerating the original profile from scratch every time, this change adds the support of reading in the original profile (called symbolized profile) and running the post-processor on it.

Reviewed By: wenlei

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

2 years ago[lld/mac] Give range extension thunks for local symbols local visibility
Nico Weber [Tue, 29 Mar 2022 00:17:08 +0000 (20:17 -0400)]
[lld/mac] Give range extension thunks for local symbols local visibility

When two local symbols (think: file-scope static functions, or functions in
unnamed namespaces) with the same name in two different translation units
both needed thunks, ld64.lld previously created external thunks for both
of them. These thunks ended up with the same name, leading to a duplicate
symbol error for the thunk symbols.

Instead, give thunks for local symbols local visibility.

(Hitting this requires a jump to a local symbol from over 128 MiB away.
It's unlikely that a single .o file is 128 MiB large, but with ICF
you can end up with a situation where the local symbol is ICF'd with
a symbol in a separate translation unit. And that can introduce a
large enough jump to require a thunk.)

Fixes PR54599.

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

2 years agoRecommit "[Docs] Add documentation for llvm-remark-size-diff"
Jessica Paquette [Wed, 30 Mar 2022 20:35:50 +0000 (13:35 -0700)]
Recommit "[Docs] Add documentation for llvm-remark-size-diff"

Add it to the toctree for the LLVM command guide.

2 years agoRevert "[Docs] Add documentation for llvm-remark-size-diff"
Jessica Paquette [Wed, 30 Mar 2022 20:34:03 +0000 (13:34 -0700)]
Revert "[Docs] Add documentation for llvm-remark-size-diff"

This reverts commit bdea2afc8c16e51edc8877479623e16261940e00.

Bot failure.

2 years ago[AutoUpgrade] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds
Fangrui Song [Wed, 30 Mar 2022 20:31:17 +0000 (13:31 -0700)]
[AutoUpgrade] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds

2 years ago[Docs] Add documentation for llvm-remark-size-diff
Jessica Paquette [Wed, 30 Mar 2022 16:42:51 +0000 (09:42 -0700)]
[Docs] Add documentation for llvm-remark-size-diff

Add documentation describing how to

- Use `llvm-remark-size-diff`
- Interpret the output from the tool

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

2 years agoDemangle: Fix crash-on-invalid demangling of a module name with no underlying entity
David Blaikie [Wed, 30 Mar 2022 20:18:40 +0000 (20:18 +0000)]
Demangle: Fix crash-on-invalid demangling of a module name with no underlying entity

2 years ago[MC][BOLT] Add setter for AllowAtInName
Amir Ayupov [Tue, 29 Mar 2022 22:54:08 +0000 (15:54 -0700)]
[MC][BOLT] Add setter for AllowAtInName

Use the setter in BOLT to allow printing names with variant kind in the name
(e.g. "func@PLT").
Fixes BOLT buildbot tests that broke after D122516:
https://lab.llvm.org/buildbot/#/builders/215/builds/3595

Reviewed By: maksfb

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

2 years ago[AMDGPU] Remove empty comments in 2 tests. NFC.
Stanislav Mekhanoshin [Wed, 30 Mar 2022 19:56:46 +0000 (12:56 -0700)]
[AMDGPU] Remove empty comments in 2 tests. NFC.

2 years ago[clang][extract-api][NFC] Don't remap the generated input buffer in PPOpts
Daniel Grumberg [Wed, 30 Mar 2022 19:38:09 +0000 (20:38 +0100)]
[clang][extract-api][NFC] Don't remap the generated input buffer in PPOpts

This was triggering some build failures so removing this change for now.

2 years ago[AArch64] Fix AArch64TargetParser.def to match AArch64.td.
Eli Friedman [Tue, 22 Mar 2022 23:41:16 +0000 (16:41 -0700)]
[AArch64] Fix AArch64TargetParser.def to match AArch64.td.

Currently, we have two different lists of features each CPU supports...
and those lists aren't consistent. This patch assumes AArch64.td is
right, and tries to fix AArch64TargetParser to match.

It's hard to find documentation for the right features, but reviewers
have confirmed these changes.

Probably we should try to unify the two lists at some point, but
synchronizing them seems like a prerequisite to that anyway.

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

2 years agoExpanding HLSL attribute diagnostics
Chris Bieneman [Wed, 30 Mar 2022 18:32:24 +0000 (13:32 -0500)]
Expanding HLSL attribute diagnostics

Updating the diagnostics as per the feedback on
https://reviews.llvm.org/D122627.

This change correctly handles missing argument lists, and changes the
subject for the `numthreads` attribute to be global functions.

I did not handle applying the attribute to template functions because
that currently fails parsing in a way that is consisetent with the
current DXC codebase (Microsoft attributes are not supported on
templates).

A future improvement to the diagnostic maybe warranted.

2 years ago[libc++] Ensure that all public C++ headers include <__assert>
Louis Dionne [Fri, 25 Mar 2022 16:55:36 +0000 (12:55 -0400)]
[libc++] Ensure that all public C++ headers include <__assert>

This patch changes the requirement for getting the declaration of the
assertion handler from including <__assert> to including any public
C++ header of the library. Note that C compatibility headers are
excluded because we don't implement all the C headers ourselves --
some of them are taken straight from the C library, like assert.h.

It also adds a generated test to check it. Furthermore, this new
generated test is designed in a way that will make it possible to
replace almost all the existing test-generation scripts with this
system in upcoming patches.

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

2 years ago[VFS] RedirectingFileSystem only replace path if not already mapped
Ben Barham [Sun, 27 Mar 2022 21:08:48 +0000 (14:08 -0700)]
[VFS] RedirectingFileSystem only replace path if not already mapped

If the `ExternalFS` has already remapped a path then the
`RedirectingFileSystem` should not change it to the originally provided
path. This fixes the original path always being used if multiple VFS
overlays were provided and the path wasn't found in the highest (ie.
first in the chain).

This also renames `IsVFSMapped` to `ExposesExternalVFSPath` and only
sets it if `UseExternalName` is true. This flag then represents that the
`Status` has an external path that's different from its virtual path.
Right now the contained path is still the external path, but further PRs
will change this to *always* be the virtual path. Clients that need the
external can then request it specifically.

Note that even though `ExposesExternalVFSPath` isn't set for all
VFS-mapped paths, `IsVFSMapped` was only being used by a hack in
`FileManager` that was specific to module searching. In that case
`UseExternalNames` is always `true` and so that hack still applies.

Resolves rdar://90578880 and llvm-project#53306.

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

2 years ago[RISCV] ISel (and (shift X, C1), C2)) to shift pair in more cases
Craig Topper [Wed, 30 Mar 2022 18:37:34 +0000 (11:37 -0700)]
[RISCV] ISel (and (shift X, C1), C2)) to shift pair in more cases

Previously, these isel optimizations were disabled if the AND could
be selected as a ANDI instruction. This patch disables the optimizations
only if the immediate is valid for C.ANDI. If we can't use C.ANDI,
we might be able to compress the shift instructions instead.

I'm not checking the C extension since we have relatively poor test
coverage of the C extension. Without C extension the code size
should be equal. My only concern would be if the shift+andi had
better latency/throughput on a particular CPU.

I did have to add a peephole to match SRLIW if the input is zexti32
to prevent a regression in rv64zbp.ll.

Reviewed By: luismarques

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