Louis Dionne [Tue, 15 Nov 2022 22:08:01 +0000 (17:08 -0500)]
[libc++] Only include_next C library headers when they exist
Some platforms don't provide all C library headers. In practice, libc++
only requires a few C library headers to exist, and only a few functions
on those headers. Missing functions that libc++ doesn't need for its own
implementation are handled properly by the using_if_exists attribute,
however a missing header is currently a hard error when we try to
do #include_next.
This patch should make libc++ more flexible on platforms that do not
provide C headers that libc++ doesn't actually require for its own
implementation. The only downside is that it may move some errors from
the #include_next point to later in the compilation if we actually try
to use something that isn't provided, which could be somewhat confusing.
However, these errors should be caught by folks trying to port libc++
over to a new platform (when running the libc++ test suite), not by end
users.
NOTE: This is a reapplicaton of 226409, which was reverted in
674729813
because it broke the build. The issue has now been fixed with
https://reviews.llvm.org/D138062.
Differential Revision: https://reviews.llvm.org/D136683
bixia1 [Thu, 17 Nov 2022 00:28:41 +0000 (16:28 -0800)]
[mlir][sparse] Split SparseTensorRewrite into PreSparsificationRewrite and PostSparsificationRewrite.
Reviewed By: aartbik, wrengr
Differential Revision: https://reviews.llvm.org/D138153
David Green [Thu, 17 Nov 2022 15:07:28 +0000 (15:07 +0000)]
[ARM] Add an extra test for low trip count MVE vectorization. NFC
This is quite reduced from the original example, but hopefully shows
where vectorization is unprofitable because of multiple factors
including the low trip count of the loop.
Matthias Springer [Thu, 17 Nov 2022 14:54:52 +0000 (15:54 +0100)]
[mlir][transform] Add C++ builder to SequenceOp
This change adds a builder that populates the body of a SequenceOp. This is useful for constructing SequenceOps from C++.
Differential Revision: https://reviews.llvm.org/D137710
Guillaume Chatelet [Thu, 3 Nov 2022 12:50:35 +0000 (12:50 +0000)]
[libc][bazel] Add tests to the bazel build
@GMNGeoffrey let me know it there's a better way to import MPFR and GMP for the purpose of testing libc math functions.
Differential Revision: https://reviews.llvm.org/D119547
Martin Storsjö [Wed, 16 Nov 2022 09:32:31 +0000 (11:32 +0200)]
[openmp] [cmake] Fix detecting aarch64 in standalone MSVC builds
Differential Revision: https://reviews.llvm.org/D138113
Alex Richardson [Tue, 20 Sep 2022 13:19:16 +0000 (13:19 +0000)]
[CGP] Update MemIntrinsic alignment if possible
Previously it was only being done if shouldAlignPointerArgs() returned
true, which right now is only true for ARM targets.
Updating the argument alignment attributes of memcpy/memset intrinsics
if the underlying object has larger alignment can be beneficial even
when CGP didn't increase alignment (as can be seen from the test changes),
so invert the loop and if condition.
Differential Revision: https://reviews.llvm.org/D134281
Alex Richardson [Tue, 20 Sep 2022 12:42:52 +0000 (12:42 +0000)]
[AMDGPU] Autogenerate a test in preparation for upcoming change
Emmmer [Mon, 7 Nov 2022 11:47:09 +0000 (19:47 +0800)]
[LLDB][RISCV] Allow accessing FPR registers through ABI names
Allow users to access FPR registers by names or ABI names.
PS: This patch should be merged after D137508
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D137761
Emmmer [Sat, 5 Nov 2022 09:32:40 +0000 (17:32 +0800)]
[LLDB][RISCV] Allow accessing registers through ABI names
This patch uses RISCV ABI register name as `alt_name` in `RegisterInfo` in `lldb-private-types.h`
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D137508
Timm Bäder [Wed, 16 Nov 2022 11:50:24 +0000 (12:50 +0100)]
[clang] Short-circuit evaluation in ::EvaluateAsConstantExpr
Use FastEvaluateAsRValue() in EvaluateAsConstantExpr() as well, to
short-circuit evaluation of simple integrals.
Differential Revision: https://reviews.llvm.org/D138115
Uday Bondhugula [Thu, 17 Nov 2022 10:29:27 +0000 (15:59 +0530)]
[MLIR] NFC. Fix unused context warning from Parser.h
NFC. Fix unused context warning from Parser.h.
```
..include/mlir/Parser/Parser.h:39:38: warning: parameter ‘context’ set but not used [-Wunused-but-set-parameter]
39 | Block *parsedBlock, MLIRContext *context, Location sourceFileLoc) {
```
Differential Revision: https://reviews.llvm.org/D138192
Anton Sidorenko [Tue, 11 Oct 2022 08:36:53 +0000 (11:36 +0300)]
[MachineCombiner][RISCV] Add fmadd/fmsub/fnmsub instructions patterns
This patch adds tranformation of fmul+fadd/fsub chains to fused multiply
instructions:
* fmul+fadd->fmadd
* fmul+fsub->fmsub/fnmsub
We also will try to combine these instructions if the fmul has more than one use
and cannot be deleted. However, removing the dependence between fmul and fadd can
still be profitable, and we rely on machine combiner approximations of scheduling.
Differential Revision: https://reviews.llvm.org/D136764
Evgeniy Brevnov [Thu, 17 Nov 2022 10:11:47 +0000 (17:11 +0700)]
Revert "[JT] Preserve exisiting BPI/BFI during JumpThreading"
This reverts commit
52a4018506e39f50d0c06ac5a1c987eb83b900c7.
Evgeniy Brevnov [Wed, 26 Oct 2022 09:03:25 +0000 (16:03 +0700)]
[JT] Preserve exisiting BPI/BFI during JumpThreading
Currently, JT creates and updates local instances of BPI\BFI. As a result global ones have to be invalidated if JT made any changes.
In fact, JT doesn't use any information from BPI/BFI for the sake of the transformation itself. It only creates BPI/BFI to keep them up to date. But since it updates local copies (besides cases when it updates profile metadata) it just waste of time.
Current patch is a rework of D124439. D124439 makes one step and replaces local copies with global ones retrieved through AnalysisPassManager. Here we do one more step and don't create BPI/BFI if the only reason of creation is to keep BPI/BFI up to date. Overall logic is the following. If there is cached BPI/BFI then update it along the transformations. If there is no existing BPI/BFI, then create it only if it is required to update profile metadata.
Please note if BPI/BFI exists on exit from JT (either cached or created) it is always up to date and no reason to invalidate it.
Differential Revision: https://reviews.llvm.org/D136827
Valentin Clement [Thu, 17 Nov 2022 09:53:13 +0000 (10:53 +0100)]
[flang] Create fir.dispatch_table and fir.dt_entry operations
Create the fir.dispatch_table operation based on semantics
information. The fir.dispatch_table will be used for static devirtualization
as well as for fir.select_type conversion.
Depends on D138129
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D138131
Valentin Clement [Thu, 17 Nov 2022 09:45:46 +0000 (10:45 +0100)]
[flang] Make CollectBindings available to lowering
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D138129
Jay Foad [Wed, 16 Nov 2022 14:37:27 +0000 (14:37 +0000)]
[AMDGPU] Add GFX11 to some tests with manual checks
Differential Revision: https://reviews.llvm.org/D138138
Tobias Gysi [Thu, 17 Nov 2022 09:33:11 +0000 (10:33 +0100)]
[mlir][llvm] Move call and gep LLVM IR import tests.
The revision moves call and gep tests to instructions.ll.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D137636
Emilia Dreamer [Thu, 17 Nov 2022 09:35:43 +0000 (11:35 +0200)]
[clang-format] Remove special case for kw_operator when aligning decls
This change breaks no existing tests but does fix the linked issue.
Declarations of operator overloads are annotated with
`TT_FunctionDeclarationName` on the `operator` keyword, which is already
being checked for when aligning, so the extra `kw_operator` doesn't seem
to be necessary. (just for reference, it was added in
rG92b397fb9d55ccdf4632c2b1b15b4a0ee417cf74 /
92b397fb9d55ccdf4632c2b1b15b4a0ee417cf74)
Fixes https://github.com/llvm/llvm-project/issues/55733
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D137223
Emilia Dreamer [Thu, 17 Nov 2022 09:36:05 +0000 (11:36 +0200)]
[clang-format] Defer formatting of operator< to honor paren spacing
I'm not exactly sure what the intent of that section of
`spaceRequiredBetween` is doing, it seems to handle templates and <<,
but the part which adds spaces before parens is way later, as part
of `spaceRequiredBeforeParens`.
Fixes https://github.com/llvm/llvm-project/issues/58821
Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D137474
Aliia Khasanova [Fri, 21 Oct 2022 07:45:51 +0000 (07:45 +0000)]
[mlir] Make kDynamicSize equal to kDynamicOffsetAndStride.
Differential Revision: https://reviews.llvm.org/D134807
Tobias Gysi [Thu, 17 Nov 2022 09:27:43 +0000 (10:27 +0100)]
[mlir][llvm] Consolidate function attribute import tests (NFC).
The revision puts the function attributes tests previously distributed
accross multiple files int a single function-attributes.ll test file.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D137627
Tobias Gysi [Thu, 17 Nov 2022 09:10:13 +0000 (10:10 +0100)]
[mlir][llvm] Test LLVM IR global variable import separately (NFC).
The revision moves tests related to LLVM IR global variable
import into a separate global-variables.ll file.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D137622
Sinan Lin [Thu, 17 Nov 2022 09:19:23 +0000 (17:19 +0800)]
Fix broken CI
The test case introduced in https://reviews.llvm.org/D137535 does not
set a proper triple, which breaks CI from ppc/x86win/nvptx64. Hope this
patch can fix the issue.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D138188
Anton Sidorenko [Wed, 12 Oct 2022 14:29:08 +0000 (17:29 +0300)]
[MachineCombiner][RISCV] Precommit tests for D136764
Matt Jacobson [Thu, 17 Nov 2022 09:04:15 +0000 (04:04 -0500)]
In ChangePrinters tests, redirect stderr of `diff --help` to stdout
FreeBSD's diff writes its `--help` to stderr.
Jay Foad [Tue, 5 Oct 2021 10:05:05 +0000 (11:05 +0100)]
[GlobalISel] Better verification of G_UNMERGE_VALUES
Verify three cases of G_UNMERGE_VALUES separately:
1. Splitting a vector into subvectors (the converse of
G_CONCAT_VECTORS).
2. Splitting a vector into its elements (the converse of
G_BUILD_VECTOR).
3. Splitting a scalar into smaller scalars (the converse of
G_MERGE_VALUES).
Previously #1 allowed strange combinations like this:
%1:_(<2 x s16>),%2:_(<2 x s16>) = G_UNMERGE_VALUES %0(<2 x s32>)
This has been tightened up to check that the source and destination
element types match, and some MIR test cases updated accordingly.
Differential Revision: https://reviews.llvm.org/D111132
Muhammad Omair Javaid [Thu, 17 Nov 2022 07:34:33 +0000 (11:34 +0400)]
Revert "[lld-macho] Overhaul map file code"
This reverts commit
213dbdbef0bad835abca0753f9e59b17dc2bcde2.
This patch series breaks lld:map-file.s on arm v7 linux buildbots.
e.g https://lab.llvm.org/buildbot/#/builders/178/builds/3190
Muhammad Omair Javaid [Thu, 17 Nov 2022 07:33:28 +0000 (11:33 +0400)]
Revert "[lld-macho] Emit map file entry for compact unwind info"
This reverts commit
7f0779967f0690482c2cef70fc49e1381d32af1e.
This patch series breaks lld:map-file.s on arm v7 linux buildbots.
e.g https://lab.llvm.org/buildbot/#/builders/178/builds/3190
Muhammad Omair Javaid [Thu, 17 Nov 2022 07:32:42 +0000 (11:32 +0400)]
Revert "[lld-macho] Fix bugs around EH_Frame symbols"
This reverts commit
1a2bc103bba04e8fba574c70c6201ba18ccc08ba.
This patch series breaks lld:map-file.s on arm v7 linux buildbots.
e.g https://lab.llvm.org/buildbot/#/builders/178/builds/3190
Fangrui Song [Thu, 17 Nov 2022 08:12:42 +0000 (00:12 -0800)]
[Sink] Add a single successor test
Matt Arsenault [Thu, 17 Nov 2022 06:30:08 +0000 (22:30 -0800)]
ValueTracking: Look through fabs and fneg in isKnownNeverInfinity
Matt Arsenault [Thu, 17 Nov 2022 05:44:28 +0000 (21:44 -0800)]
ValueTracking: Look through canonicalize in isKnownNeverInfinity
Che-Yu Wu [Wed, 16 Nov 2022 23:01:09 +0000 (23:01 +0000)]
Increase the limit of SCF nested tiling loop to 10
Differential Revision: https://reviews.llvm.org/D138156
Vladislav Khmelevsky [Wed, 16 Nov 2022 08:15:15 +0000 (12:15 +0400)]
[BOLT][runtime] Change fPIE flag to fPIC
Since instrumentation could be used on libraries we need to use fPIC,
not fPIE flag.
Differential Revision: https://reviews.llvm.org/D138099
Sinan Lin [Thu, 17 Nov 2022 06:55:38 +0000 (14:55 +0800)]
[CodeGen][BasicBlockSections] Fix wrong alignment directive placement in
basic block section cases
MachineBlockPlacement pass sets an alignment attribute to the loop
header MBB and this attribute will lead to an alignment directive during
emitting asm. In the case of the basic block section, the alignment
directive is put before the section label, and thus the alignment is set
to the predecessor of the loop header, which is not what we expect and
increases the code size (both inserting nop and set section alignment).
Reviewed By: rahmanl
Differential Revision: https://reviews.llvm.org/D137535
Vitaly Buka [Thu, 17 Nov 2022 04:47:46 +0000 (20:47 -0800)]
[NFC][asan] Reformat macro
Vitaly Buka [Thu, 17 Nov 2022 06:40:29 +0000 (22:40 -0800)]
[NFC][asan] clang-format the test
Vitaly Buka [Thu, 17 Nov 2022 06:07:58 +0000 (22:07 -0800)]
[NFC][asan] format __sanitizer_annotate_contiguous_container
Chi Chun Chen [Thu, 17 Nov 2022 06:44:44 +0000 (00:44 -0600)]
[OpenMP][NFC] Claim thread_limit clause in target directive
Carlos Alberto Enciso [Thu, 17 Nov 2022 06:16:53 +0000 (06:16 +0000)]
[llvm-debuginfo-analyzer] Return by reference instead of value.
The following functions are used in the unittest, to access
invalid data detected by the Reader during the debug information
analysis:
- getDebugTags
- getWarningOffsets
- getInvalidLocations
- getInvalidCoverages
- getInvalidRanges
- getLinesZero
Just return a reference to the container with the information.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D138092
Mehdi Amini [Thu, 17 Nov 2022 05:16:19 +0000 (05:16 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in StandaloneExtension.cpp (NFC)
Fangrui Song [Thu, 17 Nov 2022 06:13:22 +0000 (22:13 -0800)]
[LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally
For a local linkage GlobalObject in a non-prevailing COMDAT, it remains defined while its
leader has been made available_externally. This violates the COMDAT rule that
its members must be retained or discarded as a unit.
To fix this, update the regular LTO change D34803 to track local linkage
GlobalValues, and port the code to ThinLTO (GlobalAliases are not handled.)
This fixes two problems.
(a) `__cxx_global_var_init` in a non-prevailing COMDAT group used to
linger around (unreferenced, hence benign), and is now correctly discarded.
```
int foo();
inline int v = foo();
```
(b) Fix https://github.com/llvm/llvm-project/issues/58215:
as a size optimization, we place private `__profd_` in a COMDAT with a
`__profc_` key. When FuncImport.cpp makes `__profc_` available_externally due to
a non-prevailing COMDAT, `__profd_` incorrectly remains private. This change
makes the `__profd_` available_externally.
```
cat > c.h <<'eof'
extern void bar();
inline __attribute__((noinline)) void foo() {}
eof
cat > m1.cc <<'eof'
#include "c.h"
int main() {
bar();
foo();
}
eof
cat > m2.cc <<'eof'
#include "c.h"
__attribute__((noinline)) void bar() {
foo();
}
eof
clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw
clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto=thin -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw
```
If a GlobalAlias references a GlobalValue which is just changed to
available_externally, change the GlobalAlias as well (e.g. C5/D5 comdats due to
cc1 -mconstructor-aliases). The GlobalAlias may be referenced by other
available_externally functions, so it cannot easily be removed.
Depends on D137441: we use available_externally to mark a GlobalAlias in a
non-prevailing COMDAT, similar to how we handle GlobalVariable/Function.
GlobalAlias may refer to a ConstantExpr, not changing GlobalAlias to
GlobalVariable gives flexibility for future extensions (the use case is niche.
For simplicity we don't handle it yet). In addition, available_externally
GlobalAlias is the most straightforward implementation and retains the aliasee
information to help optimizers.
See windows-vftable.ll: Windows vftable uses an alias pointing to a
private constant where the alias is the COMDAT leader. The COMDAT use case
is skeptical and ThinLTO does not discard the alias in the non-prevailing COMDAT.
This patch retains the behavior.
See new tests ctor-dtor-alias2.ll: depending on whether the complete object
destructor emitted, when ctor/dtor aliases are used, we may see D0/D2 COMDATs in
one TU and D0/D1/D2 in a D5 COMDAT in another TU.
Allow such a mix-and-match with `if (GO->getComdat()->getName() == GO->getName()) NonPrevailingComdats.insert(GO->getComdat());`
GlobalAlias handling in ThinLTO is still weird, but this patch should hopefully
improve the situation for at least all cases I can think of.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D135427
Fangrui Song [Thu, 17 Nov 2022 05:43:50 +0000 (21:43 -0800)]
Revert D135427 "[LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally"
This reverts commit
8901635423cbea4324059a5127657126d2e00ce1.
This change broke the following example and we need to check `if (GO->getComdat()->getName() == GO->getName())`
before `NonPrevailingComdats.insert(GO->getComdat());`
Revert for clarify.
```
// a.cc
template <typename T>
struct A final { virtual ~A() {} };
extern "C" void aa() { A<int> a; }
// b.cc
template <typename T>
struct A final { virtual ~A() {} };
template struct A<int>;
extern "C" void bb(A<int> *a) { delete a; }
clang -c -fpic -O0 -flto=thin a.cc && ld.lld -shared a.o b.o
```
Matt Jacobson [Thu, 17 Nov 2022 05:20:23 +0000 (00:20 -0500)]
Trivial fix to failing test on FreeBSD
This file can't use C99-style comments.
Serge Pavlov [Wed, 9 Nov 2022 11:07:08 +0000 (18:07 +0700)]
[clang] Missed rounding mode use in constant evaluation
Integer-to-float conversion was handled in constant evaluator with
default rounding mode. This change fixes the behavior and the conversion
is made using rounding mode stored in ImplicitCastExpr node.
Differential Revision: https://reviews.llvm.org/D137719
Yashwant Singh [Thu, 17 Nov 2022 04:30:11 +0000 (10:00 +0530)]
Handling ADD|SUB U64 decomposed Pseudos not getting lowered to SDWA form
This patch fixes some of the V_ADD/SUB_U64_PSEUDO not getting converted to their sdwa form.
We still get below patterns in generated code:
v_and_b32_e32 v0, 0xff, v0
v_add_co_u32_e32 v0, vcc, v1, v0
v_addc_co_u32_e64 v1, s[0:1], 0, 0, vcc
and,
v_and_b32_e32 v2, 0xff, v2
v_add_co_u32_e32 v0, vcc, v0, v2
v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1st and 2nd instructions of both above examples should have been folded into sdwa add with BYTE_0 src operand.
The reason being the pseudo instruction is broken down into VOP3 instruction pair of V_ADD_CO_U32_e64 and V_ADDC_U32_e64.
The sdwa pass attempts lowering them to their VOP2 form before converting them into sdwa instructions. However V_ADDC_U32_e64
cannot be shrunk to it's VOP2 form if it has non-reg src1 operand.
This change attempts to fix that problem by only shrinking V_ADD_CO_U32_e64 instruction.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D136663
WANG Xuerui [Thu, 17 Nov 2022 04:00:48 +0000 (12:00 +0800)]
[BinaryFormat] Add LoongArch
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D138018
zhanglimin [Thu, 17 Nov 2022 03:58:57 +0000 (11:58 +0800)]
[OpenMP] kmp_affinity.h: add LoongArch64 support
In D135552 the #else is added, which causes build error when
building openmp on LoongArch. This patch fixed the error:
"Unknown or unsupported architecture"
Reviewed By: SixWeining, MaskRay
Differential Revision: https://reviews.llvm.org/D137604
Youling Tang [Thu, 17 Nov 2022 03:57:27 +0000 (11:57 +0800)]
[sanitizer] Add ptrace interceptor support for LoongArch
Add ptrace interceptor support for LoongArch, `ptrace.cpp` has been
tested and passed.
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D137228
Alex Brachet [Thu, 17 Nov 2022 03:37:58 +0000 (03:37 +0000)]
Revert "[CMake] Drop libLTO and switch to PIE for Fuchsia toolchain"
This reverts commit
a6f621b8cacca926d809010c135be038fd05652c.
We suspect that this patch might be the culprit that is causing
every llvm executable to be sigkill'd immediately on Apple Silicon
machines. Notably, the only other cache file with CMAKE_POSITION_INDEPENDENT_CODE
is Apple's and they have it off.
Mike Hommey [Thu, 17 Nov 2022 02:31:28 +0000 (21:31 -0500)]
[lld-macho] Increase slop to prevent thunk out of range again.
Building Firefox with -O0 on arm64 mac recently hit the
"FIXME: thunk range overrun" error on multiple occasions.
Doubling or tripling slop was not sufficient in some cases, so
quadruple it.
Reviewed By: #lld-macho, int3
Differential Revision: https://reviews.llvm.org/D138174
Craig Topper [Thu, 17 Nov 2022 02:51:12 +0000 (18:51 -0800)]
[RISCV] Add a DAG combine to pre-promote (i1 (truncate (i32 (srl X, Y)))) with Zbs on RV64.
Type legalization will want to turn (srl X, Y) into RISCVISD::SRLW,
which will prevent us from using a BEXT instruction.
This is similar to what we do for (i32 (and (srl X, Y), 1)).
Joshua Batista [Thu, 17 Nov 2022 01:56:24 +0000 (17:56 -0800)]
[HLSL] add sin library function
This change exposes the sin library function for HLSL,
excluding long, int, and long long doubles.
Sin is supported for all scalar, vector, and matrix types.
Long and long long double support is missing in this patch because those types
don't exist in HLSL. Int is missing because the sin function only works on floating type arguments.
The full documentation of the HLSL sin function is available here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-sin
Reviewed By: python3kgae
Differential Revision: https://reviews.llvm.org/D138161
Koakuma [Thu, 17 Nov 2022 01:56:17 +0000 (20:56 -0500)]
[SPARC] Don't emit deprecated FP branches when targeting v9
Don't emit deprecated v8-style FP compares & branches when targeting v9
processors.
For now, always use %fcc0, because currently the allocator requires allocatable
registers to also be spillable, which isn't the case with v9 FCC registers.
The work to enable allocation over the entire FCC register file will be done in
a future patch.
Fixes bug #17834
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D135515
Koakuma [Thu, 17 Nov 2022 01:46:14 +0000 (20:46 -0500)]
[SPARC] Improve integer branch handling for v9 targets
Do not emit deprecated v8-style branches when targeting a v9 processor.
As a side effect, this also fixes the emission of useless ba's when doing
conditional branches on 64-bit integer values.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D130006
wren romano [Thu, 17 Nov 2022 01:32:10 +0000 (17:32 -0800)]
[mlir][sparse] Adding wrapper for `__has_builtin`
This is a followup to D138154 and should resolve build issues on Windows.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138167
gonglingqin [Thu, 17 Nov 2022 01:27:08 +0000 (09:27 +0800)]
[LoongArch] Eliminate extra un-accounted-for successors
Specifically:
```
*** Bad machine code: MBB has unexpected successors which are not branch targets, fallthrough, EHPads, or inlineasm_br targets. ***
- function: atomicrmw_umax_i8_acquire
- basic block: %bb.3 (0x1b90bd8)
*** Bad machine code: Non-terminator instruction after the first terminator ***
- function: atomicrmw_umax_i8_acquire
- basic block: %bb.3 (0x1b90bd8)
- instruction: DBAR 1792
```
Differential Revision: https://reviews.llvm.org/D137884
Richard Smith [Thu, 17 Nov 2022 01:41:12 +0000 (17:41 -0800)]
Suppress warning on unused static data member.
The member in the specialization is intentionally unused on 32-bit
targets.
Adrian Prantl [Thu, 17 Nov 2022 01:35:10 +0000 (17:35 -0800)]
Fix use of std::unique / erase. This fixes a bot error after D136650.
wanglei [Thu, 17 Nov 2022 01:12:27 +0000 (09:12 +0800)]
[LoongArch] Transfer MI flags when expand PseudoCALL
When expanding a PseudoCALL, the corresponding flags (e.g. nomerge)
need to be passed to the new instruction.
This patch also adds test for the nomerge attribute.
The `nomerge` attribute was added during `LowerCall`, but was lost
during expand PseudoCALL. Now add it back.
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D137888
Matt Arsenault [Thu, 17 Nov 2022 00:51:56 +0000 (16:51 -0800)]
AMDGPU: Use -passes for amdgpu-promote-alloca tests
Craig Topper [Thu, 17 Nov 2022 00:53:42 +0000 (16:53 -0800)]
[RISCV] Remove duplicate setOperationAction. NFC
wren romano [Wed, 16 Nov 2022 21:26:58 +0000 (13:26 -0800)]
[mlir][sparse] Macros to clean up StridedMemRefType in the SparseTensorRuntime
In particular, this silences warnings from [-Wsign-compare].
This is a revised version of D137735, which got reverted due to a sign-comparison warning on LLVM's Windows buildbot (which was not on MLIR's Windows buildbot). Differences vs the previous differential:
* `vectorToMemref` now uses `detail::checkOverflowCast` to silence the warning that caused the the previous differential to get reverted.
* `MEMREF_GET_USIZE` now uses `detail::checkOverflowCast` rather than `static_cast`
* `ASSERT_USIZE_EQ` added to abbreviate another common idiom, and to ensure that we use `detail::safelyEQ` everywhere (to silence a few other warnings)
* A couple for-loops now use `index_type` for the induction variable, since their upper bound uses that typedef too. (Namely `_mlir_ciface_getSparseTensorReaderDimSizes` and `_mlir_ciface_outSparseTensorWriterNext`)
Depends on D138149
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D137998
Ben Shi [Wed, 16 Nov 2022 13:12:28 +0000 (21:12 +0800)]
[clang] Fix wrong ABI of AVRTiny.
A scalar which exceeds 4 bytes should be returned via a stack slot,
on an AVRTiny device.
Reviewed By: aykevl
Differential Revision: https://reviews.llvm.org/D138125
wren romano [Wed, 16 Nov 2022 22:19:01 +0000 (14:19 -0800)]
[mlir][sparse] Updating checkedMul to use intrinsics.
Depends On D138149
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138154
wren romano [Wed, 16 Nov 2022 20:59:54 +0000 (12:59 -0800)]
[mlir][sparse] Adding safe comparison functions to MLIRSparseTensorRuntime.
Different platforms use different signedness for `StridedMemRefType::sizes` and `std::vector::size_type`, and this has been causing a lot of portability issues re [-Wsign-compare] warnings. These new functions ensure that we need never worry about those signedness warnings ever again.
Also merging CheckedMul.h into ArithmeticUtils.h
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138149
wren romano [Wed, 16 Nov 2022 23:32:26 +0000 (15:32 -0800)]
[mlir][sparse] Misc cleanup of MLIRSparseTensorRuntime
Removing an unnecessary import, and renaming some macros to match the style used elsewhere.
Reviewed By: aartbik, bixia
Differential Revision: https://reviews.llvm.org/D138158
Peiming Liu [Wed, 16 Nov 2022 22:52:39 +0000 (22:52 +0000)]
[mlir][sparse] annotate loops that are generated by loop emitter.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138155
Jim Ingham [Thu, 17 Nov 2022 00:00:26 +0000 (16:00 -0800)]
Only use major version in the clang resource directory for standalone builds.
Commit
e1b88c8a09be changed the name of the clang resource directory so that
it was "lib/clang/<MajorVersion>" but missed the place in the LLDB standalone
build where we search for the resource directory. That was still looking for
<Major>.<Minor>.<Patch>. The standalone lldb bot has been failing since this
commit.
Adrian Prantl [Tue, 15 Nov 2022 00:24:36 +0000 (16:24 -0800)]
Make CompilerType safe
When a process gets restarted TypeSystem objects associated with it
may get deleted, and any CompilerType objects holding on to a
reference to that type system are a use-after-free in waiting. Because
of the SBAPI, we don't have tight control over where CompilerTypes go
and when they are used. This is particularly a problem in the Swift
plugin, where the scratch TypeSystem can be restarted while the
process is still running. The Swift plugin has a lock to prevent
abuse, but where there's a lock there can be bugs.
This patch changes CompilerType to store a std::weak_ptr<TypeSystem>.
Most of the std::weak_ptr<TypeSystem>* uglyness is hidden by
introducing a wrapper class CompilerType::WrappedTypeSystem that has a
dyn_cast_or_null() method. The only sites that need to know about the
weak pointer implementation detail are the ones that deal with
creating TypeSystems.
rdar://
101505232
Differential Revision: https://reviews.llvm.org/D136650
Eli Friedman [Wed, 16 Nov 2022 23:13:33 +0000 (15:13 -0800)]
[clang] Fix __try/__finally blocks in C++ constructors.
We were crashing trying to convert a GlobalDecl from a
CXXConstructorDecl. Instead of trying to do that conversion, just pass
down the original GlobalDecl.
I think we could actually compute the correct constructor/destructor
kind from the context, given the way Microsoft mangling works, but it's
simpler to just pass through the correct constructor/destructor kind.
Differential Revision: https://reviews.llvm.org/D136776
Florian Hahn [Wed, 16 Nov 2022 23:12:40 +0000 (23:12 +0000)]
[VPlan] Introduce VPValue::hasDefiningRecipe helper (NFC).
This clarifies the intention of code that uses the helper.
Suggested by @Ayal during review of D136068, thanks!
Florian Hahn [Wed, 16 Nov 2022 23:03:34 +0000 (23:03 +0000)]
[VPlan] Use recipe type to avoid getDefiningRecipe call (NFC).
Suggested by @Ayal during review of D136068, thanks!
Fangrui Song [Wed, 16 Nov 2022 22:47:53 +0000 (22:47 +0000)]
Revert D137868 "[libc] Fix builtin definition for memory functions"
This reverts commit
da5d00ad0cf4d45e38287280c670b08e84e27411.
This caused -Wmacro-redefined
```
.../libc/src/string/memory_utils/op_x86.h:31:9: error: '_mm512_cmpneq_epi8_mask' macro redefined [-Werror,-Wmacro-redefined]
^
.../lib/clang/google3-trunk/include/avx512bwintrin.h:294:9: note: previous definition is here
^
```
Matt Arsenault [Wed, 16 Nov 2022 21:48:52 +0000 (13:48 -0800)]
AMDGPU: Create poison values instead of undef
These placeholders don't care about the finer points on
the difference between the two.
Florian Hahn [Wed, 16 Nov 2022 22:39:50 +0000 (22:39 +0000)]
[VPlan] Update stale comment (NFC).
Update comment to reflect current code, which also allows for
VPScalarIVStepsRecipes to be uniform.
Suggested by @Ayal during review of D136068, thanks!
Tom Praschan [Wed, 16 Nov 2022 23:37:15 +0000 (00:37 +0100)]
[clangd] Add heuristic for dropping snippet when completing member function pointer
This implements the 1st heuristic mentioned in https://github.com/clangd/clangd/issues/968#issuecomment-
1002242704:
When completing a function that names a non-static member of a class, and we are not inside that class's scope, assume the reference will not be a call (and thus don't add the snippetSuffix)
Reviewed By: nridge
Differential Revision: https://reviews.llvm.org/D137040
Richard Smith [Wed, 9 Nov 2022 23:45:54 +0000 (15:45 -0800)]
When we run out of source locations, try to produce useful information
indicating why we ran out.
Florian Hahn [Wed, 16 Nov 2022 22:31:58 +0000 (22:31 +0000)]
[LV] Replace unnecessary cast_or_null with cast (NFC).
The existing code already unconditionally dereferences RepR, so
cast_or_null can be replaced by just cast.
Suggested by @Ayal during review of D136068, thanks!
Florian Hahn [Wed, 16 Nov 2022 22:17:08 +0000 (22:17 +0000)]
[VPlan] Remove unnecessary casts from tests after
32f1c5531b.
After
32f1c5531b, getDefiningRecipe returns a VPRecipeBase* so there's
no need to cast to VPRecipeBase.
Suggested by @Ayal during review of D136068, thanks!
Florian Hahn [Wed, 16 Nov 2022 22:12:08 +0000 (22:12 +0000)]
[VPlan] Update VPValue::getDef to return VPRecipeBase, adjust name(NFC)
The return value of getDef is guaranteed to be a VPRecipeBase and all
users can also accept a VPRecipeBase *. Most users actually case to
VPRecipeBase or a specific recipe before using it, so this change
removes a number of redundant casts.
Also rename it to getDefiningRecipe to make the name a bit clearer.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D136068
Ivan Butygin [Thu, 10 Nov 2022 19:53:36 +0000 (20:53 +0100)]
[mlir][linalg] Fix `FoldTensorCastProducerOp` for generic with memref output
Type should only be added to results if it is tensor.
Differential Revision: https://reviews.llvm.org/D137801
Ivan Butygin [Tue, 8 Nov 2022 15:48:10 +0000 (16:48 +0100)]
[mlir][arith] Fold `and(a, and(a, b))` to `and(a, b)`
Differential Revision: https://reviews.llvm.org/D137647
Mehdi Amini [Wed, 16 Nov 2022 21:35:26 +0000 (21:35 +0000)]
Improve diagnostic when parsing a custom op without registering the dialect
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D138151
Tom Honermann [Thu, 13 Oct 2022 20:47:08 +0000 (13:47 -0700)]
[Clang] Correct when Itanium ABI guard variables are set for non-block variables with static or thread storage duration.
Previously, Itanium ABI guard variables were set after initialization was
complete for non-block declared variables with static and thread storage
duration. That resulted in initialization of such variables being restarted
in cases where the variable was referenced while it was still under
construction. Per C++20 [class.cdtor]p2, such references are permitted
(though the value obtained by such an access is unspecified). The late
initialization resulted in recursive reinitialization loops for cases like
this:
template<typename T>
struct ct {
struct mc {
mc() { ct<T>::smf(); }
void mf() const {}
};
thread_local static mc tlsdm;
static void smf() { tlsdm.mf(); }
};
template<typename T>
thread_local typename ct<T>::mc ct<T>::tlsdm;
int main() {
ct<int>::smf();
}
With this change, guard variables are set before initialization is started
so as to avoid such reinitialization loops.
Fixes https://github.com/llvm/llvm-project/issues/57828
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D135919
Michael Jones [Fri, 11 Nov 2022 22:08:58 +0000 (14:08 -0800)]
[libc] Fix builtin definition for memory functions
The memory functions are highly performance sensitive and use builtins
where possible, but also need to define those functions names when they
don't exist to avoid compilation errors. Previously all those
redefinitions were behind the SSE2 flag for x86, which caused errors on
CPUs that supported SSE2 but not AVX512. This patch splits the various
CPU extensions out to avoid errors on such CPUs.
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D137868
Joshua Batista [Wed, 16 Nov 2022 20:06:43 +0000 (12:06 -0800)]
[HLSL] add cos library function
This change exposes the cos library function for HLSL,
excluding long, int, and long long doubles.
Cos is supported for all scalar, vector, and matrix types.
Long and long long double support is missing in this patch because those types
don't exist in HLSL. Int is missing because the cos function only works on floating type arguments.
The full documentation of the HLSL cos function is available here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-cos
Reviewed By: python3kgae
Differential Revision: https://reviews.llvm.org/D134921
Peiming Liu [Wed, 16 Nov 2022 20:03:23 +0000 (20:03 +0000)]
[mlir][sparse] fix CHECK test error on windows.
Reviewed By: aartbik, bixia
Differential Revision: https://reviews.llvm.org/D138147
Louis Dionne [Tue, 15 Nov 2022 21:41:55 +0000 (16:41 -0500)]
[clang] Don't include C++ Standard Library headers when -nostdinc is used
This is a follow-up to
53c98d85a, which made the same change but only
for GNU. It seems that we should try to provide a consistent behavior
across all targets.
This fixes an issue where clang/test/Driver/nostdincxx.cpp would start
failing on non-GNU targets because that test was too loose in its checks.
It would only check that 'file not found' was part of the error message,
but didn't ensure that the file we had not found was <vector>.
Differential Revision: https://reviews.llvm.org/D138062
bixia1 [Wed, 16 Nov 2022 18:49:48 +0000 (10:49 -0800)]
[mlir][sparse] Make integration tests run on both library and codegen pathes.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138145
Matt Arsenault [Tue, 18 Jan 2022 19:10:26 +0000 (14:10 -0500)]
OpenMP: Remove -fno-experimental-isel flag from testing
This effectively reverts
6f9e25d3824fb7b03dc6a403e1962d80a9c88ebe.
I didn't follow the complete history, but it seems this was added due
to AArch64's output changing in some fallback. Blockaddress definitely
works now, so just remove this.
Matt Arsenault [Wed, 16 Nov 2022 00:52:32 +0000 (16:52 -0800)]
AutoUpgrade: Fix assertion on invalid name mangling usage
This was trying to auto-upgrade a read_register call with missing type
mangling. This first would break since getCalledFunction checks the
callee type is consistent, so this would assert there. After that,
the replacement code would die on the type mismatch. Be more
defensive and let the verifier code produce an error that the IR
is broken.
Zequan Wu [Tue, 15 Nov 2022 01:23:18 +0000 (17:23 -0800)]
[AST] Fix class layout when using external layout under MS ABI.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D137806
Zequan Wu [Thu, 3 Nov 2022 23:13:59 +0000 (16:13 -0700)]
[LLDB][NativePDB] Forcefully complete a record type if it has empty debug info and is required to have complete type.
It's required in following situations:
1. As a base class.
2. As a data member.
3. As an array element type.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D134066
David Goldman [Tue, 15 Nov 2022 18:50:25 +0000 (10:50 -0800)]
Fix use of dangling stack allocated string in IncludeFixer
IncludeFixer uses this BuildDir string later on if given relative paths.
Differential Revision: https://reviews.llvm.org/D138047
Krzysztof Parzyszek [Wed, 16 Nov 2022 18:31:44 +0000 (10:31 -0800)]
[Hexagon] Rearrange bits in TSFlags, NFC
Alexey Bataev [Wed, 16 Nov 2022 17:56:07 +0000 (09:56 -0800)]
[SLP]Fix PR58766: deleted value used after vectorization.
If same instruction is reduced several times, but in one graph is part
of buildvector sequence and in another it is vectorized, we may loose
information that it was part of buildvector and must be extracted from
later vectorized value.
Tomas Matheson [Mon, 14 Nov 2022 12:36:23 +0000 (12:36 +0000)]
[ARM][AArch64] Move common code into ARMTargetParserCommon
Differential Revision: https://reviews.llvm.org/D138017