Simon Pilgrim [Sat, 17 Dec 2022 14:06:26 +0000 (14:06 +0000)]
[llvm-exegesis][X86] Use the same AGU counter estimate mapping for znver1 as znver2, and count RMW ops as well
znver2 can use the ld/st dispatch counters to make a reasonable estimate for the AGU usage (although it misses complex LEA ops which I don't think we can fix), although it wasn't accounting for RMW ld-st uops which are counted separately - the same approach can be used for znver1 (ymm double-pumping ld/st agu is correctly measured as 2uops)
This change is mainly academic, but was noticed as the znver1/2 models incorrectly assume scalar RMW ops take 2uops
Roman Lebedev [Sat, 17 Dec 2022 13:38:24 +0000 (16:38 +0300)]
[NFC][InstCombine] Move nested-select testcase into proper place, adjust comment
Mark de Wever [Thu, 15 Dec 2022 17:58:17 +0000 (18:58 +0100)]
[libc++][format] Renames __null_sentinel.
While the FreeBSD CI was enabled in D128084 it was discovered libc++
uses the name of a system macro on FreeBSD. This renames the macro to
fix the issue.
Reviewed By: emaste, #libc, philnik
Differential Revision: https://reviews.llvm.org/D140117
Ganesh Gopalasubramanian [Thu, 15 Dec 2022 13:58:34 +0000 (19:28 +0530)]
[X86] AMD Zen 4 Initial enablement
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D139073
Ramkumar Ramachandra [Wed, 14 Dec 2022 10:39:19 +0000 (11:39 +0100)]
mlir/tblgen: use std::optional in generation
This is part of an effort to migrate from llvm::Optional to
std::optional. This patch changes the way mlir-tblgen generates .inc
files, and modifies tests and documentation appropriately. It is a "no
compromises" patch, and doesn't leave the user with an unpleasant mix of
llvm::Optional and std::optional.
A non-trivial change has been made to ControlFlowInterfaces to split one
constructor into two, relating to a build failure on Windows.
See also: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Signed-off-by: Ramkumar Ramachandra <r@artagnon.com>
Differential Revision: https://reviews.llvm.org/D138934
Craig Topper [Sat, 17 Dec 2022 08:11:19 +0000 (00:11 -0800)]
Revert "[RISCV] Support the short-forward-branch predicatd ops in RISCVSExtWRemoval."
This reverts commit
9e586217f4e331bca241df00648ca0b71edd3ef6.
I think there's at least one mistake in this.
Fangrui Song [Sat, 17 Dec 2022 08:10:45 +0000 (08:10 +0000)]
[clang] llvm::Optional::value => operator*/operator->
std::optional::value() has undesired exception checking semantics and is
unavailable in older Xcode (see _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS). The
call sites block std::optional migration.
This makes `ninja check-clang` work in the absence of llvm::Optional::value.
Kazu Hirata [Sat, 17 Dec 2022 07:36:51 +0000 (23:36 -0800)]
Ensure newlines at the end of files (NFC)
Craig Topper [Sat, 17 Dec 2022 07:25:20 +0000 (23:25 -0800)]
[RISCV] Support the short-forward-branch predicatd ops in RISCVSExtWRemoval.
Kazu Hirata [Sat, 17 Dec 2022 07:20:11 +0000 (23:20 -0800)]
[BinaryFormat] Use std::optional instead of llvm::Optional (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Uday Bondhugula [Thu, 15 Dec 2022 15:24:19 +0000 (20:54 +0530)]
[MLIR] Enhance getLargestKnownDivisor for AffineExpr floordiv/ceildiv
The largest known divisor for expressions like (32 * d0 + 32, 128)
ceildiv 8 wasn't being computed tightly; a conservative value of 1 was
being returned. Address this. This leads to a broad improvement for
several affine analyses and rewrites that depend on knowing whether
something is a multiple of a specific constant or such largest known
constant.
Differential Revision: https://reviews.llvm.org/D140185
Kazu Hirata [Sat, 17 Dec 2022 06:38:57 +0000 (22:38 -0800)]
[NVPTX] Use std::optional instead of llvm::Optional (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Craig Topper [Sat, 17 Dec 2022 06:37:14 +0000 (22:37 -0800)]
[RISCV] Add support for predicating AND/OR/XOR/ADD/SUB with short-forward-branch-opt.
sifive-7-series can predicate ALU instructions in the shadow of a
branch not just move instructions.
This patch implements analyzeSelect/optimizeSelect to predicate
these operations. This is based on ARM's implementation which can
predicate using flags and condition codes.
I've restricted it to just the instructions we have test cases for,
but it can be extended in the future.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D140053
Fangrui Song [Sat, 17 Dec 2022 06:51:04 +0000 (06:51 +0000)]
[M68k] Fix spillCalleeSavedRegisters after D138656
Fangrui Song [Sat, 17 Dec 2022 06:37:59 +0000 (06:37 +0000)]
llvm::Optional::value => operator*/operator->
std::optional::value() has undesired exception checking semantics and is
unavailable in older Xcode (see _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS). The
call sites block std::optional migration.
This makes `ninja clang` work in the absence of llvm::Optional::value.
Christudasan Devadasan [Thu, 14 Apr 2022 14:09:59 +0000 (19:39 +0530)]
[AMDGPU][SILowerSGPRSpills] Spill SGPRs to virtual VGPRs
Currently, the custom SGPR spill lowering pass spills
SGPRs into physical VGPR lanes and the remaining VGPRs
are used by regalloc for vector regclass allocation.
This imposes many restrictions that we ended up with
unsuccessful SGPR spilling when there won't be enough
VGPRs and we are forced to spill the leftover into
memory during PEI. The custom spill handling during PEI
has many edge cases and often breaks the compiler time
to time.
This patch implements spilling SGPRs into virtual VGPR
lanes. Since we now split the register allocation for
SGPRs and VGPRs, the virtual registers introduced for
the spill lanes would get allocated automatically in
the subsequent regalloc invocation for VGPRs.
Spill to virtual registers will always be successful,
even in the high-pressure situations, and hence it avoids
most of the edge cases during PEI. We are now left with
only the custom SGPR spills during PEI for special registers
like the frame pointer which isn an unproblematic case.
This patch also implements the whole wave spills which
might occur if RA spills any live range of virtual registers
involved in the whole wave operations. Earlier, we had
been hand-picking registers for such machine operands.
But now with SGPR spills into virtual VGPR lanes, we are
exposing them to the allocator.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D124196
Christudasan Devadasan [Thu, 24 Nov 2022 08:17:01 +0000 (13:47 +0530)]
[CodeGen] Additional Register argument to storeRegToStackSlot/loadRegFromStackSlot
With D134950, targets get notified when a virtual register is created and/or
cloned. Targets can do the needful with the delegate callback. AMDGPU propagates
the virtual register flags maintained in the target file itself. They are useful
to identify a certain type of machine operands while inserting spill stores and
reloads. Since RegAllocFast spills the physical register itself, there is no way
its virtual register can be mapped back to retrieve the flags. It can be solved
by passing the virtual register as an additional argument. This argument has no
use when the spill interfaces are called during the greedy allocator or even the
PrologEpilogInserter and can pass a null register in such cases.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D138656
Christudasan Devadasan [Tue, 22 Nov 2022 19:15:57 +0000 (00:45 +0530)]
[CodeGen] Use cloneVirtualRegister in LiveIntervals and LiveRangeEdit
It is needed to invoke the delegate methods effectively whenever a
virtual register is cloned from an existing register of the same class.
Reviewed By: qcolombet
Differential Revision: https://reviews.llvm.org/D138517
Christudasan Devadasan [Fri, 30 Sep 2022 07:50:58 +0000 (13:20 +0530)]
[CodeGen] Use delegate to notify targets when virtual registers are created
This will help targets to customize certain codegen decisions based on
the virtual registers involved in special operations. This patch also
extends the existing delegate in MRI to start support multicast.
Reviewed By: qcolombet
Differential Revision: https://reviews.llvm.org/D134950
Christudasan Devadasan [Fri, 30 Sep 2022 03:17:06 +0000 (08:47 +0530)]
[AMDGPU][SIFrameLowering] Use the right frame register in CSR spills
Unlike the callee-saved VGPR spill instructions emitted by
`PEI::spillCalleeSavedRegs`, the CS VGPR spills inserted during
emitPrologue/emitEpilogue require the exec bits flipping to avoid
clobbering the inactive lanes of VGPRs used for SGPR spilling.
Currently, these spill instructions are referenced from the SP at
function entry and when the callee performs a stack realignment,
they ended up getting incorrect stack offsets. Even if we try to
adjust the offsets, the FP-SP becomes a runtime entity with dynamic
stack realignment and the offsets would still be inaccurate.
To fix it, use FP as the frame base in the spill instructions
whenever the function has FP. The offsets obtained for the CS
objects would always be the right values from FP.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D134949
Christudasan Devadasan [Fri, 23 Sep 2022 09:43:09 +0000 (15:13 +0530)]
[AMDGPU] Preserve only the inactive lanes of scratch vgprs
In general, a callee is free to use a scratch register without
preserving its previous state. However, the VGPR used for SGPR
spilling can potentially have its inactive lanes overwritten by
the writelane instructions. When the function returns, it can
cause unexpected behavior if the VGPR value is not preserved
appropriately.
The current scheme to preserve the inactive lanes of such
scratch VGPRs is not done rightly. It preserves all lanes
and causes the outgoing values (if any) getting overwritten
by the epilog restores. It then corrupts the return value.
To avoid such situation with scratch VGPRs, this patch ensures
we preserve only their inactive lanes.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D134526
Christudasan Devadasan [Thu, 18 Aug 2022 04:56:09 +0000 (10:26 +0530)]
[AMDGPU][SIFrameLowering] Unify PEI SGPR spill saves and restores
There is a lot of customization and eventually code duplication in the
frame lowering that handles special SGPR spills like the one needed for
the Frame Pointer. Incorporating any additional SGPR spill currently
makes it difficult during PEI. This patch introduces a new spill builder
to efficiently handle such spill requirements. Various spill methods are
special handled using a separate class.
Reviewed By: sebastian-ne, scott.linder
Differential Revision: https://reviews.llvm.org/D132436
Christudasan Devadasan [Wed, 13 Apr 2022 05:58:59 +0000 (11:28 +0530)]
[AMDGPU] Separate out SGPR spills to VGPR lanes during PEI
SILowerSGPRSpills pass handles the lowering of SGPR spills
into VGPR lanes. Some SGPR spills are handled later during
PEI. There is a common function used in both places to find
the free VGPR lane. This patch eliminates that dependency to
find the free VGPR by handling it separately for PEI. It is a
prerequisite patch for a future work to allow SGPR spills to
virtual VGPR lanes during SILowerSGPRSpills.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D124195
Christudasan Devadasan [Sun, 17 Apr 2022 12:14:39 +0000 (17:44 +0530)]
[AMDGPU] Correctly set IsKill flag for VGPR spills in the prolog
We always assume the vector register is dead or killed while
inserting the VGPR spills in the prolog. It is not always
true. Used the entry block liveIn data while setting the flag.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D124194
Christudasan Devadasan [Tue, 19 Apr 2022 07:04:12 +0000 (12:34 +0530)]
[AMDGPU] Add WWM reserved VGPRs to WWMSpills
The custom VGPR spills inserted during frame lowering
maintain a separate list for WWM reserved registers.
Added them into WWMSpills that already tracks such
reserved registers. It unifies the spill insertion.
Reviewed By: nhaehnle, arsenm
Differential Revision: https://reviews.llvm.org/D124193
Christudasan Devadasan [Mon, 13 Jun 2022 13:12:02 +0000 (18:42 +0530)]
[AMDGPU] Callee must always spill writelane VGPRs
Since the writelane instruction used for SGPR spills can
modify inactive lanes, the callee must preserve the VGPR
this instruction modifies even if it was marked Caller-saved.
Reviewed By: arsenm, nhaehnle
Differential Revision: https://reviews.llvm.org/D124192
Fangrui Song [Sat, 17 Dec 2022 05:27:33 +0000 (05:27 +0000)]
[mlir] llvm::Optional::value => operator*/operator->
std::optional::value() has undesired exception checking semantics and is
unavailable in some older Xcode. The call sites block std::optional migration.
Fangrui Song [Sat, 17 Dec 2022 05:23:45 +0000 (05:23 +0000)]
[llvm] llvm::Optional::value => operator*/operator->
std::optional::value() has undesired exception checking semantics and is
unavailable in some older Xcode. The call sites block std::optional migration.
Fangrui Song [Sat, 17 Dec 2022 05:15:07 +0000 (05:15 +0000)]
[clang] llvm::Optional::value => operator*/operator->
std::optional::value() has undesired exception checking semantics and is
unavailable in some older Xcode. The call sites block std::optional migration.
Fangrui Song [Sat, 17 Dec 2022 05:11:01 +0000 (05:11 +0000)]
[clangd] llvm::Optional::value => operator*/operator->
std::optional::value() has undesired exception checking semantics and is
unavailable in some older Xcode. The call sites block std::optional migration.
ziqingluo-90 [Sat, 17 Dec 2022 04:59:40 +0000 (20:59 -0800)]
[-Wunsafe-buffer-usage] Ignore array subscript on literal zero
Unsafe Buffer Usage analysis only warns unsafe buffer accesses but not
pointer dereferences. An array subscript on a literal zero is
equivalent to dereference a pointer thus we do not want to warn it.
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D138321
Fangrui Song [Sat, 17 Dec 2022 05:03:57 +0000 (05:03 +0000)]
[lld] llvm::Optional::value => operator*/operator->
std::optional::value() has undesired exception checking semantics and is
unavailable in some older Xcode. The call sites block std::optional migration.
Fangrui Song [Sat, 17 Dec 2022 05:01:54 +0000 (05:01 +0000)]
[lldb] llvm::Optional::value => operator*/operator->
std::optional::value() has undesired exception checking semantics and is
unavailable in some older Xcode. The call sites block std::optional migration.
Fangrui Song [Sat, 17 Dec 2022 04:45:11 +0000 (04:45 +0000)]
llvm::Optional::value => operator*/operator->
std::optional::value() has undesired exception checking semantics and is
unavailable in some older Xcode. The call sites block std::optional migration.
ziqingluo-90 [Sat, 17 Dec 2022 04:35:41 +0000 (20:35 -0800)]
[-Wunsafe-buffer-usage] Improve pointer matching pattern
Generalize the pointer expression AST matcher in Unsafe Buffer Usage analysis.
Add test cases for various kinds of pointer usages.
Reviewed By: NoQ, aaron.ballman, xazax.hun
Differential Revision: https://reviews.llvm.org/D138318
Fangrui Song [Sat, 17 Dec 2022 04:38:27 +0000 (04:38 +0000)]
[mlir] std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
Fangrui Song [Sat, 17 Dec 2022 04:11:55 +0000 (04:11 +0000)]
[flang] std::optional::value => operator*/operator->
Fangrui Song [Sat, 17 Dec 2022 03:19:47 +0000 (03:19 +0000)]
[lld] std::optional::value => operator*/operator->
Wenzel Jakob [Sat, 17 Dec 2022 02:11:56 +0000 (13:11 +1100)]
[C-API] Add example code to exercise new MCJIT-like-memory-manager API.
This example shows how to use the newly added
LLVMOrcCreateRTDyldObjectLinkingLayerWithMCJITMemoryManagerLikeCallbacks API.
Lang Hames [Sat, 17 Dec 2022 02:01:08 +0000 (13:01 +1100)]
[C-API] LLVMOrcCreateRTDyldObjectLinkingLayerWithMCJITMemoryManagerLikeCallbacks
Adds a LLVMOrcCreateRTDyldObjectLinkingLayerWithMCJITMemoryManagerLikeCallbacks
function that can be used to create an RTDyldObjectLinkingLayer using callbacks
that are similar (but not identical) to those used in
LLVMCreateSimpleMCJITMemoryManager. This is intended to ease the transition to
ORC for MCJIT C-API clients.
Differential Revision: https://reviews.llvm.org/D139393
Fangrui Song [Sat, 17 Dec 2022 03:12:04 +0000 (03:12 +0000)]
std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
This fixes check-clang-tools.
Vy Nguyen [Fri, 16 Dec 2022 20:17:06 +0000 (15:17 -0500)]
Reland 2nd attempt: [lld-macho] Fix bug in reading cpuSubType field.
This reverts commit
52a118d08fbb0a45cba8c34346d9ccb14f599c6a.
New changes:
Fix tests to dump both slices in the fat-archive because otool
isn't deterministic about which slice it prints across different archs.
(It printed x86 on x86 machines but arm64 on arm64, this was why
the test failed on arm64)
Differential Revision: https://reviews.llvm.org/D139572
Yingchi Long [Fri, 9 Dec 2022 16:53:57 +0000 (00:53 +0800)]
[RISCV][VP] support vp.reduce.mul by ExpandVectorPredication
Most of VP intrinsics are implemented in RISC-V backends, but
vp.reduce.mul (element length > 1) does not yet. Legalizes vp.reduce.mul
using ExpandVectorPredication Pass.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D139721
Artem Dergachev [Sat, 17 Dec 2022 01:52:02 +0000 (17:52 -0800)]
[-Wunsafe-buffer-usage] NFC: Implement fix-strategies and variable-use-claiming.
This patch adds more abstractions that we'll need later for emitting
-Wunsafe-buffer-usage fixits. It doesn't emit any actual fixits,
so no change is observed behavior, but it introduces a way to emit fixits,
and existing tests now verify that the compiler still emits no fixits,
despite knowing how to do so.
The purpose of our code transformation analysis is to fix variable types
in the code from raw pointer types to C++ standard collection/view types.
The analysis has to decide on its own which specific type is
the most appropriate for every variable. This patch introduces
the Strategy class that maps variables to their most appropriate types.
In D137348 we've introduced the Gadget abstraction, which describes
a rigid AST pattern that the analysis "fully understands" and may need
to fix. Which specific fix is actually necessary for a given Gadget,
and whether it's necessary at all, and whether it's possible in the first place,
depends on the Strategy. So, this patch adds a virtual method which every
gadget can implement in order to teach the analysis how to fix that gadget:
Gadget->getFixits(Strategy)
However, even if the analysis knows how to fix every Gadget, doesn't
necessarily mean it can fix the variable. Some uses of the variable may have
never been covered by Gadgets, which corresponds to the situation that
the analysis doesn't fully understand how the variable is used. This patch
introduces a Tracker class that tracks all variable uses (i.e. DeclRefExprs)
in the function. Additionally, each Gadget now provides a new virtual method
Gadget->getClaimedVarUseSites()
that the Tracker can call to see which DeclRefExprs are "claimed" by the Gadget.
In order to fix the variable with a certain Strategy, the Tracker needs to
confirm that there are no unclaimed uses, and every Gadget has to provide
a fix for that Strategy.
This "conservative" behavior guarantees that fixes emitted by our analysis
are correct by construction. We can now be sure that the analysis won't
attempt to emit a fix if it doesn't understand the code. Later, as we implement
more getFixits() methods in individual Gadget classes, we'll start
progressively emitting more and more fixits.
Differential Revision: https://reviews.llvm.org/D138253
Benoit Jacob [Thu, 15 Dec 2022 02:00:39 +0000 (02:00 +0000)]
Allow non-constant divisors in affine mod, floordiv, ceildiv.
The requirement that divisor>0 is not enforced here outside of the
constant case, but how to enforce it? If I understand correctly, it is
UB and while it is nice to be able to deterministically intercept UB,
that isn't always feasible. Hopefully, keeping the existing
enforcement in the constant case is enough.
Differential Revision: https://reviews.llvm.org/D140079
Roman Lebedev [Sat, 17 Dec 2022 02:13:30 +0000 (05:13 +0300)]
Reland "[SimplifyCFG] `FoldBranchToCommonDest()`: deal with mismatched IV's in PHI's in common successor block"
This reverts commit
37b8f09a4b61bf9bf9d0b9017d790c8b82be2e17,
and returns commit
1bd0b82e508d049efdb07f4f8a342f35818df341.
The miscompile was in InstCombine, and it has been addressed.
This tries to approach the problem noted by @arsenm:
terrible codegen for `__builtin_fpclassify()`:
https://godbolt.org/z/388zqdE37
Just because the PHI in the common successor happens to have different
incoming values for these two blocks, doesn't mean we have to give up.
It's quite easy to deal with this, we just need to produce a select:
https://alive2.llvm.org/ce/z/000srb
Now, the cost model for this transform is rather overly strict,
so this will basically never fire. We tally all (over all preds)
the selects needed to the NumBonusInsts
Differential Revision: https://reviews.llvm.org/D139275
Roman Lebedev [Sat, 17 Dec 2022 01:57:58 +0000 (04:57 +0300)]
[IR][PatternMatch] `m_Not`: do not apply inner matcher unless `Not` matched
This is consistent with how other commutative matchers operate,
and i assumed that is how this one worked, alas it did not,
and thus `foldNestedSelects()` was miscompiling stuff.
Roman Lebedev [Sat, 17 Dec 2022 01:20:28 +0000 (04:20 +0300)]
[NFC][InstCombine] Simplify miscompile testcase
Roman Lebedev [Fri, 16 Dec 2022 21:22:11 +0000 (00:22 +0300)]
[NFC][InstCombine] Add some readability by using `DecomposedSelect` struct
Peter Klausler [Sat, 17 Dec 2022 00:47:06 +0000 (16:47 -0800)]
[flang] Catch attempts to initialize allocatable components with DATA statement
Nice try, but no, you can't initialize an instance of a derived type using a
structure constructor that has a component corresponding to an allocatable
component.
Differential Revision: https://reviews.llvm.org/D140144
Fangrui Song [Sat, 17 Dec 2022 02:08:24 +0000 (02:08 +0000)]
clang/unittests/Basic/SarifTest.cpp: std::optional::value => operator*
Mitch Phillips [Sat, 17 Dec 2022 01:58:39 +0000 (17:58 -0800)]
Revert "[Attributor][NFCI] Update tests according to last commit"
This reverts commit
cc9d9df7e539da4752f1569155d4ceb78465114f.
Reason: This change is dependent on a commit that needs to be rolled
back because it broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Mitch Phillips [Sat, 17 Dec 2022 01:56:48 +0000 (17:56 -0800)]
Revert "[Attributor] Introduce AA[Intra/Inter]Reachability"
This reverts commit
fc21f2d7bae2e0be630470cc7ca9323ed5859892.
This patch broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Mitch Phillips [Sat, 17 Dec 2022 01:56:38 +0000 (17:56 -0800)]
Revert "[OpenMP][FIX] Restrict more unsound assmptions about threading"
This reverts commit
07c375348083170e39c9498a42a9679c7e08f07f.
Reason: This change is dependent on a commit that needs to be rolled
back because it broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Mitch Phillips [Sat, 17 Dec 2022 01:56:21 +0000 (17:56 -0800)]
Revert "[Attributor][FIX] Avoid memory leakage through InstExclusionSet"
This reverts commit
4a5d0d8704aa2860c0459a63adfdd415a451c4f1.
Reason: This change is dependent on a commit that needs to be rolled
back because it broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Mitch Phillips [Sat, 17 Dec 2022 01:56:11 +0000 (17:56 -0800)]
Revert "[Attributor][FIX] Try to prevent a potential memory leak"
This reverts commit
2ac37df5d7f385dbf9c9456aae1cc6d0d98587ef.
Reason: This change is dependent on a commit that needs to be rolled
back because it broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Mitch Phillips [Sat, 17 Dec 2022 01:56:00 +0000 (17:56 -0800)]
Revert "[Attributor][FIX] Allow negative offsets for ranges"
This reverts commit
88f9b525085b4292080aec6aba835801ca5793b6.
Reason: This change is dependent on a commit that needs to be rolled
back because it broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Mitch Phillips [Sat, 17 Dec 2022 01:55:48 +0000 (17:55 -0800)]
Revert "[AAPointerInfo] handle multiple offsets in PHI"
This reverts commit
88db516af69619d4326edea37e52fc7321c33bb5.
Reason: This change is dependent on a commit that needs to be rolled
back because it broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Mitch Phillips [Sat, 17 Dec 2022 01:55:38 +0000 (17:55 -0800)]
Revert "Revert "[AAPointerInfo] handle multiple offsets in PHI""
This reverts commit
12696d302d146ffe616eecab3feceba9d29be2db.
Reason: This change is dependent on a commit that needs to be rolled
back because it broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Mitch Phillips [Sat, 17 Dec 2022 01:54:44 +0000 (17:54 -0800)]
Revert "[AAPointerInfo] handle multiple offsets in PHI"
This reverts commit
179ed8871101cd197e0a719a3629cd5077b1a999.
Reason: This change is dependent on a commit that needs to be rolled
back because it broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Fangrui Song [Sat, 17 Dec 2022 01:42:39 +0000 (01:42 +0000)]
std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
This fixes check-llvm.
ziqingluo-90 [Sat, 17 Dec 2022 00:21:57 +0000 (16:21 -0800)]
[-Wunsafe-buffer-usage] Add warnings for unsafe buffer accesses by array subscript operations
Add an unsafe Gadget in the Unsafe Buffer Usage anslysis to represent
(and search (via matchers) for) unsafe buffer-accessing array subscript operations.
Reviewed By: NoQ, jkorous, aaron.ballman, xazax.hun
Differential Revision: https://reviews.llvm.org/D137379
Nico Weber [Sat, 17 Dec 2022 01:09:25 +0000 (20:09 -0500)]
Peter Klausler [Fri, 16 Dec 2022 23:10:50 +0000 (15:10 -0800)]
[flang] Prevent crash in error case: elemental with alternate return
When an ELEMENTAL subroutine is erroneously declared with alternate return
arguments, don't crash when checking the ranks of the actual arguments.
Differential Revision: https://reviews.llvm.org/D140143
Kevin Sala [Sat, 17 Dec 2022 00:37:21 +0000 (01:37 +0100)]
[NFC][OpenMP] Fix format for recent changes on OMPGridValues
This patch applies the clang-format to the recent changes on OMPGridValues
introduced by commit
2e9c3fe6fcfd7b4672facec87dceb76ff3c83566.
Fangrui Song [Sat, 17 Dec 2022 00:42:05 +0000 (00:42 +0000)]
std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
This fixes clang.
Kevin Sala [Wed, 21 Sep 2022 19:25:39 +0000 (19:25 +0000)]
[OpenMP] Increase max teams in OMPGridValues
Differential Revision: https://reviews.llvm.org/D140174
Siva Chandra Reddy [Sat, 17 Dec 2022 00:20:01 +0000 (00:20 +0000)]
[libc][Obvious] Add missing deps for a few targets.
Mircea Trofin [Sat, 17 Dec 2022 00:10:22 +0000 (16:10 -0800)]
Revert "[InlineAdvisor] Allow loading advisors as plugins"
This reverts commit
a00aaf2b1317fbc224dc6606ef7c2a10d617f28f.
Example failures:
https://lab.llvm.org/buildbot#builders/68/builds/44933
https://lab.llvm.org/buildbot#builders/230/builds/6938
ibricchi [Fri, 16 Dec 2022 22:11:52 +0000 (14:11 -0800)]
[InlineAdvisor] Allow loading advisors as plugins
Adds the ability to load InlineAdvisors as plugins. This allows developing and distributing inlining heuristics outside of tree.
The PluginInlineAdvisorAnalysis class serves as the entry point for dynamic advisors. Plugins must register instances of this class to provide their own InliningAdvisor.
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D139644
Mircea Trofin [Fri, 16 Dec 2022 23:44:27 +0000 (15:44 -0800)]
[NFC] Add llvm-config.h def for LLVM_ENABLE_PLUGINS
Snatched from D139644, but because it'd also need a fix in
Passes/CMakeLists.txt, decided to peel it off.
Fangrui Song [Fri, 16 Dec 2022 23:43:32 +0000 (23:43 +0000)]
-Wunsafe-buffer-usage: fix build when -DLLVM_ENABLE_ASSERTIONS=off
Fangrui Song [Fri, 16 Dec 2022 23:41:36 +0000 (23:41 +0000)]
[CodeGen] std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
This fixes LLVMMIRParser, LLVMGlobalISel, LLVMAsmPrinter, LLVMSelectionDAG.
David Blaikie [Fri, 16 Dec 2022 23:39:28 +0000 (23:39 +0000)]
Ensure clang test doesn't write out to the source directory
Fangrui Song [Fri, 16 Dec 2022 23:21:27 +0000 (23:21 +0000)]
[Transforms,CodeGen] std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
David Blaikie [Fri, 16 Dec 2022 23:13:47 +0000 (23:13 +0000)]
clang/test/CodeCompletion: Simplify/fix some `touch` commands
These were inconsistent (one `touch` line listed all the files in a
single `touch` invocation, but the other listed them as separate
commands with `&&`) and incorrect (one `&&` was missing, causing `touch`
to try to touch a file called `touch` in the cwd, which might not be
accessible/relevant to test execution)
So make them consistent and simpler by using the "list all the files on
a line in a single `touch` invocation" reducing the visual
noise/clutter/etc.
Arthur Eubanks [Fri, 16 Dec 2022 23:16:52 +0000 (15:16 -0800)]
[lldb][NFC] Remove unused/unimplemented Type methods
Murali Vijayaraghavan [Fri, 16 Dec 2022 04:49:45 +0000 (04:49 +0000)]
[mlir][linalg] Creating named 1D pooling ops
This is mostly going to be used for linalg transformations - to make pooling ops similar to convolution ops.
Differential Revision: https://reviews.llvm.org/D140186
Peter Klausler [Fri, 16 Dec 2022 21:48:13 +0000 (13:48 -0800)]
[flang][runtime] Allow CLASS(*) components when creating descriptors
Extend the descriptor creation function for components to allow
unlimited polymorphic components (CLASS(*)) and to also properly set
the attributes of the established descriptors.
Differential Revision: https://reviews.llvm.org/D140141
Artem Dergachev [Fri, 16 Dec 2022 22:46:05 +0000 (14:46 -0800)]
[-Wunsafe-buffer-usage] NFC: Introduce an abstraction for fixable code patterns.
This patch introduces a hierarchy of Gadget classes, which are going to be
the core concept in the somewhat sophisticated machine behind the upcoming
-Wunsafe-buffer-usage fix-it hints.
A gadget is a rigid code pattern that constitutes an operation that
the fixit machine "understands" well enough to work with. A gadget may be
"unsafe" (i.e., constitute a raw buffer access) or "safe" (constitute
a use of a pointer or array variable that isn't unsafe per se,
but may need fixing if the participating variable changes type
to a safe container/view).
We'll be able to make decisions about how to fix the code depending on
the set of gadgets that we've enumerated. Basically, in order to fix a type
of a variable, each use of that variable has to participate in a gadget,
and each such gadget has to consent to fixing itself according to
the variable's new type.
Differential Revision: https://reviews.llvm.org/D137348
Kevin Sala [Fri, 16 Dec 2022 14:26:46 +0000 (15:26 +0100)]
[OpenMP][libomptarget] Add AMDGPU NextGen plugin with asynchronous behavior
This commit adds the AMDGPU NextGen plugin inheriting from PluginInterface's classes.
It also implements the asynchronous behavior in the plugin operations: kernel launches
and memory transfers. To this end, it implements the concept of streams of asynchronous
operations. The streams are implemented using the HSA signals to define input and output
dependencies between asynchronous operations.
Missing features:
- Retrieve the maximum number of threads per group that a kernel can run. This requires
reading the image.
- Implement __tgt_rtl_sync_event, not used on the libomptarget side.
Differential Revision: https://reviews.llvm.org/D138389
Kevin Sala [Fri, 16 Dec 2022 14:23:34 +0000 (15:23 +0100)]
[OpenMP][libomptarget] Add missing symbols in dynamic_hsa
This patch prepares for the new AMDGPU NextGen plugin.
Differential Revision: https://reviews.llvm.org/D140213
Fangrui Song [Fri, 16 Dec 2022 22:57:55 +0000 (22:57 +0000)]
[Transforms,InstCombine] std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
Fangrui Song [Fri, 16 Dec 2022 22:44:08 +0000 (22:44 +0000)]
std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
This commit fixes LLVMAnalysis and its dependencies.
Adrian Prantl [Fri, 16 Dec 2022 21:50:09 +0000 (13:50 -0800)]
Temporarily skip test under ASAN
Dave Lee [Wed, 14 Dec 2022 21:53:15 +0000 (13:53 -0800)]
[lldb] Report clang module build remarks
Update the Clang diagnostic consumer (in ClangModulesDeclVendor) to report
progress on Clang module builds, as both progress events and expression logs.
Module build remarks are enabled by with clang's `-Rmodule-build` flag.
With this change, command line users of lldb will see progress events showing
which modules are being built, and - by how long they stay on screen - how much
time it takes to build them. IDEs that show progress events can show these
updates if desired.
This does not show module-import remarks, although that may be added as a
future change.
Differential Revision: https://reviews.llvm.org/D140056
Peter Klausler [Fri, 16 Dec 2022 19:44:51 +0000 (11:44 -0800)]
[flang] Correct folding of EXTENDS_TYPE_OF()
There was a falsely known case with a polymorphic type.
Differential Revision: https://reviews.llvm.org/D140140
Jacques Pienaar [Fri, 16 Dec 2022 21:36:15 +0000 (13:36 -0800)]
[mlir-c] Add method to create unmanaged dense resource elements attr
Following DenseElementsAttr pattern.
Differential Revision: https://reviews.llvm.org/D140189
Emilia Dreamer [Fri, 16 Dec 2022 21:25:52 +0000 (23:25 +0200)]
[clang-format] Don't require deduction guides to be templates
The C++ standard doesn't require that class template deduction guides
be templates themselves, but previously `isDeductionGuide` would assert
for the existence of a template closer or requires clause closer before
the deduction guide declaration.
This patch simply removes that check. Because of this, a test which
asserted that `x()->x<1>;` *isn't* a deduction guide failed, as it is
now formatted as a deduction guide. However, as @JohelEGP demonstrated,
it is [possible to make that a viable deduction guide][1].
Thus, that test has been removed, but other tests related to
non-template class template deduction guides have been added.
Fixes https://github.com/llvm/llvm-project/issues/55142
[1]: https://compiler-explorer.com/z/Wx3K6d5K9
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D139416
Hanhan Wang [Fri, 2 Dec 2022 21:25:48 +0000 (13:25 -0800)]
[mlir][tensor] Implement TilingInterface for unpack op
The main issue of tiling unpack op is about incomplete tile. Since all
the dimensions are orthogonal, discussing 1-d unpack case is enough. The
core idea is to make the input slice have complete tiles. In this case,
a larger unpacked tile will be created. We'll need an extract_slice op
to shift and truncate the output.
Take Nn_to_N as an example. Say that N=32, n=8, and tiling_size=15. The
coordinates of second tile (i.e., result[15..31]) are [(1, 7), (2, 0,),
(2, 1) ... (3, 6), (3, 7)]. The first row and the last row are
incomplete in terms of inputs. It's impossible to represent an unpack op
using the coordinates. Because the input has higher rank and the math
computation of coordinate is using mod and ceilDiv. That's very tricky.
To represent the unpack op, we have to complete the rows. I.e., the
input coordinates would start with (1, 0); end with (3, 7). In this
context, the tiled unpack produces a (3 * n) elements because there are
3 rows in total. Follow by a tensor.extract_slice op, we can get the
actual result.
If the tiling sizes are multiple of inner tile sizes, it is a perfect
tiling case. In this context, the larger input and output is not needed.
Reviewed By: chelini
Differential Revision: https://reviews.llvm.org/D139362
Adrian Prantl [Fri, 16 Dec 2022 21:02:59 +0000 (13:02 -0800)]
Fix a syntax error
Paul Robinson [Fri, 16 Dec 2022 20:47:54 +0000 (12:47 -0800)]
[fuzzer] Fix UNSUPPORTED criteria for two tests
Fuzzer might decide on a target arch different from the triple.
Fangrui Song [Fri, 16 Dec 2022 20:31:47 +0000 (20:31 +0000)]
Error: Replace value() with operator*
Some older macOS libc++ report:
error: 'value' is unavailable: introduced in macOS 10.13
Fangrui Song [Fri, 16 Dec 2022 20:24:35 +0000 (20:24 +0000)]
[mlir] Drop uses of operator<<(raw_ostream &OS, const Optional<T> &O)
Valentin Clement [Fri, 16 Dec 2022 20:21:00 +0000 (21:21 +0100)]
[flang] Fix fir.dispatch_table generation with derived-type parameter with kind type parameter
When generating the `fir.dispatch_table` operation, the name of the parent
derived-type needs to be mangled. For this the type instantiation
DerivedTypeSpec needs to be retrieved to have the correct kind type parameters.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D140209
Valentin Clement [Fri, 16 Dec 2022 20:19:55 +0000 (21:19 +0100)]
[flang] Unlimited polymoprhic allocation with intrinsic type spec
An unlimited polymoprhic entity can be allocated with a derived type
spec or an intrinsic type spec. This patch add the generation of the
runtime function call when the allocation is done with an intrinsic
type spec.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D140207
Jeffrey Byrnes [Thu, 8 Dec 2022 21:26:59 +0000 (13:26 -0800)]
[AMDGPU][SIFrameLowering] Mark VGPR used for AGPR spills as reserved
Presently, there is an issue on MI100 (and probably other architecture) where the VGPR used for AGPR copies clobbers VGPR used for AGPR spill. AFAICT this is because in processFunctionBeforeFrameIndicesReplaced we think the VGPR register for AGPR spill is unused. This patch aims to correct that. This is a WIP while I work out issues with producing a good test. For now, I'm curious if this is generally a good / bad idea.
Differential Revision: https://reviews.llvm.org/D139673
Roman Lebedev [Fri, 16 Dec 2022 19:53:58 +0000 (22:53 +0300)]
Revert "[SROA] `isVectorPromotionViable()`: memory intrinsics operate on vectors of bytes (take 3)"
While the PPC litte-endian miscompile did get addressed
by https://reviews.llvm.org/D140046
the PPV big-endian bots are still unhappy.
https://lab.llvm.org/buildbot/#/builders/93/builds/12560
This reverts commit
7bd358bcb4e358b4351c69e02ef76939e08acdc7.
Fangrui Song [Fri, 16 Dec 2022 19:57:30 +0000 (19:57 +0000)]
[mlir] Drop uses of operator<<(raw_ostream &OS, const Optional<T> &O)
Fangrui Song [Fri, 16 Dec 2022 19:46:00 +0000 (19:46 +0000)]
[clangd] Migrate uses of operator<<(raw_ostream &OS, const Optional<T> &O) to std::optional