Adrian Prantl [Fri, 26 May 2023 20:51:30 +0000 (13:51 -0700)]
Revert "Factor out xcrun into a function (NFC)"
This reverts commit
97ca34996dbe5a61e79d7c559af7b15dc39c08a5.
Adrian Prantl [Fri, 26 May 2023 20:51:25 +0000 (13:51 -0700)]
Revert "Make function static (NFC)"
This reverts commit
cefd2802aa49274942da87edf5019b5a23315f01.
Jonas Devlieghere [Fri, 26 May 2023 20:10:51 +0000 (13:10 -0700)]
[lldb] Skip instead of XFAIL TestInteractiveScriptedProcess
The test is failing on x86_64 but passing on arm64. Skip until Ismail
can investigate this further.
Adrian Prantl [Fri, 26 May 2023 20:12:12 +0000 (13:12 -0700)]
Make function static (NFC)
Adrian Prantl [Fri, 26 May 2023 20:01:34 +0000 (13:01 -0700)]
Factor out xcrun into a function (NFC)
Hongtao Yu [Fri, 26 May 2023 05:41:58 +0000 (22:41 -0700)]
[PseudoProbe] Do not force the calliste debug loc to inlined probes from __nodebug__ functions.
For pseudo probes we would like to keep their original dwarf discriminator (either a zero or null) until the first FS-discriminator pass. The inliner is a violation of that, given that it assigns inlinee instructions with no debug info with the that of the callsite. This is being disabled in this patch.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D151568
Florian Hahn [Fri, 26 May 2023 19:58:05 +0000 (20:58 +0100)]
[PhaseOrdering] Add test for loop over span with hardened libc++.
Add a slightly reduced test case for a loop iterating over a std::span
with libc++ hardening.
See https://godbolt.org/z/cKerYq9fY.
max [Fri, 26 May 2023 19:39:03 +0000 (14:39 -0500)]
[MLIR][python bindings] Fix inferReturnTypes + AttrSizedOperandSegments for optional operands
Right now `inferTypeOpInterface.inferReturnTypes` fails because there's a cast in there to `py::sequence` which throws a `TypeError` when it tries to cast the `None`s. Note `None`s are inserted into `operands` for omitted operands passed to the generated builder:
```
operands.append(_get_op_result_or_value(start) if start is not None else None)
operands.append(_get_op_result_or_value(stop) if stop is not None else None)
operands.append(_get_op_result_or_value(step) if step is not None else None)
```
Note also that skipping appending to the list operands doesn't work either because [[ https://github.com/llvm/llvm-project/blob/
27c37327da67020f938aabf0f6405f57d688441e/mlir/lib/Bindings/Python/IRCore.cpp#L1585 | build generic ]] checks against the number of operand segments expected.
Currently the only way around is to handroll through `ir.Operation.create`.
Reviewed By: rkayaith
Differential Revision: https://reviews.llvm.org/D151409
Louis Dionne [Thu, 25 May 2023 16:46:21 +0000 (09:46 -0700)]
[libc++][NFC] Add additional test case for modules issue in Objective-C++
Differential Revision: https://reviews.llvm.org/D151467
Alexey Bataev [Fri, 26 May 2023 17:35:25 +0000 (10:35 -0700)]
[SLP]Fix getSpillCost functions.
There are several issues in the current implementation. The instructions
are not properly ordered, if they are placed in different basic blocks,
need to reverse the order of blocks. Also, need to exclude
non-vectorizable nodes and check for CallBase, not CallInst, otherwise
invoke calls are not handled correctly.
Craig Topper [Fri, 26 May 2023 19:16:19 +0000 (12:16 -0700)]
[RISCV] Simplify code in LowerIS_FPCLASS. NFC
Craig Topper [Fri, 26 May 2023 19:01:14 +0000 (12:01 -0700)]
[RISCV] Remove extra MVT::Other result from creation of RISCVISD::FCLASS_VL.
electriclilies [Fri, 26 May 2023 18:53:17 +0000 (11:53 -0700)]
Add fastmath attributes to llvm.call_intrinsic
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D151492
Craig Topper [Fri, 26 May 2023 18:49:55 +0000 (11:49 -0700)]
[RISCV] Tighten type constraint for RISCVISD::FCLASS_VL.
Daniel Thornburgh [Tue, 23 May 2023 18:48:28 +0000 (11:48 -0700)]
[lldb] Pass CMAKE_SYSROOT through to LLDB shell tests
This allows the LLDB Shell tests to succeed in (e.g. CI) environments where
system libraries are provided hermetically as a sysroot.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D151269
Alexey Bataev [Fri, 26 May 2023 17:59:40 +0000 (10:59 -0700)]
[SLP][NFC]Add a test for spill cost, NFC.
Aart Bik [Fri, 26 May 2023 17:50:55 +0000 (10:50 -0700)]
[mlir][sparse][gpu] fix merge conflict
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D151574
Alex Langford [Wed, 24 May 2023 22:01:22 +0000 (15:01 -0700)]
[lldb][NFCI] Include <cstdio> in SBDefines for FILE * definition
There are a few API headers that use FILE * but do not include the
correct header for their definition. Instead of including <cstdio> in each
of the headers manually, it seems easiest to include it in SBDefines to
get them all at once.
rdar://
109579348
Differential Revision: https://reviews.llvm.org/D151381
Nikolas Klauser [Fri, 26 May 2023 14:45:08 +0000 (07:45 -0700)]
[libc++][PSTL] Add a test to make sure that customization points work properly
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D151257
Craig Topper [Fri, 26 May 2023 17:48:49 +0000 (10:48 -0700)]
SelectionDAG: Teach ComputeKnownBits about VSCALE
This reverts commit
9b92f70d4758f75903ce93feaba5098130820d40. The issue
with the re-applied change was an implicit truncation due to the
multiplication. Although the operations were converted to `APInt`, the
values were implicitly converted to `long` due to the typing rules.
Fixes: #59594
Differential Revision: https://reviews.llvm.org/D140347
Piotr Zegar [Fri, 26 May 2023 16:03:39 +0000 (16:03 +0000)]
[clang-tidy] Optimize misc-confusable-identifiers
Main performance issue in this check were caused by many
calls to getPrimaryContext and constant walk up to declaration
contexts using getParent. Also there were issue with forallBases
that is slow.
Profiled with perf and tested on open-source project Cataclysm-DDA.
Before changes check took 27320 seconds, after changes 3682 seconds.
That's 86.5% reduction. More optimizations are still possible in this
check.
Reviewed By: serge-sans-paille
Differential Revision: https://reviews.llvm.org/D151051
Louis Dionne [Thu, 18 May 2023 21:11:01 +0000 (14:11 -0700)]
[libc++][ci] Install ccache in the Docker image
This will allow using ccache in the jobs that build Clang, which
should speed up those jobs.
Differential Revision: https://reviews.llvm.org/D150907
Jennifer Yu [Thu, 25 May 2023 16:29:59 +0000 (09:29 -0700)]
Fix wrong error message when compiling C souce code:
Currently emit error for uses_allocators(alloc(traits)):
called object type 'omp_allocator_handle_t' (aka
'enum omp_allocator_handle_t') is not a function or function pointer
To fix this, since "alloc" is Id expresison(spce 5.2), during the parser
(in ParseOpenMP.cpp), using tryParseCXXIdExpression instead of
ParseExpression for C.
Differential Revision: https://reviews.llvm.org/D151517
Kun Wu [Fri, 26 May 2023 02:29:49 +0000 (02:29 +0000)]
[mlir] [sparse] [gpu] adding transpose support to spmm spmv
Reviewed By: aartbik, wrengr
Differential Revision: https://reviews.llvm.org/D151259
Fangrui Song [Fri, 26 May 2023 16:52:57 +0000 (09:52 -0700)]
[Driver][X86] Reject unsupported value for -mabi=
-mabi= was incorrectly claimed before D134671. -mabi=sysv appears to be
somewhat common in open-source packages, even if it was not intended to
be supported by Clang.
(For common options supported by multiple architectures, it's easy to
forget to report an error on unsupported targets. Unfortunately
the driver infrastructure doesn't make this less error-prone.)
On x86, support -mabi=sysv for non-Windows targets and -mabi=ms for Windows,
and remove the spurious -Wunused-command-line-argument warning.
With this change, all popular architectures claim -mabi=, so we don't
have to worry much about -Wunused-command-line-argument for other
architectures.
Differential Revision: https://reviews.llvm.org/D151509
Thurston Dang [Thu, 25 May 2023 20:37:11 +0000 (20:37 +0000)]
hwasan: enable mmap interception (no tagging used)
This enables HWASan interception for mmap, to prevent users from allocating in the shadow memory regions. For compatibility, it does not use pointer tagging, nor does it allow MAP_FIXED with a tagged address.
This patch initializes the common interceptors, but that should be a no-op (except for the mmap interceptor), due to the disable-by-default nature of hwasan_platform_interceptors.h (from D150708). As the first patch to utilize this common interceptor machinery for HWASan, it also defines some macros (e.g., COMMON_INTERCEPT_FUNCTION) that will be useful as future interceptors are enabled.
TestCases/Posix/mmap_write_exec.cpp now passes for HWASan.
Reviewed By: kstoimenov, vitalybuka
Differential Revision: D151262
Jonas Devlieghere [Fri, 26 May 2023 16:26:29 +0000 (09:26 -0700)]
[lldb] Remove reproducer test suite (NFC)
The reproducer feature as well as the ability to capture or replay tests
with reproducers was removed. This removes the corresponding CMake
target.
V Donaldson [Thu, 25 May 2023 17:05:26 +0000 (10:05 -0700)]
[flang] Retain the sign of the argument for the result of fraction(0)
The f18 clause 16.9.80 description of the FRACTION(X) intrinsic states:
Result Value. The result has the value ....
If X has the value zero, the result is zero.
If X is an IEEE NaN, the result is that NaN.
If X is an IEEE infinity, the result is an IEEE NaN.
This clause does not specify whether fraction(-0.0) should be -0.0 or +0.0.
However, a folded result and a runtime result should be consistent, and
returning -0.0 is more in line with the result for fraction(NaN).
For this test:
print '(2f6.1)', 0.0, fraction(0.0)
call f(0.0)
print '(2f6.1)', -0.0, fraction(-0.0)
call f(-0.0)
end
subroutine f(x)
print '(2f6.1)', x, fraction(x)
end
Current output is:
0.0 0.0
0.0 0.0
-0.0 -0.0
-0.0 0.0
Change that to:
0.0 0.0
0.0 0.0
-0.0 -0.0
-0.0 -0.0
Craig Topper [Fri, 26 May 2023 16:01:28 +0000 (09:01 -0700)]
[VP][SelectionDAG][RISCV] Add get_vector_length intrinsics and generic SelectionDAG support.
The generic implementation is umin(TC, VF * vscale).
Lowering to vsetvli for RISC-V will come in a future patch.
This patch is a pre-requisite to be able to CodeGen vectorized code from
D99750.
Reviewed By: reames, frasercrmck
Differential Revision: https://reviews.llvm.org/D149916
max [Fri, 26 May 2023 15:23:17 +0000 (10:23 -0500)]
[MLIR][python bindings] Add TypeCaster for returning refined types from python APIs
depends on D150839
This diff uses `MlirTypeID` to register `TypeCaster`s (i.e., `[](PyType pyType) -> DerivedTy { return pyType; }`) for all concrete types (i.e., `PyConcrete<...>`) that are then queried for (by `MlirTypeID`) and called in `struct type_caster<MlirType>::cast`. The result is that anywhere an `MlirType mlirType` is returned from a python binding, that `mlirType` is automatically cast to the correct concrete type. For example:
```
c0 = arith.ConstantOp(f32, 0.0)
# CHECK: F32Type(f32)
print(repr(c0.result.type))
unranked_tensor_type = UnrankedTensorType.get(f32)
unranked_tensor = tensor.FromElementsOp(unranked_tensor_type, [c0]).result
# CHECK: UnrankedTensorType
print(type(unranked_tensor.type).__name__)
# CHECK: UnrankedTensorType(tensor<*xf32>)
print(repr(unranked_tensor.type))
```
This functionality immediately extends to typed attributes (i.e., `attr.type`).
The diff also implements similar functionality for `mlir_type_subclass`es but in a slightly different way - for such types (which have no cpp corresponding `class` or `struct`) the user must provide a type caster in python (similar to how `AttrBuilder` works) or in cpp as a `py::cpp_function`.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D150927
Alex Zinenko [Fri, 26 May 2023 11:26:52 +0000 (11:26 +0000)]
[mlir] make `fuse_into_containing_op` preserve the containing op handle
This partially undoes the intent of https://reviews.llvm.org/D151418 by
cheating its way to keep the "containing op" (aka loop) handle read-only
in fusion. It is crucial to do so for composability of tiling and
fusion. Specfically, after the "containing op" handle started being
consumed, it became impossible to perform additional tiling after fusion
except tiling the last-fused op:
%tiled1, %loop1 = tile %op
%producer1, %loop2 = fuse %producer into %loop1
// invalid, because %tiled1 is invalidated by consuming %loop1
// that points to its parent
tile %tiled1
or
%tiled1, %loop1 = tile %op
%tiled2, %loop2 = tile %tiled1
%p2 = fuse %producer into %loop1
// invalid, because %loop2 is invalidated by consuming %loop1
// that points to its parent
fuse %p2 into %loop2
The approach here makes creative use of the state extension mechanism to
update the payload operation associted with the operand handle. Further
investigation is necessary to understand if is consistent with the
overall execution model of the transform dialect, but it is crucial to
restore composability ASAP.
Reviewed By: springerm, nicolasvasilache
Differential Revision: https://reviews.llvm.org/D151555
Alex Zinenko [Fri, 26 May 2023 13:07:13 +0000 (13:07 +0000)]
[mlir] teach expensive-checks transform mode about empty handle
The transform dialect interpreter features the expensive-checks mode
that acts as an embedded sanitizer to track use-after-consume of
transform handles. Its logic is based on the relations between payload
operations, which made it silently ignore empty handles that are
consumed. Also catch and report this case because the remaining code may
hit an assertion on attempting to access a consumed handle (that is
removed from the mapping).
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D151560
Jonas Devlieghere [Fri, 26 May 2023 15:48:02 +0000 (08:48 -0700)]
[lldb] Improve error message when evaluating expression when not stopped
When trying to run an expression after a process has existed, you
currently are shown the following error message:
(lldb) p strlen("")
error: Can't make a function caller while the process is running
This error is wrong and pretty uninformative. After this patch, the
following error message is shown:
(lldb) p strlen("")
error: unable to evaluate expression while the process is exited: the
process must be stopped because the expression might require
allocating memory.
rdar://
109731325
Differential revision: https://reviews.llvm.org/D151497
Nikita Popov [Fri, 26 May 2023 14:58:48 +0000 (16:58 +0200)]
[Clang] Convert some tests to opaque pointers (NFC)
Felipe de Azevedo Piovezan [Wed, 24 May 2023 11:53:26 +0000 (07:53 -0400)]
[FastISel] Implement translation of entry_value dbg.value intrinsics
For dbg.value intrinsics targeting an llvm::Argument address whose expression
starts with an entry value, we lower this to a DEBUG_VALUE targeting the livein
physical register corresponding to that Argument.
Depends on D151332
Differential Revision: https://reviews.llvm.org/D151333
LLVM GN Syncbot [Fri, 26 May 2023 15:12:00 +0000 (15:12 +0000)]
[gn build] Port
8d0412ce9d48
Philip Reames [Fri, 26 May 2023 14:59:08 +0000 (07:59 -0700)]
[RISCV] Revise test coverage for shuffle/insert idiom which become v(f)slide1ups
This fixes a couple mistakes in
0f64d4f877. In particular, I'd not included a negative test where the slideup didn't write the entire VL, and had gotten all of my 4 element vector shuffle masks incorrect so they didn't match. Also, add a test with swapped operands for completeness.
The transform is in D151468.
Nico Weber [Fri, 26 May 2023 15:05:57 +0000 (11:05 -0400)]
[gn] attempt to port
fe2f0ab37c33
Nikita Popov [Wed, 24 May 2023 14:47:15 +0000 (16:47 +0200)]
[InstCombine] Remove instructions in dead blocks during combining
We already do this during initial worklist population. Doing this
as part of primary combining allows us to remove instructions in
blocks that were rendered dead by condition folding within the
same instcombine iteration.
Nikita Popov [Fri, 26 May 2023 14:37:38 +0000 (16:37 +0200)]
[ValueTracking] Avoid optimizing away condition in test (NFC)
This is not what we're interested in testing, and it allows to
essentially optimize away the entire function with more powerful
optimization.
Michael Maitland [Thu, 25 May 2023 21:53:56 +0000 (14:53 -0700)]
[RISCV] Fix typo VLUpperBound to VLEN in SiFive7. NFC.
The scheduler models said VLUpperBound which was a typo and should have
said VLEN. This is a purley cosmetic fix.
Differential Revision: https://reviews.llvm.org/D151506
Krasimir Georgiev [Fri, 26 May 2023 14:25:50 +0000 (14:25 +0000)]
Zain Jaffal [Fri, 19 May 2023 14:24:30 +0000 (15:24 +0100)]
[AArch64] merge scaled and unscaled zero narrow stores.
This patch fixes a crash when a sclaed and unscaled zero stores are merged.
Differential Revision: https://reviews.llvm.org/D150963
Tejas Joshi [Fri, 26 May 2023 14:02:22 +0000 (16:02 +0200)]
[InstCombine] Optimize compares with multiple selects as operands
In case of a comparison with two select instructions having the same
condition, check whether one of the resulting branches can be simplified.
If so, just compare the other branch and select the appropriate result.
For example:
%tmp1 = select i1 %cmp, i32 %y, i32 %x
%tmp2 = select i1 %cmp, i32 %z, i32 %x
%cmp2 = icmp slt i32 %tmp2, %tmp1
The icmp will result false for the false value of selects and the result
will depend upon the comparison of true values of selects if %cmp is
true. Thus, transform this into:
%cmp = icmp slt i32 %y, %z
%sel = select i1 %cond, i1 %cmp, i1 false
Differential Revision: https://reviews.llvm.org/D150360
Corentin Jabot [Wed, 24 May 2023 16:11:40 +0000 (18:11 +0200)]
[Clang] Correctly handle generic lambda used as default template argument.
Adjust the template pparameter depth when parsing default
template arguments as they may introduce generic lambda whose parameters
are not substituted at the same depth.
Fixes #62611
Reviewed By: erichkeane, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D151342
Tejas Joshi [Fri, 26 May 2023 14:00:28 +0000 (16:00 +0200)]
[InstCombine] Add tests for icmp of select fold (NFC)
For D150360.
Nikita Popov [Thu, 25 May 2023 14:52:16 +0000 (16:52 +0200)]
[InstCombine] Handle undef when pruning unreachable code
If the branch condition is undef, then behavior is undefined and
neither of the successors are live.
This is to ensure that optimization quality does not decrease
when a constant gets replaced with undef/poison in this context.
Nikita Popov [Fri, 26 May 2023 13:54:51 +0000 (15:54 +0200)]
[ValueTracking] Avoid UB in test (NFC)
Don't use br undef, as it is UB.
Luo, Yuanke [Fri, 26 May 2023 05:28:59 +0000 (13:28 +0800)]
[X86] fold select to mask instructions.
When avx512 is available the lhs operand of select instruction can be
folded with mask instruction, while the rhs operand can't. This patch is
to commute the lhs and rhs of the select instruction to create the
opportunity of folding.
Differential Revision: https://reviews.llvm.org/D151535
Nikita Popov [Fri, 26 May 2023 13:47:50 +0000 (15:47 +0200)]
[InstCombine] Add additional tests for unreachable code (NFC)
Laszlo Kindrat [Thu, 25 May 2023 21:13:28 +0000 (17:13 -0400)]
[LLDB] Explicitly declare constructor in `PersistentExpressionState`
It seems that when trying to link the lldb library explicitly, the inlined default constructor cannot find the vtable for the class. This patch fixes this by explicitly declaring a default constructor in `PersistentExpressionState`, and providing the definition in the source file.
Differential Revision: https://reviews.llvm.org/D151501
Luo, Yuanke [Fri, 26 May 2023 13:04:04 +0000 (21:04 +0800)]
[NFC] refactor code
Split the NFC patch from D151535. Refactor canCombineAsMaskOperation to
take 1 input operand.
Nikita Popov [Fri, 26 May 2023 12:59:36 +0000 (14:59 +0200)]
[InstCombine] Add test for missing assume handling multi-use demanded bits (NFC)
Works if the assume is on a root value or an operation that does
not support multi-use demanded bits.
Nikita Popov [Fri, 26 May 2023 12:39:57 +0000 (14:39 +0200)]
[InstCombine] Use KnownBits::shl() in SimplifyDemandedBits()
It is more precise than the custom logic we had. This came up when
trying to enforce a consistency assertion with computeKnownBits().
Nikita Popov [Fri, 26 May 2023 12:03:12 +0000 (14:03 +0200)]
[KnownBits] Partially synchronize shift implementations (NFC)
And remove some bits of effectively dead code.
Benjamin Kramer [Fri, 26 May 2023 11:57:09 +0000 (13:57 +0200)]
[mlir] Make sure mlir-opt is in the list of substituted tools
otherwise it gets picked up from $PATH, which is not always working
properly.
Nikita Popov [Fri, 26 May 2023 10:09:44 +0000 (12:09 +0200)]
[KnownBits] Add fast-path for shl with unknown shift amount (NFC)
We currently don't call into KnownBits::shl() from ValueTracking
if the shift amount is unknown. If we do try to do so, we get
significant compile-time regressions, because evaluating all 64
shift amounts if quite expensive, and mostly pointless in this case.
Add a fast-path for the case where the shift amount is the full
[0, BitWidth-1] range. This primarily requires a more accurate
estimate of the max shift amount, to avoid taking the fast-path in
too many cases.
Differential Revision: https://reviews.llvm.org/D151540
Benjamin Kramer [Fri, 26 May 2023 11:11:48 +0000 (13:11 +0200)]
[bazel][libc] Add another missing dependency
Felipe de Azevedo Piovezan [Wed, 24 May 2023 11:13:17 +0000 (07:13 -0400)]
[FastISel][NFC] Remove repeated calls to get{Variable,Expr}
This will make it easy to reuse these values in subsequent commits.
Depends on D151331
Differential Revision: https://reviews.llvm.org/D151332
Felipe de Azevedo Piovezan [Wed, 24 May 2023 11:01:11 +0000 (07:01 -0400)]
[FastISel][NFC] Refactor if/else chain into early returns
This will make it easier to add more cases in a subsequent commit and also
better conforms to the coding guidelines.
Depends on D151330
Differential Revision: https://reviews.llvm.org/D151331
Felipe de Azevedo Piovezan [Tue, 23 May 2023 17:52:01 +0000 (13:52 -0400)]
[SelectionDAGBuilder] Handle entry_value dbg.value intrinsics
Summary:
DbgValue intrinsics whose expression is an entry_value and whose address is
described an llvm::Argument must be lowered to the corresponding livein physical
register for that Argument.
Depends on D151329
Reviewers: aprantl
Subscribers:
Felipe de Azevedo Piovezan [Tue, 23 May 2023 15:48:11 +0000 (11:48 -0400)]
[IRTranslator] Implement translation of entry_value dbg.value intrinsics
For dbg.value intrinsics targeting an llvm::Argument address whose expression
starts with an entry value, we lower this to a DEBUG_VALUE targeting the livein
physical register corresponding to that Argument.
Depends on D151328
Differential Revision: https://reviews.llvm.org/D151329
luxufan [Fri, 26 May 2023 03:48:28 +0000 (11:48 +0800)]
[RISCV] Support '.option arch' directive
The proposal of '.option arch' directive is https://github.com/riscv-non-isa/riscv-asm-manual/pull/67
Note: For '.option arch, +/-' directive, version number is not yet supported.
Reviewed By: luismarques, craig.topper
Differential Revision: https://reviews.llvm.org/D123515
dbakunevich [Thu, 11 May 2023 09:30:07 +0000 (16:30 +0700)]
[Utils] Added the ability to print the pass number and IR after it is triggered
As part of this patch, 2 options have been added:
print-pass-numbers and print-after-pass-number.
1) The print-pass-numbers option allows to print the pass names and their ordinals.
The output of the option looks like this:
Running pass ORDINAL PASS_NAME
2) The print-after-pass-number option allows to print IR after pass with the number
which reported by print-passes-names.
Reviewed By: apilipenko, aeubanks
Differential Revision: https://reviews.llvm.org/D149345
Benjamin Kramer [Fri, 26 May 2023 10:24:36 +0000 (12:24 +0200)]
Benjamin Kramer [Fri, 26 May 2023 10:14:50 +0000 (12:14 +0200)]
[bazel][libc] Adjust for
4f1fe19df385445fabde47998affca50c7f1bc1e
This also required a build rule for error_to_string, so add that too.
Benjamin Kramer [Fri, 26 May 2023 10:14:24 +0000 (12:14 +0200)]
[bazel] Run buildifier on libc BUILD. NFC.
Florian Hahn [Fri, 26 May 2023 10:01:18 +0000 (11:01 +0100)]
[Remarks] Retain all remarks by default, add option to drop without DL.
At the moment, dsymutil drops all remarks without debug location.
There are many cases where debug location may be missing for remarks,
mostly due LLVM not preserving debug locations. When using bitstream
remarks for statistical analysis, those missed remarks mean we get an
incomplete picture.
The patch flips the default to keeping all remarks and leaving it to
tools that display remarks to filter out remarks without debug locations
as needed.
The new --remarks-drop-without-debug flag can be used to drop remarks
without debug locations, i.e. restore the previous behavior.
Reviewed By: thegameg
Differential Revision: https://reviews.llvm.org/D151089
Ingo Müller [Fri, 26 May 2023 09:39:22 +0000 (09:39 +0000)]
[mlir][tensor] Fix one-shot bufferization of tensor.reshape.
I believe that the previous implementation did not work on any input. It
called getMemRefType with `layout = {}`, presumably with the intention
to create a MemrefType with identity layout. However, the implementation
of that function returns a MemrefType with *unknown* layout if it is
provided with a default-constructed layout attribute. This patch uses
getMemRefTypeWithStaticIdentityLayout instead, with has identical
behavior except for the case of a default-constructed layout, which it
passes on as-is to the MemrefType.
This problem did not surface in the test because tensor.reshape was not
tested with -one-shot-bufferize. This patch introduces a test copied
from the tests for -tesnor-bufferize adapted in as follows: since the
test is run with "bufferize-function-boundaries", a tensor that is
passed into the function is bufferized into a memref with unknown
layout, which wouldn't be a valid intput for memref.reshape, so the
tests now uses a tensor constructed with arith.constant inside of the
function.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D151544
Owen Pan [Fri, 26 May 2023 09:10:38 +0000 (02:10 -0700)]
[clang-format][doc] Fix a typo introduced in
9aab0db13fb6d
Mike Matthews [Fri, 26 May 2023 08:53:25 +0000 (01:53 -0700)]
[clang-format][doc] Fix contradiction in SortIncludes description
Fixes #62033.
Differential Revision: https://reviews.llvm.org/D147894
Brian Gluzman [Fri, 26 May 2023 08:41:18 +0000 (10:41 +0200)]
[clangd] Remove inline Specifier for DefineOutline Tweak
`inline` specifiers should be removed from from the function declaration and
the newly-created implementation.
For example, take the following (working) code:
```cpp
// foo.hpp
struct A {
inline void foo() { std::cout << "hello world\n" << std::flush; }
};
// foo.cpp
#include "foo.hpp"
// main.cpp
#include "foo.hpp"
int main() {
A a;
a.foo();
return 0;
}
// compile: clang++ -std=c++20 main.cpp foo.cpp -o main
```
After applying the tweak:
```
// foo.hpp
struct A {
inline void foo();
};
// foo.cpp
#include "foo.hpp"
inline void A::foo() { std::cout << "hello world\n" << std::flush; }
// main.cpp
#include "foo.hpp"
int main() {
A a;
a.foo();
return 0;
}
// compile: clang++ -std=c++20 main.cpp foo.cpp -o main
```
We get a link error, as expected:
```
/usr/bin/ld: /tmp/main-4c5d99.o: in function `main':
main.cpp:(.text+0x14): undefined reference to `A::foo()'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
This revision removes these specifiers from both the header and the source file. This was identified in Github issue llvm/llvm-project#61295.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D151294
Luke Lau [Thu, 25 May 2023 21:16:45 +0000 (22:16 +0100)]
[RISCV] Don't scalarize vector stores if volatile
As noted by @reames in https://reviews.llvm.org/D151211#4373404, we shouldn't
scalarize vector stores of constants if the store is volatile, or vector copies
if either the store or load are volatile.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D151500
Tres Popp [Fri, 26 May 2023 08:17:47 +0000 (10:17 +0200)]
[mlir] Move casting calls from methods to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.
Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.
Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Implementation:
This patch updates all remaining uses of the deprecated functionality in
mlir/. This was done with clang-tidy as described below and further
modifications to GPUBase.td and OpenMPOpsInterfaces.td.
Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
additional check:
main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
them to a pure state.
```
ninja -C $BUILD_DIR clang-tidy
run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
-header-filter=mlir/ mlir/* -fix
rm -rf $BUILD_DIR/tools/mlir/**/*.inc
```
Differential Revision: https://reviews.llvm.org/D151542
eopXD [Fri, 26 May 2023 08:26:31 +0000 (01:26 -0700)]
[Clang][RISCV] Add test coverage for typedef of RVV intrinsic data types under riscv_vector.h. NFC
Signed-off by: eop Chen <eop.chen@sifive.com>
Mikael Holmen [Fri, 26 May 2023 08:17:59 +0000 (10:17 +0200)]
[AMDGPU] Silence gcc warning [NFC]
Without the fix gcc complains with
../lib/Target/AMDGPU/SIWholeQuadMode.cpp:1543: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
1542 | unsigned CopyOp = MI->getOperand(1).isReg()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1543 | ? AMDGPU::COPY
| ~~~~~~~~~~~~~~
1544 | : TII->getMovOpcode(TRI->getRegClassForOperandReg(
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1545 | *MRI, MI->getOperand(0)));
|
Yeting Kuo [Wed, 26 Apr 2023 04:55:50 +0000 (12:55 +0800)]
[ASAN] Support memory checks on vp.gather/scatter.
The patch supports vp.gather/scatter by allowing addresses being pointer vectors.
And then we just need to check each active pointer element of those pointer vectors.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D149245
Qingyuan Zheng [Fri, 26 May 2023 07:15:10 +0000 (03:15 -0400)]
[clangd] Implement configs to stop clangd produce a certain semantic tokens
This patch introduces the following configurations to .clangd:
```
SemanticTokens:
DisabledKinds: [ ... ]
DisabledModifiers: [ ... ]
```
Based on the config, clangd would stop producing a certain type of semantic tokens from the source file.
Fixes https://github.com/clangd/clangd/discussions/1598
Reviewed By: nridge
Differential Revision: https://reviews.llvm.org/D148489
eopXD [Fri, 26 May 2023 07:22:34 +0000 (00:22 -0700)]
[Clang][RISCV] Add description for test case . NFC
Jay Foad [Thu, 25 May 2023 15:18:25 +0000 (16:18 +0100)]
[AMDGPU] 4-align SGPR triples
Previously SGPR triples like s[3:5] were aligned on a 3-SGPR boundary
which has no basis in hardware.
Aligning them on a 4-SGPR boundary is at least justified by the
architecture reference guide which says: "Quad-alignment of SGPRs is
required for operation on more than 64-bits".
Currently there are no instructions that take SGPR triples as operands
so the issue is latent.
Differential Revision: https://reviews.llvm.org/D151463
Valery Pykhtin [Fri, 9 Dec 2022 16:34:22 +0000 (17:34 +0100)]
[AMDGPU] Add pass to rewrite partially used virtual superregisters after RenameIndependentSubregs pass with registers of minimal size.
The main purpose of this is to simplify register pressure tracking as after the pass there is no need
to track subreg liveness anymore.
On the other hand this pass creates more possibilites for the subreg unaware code, as many of the subregs
becomes ordinary registers.
Intersting sideeffect: spill-vgpr.ll has lost a lot of spills.
Reviewed By: #amdgpu, arsenm
Differential Revision: https://reviews.llvm.org/D139732
Zi Xuan Wu (Zeson) [Fri, 26 May 2023 03:08:35 +0000 (11:08 +0800)]
[CSKY] Add missing relocation type for FK_Data_4 Fixup
Kazu Hirata [Fri, 26 May 2023 06:52:09 +0000 (23:52 -0700)]
[CodeGen] Remove unused declaration EmitMoveFromReturnSlot
The corresponding function definition was removed by:
commit
56e5a2e13e3048fc2ff39029cde406d9f4eb55f3
Author: George Burgess IV <george.burgess.iv@gmail.com>
Date: Sat Mar 10 01:11:17 2018 +0000
LiaoChunyu [Fri, 26 May 2023 06:19:45 +0000 (14:19 +0800)]
[RISCV] Custom lower vector llvm.is.fpclass to vfclass.v
After D149063.
This patch adds support for both scalable and fixed-length vector.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D151176
Kazu Hirata [Fri, 26 May 2023 06:41:34 +0000 (23:41 -0700)]
[CodeGen] Remove unused member variable NextBlockInfo
The last use was removed by:
commit
c9a52de0026093327daedda7ea2eead8b64657b4
Author: Akira Hatanaka <ahatanaka@apple.com>
Date: Wed Jun 3 16:41:50 2020 -0700
Fraser Cormack [Fri, 26 May 2023 06:20:01 +0000 (07:20 +0100)]
[RISCV] Regenerate missing test checks
Codegen was different between RV32 and RV64 so the single unified CHECK
was skipping these functions.
Fraser Cormack [Fri, 26 May 2023 06:02:20 +0000 (07:02 +0100)]
[lit][NFC] Remove docs for nonexistent parameter
Fraser Cormack [Fri, 26 May 2023 06:01:09 +0000 (07:01 +0100)]
[lit][NFC] Remove double space after full stop/period
Fraser Cormack [Fri, 26 May 2023 05:59:24 +0000 (06:59 +0100)]
[lit][NFC] Fix a couple of typos
Kazu Hirata [Fri, 26 May 2023 06:31:17 +0000 (23:31 -0700)]
[clang] Remove unused declaration IgnoreLinkageSpecDecls
The declaration and its corresponding function definition were removed
once by:
commit
02093906fa0fd5bacc61b2189ea643c78cd02509
Author: Nathan Sidwell <nathan@acm.org>
Date: Mon Feb 14 10:19:04 2022 -0800
However, the declaration was added back without a corresponding
function definition a few days later by:
commit
18ead23385a4e0e6421d658591b1ee6a1c592b53
Author: Peter Collingbourne <peter@pcc.me.uk>
Date: Thu Feb 17 11:23:33 2022 -0800
This is most likely a rebasing error.
Siva Chandra Reddy [Mon, 15 May 2023 22:12:26 +0000 (22:12 +0000)]
[libc] Make ErrnoSetterMatcher handle logging floating point values.
Along the way, couple of additional things have been done:
1. Move `ErrnoSetterMatcher.h` to `test/UnitTest` as all other matchers live
there now.
2. `ErrnoSetterMatcher` ignores matching `errno` on GPUs.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D151129
Jean Perier [Fri, 26 May 2023 06:21:49 +0000 (08:21 +0200)]
[flang][hlfir] Only canonicalize forall_index if it can be erased
It seems the canonicalization was not correct: it cannot return that
it failed if it did modify the IR.
This was exposed by a new MLIR sanity check added in
https://reviews.llvm.org/D144552.
I am not sure it is legit to return success if the operation being
canonicalized is not modified either. So only remove the loads if
they are the only uses of the forall_index.
Should fix (intermittent?) bot failures like
https://lab.llvm.org/buildbot/#/builders/179/builds/6251
since the new MLIR check was added.
Differential Revision: https://reviews.llvm.org/D151487
Anshil Gandhi [Wed, 24 May 2023 16:37:07 +0000 (09:37 -0700)]
[AMDGPUCodegenPrepare] Add NewPM Support
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D151241
Tobias Hieta [Fri, 26 May 2023 06:11:06 +0000 (08:11 +0200)]
[NFC][Py Reformat] Reformat version-check.py in .github dir
Tobias Hieta [Fri, 26 May 2023 06:06:03 +0000 (08:06 +0200)]
[NFC] Add mlir python reformat SHA to .git-blame-ignore-revs
Tobias Hieta [Wed, 17 May 2023 14:53:39 +0000 (16:53 +0200)]
[NFC][Py Reformat] Reformat python files in mlir subdir
This is an ongoing series of commits that are reformatting our
Python code.
Reformatting is done with `black`.
If you end up having problems merging this commit because you
have made changes to a python file, the best way to handle that
is to run git checkout --ours <yourfile> and then reformat it
with black.
If you run into any problems, post to discourse about it and
we will try to help.
RFC Thread below:
https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style
Differential Revision: https://reviews.llvm.org/D150782
Kazu Hirata [Fri, 26 May 2023 05:56:08 +0000 (22:56 -0700)]
[clang] Modernize SourceLocation (NFC)
Kazu Hirata [Fri, 26 May 2023 05:56:06 +0000 (22:56 -0700)]
[clang-tody] Fix typos in documentation
Tres Popp [Thu, 25 May 2023 14:35:45 +0000 (16:35 +0200)]
[mlir] Update cast/isa method calls to function calls
This updates the rest (at implementation) of MLIR's use of cast/isa
method calls where function calls are possible and automatic refactoring
is not. These changes occured in .td files or in macros.
Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Tres Popp [Thu, 25 May 2023 13:56:16 +0000 (15:56 +0200)]
[mlir] Move tblgen code generation to use functional forms of cast/isa
Summary:
The method forms are deprecated. This updates the rest of the tblgen
uses of methods where a function call is available.
Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Reviewers: rriddle