Philip Reames [Fri, 10 Jun 2022 19:45:54 +0000 (12:45 -0700)]
[RISCV] Add cost model coverage for scalable scatter/gather
Mitch Phillips [Fri, 10 Jun 2022 19:45:26 +0000 (12:45 -0700)]
Add documentation of new sanitizer-specific GV attributes.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D126922
Mitch Phillips [Fri, 10 Jun 2022 19:24:36 +0000 (12:24 -0700)]
Add sanitizer-specific GlobalValue attributes.
Plan is the migrate the global variable metadata for sanitizers, that's
currently carried around generally in the 'llvm.asan.globals' section,
onto the global variable itself.
This patch adds the attribute and plumbs it through the LLVM IR and
bitcode formats, but is a no-op other than that so far.
Reviewed By: vitalybuka, kstoimenov
Differential Revision: https://reviews.llvm.org/D126100
John Ericson [Fri, 10 Jun 2022 19:26:12 +0000 (19:26 +0000)]
Revert "[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore"
This reverts commit
d5daa5c5b091cafb9b7ffd19b5dfa2daadef3229.
Dávid Bolvanský [Fri, 10 Jun 2022 19:17:52 +0000 (21:17 +0200)]
[Clang] Added missing doc for minsize attribute
Fixes https://github.com/llvm/llvm-project/issues/53226
Louis Dionne [Fri, 10 Jun 2022 19:14:57 +0000 (15:14 -0400)]
[libc++] Make sure we install the modulemap file with install-cxx-headers
Sam Estep [Fri, 10 Jun 2022 19:08:41 +0000 (19:08 +0000)]
[clang][dataflow] Don't `assert` full LHS coverage in `optional` model
Followup to D127434.
Reviewed By: ymandel, sgatev
Differential Revision: https://reviews.llvm.org/D127502
Sunho Kim [Fri, 10 Jun 2022 18:34:49 +0000 (03:34 +0900)]
[JITLink][ELF][AArch64] Implement eh frame handling.
Implements eh frame handling by using generic EHFrame passes. The c++ exception handling works correctly with this change.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D127063
Philip Reames [Fri, 10 Jun 2022 19:01:16 +0000 (12:01 -0700)]
[RISCV] Add cost model coverage for mask reductions requiring legalization
Krzysztof Drewniak [Thu, 2 Jun 2022 20:19:41 +0000 (20:19 +0000)]
[mlir][AMDGPU] Set ABI version constant when linking device libs
Currently, linking the device libraries requires setting a constant
that indicates the code object ABI version the compilation is
targeting.
This fixes the MLIR linking process by setting this constant to 400,
which is the value corresponding to the current code object ABI
default, version 4.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D126913
Shraiysh Vaishay [Fri, 10 Jun 2022 17:37:18 +0000 (23:07 +0530)]
[OpenMP][IRBuilder] Add final clause to task
This patch adds final clause to OpenMP IR Builder.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D126626
Nikolas Klauser [Fri, 10 Jun 2022 10:42:46 +0000 (12:42 +0200)]
[libc++] Remove uses of __two in type_traits
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D127483
Mariusz Borsa [Fri, 10 Jun 2022 16:40:17 +0000 (09:40 -0700)]
Revert "[Sanitizers] Cleanup handling of stat64/statfs64"
This reverts commit
6d890a0fb8b1962cf7b58e9e16ff4545f1f2b84f.
Jay Foad [Tue, 5 Apr 2022 12:38:57 +0000 (13:38 +0100)]
Update *_TMPRING_SIZE.WAVESIZE for GFX11
The encoding of COMPUTE_TMPRING_SIZE.WAVESIZE and
SPI_TMPRING_SIZE.WAVESIZE has changed in GFX11: it is now in units
of 64 dwords instead of 256 dwords, and the field has been widened
from 13 bits to 15 bits.
Depends on D126989
Reviewed By: rampitec, arsenm, #amdgpu
Differential Revision: https://reviews.llvm.org/D127248
Thomas Raoux [Mon, 6 Jun 2022 20:56:50 +0000 (20:56 +0000)]
[mlir][vector] Add patterns for vector distribution
Add pattern to hoist scalar code outside of warp distribute region as
those cannot be distributed and we would want to execute them on all
the lanes.
Add patterns to distribute transfer_write ops. Those operations can be
distributed in different ways and it is control by user.
Differential Revision: https://reviews.llvm.org/D127152
Kai Nacke [Thu, 9 Jun 2022 16:54:40 +0000 (12:54 -0400)]
[SystemZ/z/OS] Set DWARF version to 4 for z/OS.
The DWARF version was raised to 5 for all platforms which do not opt
out. Default to DWARF version to 4 for z/OS again.
Reviewed By: abhina.sreeskantharajan, uweigand
Differential Revision: https://reviews.llvm.org/D127498
Joe Nash [Mon, 6 Jun 2022 18:05:52 +0000 (14:05 -0400)]
[AMDGPU] gfx11 add bits to COMPUTE_PGM_RSRC3
Contributors:
Konstantin Zhuravlyov <kzhuravl_dev@outlook.com>
Patch 21/N for upstreaming of AMDGPU gfx11 architecture
Depends on D127143
Reviewed By: rampitec, #amdgpu, kzhuravl
Differential Revision: https://reviews.llvm.org/D127241
Shivam Gupta [Fri, 10 Jun 2022 05:29:50 +0000 (10:59 +0530)]
[NFC] Suggest Release mode in clang GettingStarted.html
This fix https://github.com/llvm/llvm-project/issues/23841.
Lots of beginners are not of aware of this option do suggesting it here
would be helpful.
Christopher Di Bella [Wed, 1 Jun 2022 22:12:38 +0000 (22:12 +0000)]
[clang][tablegen] adds human documentation to `WarningOption`
Building on D126796, this commit adds the infrastructure for being able
to print out descriptions of what each warning does.
Differential Revision: https://reviews.llvm.org/D126832
Joe Nash [Thu, 9 Jun 2022 14:32:27 +0000 (10:32 -0400)]
[AMDGPU] NFC. Comment change to GFX10+ in AsmParser
Joe Nash [Mon, 6 Jun 2022 19:33:15 +0000 (15:33 -0400)]
[AMDGPU] gfx11 SRC_POPS_EXISTING_WAVE_ID is removed
Michael Jones [Wed, 1 Jun 2022 21:42:57 +0000 (14:42 -0700)]
[libc] add buffering to FILE writes
Previously all FILE objects were fully buffered, this patch adds line
buffering and unbuffered output, as well as applying them to stdout and
stderr.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D126829
Benjamin Kramer [Fri, 10 Jun 2022 16:47:40 +0000 (18:47 +0200)]
[libc][math] Add EXP_MANT_MASK when long double is double or quad
Sanjay Patel [Fri, 10 Jun 2022 14:44:13 +0000 (10:44 -0400)]
[InstCombine] add narrowing transform for low-masked binop with zext operand (2nd try)
The 1st try (
afa192cfb6049a15c55 ) was reverted because it could
cause an infinite loop with constant expressions.
A test for that and an extra condition to enable the transform
are added now. I also added code comments to better describe
the transform and the existing, related transform.
Original commit message:
https://alive2.llvm.org/ce/z/hRy3rE
As shown in D123408, we can produce this pattern when moving
casts around, and we already have a related fold for a binop
with a constant operand.
Sanjay Patel [Fri, 10 Jun 2022 14:36:41 +0000 (10:36 -0400)]
[InstCombine] add test for mask op with constant expression; NFC
This is reduced from the post-commit C example in:
afa192cfb6049a15
That was reverted with:
6fedc6a2b41e458f
This will infinite loop unless that transform or the ones
with casts that can "EvaluateInDifferentType" are limited
to ignore constant expressions.
Yusra Syeda [Fri, 10 Jun 2022 14:52:05 +0000 (10:52 -0400)]
[SystemZ][z/OS] Add llvm.read_register() intrinsic support for zOS
Differential Revision: https://reviews.llvm.org/D127412
Shao-Ce SUN [Fri, 10 Jun 2022 16:11:13 +0000 (00:11 +0800)]
[RISCV] move `isFaultFirstLoad` into `RISCVInstrInfo`
Fix build errors in D126794
```
ld.lld: error: undefined symbol: llvm::MachineInstr::getNumExplicitDefs() const
>>> referenced by RISCVBaseInfo.cpp
>>> RISCVBaseInfo.cpp.o:(llvm::isFaultFirstLoad(llvm::MachineInstr const&)) in archive lib/libLLVMRISCVDesc.a
ld.lld: error: undefined symbol: llvm::MachineInstr::findRegisterDefOperandIdx(llvm::Register, bool, bool, llvm::TargetRegisterInfo const*) const
>>> referenced by RISCVBaseInfo.cpp
>>> RISCVBaseInfo.cpp.o:(llvm::isFaultFirstLoad(llvm::MachineInstr const&)) in archive lib/libLLVMRISCVDesc.a
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
```
Reviewed By: fakepaper56, craig.topper
Differential Revision: https://reviews.llvm.org/D127477
Jay Foad [Fri, 10 Jun 2022 16:05:29 +0000 (17:05 +0100)]
[AMDGPU] Restore documentation of .amdhsa_shared_vgpr_count
This was accidentally lost in D127402.
Shao-Ce SUN [Fri, 10 Jun 2022 16:02:45 +0000 (00:02 +0800)]
Revert "[RISCV] move `isFaultFirstLoad` into `RISCVInstrInfo`"
This reverts commit
e018e493c1ac514504bbaa1d1396aec025142a31.
There are some problems with this commit,
related revision: https://reviews.llvm.org/D127477
Philip Reames [Fri, 10 Jun 2022 15:57:27 +0000 (08:57 -0700)]
[RISCV] Fix accidental deletion of test lines in 2247e4d
Apparently, update_analyze_test_checks.sh does *not* warn on conflicting CHECKs, it just silently drops those lines from the generated test. That is.. less than helpful.
Paul Robinson [Thu, 9 Jun 2022 18:17:16 +0000 (11:17 -0700)]
[PS5] Use linker scripting to find profiling data, like PS4
Craig Topper [Fri, 10 Jun 2022 15:36:31 +0000 (08:36 -0700)]
[RISCV] Mark FSIN and other math functions as Expand for scalable vectors.
This prevents them from being assumed legal by the cost model.
This matches what is done for AArch64 SVE.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D123799
Philip Reames [Fri, 10 Jun 2022 15:27:12 +0000 (08:27 -0700)]
[RISCV] Use common prefixes to reduce duplication in cost model tests
Nikita Popov [Fri, 10 Jun 2022 15:31:10 +0000 (17:31 +0200)]
[DCE] Update tests to use opaque pointers (NFC)
Andrzej Warzynski [Fri, 10 Jun 2022 15:26:13 +0000 (15:26 +0000)]
[flang][lowering] Ignore compiler directives
This patch simply replaces a `TODO` with a warning.
This is part of the upstreaming effort from the `fir-dev` branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D127415
Guillaume Chatelet [Fri, 10 Jun 2022 15:20:07 +0000 (15:20 +0000)]
[NFC][Alignment] Simplify code
Adrian Prantl [Fri, 10 Jun 2022 15:16:30 +0000 (08:16 -0700)]
[LLDB][Docs] Fix formatting of example code-block
Tested by building the docs-lldb-html target and
confirming the code-block renders properly with
the fix.
Patch by Michael Buch!
Differential Revision: https://reviews.llvm.org/D127437
Nikita Popov [Fri, 10 Jun 2022 15:07:27 +0000 (17:07 +0200)]
[InstSimplify] Convert tests to opaque pointers (NFC)
The only interesting test change is in @PR31262, where the following
fold is now performed, while it previously was not:
https://alive2.llvm.org/ce/z/a5Qmr6
llvm/test/Transforms/InstSimplify/ConstProp/gep.ll has not been
updated, because there is a tradeoff between folding and inrange
preservation there that we may want to discuss.
Updates have been performed using:
https://gist.github.com/nikic/
98357b71fd67756b0f064c9517b62a34
Guillaume Chatelet [Fri, 10 Jun 2022 15:13:25 +0000 (15:13 +0000)]
[NFC] Remove deadcode
Philip Reames [Fri, 10 Jun 2022 15:07:55 +0000 (08:07 -0700)]
[RISCV] Broaden cost model coverage for fixed vectors w/i1 element type
Simon Pilgrim [Fri, 10 Jun 2022 14:49:49 +0000 (15:49 +0100)]
[DAG] SimplifyDemandedVectorElts - adding SimplifyMultipleUseDemandedVectorElts handling to ISD::CONCAT_VECTORS
Attempt to look through multiple use operands of ISD::CONCAT_VECTORS nodes
Another minor improvement for D127115
Nikita Popov [Fri, 10 Jun 2022 14:56:13 +0000 (16:56 +0200)]
[InstSimplify] Name variables/labels in test (NFC)
Run the test through -instnamer. Also drop irrelevant uwtable
attribute.
Nikita Popov [Fri, 10 Jun 2022 14:52:53 +0000 (16:52 +0200)]
[InstSimplify] Regenerate test checks (NFC)
Sam Estep [Fri, 10 Jun 2022 14:50:22 +0000 (14:50 +0000)]
[clang][dataflow] In `optional` model, match call return via hasType
Currently the unchecked-optional-access model fails on this example:
#include <memory>
#include <optional>
void foo() {
std::unique_ptr<std::optional<float>> x;
*x = std::nullopt;
}
You can verify the failure by saving the file as `foo.cpp` and running this command:
clang-tidy -checks='-*,bugprone-unchecked-optional-access' foo.cpp -- -std=c++17
The failing `assert` is in the `transferAssignment` function of the `UncheckedOptionalAccessModel.cpp` file:
assert(OptionalLoc != nullptr);
The symptom can be treated by replacing that `assert` with an early `return`:
if (OptionalLoc == nullptr)
return;
That would be better anyway since we cannot expect to always cover all possible LHS expressions, but it is out of scope for this patch and left as a followup.
Note that the failure did not occur on this very similar example:
#include <optional>
template <typename T>
struct smart_ptr {
T& operator*() &;
T* operator->();
};
void foo() {
smart_ptr<std::optional<float>> x;
*x = std::nullopt;
}
The difference is caused by the `isCallReturningOptional` matcher, which was previously checking the `functionDecl` of the `callee`. This patch changes it to instead use `hasType` directly on the call expression, fixing the failure for the `std::unique_ptr` example above.
Reviewed By: sgatev
Differential Revision: https://reviews.llvm.org/D127434
John Ericson [Sat, 8 Jan 2022 09:00:53 +0000 (09:00 +0000)]
[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore
First of all, `LLVM_TOOLS_INSTALL_DIR` put there breaks our NixOS
builds, because `LLVM_TOOLS_INSTALL_DIR` defined the same as
`CMAKE_INSTALL_BINDIR` becomes an *absolute* path, and then when
downstream projects try to install there too this breaks because our
builds always install to fresh directories for isolation's sake.
Second of all, note that `LLVM_TOOLS_INSTALL_DIR` stands out against the
other specially crafted `LLVM_CONFIG_*` variables substituted in
`llvm/cmake/modules/LLVMConfig.cmake.in`.
@beanz added it in
d0e1c2a550ef348aae036d0fe78cab6f038c420c to fix a
dangling reference in `AddLLVM`, but I am suspicious of how this
variable doesn't follow the pattern.
Those other ones are carefully made to be build-time vs install-time
variables depending on which `LLVMConfig.cmake` is being generated, are
carefully made relative as appropriate, etc. etc. For my NixOS use-case
they are also fine because they are never used as downstream install
variables, only for reading not writing.
To avoid the problems I face, and restore symmetry, I deleted the
exported and arranged to have many `${project}_TOOLS_INSTALL_DIR`s.
`AddLLVM` now instead expects each project to define its own, and they
do so based on `CMAKE_INSTALL_BINDIR`. `LLVMConfig` still exports
`LLVM_TOOLS_BINARY_DIR` which is the location for the tools defined in
the usual way, matching the other remaining exported variables.
For the `AddLLVM` changes, I tried to copy the existing pattern of
internal vs non-internal or for LLVM vs for downstream function/macro
names, but it would good to confirm I did that correctly.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D117977
Joe Nash [Mon, 6 Jun 2022 19:33:15 +0000 (15:33 -0400)]
[AMDGPU] gfx11 EXECZ and VCCZ are no longer allowed to be used as
sources to SALU and VALU instructions.
Contributors:
Baptiste Saleil <baptiste.saleil@amd.com>
Patch 20/N for upstreaming of AMDGPU gfx11 architecture
Depends on D126989
Reviewed By: rampitec, foad, #amdgpu
Differential Revision: https://reviews.llvm.org/D127143
Nuno Lopes [Fri, 10 Jun 2022 14:28:57 +0000 (15:28 +0100)]
[NFC] remove 'br undef' from InstCombine test cases
This is UB and allows the compiler to give any result, so these tests weren't meaningful
InstCombine tests are now clean of 'br undef'
Simon Tatham [Fri, 10 Jun 2022 14:18:06 +0000 (15:18 +0100)]
[Clang,ARM] Add release note for D127197.
I should have put that in the original commit, but @lenary only just
reminded me that it needed to be there.
Nikita Popov [Fri, 10 Jun 2022 13:48:34 +0000 (15:48 +0200)]
[InstCombine] Add additional cost of phi tests (NFC)
These check for undesirable folds for a cast of a loop phi.
Louis Dionne [Fri, 10 Jun 2022 14:11:24 +0000 (10:11 -0400)]
[libc++][NFC] Fix indentation of some #if directives
Jay Foad [Tue, 7 Jun 2022 16:21:00 +0000 (17:21 +0100)]
[AMDGPU] Basic implementation of isExtractSubvectorCheap
Add a basic implementation of isExtractSubvectorCheap that only
considers extracts at offset 0.
Differential Revision: https://reviews.llvm.org/D127385
Ivan Kosarev [Fri, 10 Jun 2022 13:18:29 +0000 (14:18 +0100)]
[TableGen][CodeEmitterGen] Do not crash on insufficient positional instruction operands.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D126288
Hans Wennborg [Wed, 8 Jun 2022 13:08:46 +0000 (15:08 +0200)]
[SimplifyCFG] Share code to compute switch density between ShouldBuildLookupTable() and ReduceSwitchRange()
They're computing the same thing. No functionality change.
Differential revision: https://reviews.llvm.org/D127482
Guillaume Chatelet [Tue, 7 Jun 2022 09:51:32 +0000 (09:51 +0000)]
[clang] Add support for __builtin_memset_inline
In the same spirit as D73543 and in reply to https://reviews.llvm.org/D126768#3549920 this patch is adding support for `__builtin_memset_inline`.
The idea is to get support from the compiler to easily write efficient memory function implementations.
This patch could be split in two:
- one for the LLVM part adding the `llvm.memset.inline.*` intrinsics.
- and another one for the Clang part providing the instrinsic as a builtin.
Differential Revision: https://reviews.llvm.org/D126903
Nuno Lopes [Fri, 10 Jun 2022 13:06:32 +0000 (14:06 +0100)]
[NFC] Add 3 more -inseltpoison.ll test variations
Shao-Ce SUN [Fri, 10 Jun 2022 08:53:34 +0000 (16:53 +0800)]
[RISCV] move `isFaultFirstLoad` into `RISCVInstrInfo`
Fix build errors in D126794
```
ld.lld: error: undefined symbol: llvm::MachineInstr::getNumExplicitDefs() const
>>> referenced by RISCVBaseInfo.cpp
>>> RISCVBaseInfo.cpp.o:(llvm::isFaultFirstLoad(llvm::MachineInstr const&)) in archive lib/libLLVMRISCVDesc.a
ld.lld: error: undefined symbol: llvm::MachineInstr::findRegisterDefOperandIdx(llvm::Register, bool, bool, llvm::TargetRegisterInfo const*) const
>>> referenced by RISCVBaseInfo.cpp
>>> RISCVBaseInfo.cpp.o:(llvm::isFaultFirstLoad(llvm::MachineInstr const&)) in archive lib/libLLVMRISCVDesc.a
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
```
Reviewed By: fakepaper56
Differential Revision: https://reviews.llvm.org/D127477
Nico Weber [Fri, 10 Jun 2022 12:36:34 +0000 (08:36 -0400)]
Revert "[analyzer] Deprecate `-analyzer-store region` flag"
This reverts commit
d50d9946d1d7e5f20881f0bc71fbd025040b1c96.
Broke check-clang, see comments on https://reviews.llvm.org/D126067
Also revert dependent change "[analyzer] Deprecate the unused 'analyzer-opt-analyze-nested-blocks' cc1 flag"
This reverts commit
07b4a6d0461fe64e10d30029ed3d598e49ca3810.
Also revert "[analyzer] Fix buildbots after introducing a new frontend warning"
This reverts commit
90374df15ddc58d823ca42326a76f58e748f20eb.
(See https://reviews.llvm.org/rG90374df15ddc58d823ca42326a76f58e748f20eb)
Balazs Benics [Fri, 10 Jun 2022 12:47:23 +0000 (14:47 +0200)]
[analyzer] Fix buildbots after introducing a new frontend warning
It seems like I should have ran the `check-clang` target after introducing a new warning diagnostic entry.
My bad. I'll run it next time; `check-clang-analysis` was not enough.
Here is a link to the broken bot: http://45.33.8.238/linux/78236/step_7.txt
This commit should fix this.
Differential Revision: https://reviews.llvm.org/D126067
Simon Pilgrim [Fri, 10 Jun 2022 12:29:04 +0000 (13:29 +0100)]
[X86] combineMulToPMADDWD - don't bitcast the source ops before splitting to ensure we split the build vectors early
Fixes a regression on D127115 - splitting was creating extract_subvector(bitcast(build_vector())) patterns which prevented the build vectors being split before being bitcast to vXi16 types, resulting in various issues with further folding of the (now legal) build vectors
Guillaume Chatelet [Fri, 10 Jun 2022 12:36:40 +0000 (12:36 +0000)]
[NFC] Use proper getSliceAlign type in SROA
Sanjay Patel [Fri, 10 Jun 2022 12:12:02 +0000 (08:12 -0400)]
Revert "[InstCombine] add narrowing transform for low-masked binop with zext operand"
This reverts commit
afa192cfb6049a15c5542d132d500b910b802c74.
This can cause an infinite loop as shown with an example in the
post-commit thread.
Ivan Kosarev [Fri, 10 Jun 2022 09:06:45 +0000 (10:06 +0100)]
[AMDGPU][GFX9][GFX10] Support base+soffset+offset SMEM atomics.
Resolves a part of
https://github.com/llvm/llvm-project/issues/38652
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D127314
David Sherwood [Tue, 31 May 2022 14:54:49 +0000 (15:54 +0100)]
[InstCombine] Use +0.0 instead of -0.0 as the FP identity for some folds
In foldSelectIntoOp we sometimes transform a select of a fadd into a
fadd of a select, where we select between data and an identity value.
For both fadd and fsub the identity is always -0.0, but if the nsz
flag is set on the select instruction we can use +0.0 instead. Doing
so then triggers other optimisations, such as when folding the select
of masked load into a new masked load.
Differential Revision: https://reviews.llvm.org/D126774
Diana Picus [Fri, 10 Jun 2022 11:36:52 +0000 (11:36 +0000)]
[flang] Fix RUN line in test from 3e782ba
The current RUN line leaves a parse-ir-error.s file around, which might
confuse the buildbots. Direct the output into the void instead (although
it would probably be better to direct it to FileCheck).
Shivam Gupta [Fri, 10 Jun 2022 11:25:55 +0000 (16:55 +0530)]
[NFC] update clang-tools-extra README.txt
Markus Mützel [Fri, 10 Jun 2022 08:31:42 +0000 (08:31 +0000)]
[flang][runtime] Remove dependency on C++ <mutex> on Windows
The implementation of the Lock class on Windows currently uses C++
mutexes. That introduces a dependency on the C++ runtime on that
platform.
Use a Windows CriticalSection instead of a std::mutex to avoid that
dependency.
This works for me with MinGW (tested in a CLANG64 environment of MSYS2).
See also D126291.
Differential Revision: https://reviews.llvm.org/D127316
Balazs Benics [Fri, 10 Jun 2022 11:21:28 +0000 (13:21 +0200)]
[clang-tidy] Remove reference to CSA AnalysisStoreOpt field
D126215 removed the `AnalysisStoreOpt` field, so `clang-tidy` should not
refer to it.
http://45.33.8.238/linux/78232/step_4.txt
../../clang-tools-extra/clang-tidy/ClangTidy.cpp:444:22: error: no
member named 'AnalysisStoreOpt' in 'clang::AnalyzerOptions'
AnalyzerOptions->AnalysisStoreOpt = RegionStoreModel;
~~~~~~~~~~~~~~~~~^
../../clang-tools-extra/clang-tidy/ClangTidy.cpp:444:41: error: use of
undeclared identifier 'RegionStoreModel'
AnalyzerOptions->AnalysisStoreOpt = RegionStoreModel;
This one liner patch should resolve the build failure.
Differential Revision: https://reviews.llvm.org/D126215
Balazs Benics [Fri, 10 Jun 2022 11:09:37 +0000 (13:09 +0200)]
[analyzer] Deprecate the unused 'analyzer-opt-analyze-nested-blocks' cc1 flag
This flag was introduced by
https://github.com/llvm/llvm-project/commit/
6818991d7165f68fe196922d9e5c6648dd57cc47
commit
6818991d7165f68fe196922d9e5c6648dd57cc47
Author: Ted Kremenek <kremenek@apple.com>
Date: Mon Dec 7 22:06:12 2009 +0000
Add clang-cc option '-analyzer-opt-analyze-nested-blocks' to treat
block literals as an entry point for analyzer checks.
The last reference was removed by this commit:
https://github.com/llvm/llvm-project/commit/
5c32dfc5fb1cfcff8ae3671284e17daa8da3a188
commit
5c32dfc5fb1cfcff8ae3671284e17daa8da3a188
Author: Anna Zaks <ganna@apple.com>
Date: Fri Dec 21 01:19:15 2012 +0000
[analyzer] Add blocks and ObjC messages to the call graph.
This paves the road for constructing a better function dependency graph.
If we analyze a function before the functions it calls and inlines,
there is more opportunity for optimization.
Note, we add call edges to the called methods that correspond to
function definitions (declarations with bodies).
Consequently, we should remove this dead flag.
However, this arises a couple of burning questions.
- Should the `cc1` frontend still accept this flag - to keep
tools/users passing this flag directly to `cc1` (which is unsupported,
unadvertised) working.
- If we should remain backward compatible, how long?
- How can we get rid of deprecated and obsolete flags at some point?
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D126067
Alex Zinenko [Fri, 10 Jun 2022 09:57:59 +0000 (11:57 +0200)]
[mlir] add a dynamic user-after-parent-freed transform dialect check
In the transform dialect, a transform IR handle may be pointing to a payload IR
operation that is an ancestor of another payload IR operation pointed to by
another handle. If such a "parent" handle is consumed by a transformation, this
indicates that the associated operation is likely rewritten, which in turn
means that the "child" handle may now be associated with a dangling pointer or
a pointer to a different operation than originally. Add a handle invalidation
mechanism to guard against such situations by reporting errors at runtime.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D127480
Balazs Benics [Fri, 10 Jun 2022 11:02:26 +0000 (13:02 +0200)]
[analyzer][NFC] Remove unused RegionStoreFeatures
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D126216
Andrzej Warzynski [Wed, 1 Jun 2022 16:00:31 +0000 (16:00 +0000)]
[flang][driver] Make `flang-new -fc1` accept MLIR files
This relatively small change will allow Flang's frontend driver,
`flang-new -fc1`, to consume and parse MLIR files. Semantically (i.e.
from user's perspective) this is identical to reading LLVM IR files.
Two file extensions are associated with MLIR files: .fir and .mlir. Note
that reading MLIR files makes only sense when running one of the
code-generation actions, i.e. when using one of the following action
flags: -S, -emit-obj, -emit-llvm, -emit-llvm-bc.
The majority of tests that required `tco` to run are updated to also run
with `flang-new -fc1`. A few tests are updated to use `fir-opt` instead
of `tco` (that's the preferred choice when testing a particular MLIR
pass). basic-program.fir is not updated as that test is intended to
verify the behaviour of `tco` specifically.
Differential Revision: https://reviews.llvm.org/D126890
Balazs Benics [Fri, 10 Jun 2022 10:57:15 +0000 (12:57 +0200)]
[analyzer] Deprecate `-analyzer-store region` flag
I'm trying to remove unused options from the `Analyses.def` file, then
merge the rest of the useful options into the `AnalyzerOptions.def`.
Then make sure one can set these by an `-analyzer-config XXX=YYY` style
flag.
Then surface the `-analyzer-config` to the `clang` frontend;
After all of this, we can pursue the tablegen approach described
https://discourse.llvm.org/t/rfc-tablegen-clang-static-analyzer-engine-options-for-better-documentation/61488
In this patch, I'm proposing flag deprecations.
We should support deprecated analyzer flags for exactly one release. In
this case I'm planning to drop this flag in `clang-16`.
In the clang frontend, now we won't pass this option to the cc1
frontend, rather emit a warning diagnostic reminding the users about
this deprecated flag, which will be turned into error in clang-16.
Unfortunately, I had to remove all the tests referring to this flag,
causing a mass change. I've also added a test for checking this warning.
I've seen that `scan-build` also uses this flag, but I think we should
remove that part only after we turn this into a hard error.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D126215
Bin Cheng [Fri, 10 Jun 2022 10:40:59 +0000 (18:40 +0800)]
[FuncSpec]Fix assertion failure when value is not added to solver
This patch improves the fix in D110529 to prevent from crashing on value
with byval attribute that is not added in SCCP solver.
Authored-by: sinan.lin@linux.alibaba.com
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D126355
Dmitry Preobrazhensky [Fri, 10 Jun 2022 10:37:57 +0000 (13:37 +0300)]
[AMDGPU][MC][GFX1013] Enable image_msaa_load
Differential Revision: https://reviews.llvm.org/D127198
LLVM GN Syncbot [Fri, 10 Jun 2022 10:37:02 +0000 (10:37 +0000)]
[gn build] Port
ff6d5dee713c
LLVM GN Syncbot [Fri, 10 Jun 2022 10:37:01 +0000 (10:37 +0000)]
[gn build] Port
1972d1e86a62
Andrzej Warzynski [Mon, 6 Jun 2022 17:57:33 +0000 (17:57 +0000)]
[flang][driver] Fix support for `-x`
Until now, `-x` wasn't really taken into account in Flang's compiler and
frontend drivers. `flang-new` and `flang-new -fc1` only recently gained
powers to consume inputs other than Fortran files and that's probably
why this hasn't been noticed yet.
This patch makes sure that `-x` is supported correctly and consistently
with Clang. To this end, verification is added when reading LLVM IR
files (i.e. IR modules are verified with `llvm::verifyModule`). This
way, LLVM IR parsing errors are correctly reported to Flang users. This
also aids testing.
With the new functionality, we can verify that `-x ir` breaks
compilation for e.g. Fortran files and vice-versa. Tests are updated
accordingly.
Differential Revision: https://reviews.llvm.org/D127207
Simon Tatham [Fri, 10 Jun 2022 10:25:53 +0000 (11:25 +0100)]
[ARM] Fix how size-0 bitfields affect homogeneous aggregates.
By both AAPCS32 and AAPCS64, the test for whether an aggregate
qualifies as homogeneous (either HFA or HVA) is based on the data
layout alone. So any logical member of the structure that does not
affect the data layout also should not affect homogeneity. In
particular, an empty bitfield ('int : 0') should make no difference.
In fact, clang considered it to make a difference in C but not in C++,
and justified that policy as compatible with gcc. But that's
considered a bug in gcc as well (at least for Arm targets), and it's
fixed in gcc 12.1.
This fix mimics gcc's: zero-sized bitfields are now ignored in all
languages for the Arm (32- and 64-bit) ABIs. But I've left the
previous behaviour unchanged in other ABIs, by means of adding an
ABIInfo::isZeroLengthBitfieldPermittedInHomogeneousAggregate query
method which the Arm subclasses override.
Reviewed By: lenary
Differential Revision: https://reviews.llvm.org/D127197
Nico Weber [Fri, 10 Jun 2022 10:26:31 +0000 (06:26 -0400)]
[gn build] (manually) port
6bc8163c79fd
Balazs Benics [Fri, 10 Jun 2022 10:21:17 +0000 (12:21 +0200)]
[analyzer] Print the offending function at EndAnalysis crash
I've faced crashes in the past multiple times when some
`check::EndAnalysis` callback caused some crash.
It's really anoying that it doesn't tell which function triggered this
callback.
This patch adds the well-known trace for that situation as well.
Example:
1. <eof> parser at end of file
2. While analyzing stack:
#0 Calling test11
Note that this does not have tests.
I've considered `unittests` for this purpose, by using the
`ASSERT_DEATH()` similarly how we check double eval called functions in
`ConflictingEvalCallsTest.cpp`, however, that the testsuite won't invoke
the custom handlers. Only the message of the `llvm_unreachable()` will
be printed. Consequently, it's not applicable for us testing this
feature.
I've also considered using an end-to-end LIT test for this.
For that, we would need to somehow overload the `clang_analyzer_crash()`
`ExprInspection` handler, to get triggered by other events than the
`EvalCall`. I'm not saying that we could not come up with a generic way
of causing crash in a specific checker callback, but I'm not sure if
that would worth the effort.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D127389
David Sherwood [Wed, 8 Jun 2022 08:25:00 +0000 (09:25 +0100)]
[MVE] Fold fadd(select(..., +0.0)) into a predicated fadd
We already have patterns for matching fadd(select(..., -0.0)),
but an upcoming patch will lead to patterns using +0.0 as the
identity instead of -0.0. I'm adding support for these patterns
now to avoid any regressions for MVE.
Differential Revision: https://reviews.llvm.org/D127275
Nikolas Klauser [Fri, 10 Jun 2022 08:48:39 +0000 (10:48 +0200)]
[libc++] Granularize even more of type_traits
Reviewed By: ldionne, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D126593
Nikolas Klauser [Tue, 7 Jun 2022 07:42:10 +0000 (09:42 +0200)]
[libc++] Implement ranges::replace{, _if}
Reviewed By: var-const, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D126283
Nikita Popov [Sat, 10 Apr 2021 17:26:50 +0000 (19:26 +0200)]
[LoopInfo] Add getOutermostLoop() (NFC)
This is a recurring pattern, add an API function for it.
David Green [Fri, 10 Jun 2022 08:36:09 +0000 (09:36 +0100)]
[AggressiveInstcombine] Conditionally fold saturated fptosi to llvm.fptosi.sat
This adds a fold for aggressive instcombine that converts
smin(smax(fptosi(x))) into a llvm.fptosi.sat, providing that the
saturation constants are correct and the cost of the llvm.fptosi.sat is
lower.
Unfortunately, a llvm.fptosi.sat cannot always be converted back to a
smin/smax/fptosi. The llvm.fptosi.sat intrinsic is more defined that the
original, which produces poison if the original fptosi was out of range.
The llvm.fptosi.sat will saturate any value, so needs to be expanded to
a fptosi(fpmin(fpmax(x))), which can be worse for codegeneration
depending on the target.
So this change thais conditional on the backend reporting that the
llvm.fptosi.sat is cheaper that the original smin+smax+fptost. This is
a change to the way that AggressiveInstrcombine has worked in the past.
Instead of just being a canonicalization pass, that canonicalization can
be dependant on the target in certain specific cases.
Differential Revision: https://reviews.llvm.org/D125755
Michał Górny [Fri, 3 Jun 2022 18:19:53 +0000 (20:19 +0200)]
[lldb] [test] Implement getting thread ID on FreeBSD
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D126982
Matthias Springer [Fri, 10 Jun 2022 08:17:07 +0000 (10:17 +0200)]
[mlir][bufferize] Avoid tensor copies when the data is not read
There are various shortcuts in `BufferizationState::getBuffer` that avoid a buffer copy when we just need an allocation (and no initialization). This change adds those shortcuts to the TensorCopyInsertion pass, so that `getBuffer` can be simplified in a subsequent change.
Differential Revision: https://reviews.llvm.org/D126821
Benjamin Kramer [Fri, 10 Jun 2022 08:22:55 +0000 (10:22 +0200)]
[bazel] Change references to driver-template.cpp.in after
6bc8163c79fd
isuckatcs [Fri, 10 Jun 2022 08:09:31 +0000 (10:09 +0200)]
[Documentation] Fixed typos in LibASTMatchers tutorial
There was one missing parenthesis and a typo in the mentioned
part of the documentation.
Differential Revision: https://reviews.llvm.org/D124738
Kirill Okhotnikov [Mon, 6 Jun 2022 10:34:53 +0000 (12:34 +0200)]
[libc][math] Improved FBits performance and readablity.
Some function added in preparation to fmod commit.
Differential Revision: https://reviews.llvm.org/D127097
Balázs Kéri [Fri, 10 Jun 2022 08:00:34 +0000 (10:00 +0200)]
[clang][ASTImporter] Fix import of function with auto return type.
Fix a case of importing a function with auto return type
that is resolved with a type template argument that is declared
inside the function.
Fixes #55500
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D127396
Kirill Okhotnikov [Mon, 6 Jun 2022 09:04:57 +0000 (11:04 +0200)]
[libc][math] Differential "diff" test for hypot/hypotf functions.
Added test handler in preparation to fmod/fmodf commit.
Differential Revision: https://reviews.llvm.org/D127091
Nikita Popov [Wed, 8 Jun 2022 09:36:52 +0000 (11:36 +0200)]
[EarlyCSE] Update tests to use opaque pointers (NFC)
Update the EarlyCSE tests to use opaque pointers.
Worth noting that this leaves some bitcast ptr to ptr instructions
in the input IR behind which are no longer necessary. This is
because these use numbered instructions, so it's hard to drop them
in an automated fashion (as it would require renumbering all other
instructions as well). I'm leaving that as a problem for another day.
The test updates have been performed using
https://gist.github.com/nikic/
98357b71fd67756b0f064c9517b62a34.
Differential Revision: https://reviews.llvm.org/D127278
Nikita Popov [Thu, 9 Jun 2022 08:24:52 +0000 (10:24 +0200)]
[cmake] Export driver template to fix standalone build
Export the driver-template.cpp.in file so that tools using
GENERATE_DRIVER work in standalone builds (currently only relevant
for clang). I've given the file an llvm- prefix, as we're now
searching for the file in CMAKE_MODULE_PATH.
Differential Revision: https://reviews.llvm.org/D127384
Nikita Popov [Mon, 30 May 2022 09:12:46 +0000 (11:12 +0200)]
[CGP] Also freeze ctlz/cttz operand when despeculating
D125887 changed the ctlz/cttz despeculation transform to insert
a freeze for the introduced branch on zero. While this does fix
the "branch on poison" issue, we may still get in trouble if we
pick a different value for the branch and for the ctz argument
(i.e. non-zero for the branch, but zero for the ctz). To avoid
this, we should use the same frozen value in both positions.
This does cause a regression in RISCV codegen by introducing an
additional sext. The DAG looks like this:
t0: ch = EntryToken
t2: i64,ch = CopyFromReg t0, Register:i64 %3
t4: i64 = AssertSext t2, ValueType:ch:i32
t23: i64 = freeze t4
t9: ch = CopyToReg t0, Register:i64 %0, t23
t16: ch = CopyToReg t0, Register:i64 %4, Constant:i64<32>
t18: ch = TokenFactor t9, t16
t25: i64 = sign_extend_inreg t23, ValueType:ch:i32
t24: i64 = setcc t25, Constant:i64<0>, seteq:ch
t28: i64 = and t24, Constant:i64<1>
t19: ch = brcond t18, t28, BasicBlock:ch<cond.end 0x8311f68>
t21: ch = br t19, BasicBlock:ch<cond.false 0x8311e80>
I don't see a really obvious way to improve this, as we can't push
the freeze past the AssertSext (which may produce poison).
Differential Revision: https://reviews.llvm.org/D126638
Jay Foad [Wed, 8 Jun 2022 15:04:29 +0000 (16:04 +0100)]
[AMDGPU] New GFX11 intrinsic llvm.amdgcn.s.sendmsg.rtn
Add new intrinsic and codegen support for the s_sendmsg_rtn_b32 and
s_sendmsg_rtn_b64 instructions.
Differential Revision: https://reviews.llvm.org/D127315
Jay Foad [Thu, 4 Nov 2021 17:24:11 +0000 (17:24 +0000)]
[AMDGPU] Update dlc usage for GFX11
In GFX10 dlc controlled L1 cache bypass. In GFX11 it has been repurposed
to control MALL NOALLOC, and glc controls L1 as well as L0 cache bypass.
Update the documentation and SIMemoryLegalizer accordingly. Set dlc for
nontemporal and volatile accesses.
Differential Revision: https://reviews.llvm.org/D127405
Tony [Mon, 22 Mar 2021 21:08:29 +0000 (21:08 +0000)]
[AMDGPU] Add GFX11 documentation to AMDGPUUsage
Update most of the document to include GFX11. Memory model changes will
come later.
Differential Revision: https://reviews.llvm.org/D127402
Valentin Clement [Fri, 10 Jun 2022 06:50:40 +0000 (08:50 +0200)]
[flang][NFC] Move Todo.h from Lower to Optimizer
Remove a backwards dependence from Optimizer -> Lower by moving Todo.h
to the optimizer and out of lowering.
This patch is part of the upstreaming effort from fir-dev branch.
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D127292
Sunho Kim [Fri, 10 Jun 2022 06:22:18 +0000 (15:22 +0900)]
[JITLink][EHFrameSupport] Remove CodeAlignmentFactor and DataAlignmentFactor validation.
Removes CodeAlignmentFactor and DataAlignmentFactor validation in EHFrameEdgeFixer. I observed some of aarch64 elf files generated by clang contains CIE record with code_alignment_factor = 4 or data_alignment_factor = -8. code_alignment_factor and data_alignment_factor are used by call fram instruction that should be correctled handled by libunwind.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D127062