Chia-hung Duan [Tue, 8 Mar 2022 20:31:06 +0000 (20:31 +0000)]
[mlir] Make ShapedTypeComponents contructible from ShapeAdaptor
ValueShapeRange::getShape() returns ShapeAdaptor rather than ShapedType
and ShapeAdaptor allows implicit conversion to bool. It ends up that
ShapedTypeComponents can be constructed with ShapeAdaptor incorrectly.
The reason is that the type trait
std::is_constructible<ShapeStorageT, Arg>::value
is fulfilled because ShapeAdaptor can be converted to bool and it can be
used to construct ShapeStorageT. In the end, we won't give any warning
or error message when doing things like
inferredReturnShapes.emplace_back(valueShapeRange.getShape(0));
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D120845
Arthur O'Dwyer [Wed, 9 Mar 2022 02:56:25 +0000 (21:56 -0500)]
[libc++] Fix a use-after-move introduced in D118003.
Thanks to Eric Fiselier for catching this!
Jonas Devlieghere [Wed, 9 Mar 2022 02:35:06 +0000 (18:35 -0800)]
[lldb] Always move the cursor back after printing progress
This got lost while iterating on the patch. We need to always move the
cursor to the front of the line so that if something else
(asynchronously) prints to the debugger's output it overwrites the
progress message.
Jonas Devlieghere [Sun, 6 Mar 2022 01:52:01 +0000 (17:52 -0800)]
[lldb] Add a setting to change the progress color
Add a setting to change how progress is shown in a color enabled
terminal. This follows the existing -prefix, -suffix pattern
that's used elsewhere in lldb.
Differential revision: https://reviews.llvm.org/D121062
Jonas Devlieghere [Sat, 5 Mar 2022 23:45:52 +0000 (15:45 -0800)]
[lldb] Show progress events in the command line driver
This patch adds support for showing progress events when using lldb on
the command line. It spawns a separate thread that listens for progress
events and prints them to the debugger's output stream.
It's nothing fancy (yet), for now it just prints the progress message.
If we know the total number of items being processed, we prefix the
message with something like [1/100], similar to ninja's output.
This patch doesn't use any fancy terminal manipulation: it uses a simple
carriage return (\r) to bring the cursor to the front of the line and
vt100 escape codes to clear the (rest) of the line.
Differential revision: https://reviews.llvm.org/D120972
Jonas Devlieghere [Wed, 9 Mar 2022 02:22:56 +0000 (18:22 -0800)]
[lldb] Remove "(i.e. ANSI)" from several property descriptions.
Addresses Adrian's feedback from D121062.
Chuanqi Xu [Wed, 9 Mar 2022 02:14:35 +0000 (10:14 +0800)]
Revert "[clang][ABI] New C++20 module mangling scheme"
This reverts commit
21e16ab6b8ddaccb70d2344bb35419e214a32ec9.
It looks like it would break builds in mac. See
https://reviews.llvm.org/D118352.
Amy Zhuang [Wed, 9 Mar 2022 01:17:22 +0000 (17:17 -0800)]
[mlir] Extend AffineForEmptyLoopFolder
Currently when we fold an empty loop, we assume that any loop
with iterArgs returns its iterArgs in order, which is not always
the case. It may return values defined outside of the loop or
return its iterArgs out of order. This patch adds support to
those cases.
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D120776
Aart Bik [Tue, 8 Mar 2022 21:24:45 +0000 (13:24 -0800)]
[mlir][sparse] index support in sparse compiler codegen
This revision adds support for the linalg.index to the sparse compiler
pipeline. In essence, this adds the ability to refer to indices in
the tensor index expression, as illustrated below:
Y[i, j, k, l, m] = T[i, j, k, l, m] * i * j
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D121251
Peter Klausler [Mon, 7 Mar 2022 21:57:37 +0000 (13:57 -0800)]
[flang] Distinguish usage and portability warning messages
Using recently established message severity codes, upgrade
non-fatal messages to usage and portability warnings as
appropriate.
Differential Revision: https://reviews.llvm.org/D121246
River Riddle [Tue, 8 Mar 2022 03:07:30 +0000 (19:07 -0800)]
[mlir][NFC] Add various includes currently transitively found in
BuiltinOps.h
These includes are going to be removed from BuiltinOps.h in a followup
when FuncOp is moved out of the Builtin dialect. This commit
pre-emptively adds those includes to simplify the patch moving FuncOp.
Kevin Athey [Tue, 8 Mar 2022 23:17:30 +0000 (15:17 -0800)]
[MSAN] add interceptor for timer_create, timer_settime, timer_gettime
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D120602
Florian Mayer [Wed, 9 Mar 2022 00:41:52 +0000 (16:41 -0800)]
[NFC] [MTE] [HWASan] fixed orphaned comments.
Ryan Senanayake [Wed, 9 Mar 2022 00:27:27 +0000 (00:27 +0000)]
[clang] Fix CodeGenAction for LLVM IR MemBuffers
Replaces use of getCurrentFile with getCurrentFileOrBufferName
in CodeGenAction. This avoids an assertion error or an incorrect
name chosen for the output file when assertions are disabled.
This error previously occurred when the FrontendInputFile was a
MemoryBuffer instead of a file.
Reviewed By: jlebar
Differential Revision: https://reviews.llvm.org/D121259
Florian Mayer [Wed, 9 Mar 2022 00:26:23 +0000 (16:26 -0800)]
[NFC] [MTE] [HWASan] simply code.
Tom Stellard [Tue, 8 Mar 2022 23:49:32 +0000 (15:49 -0800)]
docs: Update instructions for requesting backports to the release branches
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D120974
River Riddle [Tue, 8 Mar 2022 23:06:53 +0000 (15:06 -0800)]
[mlir:toy][NFC] Add comment blocks for toy operations.
Vitaly Buka [Wed, 9 Mar 2022 00:15:21 +0000 (16:15 -0800)]
Revert "Attempt to fix linking issue on the bot"
The issue was fixed with
48c74bb2e2a72830f1068823bfc2f6fd4b53d427
This reverts commit
ac423a8c8aa87a128e51f3690afc1405d06b8c9d.
Florian Mayer [Tue, 8 Mar 2022 23:35:18 +0000 (15:35 -0800)]
[NFC] [HWASan] [MTE] Use function_ref over template.
Vitaly Buka [Tue, 8 Mar 2022 23:31:58 +0000 (15:31 -0800)]
Attempt to fix linking issue on the bot
Shoaib Meenai [Sat, 5 Mar 2022 01:53:21 +0000 (17:53 -0800)]
[cmake] Use CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
Now that our minimum required CMake version is past 3.6, we can use
CMAKE_TRY_COMPILE_PLATFORM_VARIABLES instead of relying on environment
variable trickery. The two aren't entirely equivalent because
CMAKE_TRY_COMPILE_PLATFORM_VARIABLES is only used for try_compiles of
source files and not whole projects, but I ran LLVM configures before
and after this change and the generated CMakeCache.txt files were
identical, so this should be NFC for us.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D121035
Tom Stellard [Tue, 8 Mar 2022 23:10:39 +0000 (15:10 -0800)]
SafeStack: Re-enable SafeStack coloring optimization
This was disabled in
2acea2786b9fd40e1aba018b165834168535e164 as a
work-around for Issue #31491. I've reduced the test case from that bug
and confirmed that it is now fixed.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D120866
Vladislav Khmelevsky [Wed, 2 Mar 2022 21:34:41 +0000 (00:34 +0300)]
[BOLT] Handle ifuncs trampolines for aarch64
The aarch64 uses the trampolines located in .iplt section, which
contains plt-like trampolines on the value stored in .got. In this case
we don't have JUMP_SLOT relocation, but we have a symbol that belongs to
ifunc trampoline, so use it and set set plt symbol for such functions.
Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei
Differential Revision: https://reviews.llvm.org/D120850
Arthur Eubanks [Tue, 8 Mar 2022 22:33:19 +0000 (14:33 -0800)]
[test] Modify some tests to remove implicit -basic-aa in legacy PM RUN lines
Fangrui Song [Tue, 8 Mar 2022 22:34:53 +0000 (14:34 -0800)]
[SampleProfileInference] Work around odr-use of const non-inline static data member to fix -O0 builds after D120508
MinBaseDistance may be odr-used by std::max, leading to an undefined symbol linker error:
```
ld.lld: error: undefined symbol: (anonymous namespace)::MinCostMaxFlow::MinBaseDistance
>>> referenced by SampleProfileInference.cpp:744 (/home/ray/llvm-project/llvm/lib/Transforms/Utils/SampleProfileInference.cpp:744)
>>> lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/SampleProfileInference.cpp.o:((anonymous namespace)::FlowAdjuster::jumpDistance(llvm::FlowJump*) const)
```
Since llvm-project is still using C++ 14, workaround it with a cast.
Andrew Browne [Tue, 8 Mar 2022 21:18:25 +0000 (13:18 -0800)]
[DFSan] Fix several bugs in dfsan custom callbacks test.
Reviewed By: kda
Differential Revision: https://reviews.llvm.org/D121249
LLVM GN Syncbot [Tue, 8 Mar 2022 22:21:17 +0000 (22:21 +0000)]
[gn build] Port
c2cd15a66531
Nikolas Klauser [Tue, 8 Mar 2022 22:12:35 +0000 (23:12 +0100)]
[libc++][ranges] Implement ranges::mismatch
Implement `ranges::mismatch`
Reviewed By: Quuxplusone, ldionne, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D117817
Arthur Eubanks [Tue, 8 Mar 2022 22:00:08 +0000 (14:00 -0800)]
[test] Use new PM for -aa-eval tests
Florian Hahn [Tue, 8 Mar 2022 22:01:53 +0000 (22:01 +0000)]
[ConstraintElimination] Remove over-eager assertion.
After moving the CanAdd check in
c60cdb44f7ecb4b02ed and using it for
the assume cases as well, the passed in block may not have a branch
instruction as terminator. This can trigger the assertion. Given the new
use case, it doesn't add value any longer and can be removed.
Fixes https://github.com/llvm/llvm-project/issues/54281
Joseph Huber [Tue, 8 Mar 2022 21:53:50 +0000 (16:53 -0500)]
[OpenMP][Docs] Make copy pasting remarks easier
Arthur Eubanks [Tue, 8 Mar 2022 21:37:22 +0000 (13:37 -0800)]
[test][LowerMatrixIntrinsics] Use new PM RUN lines
Louis Dionne [Tue, 8 Mar 2022 21:34:28 +0000 (16:34 -0500)]
[libc++] Remove stray #undef
I think that was left after we removed _CONSTEXPR_TERNARY based on a
review comment -- the #undef was never removed.
Valentin Clement [Tue, 8 Mar 2022 21:08:02 +0000 (22:08 +0100)]
[flang] Lower associate construct
This patch lowers the `associate` construct.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D121239
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Amir Ayupov [Tue, 8 Mar 2022 17:17:41 +0000 (09:17 -0800)]
[BOLT][NFC] Handle "dynamic section sizes should match"
Address fuzzer crash on malformed input
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D121070
Lei Zhang [Tue, 8 Mar 2022 20:58:31 +0000 (15:58 -0500)]
[mlir][spirv] Define spv.VectorTimesScalar op
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D121247
Lei Zhang [Tue, 8 Mar 2022 20:56:37 +0000 (15:56 -0500)]
[mlir][spirv] Fix spv.GLSL.{S|U}Clamp type checking
It's fine to use any integer (vector) values regardless of the
signedness. The opcode decides how to interpret the bits.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D121238
Lei Zhang [Tue, 8 Mar 2022 20:53:22 +0000 (15:53 -0500)]
[mlir][spirv] Handle another form of folding comparsion into clamp
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D121227
Tue Ly [Tue, 8 Mar 2022 18:36:39 +0000 (13:36 -0500)]
[libc] Add testing macros for errno and floating point exceptions.
Add testing macros for errno and floating point exceptions.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D121235
Mehdi Amini [Tue, 8 Mar 2022 20:39:51 +0000 (20:39 +0000)]
Revert "Fix link of libmlir.so by adding ExecutionEngine as dependency to GPUTransforms"
This reverts commit
b743850b736e4a89378be8bed61c1b3489b56d19.
This didn't produce the expected result.
spupyrev [Thu, 24 Feb 2022 19:29:37 +0000 (11:29 -0800)]
introducing some profi flags
Differential Revision: https://reviews.llvm.org/D120508
Mehdi Amini [Tue, 8 Mar 2022 20:31:16 +0000 (20:31 +0000)]
Fix link of libmlir.so by adding ExecutionEngine as dependency to GPUTransforms
This feels like a layering violation, but it fixes the build.
Fixes #54242
tools/mlir/lib/Dialect/GPU/CMakeFiles/obj.MLIRGPUTransforms.dir/Transforms/SerializeToHsaco.cpp.o:SerializeToHsaco.cpp:function (anonymous namespace)::SerializeToHsacoPass::optimizeLlvm(llvm::Module&, llvm::TargetMachine&):
error: undefined reference to 'mlir::makeOptimizingTransformer(unsigned int, unsigned int, llvm::TargetMachine*)'
River Riddle [Tue, 8 Mar 2022 08:04:12 +0000 (00:04 -0800)]
[mlir][SCF] Replace use of FuncOp with FunctionOpInterface
There is nothing specific to FuncOp about the check, it can be changed
to be interface based.
Differential Revision: https://reviews.llvm.org/D121194
River Riddle [Tue, 8 Mar 2022 08:02:21 +0000 (00:02 -0800)]
[mlir][MemRef] Change memref-expand to be a generic operation pass
This pass doesn't rely on any specific characteristics of FuncOp, and
can just be a generic operation pass.
Differential Revision: https://reviews.llvm.org/D121193
River Riddle [Tue, 8 Mar 2022 02:29:59 +0000 (18:29 -0800)]
[mlir] Change ComplexToLLVM to be a generic pass
It is currently a module pass, but shouldn't be. All of the patterns
are local conversions, and don't require anything about
functions/modules.
Differential Revision: https://reviews.llvm.org/D121192
River Riddle [Mon, 7 Mar 2022 21:56:38 +0000 (13:56 -0800)]
[mlir] Update FuncOp conversion passes to Pass/InterfacePass<FunctionOpInterface>
These passes generally don't rely on any special aspects of FuncOp, and moving allows
for these passes to be used in many more situations. The passes that obviously weren't
relying on invariants guaranteed by a "function" were updated to be generic pass, the
rest were updated to be FunctionOpinterface InterfacePasses.
The test updates are NFC switching from implicit nesting (-pass -pass2) form to
the -pass-pipeline form (generic passes do not implicitly nest as op-specific passes do).
Differential Revision: https://reviews.llvm.org/D121190
River Riddle [Tue, 8 Mar 2022 03:13:02 +0000 (19:13 -0800)]
[mlir][NFC] Update the Builtin dialect to use "Both" accessors
Differential Revision: https://reviews.llvm.org/D121189
River Riddle [Tue, 8 Mar 2022 08:05:02 +0000 (00:05 -0800)]
[mlir][Vector] Drop use of FuncOp in transferOpflowOpt
FuncOp isn't really important to hardcode here, it is only used to act
as a root operation for the transformation.
Differential Revision: https://reviews.llvm.org/D121195
River Riddle [Tue, 8 Mar 2022 02:19:15 +0000 (18:19 -0800)]
[mlir][test] Generalize a bunch of FuncOp based passes to run on any operation/interfaces
A lot of test passes are currently anchored on FuncOp, but this
dependency
is generally just historical. A majority of these test passes can run on
any operation, or can operate on a specific interface
(FunctionOpInterface/SymbolOpInterface).
This allows for greatly reducing the API dependency on FuncOp, which
is slated to be moved out of the Builtin dialect.
Differential Revision: https://reviews.llvm.org/D121191
Louis Dionne [Fri, 4 Mar 2022 14:54:29 +0000 (09:54 -0500)]
[libc++] Remove extension to support allocator<const T>
This extension is a portability trap for users, since no other standard
library supports it. Furthermore, the Standard explicitly allows
implementations to reject std::allocator<cv T>, so allowing it is
really going against the current.
This was discovered in D120684: this extension required `const_cast`ing
in `__construct_range_forward`, a fishy bit of code that can be removed
if we don't support the extension anymore.
This is a re-application of
dbc647643577, which was reverted in
9138666f5
because it broke std::shared_ptr<T const>. Tests have now been added and
we've made sure that std::shared_ptr<T const> wouldn't be broken in this
version.
Differential Revision: https://reviews.llvm.org/D120996
Michael Jones [Tue, 8 Mar 2022 18:19:31 +0000 (10:19 -0800)]
[libc][NFC] remove completed TODOs
There were some "TODO" messages that were for things that I have already
completed. This patch removes those.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D121232
Michael Jones [Tue, 8 Mar 2022 19:17:11 +0000 (11:17 -0800)]
[libc][NFC] split standalone_cpp into single headers
Previously, the entire support/CPP folder was in one header library,
which meant that a lot of headers were included where they shouldn't be.
This patch splits each header into its own target, as well as adjusting
each place they were included to only include what is used.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D121237
Louis Dionne [Tue, 8 Mar 2022 19:48:46 +0000 (14:48 -0500)]
[libc++][NFC] Rename ostreambuf_iterator test
Peter Klausler [Mon, 7 Mar 2022 17:23:21 +0000 (09:23 -0800)]
[flang] Add nonfatal message classes
F18 presently has fatal and non-fatal diagnostic messages. We'd like
to make non-fatal warnings stand out better in the output of the compiler.
This will turn out to be a large change that affects many files.
This patch is just the first part. It converts a Boolean isFatal_ data
member of the message classes into a severity code, and defines four
of these codes (Error, Warning, Portability, and a catch-all Other).
Later patches will result from sweeping over the parser and semantics,
changing most non-fatal diagnostic messages into warnings and portability
notes.
Differential Revision: https://reviews.llvm.org/D121228
Rong Xu [Tue, 8 Mar 2022 19:18:41 +0000 (11:18 -0800)]
[SampleFDO] Allow multiple of --enable-fs-discrimintor option [NFC]
Allow users to use multiple of --enable-fs-discriminator option.
When this option is specified multiple times, the last instance wins.
Fangrui Song [Tue, 8 Mar 2022 19:26:12 +0000 (11:26 -0800)]
[ELF] Inline InputSection::getParent. NFC
Combined with the previous change, lld executable is ~2K smaller and some code
paths using InputSection::getParent are more efficient.
The fragmented headers lead to a design limitation that OutputSection has to be
incomplete, so we cannot use static_cast.
Fangrui Song [Tue, 8 Mar 2022 19:23:41 +0000 (11:23 -0800)]
[ELF] Don't use multiple inheritance for OutputSection. NFC
Add an OutputDesc class inheriting from SectionCommand. An OutputDesc wraps an
OutputSection. This change allows InputSection::getParent to be inlined.
Differential Revision: https://reviews.llvm.org/D120650
Andrzej Warzynski [Tue, 8 Mar 2022 10:01:55 +0000 (10:01 +0000)]
[flang][driver] Add support for `-debug-dump-pft`
This patch adds support for dumping the pre-FIR tree in `flang-new
-fc1`, i.e. Flang's frontend driver. This flag is functionally identical
to `-pft-test` in `bbc` and semantically similar to
`-fdebug-dump-parse-tree` from `flang-new -fc1`.
Differential Revision: https://reviews.llvm.org/D121198
Valentin Clement [Tue, 8 Mar 2022 19:17:48 +0000 (20:17 +0100)]
[flang] Lower computed and assigned goto
This patch lowers the computed and assigned goto statements.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld, schweitz
Differential Revision: https://reviews.llvm.org/D121219
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Mahesh Ravishankar [Fri, 4 Mar 2022 04:28:47 +0000 (04:28 +0000)]
[mlir][Linalg] Modify `InferStaticShapeOfOperands` to work on Linalg Ops.
Commit rG1a2bb03edab9d7aa31beb587d0c863acc6715d27 introduced a pattern
to convert dynamic dimensions in operands of `GenericOp`s to static
values based on indexing maps and shapes of other operands. The logic
is directly usable to any `LinalgOp`. Move that pattern as an
`OpInterfaceRewritePattern`.
Differential Revision: https://reviews.llvm.org/D120968
Lei Zhang [Tue, 8 Mar 2022 18:45:19 +0000 (13:45 -0500)]
[mlir][spirv] NFC: Move GLSL canonicalization pass to Transforms/
This is a pass that can be used by downstream consumers directly
to avoid the boilerplate to wrap around the `populate*Patterns`.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D121222
Arthur O'Dwyer [Wed, 29 Dec 2021 19:11:46 +0000 (14:11 -0500)]
[libc++] "Bottom-up heapsort" improvement to sort_heap.
https://en.wikipedia.org/wiki/Heapsort#Bottom-up_heapsort
In `pop_heap` specifically, the item we insert at the top and
sift downward is guaranteed to be leaf-sized, so we expect it
to go pretty far down. Sift it down as if it were INT_MIN, and
then bubble it back up if needed.
Also known as "heapsort with bounce."
Numbers are here: https://godbolt.org/z/cvfnYW6fe
Fixes #10008.
Differential Revision: https://reviews.llvm.org/D118003
Arthur O'Dwyer [Mon, 7 Mar 2022 21:56:20 +0000 (16:56 -0500)]
[libc++] Complexity regression tests for make_heap and sort_heap.
Reviewed as part of D118003.
Amir Ayupov [Tue, 8 Feb 2022 04:16:13 +0000 (20:16 -0800)]
[BOLT] CMOVConversion pass
Convert simple hammocks into cmov based on misprediction rate.
Test Plan:
- Assembly test: `cmov-conversion.s`
- Testing on a binary:
# Bootstrap clang with `-x86-cmov-converter-force-all` and `-Wl,--emit-relocs`
(Release build)
# Collect perf.data:
- `clang++ <opts> bolt/lib/Core/BinaryFunction.cpp -E > bf.cpp`
- `perf record -e cycles:u -j any,u -- clang-15 bf.cpp -O2 -std=c++14 -c -o bf.o`
# Optimize clang-15 with and w/o -cmov-conversion:
- `llvm-bolt clang-15 -p perf.data -o clang-15.bolt`
- `llvm-bolt clang-15 -p perf.data -cmov-conversion -o clang-15.bolt.cmovconv`
# Run perf experiment:
- test: `clang-15.bolt.cmovconv`,
- control: `clang-15.bolt`,
- workload (clang options): `bf.cpp -O2 -std=c++14 -c -o bf.o`
Results:
```
task-clock [delta: -360.21 ± 356.75, delta(%): -1.7760 ± 1.7589, p-value: 0.047951, balance: -6]
instructions [delta:
44061118 ±
13246382, delta(%): 0.0690 ± 0.0207, p-value: 0.000001, balance: 50]
icache-misses [delta: -5534468 ± 2779620, delta(%): -0.4331 ± 0.2175, p-value: 0.028014, balance: -28]
branch-misses [delta: -1624270 ± 1113244, delta(%): -0.3456 ± 0.2368, p-value: 0.030300, balance: -22]
```
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D120177
Lang Hames [Tue, 8 Mar 2022 18:22:17 +0000 (10:22 -0800)]
[JITLink] Demote symbol scope to local during external-to-absolute conversion.
When an external symbol is converted to an absolute it should be demoted to
local scope so that the symbol does not become a new definition within this
LinkGraph.
Mahesh Ravishankar [Tue, 8 Mar 2022 18:22:19 +0000 (18:22 +0000)]
[mlir] Add canonicalizations for op -> tensor.cast folding.
A `tensor.cast` consumer can be folded with its producer. This is
beneficial only if the result of the tensor cast is more static than
the source. This patch adds a utility function to check that this is
the case, and adds a couple of canonicalizations patterns that fold an
operation with `tensor.cast` conusmers.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D120950
Chia-hung Duan [Tue, 8 Mar 2022 17:48:08 +0000 (17:48 +0000)]
[mlir] Check nullity of MixedContainerType and TypedArrayAttrBase
It's valid to create a TypedArrayAttr or MixedContainerType with
nullptr, e.g.,
std::vector<mlir::Attribute> attrs = {mlir::StringAttr()};
builder.createArrayAttr(attrs);
The predicate didn't check if it's a nullptr and it ended up a crash in
the attribute static verifier. We always check if an attribute is null
so it's better to align the check for these two container type attr.
Reviewed By: rdzhabarov
Differential Revision: https://reviews.llvm.org/D121178
Simon Pilgrim [Tue, 8 Mar 2022 18:06:18 +0000 (18:06 +0000)]
[X86] convertIntLogicToFPLogic - enable fp-logic on pre-AVX targets for supported fp predicates (PR34563)
If the SETCC fp-condcode is supported on SSE as a single CMPPS/PD op then we can use convertIntLogicToFPLogic to reduce EFLAGS and XMM->GPR traffic like we do for AVX targets.
Differential Revision: https://reviews.llvm.org/D121210
Simon Pilgrim [Tue, 8 Mar 2022 18:01:58 +0000 (18:01 +0000)]
[X86] Add cheapX86FSETCC_SSE helper. NFC.
Identify FP CondCode that can be performed by a non-AVX SSE CMP op
Pulled out of D121210
Craig Topper [Tue, 8 Mar 2022 17:59:57 +0000 (09:59 -0800)]
[LegalizeTypes][VP] Add widening and splitting support for VP_FMA.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D120854
Craig Topper [Tue, 8 Mar 2022 17:40:18 +0000 (09:40 -0800)]
[LegalizeTypes][VP] Add splitting and widening support for VP_FNEG.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D120785
Nicolas Vasilache [Tue, 8 Mar 2022 17:40:12 +0000 (12:40 -0500)]
[mlir][Linalg] Add a polymorphic linalg.copy operation
With the recent improvements to OpDSL it is cheap to reintroduce a linalg.copy operation.
This operation is needed in at least 2 cases:
1. for copies that may want to change the elemental type (e.g. cast, truncate, quantize, etc)
2. to specify new tensors that should bufferize to a copy operation. The linalg.generic form
always folds away which is not always the right call.
Differential Revision: https://reviews.llvm.org/D121230
eopXD [Fri, 11 Feb 2022 09:49:19 +0000 (01:49 -0800)]
[RISCV] Add combination crypto extensions in ISAInfo
The crypto extension have several shorthand extensions that don't consist of any extra instructions.
Take `zk` for example, while the extension would imply `zkn, zkr, zkt`. The 3 extensions should also
combine back into `zk` to maintain the canonical order in isa strings.
This patch addresses the above.
Reviewed By: VincentWu
Differential Revision: https://reviews.llvm.org/D119530
Valentin Clement [Tue, 8 Mar 2022 17:47:28 +0000 (18:47 +0100)]
[flang] Lower sum intrinsic
This patch enables the lowering of the `sum` intrinsic. It adds
also infrastructure to deal with optional arguments in intrinsics and
implied loops.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D121221
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Akira Hatanaka [Tue, 8 Mar 2022 17:45:15 +0000 (09:45 -0800)]
[NFC][Clang][OpaquePtr] Remove calls to Address::deprecated in
CGBuiltin.cpp
Differential Revision: https://reviews.llvm.org/D121153
Philip Reames [Tue, 8 Mar 2022 17:42:43 +0000 (09:42 -0800)]
[MSSA] Add clarifying comment for isOptimized on MemoryUse [nfc]
Sanjay Patel [Tue, 8 Mar 2022 15:17:50 +0000 (10:17 -0500)]
[InstCombine] fold fcmp with lossy casted constant
This is noted as a missing clang warning in #54222
(and we should still make that enhancement).
Alive2 proofs:
https://alive2.llvm.org/ce/z/Q8drDq
https://alive2.llvm.org/ce/z/pE6LRt
I don't see a single conversion for all predicates
using "getFCmpCode" logic, so other predicates are
left as a TODO item.
gysit [Tue, 8 Mar 2022 17:30:06 +0000 (17:30 +0000)]
[mlir][OpDSL] Support pointwise ops with rank zero inputs.
Allow pointwise operations to take rank zero input tensors similarly to scalar inputs. Use an empty indexing map to broadcast rank zero tensors to the iteration domain of the operation.
Depends On D120734
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D120807
Philip Reames [Tue, 8 Mar 2022 17:38:01 +0000 (09:38 -0800)]
[MSSA] Add comments describing optimized uses for MemoryDefs [nfc]
As clarified by a recent email chain with Alina.
gysit [Tue, 8 Mar 2022 17:20:01 +0000 (17:20 +0000)]
[mlir][OpDSL] Remove unused SoftPlus2DOp operation.
The revision removes the SoftPlus2DOp operation that previously served as a test operation. It has been replaced by the elemwise_unary operation, which is now used to test unary log and exp functions.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D120794
Andrzej Warzynski [Tue, 8 Mar 2022 15:19:36 +0000 (15:19 +0000)]
[flang][nfc] Update the CMake dependencies for `flangFrontend`
The "FrontendActions.cpp" file (which is one of the source files for the
`flangFrontend` library) includes "Passes.h.inc" (indirectly, via
"CLOptions.inc"). This file is generated alongside other TableGen
outputs from the `FIROptTransformsPassIncGen` CMake target. This patch
adds `FIROptTransformsPassIncGen` to the list of build dependencies for
`flangFrontend`.
The lack of this dependency might cause non-determinstic build failures,
e.g. https://lab.llvm.org/buildbot/#/builders/160/builds/6210.
Differential Revision: https://reviews.llvm.org/D121218
Amir Ayupov [Tue, 8 Mar 2022 17:12:19 +0000 (09:12 -0800)]
[BOLT][NFC] Check section contents before registering it
Address fuzzer crash on malformed input:
```
BOLT-ERROR: cannot get section contents for .dynsym: The end of the file was unexpectedly encountered.
```
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D121068
gysit [Tue, 8 Mar 2022 17:06:50 +0000 (17:06 +0000)]
[mlir][OpDSL] Simplify index and constant tests.
Simplify tests that use `linalg.fill_rng_2d` to focus on testing the `const` and `index` functions. Additionally, cleanup emit_misc.py to use simpler test functions and fix an error message in config.py.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D120734
Arnold Schwaighofer [Tue, 8 Mar 2022 15:19:58 +0000 (07:19 -0800)]
InstCombine: Can't fold a phi arg load into the phi if the load is from a swifterror address
`swifterror` addresses are only allowed as operands to load, store, and
calls.
The following transformation is not allowed. It would create a phi with a
`swifterror` address operand.
```
%addr = alloca swifterror i8*
br %cond, label %bb1, label %b22
bb1:
%val1 = load i8*, i8** %addr
br exit
bb2:
%val2 = load i8*, i8** %addr
br exit
exit:
%val = phi [%val1, %bb1] [%val2, %bb2]
```
=>
```
%addr = alloca swifterror i8*
br %cond, label %bb1, label %b22
bb1:
br exit
bb2:
br exit
exit:
%val_addr = phi [%addr, %bb1] [%addr, %bb2]
%val2 = load i8*, i8** %val_addr
```
rdar://
89865485
Differential Revision: https://reviews.llvm.org/D121217
Hongtao Yu [Mon, 28 Feb 2022 19:28:31 +0000 (11:28 -0800)]
[CSSPGO][SCCIterator] Fix a non-determinism in scc_member_iterator
Previously we initialed the work queue with MST roots based on NodeInfoMap which is an unordered map. This could cause a non-determinism. I'm fixing this by initializing the queue based on SortedEdges.
I don't see any performance move with this change. However this helps debugging.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D120670
Hongtao Yu [Mon, 7 Mar 2022 19:41:11 +0000 (11:41 -0800)]
[llvm-profgen] Turn on CS nested profile generation by default for CSSPGO.
CS nested profile has a benefit over the CS flat profile that is to speed up the build while achieve an on-par performance. I'm turning it on by default for CSSPGO.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D121142
Masoud Ataei [Tue, 8 Mar 2022 16:59:17 +0000 (08:59 -0800)]
[PowerPC] Fix the none tail call in scalar MASS conversion
This patch is proposing a fix for patch https://reviews.llvm.org/D101759
on none tail call math function conversion to MASS call.
Differential: https://reviews.llvm.org/D121016
reviewer: @nemanjai
Fraser Cormack [Tue, 8 Mar 2022 16:21:33 +0000 (16:21 +0000)]
[SelectionDAG][NFC] Address a few clang-tidy warnings
Fix a couple of else-after-return warnings and some unnecessary
parentheses.
gysit [Tue, 8 Mar 2022 15:56:40 +0000 (15:56 +0000)]
[mlir][OpDSL] Add support for adding canonicalization patterns.
Extend OpDSL with a `defines` method that can set the `hasCanonicalizer` flag for an OpDSL operation. If the flag is set via `defines(Canonicalizer)` the operation needs to implement the `getCanonicalizationPatterns` method. The revision specifies the flag for linalg.fill_tensor and adds an empty `FillTensorOp::getCanonicalizationPatterns` implementation.
This revision is a preparation step to replace linalg.fill by its OpDSL counterpart linalg.fill_tensor. The two are only functionally equivalent if both specify the same canonicalization patterns. The revision is thus a prerequisite for the linalg.fill replacement.
Depends On D120725
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D120726
gysit [Tue, 8 Mar 2022 15:50:11 +0000 (15:50 +0000)]
[mlir][linalg] Add returning rewrite method to fusion pattern (NFC).
Enhance `LinalgTileAndFuseTensorOpsPattern` with an additional rewrite signature that returns the result of the rewrite.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D121212
gysit [Tue, 8 Mar 2022 15:33:47 +0000 (15:33 +0000)]
[mlir][linalg] Add a FillOpInterface.
Add a FillOpInterface similar to the contraction and convolution op interfaces. The FillOpInterface is a preparation step to replace linalg.fill by its OpDSL version linalg.fill_tensor. The interface implements the `value()`, `output()`, and `result()` methods that by default are not available on linalg.fill_tensor.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D120725
Louis Dionne [Mon, 7 Mar 2022 16:31:45 +0000 (11:31 -0500)]
[libc++] Remove workarounds for re-defining _LIBCPP_ASSERT in the test suite
As a fly-by fix, enable the complexity-changing assertions in __debug_less
only when the full debug mode is enabled, since debugging level 0 is usually
understood to only contain basic assertions that do not change the complexity
of algorithms.
Differential Revision: https://reviews.llvm.org/D121129
Aaron Ballman [Tue, 8 Mar 2022 15:09:16 +0000 (10:09 -0500)]
Properly diagnose constant evaluation issues at TU scope
We were not creating an evaluation context for the TU scope, so we
never popped an evaluation context for it. Popping the evaluation
context triggers a number of diagnostics, including warnings about
immediate invocations that we were previously missing.
Note: I think we have an additional issue that we should solve, but not
as part of this patch. I don't think Clang is properly modeling static
initialization as happening before constant expression evaluation. I
think structure members members are zero initialized per
http://eel.is/c++draft/basic.start.static#1,
https://eel.is/c++draft/basic.start.static#2.sentence-2, and
http://eel.is/c++draft/dcl.init#general-6.2 and the new test case
actually should be accepted. However, it's also worth noting that other
compilers behave the way this patch makes Clang behave:
https://godbolt.org/z/T7noqhdPr
Timm Bäder [Tue, 8 Mar 2022 13:21:37 +0000 (14:21 +0100)]
[clang][driver] Fix float128 diagnostics with glibc >= 2.32
Fix checking for an unsupported stdlib++.
Differential Revision: https://reviews.llvm.org/D121209
Sanjay Patel [Mon, 7 Mar 2022 22:02:05 +0000 (17:02 -0500)]
[InstCombine] add tests for fcmp (fpext X), C; NFC
Nathan Sidwell [Tue, 18 Jan 2022 15:14:08 +0000 (07:14 -0800)]
[clang][ABI] New C++20 module mangling scheme
The existing module symbol mangling scheme turns out to be
undemangleable. It is also desirable to switch to the
strong-ownership model as the hoped-for C++17 compatibility turns out
to be fragile, and we also now have a better way of controlling that.
The issue is captured on the ABI list at:
https://github.com/itanium-cxx-abi/cxx-abi/issues/134
A document describing the issues and new mangling is at:
https://drive.google.com/file/d/1qQjqptzOFT_lfXH8L6-iD9nCRi34wjft/view
This patch is the code-generation part. I have a demangler too, but
that patch is based on some to-be-landed refactoring of the demangler.
The old mangling is unceremoniously dropped. No backwards
compatibility, no deprectated old-mangling flag. It was always
labelled experimental. (Old and new manglings cannot be confused.)
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D118352
Jez Ng [Tue, 8 Mar 2022 13:25:59 +0000 (08:25 -0500)]
[lld-macho] Deduplicate the `__objc_classrefs` section contents
ld64 breaks down `__objc_classrefs` on a per-word level and deduplicates
them. This greatly reduces the number of bind entries emitted (and
therefore the amount of work `dyld` has to do at runtime). For
chromium_framework, this change to LLD cuts the number of (non-lazy)
binds from 912 to 190, getting us to parity with ld64 in this aspect.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D121053
Jez Ng [Tue, 8 Mar 2022 13:25:56 +0000 (08:25 -0500)]
[lld-macho] Deduplicate CFStrings during ICF
`__cfstring` has embedded addends that foil ICF's hashing / equality
checks. (We can ignore embedded addends when doing ICF because the same
information gets recorded in our Reloc structs.) Therefore, in order to
properly dedup CFStrings, we create a mutable copy of the CFString and
zero out the embedded addends before performing any hashing / equality
checks.
(We did in fact have a partial implementation of CFString deduplication
already. However, it only worked when the cstrings they point to are at
identical offsets in their object files.)
I anticipate this approach can be extended to other similar
statically-allocated struct sections in the future.
In addition, we previously treated all references with differing addends
as unequal. This is not true when the references are to literals:
different addends may point to the same literal in the output binary. In
particular, `__cfstring` has such references to `__cstring`. I've
adjusted ICF's `equalsConstant` logic accordingly, and I've added a few
more tests to make sure the addend-comparison code path is adequately
covered.
Fixes https://github.com/llvm/llvm-project/issues/51281.
Reviewed By: #lld-macho, Roger
Differential Revision: https://reviews.llvm.org/D120137
Simon Pilgrim [Tue, 8 Mar 2022 13:31:17 +0000 (13:31 +0000)]
[X86] convertIntLogicToFPLogic - pull out condcodes. NFCI.
Nikolas Klauser [Thu, 3 Mar 2022 19:07:09 +0000 (20:07 +0100)]
[libc++] Enable more clang-tidy checks and list potential candidates
These are some checks that make sense in libc++ IMO. The checks after `#TODO: investigate these checks` are candidates, but they can't be enabled without some cleanup.
Reviewed By: ldionne, #libc
Spies: aheejin, libcxx-commits
Differential Revision: https://reviews.llvm.org/D120925