Commit graph

421683 commits

Author SHA1 Message Date
Haojian Wu 82cddb173f [clangd] tweak tile should start with a capital letter.
to consistent with other tweaks.
2022-04-21 11:24:02 +02:00
Nikita Popov 3df86e799e [SimplifyCFG] Handle branch on same condition in pred more directly
Rather than creating a PHI node and then using the PHI threading
code, directly handle this case in
FoldCondBranchOnValueKnownInPredecessor().

This change is supposed to be NFC-ish, but may cause changes due
to different transform order.
2022-04-21 11:22:02 +02:00
Haojian Wu 1234b1c6d8 [AST] Support template declaration found through using-decl for QualifiedTemplateName.
This is a followup of https://reviews.llvm.org/D123127, adding support
for the QualifiedTemplateName.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D123775
2022-04-21 10:53:23 +02:00
Nikita Popov 8988254667 [SimplifyCFG] Make FoldCondBranchOnPHI more amenable to extension
This general threading transform can be performed whenever we know
a constant value for the condition in a predecessor, which would
currently just be the case of a phi node with constant arguments.
2022-04-21 10:49:49 +02:00
gpei-dev 3e6b904f0a Force insert zero-idiom and break false dependency of dest register for several instructions.
The related instructions are:

VPERMD/Q/PS/PD
VRANGEPD/PS/SD/SS
VGETMANTSS/SD/SH
VGETMANDPS/PD - mem version only
VPMULLQ
VFMULCSH/PH
VFCMULCSH/PH

Differential Revision: https://reviews.llvm.org/D116072
2022-04-21 16:47:13 +08:00
Nikita Popov 15fc293b11 Revert "[GVNSink] Regenerate test checks (NFC)"
This reverts commit 3b13230072.

It looks like GVNSink is currently non-deterministic, due to an
std::sort() on BasicBlock* pointers in ModelledPHI. This becomes
visible in the generated checks.
2022-04-21 10:46:34 +02:00
wangpc ce83883691 Revert "[RISCV] Do not outline CFI instructions when they are needed in EH"
This reverts commit 0d40688925.
2022-04-21 16:23:10 +08:00
wangpc 0d40688925 [RISCV] Do not outline CFI instructions when they are needed in EH
We saw a failure caused by unwinding with incomplete CFIs, so we
can't outline CFI instructions when they are needed in EH.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D122634
2022-04-21 16:13:22 +08:00
wangpc 360d44e86d [RISCV] Precommit test for D122634
Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D123364
2022-04-21 16:08:40 +08:00
Nikita Popov 3b13230072 [GVNSink] Regenerate test checks (NFC) 2022-04-21 10:07:09 +02:00
Tobias Hieta 334522ca58 [CMake] Check for problematic MSVC + /arch:AVX configuration
Add a new CMake file to expand on for more problematic configurations
in the future.

Related to #54645

Reviewed By: beanz, phosek, smeenai

Differential Revision: https://reviews.llvm.org/D123777
2022-04-21 09:46:44 +02:00
Chuanqi Xu 7eaa84eac3 [NFC] Code cleanups for coroutine after we remvoed legacy passes 2022-04-21 15:32:46 +08:00
Nimish Mishra 00c511b351 Added lowering support for atomic read and write constructs
This patch adds lowering support for atomic read and write constructs.
Also added is pointer modelling code to allow FIR pointer like types to
be inferred and converted while lowering.

Reviewed By: kiranchandramohan

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

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
2022-04-21 12:19:13 +05:30
Xiang Li b02d88d5af [HLSL] Add shader attribute
Shader attribute is for shader library identify entry functions.
Here's an example,

[shader("pixel")]
float ps_main() : SV_Target {
  return 1;
}

When compile this shader to library target like -E lib_6_3, compiler needs to know ps_main is an entry function for pixel shader. Shader attribute is to offer the information.

A new attribute HLSLShader is added to support shader attribute. It has an EnumArgument which included all possible shader stages.

Reviewed By: aaron.ballman, MaskRay

Differential Revision: https://reviews.llvm.org/D123907
2022-04-20 23:46:43 -07:00
Fraser Cormack 3e678cb772 [RISCV] Don't emit fractional VIDs with negative steps
We can't shift-right negative numbers to divide them, so avoid emitting
such sequences. Use negative numerators as a proxy for this situation, since
the indices are always non-negative.

An alternative strategy could be to add a compiler flag to emit division
instructions, which would at least allow us to test the VID sequence
matching itself.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D123796
2022-04-21 07:00:34 +01:00
Fraser Cormack 627e21048a [RISCV] Add another test showing incorrect BUILD_VECTOR lowering
This test shows a (contrived) BUILD_VECTOR which is correctly identified
as a sequence of ((vid * -3) / 8) + 5. However, the issue is that using
shift-right for the divide is invalid as the step values are negative.

This patch just adds the test: the fix is added in D123796.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D123989
2022-04-21 06:55:13 +01:00
Fangrui Song f4a3569d0a [ELF] Fix spurious GOT/PLT assertion failure when .dynsym is discarded
Linux kernel arch/arm64/kernel/vmlinux.lds.S discards .dynsym . D123985 triggers
a spurious assertion failure. Detect the case with
`!mainPart->dynSymTab->getParent()`.
2022-04-20 22:49:49 -07:00
River Riddle 0fd3a1ce60 [mlir][NFC] Update remaining textual references of un-namespaced func operations
The special case parsing of operations in the `func` dialect is being removed, and
operations will require the dialect namespace prefix.
2022-04-20 22:17:31 -07:00
River Riddle cda6aa78f8 [mlir][NFC] Update textual references of func to func.func in Transform tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:30 -07:00
River Riddle a4936cb3e8 [mlir][NFC] Update textual references of func to func.func in Pass/Target tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:30 -07:00
River Riddle 63237cddc1 [mlir][NFC] Update textual references of func to func.func in tool/runner tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:30 -07:00
River Riddle 6a99d29022 [mlir][NFC] Update textual references of func to func.func in IR/Interface tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:30 -07:00
River Riddle 87db8e4439 [mlir][NFC] Update textual references of func to func.func in Integration tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:29 -07:00
River Riddle c48e3a13f3 [mlir][NFC] Update textual references of func to func.func in Tensor/Tosa/Vector tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:29 -07:00
River Riddle 2c7836ef15 [mlir][NFC] Update textual references of func to func.func in SPIRV tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:29 -07:00
River Riddle fb35cd3baf [mlir][NFC] Update textual references of func to func.func in SparseTensor tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:29 -07:00
River Riddle 0254b0bcf0 [mlir][NFC] Update textual references of func to func.func in LLVM/Math/MemRef/NVGPU/OpenACC/OpenMP/Quant/SCF/Shape tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:28 -07:00
River Riddle 92d38adb83 [mlir][NFC] Update textual references of func to func.func in Linalg tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:28 -07:00
River Riddle 412b8850f6 [mlir][NFC] Update textual references of func to func.func in Bufferization/Complex/EmitC/CF/Func/GPU tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:28 -07:00
River Riddle 5e7dea225b [mlir][NFC] Update textual references of func to func.func in AMX/Arithmetic/ArmSVE/Async tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:28 -07:00
River Riddle 227ed2f448 [mlir][NFC] Update textual references of func to func.func in Affine/ tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:27 -07:00
River Riddle 3028bf740e [mlir][NFC] Update textual references of func to func.func in Conversion/ tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:27 -07:00
River Riddle ccaabff131 [mlir][NFC] Update textual references of func to func.func in Analysis/ tests
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:27 -07:00
River Riddle 8ae83bb8be [mlir][NFC] Update textual references of func to func.func in ODS documentation
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:26 -07:00
River Riddle 2310ced874 [mlir][NFC] Update textual references of func to func.func in examples+python scripts
The special case parsing of `func` operations is being removed.
2022-04-20 22:17:26 -07:00
Craig Topper 186d5c8af5 [RISCV] Make getInstSeqCost handle other Zb* instructions.
We haven't been updating this as Zb* instructions have been used
for immediate materialization. They will hit the default case and
trigger an llvm_unreachable. Instead of trying to list them all,
assume instructions that aren't explicitly listed aren't compressible.

Spotted while looking at integer materialization for other reasons.
I haven't seen a crash from this yet.
2022-04-20 22:08:04 -07:00
Chuanqi Xu ce2257d69f [C++20] [Modules] Judge current module correctly
Now the implementation would accept following code:
```
//--- impl.cppm
module M:impl;
class A {};

//--- M.cppm
export module M;
import :impl;

//--- Use.cpp
import M;
void test() {
    A a; // Expected error. A is not visible here.
}
```

which is clearly wrong.  The root cause is the implementation of
`isInCurrentModule` would return true if the module is a partition! So
in the above example, although Use.cpp is not a module unit,
`isInCurrentModule ` would still return true when the compiler tries to
see if the owning module of `A` is the current module. I believe this is
an oversight. This patch tries to fix this problem.

Reviewed By: iains

Differential Revision: https://reviews.llvm.org/D123837
2022-04-21 11:09:55 +08:00
Chuanqi Xu 483efc9ad0 [Pipelines] Remove Legacy Passes in Coroutines
The legacy passes are deprecated now and would be removed in near
future. This patch tries to remove legacy passes in coroutines.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D123918
2022-04-21 10:59:11 +08:00
hsmahesha 5bd87350a5 [AMDGPU] On gfx908, reserve VGPR for AGPR copy based on register budget.
Based on available register budget, reserve highest available VGPR for
AGPR copy before RA. After RA, shift it to lowest unused VGPR if the one
exist.

Fixes SWDEV-330006.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D123525
2022-04-21 07:57:26 +05:30
Weining Lu 3a49ad717c [LoongArch] Add basic floating-point instructions definition
These instructions are added by following the `LoongArch Reference
Manual Volume 1: Basic Architecture Version 1.00`.

Differential Revision: https://reviews.llvm.org/D123988
2022-04-21 10:04:20 +08:00
Shraiysh Vaishay 88bb2521b0 [mlir][OpenMP] Add checks and tests for hint clause and fix empty hint
This patch handles empty hint value for critical and atomic constructs.

This also adds checks and tests for hint clause on atomic constructs.

Reviewed By: peixin, kiranchandramohan, NimishMishra

Differential Revision: https://reviews.llvm.org/D123186
2022-04-21 07:31:03 +05:30
hsmahesha 7895c87367 [AMDGPU] Split the lit test spill-vgpr-to-agpr.ll to different tests
[1]. Move the test which reject the usage of agpr before gfx908 into a separate file - reject-agpr-usage-before-gfx908.ll.
[2]. Move those tests which are applicable to both gfx900 and gfx908 into a separate file - spill-vgpr.ll.
[3]. Keep those tests which are specific to only gfx908 in the file spill-vgpr-to-agpr.ll.

Above split is required to properly update the tests in D123525.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D123973
2022-04-21 07:16:58 +05:30
Richard Smith 72315d02c4 Treat std::move, forward, etc. as builtins.
This is extended to all `std::` functions that take a reference to a
value and return a reference (or pointer) to that same value: `move`,
`forward`, `move_if_noexcept`, `as_const`, `addressof`, and the
libstdc++-specific function `__addressof`.

We still require these functions to be declared before they can be used,
but don't instantiate their definitions unless their addresses are
taken. Instead, code generation, constant evaluation, and static
analysis are given direct knowledge of their effect.

This change aims to reduce various costs associated with these functions
-- per-instantiation memory costs, compile time and memory costs due to
creating out-of-line copies and inlining them, code size at -O0, and so
on -- so that they are not substantially more expensive than a cast.
Most of these improvements are very small, but I measured a 3% decrease
in -O0 object file size for a simple C++ source file using the standard
library after this change.

We now automatically infer the `const` and `nothrow` attributes on these
now-builtin functions, in particular meaning that we get a warning for
an unused call to one of these functions.

In C++20 onwards, we disallow taking the addresses of these functions,
per the C++20 "addressable function" rule. In earlier language modes, a
compatibility warning is produced but the address can still be taken.

The same infrastructure is extended to the existing MSVC builtin
`__GetExceptionInfo`, which is now only recognized in namespace `std`
like it always should have been.

This is a re-commit of
  fc30901096,
  a571f82a50,
  64c045e25b, and
  de6ddaeef3,
and reverts aa643f455a.
This change also includes a workaround for users using libc++ 3.1 and
earlier (!!), as apparently happens on AIX, where std::move sometimes
returns by value.

Reviewed By: aaron.ballman

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

Revert "Fixup D123950 to address revert of D123345"

This reverts commit aa643f455a.
2022-04-20 17:58:31 -07:00
Muhammad Omair Javaid e3cd8fedca [LLDB] Skip TestCrashDuringStep.py AArch64/Windows
TestCrashDuringStep.py hangs on AArch64 windows with no resonable
possible fix. I am marking it skipped for now.
2022-04-21 05:10:37 +05:00
Maksim Panchenko 76981fbcf6 [BOLT] Add fuzzy function name matching for LLVM LTO
LLVM with LTO can generate function names in the form
func.llvm.<number>, where <number> could vary based on the compilation
environment. As a result, if a profiled binary originated from a
different build than a corresponding binary used for BOLT optimization,
then profiles for such LTO functions will be ignored.

To fix the problem, use "fuzzy" matching with "func.llvm.*" form.

Reviewed By: yota9, Amir

Differential Revision: https://reviews.llvm.org/D124117
2022-04-20 17:00:21 -07:00
David Tenty aa643f455a Fixup D123950 to address revert of D123345
Since D123345 got reverted Builtin::BIaddressof and Builtin::BI__addressof don't exist and cause build breaks.
2022-04-20 19:59:07 -04:00
Alexander Yermolovich 7d6716786f [BOLT][DWARF] Handle Error returned by visitLocationList
Looks like implementation in llvm changed, and now we need to process error
being returned.

Reviewed By: maksfb

Differential Revision: https://reviews.llvm.org/D124133
2022-04-20 16:40:46 -07:00
David Tenty 98d911e01f Revert "Treat std::move, forward, etc. as builtins."
This reverts commit b27430f9f4 as the
    parent https://reviews.llvm.org/D123345 breaks the AIX CI:

    https://lab.llvm.org/buildbot/#/builders/214/builds/819
2022-04-20 19:14:37 -04:00
David Tenty de6ddaeef3 Revert "Don't treat 'T &forward(T&&)' as builtin."
This reverts commit e43c93dd63 as the
parent https://reviews.llvm.org/D123345 breaks the AIX CI.
2022-04-20 19:14:36 -04:00
Evgeny Mankov c23147106f [clang][CUDA][Windows] Fix compilation error on Windows with uint32_t __nvvm_get_smem_pointer
The change fixes https://github.com/llvm/llvm-project/issues/54609 (the second reported issue) by eliminating a compilation error occurring only on Windows while trying to compile any CUDA source file by clang (-x cuda).

[Repro]
clang -x cuda <any_cu_source>

[Error]

__clang_cuda_runtime_wrapper.h:473:
__clang_cuda_intrinsics.h(517,19): error GC871EEFB: unknown type name 'uint32_t'; did you mean 'cuuint32_t'?
__device__ inline uint32_t __nvvm_get_smem_pointer(void *__ptr) {
                          ^
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/include\cuda.h:57:26: note: 'cuuint32_t' declared here
typedef unsigned __int32 cuuint32_t;

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D122897
2022-04-21 00:41:20 +03:00