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
Joseph Huber [Wed, 16 Nov 2022 17:22:28 +0000 (11:22 -0600)]
[libc] Fix assert.h and ctype.h not being built
The `assert.h` and `ctype.h` headers are never built despite their
entrypoints being present in the generated library. This patch adds a
dependency on these headers so that they will be built properly.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D138142
Brett Werling [Wed, 16 Nov 2022 16:16:11 +0000 (08:16 -0800)]
[ELF] Handle GCC collect2 -plugin-opt= on Windows
Follows up on commit
cd5d5ce235081005173566c99c592550021de058 by
additionally ignoring relative paths ending in "lto-wrapper.exe" as
can be the case for GCC cross-compiled for Windows.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D138065
Muhammad Omair Javaid [Wed, 16 Nov 2022 17:41:41 +0000 (21:41 +0400)]
[llvm-objcopy] XFAIL ELF/update-section.test on 32-bit arm
ELF/update-section.test is failing on 32-bit arm targets. It was
enabled by commit
4f0a1201a462. I am marking it as XFAIL for now.
Simon Pilgrim [Wed, 16 Nov 2022 17:46:18 +0000 (17:46 +0000)]
[X86] Remove unnecessary override GFNI AFFINE reg-reg overrides from AlderlakeP model
Now matches the default SchedWriteVecIMul values used for the instruction.
NOTE: The folded variant overrides are still there as the latency differs by 1cy
Teresa Johnson [Wed, 16 Nov 2022 15:05:11 +0000 (07:05 -0800)]
Restore "[MemProf] ThinLTO summary support" with more fixes
This restores commit
98ed423361de2f9dc0113a31be2aa04524489ca9 and
follow on fix
00c22351ba697dbddb4b5bf0ad94e4bcea4b316b, which were
reverted in
5d938eb6f79b16f55266dd23d5df831f552ea082 due to an
MSVC bot failure. I've included a fix for that failure.
Differential Revision: https://reviews.llvm.org/D135714
Sander de Smalen [Wed, 16 Nov 2022 17:19:09 +0000 (17:19 +0000)]
[AArch64] NFC: Fix broken test sve-fixed-ld2-alloca.ll
There were several issues with this test, the most obvious being
that %strided.vec wasn't used and therefore could be deadcoded.
I've verified that the updated test still covers the code-changes
from its original patch.
Nick Desaulniers [Wed, 16 Nov 2022 17:19:16 +0000 (09:19 -0800)]
[LangRef] remove callbr references from Addresses of BasicBlock section
Since D129288, we no longer use BlockAddress constants as operands of
callbr.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D138080
Matt Arsenault [Wed, 16 Nov 2022 15:46:52 +0000 (07:46 -0800)]
MemoryBuiltins: Don't check for unsized allocas
The verifier rejects these.
Simon Pilgrim [Wed, 16 Nov 2022 16:58:16 +0000 (16:58 +0000)]
[MCA][X86] Add test coverage for VBMI instructions
Guray Ozen [Wed, 16 Nov 2022 16:23:43 +0000 (17:23 +0100)]
[mlir] Introduce `replaceUsesOfWith` to `RewriterBase`
Finding uses of a value and replacing them with a new one is a common method. I have not seen an safe and easy shortcut that does that. This revision attempts to address that by intoroducing `replaceUsesOfWith` to `RewriterBase`.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D138110
Sander de Smalen [Wed, 16 Nov 2022 15:03:03 +0000 (15:03 +0000)]
[SME] Store buffer to the correct pointer when setting up lazy-save.
This fixes a bug in 'allocateLazySaveBuffer' that led to the
buffer pointer being stored to the wrong address.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D137734
Mahesh Ravishankar [Wed, 16 Nov 2022 02:51:53 +0000 (02:51 +0000)]
[mlir][Linalg] Move patterns to remove dead arguments and results out of canonicalization.
The patterns to remove dead arguments and results of `linalg.generic`
operations are not necessarily canonicalizations. Instead a new entry
point `populateEraseUnusedOperandsAndResults` is added to allow using
these patterns when needed. The transformations that rely on this
pattern for cleanup now include these patterns explicitly.
Differential Revision: https://reviews.llvm.org/D138085
Aart Bik [Wed, 16 Nov 2022 05:11:31 +0000 (21:11 -0800)]
[mlir][sparse] bring CHECK tests back (but disabled)
We have a strange nondeterministic failure on windows
by not getting the desired fill statement in the resulting
IR. Probably something wrong with our option passing or
pass construction?
https://github.com/llvm/llvm-project/issues/59016#issuecomment-
1316410249
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D138089
Kadir Cetinkaya [Wed, 16 Nov 2022 14:49:47 +0000 (15:49 +0100)]
[include-cleaner] Defer decl->stdlib conversion into decl->location conversion
We preserve decls for stdlib symbols after this patch in symbol. That
way we have a more unified view of stdlib and regular decls and can provide
reacher information in applications.
Differential Revision: https://reviews.llvm.org/D138134
Matt Arsenault [Wed, 16 Nov 2022 01:49:53 +0000 (17:49 -0800)]
GlobalISel: Fold some idempotent operations
This makes the existing fabs_fabs fold redundant, which
I thought was using more tablegen matching, but apparently not.
I'm not sure how to make match work with multiple opcodes. There
are a few more this could handle, but these are the ones that
legalization are more likely to introduce.
Alexey Bataev [Wed, 16 Nov 2022 14:30:47 +0000 (06:30 -0800)]
[SLP]Fix PR58956: fix insertpoint for reduced buildvector graphs.
If the graph is only the buildvector node without main operation, need
to inherit insrtpoint from the redution instruction. Otherwise the
compiler crashes trying to insert instruction at the entry block.
zhongyunde [Wed, 16 Nov 2022 15:32:47 +0000 (23:32 +0800)]
[NFC] Fix typo in comment
Address comment in https://reviews.llvm.org/D137936
Differential Revision: https://reviews.llvm.org/D138124
Erich Keane [Wed, 16 Nov 2022 15:00:55 +0000 (07:00 -0800)]
[Concepts] Fix friend-checking to include NTTPs
More work for temp.friend p9, this fixes a previous bug where we didn't
properly consider a friend to depend on the enclosing template if it
only did so via an NTTP.
LLVM GN Syncbot [Wed, 16 Nov 2022 15:19:13 +0000 (15:19 +0000)]
[gn build] Port
332c4af35db9
Muhammad Omair Javaid [Wed, 16 Nov 2022 15:09:49 +0000 (19:09 +0400)]
Revert "[NFC] Make format() more amenable to format attributes"
This reverts commit
cf239c2f1777eb94a4801a086acf1332a7d3cccf.
It has broken tools/llvm-dwarfdump/X86/simplified-template-names.s on
following buildbot:
https://lab.llvm.org/buildbot/#/builders/178/builds/3148
serge-sans-paille [Wed, 9 Nov 2022 22:13:51 +0000 (23:13 +0100)]
[Lexer] Speedup LexTokenInternal
Only reset "NeedsCleaning" flag in case of re-entrant call.
Do not needlessly blank IdentifierInfo. This information will be set
once the token type is picked.
This yields a nice 1% speedup when pre-processing sqlite amalgamation
through:
valgrind --tool=callgrind ./bin/clang -E sqlite3.c -o/dev/null
Differential Revision: https://reviews.llvm.org/D137960
Jay Foad [Wed, 16 Nov 2022 14:57:01 +0000 (14:57 +0000)]
[AMDGPU] Reinstate some dwordx3 tests
Nicholas Guy [Tue, 15 Nov 2022 11:58:04 +0000 (11:58 +0000)]
[AArch64][CodeGen] Add AArch64 support for complex deinterleaving
Differential Revision: https://reviews.llvm.org/D129066
Joseph Huber [Wed, 16 Nov 2022 13:52:14 +0000 (07:52 -0600)]
[OMPT] Fix debug prefix not being defined
Summary:
This header file uses the `DP` prefixes but does not define
`DEBUG_PREFIX`. This patch adds a simple fix, but realistically the `DP`
system isn't ideal. Now that we have access to LLVM libraries and other
utilities we should consider rewriting all of the debugging and error
handling glue.
Paul Robinson [Fri, 4 Nov 2022 13:08:35 +0000 (06:08 -0700)]
[lit] Add `target=<triple>` as a feature keyword
As proposed first in D107162 and later in discourse at
https://discourse.llvm.org/t/rfc-lits-requires-and-triples/66041
Modified a couple of lit's own tests to use this; left others as-is,
because for now triple substrings still work in UNSUPPORTED/XFAIL.
Differential Revision: https://reviews.llvm.org/D137434
Dmitry Preobrazhensky [Wed, 16 Nov 2022 13:26:48 +0000 (16:26 +0300)]
[AMDGPU][GFX11] Refactor VOPD operands handling
Differential Revision: https://reviews.llvm.org/D137952
David Green [Wed, 16 Nov 2022 13:22:48 +0000 (13:22 +0000)]
[AArch64][MachineCombiner] Use MIMetadata to copy pcsections metadata to reassociated instructions.
D134260/D138107 exposed that the MachineCombiner was not copying
pcsections metadata where it should. This patch switches the MIBuild
methods to use MIMetadata that can copy the debug loc and pcsections at
the same time.
Differential Revision: https://reviews.llvm.org/D138112
Kevin Sala [Wed, 16 Nov 2022 13:11:00 +0000 (07:11 -0600)]
[Libomptarget] Build plugins-nextgen/common/PluginInterface with protected visibility
Summary:
This commit sets the default visibility of PluginInterface's symbols (in
nextgen plugins) as protected. This prevents symbols from a plugin
library to be preempted by another plugin library's symbol. It applies
the same fix introduced by D136365.
Issue reported by @ggeorgakoudis.
Differential Revision: https://reviews.llvm.org/D138002
Simon Pilgrim [Wed, 16 Nov 2022 13:11:04 +0000 (13:11 +0000)]
[DAG] simplifySelect - add support for vselect(0, T, F) -> F fold
We still need to add handling for the non-zero T fold (which requires getBooleanContents handling)
Guillaume Chatelet [Wed, 16 Nov 2022 11:01:02 +0000 (11:01 +0000)]
[libc][benchmark] Fix wrong BatchSize leading to data not fitting in L1.
Differential Revision: https://reviews.llvm.org/D138111
Lorenzo Chelini [Tue, 15 Nov 2022 09:39:07 +0000 (10:39 +0100)]
[MLIR][Tensor] Clean-up `ops.mlir` test (NFC)
Split input file was not used.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D138009
David Green [Wed, 16 Nov 2022 12:39:13 +0000 (12:39 +0000)]
[AArch64] Add GPR rr instructions to isAssociativeAndCommutative
This adds some more scalar instructions that are both associative and
commutative to isAssociativeAndCommutative, allowing the machine
combiner to reassociate them to reduce critical path length.
Differential Revision: https://reviews.llvm.org/D134260
John Brawn [Fri, 5 Nov 2021 10:11:00 +0000 (10:11 +0000)]
[AArch64] Mark all instructions that read/write FPCR as doing so
All instructions that can raise fp exceptions also read FPCR, with the
only other instructions that interact with it being the MSR/MRS to
write/read FPCR.
Introducing an FPCR register also requires adjusting
invalidateWindowsRegisterPairing in AArch64FrameLowering.cpp to use
the encoded value of registers instead of their enum value, as the
enum value is based on the alphabetical order of register names and
now FPCR is placed between FP and LR.
This change unfortunately means a large number of mir tests need to
be adjusted due to instructions now requiring an implicit fpcr operand
to be present.
Differential Revision: https://reviews.llvm.org/D121929
OCHyams [Wed, 16 Nov 2022 12:20:12 +0000 (12:20 +0000)]
[Assignment Tracking][11/*] Update RemoveRedundantDbgInstrs
The Assignment Tracking debug-info feature is outlined in this RFC:
https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir
Update the RemoveRedundantDbgInstrs utility to avoid sometimes losing
information when deleting dbg.assign intrinsics.
removeRedundantDbgInstrsUsingBackwardScan - treat dbg.assign intrinsics that
are not linked to any instruction just like dbg.values. That is, in a block of
contiguous debug intrinsics, delete all other than the last definition for a
fragment. Leave linked dbg.assign intrinsics in place.
removeRedundantDbgInstrsUsingForwardScan - Don't delete linked dbg.assign
intrinsics and don't delete the next intrinsic found even if it would otherwise
be eligible for deletion.
remomveUndefDbgAssignsFromEntryBlock - Delete undef and unlinked dbg.assign
intrinsics encountered in the entry block that come before non-undef
non-unlinked intrinsics for the same variable.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D133294