Kirill Stoimenov [Wed, 21 Dec 2022 22:31:40 +0000 (22:31 +0000)]
[HWASAN] Init lsan and install at_exit hook
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141146
Lang Hames [Thu, 19 Jan 2023 01:33:50 +0000 (17:33 -0800)]
[ORC-RT] Specialize non-coalescing-IntervalMap to allow non-comparable values.
In non-coalescing IntervalMaps the value type should not be requried to be
equality-comparable.
Vitaly Buka [Thu, 19 Jan 2023 01:24:10 +0000 (17:24 -0800)]
[NFC][sanitizers] Add COMPILER_RT_HAS_WTHREAD_SAFETY_*_FLAG
Shilei Tian [Thu, 19 Jan 2023 01:08:59 +0000 (20:08 -0500)]
[OpenMP][OMPT] Expect failure from tool_available_search.c on macOS
D91464 introduced verbose tool loading, but the test check only considers Linux.
On macOS, the outputs are totally different, causing the regression afterwards.
This patch simply sets the test to XFAIL on macOS.
Fix #56833.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D142045
Shilei Tian [Thu, 19 Jan 2023 01:08:10 +0000 (20:08 -0500)]
[OpenMP][AMDGPU] Get rid of redundant macro def
The next gen plugin adds the def of `DEBUG_PREFIX` in CMake, causing
compiler warning that `DEBUG_PREFIX` is defined multiple times. This patch simply
guards the macro def.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D142064
Jonas Paulsson [Thu, 15 Sep 2022 06:54:36 +0000 (08:54 +0200)]
Add parameter extension attributes in various instrumentation passes.
For the targets that have in their ABI the requirement that arguments and
return values are extended to the full register bitwidth, it is important
that calls when built also take care of this detail.
The OMPIRBuilder, AddressSanitizer, GCOVProfiling, MemorySanitizer and
ThreadSanitizer passes are with this patch hopefully now doing this properly.
Reviewed By: Eli Friedman, Ulrich Weigand, Johannes Doerfert
Differential Revision: https://reviews.llvm.org/D133949
Joseph Huber [Thu, 15 Dec 2022 20:49:09 +0000 (14:49 -0600)]
[CUDA] Allow targeting NVPTX directly without a host toolchain
Currently, the NVPTX compilation toolchain can only be invoked either
through CUDA or OpenMP via `--offload-device-only`. This is because we
cannot build a CUDA toolchain without an accompanying host toolchain for
the offloading. When using `--target=nvptx64-nvidia-cuda` this results
in generating calls to the GNU assembler and linker, leading to errors.
This patch abstracts the portions of the CUDA toolchain that are
independent of the host toolchain or offloading kind into a new base
class called `NVPTXToolChain`. We still need to read the host's triple
to build the CUDA installation, so if not present we just assume it will
match the host's system for now, or the user can provide the path
explicitly.
This should allow the compiler driver to create NVPTX device images
directly from C/C++ code.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D140158
Jeffrey Byrnes [Thu, 19 Jan 2023 00:12:18 +0000 (16:12 -0800)]
[AMDGPU] Run autogen checks on test
Change-Id: I46f2ced9ceac592c2a93a00631014a806d4b0693
Paul Kirth [Wed, 18 Jan 2023 21:54:21 +0000 (21:54 +0000)]
Reland [pgo] Avoid introducing relocations by using private alias
In many cases, we can use an alias to avoid a symbolic relocations,
instead of using the public, interposable symbol. When the instrumented
function is in a COMDAT, we can use a hidden alias, and still avoid
references to discarded sections.
Previous versions of this patch allowed the compiler to name the
generated alias, but that would only be valid when the functions were
local. Since the alias may be used across TUs we use a more
deterministic naming convention, and add a ".local" suffix to the alias
name just as we do for relative vtables aliases.
https://reviews.llvm.org/rG20894a478da224bdd69c91a22a5175b28bc08ed9
removed an incorrect assertion on Mach-O which caused assertion failures in LLD.
We addressed the link errors under ThinLTO + PGO + CFI by being more
selective about which comdat functions can be given aliases.
Specifically, we now do not emit an alias in the case of a comdat
function with hidden visibility, since the alias would have the same
linkage and visibility, giving no benefit over using the symbol
directly. This also prevents LowerTypeTest from incorrectly updating the
dangling alias after GlobalOpt replaces uses, and introducing a
duplicate symbol.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D137982
Kirill Stoimenov [Wed, 18 Jan 2023 22:34:07 +0000 (22:34 +0000)]
[HWASAN] Remove FindHeapChunkByAddressFastLocked
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D142042
Shilei Tian [Wed, 18 Jan 2023 23:21:49 +0000 (18:21 -0500)]
[OpenMP] Fix inconsistent task state if hot team is not used
This patch fixes the inconsistent task state when hot team is not used.
When the primary thread executes `__kmp_join_call`, it calls `__kmp_free_team`,
where worker threads will get destroyed if not using hot team. The destroy of
worker threads also reset their task state. However, the primary thread's is not
reset. When the next parallel region is encountered, in `__kmp_task_team_sync`,
the task state of thread will be flipped. Since the state of primary thread is not
reset, it is still 1, but all the worker threads will be 0, this leads to the
inconsistent task state, causing those threads are using completely different
task team.
Fix #59190.
Reviewed By: tlwilmar
Differential Revision: https://reviews.llvm.org/D141979
Joseph Huber [Wed, 18 Jan 2023 23:07:02 +0000 (17:07 -0600)]
[Clang][NFC] Clang-format CUDA toolchain file
Summary:
This file is not formatted, which makes further changes to it more
difficult. Format it.
Jan Korous [Wed, 18 Jan 2023 22:47:03 +0000 (14:47 -0800)]
[-Wunsafe-buffer-usage] Group diagnostics by variable
Differential Revision: https://reviews.llvm.org/D141356
Amir Ayupov [Wed, 18 Jan 2023 22:21:28 +0000 (14:21 -0800)]
[BOLT][NFC] Replace ambiguous BinarySection::isReadOnly with isWritable
Address feedback in https://reviews.llvm.org/D102284#2755060
Reviewed By: yota9
Differential Revision: https://reviews.llvm.org/D141733
Fred Riss [Wed, 18 Jan 2023 22:46:55 +0000 (14:46 -0800)]
[StatCacheFileSystem] Attempt to fix build
Some bots are not happy with the way Error is returned here. Let's see if
std::moving it fixes this.
Fred Riss [Thu, 20 Oct 2022 00:29:36 +0000 (17:29 -0700)]
[Clang] Give Clang the ability to use a shared stat cache
Every Clang instance uses an internal FileSystemStatCache to avoid
stating the same content multiple times. However, different instances
of Clang will contend for filesystem access for their initial stats
during HeaderSearch or module validation.
On some workloads, the time spent in the kernel in these concurrent
stat calls has been measured to be over 20% of the overall compilation
time. This is extremly wassteful when most of the stat calls target
mostly immutable content like a SDK.
This commit introduces a new tool `clang-stat-cache` able to generate
an OnDiskHashmap containing the stat data for a given filesystem
hierarchy.
The driver part of this has been modeled after -ivfsoverlay given
the similarities with what it influences. It introduces a new
-ivfsstatcache driver option to instruct Clang to use a stat cache
generated by `clang-stat-cache`. These stat caches are inserted at
the bottom of the VFS stack (right above the real filesystem).
Differential Revision: https://reviews.llvm.org/D136651
Kirill Stoimenov [Wed, 18 Jan 2023 22:01:27 +0000 (22:01 +0000)]
[HWASAN] Fix Fuchsia link problem
Reviewed By: mysterymath
Differential Revision: https://reviews.llvm.org/D142057
Amir Ayupov [Wed, 18 Jan 2023 22:07:48 +0000 (14:07 -0800)]
[BOLT][NFC] Simplify handleRelocation
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132089
Jan Korous [Tue, 10 Jan 2023 01:36:48 +0000 (17:36 -0800)]
[-Wunsafe-buffer-usage] Use relevant source locations for warnings
This way we highlight a particular unsafe subexpression by providing more accurate
source location than begin of an entire statement.
Differential Revision: https://reviews.llvm.org/D141340
Volodymyr Sapsai [Tue, 10 Jan 2023 20:41:11 +0000 (12:41 -0800)]
[clang][Sema] Fix uninitialized `SourceLocation` for types with multiple attributes and macros.
Some `TypeLoc`s are considered "sugar" and we go past them in
`GetTypeSourceInfoForDeclarator`. The problem is that we peel off only
the same kind of `TypeLoc` at the time which makes it impossible to
handle mixed sequences like
`AttributedTypeLoc - MacroQualifiedTypeLoc - AttributedTypeLoc - PointerTypeLoc`
In this situation, as shown in the added test, we don't get to
`PointerTypeLoc` and don't set its starLoc leaving it uninitialized.
Address FIXME and peel off "sugar" `TypeLoc`s regardless of their order.
rdar://
102149264
Differential Revision: https://reviews.llvm.org/D141424
Martin Storsjö [Tue, 2 Aug 2022 11:53:36 +0000 (14:53 +0300)]
[CMake] Allow setting the location of host tools with LLVM_NATIVE_TOOL_DIR
This avoids having to specify the location of all individual tools.
In current builds, one may want to specify LLVM_TABLEGEN, CLANG_TABLEGEN,
LLDB_TABLEGEN, LLVM_CONFIG_PATH, CLANG_PSEUDO_GEN and
CLANG_TIDY_CONFUSABLE_CHARS_GEN; specifying just the base directory
containing all of them is much more convenient.
Factorize the code for setting up use of a tool that is used during
the build (which either is newly built in the same build, or
built in a separate nested cmake build - when cross compiling or
when e.g. optimized tablegen is requested - or used from an existing
prebuilt binary).
Differential Revision: https://reviews.llvm.org/D131052
Amir Ayupov [Fri, 9 Dec 2022 23:09:39 +0000 (15:09 -0800)]
[BOLT][NFC] DataAggregator code cleanup
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D139794
Amir Ayupov [Wed, 18 Jan 2023 02:26:34 +0000 (18:26 -0800)]
[BOLT][NFC] Remove AArch64 override for evaluateBranch
Use MCInstrAnalysis implementation
Reviewed By: #bolt, rafauler, yota9
Differential Revision: https://reviews.llvm.org/D141983
Tulio Magno Quites Machado Filho [Wed, 18 Jan 2023 19:26:24 +0000 (13:26 -0600)]
[SystemZ] Implement lowering of GET_ROUNDING
Add support for _FLT_ROUNDS_ in SystemZ.
Patch by Tulio Magno Quites Machado Filho.
Reviewed By: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D140988
Jason Molenda [Wed, 18 Jan 2023 20:29:52 +0000 (12:29 -0800)]
Do qProcessInfo-hint binary loading later in Process setup
The remote stub may give lldb hints about binaries to
be loaded, especially in a firmware type environment, and
relay those hints in the qProcessInfo response. The
binary loading was done very early in Process setup, before
we had any threads, and this made it complicated for people
to write dSYM python scripts which need access to a thread.
Delay the binary loading until a bit later in the Process
startup.
Differential Revision: https://reviews.llvm.org/D141972
rdar://
104235301
Krzysztof Drewniak [Mon, 16 Jan 2023 18:39:21 +0000 (18:39 +0000)]
[llvm][GenericUniformity] Hack around strict is_invocable() checks
With recent (> 15, as far as I can tell, possibly > 16) clang, c++17,
and GNU's libstdc++ (versions 9 and 10 and maybe others), LLVM fails
to compile due to an is_invocable() check in unique_ptr::reset().
To resolve this issue, add a template argument to ImplDeleter to make
things work.
Differential Revision: https://reviews.llvm.org/D141865
Craig Topper [Wed, 18 Jan 2023 19:38:38 +0000 (11:38 -0800)]
[RISCV] Use canonical move instruction in RISCVAsmPrinter::EmitHwasanMemaccessSymbols.
We were using an OR with X0 which is the canonical move for AArch64.
The canonical move for RISC-V is ADDI reg1, reg2, 0.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D142044
Craig Topper [Wed, 18 Jan 2023 19:38:17 +0000 (11:38 -0800)]
[RISCV] Use TargetMachine MCSubtargetInfo in RISCVAsmPrinter::EmitHwasanMemaccessSymbols.
The STI object in the class is updated each time runOnMachineFunction
is called. That means STI will be based on the last function processed.
If that function has different attributes than the rest of the module
that could theoretically result in odd behavior.
Use the copy in TargetMachine instead. That will use the global
CPU and mattrs.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D142041
Craig Topper [Wed, 18 Jan 2023 19:31:29 +0000 (11:31 -0800)]
[RISCV] Make it explicit that attributes use the MCSubtargetInfo from TargetMachine. NFC
The MCSTI variable is initialized to TM.getMCSubtargetInfo(), but is
re-assigned in every call to runOnMachineFunction. emitAttributes is
called before any call to runOnMachineFunction, but it's not
immediately obvious.
This patch removes the MCSTI variable, and instead queries
TM.getMCSubtargetInfo() at the time emitAttributes is called.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D142037
Giorgis Georgakoudis [Wed, 14 Dec 2022 06:57:02 +0000 (22:57 -0800)]
[OpenMP] RecordReplay saves bitcode when JIT-ing
This patch enables to store bitcode images when JIT is enabled for the record-and-replay functionality (see https://reviews.llvm.org/D138931). Credits to @jdoerfert for refactoring the code.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D141986
Johan Erlandsson [Wed, 18 Jan 2023 19:10:55 +0000 (11:10 -0800)]
[hwasan] add pattern for short tag in symbolizer
Lines with 'record_addr:' are not processed when failing to decode
access tag. The regular format is: %02x/%02x but for a short tag it's:
%02x/%02x(%02x). Now it will handle both cases.
Tested-by: Ivar Henckel <ivar.henckel@sony.com>
Reviewed By: fmayer
Differential Revision: https://reviews.llvm.org/D141906
Eric Li [Thu, 12 Jan 2023 22:29:17 +0000 (17:29 -0500)]
[libTooling] Rename `getRangeForEdit` as `getFileRangeForEdit`
With the addition of `getFileRange`, we rename `getRangeForEdit` as
`getFileRangeForEdit` for consistency in the API.
Depends on D141634
Differential Revision: https://reviews.llvm.org/D141636
Sanjay Patel [Wed, 18 Jan 2023 18:35:12 +0000 (13:35 -0500)]
[InstSimplify] reduce "mul nsw i1" to "false"
https://alive2.llvm.org/ce/z/XYGvYg
Follow-up for:
68c197f07eeae71
Shilei Tian [Wed, 18 Jan 2023 18:39:58 +0000 (13:39 -0500)]
[OpenMP] Disable building `libomptarget` on 32-bit systems
There are plenty of assumptions in `libomptarget` and the device runtime
about the pointer size or `size_t`, etc. 32-bit systems are not supported. There
is no point to refine whole things to make it portable. This patch simply disables
building on 32-bit systems.
Fix #60121.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D142023
Sanjay Patel [Wed, 18 Jan 2023 18:21:32 +0000 (13:21 -0500)]
[InstSimplify] add no-wrap parameters to simplifyMul and add more tests; NFC
This gives mul the same capabilities as add/sub.
A potential improvement with nsw was noted in:
1720ec6da040729f17
Caleb Zulawski [Wed, 18 Jan 2023 18:14:15 +0000 (18:14 +0000)]
[clang][Darwin] Try to guess the SDK root with xcrun when unspecified
Picking up from https://reviews.llvm.org/D109460
Reviewed By: ldionne
Differential Revision: https://reviews.llvm.org/D136315
Michael Buch [Wed, 18 Jan 2023 16:42:20 +0000 (16:42 +0000)]
[lldb][Language] List supported languages in expr error text
Before:
```
(lldb) expr --language abc -- 1 + 1
error: unknown language type: 'abc' for expression
```
After:
```
(lldb) expr --language abc -- 1 + 1
error: unknown language type: 'abc' for expression. List of supported languages:
c++
objective-c++
c++03
c++11
c++14
objc++
```
We choose to only list the languages which `expr` will actually
accept instead of all the language constants defined in `Language.cpp`
since that's what the user will most likely need.
Differential Revision: https://reviews.llvm.org/D142034
Tobias Hieta [Wed, 18 Jan 2023 18:17:25 +0000 (19:17 +0100)]
[NFC] Release Note for D138995
Jonathan Peyton [Wed, 18 Jan 2023 18:05:01 +0000 (12:05 -0600)]
[OpenMP][libomp] Switch Intel topology type values: module, tile
According to Software Developer Manual, modules should be value 3 and
tile should be value 4.
Lorenzo Chelini [Thu, 12 Jan 2023 14:22:59 +0000 (15:22 +0100)]
Reduce input arguments for `getPackingInfoFromConsumer` (NFC)
Pass to `getPackingInfoFromConsumer` the tensor.pack op instead of all
the arguments derived from it. Additionally, remove the padding from the
struct, as we currently don't handle propagation when `tensor.pack`
requires padding. We will add back the field when we will need it.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D141837
Jonathan Peyton [Mon, 12 Dec 2022 19:25:51 +0000 (13:25 -0600)]
[OpenMP][libomp] Fix stats-gathering for new MSVC sections API
Differential Revision: https://reviews.llvm.org/D139867
Valentin Clement [Wed, 18 Jan 2023 17:52:44 +0000 (18:52 +0100)]
[flang] Do not perform INTERNAL_CHECK for deallocation of unlimited polymorphic with intrinsic type spec
When an unlimited polymorphic descriptor is establish for an intrinsic
type spec, the `PointerNullifyIntrinsic` or `AllocatableInitIntrinsic` runtime
function is called. These functions do not initialize an addendum with a derivedType.
When the deallocation on this descriptor is performed, the runtime should not
crash if the addendum is not present. This patch updates `PointerDeallocatePolymorphic`
and `AllocatableDeallocatePolymorphic` for this use case.
Depends on D141996
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D142010
Valentin Clement [Wed, 18 Jan 2023 17:51:18 +0000 (18:51 +0100)]
[flang] Allocate polymorphic with SOURCE= using ApplyMold
Source allocation is similar to mold allocation + assignment. Use
ApplyMold runtime entry point for polymorphic source allocation.
It could be generalized for other source allocation.
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D141996
Joseph Huber [Wed, 18 Jan 2023 17:40:40 +0000 (11:40 -0600)]
[Clang] Update the help message for `--offload-arch`
Summary:
This works for `OpenMP` and supports the `native` option. It should be
better documented.
Timm Bäder [Wed, 12 Oct 2022 07:07:27 +0000 (09:07 +0200)]
[clang][Interp][NFC] Simplify InterpFrame constructor
Try to decrease the block depth here a bit.
Rob Suderman [Wed, 18 Jan 2023 16:59:02 +0000 (08:59 -0800)]
[mlir][tosa] Prefer tosa.transpose composition canonicalization to reshape
It is preferred to merge tosa.transpose operations together rather than convert
one to a tosa.reshape. This is to leverage the tosa.transpose -> tosa.transpose
merging canonicalization.
Reviewed By: AviadCo
Differential Revision: https://reviews.llvm.org/D141434
Rob Suderman [Wed, 18 Jan 2023 16:37:05 +0000 (08:37 -0800)]
[mlir][tosa] Set explicit benefit for tosa.reshape to linalg
The patterns used to lower tosa.reshape to linalg are order
dependent which varies depending on platform. Setting the
benefit appropriately guarantees compilation executes the
rewriters in the correct ordering.
Reviewed By: benvanik
Differential Revision: https://reviews.llvm.org/D141981
Joseph Huber [Wed, 18 Jan 2023 14:08:06 +0000 (08:08 -0600)]
[Libomptarget] Only build GPU tests if a GPU is found on the system
Currently we build tests as long as the libraries are found on the
machine. This doesn't necessarily mean there is a GPU to use though.
This patch changes it to where we only will build the tests if we found
a compatible GPU via `nvptx-arch` or `amdgpu-arch`.
The only downside to this I could see if someone were to build LLVM on a
home node of a cluster and then wished to run the tests after switching
to a compute node. For this I think we should allow it to be overridden.
I think that's better than allowing us to run tests that will fail by
default.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D142018
Mark de Wever [Sat, 17 Dec 2022 11:58:40 +0000 (12:58 +0100)]
[libc++][format] Adds new test macros.
These macros make it easier to log additional information. This is
useful for formatting tests. It also properly disables additional
information when locales are disabled in libc++.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D140651
Timm Bäder [Mon, 26 Dec 2022 08:29:04 +0000 (09:29 +0100)]
[clang][Interp] Track initialization state of local variables
Use an InlineDescriptor per local variable to track whether locals
have been initialized or not. This way we can support uninitialized
local variables in constexpr functions.
Differential Revision: https://reviews.llvm.org/D135750
Roman Lebedev [Wed, 18 Jan 2023 15:41:22 +0000 (18:41 +0300)]
[DAGCombiner] `combineShuffleOfSplatVal()`: don't assert that shuffle is non-undef
As per the test case from Steven Johnson in https://reviews.llvm.org/rGf8d9097168b7#1165311
we can indeed encounter such shuffles, that produce all-undef after folding,
before something else manages to optimize them away.
OCHyams [Wed, 18 Jan 2023 15:33:46 +0000 (15:33 +0000)]
[Assignment Tracking] Replace metadata number with variable capture in tests
David Truby [Mon, 9 Jan 2023 15:13:58 +0000 (15:13 +0000)]
[flang] Add implementation of move_alloc to the runtime
This patch adds a move_alloc implementation to the flang runtime.
Most of the checks required by the standard for move_alloc are
done by semenatic analysis; these checks are not replicated here.
Differential Revision: https://reviews.llvm.org/D141286
Sanjay Patel [Wed, 18 Jan 2023 15:26:18 +0000 (10:26 -0500)]
[InstCombine] restrict no-wrap propagation for i1/i2 to avoid miscompiles
This transform was added with
68c197f07eeae71b9b7,
and the post-commit review noted the potential
for miscompiles at narrow bitwidths.
I'm not sure how to expose the i1 nuw bug because we
already simplify that, but other cases show that
there are missing transforms to add in follow-up
patches.
Valentin Clement [Wed, 18 Jan 2023 15:31:19 +0000 (16:31 +0100)]
[flang] Move TODO to the source allocation part
Sanjay Patel [Wed, 18 Jan 2023 15:13:20 +0000 (10:13 -0500)]
[InstCombine] reduce code duplication in visitSub(); NFC
Sanjay Patel [Wed, 18 Jan 2023 15:03:36 +0000 (10:03 -0500)]
[InstCombine][InstSimplify] add tests for i1/i2 mul with no-wrap; NFC
A bug was introduced with
68c197f07eeae71 as noted in the
post-commit review comments, and there are potentially
missed smaller transforms/simplifications because no-wrap
multiply with only 1 or 2 bits eliminates some potential
results.
Denis Antrushin [Tue, 17 Jan 2023 11:01:42 +0000 (18:01 +0700)]
[StatepointLowering] Move statepoint correctness checks to Verifier. NFC.
Since D140504, GCStrategy is available for use in opt.
Now we can move statepoint correctness checks from
StatepointLowering.cpp to Verifier.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D141948
Florian Hahn [Wed, 18 Jan 2023 15:02:40 +0000 (15:02 +0000)]
[VPlan] Disconnect VPRegionBlock from successors in graph iterator(NFCI)
This updates the VPAllSuccessorsIterator to not connect the
VPRegionBlock itself to its successors. The successors are connected to
the exit block of the region. At the moment, this doesn't change any
exisint functionality.
But the new schema ensures the following property when used for
VPDominatorTree:
1. Entry & exit blocks of regions dominate the successors of the region.
This allows for convenient checking of dominance between defs and uses
that are not defined in the same region. I will share a follow-up patch
to use it for the VPDominatorTree soon.
Depends on D140500.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D140511
Matthias Springer [Wed, 18 Jan 2023 14:55:13 +0000 (15:55 +0100)]
[mlir][vector] Limit vector.mask op to single vector result
Multiple vector results require multiple masks and passthru values.
Depends On: D141683
Differential Revision: https://reviews.llvm.org/D141786
Nikita Popov [Wed, 18 Jan 2023 14:21:27 +0000 (15:21 +0100)]
[Regex] Check two chars in step back optimization (NFC)
When stepping back, and there is a following fixed character, also
try to check whether another following fixed character matches.
For our tests the next fixed character is often " ", which occurs
pretty frequently, so checking a second character is worthwhile in
practice.
This drops FileCheck runtime for the vloxseg.c test from 25s to
17s for me.
Florian Hahn [Wed, 18 Jan 2023 14:25:00 +0000 (14:25 +0000)]
Revert "[ConstraintElim] Enable pass by default."
This reverts commit
fb13dcf3431cd83911fe56899d2fade808dc5b8d.
A large compile-time regression for code generated by sanitizers has
been reported. Revert while I investigate the issue. Details and
reproducers are available here: https://reviews.llvm.org/D135915
Florian Hahn [Wed, 18 Jan 2023 14:23:22 +0000 (14:23 +0000)]
[VPlan] Replace VPInterleaveRecipe::classof with VP_CLASSOF_IMPL. (NFC)
Matthias Springer [Wed, 18 Jan 2023 14:19:23 +0000 (15:19 +0100)]
[mlir][linalg][bufferize][NFC] Utilize DestinationStyleOpInterface helper
`DstBufferizableOpInterfaceExternalModel` provides suitable default implementations for Linalg ops.
Differential Revision: https://reviews.llvm.org/D141921
Mehdi Amini [Wed, 18 Jan 2023 14:14:33 +0000 (14:14 +0000)]
Harden -slice-analysis-test MLIR testing pass to check for some invariants
The pass would assert on some input IR that it didn't expect. Instead
signal a pass failure and properly interupt the flow.
Fixes #60022
Matthias Springer [Wed, 18 Jan 2023 14:10:14 +0000 (15:10 +0100)]
[mlir] GreedyPatternRewriteDriver: Fix termination criteria in OpPatternRewriteDriver
This driver should iterate until convergence or until the specified op was erased. However, it used to stop when any op was erased.
Differential Revision: https://reviews.llvm.org/D141921
Elena Lepilkina [Wed, 18 Jan 2023 11:09:03 +0000 (14:09 +0300)]
[llvm-objdump] Fix reporting error for processing target features
Differential Revision: https://reviews.llvm.org/D142003
Aaron Ballman [Wed, 18 Jan 2023 13:49:45 +0000 (08:49 -0500)]
Diagnose extensions in 'offsetof'
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm made very
clear that it is an UB having type definitions with in offsetof.
Clang supports defining a type as the first argument as a conforming
extension due to how many projects use the construct in C99 and earlier
to calculate the alignment of a type. GCC also supports defining a type
as the first argument.
This adds extension warnings and documentation for the functionality
Clang explicitly supports.
Fixes #57065
Reverts the revert of
39da55e8f548a11f7dadefa73ea73d809a5f1729
Co-authored-by: Yingchi Long <i@lyc.dev>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Differential Revision: https://reviews.llvm.org/D133574
Peixin Qiao [Wed, 18 Jan 2023 13:49:22 +0000 (21:49 +0800)]
[flang] Add TODO for allocate array with scalar source
This scenario is not supported yet.
Reviewed By: clementval, jeanPerier, sscalpone
Differential Revision: https://reviews.llvm.org/D141932
Samuel Parker [Wed, 18 Jan 2023 13:30:53 +0000 (13:30 +0000)]
[NFC][WebAssembly] Add tests
Add more variations to fpclamptosat.
Sanjay Patel [Tue, 17 Jan 2023 20:21:14 +0000 (15:21 -0500)]
[InstCombine] add tests for diff-of-squares; NFC
Ideally, these negative tests would have been added
before
68c197f07eea to make sure the specific
operand matching is working as expected, but I did
not remember to include them.
Sanjay Patel [Tue, 17 Jan 2023 20:15:48 +0000 (15:15 -0500)]
[InstCombine] simplify code for matching shift-logic-shift pattern; NFC
We can match and capture in one statement. Also, make the
code more closely resemble the description comment by using
the constant name of an operand value.
Viktoriia Bakalova [Tue, 17 Jan 2023 16:38:14 +0000 (16:38 +0000)]
[include-mapping] Fix gen_std.py test
Differential Revision: https://reviews.llvm.org/D141944
LLVM GN Syncbot [Wed, 18 Jan 2023 12:50:04 +0000 (12:50 +0000)]
[gn build] Port
f10d452db841
wanglei [Tue, 17 Jan 2023 07:10:00 +0000 (15:10 +0800)]
Reland "[JITLink] Add an initial implementation of JITLink for ELF/LoongArch"
This implementation supports basic relocation types and adds EHFrame,
Got/Plt handling passes.
This patch also enables JIT support for LoongArch64.
With this patch, I successfully run hello.ll and simple_throw.ll
(which is generated from test-suite/SingleSource/Regression/C++/EH/simple_throw.cpp)
using the `lli` command with options `--jit-kind=orc --jit-linker=jitlink`.
Note: `hasJIT` property of LoongArch32 remains false as there is no
validation environment.
New changes: Since LoongArch does not support RuntimeDyld, JITLink is set
by default. Add a null-terminator to eh-frame sections. This should fix
the test failure on LoongArch bot.
(https://lab.llvm.org/staging/#/builders/236/builds/896)
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D141036
Benjamin Kramer [Wed, 18 Jan 2023 12:31:35 +0000 (13:31 +0100)]
[bazel] Fix build after
c33b9395b1
Sebastian Neubauer [Wed, 18 Jan 2023 12:19:59 +0000 (13:19 +0100)]
[BitcodeReader] Allow reading pointer types from old IR
When opaque pointers are enabled and old IR with typed pointers is read,
the BitcodeReader automatically upgrades all typed pointers to opaque
pointers. This is a lossy conversion, i.e. when a function argument is a
pointer and unused, it’s impossible to reconstruct the original type
behind the pointer.
There are cases where the type information of pointers is needed. One is
reading DXIL, which is bitcode of old LLVM IR and makes a lot of use of
pointers in function signatures.
We’d like to keep using up-to-date llvm to read in and process DXIL, so
in the face of opaque pointers, we need some way to access the type
information of pointers from the read bitcode.
This patch allows extracting type information by supplying functions to
parseBitcodeFile that get called for each function signature or metadata
value. The function can access the type information via the reader’s
type IDs and the getTypeByID and getContainedTypeID functions.
The tests exemplarily shows how type info from pointers can be stored in
metadata for use after the BitcodeReader finished.
Differential Revision: https://reviews.llvm.org/D127728
Florian Hahn [Wed, 18 Jan 2023 12:14:57 +0000 (12:14 +0000)]
[VPlan] Replace VPBranchOnMaskSC::classof with VP_CLASSOF_IMPL. (NFC)
Dmitry Bushev [Tue, 17 Jan 2023 15:19:38 +0000 (18:19 +0300)]
[RISCV][ISelLowering] Fix select lowering issue
Fix bug that leads to some pseudo instructions not being lowered.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D141395
Haojian Wu [Wed, 18 Jan 2023 12:08:21 +0000 (13:08 +0100)]
Remove an unused variable, NFC
Simon Pilgrim [Wed, 18 Jan 2023 11:21:06 +0000 (11:21 +0000)]
[DAG] combineInsertEltToShuffle - split off mergeInsertEltWithShuffle fold. NFC.
combineInsertEltToShuffle was performing 2 very different folds in the same call, merging "(insert_vector_elt (vector_shuffle X, Y), (extract_vector_elt X, N), IdxC) --> (vector_shuffle X, Y)" and "(insert_vector_elt V, (bitcast X from vector type), IdxC) --> bitcast(shuffle (bitcast V), (extended X), Mask)"
The folds are currently still attempted in the same order as before (just as 2 seperate calls) so there should be no change in behaviour.
First step towards some adjustments to mergeInsertEltWithShuffle for D127115.
David Green [Wed, 18 Jan 2023 11:44:26 +0000 (11:44 +0000)]
[DAG][ARM][AArch64] Transform max(a,b) - min(a,b) -> abd(a,b)
This adds both signed and unsigned transforms for
max(a, b) - min(a, b) -> abd(a, b).
unsigned: https://alive2.llvm.org/ce/z/RF4jGQ
signed: https://alive2.llvm.org/ce/z/Cjr2zE
Fixes: #59894
Differential Revision: https://reviews.llvm.org/D141706
Haojian Wu [Wed, 18 Jan 2023 11:18:26 +0000 (12:18 +0100)]
Reland "nullptr returned from ActOnTag() is not a valid result"
The commit was reverted in
346e1c43a11b8af5a818dac321f83f043862c1ec as
part of the
f1f0a0d8e8fdd2e534d9423b2e64c6b8aaa53aee revert.
Tim Northover [Tue, 10 Jan 2023 11:52:12 +0000 (11:52 +0000)]
AArch64: allocate small fixed args properly in varargs functions.
On Darwin, function arguments occupy their real size when passed on the stack
(e.g. an i16 only consumes 2 bytes). This means that, even for fixed args in
varargs calls we need to keep track of the original type being passed before
any DAG/GISel promotions. Existing logic only applied this fix to the
non-varargs case leading to mismatch between caller & callee in those
situations.
On Linux & Windows these arguments always occupy a 64-bit slot anyway so
there's no special handling needed.
chenglin.bi [Wed, 18 Jan 2023 11:23:58 +0000 (19:23 +0800)]
Reapply [AArch64] fold subs ugt/ult to ands when the second operand is mask/pow2
Origianl patch made a mistake that ugt is reverse cc should be ule.
And ule < C will be generalize to ult < C + 1. So the new patch add support for ult < Pow2 case.
https://alive2.llvm.org/ce/z/naBw5A
Reviewed By: samtebbs, chapuni
Differential Revision: https://reviews.llvm.org/D141829
Haojian Wu [Wed, 18 Jan 2023 11:04:38 +0000 (12:04 +0100)]
[libc++][ranges] Remove a leftover include version control markers in Cxx20Papers.csv
Luke Lau [Thu, 12 Jan 2023 12:20:07 +0000 (12:20 +0000)]
[RISCV] Generalize performFP_TO_INTCombine to vectors
Like in the scalar domain, combine calls to (fp_to_int (ftrunc X)) on
scalable and fixed-length vectors into a single vfcvt instruction.
For truncating rounds, the static vfcvt.rtz rounding mode is used.
Otherwise use the VFCVT_RM_ variants to set the rounding mode
dynamically.
Closes https://github.com/llvm/llvm-project/issues/56737
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D141599
Luke Lau [Thu, 12 Jan 2023 12:14:44 +0000 (12:14 +0000)]
[RISCV][NFC] Add test cases for rounding vfcvt
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D141600
Nikita Popov [Wed, 18 Jan 2023 10:04:12 +0000 (11:04 +0100)]
[LLVMContext] Remove hasSetOpaquePointersValue() API (NFC)
Now that we no longer perform any kind of typed pointer guessing,
we no longer need this API.
David Green [Wed, 18 Jan 2023 10:10:52 +0000 (10:10 +0000)]
[DAG][AArch64][ARM] Combine abd(sub(x, y)) to abd if the sub is nsw
This implements the fold (abs (sub nsw x, y)) -> abds(x, y). Providing
the sub is nsw this appears to be valid without the extensions that are
usually used for abds. https://alive2.llvm.org/ce/z/XHVaB3. The
equivalent abdu combine seems to not be valid.
Differential Revision: https://reviews.llvm.org/D141665
Nikita Popov [Wed, 18 Jan 2023 10:01:16 +0000 (11:01 +0100)]
[LTO] Always use opaque pointers mode from config
Always use the configured opaque pointers mode, don't check whether
it has already been set through a different means.
Removes the last user of the hasSetOpaquePointersValue() API.
Diana Picus [Tue, 17 Jan 2023 08:08:34 +0000 (09:08 +0100)]
[GlobalISel] Detect splats built with G_CONCAT_VECTORS
Add support to the MI matching of vector splats for patterns that
consist of `G_CONCAT_VECTORS` of smaller splats with the same constant
value. With this, we would consider the following pseudo-MIR to be a splat:
```
%0 = G_[F]CONSTANT [...]
%1 = G_BUILD_VECTOR %0, %0, ..., %0
%2 = G_CONCAT_VECTORS %1, %1, ..., %1
```
Since it uses recursion for matching splats, it could match pretty
complicated patterns with all sorts of combinations of `G_BUILD_VECTOR`
and `G_CONCAT_VECTORS` (e.g. a `G_CONCAT_VECTORS` with
a `G_BUILD_VECTOR_TRUNC` and another `G_CONCAT_VECTORS` as operands),
and it should also look through copies etc.
This should make it easier to match complex immediates for certain
instructions on AMDGPU, where for instance a <8 x s16> will be split
before instruction selection into a `G_CONCAT_VECTORS` of <2 x s16>
splats.
Differential Revision: https://reviews.llvm.org/D141902
Diana Picus [Mon, 16 Jan 2023 14:03:12 +0000 (15:03 +0100)]
Fix typo. NFC
Markus Böck [Thu, 12 Jan 2023 17:07:57 +0000 (18:07 +0100)]
[mlir][tblgen] Emit deprecation warning if `kEmitRawAttributes` is used
As discussed in https://reviews.llvm.org/D140886, emitting a warning if the old API is used may be beneficial to encourage migration to the new fold API.
This reuse the existing `Deprecated` infrastructure within TableGen, and simply marks the `def` for `kEmitRawAttributesFolder` causing a use of it in a record (even if set within a base class) to emit a warning.
Error message as printed in the terminal:
```
Included from C:/llvm-project/mlir/python/mlir/dialects/TensorOps.td:13:
Included from C:/llvm-project/mlir/include\mlir/Dialect/Tensor/IR/TensorOps.td:12:
C:/llvm-project/mlir/include\mlir/Dialect/Tensor/IR/TensorBase.td:14:5: warning: Using deprecated def `kEmitRawAttributesFolder`
def Tensor_Dialect : Dialect {
^
note: 'useFoldAPI' of 'kEmitRawAttributesFolder' (default) has been deprecated and is pending removal. Please switch to 'kEmitFoldAdaptorFolder'. See https://discourse.llvm.org/t/psa-new-improved-fold-method-signature-has-landed-please-update-your-downstream-projects/67618
```
Differential Revision: https://reviews.llvm.org/D141604
LLVM GN Syncbot [Wed, 18 Jan 2023 09:05:51 +0000 (09:05 +0000)]
[gn build] Port
48c2172e51b2
wangpc [Wed, 18 Jan 2023 08:49:32 +0000 (16:49 +0800)]
[CSKY] Fix errors caused by change of compressInst
We don't need MCContext since D141951.
Reviewed By: zixuan-wu
Differential Revision: https://reviews.llvm.org/D141995
Nikita Popov [Tue, 17 Jan 2023 11:59:54 +0000 (12:59 +0100)]
[Release] Produce mlir tarball
MLIR supports standalone builds, so I think it makes sense to also
produce a release tarball for the MLIR subproject.
Differential Revision: https://reviews.llvm.org/D141919
Nikita Popov [Wed, 14 Dec 2022 12:41:10 +0000 (13:41 +0100)]
[AsmParser] Remove typed pointer auto-detection
IR is now always parsed in opaque pointer mode, unless
-opaque-pointers=0 is explicitly given. There is no automatic
detection of typed pointers anymore.
The -opaque-pointers=0 option is added to any remaining IR tests
that haven't been migrated yet.
Differential Revision: https://reviews.llvm.org/D141912
wanglei [Wed, 18 Jan 2023 08:50:32 +0000 (16:50 +0800)]
Revert "[JITLink] Add an initial implementation of JITLink for ELF/LoongArch"
This reverts commit
28b6f38d0a841451af7b4893368543382dd5e630.
This breaks on LoongArch64 bot.
https://lab.llvm.org/staging/#/builders/236/builds/896
Nikita Popov [Wed, 18 Jan 2023 08:48:31 +0000 (09:48 +0100)]
Revert "[BitcodeReader] Allow reading pointer types from old IR"
This reverts commit
b56df190b01335506ce30a4559d880da76d1a181.
The unit tests are implemented in a way that requires support for
writing typed pointer bitcode, which is going away soon. Please
rewrite it in a way that not have requirement, e.g. by shipping
pre-compiled bitcode, as we do for integration tests.