Erich Keane [Tue, 10 May 2022 20:34:01 +0000 (13:34 -0700)]
[NFC] Replace not-null and not-isa check with a not-isa_and_nonnull
Jim Ingham [Tue, 10 May 2022 20:27:47 +0000 (13:27 -0700)]
Add the "sent break" message to the "gdb-remote packets" channel
It was originally only in "gdb-remote process" but it is convenient to
also have it come as part of gdb-remote packets.
Matthias Braun [Tue, 10 May 2022 20:25:32 +0000 (13:25 -0700)]
Nathan James [Tue, 10 May 2022 20:06:17 +0000 (21:06 +0100)]
[clang-tidy] Fix unintended change left in
12cb540529e
jeff [Tue, 26 Apr 2022 18:23:13 +0000 (11:23 -0700)]
[AMDGPU] Allow for MFMA Inst Clustering
This patch adds cluster edges between independent MFMA instructions. Additionally, it propogates all predecessors of cluster insts to the root of the cluster(s), and all successors to the leaf(ves) of the cluster(s) -- this is done to remove the possibility that those insts will be interspersed within the cluster.
Reviewed By: kerbowa
Differential Revision: https://reviews.llvm.org/D124678
Erich Keane [Tue, 10 May 2022 19:48:01 +0000 (12:48 -0700)]
[NFC] Add missing 'break' in a switch case
Mingming Liu [Wed, 20 Apr 2022 19:28:19 +0000 (19:28 +0000)]
Enhance peephole optimization.
Differential Revision: https://reviews.llvm.org/D124118
Erich Keane [Tue, 10 May 2022 19:27:45 +0000 (12:27 -0700)]
[NFC]Add Missing Break in switch that we didn't notice because it was
last.
jeff [Thu, 28 Apr 2022 23:50:55 +0000 (16:50 -0700)]
[NFC] Fix typo
Reviewed By: kerbowa
Differential Revision: https://reviews.llvm.org/D124647
Arthur Eubanks [Tue, 10 May 2022 02:32:14 +0000 (19:32 -0700)]
[BasicAA] Fix order in which we pass MemoryLocations to alias()
D98718 caused the order of Values/MemoryLocations we pass to alias() to
be significant due to storing the offset in the PartialAlias case. But
some callers weren't audited and were still passing swapped arguments,
causing the returned PartialAlias offset to be negative in some
cases. For example, the newly added unittests would return -1
instead of 1.
Fixes #55343, a miscompile.
Reviewed By: asbirlea, nikic
Differential Revision: https://reviews.llvm.org/D125328
Florian Hahn [Tue, 10 May 2022 18:57:43 +0000 (19:57 +0100)]
[AArch64] Remove redundant f{min,max}nm intrinsics.
The patch extends AArch64TTIImpl::instCombineIntrinsic to simplify
llvm.aarch64.neon.f{min,max}nm(a, a) -> a.
This helps with simplifying code written using the ACLE, e.g.
see https://godbolt.org/z/jYxsoc89c
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D125234
Yaxun (Sam) Liu [Tue, 10 May 2022 18:55:59 +0000 (14:55 -0400)]
Fix indentation in ReleaseNotes.rst
Nicolas Vasilache [Tue, 10 May 2022 17:31:22 +0000 (17:31 +0000)]
[mlir][SCF] Retire `cloneWithNewYields` helper function.
This is now subsumed by `replaceLoopWithNewYields`.
Differential Revision: https://reviews.llvm.org/D125309
Mahesh Ravishankar [Fri, 6 May 2022 21:44:26 +0000 (21:44 +0000)]
[mlir][SCF] Add utility method to add new yield values to a loop.
The current implementation of `cloneWithNewYields` has a few issues
- It clones the loop body of the original loop to create a new
loop. This is very expensive.
- It performs `erase` operations which are incompatible when this
method is called from within a pattern rewrite. All erases need to
go through `PatternRewriter`.
To address these a new utility method `replaceLoopWithNewYields` is added
which
- moves the operations from the original loop into the new loop.
- replaces all uses of the original loop with the corresponding
results of the new loop
- use a call back to allow caller to generate the new yield values.
- the original loop is modified to just yield the basic block
arguments corresponding to the iter_args of the loop. This
represents a no-op loop. The loop itself is dead (since all its uses
are replaced), but is not removed. The caller is expected to erase
the op. Consequently, this method can be called from within a
`matchAndRewrite` method of a `PatternRewriter`.
The `cloneWithNewYields` could be replaces with
`replaceLoopWithNewYields`, but that seems to trigger a failure during
walks, potentially due to the operations being moved. That is left as
a TODO.
Differential Revision: https://reviews.llvm.org/D125147
Alan Zhao [Tue, 10 May 2022 18:19:45 +0000 (14:19 -0400)]
[llvm-ml] Implement support for MASM's extern directive
The EXTERN keyword defines external symbols in MASM.
Credit goes to epastor@ for implementing most of the logic; I (ayzhao@)
added some bugfixes and tests.
[0]: https://docs.microsoft.com/en-us/cpp/assembler/masm/extern-masm?view=msvc-170
Reviewed By: epastor
Submitted By: epastor
Differential Revision: https://reviews.llvm.org/D125273
Yaxun (Sam) Liu [Tue, 3 May 2022 18:13:56 +0000 (14:13 -0400)]
[CUDA][HIP] support __noinline__ as keyword
CUDA/HIP programs use __noinline__ like a keyword e.g.
__noinline__ void foo() {} since __noinline__ is defined
as a macro __attribute__((noinline)) in CUDA/HIP runtime
header files.
However, gcc and clang supports __attribute__((__noinline__))
the same as __attribute__((noinline)). Some C++ libraries
use __attribute__((__noinline__)) in their header files.
When CUDA/HIP programs include such header files,
clang will emit error about invalid attributes.
This patch fixes this issue by supporting __noinline__ as
a keyword, so that CUDA/HIP runtime could remove
the macro definition.
Reviewed by: Aaron Ballman, Artem Belevich
Differential Revision: https://reviews.llvm.org/D124866
Sanjay Patel [Tue, 10 May 2022 18:20:43 +0000 (14:20 -0400)]
[InstCombine] fold shuffles with FP<->Int cast operands
shuffle (cast X), (cast Y), Mask --> cast (shuffle X, Y, Mask)
This is similar to a recent transform with fneg (
b331a7ebc1e0 ),
but this is intentionally the most conservative first step to
try to avoid regressions in codegen. There are several
restrictions that could be removed as follow-up enhancements.
Note that a cast with a unary shuffle is currently canonicalized
in the other direction (shuffle after cast - D103038 ). We might
want to invert that to be consistent with this patch.
Sanjay Patel [Tue, 10 May 2022 15:52:07 +0000 (11:52 -0400)]
[InstCombine] add tests for shuffles with FP<->int cast operands; NFC
Joseph Huber [Tue, 10 May 2022 17:19:16 +0000 (13:19 -0400)]
[OpenMP] Fix embedding offload code when there is no offloading toolchain
Summary:
We use the `--offload-new-driver` option to enable offload code
embedding. The check for when to do this was flawed and was enabling it
too early in the case of OpenMP, causing a segfault when dereferencing
the offloading toolchain.
Jan Korous [Sat, 23 Apr 2022 02:01:50 +0000 (19:01 -0700)]
[utils] Avoid hardcoding metadata ids in update_cc_test_checks
Specifically for: !tbaa, !tbaa.struct, !annotation, !srcloc, !nosanitize.
The goal is to avoid test brittleness caused by hardcoded values.
Differential Revision: https://reviews.llvm.org/D123273
Matthias Braun [Wed, 27 Apr 2022 01:27:21 +0000 (18:27 -0700)]
CodeGenPrepare: Replace constant PHI arguments with switch condition value
We often see code like the following after running SCCP:
switch (x) { case 42: phi(42, ...); }
This tends to produce bad code as we currently materialize the constant
phi-argument in the switch-block. This increases register pressure and
if the pattern repeats for `n` case statements, we end up generating `n`
constant values.
This changes CodeGenPrepare to catch this pattern and revert it back to:
switch (x) { case 42: phi(x, ...); }
Differential Revision: https://reviews.llvm.org/D124552
Matthias Braun [Tue, 3 May 2022 17:53:34 +0000 (10:53 -0700)]
Avoid 8 and 16bit switch conditions on x86
This adds a `TargetLoweringBase::getSwitchConditionType` callback to
give targets a chance to control the type used in
`CodeGenPrepare::optimizeSwitchInst`.
Implement callback for X86 to avoid i8 and i16 types where possible as
they often incur extra zero-extensions.
This is NFC for non-X86 targets.
Differential Revision: https://reviews.llvm.org/D124894
Matthias Braun [Tue, 3 May 2022 22:01:39 +0000 (15:01 -0700)]
Use update_llc_test_checks for the switch.ll test; add new test
- Change `switch.ll` test to a style suitable for
`tools/update_llc_test_checks.py`.
- Precommit test for upcoming changes:
- Add `switch_i8` to `test/CodeGen/X86/switch.ll`.
- Add `test/CodeGen/X86/switch-phi-const.ll`.
Differential Revision: https://reviews.llvm.org/D124893
Kadir Cetinkaya [Mon, 9 May 2022 09:25:29 +0000 (11:25 +0200)]
[clangd] Support for standard inlayHint protocol
- Make clangd's internal representation more aligned with the standard.
We keep range and extra inlayhint kinds around, but don't serialize
them on standard version.
- Have custom serialization for extension (ugly, but going to go away).
- Support both versions until clangd-17.
- Don't advertise extension if client has support for standard
implementation.
- Log a warning at startup about extension being deprecated, if client
doesn't have support.
Differential Revision: https://reviews.llvm.org/D125228
Mike Rice [Mon, 9 May 2022 18:41:38 +0000 (11:41 -0700)]
[OpenMP] Add mangling support for linear modifiers (ref,uval,val)
Add mangling for linear parameters specified with ref, uval, and val
for 'omp declare simd' vector functions.
Add missing stride for linear this parameters.
Differential Revision: https://reviews.llvm.org/D125269
Tsukasa OI [Tue, 10 May 2022 16:25:43 +0000 (00:25 +0800)]
[RISCV] 'K'-extension ordering
This commit adds 'K' to supported extension list (before 'J').
It makes "Zk*" extensions correctly placed before "Zv*" extensions.
Multi-letter "Z*" extensions are first ordered with the most closely
related alphabetical extension category ("IMAF..."). This is represented
in LLVM as `AllStdExts' variable in `llvm/lib/Support/RISCVISAInfo.cpp'.
However, it did not have 'k' making "Zk*" extensions not correctly ordered.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D124340
Krzysztof Drewniak [Tue, 10 May 2022 15:37:53 +0000 (15:37 +0000)]
[mlir][AMDGPU] Add AMDGPU conversion patterns to ConvertGPUToROCDL
This ensures that attributes such as the index bitwidth propagate
correctly to the AMDGPUToROCDL patterns.
Differential Revision: https://reviews.llvm.org/D125320
Konstantin Varlamov [Tue, 10 May 2022 16:29:39 +0000 (09:29 -0700)]
[libc++][ranges] Implement `views::drop`.
The view itself has been implemented previously -- this patch only adds
the ability to pipe it.
Also finishes the implementation of [P1739](https://wg21.link/p1739) and
[LWG3407](https://wg21.link/lwg3407).
Differential Revision: https://reviews.llvm.org/D125156
David Green [Tue, 10 May 2022 16:17:03 +0000 (17:17 +0100)]
Revert "[AArch64] Generate AND in place of CSEL for predicated CTTZ"
This reverts commit
7dcd0ea683ed3175bc3ec6aed24901a9d504182e due to
issues reported postcommit with the correctness of truncated cttzs.
Craig Topper [Tue, 10 May 2022 15:56:31 +0000 (08:56 -0700)]
[CVP] Preserve exact name when converting sext->zext and ashr->lshr.
Previously we took the old name and always appended a numberic suffix.
Since we're doing a 1:1 replacement, it's clearer to keep the original
name exactly.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D125281
Craig Topper [Tue, 10 May 2022 15:56:23 +0000 (08:56 -0700)]
[SCCP] Preserve Name when converting SExt->ZExt.
This makes the output IR more readable since we're doing a one to
one replacement.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D125280
Peter Klausler [Fri, 29 Apr 2022 20:23:26 +0000 (13:23 -0700)]
[flang] Enforce limit on rank + corank
Fortran 2018 requires that a compiler allow objects whose rank + corank
is 15, and that's our maximum; detect and diagnose violations.
Differential Revision: https://reviews.llvm.org/D125153
Nikita Popov [Tue, 10 May 2022 15:43:27 +0000 (17:43 +0200)]
[InstCombine] Add additional freeze tests (NFC)
Ivan Kosarev [Tue, 10 May 2022 14:54:40 +0000 (15:54 +0100)]
[AMDGPU][GFX10] Support base+soffset+offset SMEM loads.
Also makes a step towards resolving
https://github.com/llvm/llvm-project/issues/38652
Reviewed By: foad, dp
Differential Revision: https://reviews.llvm.org/D125117
Aaron Ballman [Tue, 10 May 2022 15:14:24 +0000 (11:14 -0400)]
Diagnose unreachable generic selection associations
The controlling expression of a _Generic selection expression undergoes
lvalue conversion, array conversion, and function conversion before
picking the association. This means that array types, function types,
and qualified types are all unreachable code if they're used as an
association. I've been caught by this twice in the past few months and
I figure that if a WG14 member can't seem to remember this rule, users
are also likely to struggle with it. So this adds an on-by-default
unreachable code diagnostic for generic selection expression
associations.
Note, we don't have to worry about function types as those are already
a constraint violation which generates an error.
Differential Revision: https://reviews.llvm.org/D125259
Peter Klausler [Thu, 5 May 2022 15:15:20 +0000 (08:15 -0700)]
[flang] Fold real-valued MODULO() and MOD()
Evaluate real-valued references to the intrinsic functions MODULO
and MOD at compilation time without recourse to an external math
library.
Differential Revision: https://reviews.llvm.org/D125151
Louis Dionne [Tue, 10 May 2022 15:14:59 +0000 (11:14 -0400)]
[libc++abi][NFC] Fix typo in comment
Ashay Rane [Mon, 9 May 2022 18:22:43 +0000 (11:22 -0700)]
[mlir] Fail early if AnalysisState::getBuffer() returns failure
This patch updates calls to AnalysisState::getBuffer() so that we return
early with a failure if the call does not succeed.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D125251
Daniel Bertalan [Tue, 10 May 2022 14:52:52 +0000 (15:52 +0100)]
[CodeGen] Use ABI alignment for C++ new expressions
In case of placement new, if we do not know the alignment of the
operand, we can't assume it has the preferred alignment. It might be
e.g. a pointer to a struct member which follows ABI alignment rules.
This makes UBSAN no longer report "constructor call on misaligned
address" when constructing a double into a struct field of type double
on i686. The psABI specifies an alignment of 4 bytes, but the preferred
alignment used by Clang is 8 bytes.
We now use ABI alignment for allocating new as well, as the preferred
alignment should be used for over-aligning e.g. local variables, which
isn't relevant for ABI code dealing with operator new. AFAICT there
wouldn't be problems either way though.
Fixes #54845.
Differential Revision: https://reviews.llvm.org/D124736
Krzysztof Drewniak [Wed, 30 Mar 2022 21:56:19 +0000 (21:56 +0000)]
[MLIR][AMDGPU] Add AMDGPU dialect, wrappers around raw buffer intrinsics
By analogy with the NVGPU dialect, introduce an AMDGPU dialect for
AMD-specific intrinsic wrappers.
The dialect initially includes wrappers around the raw buffer intrinsics.
On AMD GPUs, a memref can be converted to a "buffer descriptor" that
allows more precise control of memory access, such as by allowing for
out of bounds loads/stores to be replaced by 0/ignored without adding
additional conditional logic, which is important for performance.
The repository currently contains a limited conversion from
transfer_read/transfer_write to Mubuf intrinsics, which are an older,
deprecated intrinsic for the same functionality.
The new amdgpu.raw_buffer_* ops allow these operations to be used
explicitly and for including metadata such as whether the target
chipset is an RDNA chip or not (which impacts the interpretation of
some bits in the buffer descriptor), while still maintaining an
MLIR-like interface.
(This change also exposes the floating-point atomic add intrinsic.)
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D122765
Sam McCall [Sat, 7 May 2022 00:15:41 +0000 (02:15 +0200)]
[Frontend] Flip default of CreateInvocationOptions::ProbePrecompiled to false
This is generally a better default for tools other than the compiler, which
shouldn't assume a PCH file on disk is something they can consume.
Preserve the old behavior in places associated with libclang/c-index-test
(including ASTUnit) as there are tests relying on it and most important
consumers are out-of-tree. It's unclear whether the tests are specifically
trying to test this functionality, and what the downstream implications of
removing it are. Hopefully someone more familiar can clean this up in future.
Differential Revision: https://reviews.llvm.org/D125149
Peter Klausler [Wed, 4 May 2022 23:35:31 +0000 (16:35 -0700)]
[flang] Fold real-valued DIM()
Fold references to the intrinsic function DIM with constant real
arguments. And clean up folding of comparisons with NaNs to address
a problem noticed in testing -- NaNs should successfully compare
unequal to all values, including themselves, instead of failing all
comparisons.
Differential Revision: https://reviews.llvm.org/D125146
Chris Lattner [Tue, 10 May 2022 09:22:25 +0000 (10:22 +0100)]
[MLIR Parser] Improve QoI for "expected token" errors
A typical problem with missing a token is that the missing
token is at the end of a line. The problem with this is that
the error message gets reported on the start of the following
line (which is where the next / invalid token is) which can
be confusing.
Handle this by noticing this case and backing up to the end of
the previous line.
Differential Revision: https://reviews.llvm.org/D125295
Amy Kwan [Mon, 9 May 2022 15:51:08 +0000 (10:51 -0500)]
[NFC][PowerPC] Add 32-bit AIX RUN lines to test cases.
This patch adds 32-bit AIX RUN lines to several test cases, along with the
addition of one new test case, to prepare for future codegen changes involving
the PPCISD::SCALAR_TO_VECTOR_PERMUTED node on 32-bit mode.
Nicolai Hähnle [Wed, 13 Apr 2022 02:10:04 +0000 (21:10 -0500)]
AMDGPU/SDAG: Refine the fold to v_mad_[iu]64_[iu]32
Only fold for uniform values on pre-GFX9 chips. GFX9+ allow us
to keep the calculation entirely on the SALU.
For subtargets where integer multiplication isn't full-rate, avoid
folding if the multiply has too many uses.
Finally, we expand 64x32 and 64x64 multiplies here as well, if they
feed into an addition. This results in better code generation than
the generic expansion for such multiplies because we end up using
the accumulator of the MAD instructions.
Differential Revision: https://reviews.llvm.org/D123835
Dawid Jurczak [Sat, 7 May 2022 09:34:45 +0000 (11:34 +0200)]
[GVNSink] Make GVNSink resistant against self referencing instructions (PR36954)
Before this change GVNSink pass suffers from stack overflow while processing self referenced instruction in unreachable basic block.
According [1] and [2] it's reasonable to make pass resistant against self referencing instructions.
To fix issue we skip sinking analysis when we reach instruction coming from unreachable block.
[1] https://groups.google.com/g/llvm-dev/c/843Tig9IzwA
[2] https://lists.llvm.org/pipermail/llvm-dev/2015-February/082629.html
Differential Revision: https://reviews.llvm.org/D113897
Louis Dionne [Mon, 9 May 2022 17:31:42 +0000 (13:31 -0400)]
[libc++abi] Reword uncaught exception termination message
When we terminate due to an exception being uncaught, libc++abi prints
a message saying "terminating with uncaught exception [...]". This patch
changes that to say "terminating due to uncaught exception [...]" instead,
which is a bit clearer. Indeed, I've seen some people being confused and
thinking that libc++abi was the component throwing the exception.
Differential Revision: https://reviews.llvm.org/D125245
Nikita Popov [Tue, 10 May 2022 13:10:28 +0000 (15:10 +0200)]
[SCEVExpander] Remove handling for mixed int/pointer min/max (NFCI)
Mixed int/pointer min/max are no longer possible.
Alexey Bataev [Tue, 10 May 2022 12:51:14 +0000 (05:51 -0700)]
[SLP][NFC]Add a test for improved shuffles in buildvector sequences,
NFC.
Nikita Popov [Tue, 10 May 2022 12:50:50 +0000 (14:50 +0200)]
[IndVarSimplify] Regenerate test checks (NFC)
Nicolai Hähnle [Thu, 28 Apr 2022 21:27:57 +0000 (16:27 -0500)]
GlobalISel: Trivial documentation and comment fixes
Differential Revision: https://reviews.llvm.org/D124808
Rosie Sumpter [Tue, 3 May 2022 09:58:09 +0000 (10:58 +0100)]
[Sema][SVE2] Move/simplify Sema testing for SVE2 ACLE builtins
Currently for SVE2 ACLE builtins, single tests are used to verify both
clang code generation (when the feature is available) and semantic
error/warning messages (when the feature is unavailable). This
patch moves the semantic testing for the target feature flag into
dedicated Sema tests.
Differential Revision: https://reviews.llvm.org/D124850
Rosie Sumpter [Tue, 3 May 2022 09:39:41 +0000 (10:39 +0100)]
[Sema][SVE] Move/simplify Sema testing for SVE ACLE builtins
Currently for SVE ACLE builtins, single tests are used to verify both
clang code generation (when the feature is available) and semantic
error/warning messages (when the feature is unavailable). This
patch moves the semantic testing into dedicated Sema tests.
Differential Revision: https://reviews.llvm.org/D124924
Haojian Wu [Sun, 8 May 2022 20:14:27 +0000 (22:14 +0200)]
[pseudo] Add benchmarks for pseudoparser.
Running on SemaDecl.cpp with the cxx.bnf grammar:
```
--------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------
runParseBNFGrammar 649389 ns 649365 ns 1013
runBuildLR
34591903 ns
34591380 ns 20
runPreprocessTokens
11418744 ns
11418703 ns 61 bytes_per_second=63.8971M/s
runGLRParse
282996863 ns
282988726 ns 2 bytes_per_second=2.57827M/s
runParseOverall
294969719 ns
294951870 ns 2 bytes_per_second=2.4737M/s
```
Differential Revision: https://reviews.llvm.org/D125226
Adrian Kuegel [Tue, 10 May 2022 10:58:01 +0000 (12:58 +0200)]
[mlir] Remove unused using declaration (NFC)
Fraser Cormack [Tue, 10 May 2022 09:54:12 +0000 (10:54 +0100)]
[RISCV][NFC] Remove else after continue
Nikita Popov [Tue, 10 May 2022 10:17:09 +0000 (12:17 +0200)]
[LoopVectorize] Remove incorrect nuw flag from test (NFC)
nuw does not make sense for reverse iteration.
Nikita Popov [Tue, 10 May 2022 09:46:22 +0000 (11:46 +0200)]
[InstSimplify] Handle unknown function context in pointer icmp fold (PR54615)
This issue reproduces in the context of LoopDeletion, because the
bitcast does not get simplified away there. For a plain -inst-simplify
run the bitcast would get folded away first.
Fixes https://github.com/llvm/llvm-project/issues/54615.
Chuanqi Xu [Tue, 10 May 2022 09:24:24 +0000 (17:24 +0800)]
[NFC] [Coroutines] Remove EnableReuseStorageInFrame option
The EnableReuseStorageInFrame option is designed for testing only.
But it is better to use *_PASS_WITH_PARAMS macro to keep consistent with
other passes.
Nikita Popov [Tue, 10 May 2022 09:24:02 +0000 (11:24 +0200)]
[InstCombine] Handle GEP scalar/vector base mismatch (PR55363)
30a12f3f6322399185fdceffe176152a58bb84ae switched the type check
to use the GEP result type rather than the GEP operand type.
However, the GEP result types may match even if the operand types
don't, in case GEPs with scalar/vector base and vector index
are compared.
Fixes https://github.com/llvm/llvm-project/issues/55363.
Lian Wang [Tue, 10 May 2022 09:20:56 +0000 (09:20 +0000)]
Revert "[RISCV][SelectionDAG] Support VECREDUCE_ADD mask operation"
This patch make CodeGen/test/AArch64/vecreduce-add-legalization.ll fail.
This reverts commit
17a8a1bb7126a7c1b0bc629d9299f2e5ae6db3f1.
Gabor Marton [Tue, 10 May 2022 09:17:59 +0000 (11:17 +0200)]
[analyzer] Attempt to fix test infeasible-crash.c
Lian Wang [Mon, 9 May 2022 06:18:34 +0000 (06:18 +0000)]
[RISCV][SelectionDAG] Support VECREDUCE_ADD mask operation
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D125206
Lian Wang [Tue, 10 May 2022 08:07:46 +0000 (08:07 +0000)]
[RISCV] Add more tests for vector reduce mask operations
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D125216
Nikita Popov [Fri, 22 Apr 2022 08:19:54 +0000 (10:19 +0200)]
[fuzzer] Reduce size of large.test
This halves the size of LargeTest, dropping time to compile this
file locally from 14s to 5.5s. Hopefully this will also fix the
persistent timeouts in pre-merge checks.
Differential Revision: https://reviews.llvm.org/D124237
Nikita Popov [Mon, 9 May 2022 14:47:27 +0000 (16:47 +0200)]
[MLIR] Split off MLIRExecutionEngineUtils to fix libMLIR.so build (PR54242)
Building libMLIR.so currently fails with:
> /usr/bin/ld: /tmp/ccNzulEA.ltrans39.ltrans.o: in function `(anonymous namespace)::SerializeToHsacoPass::optimizeLlvm(llvm::Module&, llvm::TargetMachine&)':
> /builddir/build/BUILD/llvm-project-15.0.0.src/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp:328: undefined reference to `mlir::makeOptimizingTransformer(unsigned int, unsigned int, llvm::TargetMachine*)'
This is because MLIRGPUTransforms depends on MLIRExecutionEngine in
https://github.com/llvm/llvm-project/blob/
61bb2e4ea82fc5499a271d70d4537383d1942208/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp#L328,
but MLIRExecutionEngine is marked as excluded from libMLIR.so.
However, this code doesn't require the full execution engine: It
only performs middle-end optimization, and does not need any of
the JIT/codegen infrastructure. As such, split off a separate
library MLIRExecutionEngineUtils, which only contains that part
and is not excluded from libMLIR.so.
Fixes https://github.com/llvm/llvm-project/issues/54242.
Differential Revision: https://reviews.llvm.org/D125214
Gabor Marton [Mon, 2 May 2022 11:32:28 +0000 (13:32 +0200)]
[analyzer] Replace adjacent assumeInBound calls to assumeInBoundDual
This is to minimize superfluous assume calls.
Depends on D124758
Differential Revision: https://reviews.llvm.org/D124761
Gabor Marton [Fri, 6 May 2022 14:20:25 +0000 (16:20 +0200)]
[analyzer] Implement assume in terms of assumeDual
Summary:
By evaluating both children states, now we are capable of discovering
infeasible parent states. In this patch, `assume` is implemented in the terms
of `assumeDuali`. This might be suboptimal (e.g. where there are adjacent
assume(true) and assume(false) calls, next patches addresses that). This patch
fixes a real CRASH.
Fixes https://github.com/llvm/llvm-project/issues/54272
Differential Revision:
https://reviews.llvm.org/D124758
Gabor Marton [Tue, 3 May 2022 10:11:49 +0000 (12:11 +0200)]
[analyzer] Indicate if a parent state is infeasible
In some cases a parent State is already infeasible, but we recognize
this only if an additonal constraint is added. This patch is the first
of a series to address this issue. In this patch `assumeDual` is changed
to clone the parent State but with an `Infeasible` flag set, and this
infeasible-parent is returned both for the true and false case. Then
when we add a new transition in the exploded graph and the destination
is marked as infeasible, the node will be a sink node.
Related bug:
https://github.com/llvm/llvm-project/issues/50883
Actually, this patch does not solve that bug in the solver, rather with
this patch we can handle the general parent-infeasible cases.
Next step would be to change the State API and require all checkers to
use the `assume*Dual` API and deprecate the simple `assume` calls.
Hopefully, the next patch will introduce `assumeInBoundDual` and will
solve the CRASH we have here:
https://github.com/llvm/llvm-project/issues/54272
Differential Revision: https://reviews.llvm.org/D124674
Nikita Popov [Tue, 10 May 2022 08:01:24 +0000 (10:01 +0200)]
[Docs] Clarify CLANG_ENABLE_OPAQUE_POINTERS behavior (NFC)
While it originally did, this option no longer affects the cc1
interface. For the cc1 interface, -no-opaque-pointers has to be
passed, there is no cmake option.
Martin Storsjö [Tue, 10 May 2022 07:22:39 +0000 (10:22 +0300)]
[libcxxabi] [cmake] Fix a mismatched variable name
The variable name checked didn't match the one set on the line above.
This error was introduced in
b3df14b6c98702ce50401fd039852787373e4676.
Max Kazantsev [Tue, 10 May 2022 06:21:10 +0000 (13:21 +0700)]
Return "[Test] One more test to prevent crash in SLP vectorizer"
Looks like this test exposes some non-determinism and fails with
auth-generated checks. Recommited with sole check it didn't crash.
Will investigate why it happens.
Max Kazantsev [Tue, 10 May 2022 06:20:57 +0000 (13:20 +0700)]
Revert "[Test] One more test to prevent crash in SLP vectorizer"
This reverts commit
1daf35f47cb13ae3c257873203a52f7c48856eef.
Max Kazantsev [Tue, 10 May 2022 06:09:17 +0000 (13:09 +0700)]
[Test] One more test to prevent crash in SLP vectorizer
Make sure "[SLP]Further improvement of the cost model for scalars used in buildvectors."
does not come back until it's fixed.
Walter Erquinigo [Tue, 10 May 2022 05:46:34 +0000 (22:46 -0700)]
Revert "[NFC][lldb][trace] Use uint64_t when decoding and enconding json"
This reverts commit
9d2dd6d7622335ba9c19b55ac7d463cf662cab0d.
Reverting because this exposes an issue in the uint64_t json parser.
Chuanqi Xu [Tue, 10 May 2022 03:48:30 +0000 (11:48 +0800)]
[Coroutines] Use PassManager instead of Legacy PassManager internally
This is a following cleanup for the previous work D123918. I missed
serveral places which still use legacy pass managers. This patch tries
to remove them.
Shraiysh Vaishay [Tue, 10 May 2022 04:46:06 +0000 (10:16 +0530)]
[flang][OpenMP] Lowering for task construct
This patch adds lowering for task construct from Fortran to
`omp.task` operation in OpenMPDialect Dialect (mlir). Also added tests
for the same.
Reviewed By: kiranchandramohan, peixin
Differential Revision: https://reviews.llvm.org/D124138
Walter Erquinigo [Tue, 10 May 2022 04:44:09 +0000 (21:44 -0700)]
[NFC][lldb][trace] Use uint64_t when decoding and enconding json
llvm's json parser supports uint64_t, so let's better use it for the
packets being sent between lldb and lldb-server instead of using int64_t
as an intermediate type, which might be error-prone.
Craig Topper [Tue, 10 May 2022 04:37:23 +0000 (21:37 -0700)]
[IR][CostModel] A scalable vector shuffle can't be an identity or reverse shuffle.
Even if the minimum number of elements is 1 and the length doesn't change,
we don't know what vscale is so we can't classify it as identity mask. Instead it
is a zero element splat.
For reverse, we shouldn't classify it as a reverse unless there are at least 2 elements
in the mask. This applies to both fixed and scalable vectors. For fixed vectors, a single
element would be an identity shuffle. For scalable vector it's a zero elt splat.
Reviewed By: sdesmalen, liaolucy
Differential Revision: https://reviews.llvm.org/D124655
Walter Erquinigo [Tue, 10 May 2022 04:27:23 +0000 (21:27 -0700)]
[lldb] Fix
7b73de9ec2b19df040c919d3004dfbead9b6ac59
It turns out that the issue in
https://lab.llvm.org/buildbot/#/builders/17/builds/21754 is that a
size_t is attempted to be used interchangeably with uint64_t.
Greg McGary [Tue, 10 May 2022 03:41:08 +0000 (20:41 -0700)]
[ELF] Move InputSectionBase::rawData member [NFC]
Walter Erquinigo [Tue, 10 May 2022 04:12:09 +0000 (21:12 -0700)]
[lldb] Fix
7b73de9ec2b19df040c919d3004dfbead9b6ac59
It turns out that the issue in
https://lab.llvm.org/buildbot/#/builders/17/builds/21754 is that a
size_t is attempted to be used interchangeably with uint64_t.
Walter Erquinigo [Tue, 10 May 2022 04:01:05 +0000 (21:01 -0700)]
[lldb] Fix
7b73de9ec2b19df040c919d3004dfbead9b6ac59
This commit causes
https://lab.llvm.org/buildbot/#/builders/17/builds/21743 to fail
seemingly because of bad handling of the PERF_ATTR_SIZE_VER5 symbol.
This patch tries to handle better the absence of this symbol.
Andrew Litteken [Sun, 1 May 2022 23:06:21 +0000 (18:06 -0500)]
[IRSim] Remove early check from similarity matching such that commutative instructions are checked correctly when using the same value.
When the first commutative instruction in a region using the same value in both positions was compared to a corresponding instruction with two different values, there was an early check that determined that since the values were new, it was true that these values acted in the same way structurally. If this was not contradicted later in the program, the regions were marked as similar. This removes that check, so that it is clear that the same value cannot be mapped to two different values.
Reviewer: paquette
Differential Revision: https://reviews.llvm.org/D124775
Stella Stamenova [Tue, 10 May 2022 02:46:47 +0000 (19:46 -0700)]
[mlir] Fix python bindings build on Windows in Debug
Currently, building mlir with the python bindings enabled on Windows in Debug is broken because pybind11, python and cmake don't like to play together. This change normalizes how the three interact, so that the builds can now run and succeed.
The main issue is that python and cmake both make assumptions about which libraries are needed in a Windows build based on the flavor.
- cmake assumes that a debug (or a debug-like) flavor of the build will always require pythonX_d.lib and provides no option/hint to tell it to use a different library. cmake does find both the debug and release versions, but then uses the debug library.
- python (specifically pyconfig.h and by extension python.h) hardcodes the dependency on pythonX_d.lib or pythonX.lib depending on whether `_DEBUG` is defined. This is NOT transparent - it does not show up anywhere in the build logs until the link step fails with `pythonX_d.lib is missing` (or `pythonX.lib is missing`)
- pybind11 tries to "fix" this by implementing a workaround - unless Py_DEBUG is defined, `_DEBUG` is explicitly undefined right before including python headers. This also requires some windows headers to be included differently, so while clever, this is a non-trivial workaround.
mlir itself includes the pybind11 headers (which contain the workaround) AS WELL AS python.h, essentially always requiring both pythonX.lib and pythonX_d.lib for linking. cmake explicitly only adds one or the other, so the build fails.
This change does a couple of things:
- In the cmake files, explicitly add the release version of the python library on Windows builds regardless of flavor. Since Py_DEBUG is not defined, pybind11 will always require release and it will be satisfied
- To satisfy python as well, this change removes any explicit inclusions of Python.h on Windows instead relying on the fact that pybind11 headers will bring in what is needed
There are a few additional things that we could do but I rejected as unnecessary at this time:
- define Py_DEBUG based on the CMAKE_BUILD_TYPE - this will *mostly* work, we'd have to think through multiconfig generators like VS, but it's possible. There doesn't seem to be a need to link against debug python at the moment, so I chose not to overcomplicate the build and always default to release
- similar to above, but define Py_DEBUG based on the CMAKE_BUILD_TYPE *as well as* the presence of the debug python library (`Python3_LIBRARY_DEBUG`). Similar to above, this seems unnecessary right now. I think it's slightly better than above because most people don't actually have the debug version of python installed, so this would prevent breaks in that case.
- similar to the two above, but add a cmake variable to control the logic
- implement the pybind11 workaround directly in mlir (specifically in Interop.h) so that Python.h can still be included directly. This seems prone to error and a pain to maintain in lock step with pybind11
- reorganize how the pybind11 headers are included and place at least one of them in Interop.h directly, so that the header has all of its dependencies included as was the original intention. I decided against this because it really doesn't need pybind11 logic and it's always included after pybind11 is, so we don't necessarily need the python includes
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D125284
Sheng [Tue, 10 May 2022 02:30:39 +0000 (10:30 +0800)]
[NFC] Modify the comment to reflect the changes in decoder
Ben Shi [Tue, 10 May 2022 02:16:45 +0000 (02:16 +0000)]
[clang][Driver] Add more tests for riscv
Reviewed By: benshi001
Differential Revision: https://reviews.llvm.org/D125157
Ben Shi [Tue, 10 May 2022 02:15:13 +0000 (02:15 +0000)]
[RISCV][NFC] Add 'rv32izvfh' invalid arch test
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D125210
Peter Klausler [Wed, 4 May 2022 19:50:03 +0000 (12:50 -0700)]
[flang] Allow ENTRY function result symbol usage before the ENTRY
In a function, ENTRY E without an explicit RESULT() creates a
function result entity also named E that is storage associated with
the enclosing function's result. f18 was emitting an incorrect error
message if that function result E was referenced without any
declaration prior to its ENTRY statement when it should have been
implicitly declared instead.
Differential Revision: https://reviews.llvm.org/D125144
Chuanqi Xu [Tue, 10 May 2022 02:00:35 +0000 (10:00 +0800)]
[NFC] follow up code cleanup after D123837
Reviewed By: iains
Differential Revision: https://reviews.llvm.org/D124149
Peter Klausler [Wed, 4 May 2022 21:10:18 +0000 (14:10 -0700)]
[flang] Accept POINTER followed by INTERFACE
As is already supported for dummy procedures, we need to also accept
declarations of procedure pointers that consist of a POINTER attribute
statement followed by an INTERFACE block. (The case of an INTERFACE
block followed by a POINTER statement already works.)
While cleaning this case up, adjust the utility predicate IsProcedurePointer()
to recognize it (namely a SubprogramDetails symbol with Attr::POINTER)
and delete IsProcName(). Extend tests, and add better comments to
symbol.h to document the two ways in which procedure pointers are
represented.
Differential Revision: https://reviews.llvm.org/D125139
LLVM GN Syncbot [Tue, 10 May 2022 01:06:44 +0000 (01:06 +0000)]
[gn build] Port
059e03476cbb
Douglas Yung [Tue, 10 May 2022 01:00:53 +0000 (18:00 -0700)]
Add x86 to REQUIRES line in test as suggested in https://reviews.llvm.org/D124105.
Mircea Trofin [Wed, 27 Apr 2022 21:19:14 +0000 (14:19 -0700)]
[mlgo] Support exposing more features than those supported by models
This allows the compiler to support more features than those supported by a
model. The only requirement (development mode only) is that the new
features must be appended at the end of the list of features requested
from the model. The support is transparent to compiler code: for
unsupported features, we provide a valid buffer to copy their values;
it's just that this buffer is disconnected from the model, so insofar
as the model is concerned (AOT or development mode), these features don't
exist. The buffers are allocated at setup - meaning, at steady state,
there is no extra allocation (maintaining the current invariant). These
buffers has 2 roles: one, keep the compiler code simple. Second, allow
logging their values in development mode. The latter allows retraining
a model supporting the larger feature set starting from traces produced
with the old model.
For release mode (AOT-ed models), this decouples compiler evolution from
model evolution, which we want in scenarios where the toolchain is
frequently rebuilt and redeployed: we can first deploy the new features,
and continue working with the older model, until a new model is made
available, which can then be picked up the next time the compiler is built.
Differential Revision: https://reviews.llvm.org/D124565
Peter Klausler [Tue, 3 May 2022 20:57:14 +0000 (13:57 -0700)]
[flang] Reverse a reversed type compatibility check
The semantic test for an intrinsic assignment to a polymorphic
derived type entity from a type that is an extension of its base
type was reversed, so it would allow assignments that it shouldn't
and disallowed some that it should; and the test case for it
incorectly assumed that the invalid semantics were correct.
Fix the code and the test, and add a new test for the invalid
case (LHS type is an extension of the RHS type).
Differential Revision: https://reviews.llvm.org/D125135
Peter Klausler [Tue, 3 May 2022 20:17:50 +0000 (13:17 -0700)]
[flang] Refine error checking in specification expressions
The rules in the Fortran standard for specification expressions
are full of special cases and exceptions, and semantics didn't get
them exactly right. It is valid to refer to an INTENT(OUT) dummy
argument in a specification expression in the context of a
specification inquiry function like SIZE(); it is not valid to
reference an OPTIONAL dummy argument outside of the context of
PRESENT. This patch makes the specification expression checker
a little context-sensitive about whether it's examining an actual
argument of a specification inquiry intrinsic function or not.
Differential Revision: https://reviews.llvm.org/D125131
Peter Klausler [Tue, 3 May 2022 18:24:10 +0000 (11:24 -0700)]
[flang] Allow implicit declaration of DATA objects in inner procedures
DATA statements in inner procedures were not treating undeclared objects
as implicitly declared variables if the DATA statement appeared in a
specification part; they were treated as host-associated symbols instead.
This was incorrect. Fix DATA statement name resolution to always treat
DATA as if it had appeared in the executable part.
Differential Revision: https://reviews.llvm.org/D125129
Carl Ritson [Tue, 10 May 2022 00:02:36 +0000 (09:02 +0900)]
[AMDGPU] Pre-commit test for D124981. NFC.
Carl Ritson [Mon, 9 May 2022 23:52:31 +0000 (08:52 +0900)]
[AMDGPU] Generate checks in llvm.amdgcn.softwqm.ll
Peter Klausler [Tue, 3 May 2022 17:10:11 +0000 (10:10 -0700)]
[flang] Allow NULL() actual argument for optional dummy procedure
A disassociated procedure pointer is allowed to be passed as an absent
actual argument that corresponds to an optional dummy procedure,
but not NULL(); accept that case as well.
Differential Revision: https://reviews.llvm.org/D125127