Vince Bridgers [Tue, 28 Sep 2021 13:42:31 +0000 (08:42 -0500)]
[analyzer] canonicalize special case of structure/pointer deref
This simple change addresses a special case of structure/pointer
aliasing that produced different symbolvals, leading to false positives
during analysis.
The reproducer is as simple as this.
```lang=C++
struct s {
int v;
};
void foo(struct s *ps) {
struct s ss = *ps;
clang_analyzer_dump(ss.v); // reg_$1<int Element{SymRegion{reg_$0<struct s *ps>},0 S64b,struct s}.v>
clang_analyzer_dump(ps->v); //reg_$3<int SymRegion{reg_$0<struct s *ps>}.v>
clang_analyzer_eval(ss.v == ps->v); // UNKNOWN
}
```
Acks: Many thanks to @steakhal and @martong for the group debug session.
Reviewed By: steakhal, martong
Differential Revision: https://reviews.llvm.org/D110625
Nathan Sidwell [Thu, 16 Sep 2021 19:29:37 +0000 (12:29 -0700)]
[X86][NFC] structure-return simplificiation
The X86 backend only needs to know whether structure return is via an
sret pointer. This removes the categorization enumeration and
adjusts, templatizes and renames the related functions.
Differential Revision: https://reviews.llvm.org/D109966
Nicolas Vasilache [Wed, 6 Oct 2021 10:00:50 +0000 (10:00 +0000)]
[mlir][Linalg] Don't return early from inPlaceAnalysis
Instead just emit a warning that analysis failed and the result will be treated conservatively.
Differential Revision: https://reviews.llvm.org/D111217
David Green [Wed, 6 Oct 2021 09:38:22 +0000 (10:38 +0100)]
[AArch64] Regenerate some more tests
This updates the check lines in some extra tests, to make them more
maintainable going forward.
Simon Pilgrim [Tue, 5 Oct 2021 21:12:37 +0000 (22:12 +0100)]
[CostModel][X86] getCmpSelInstrCost - treat BAD_PREDICATEs the same as the worst case cost predicates for ICMP/FCMP instructions
As suggested on D111024, we should treat getCmpSelInstrCost calls without a specific predicate as matching the worst case predicate cost.
These regressions will be addressed with a mixture of D111024 and fixing other specific getCmpSelInstrCost calls to have realistic predicates.
Jonas Paulsson [Wed, 6 Oct 2021 08:48:21 +0000 (10:48 +0200)]
[SystemZ] Temporarily revert memcmp and memcpy patches
Seem to cause test failures in compiler-rt.
Revert "[SystemZ] Implement memcmp of variable length with CLC."
This reverts commit
7a4e9a0c73667cb80e4572d41535a9e48f1ed9ef.
Revert "[SystemZ] Implement memcpy of variable length with MVC."
This reverts commit
c6c13c58eebda605a9a05f1f13cac1e46407afc7.
Muhammad Omair Javaid [Wed, 6 Oct 2021 08:56:44 +0000 (13:56 +0500)]
Round XML register bitsize to byte boundary
This patch allows LLDB to accept register sizes which are not aligned
to 8 bits bitsize boundary. This fixes a crash in LLDB when connecting
to OpenOCD stub. GDB xml description allows for non-aligned bit lengths
but they are rounded off to nearest byte during transfer. In case of
OpenOCD some of SOC specific system registers were less than a single
byte in length and were causing LLDB to crash.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D111131
David Spickett [Fri, 1 Oct 2021 13:12:01 +0000 (14:12 +0100)]
[compiler-rt][lsan] Add backup AArch64 register for use_registers test
On Ubuntu Focal x13 is used by something in the process of calling
sched_yield. Causing the test to fail depending on when the thread
is stopped.
Adding x14 works around this and the test passes consistently.
Not switching to only x14 because that could make other platforms
fail. With both we'll always find at least one and even if both
values are present we'll only get one report.
Reviewed By: oontvoo, vitalybuka
Differential Revision: https://reviews.llvm.org/D110931
LLVM GN Syncbot [Wed, 6 Oct 2021 08:40:14 +0000 (08:40 +0000)]
[gn build] Port
fc36fb4d23a5
David Spickett [Wed, 6 Oct 2021 08:31:58 +0000 (08:31 +0000)]
Revert "Second Recommit "[AArch64] Split bitmask immediate of bitwise AND operation""
This reverts commit
13f3c39f3658fa28cb008eb56a58d8e34697cd5d.
Due to test failures in stage 2 clang tests on AArch64 bots.
Kinuko Yasuda [Wed, 6 Oct 2021 08:29:52 +0000 (08:29 +0000)]
[docs] Fix typo and minor text changes in MyFirstTypoFix
Reviewed By: kuhnel
Differential Revision: https://reviews.llvm.org/D111211
David Green [Wed, 6 Oct 2021 08:30:48 +0000 (09:30 +0100)]
[AArch64] Regenerate some fast-isel tests
This updates the check lines in some fast isel test, to make them more
maintainable going forward.
David Sherwood [Tue, 28 Sep 2021 13:33:10 +0000 (14:33 +0100)]
[SVE] Fix incorrect DAG combines when extracting fixed-width from scalable vectors
We were previously silently generating incorrect code when extracting a
fixed-width vector from a scalable vector. This is worse than crashing,
since the user will have no indication that this is currently unsupported
behaviour. I have fixed the code to only perform DAG combines when safe
to do so, i.e. the input and output vectors are both fixed-width or
both scalable.
Test added here:
CodeGen/AArch64/sve-extract-scalable-vector.ll
Differential revision: https://reviews.llvm.org/D110624
Paulo Matos [Wed, 6 Oct 2021 08:08:04 +0000 (10:08 +0200)]
[WebAssembly] Fix call_indirect on funcrefs
The currently implementation of funcrefs is broken since it is putting
the funcref itself on the stack before the call_indirect. Instead what
should be on the stack is the constant 0, which is the index at which
we store the funcref in __funcref_call_table.
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D111152
Paulo Matos [Wed, 6 Oct 2021 07:28:36 +0000 (09:28 +0200)]
[WebAssembly] De-duplicate WasmAddressSpace and refactor reftype predicates
This is a non-functional change to remove the duplicate
WasmAddressSpace enum and refactor reftype predicates by moving them
to the Utilities source file.
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D111144
Albion Fung [Wed, 6 Oct 2021 07:42:17 +0000 (02:42 -0500)]
[PowerPC] Implement vector float and vector double version for vec_orc builtin
The builtin for vec_orc has support for the following two signatures,
but currently the compiler marks it ambiguous:
vector float vec_orc(vector float, vector float)
vector double vec_orc(vector double, vector double)
This patch implements these two builtins.
Differential revision: https://reviews.llvm.org/D110858
Markus Lavin [Wed, 6 Oct 2021 06:48:37 +0000 (08:48 +0200)]
[NPM] Automatic 'opt' pipeline reducer script.
Script for automatic 'opt' pipeline reduction for when using the new
pass-manager (NPM). Based around the '-print-pipeline-passes' option.
The reduction algorithm consists of several phases (steps).
Step #0: Verify that input fails with the given pipeline and make note of the
error code.
Step #1: Split pipeline in two starting from front and move forward as long as
first pipeline exits normally and the second pipeline fails with the expected
error code. Move on to step #2 with the IR from the split point and the
pipeline from the second invocation.
Step #2: Remove passes from end of the pipeline as long as the pipeline fails
with the expected error code.
Step #3: Make several sweeps over the remaining pipeline trying to remove one
pass at a time. Repeat sweeps until unable to remove any more passes.
Usage example:
./utils/reduce_pipeline.py --opt-binary=./build-all-Debug/bin/opt --input=input.ll --output=output.ll --passes=PIPELINE [EXTRA-OPT-ARGS ...]
Differential Revision: https://reviews.llvm.org/D110908
Tobias Gysi [Wed, 6 Oct 2021 06:45:42 +0000 (06:45 +0000)]
[mlir][linalg] Update OpDSL to use the newly introduced min and max ops.
Implement min and max using the newly introduced std operations instead of relying on compare and select.
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D111170
Dmitry Vyukov [Tue, 5 Oct 2021 14:54:14 +0000 (16:54 +0200)]
tsan: don't instrument runtime callbacks in tests
These runtime callbacks are supposed to be non-instrumented,
we can't handle runtime recursion well, nor can we afford
explicit recursion checks in the hot functions (memory access,
function entry/exit).
It used to work (not crash), but it won't work with the new runtime.
Mark all runtime callbacks as non-instrumented.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D111157
Amara Emerson [Wed, 6 Oct 2021 00:41:21 +0000 (17:41 -0700)]
[GlobalISel] Clear unreachable blocks' contents after selection.
If these blocks are unreachable, then we can discard all of the instructions.
However, keep the block around because it may have an address taken or the
block may have a stale reference from a PHI somewhere. Instead of finding
those PHIs and fixing them up, just leave the block empty.
Differential Revision: https://reviews.llvm.org/D111201
Arthur Eubanks [Wed, 6 Oct 2021 05:24:16 +0000 (22:24 -0700)]
Revert "[clang] Allow printing 64 bit ints in diagnostics"
This reverts commit
edfff2f8b0435bc4af94bd3b41bf57244d84d993.
Breaks clang-tidy.
Arthur Eubanks [Wed, 29 Sep 2021 22:26:26 +0000 (15:26 -0700)]
Mark PassBuilder::addPass() as minsize
PassBuilder.cpp is the slowest LLVM file to compile (if only building X86).
This makes PassBuilder.o a little faster to compile and a little smaller
as well.
These methods are not performance critical at all but are instantiated many times.
83M -> 72M instructions according to perf stat.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D110782
Arthur Eubanks [Tue, 5 Oct 2021 20:55:31 +0000 (13:55 -0700)]
[clang] Allow printing 64 bit ints in diagnostics
Currently we're limited to 32 bit ints in diagnostics.
With support for 4GB alignments coming soon, we need to report 4GB as the max alignment allowed.
I've tested that this does indeed properly print 2^32.
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D111184
David Carlier [Wed, 6 Oct 2021 05:01:50 +0000 (06:01 +0100)]
[Sanitizers] intercept md5 and sha* apis on FreeBSD.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D110989
Vitaly Buka [Wed, 29 Sep 2021 06:01:20 +0000 (23:01 -0700)]
[NFC][sanitizers] Add StackDepotBase Node::hash_type
Depends on D111177.
Differential Revision: https://reviews.llvm.org/D111182
Vitaly Buka [Wed, 29 Sep 2021 06:01:20 +0000 (23:01 -0700)]
[NFC][sanitizer] Add MurMur2Hash64Builder
Depends on D111176.
Differential Revision: https://reviews.llvm.org/D111177
Vitaly Buka [Tue, 5 Oct 2021 19:02:16 +0000 (12:02 -0700)]
[NFC][sanitizer] Add basic hash test
Differential Revision: https://reviews.llvm.org/D111176
Michael Forster [Wed, 6 Oct 2021 03:34:31 +0000 (05:34 +0200)]
(test commit) Fix capitalization in README.md
This commit primarily checks that my newly acquired commit access works.
But this is also a real spelling fix.
Lang Hames [Tue, 5 Oct 2021 17:50:31 +0000 (10:50 -0700)]
[JITLink][MachO][arm64] Make testcase less brittle.
The operand value is sign extended, so the test broke when sections were
re-ordered. The new test should be robust to reorderings.
Mehdi Amini [Wed, 6 Oct 2021 02:35:58 +0000 (02:35 +0000)]
Stop stripping the `std.` prefix when printing operations in a region with a defined default dialect
This fixes round-trip / ambiguity when an operation in the standard dialect would
have the same name as an operation in the default dialect.
Differential Revision: https://reviews.llvm.org/D111204
Philip Reames [Wed, 6 Oct 2021 01:54:50 +0000 (18:54 -0700)]
Address a rst format error caught by buildbot
Philip Reames [Wed, 6 Oct 2021 01:52:07 +0000 (18:52 -0700)]
[test] autogen a couple of additional tests
kpyzhov [Wed, 6 Oct 2021 01:47:25 +0000 (21:47 -0400)]
[AMDGPU] Correction to
095c48fdf3d27a4f346f8680d1d7e89449bb557b.
Differential Revision: https://reviews.llvm.org/D110337
Philip Reames [Wed, 6 Oct 2021 01:33:24 +0000 (18:33 -0700)]
[docs] Expand the pre-merge testing description a bit
Core changes are:
Be explicit about desired balance between missing true positives and reporting false positives.
Mention the opt-out mechanism.
Provide links to background, and give description of who to contact if needed.
Differential Revision: https://reviews.llvm.org/D110873
Philip Reames [Wed, 6 Oct 2021 01:32:15 +0000 (18:32 -0700)]
[test] refresh a couple of autogen tests
Carl Ritson [Wed, 6 Oct 2021 00:53:52 +0000 (09:53 +0900)]
[AMDGPU] Only remove branches in SIInstrInfo::removeBranch
Without this change _term instructions can be removed during
critical edge splitting.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D111126
Louis Dionne [Thu, 19 Aug 2021 16:21:06 +0000 (12:21 -0400)]
[libc++] Refactor how basic_string and vector hoist exception-throwing functions
In basic_string and vector, we've been encapsulating all exception
throwing code paths in helper functions of a base class, which are defined
in the compiled library. For example, __vector_base_common defines two
methods, __throw_length_error() and __throw_out_of_range(), and the class
is externally instantiated in the library. This was done a long time ago,
but after investigating, I believe the goal of the current design was to:
1. Encapsulate the code to throw an exception (which is non-trivial) in
an externally-defined function so that the important code paths that
call it (e.g. vector::at) are free from that code. Basically, the
intent is for the "hot" code path to contain a single conditional jump
(based on checking the error condition) to an externally-defined function,
which handles all the exception-throwing business.
2. Avoid defining this exception-throwing function once per instantiation
of the class template. In other words, we want a single copy of
__throw_length_error even if we have vector<int>, vector<char>, etc.
3. Encapsulate the passing of the container-specific string (i.e. "vector"
and "basic_string") to the underlying exception-throwing function
so that object files don't contain those duplicated string literals.
For example, we'd like to have a single "vector" string literal for
passing to `std::__throw_length_error` in the library, instead of
having one per translation unit.
However, the way this is achieved right now has two problems:
- Using a base class and exporting it is really weird - I've been confused
about this ever since I first saw it. It's just a really unusual way of
achieving the above goals. Also, it's made even worse by the fact that
the definitions of __throw_length_error and __throw_out_of_range appear
in the headers despite always being intended to be defined in the compiled
library (via the extern template instantiation).
- We end up exporting those functions as weak symbols, which isn't great
for load times. Instead, it would be better to export those as strong
symbols from the library.
This patch fixes those issues while retaining ABI compatibility (e.g. we
still export the exact same symbols as before). Note that we need to
keep the base classes as-is to avoid breaking the ABI of someone who
might inherit from std::basic_string or std::vector.
Differential Revision: https://reviews.llvm.org/D111173
Heejin Ahn [Sat, 2 Oct 2021 02:07:41 +0000 (19:07 -0700)]
[WebAssembly] Remove WasmTagType
This removes `WasmTagType`. `WasmTagType` contained an attribute and a
signature index:
```
struct WasmTagType {
uint8_t Attribute;
uint32_t SigIndex;
};
```
Currently the attribute field is not used and reserved for future use,
and always 0. And that this class contains `SigIndex` as its property is
a little weird in the place, because the tag type's signature index is
not an inherent property of a tag but rather a reference to another
section that changes after linking. This makes tag handling in the
linker also weird that tag-related methods are taking both `WasmTagType`
and `WasmSignature` even though `WasmTagType` contains a signature
index. This is because the signature index changes in linking so it
doesn't have any info at this point. This instead moves `SigIndex` to
`struct WasmTag` itself, as we did for `struct WasmFunction` in D111104.
In this CL, in lib/MC and lib/Object, this now treats tag types in the
same way as function types. Also in YAML, this removes `struct Tag`,
because now it only contains the tag index. Also tags set `SigIndex` in
`WasmImport` union, as functions do.
I think this makes things simpler and makes tag handling more in line
with function handling. These two shares similar properties in that both
of them have signatures, but they are kind of nominal so having the same
signature doesn't mean they are the same element.
Also a drive-by fix: the reserved 'attirubute' part's encoding changed
from uleb32 to uint8 a while ago. This was fixed in lib/MC and
lib/Object but not in YAML. This doesn't change object files because the
field's value is always 0 and its encoding is the same for the both
encoding.
This is effectively NFC; I didn't mark it as such just because it
changed YAML test results.
Reviewed By: sbc100, tlively
Differential Revision: https://reviews.llvm.org/D111086
Louis Dionne [Tue, 5 Oct 2021 20:34:33 +0000 (16:34 -0400)]
[libc++] Pickle substitutions to pass them to dsl.sh.py
This is less brittle than hand-picking the substitutions that we
pass to the test, since a config could theorically use non-base
substitutions as well (such as defining %{flags} in terms of another
substitution like %{include}).
Also, print the decoded substitutions, which makes it much easier
to debug the test when it fails.
Differential Revision: https://reviews.llvm.org/D111179
Louis Dionne [Wed, 29 Sep 2021 19:26:05 +0000 (15:26 -0400)]
[runtimes] Allow FOO_TEST_CONFIG to be a relative path
That makes it possible to store that value in a CMake cache if needed.
Differential Revision: https://reviews.llvm.org/D110843
Diego Caballero [Tue, 5 Oct 2021 22:42:37 +0000 (22:42 +0000)]
[mlir][Linalg] Add support for min/max reduction vectorization in linalg.generic
This patch extends Linalg core vectorization with support for min/max reductions
in linalg.generic ops. It enables the reduction detection for min/max combiner ops.
It also renames MIN/MAX combining kinds to MINS/MAXS to make the sign explicit for
floating point and signed integer types. MINU/MAXU should be introduce din the future
for unsigned integer types.
Reviewed By: pifon2a, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D110854
Zequan Wu [Tue, 5 Oct 2021 22:41:20 +0000 (15:41 -0700)]
[Profile] Add missing fflush in __llvm_profile_set_file_object
Sanjay Patel [Tue, 5 Oct 2021 22:30:20 +0000 (18:30 -0400)]
[InstCombine] add folds for logical nand/nor
This is noted as a regression in:
https://llvm.org/PR52077
Sanjay Patel [Tue, 5 Oct 2021 21:41:06 +0000 (17:41 -0400)]
[InstCombine] add tests for logical nand/nor; NFC
Heejin Ahn [Mon, 4 Oct 2021 22:55:37 +0000 (15:55 -0700)]
[lld][WebAssembly] Remove redundant check for undefined global (NFC)
Also does some refactoring.
Reviewed By: sbc100
Differential Revision: https://reviews.llvm.org/D111101
Philip Reames [Tue, 5 Oct 2021 21:45:48 +0000 (14:45 -0700)]
[test] factor out reliance on noundef return value
Philip Reames [Tue, 5 Oct 2021 21:41:29 +0000 (14:41 -0700)]
[test] rework recently added SCEV tests
These are meant to check a future patch which recurses through operands of SCEVs, but because all SCEVs are trivially bounded by function entry, we need to arrange the trivial scope not to be valid. (i.e. we specifically need a lower defining scope)
Mircea Trofin [Thu, 30 Sep 2021 23:13:05 +0000 (16:13 -0700)]
[inliner] Mandatory inlining decisions produce remarks
This also removes the need to disable the mandatory inlining phase in
tests.
In a departure from the previous remark, we don't output a 'cost' in
this case, because there's no such thing. We just report that inlining
happened because of the attribute.
Differential Revision: https://reviews.llvm.org/D110891
Louis Dionne [Tue, 5 Oct 2021 17:37:43 +0000 (13:37 -0400)]
[libc++] Run the no-unicode CI job on new testing configs
This was most likely an oversight, since we're running all other jobs on
the new configs.
Differential Revision: https://reviews.llvm.org/D111168
Aaron Ballman [Tue, 5 Oct 2021 20:43:55 +0000 (16:43 -0400)]
Fix some Sphinx warnings in the static analyzer docs
A heading wasn't underlined properly, and two links share the same text
and so they should use an anonymous hyperlink instead of a named one.
Aaron Ballman [Tue, 5 Oct 2021 20:38:01 +0000 (16:38 -0400)]
Update the release notes for consteval if support; NFC
This support was landed in
424733c12aacc227a28114deba72061153f8dff2.
Sanjay Patel [Tue, 5 Oct 2021 20:26:01 +0000 (16:26 -0400)]
[InstCombine] refactor folds of 'not' instructions; NFC
This removes repeated calls to m_Not, so hopefully a little
more efficient.
Also, we may need to enhance some of these blocks to allow
logical and/or (select of bools).
Sam Clegg [Tue, 28 Sep 2021 18:43:47 +0000 (11:43 -0700)]
[lld][WebAssembly] Create optional internal symbols only after LTO object as been added
This is important for the cases where new symbols can be introduced
during LTO. Specifically this happens for during TLS-lowering where
references to `__tls_base` can be introduced.
Fixes: https://github.com/emscripten-core/emscripten/issues/12489
Differential Revision: https://reviews.llvm.org/D111171
Nikita Popov [Tue, 5 Oct 2021 20:25:41 +0000 (22:25 +0200)]
[SCEV] Don't check if propagation safe if there are no flags (NFC)
If there are no nowrap flags, then we don't need to determine
whether propagating flags is safe -- it will make no difference.
Philip Reames [Tue, 5 Oct 2021 20:16:10 +0000 (13:16 -0700)]
[tests] Cover cases we could infer SCEV flags, but don't
Vitaly Buka [Tue, 5 Oct 2021 20:08:16 +0000 (13:08 -0700)]
[sanitizer] Fix Android bot
We don't need to check for equality, we need to check
that storage is large enough.
Vitaly Buka [Tue, 5 Oct 2021 19:14:48 +0000 (12:14 -0700)]
[NFC][sanitizer] Combine MSAN data in single field
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D111118
Jonas Devlieghere [Tue, 5 Oct 2021 19:12:04 +0000 (12:12 -0700)]
[lldb] Improve meta data stripping from JSON crashlogs
JSON crashlogs normally start with a single line of meta data that we
strip unconditionally. Some producers started omitting the meta data
which tripped up crashlog. Be more resilient by only removing the first
line when we know it really is meta data.
rdar://
82641662
Roman Lebedev [Tue, 5 Oct 2021 18:06:30 +0000 (21:06 +0300)]
[NFC] Fixup newly-added costmodel tests to actually test what they should
Valentin Clement [Tue, 5 Oct 2021 18:32:43 +0000 (20:32 +0200)]
[fir] Add external name interop pass
Add the external name conversion pass needed for compiler
interoperability. This pass convert the Flang internal symbol name to
the common gfortran convention.
Clean up old passes without implementation in the Passes.ts file so
the project and fir-opt can build correctly.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D111057
Louis Dionne [Thu, 30 Sep 2021 18:16:39 +0000 (14:16 -0400)]
[libc++abi] Mark __cxa_new_handler with _LIBCPP_SAFE_STATIC
For consistency with the other handlers, and because requiring constant
initialization whenever we can is a good thing.
Differential Revision: https://reviews.llvm.org/D110866
Lei Zhang [Tue, 5 Oct 2021 17:56:20 +0000 (13:56 -0400)]
[mlir][spirv] Add ops and patterns for lowering standard max/min ops
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D111143
peter klausler [Wed, 29 Sep 2021 23:42:22 +0000 (16:42 -0700)]
[flang] Fold MAXLOC and MINLOC
Generalize the code that folds FINDLOC to also handle
folding for MAXLOC and MINLOC.
Differential Revision: https://reviews.llvm.org/D110951
Philip Reames [Tue, 5 Oct 2021 18:15:35 +0000 (11:15 -0700)]
[SCEV] Tweak the algorithm for figuring out if flags must apply to a SCEV [mostly-NFC]
Behavior wise, this patch should be mostly NFC. The only behavior difference known is that on the isSCEVExprNeverPoison path we'll consider a bound imposed by the SCEVable operands (if any).
Algorithmically, it's an invert of the existing code. Previously, we checked for each operand if we could find a bound, then checked for must-execute given that bound. With the patch, we use dominance to refine the innermost bound, then check must execute once. The interesting case is when we have multiple unknowns within a single basic block. While both dominance and must-execute are worst-case linear walks within the block, only dominance is cached. As such, refining based on dominance should be more efficient.
River Riddle [Tue, 5 Oct 2021 00:24:24 +0000 (00:24 +0000)]
[mlir:Pass] Generate a reproducer as early as possible
This avoids keeping references to passes that may be freed by
the time that the pass manager has finished executing (in the
non-crash case).
Fixes PR#52069
Differential Revision: https://reviews.llvm.org/D111106
Joe Loser [Tue, 5 Oct 2021 18:08:42 +0000 (14:08 -0400)]
[libc++][test] Use = delete over DELETE_FUNCTION. NFC.
Some tests repeat the definition of `DELETE_FUNCTION` macro locally.
However, it's not even requred to guard against in the C++03 case since
Clang supports `= delete;` in C++03 mode. A warning is issued but
`libc++` tests run with `-Wno-c++11-extensions`, so this isn't an issue.
Since we don't support other compilers in C++03 mode, `= delete;` is
always available for use. As such, inline all calls of `DELETE_FUNCTION`
to use `= delete;`.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D111148
Rob Suderman [Tue, 5 Oct 2021 17:49:08 +0000 (10:49 -0700)]
[mlir][tosa] tosa.cast support for unsigned integers
Unsigned integers need to be handled for cast to floating point.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D111102
Amy Huang [Mon, 20 Sep 2021 16:50:49 +0000 (09:50 -0700)]
[Sema] Allow comparisons between different ms ptr size address space types.
We're currently using address spaces to implement __ptr32/__ptr64 attributes;
this patch fixes a bug where clang doesn't allow types with different pointer
size attributes to be compared.
Fixes https://bugs.llvm.org/show_bug.cgi?id=51889
Differential Revision: https://reviews.llvm.org/D110670
Simon Pilgrim [Tue, 5 Oct 2021 17:34:02 +0000 (18:34 +0100)]
[llvm] Update report_fatal_error calls from raw_string_ostream to use Twine(OS.str())
As described on D111049, we're trying to remove the <string> dependency from error handling and replace uses of report_fatal_error(const std::string&) with the Twine() variant which can be forward declared.
We can use the raw_string_ostream::str() method to perform the implicit flush() and return a reference to the std::string container that we can then wrap inside Twine().
David Zarzycki [Tue, 5 Oct 2021 17:39:29 +0000 (13:39 -0400)]
[lldb testing] NFC: run through clang-format
Keith Smiley [Sat, 2 Oct 2021 00:41:56 +0000 (17:41 -0700)]
[lldb] Improve help for platform put-file
Previously it was not clear what arguments this required, or what it would do if you didn't pass the destination argument.
Differential Revision: https://reviews.llvm.org/D110981
Petr Hosek [Tue, 5 Oct 2021 07:26:08 +0000 (00:26 -0700)]
[InstrProfData] Bump the raw profile version to 8
This is to account for the change that made CountersPtr in __profd_
relative which landed in
a1532ed27582038e2d9588108ba0fe8237f01844.
That change hasn't updated the raw profile version, and while the
profile layout stayed the same, profiles generated by tip-of-tree
LLVM are incompatible with 13.x tooling.
Differential Revision: https://reviews.llvm.org/D111123
Kirill Bobyrev [Tue, 5 Oct 2021 16:44:43 +0000 (18:44 +0200)]
[clangd] Revert unwanted change from D108194
Geoffrey Martin-Noble [Tue, 5 Oct 2021 01:09:02 +0000 (18:09 -0700)]
[MLIR][linalg] Preserve location during elementwise fusion
This otherwise loses a lot of debugging info and results in a painful
debugging experience.
Reviewed By: mravishankar, stellaraccident
Differential Revision: https://reviews.llvm.org/D111107
Alexey Bataev [Tue, 5 Oct 2021 13:33:14 +0000 (06:33 -0700)]
[SLP]Detect reused scalars in all possible gathers for better vectorization cost.
Some initially gathered nodes missed the check for the reused scalars,
which leads to high gather cost. Such nodes still can be represented as
m gathers + shuffle instead of n gathers, where m < n.
Differential Revision: https://reviews.llvm.org/D111153
Roman Lebedev [Tue, 5 Oct 2021 16:28:23 +0000 (19:28 +0300)]
[NFC][X86][LV] Add basic costmodel test coverage for not-fully-interleaved i32 loads
The coverage could have cumulative explosion here,
so i'm adding only the most basic cases,
and hoping it's enough, though more can be added if needed.
Aart Bik [Mon, 4 Oct 2021 20:13:24 +0000 (13:13 -0700)]
[mlir][sparse] add a "release" operation to sparse tensor dialect
We have several ways to materialize sparse tensors (new and convert) but no explicit operation to release the underlying sparse storage scheme at runtime (other than making an explicit delSparseTensor() library call). To simplify memory management, a sparse_tensor.release operation has been introduced that lowers to the runtime library call while keeping tensors, opague pointers, and memrefs transparent in the initial IR.
*Note* There is obviously some tension between the concept of immutable tensors and memory management methods. This tension is addressed by simply stating that after the "release" call, no further memref related operations are allowed on the tensor value. We expect the design to evolve over time, however, and arrive at a more satisfactory view of tensors and buffers eventually.
Bug:
http://llvm.org/pr52046
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D111099
Jonas Paulsson [Tue, 3 Aug 2021 17:49:45 +0000 (19:49 +0200)]
[SystemZ] Implement memcmp of variable length with CLC.
Following the same pattern of memset/memcpy, this patch implements a variable
length memcmp with a CLC loop followed by an EXRL instruction.
Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D107380
Nikita Popov [Tue, 5 Oct 2021 16:09:09 +0000 (18:09 +0200)]
[APInt] Fix type limits warning (NFC)
Unsigned number is always >= 0.
Matt Beardsley [Tue, 5 Oct 2021 16:09:25 +0000 (18:09 +0200)]
[clang-tidy] Fix add_new_check.py to generate correct list.rst autofix column from relative path
Previously, the code in add_new_check.py that looks for fixit keywords in check source files when generating list.rst assumed that the script would only be called from its own path. That means it doesn't find any source files for the checks it's attempting to scan for, and it defaults to writing out nothing in the "Offers fixes" column for all checks. Other parts of add_new_check.py work from other paths, just not this part.
After this fix, add_new_check.py's "offers fixes" column generation for list.rst will be consistent regardless of what path it's called from by using the caller path that's deduced elsewhere already from sys.argv[0].
Reviewed By: kbobyrev
Differential Revision: https://reviews.llvm.org/D110600
Joe Nash [Mon, 4 Oct 2021 14:29:51 +0000 (10:29 -0400)]
[MacroFusion] Expose useful static methods. NFC.
hasLessThanNumFused and fuseInstructionPair are useful for
DAG mutations similar to MacroFusion, but which cannot use
MacroFusion as a whole (such as fusing non-dependent instruction).
Reviewed By: MatzeB
Differential Revision: https://reviews.llvm.org/D111070
Change-Id: I3a5d56aba0471d45ef64cebb9b724030e2eae2f3
Kirill Bobyrev [Tue, 5 Oct 2021 16:08:00 +0000 (18:08 +0200)]
[clangd] IncludeCleaner: Mark used headers
Follow-up on D105426.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D108194
Nikita Popov [Sun, 3 Oct 2021 10:33:59 +0000 (12:33 +0200)]
[ConstantFold] Refactor load folding
This refactors load folding to happen in two cleanly separated
steps: ConstantFoldLoadFromConstPtr() takes a pointer to load from
and decomposes it into a constant initializer base and an offset.
Then ConstantFoldLoadFromConst() loads from that initializer at
the given offset. This makes the core logic independent of having
actual GEP expressions (and those GEP expressions having certain
structure) and will allow exposing ConstantFoldLoadFromConst() as
an independent API in the future.
This is mostly only a refactoring, but it does make the folding
logic slightly more powerful.
Differential Revision: https://reviews.llvm.org/D111023
Simon Pilgrim [Tue, 5 Oct 2021 16:02:18 +0000 (17:02 +0100)]
[Support] Update SmallVector report_fatal_error calls to use Twine and add missing implicit header dependency.
Simon Pilgrim [Tue, 5 Oct 2021 16:00:13 +0000 (17:00 +0100)]
[TableGen] CodeEmitterGen - emit report_fatal_error(const char*) instead of report_fatal_error(std::string&)
As described on D111049, we're trying to remove the <string> dependency from error handling. In most cases the plan is to use the Twine() variant directly but to reduce introducing additional headers for the generated files, I'm using the const char* variant here instead.
Simon Pilgrim [Tue, 5 Oct 2021 15:29:33 +0000 (16:29 +0100)]
[clang] FatalErrorHandler.cpp - add explicit <stdio.h> include
Required for fprintf/stderr usage in the error handler, noticed while trying to remove the <string> dependency described in D111049
Chris Lattner [Tue, 5 Oct 2021 04:33:51 +0000 (21:33 -0700)]
[APInt] Make insertBits and concat work with zero width APInts.
These should both clearly work with our current model for zero width
integers, but don't until now!
Differential Revision: https://reviews.llvm.org/D111113
Utkarsh Saxena [Mon, 4 Oct 2021 06:20:09 +0000 (08:20 +0200)]
[clangd] Include refs of base method in refs for derived method.
Addresses https://github.com/clangd/clangd/issues/881
Includes refs of base class method in refs of derived class method.
Previously we reported base class method's refs only for decl of derived
class method. Ideally this should work for all usages of derived class method.
Related patch:
https://github.com/llvm/llvm-project/commit/
fbeff2ec2bc6e44b92931207b0063f83ff7a3b3a.
Differential Revision: https://reviews.llvm.org/D111039
Kazu Hirata [Tue, 5 Oct 2021 15:29:19 +0000 (08:29 -0700)]
[llvm] Migrate from getNumArgOperands to arg_size (NFC)
Note that getNumArgOperands is considered a legacy name. See
llvm/include/llvm/IR/InstrTypes.h for details.
Amara Emerson [Tue, 5 Oct 2021 15:24:44 +0000 (08:24 -0700)]
Revert "Revert "Revert "[GlobalISel][IRTranslator] Emit trap intrinsic for "unreachable""""
This reverts commit
c93bc508ee446d17f9d5d59b48d98aef15f22d52.
Seems to break a different thing now.
Jonas Paulsson [Tue, 20 Jul 2021 18:53:22 +0000 (20:53 +0200)]
[SystemZ] Implement memcpy of variable length with MVC.
Instead of making a memcpy libcall, emit an MVC loop and an EXRL instruction
the same way as is already done for memset 0.
Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D106874
Peter Waller [Tue, 21 Sep 2021 14:31:09 +0000 (14:31 +0000)]
[AArch64][SVE] Remove redundant PTEST following PNEXT/PFIRST
PNEXT and PFIRST set the NZCV flags, so the subsequent PTEST can be
optimized away in AArch64InstrInfo::optimizePTestInstr.
See-also: https://reviews.llvm.org/D93292
Differential Revision: https://reviews.llvm.org/D110177
Matthew Devereau [Mon, 4 Oct 2021 15:56:56 +0000 (16:56 +0100)]
[AArch64][SVE] Propagate math flags from intrinsics to instructions
Retain floating-point math flags inside instCombineSVEVectorBinOp
David Zarzycki [Tue, 5 Oct 2021 14:21:32 +0000 (10:21 -0400)]
[lldb testing] Avoid subtle terminfo behavioral differences
The original "arbitrary" changes were causing EINVAL on a Fedora 34 box.
Joe Loser [Tue, 5 Oct 2021 14:14:48 +0000 (10:14 -0400)]
[libc++][test] Remove unused macro in is_constructible.pass.cpp. NFC.
Test file defines `LIBCPP11_STATIC_ASSERT` but it never uses it now. It
always uses `static_assert` unconditionally. So, remove the unused
macro.
TN Khanh [Tue, 5 Oct 2021 14:04:34 +0000 (19:34 +0530)]
Add .cmt and .cmti files for OCaml bindings
We can build .cmt and .cmti files for easier
code navigation for OCaml bindings
Roman Lebedev [Tue, 5 Oct 2021 13:28:54 +0000 (16:28 +0300)]
[X86][Costmodel] Load/store i64/f64 Stride=6 VF=8 interleaving costs
The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3
For load we have:
https://godbolt.org/z/1jfGddcre - for intels `Block RThroughput: =36.0`; for ryzens, `Block RThroughput: =12.0`
So could pick cost of `36`
For store we have:
https://godbolt.org/z/ao9srMT8r - for intels `Block RThroughput: =30.0`; for ryzens, `Block RThroughput: =12.0`
So we could pick cost of `30`.
I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D111094
Roman Lebedev [Tue, 5 Oct 2021 13:28:54 +0000 (16:28 +0300)]
[X86][Costmodel] Load/store i64/f64 Stride=6 VF=4 interleaving costs
The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3
For load we have:
https://godbolt.org/z/rc8jYxW6M - for intels `Block RThroughput: =18.0`; for ryzens, `Block RThroughput: =6.0`
So could pick cost of `18`.
For store we have:
https://godbolt.org/z/9PhPEr65G - for intels `Block RThroughput: =15.0`; for ryzens, `Block RThroughput: =6.0`
So we could pick cost of `15`.
I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D111093
Roman Lebedev [Tue, 5 Oct 2021 13:28:49 +0000 (16:28 +0300)]
[X86][Costmodel] Load/store i64/f64 Stride=6 VF=2 interleaving costs
The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3
For load we have:
https://godbolt.org/z/onese7rec - for intels `Block RThroughput: =6.0`; for ryzens, `Block RThroughput: =3.0`
So could pick cost of `6`.
For store we have:
https://godbolt.org/z/bMd7dddnT - for intels `Block RThroughput: =8.0`; for ryzens, `Block RThroughput: <=6.0`
So we could pick cost of `8`.
I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D111092
Roman Lebedev [Tue, 5 Oct 2021 13:28:04 +0000 (16:28 +0300)]
[X86][Costmodel] Load/store i32/f32 Stride=6 VF=16 interleaving costs
This one required quite a bit of an assembly surgery, but i think it's in the right ballpark..
The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3
For load we have:
https://godbolt.org/z/na97Kb96o - for intels `Block RThroughput: <=64.0`; for ryzens, `Block RThroughput: <=32.0`
So could pick cost of `64`.
For store we have:
https://godbolt.org/z/GG1WeoKar - for intels `Block RThroughput: =66.0`; for ryzens, `Block RThroughput: <=27.5`
So we could pick cost of `66`.
I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D111091