Jack Grigg [Mon, 17 Apr 2023 18:59:56 +0000 (11:59 -0700)]
github: Add manual workflow to build and upload release binaries
Reviewed By: kwk
Differential Revision: https://reviews.llvm.org/D143535
Jonas Devlieghere [Mon, 17 Apr 2023 18:58:27 +0000 (11:58 -0700)]
[lldb] Fix TestObjectFileJSON and TestSymbolFileJSON
- Separate the two test and only have TestSymbolFileJSON rely on strip.
- Use different file names to make sure LLDB reloads the module.
This should address all the post commit review from D148062.
Lang Hames [Mon, 17 Apr 2023 17:58:29 +0000 (10:58 -0700)]
[JITLink][ELF] Check that ELF buffer has at least ELF::EI_NIDENT bytes.
This allows the subsequent code to access the E_IDENT fields, which will be
used in the upcoming JITLink ppc64 backend (https://reviews.llvm.org/D148192).
Shraiysh Vaishay [Sun, 16 Apr 2023 02:16:16 +0000 (21:16 -0500)]
[nfc][llvm] Replace pointer cast functions in PointerUnion by llvm casting functions.
This patch replaces the uses of PointerUnion.is function by llvm::isa,
PointerUnion.get function by llvm::cast, and PointerUnion.dyn_cast by
llvm::dyn_cast_if_present. This is according to the FIXME in
the definition of the class PointerUnion.
This patch does not remove them as they are being used in other
subprojects.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D148449
mydeveloperday [Mon, 17 Apr 2023 18:38:53 +0000 (19:38 +0100)]
[clang-format] CSharp don't allow there not to be a space between `is` and `[`
as `is` is a keyword in C# ensure there is always a space before the `[` regardless of `SpaceBeforeSquareBrackets` setting
Fixes: #61965
https://github.com/llvm/llvm-project/issues/61965
Reviewed By: owenpan, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D148472
Anton Korobeynikov [Mon, 17 Apr 2023 18:29:59 +0000 (11:29 -0700)]
Revert "[lldb] Add support for MSP430 in LLDB."
This reverts commit
82c02b733c7736507a41a26bebd37d3f8e88bd4e.
Apparently, the original patch was not rebased onto `main
Lei Zhang [Mon, 17 Apr 2023 18:23:27 +0000 (11:23 -0700)]
[mlir][vector] Fix integer promotion type mismatch
We need to create a new type with transposed shape after
transposing the operand in `CanonicalizeContractMatmulToMMT`.
Reviewed By: kuhar, dcaballe
Differential Revision: https://reviews.llvm.org/D148470
Jonas Devlieghere [Mon, 17 Apr 2023 18:26:56 +0000 (11:26 -0700)]
Revert "[ADT] Apply fixes from modernize-type-traits (NFC)"
This reverts commit
9395cf063a013003704118deccf7633533170a5b because it
breaks the modules build:
STLFunctionalExtras.h:54:3: error:
'llvm::function_ref<std::__1::optional<std::__1::basic_string<char>>
(llvm::StringRef, llvm::StringRef)>::function_ref' from module
'LLVM_Utils.ADT.STLFunctionalExtras' is not present in definition of
'llvm::function_ref<std::__1::optional<std::__1::basic_string<char>>
(llvm::StringRef, llvm::StringRef)>' in module
'LLVM_Utils.ADT.STLFunctionalExtras'
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/53806/
Anton Korobeynikov [Mon, 17 Apr 2023 17:56:01 +0000 (10:56 -0700)]
[lldb] Add support for MSP430 in LLDB.
Add MSP430 to the list of available targets, implement MSP430 ABI, add support for debugging targets with 16-bit address size.
The update is intended for use with MSPDebug, a GDB server implementation for MSP430.
Reviewed By: bulbazord, DavidSpickett
Differential Revision: https://reviews.llvm.org/D146965
Yitzhak Mandelbaum [Fri, 14 Apr 2023 21:00:24 +0000 (21:00 +0000)]
[clang][dataflow] Drop optional model's dependency on libc++ internals.
Adjusts the matchers in the optional model to avoid dependency on internal
implementation details of libc++'s `std::optional`. In the process, factors out
the code to check the name of these types so that it's shared throughout.
Differential Revision: https://reviews.llvm.org/D148377
Yitzhak Mandelbaum [Fri, 14 Apr 2023 14:21:41 +0000 (14:21 +0000)]
[clang][dataflow] Refine matching of optional types to anchor at top level.
This patch refines the matching of the relevant optional types to anchor on the
global namespace. Previously, we could match anything with the right name
(e.g. `base::Optional`) even if nested within other namespaces. This over
matching resulted in an assertion violation when _different_ `base::Optional`
was encountered nested inside another namespace.
Fixes issue #57036.
Differential Revision: https://reviews.llvm.org/D148344
Markus Mützel [Mon, 17 Apr 2023 16:15:54 +0000 (09:15 -0700)]
[flang] Complex numbers in function arguments on Windows
Function arguments or return values that are complex floating point values
aren't correctly lowered for Windows x86 32-bit and 64-bit targets.
See: https://github.com/llvm/llvm-project/issues/61976
Add targets that are specific for these platforms and OS.
With thanks to @mstorsjo for pointing out the fix.
Reviewed By: vzakhari
Differential Revision: https://reviews.llvm.org/D147768
Han Zhu [Mon, 10 Apr 2023 22:40:15 +0000 (15:40 -0700)]
Second try: [clang][cmake] Add options to pass in vcs repo and revision info
V2: Fix cmake error when -DLLVM_APPEND_VC_REV=OFF
Clang may be built in an environment where Git is not available. In our case,
Clang is part of a larger monorepo which is not Git-based, and
GenerateVersionFromVCS was not able to get source info.
Provide options to pass in repo and revision info from cmake.
```
cmake \
-DCLANG_VC_REPOSITORY=abc://repo.url.com \
-DCLANG_VC_REVISION=
abcd1234 \
...
```
This would allow us to prepare the source info beforehand and pass it to the
clang binary.
Differential Revision: https://reviews.llvm.org/D148262
Snehasish Kumar [Fri, 14 Apr 2023 05:12:09 +0000 (05:12 +0000)]
[memprof] Print out profile build ids in the error message.
When no --profiled-binary flag is provided we can print out the build
ids of the modules in the profile. This can help the user fetch the
correct binary from e.g. remote object store.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D148301
Siva Chandra Reddy [Sun, 16 Apr 2023 07:28:41 +0000 (07:28 +0000)]
[libc][NFC] Remove the unused FDReader testutil.
Differential Revision: https://reviews.llvm.org/D148454
Peiming Liu [Tue, 4 Apr 2023 18:41:00 +0000 (18:41 +0000)]
[mlir][sparse] enable more sparse convolution kernels.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D147670
Alexandros Lamprineas [Mon, 20 Mar 2023 12:17:23 +0000 (12:17 +0000)]
[FuncSpec] Consider constant struct arguments when specializing.
Optionally enabled just like integer and floating point arguments.
Differential Revision: https://reviews.llvm.org/D145374
Caslyn Tonelli [Sun, 16 Apr 2023 02:03:58 +0000 (02:03 +0000)]
[scudo] Descriptive Fucshia errors
`dieOnError` in fuchsia.cpp takes the syscall name, status code, and
relevant size parameter to describe what failed, the reason, and size
context. Several different Fuchsia syscalls can fail underlying Scudo's
map operation and gets hidden if using `dieOnMapUnmapError`.
The reason for this change is to provide an error status code and more
helpful information to debug failures.
Nikolas Klauser [Sun, 16 Apr 2023 14:16:34 +0000 (16:16 +0200)]
[libc++][NFC] Remove some dead code in common_type
Reviewed By: #libc, Mordante
Spies: Mordante, libcxx-commits
Differential Revision: https://reviews.llvm.org/D148466
John-Earnshaw [Mon, 17 Apr 2023 17:11:20 +0000 (10:11 -0700)]
[Docs] Added RTTI, Run-time Type Information
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148538
Han Zhu [Mon, 17 Apr 2023 17:08:34 +0000 (10:08 -0700)]
Revert "[clang][cmake] Add options to pass in vcs repo and revision info"
This reverts commit
1f5e737fc135bf991889a1364b8f8c5edc3953d2.
Eduard Zingerman [Tue, 11 Apr 2023 18:08:45 +0000 (21:08 +0300)]
[BPF] Make sure ALU32 feature is set in MCSubtargetInfo for mcpu=v3
`BPF.td` is used to generate (among other things) `MCSubtargetInfo`
setup function for BPF target.
Specifically, the `BPFGenSubtargetInfo.inc` file:
enum {
ALU32 = 0,
...
};
...
extern const llvm::SubtargetSubTypeKV BPFSubTypeKV[] = {
{ "generic", { { { 0x0ULL, ... } } }, ... },
{ "probe", { { { 0x0ULL, ... } } }, ... },
{ "v1", { { { 0x0ULL, ... } } }, ... },
{ "v2", { { { 0x0ULL, ... } } }, ... },
{ "v3", { { { 0x1ULL, ... } } }, ... },
};
...
static inline MCSubtargetInfo *createBPFMCSubtargetInfoImpl(...) {
return new BPFGenMCSubtargetInfo(..., BPFSubTypeKV, ...);
}
The `SubtargetSubTypeKV` is defined in `MCSubtargetInfo.h` as:
/// Used to provide key value pairs for feature and CPU bit flags.
struct SubtargetSubTypeKV {
const char *Key; ///< K-V key string
FeatureBitArray Implies; ///< K-V bit mask
FeatureBitArray TuneImplies; ///< K-V bit mask
const MCSchedModel *SchedModel;
...
}
The first bit array specifies features enabled by default for a
specific CPU. This commit makes sure that this information is
communicated to `tablegen` and correct `BPFSubTypeKV` table is
generated. This allows tools like `objdump` to detect available
features when `--mcpu` flag is specified.
Differential Revision: https://reviews.llvm.org/D148037
Zequan Wu [Thu, 30 Mar 2023 19:01:21 +0000 (15:01 -0400)]
[DebugInfo] Fix file path separator when targeting windows.
This fixes two problems:
1. When crossing compiling for windows on linux, source file path in debug info is concatenated with directory by host native separator ('/'). For windows local build, they are concatenated by '\'. This causes non-determinism bug.
The solution here is to let `LangOptions.UseTargetPathSeparator` to control if we should use host native separator or not.
2. Objectfile path in CodeView also uses host native separator when generated.
It's fixed by changing the path separator in `/Fo` to '\' if the path is not an absolute path when adding the `-object-file-name=` flag.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D147256
Fangrui Song [Mon, 17 Apr 2023 16:57:53 +0000 (09:57 -0700)]
[Parse] Remove TimeTraceScope for "ParseTemplate"
Fix https://github.com/llvm/llvm-project/issues/56554
```
#include "1.h"
#include "2.h"
int foo();
```
Suppose that 1.h ends with a template function. When parsing the function,
the `ParseFunctionDefinition` call after the TimeTraceScope object
may consume a `r_brace` token and lex the end of file (1.h), resulting
in an ExitFile event in SemaPPCallbacks::FileChanged. This event will call `llvm::timeTraceProfilerEnd();`,
which incorrectly ends "ParseTemplate" instead of "Source" (1.h).
Once 2.h has been fully parsed, the destructor of 1.h's TimeTraceScope object
will end "Source" (1.h).
This behavior erroneously extends the end of "Source" (1.h), which makes
"Source" (2.h) appear to be nested inside "Source" (1.h). This bug is difficult
to fix correctly in an elegant way, and we have two options: either end
"ParseTemplate" when ending "Source" (1.h), or delay the ExitFile event.
However, both approaches require complex code. For now, we can remove the
"ParseTemplate" TimeTraceScope. This can be re-added if properly repaired.
Reviewed By: anton-afanasyev
Differential Revision: https://reviews.llvm.org/D148410
Peiming Liu [Tue, 4 Apr 2023 18:41:00 +0000 (18:41 +0000)]
[mlir][sparse] use macro to build common operations in LoopEmitter
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D147553
Thurston Dang [Mon, 17 Apr 2023 16:55:24 +0000 (16:55 +0000)]
Revert "[test][sanitizer] Add another stress test for pthread_create"
Reverting
364884e088d45b162ecb47d093f955a2333eeee1 because it appears the sanitizers are not yet ready to be stressed out (build failures starting from https://lab.llvm.org/buildbot/#/builders/37/builds/21483).
Joseph Huber [Mon, 17 Apr 2023 14:11:09 +0000 (09:11 -0500)]
[libc] Add special handling for CUDA PTX features
The NVIDIA compilation path requires some special options. This is
mostly because compilation is dependent on having a valid CUDA
toolchain. We don't actually need the CUDA toolchain to create the
exported `libcgpu.a` library because it's pure LLVM-IR. However, for
some language features we need the PTX version to be set. This is
normally set by checking the CUDA version, but without one installed it
will fail to build. We instead choose a minimum set of features on the
desired target, inferred from
https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#release-notes
and the PTX refernece for functions like `nanosleep`.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D148532
Han Zhu [Mon, 10 Apr 2023 22:40:15 +0000 (15:40 -0700)]
[clang][cmake] Add options to pass in vcs repo and revision info
Clang may be built in an environment where Git is not available. In our case,
Clang is part of a larger monorepo which is not Git-based, and
GenerateVersionFromVCS was not able to get source info.
Provide options to pass in repo and revision info from cmake.
```
cmake \
-DCLANG_VC_REPOSITORY=abc://repo.url.com \
-DCLANG_VC_REVISION=
abcd1234 \
...
```
This would allow us to prepare the source info beforehand and pass it to the
clang binary.
Differential Revision: https://reviews.llvm.org/D148262
OCHyams [Mon, 17 Apr 2023 16:18:36 +0000 (17:18 +0100)]
[NFC][Assignment Tracking] Rename flag variable in Options.td
Prefix the variable with 'f' to match other 'f' options.
Lang Hames [Mon, 17 Apr 2023 15:26:28 +0000 (15:26 +0000)]
[ORC][LLJIT] Use JITLink by default on ELF/x86-64.
This patch switches LLJIT's default JIT linker for ELF/x86-64 from RuntimeDyld
to JITLink.
Most clients should not be affected, but if you were explicitly accessing the
old RTDyldObjectLinkingLayer (e.g. to install JITEventListeners) you will need
to either force use of RuntimeDyld (following the example in
llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer), or switch to
using JITLink plugins instead.
Peiming Liu [Fri, 24 Mar 2023 16:16:21 +0000 (16:16 +0000)]
[mlir][sparse] implement index redution on dense level (for CSR)
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D147550
NAKAMURA Takumi [Mon, 17 Apr 2023 16:17:38 +0000 (01:17 +0900)]
[Bazel] Move InstCombineTableGen from InstCombine to AMDGPUCodeGen
David Green [Mon, 17 Apr 2023 16:22:46 +0000 (17:22 +0100)]
[AArch64][GISel] Add FP16 fcmp lowering
This adds v4f16 and v8f16 lowering for fp16 vector compares. It splits the
getActionDefinitionsBuilder of G_FCMP from G_ICMP, as they are quite different
operations, and adds fp16 vector lowering.
Differential Revision: https://reviews.llvm.org/D147947
V Donaldson [Fri, 14 Apr 2023 18:54:07 +0000 (11:54 -0700)]
[flang] REAL(KIND=3) and COMPLEX(KIND=3) descriptors
Update descriptor generation to correctly set the `type` field for
REAL(3) and COMPLEX(3) objects.
Siva Chandra Reddy [Fri, 14 Apr 2023 22:11:33 +0000 (22:11 +0000)]
[libc][NFC] Remove the StreamWrapper class and use the new test logger.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D148452
aabhinavg [Mon, 17 Apr 2023 15:43:37 +0000 (21:13 +0530)]
Fix the indentation error.
Differential Revision: https://reviews.llvm.org/D148535
Siva Chandra Reddy [Mon, 17 Apr 2023 06:41:22 +0000 (06:41 +0000)]
[libc][NFC] Move RandUtils.h to test/src/math.
It is currently used only by math tests so moving it to test/src/math
keeps it closer to where it is used.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D148497
David Spickett [Mon, 17 Apr 2023 13:40:16 +0000 (13:40 +0000)]
[clang] Replace find_executable with shutil.which in creduce script
distutils is deprecated and shutil.which is the suggested
replacement for this function.
https://peps.python.org/pep-0632/#migration-advice
https://docs.python.org/3/library/shutil.html#shutil.which
which was added in 3.3 (https://docs.python.org/3/library/shutil.html#shutil.which)
and LLVM requires at least 3.6 (https://llvm.org/docs/GettingStarted.html#software).
There is one small differnce here that shutil.which ignores the PATH
when given a path argument. However in this case I think that's actually
the behaviour we want.
Reviewed By: zequanwu
Differential Revision: https://reviews.llvm.org/D148529
Jay Foad [Fri, 10 Mar 2023 14:14:06 +0000 (14:14 +0000)]
[AMDGPU] Don't select _SGPR forms of SMEM instructions on GFX9+
On GFX9+, SMEM instructions have an _SGPR_IMM form which is strictly
more powerful than the _SGPR form. It simplifies codegen if we always
select the _SGPR_IMM form with an immediate offset of 0 instead of the
_SGPR form.
Note that this patch just makes minimal changes to the selection
patterns to prove the concept. Further simplifications are possible to
reduced the number of selection patterns.
On GFX9 the _SGPR form of the Real instruction is still required for
assembly/disassembly but on GFX10+ it can be removed completely.
Differential Revision: https://reviews.llvm.org/D147334
Florian Hahn [Mon, 17 Apr 2023 15:19:12 +0000 (16:19 +0100)]
[LV] Precommit test for D147963.
Reduced test case for #58811.
aabhinavg [Mon, 17 Apr 2023 14:48:38 +0000 (20:18 +0530)]
[docs][LangRef] Added minor update inside the `frem`. Fix : #61653
Added minor update inside the `frem`. Fix : #61653
Differential Revision: https://reviews.llvm.org/D146900
Valentin Clement [Mon, 17 Apr 2023 15:05:51 +0000 (08:05 -0700)]
Revert "[mlir][openacc][NFC] Use assembly format for acc.loop"
This reverts commit
7960993e4638c6243c4b37f05bb61b080fe13d43.
David Spickett [Mon, 17 Apr 2023 13:28:22 +0000 (13:28 +0000)]
[libcxx] Replace find_executable with shutil.which
distutils is deprecated and shutil.which is the suggested
replacement for this function.
https://peps.python.org/pep-0632/#migration-advice
https://docs.python.org/3/library/shutil.html#shutil.which
which was added in 3.3 (https://docs.python.org/3/library/shutil.html#shutil.which)
and LLVM requires at least 3.6 (https://llvm.org/docs/GettingStarted.html#software).
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D148527
David Green [Mon, 17 Apr 2023 15:00:57 +0000 (16:00 +0100)]
[AArch64] Add a basic pattern for FACGE and FACGT
These instructions take the absolute of two values and perform a FCMGE/FCMGT
between them. This patch adds some basic patterns for them.
Differential Revision: https://reviews.llvm.org/D147945
Kadir Cetinkaya [Mon, 27 Mar 2023 10:29:22 +0000 (12:29 +0200)]
[clangd] Use all inputs to SystemIncludeExtractor in cache key
Instead of passing in a tooling::CompileCommand into system include
extraction, pass a limited set, whose elements are used as keys.
Also fix the issue around accepting `-isysroot=/foo` which isn't a valid
argument (or the directory should be `=/foo` not `/foo`).
Fixes https://github.com/clangd/clangd/issues/1404
Fixes https://github.com/clangd/clangd/issues/1403
This should also unblock https://reviews.llvm.org/D138546
Differential Revision: https://reviews.llvm.org/D146941
Saleem Abdulrasool [Mon, 17 Apr 2023 14:52:38 +0000 (07:52 -0700)]
PECOFF: consume errors properly
We would not ensure that the error is consumed in the case that logging
is disabled. Ensure that we properly drop the error on the floor or we
would re-trigger the checked failure.
Differential Revision: https://reviews.llvm.org/D147669
Reviewed By: sgraenitz
Valentin Clement [Mon, 17 Apr 2023 14:52:50 +0000 (07:52 -0700)]
[mlir][openacc][NFC] Use assembly format for acc.loop
Use the assembly format with custom parser/printer
for specific clauses instead of a full custom parser/printer.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D148391
Martin Storsjö [Wed, 5 Apr 2023 11:52:30 +0000 (14:52 +0300)]
[libcxxabi] [test] Use the correct printf formats for printing pointers
Don't cast the pointers to long, as that's not large enough for
pointers on 64 bit Windows.
Differential Revision: https://reviews.llvm.org/D147640
Joseph Huber [Mon, 17 Apr 2023 14:36:13 +0000 (09:36 -0500)]
[libc][fix] Only use the object files when targeting NVPTX
Summary:
The `nvlink` linker doesn't support static libraries, so we just pass in
the object files. The condition was erroneously doing this for every
single GPU architecture and not just NVIDIA. The AMDGPU support handles
static libraries just fine.
Joseph Huber [Mon, 17 Apr 2023 14:33:08 +0000 (09:33 -0500)]
[libc] Add dependency on the loader for GPU tests
Summary:
We need a dependency here so the loader is up-to-date whenever we run
the tests again.
Pavel Kosov [Mon, 17 Apr 2023 14:01:21 +0000 (17:01 +0300)]
[LLVM][OHOS] Use emulated TLS for OHOS platform
Both Linux and LiteOS for all OpenHarmony targets use emulated TLS
~~~
Huawei RRI, OS Lab
Reviewed By: DavidSpickett, jrtc27, MaskRay
Differential Revision: https://reviews.llvm.org/D145224
Job Noorman [Mon, 17 Apr 2023 12:55:11 +0000 (14:55 +0200)]
[BOLT] Fix use-after-free in RewriteInstance::mapCodeSections
When a cold function is too large, its section gets deregistered.
However, the section is still dereferenced later to get its RuntimeDyld
ID. This patch moves the deregistration to after the last dereference.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D148427
Aaron Ballman [Mon, 17 Apr 2023 14:08:40 +0000 (10:08 -0400)]
Speculatively fix a failing bot
This attempts to resolve the issue found by:
https://lab.llvm.org/buildbot/#/builders/139/builds/39296
Peixin Qiao [Mon, 17 Apr 2023 13:55:51 +0000 (21:55 +0800)]
[InstSimplify] Precommit a test
This patch precommits a test for:
https://reviews.llvm.org/D148420
Takuya Shimizu [Mon, 17 Apr 2023 13:48:58 +0000 (09:48 -0400)]
Constexpr evaluator should treat [[gnu::weak]] member pointer comparisons as evaluation failure
This patch fixes the wrong signal from the constexpr evaluator that
[[gnu::weak]] member pointer comparison is valid, while it is emitting
notes on them.
I found a crashing case fixed by this change and added it as a test
case: https://godbolt.org/z/8391fGjGn
I noticed this while I was working on D146358.
Differential Revision: https://reviews.llvm.org/D148419
Nikita Popov [Mon, 17 Apr 2023 13:47:11 +0000 (15:47 +0200)]
[LoopDeletion] Don't delete loop exiting to EH pad (PR62160)
We can't branch directly to the EH pad, which is what the current
loop deletion code would try to do. We would need a different
approach here, which retains the invoke. This edge case does not
look worth bothering with.
Fixes https://github.com/llvm/llvm-project/issues/62160.
Simon Pilgrim [Mon, 17 Apr 2023 13:42:14 +0000 (14:42 +0100)]
[Support] Add MVT::getDoubleNumVectorElementsVT helper.
Matches the equivalent EVT::getDoubleNumVectorElementsVT helper.
This allows us to consistently MVT instead of EVT in the combinePTESTCC method.
Nikolas Klauser [Wed, 29 Mar 2023 15:58:25 +0000 (17:58 +0200)]
[clang] Add __is_trivially_equality_comparable
This patch adds a new trait to allow standard libraries to forward `std::equal` calls to `memcmp` in more cases.
Reviewed By: aaron.ballman
Spies: Mordante, shafik, xbolva00, libcxx-commits, cfe-commits, ldionne
Differential Revision: https://reviews.llvm.org/D147175
Tom Eccles [Thu, 13 Apr 2023 10:48:12 +0000 (10:48 +0000)]
[flang][hlfir] lower hlfir.get_extent to FIR
By the ConvertToFIR pass, the hlfir.get_shape operation will have been
lowered into a fir.shape operation (during the HFLIR bufferization pass)
and so, lowering get_extent is as simple as fetching the extent from the
shape operation.
Depends on: D146833
Differential Revision: https://reviews.llvm.org/D148222
Tom Eccles [Fri, 17 Mar 2023 15:49:22 +0000 (15:49 +0000)]
[flang][hlfir] lower hlfir.shape_of
If possible the shape is gotten from the bufferization of the expr
argument.
The simple cases should already have been resolved during lowering. This
is mostly intended for cases where shape information is added in between
lowering and the end of bufferization (for example transformational
intrinsics with assumed shape arguments).
Depends on: D146832
Differential Revision: https://reviews.llvm.org/D146833
Tom Eccles [Thu, 2 Mar 2023 15:52:20 +0000 (15:52 +0000)]
[flang][hlfir] get extents from hlfir.shape_of
If the extents were known, this should have been canonicalised into a
fir.shape operation. Therefore, the extents at this point are not known at
compile time. Use hlfir.get_extents to delay resolving the real extent
until after the expression is bufferized.
Depends On: D146831
Differential Revision: https://reviews.llvm.org/D146832
Tom Eccles [Thu, 2 Mar 2023 15:51:31 +0000 (15:51 +0000)]
[flang][hlfir] get shape from HLFIR expr using hlfir.shape_of
Depends On: D146830
Differential Revision: https://reviews.llvm.org/D146831
Tom Eccles [Wed, 12 Apr 2023 14:57:45 +0000 (14:57 +0000)]
[flang][hlfir] add hlfir.get_extent
This operation fetches an extent value from a fir.shape. The operation
could just as easily live in the fir namespace, but is only needed for
hlfir lowering so I put it here.
This operation is required to allow one to defer getting the extents of a shape
generated by hlfir.get_shape until after that shape has been resolved
(after bufferization of the hlfir.expr).
This operation will be lowered to FIR as an arith.constant created using
the definition of the fir.shape argument.
Depends on: D146830
Differential Revision: https://reviews.llvm.org/D148220
Tom Eccles [Wed, 1 Mar 2023 10:20:15 +0000 (10:20 +0000)]
[flang][hlfir] add hlfir.shape_of
This is an operation which returns the fir.shape for a hlfir.expr.
A hlfir.expr can be defined by:
- A transformational intrinsic (e.g. hlfir.matmul)
- hlfir.as_expr
- hlfir.elemental
hlfir.elemental is easy because there is a compulsory shape operand.
hlfir.as_expr is defined as operating on a variable (defined using a
hlfir.declare). hlfir.declare has an optional shape argument. The
transformational intrinsics do not have an associated shape.
If all extents are known at compile time, the extents for the shape can
be fetched from the hlfir.expr's type. For example, the result of a
hlfir.matmul with arguments who's extents are known at compile time will
have constant extents which can be queried from the type. In this case
the hlfir.shape_of will be canonicalised to a fir.shape operation using
those extents.
If not all extents are known at compile time, shapes have to be read
from boxes after bufferization. In the case of the transformational
intrinsics, the shape read from the result box can be queried from the
hlfir.declare operation for the buffer allocated to that hlfir.expr (via
the hlfir.as_expr).
Differential Revision: https://reviews.llvm.org/D146830
Mikhail R. Gadelha [Mon, 17 Apr 2023 13:16:56 +0000 (10:16 -0300)]
[libc][NFC] Standardize missing syscalls error messages.
This patch standardizes the error messages when a syscall is not
available to be in the format: "ABC and DEF syscalls are not available."
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D148373
Simon Pilgrim [Mon, 17 Apr 2023 13:09:56 +0000 (14:09 +0100)]
[X86] combinePTESTCC - fold TESTZ(OR(LO(X),HI(X)),OR(LO(Y),HI(Y))) -> TESTZ(X,Y) for TESTPS/TESTPD ops
Followup to the fix for #62171, adding support for TESTPS/TESTPD opcodes
Luke Lau [Mon, 17 Apr 2023 10:29:06 +0000 (11:29 +0100)]
[RISCV] Fix RUN line in fixed-vectors-abs-vp.ll
Reviewed By: fakepaper56
Differential Revision: https://reviews.llvm.org/D148510
Florian Hahn [Mon, 17 Apr 2023 12:49:48 +0000 (13:49 +0100)]
[LV] Regenreate check lines fr pr33706.ll
This avoids conflicts when regenerating check lines.
Florian Hahn [Mon, 17 Apr 2023 12:38:00 +0000 (13:38 +0100)]
[VPlan] Remove uneeded NeedsVectorIV from VPWidenIntOrFpInduction.
After recent improvements, all instances of
VPWidenIntOrFpInductionRecipe should needs a vector IV and there's no
need for a separate field.
Mariya Podchishchaeva [Mon, 17 Apr 2023 11:53:43 +0000 (07:53 -0400)]
[clang] Do not crash after suggesting typo correction to constexpr if condition
In some cases non-null non-constant yet valid expression may reach point where
`ConditionResult` is created. For example, typo correction mechanism can return
such expression, so double check before evaluating it.
Fixes https://github.com/llvm/llvm-project/issues/61885
Reviewed By: tbaeder, aaron.ballman
Differential Revision: https://reviews.llvm.org/D148206
Bjorn Pettersson [Mon, 17 Apr 2023 12:23:27 +0000 (14:23 +0200)]
Revert "[Passes] Remove legacy PM versions of InstructionNamer and MetaRenamer"
This reverts commit
981ec1faeb508a364cc47c8246b72fc89dd8c1d8.
It broke polly build bots. Polly still uses -instnamer with legacy PM.
Nikita Popov [Wed, 22 Mar 2023 10:53:01 +0000 (11:53 +0100)]
Reapply [SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating
This exposed a miscompile in GVN, which was fixed by D148129.
-----
After D141386, violation of nonnull, range and align metadata
results in poison rather than immediate undefined behavior,
which means that these are now safe to retain when speculating.
We only need to remove UB-implying metadata like noundef.
This is done by adding a dropUBImplyingAttrsAndMetadata() helper,
which lists the metadata which is known safe to retain on speculation.
Differential Revision: https://reviews.llvm.org/D146629
Florian Hahn [Mon, 17 Apr 2023 12:08:14 +0000 (13:08 +0100)]
[LV] Extend recurrence test coverage for sinking memory instructions.
Extra coverage for D143604, D143605.
ManuelJBrito [Mon, 17 Apr 2023 10:31:22 +0000 (11:31 +0100)]
[Clang][X86] Change X86 cast intrinsics to use __builtin_nondeterministic_value
The following intrinsics are currently implemented using a shufflevector with
an undefined mask, this is however incorrect according to intel's semantics for
undefined value which expect an unknown but consistent value.
With __builtin_nondeterministic_value we can now match intel's undefined value.
Differential Revision: https://reviews.llvm.org/D143287
Bjorn Pettersson [Sun, 16 Apr 2023 21:17:58 +0000 (23:17 +0200)]
[Passes] Remove legacy PM versions of InstructionNamer and MetaRenamer
Bjorn Pettersson [Sat, 15 Apr 2023 08:58:22 +0000 (10:58 +0200)]
[Vectorize] Clean up Transforms/Vectorize.h
Removed definitions of vectorizeBasicBlock and VectorizeConfig
(possibly a remnant from the BBVectorize pass that was removed
way back in 2017).
Also reduced amount of include dependencies to Transforms/Vectorize.h.
Bjorn Pettersson [Sat, 15 Apr 2023 08:16:09 +0000 (10:16 +0200)]
Remove several no longer needed includes. NFCI
Mostly removing includes of InitializePasses.h and Pass.h in
passes that no longer has support for the legacy PM.
Adrian Kuegel [Mon, 17 Apr 2023 11:50:29 +0000 (13:50 +0200)]
[mlir] Apply ClangTidy fix.
The argument name 'useBarePtrCallConv' does not match the actual
parameter name 'useBarePointerCallConv'.
Florian Hahn [Mon, 17 Apr 2023 11:30:52 +0000 (12:30 +0100)]
[VPlan] Mark recurrence recipes as not having side-effects.
Add support for FirstOrderRecurrenceSplice and VPFirstOrderRecurrencePHI
recipes to mayHaveSideEffects. They both don't have side-effects.
Adrian Kuegel [Mon, 17 Apr 2023 11:15:45 +0000 (13:15 +0200)]
[mlir] Remove unused using llvm::Twine declaration (NFC).
Nikita Popov [Fri, 14 Apr 2023 13:30:27 +0000 (15:30 +0200)]
[Pipelines] Add LoopSink and DivRemPairs to LTO post-link pipeline
As pointed out in D148010, these passes are missing from the LTO
post-link pipeline. They are present in the pre-link pipeline,
but LoopSink is completely useless there (it will always be fully
undone by LICM post-link) and DivRemPairs is mostly useless
(I believe most of what it does will be undone by InstCombine).
I've not added RelLookupTableConverterPass, because it's also
disabled in the LTO pre-link pipeline, with a comment that there
is an unresolved issue with full LTO.
Compile-time impact of the extra passes is minimal. Of course,
LoopSink will have a larger impact in PGO builds.
Differential Revision: https://reviews.llvm.org/D148343
Nikita Popov [Mon, 17 Apr 2023 10:52:58 +0000 (12:52 +0200)]
Revert "ValueTracking: Handle freeze in computeKnownFPClass"
This reverts commit
2c8d0048f03d054f13909a26f959ef95b2a0a4de.
This is incorrect: computeKnownFPClass() is only known up to
poison, and freeze poison may have any FP class.
Florian Hahn [Mon, 17 Apr 2023 10:56:56 +0000 (11:56 +0100)]
[LV] Add users to recurrence tests to make sure they are not removable.
This ensures VPlan-based DCE won't be able to remove the unused
recurrences.
It also adds a dedicated new test (@unused_recurrence) where an unused
recurrence can be removed.
Nikita Popov [Fri, 14 Apr 2023 09:48:54 +0000 (11:48 +0200)]
[GVN] Adjust metadata for coerced load CSE
When reusing a load in a way that requires coercion (i.e. casts or
bit extraction) we currently fail to adjust metadata. Unfortunately,
none of our existing tooling for this is really suitable, because
combineMetadataForCSE() expects both loads to have the same type.
In this case we may work on loads of different types and possibly
offset memory location.
As such, what this patch does is to simply drop all metadata, with
the following exceptions:
* Metadata for which violation is known to always cause UB.
* If the load is !noundef, keep all metadata, as this will turn
poison-generating metadata into UB as well.
This fixes the miscompile that was exposed by D146629.
Differential Revision: https://reviews.llvm.org/D148129
David Sherwood [Mon, 3 Apr 2023 16:14:09 +0000 (16:14 +0000)]
[LoopVectorize] Take vscale into account when deciding to create epilogues
In LoopVectorizationCostModel::isEpilogueVectorizationProfitable we
check to see if the chosen main vector loop VF >= 16. If so, we
decide to create a vector epilogue loop. However, this doesn't
take VScaleForTuning into account because we could be targeting a
CPU where vscale > 1, and hence the runtime VF would be a multiple
of the known minimum value.
This patch multiplies scalable VFs by VScaleForTuning and several
tests have been updated that now produce vector epilogues.
Differential Revision: https://reviews.llvm.org/D147522
Simon Pilgrim [Mon, 17 Apr 2023 10:40:39 +0000 (11:40 +0100)]
[X86] combinePTESTCC - only fold TESTZ(OR(LO(X),HI(X)),OR(LO(Y),HI(Y))) -> TESTZ(X,Y) for TESTP ops
Stop value type mismatch assertions, we can add TESTPS/TESTPD support to this in the future.
Fixes #62171
Louis Dionne [Mon, 17 Apr 2023 10:40:51 +0000 (11:40 +0100)]
[libc++] Add annotation for arm64e in the strong_order test for long double
As a fly-by, improve readability by giving a bit more space to some
comments.
Nikita Popov [Fri, 14 Apr 2023 13:46:45 +0000 (15:46 +0200)]
[DAGCombiner] Fold add (mul x, C), x to mul x, C+1
While this is normally non-canonical IR, this pattern can appear
during SDAG lowering if the add is actually a getelementptr, as
illustrated in `@test_ptr`. This pattern comes up when doing
provenance-aware high-bit pointer tagging.
Proof: https://alive2.llvm.org/ce/z/DLoEcs
Fixes https://github.com/llvm/llvm-project/issues/62093.
Differential Revision: https://reviews.llvm.org/D148341
Sergio Afonso [Fri, 14 Apr 2023 13:07:02 +0000 (14:07 +0100)]
[OpenMP][MLIR] Prevent constant hoisting out of target regions
This patch prevents constant operations defined inside `omp.target` from being
hoisted out and into their parent functions by canonicalization passes.
Differential Revision: https://reviews.llvm.org/D148349
David Green [Mon, 17 Apr 2023 09:21:46 +0000 (10:21 +0100)]
[AArch64] Add tests for vacgt/vacge. NFC
See D147945.
Akshay Khadse [Mon, 17 Apr 2023 08:16:23 +0000 (16:16 +0800)]
Fix uninitialized pointer members in CodeGen
This change initializes the members TSI, LI, DT, PSI, and ORE pointer feilds of the SelectOptimize class to nullptr.
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D148303
Florian Hahn [Mon, 17 Apr 2023 08:30:25 +0000 (09:30 +0100)]
[LV] Don't sink scalar instructions that may read from memory.
The current sinking code doesn't prevent us from sinking a load past an
aliasing store. Skip sinking instructions that may read from memory to
avoid a mis-compile.
See @minimal_bit_widths_with_aliasing_store for an example where 2 loads
are sunk past aliasing stores before this fix.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D147259
Zain Jaffal [Fri, 14 Apr 2023 15:19:31 +0000 (16:19 +0100)]
[ConstraintElimination] Transfer info from sgt %a, %b to ugt %a, %b if %b > 0
Differential Revision: https://reviews.llvm.org/D148326
Wang, Xin10 [Mon, 17 Apr 2023 08:09:00 +0000 (04:09 -0400)]
remove useless call in MIRSampleProfile.cpp
This call getSummary returns a value but nobody take
it.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D148305
Timm Bäder [Sat, 15 Apr 2023 08:16:51 +0000 (10:16 +0200)]
[clang][NFC] Use range-for loop in SemaLookup.cpp
David Spickett [Mon, 13 Mar 2023 13:22:01 +0000 (13:22 +0000)]
[lldb] Change some pointers to refs in register printing code
No one was passing nullptr for these.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D148228
Ben Shi [Sat, 14 Jan 2023 08:40:43 +0000 (16:40 +0800)]
[AVR] Fix an issue of writing 16-bit ports
For 16-bit ports, the normal devices reqiure writing high byte first
and then low byte. But the XMEGA devices require the reverse order.
Fixes https://github.com/llvm/llvm-project/issues/58395
Reviewed By: aykevl, jacquesguan
Differential Revision: https://reviews.llvm.org/D141752
Timm Bäder [Sat, 15 Apr 2023 08:14:59 +0000 (10:14 +0200)]
[clang][NFC] Make parameters to NoteOverloadCandidate const
pvanhout [Wed, 12 Apr 2023 11:28:45 +0000 (13:28 +0200)]
[Analysis] Remove DA & LegacyDA
UniformityAnalysis offers all of the same features and much more, there is no reason left to use the legacy DAs.
See RFC: https://discourse.llvm.org/t/rfc-deprecate-divergenceanalysis-legacydivergenceanalysis/69538
- Remove LegacyDivergenceAnalysis.h/.cpp
- Remove DivergenceAnalysis.h/.cpp + Unit tests
- Remove SyncDependenceAnalysis - it was not a real registered analysis and was only used by DAs
- Remove/adjust references to the passes in the docs where applicable
- Remove TTI hook associated with those passes.
- Move tests to UniformityAnalysis folder.
- Remove RUN lines for the DA, leave only the UA ones.
- Some tests had to be adjusted/removed depending on how they used the legacy DAs.
Reviewed By: foad, sameerds
Differential Revision: https://reviews.llvm.org/D148116
Mikael Holmen [Tue, 4 Apr 2023 06:45:53 +0000 (08:45 +0200)]
[builtins] Fix -Wshift-count-overflow warnings for targets with 16-bit int
Without this fix we got warnings like
/repo/llvm/compiler-rt/lib/builtins/floattidf.c:67:29: warning: shift count >= width of type [-Wshift-count-overflow]
((e + 1023) << 20) | // exponent
^ ~~
1 warning generated.
when compiling for a target with 16-bit int.
In floatundisf.c the type of "e" was already changed to "si_int" in
4d41df6482, now we do the same in a couple of other files where "e" is
also left shifted 20/23 steps.
Differential Revision: https://reviews.llvm.org/D147509