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
Daniel Cederman [Tue, 8 Mar 2022 11:20:33 +0000 (12:20 +0100)]
[Sparc] Add tail call support
This patch adds tail call support to the 32-bit Sparc backend.
Two new instructions are defined, TAIL_CALL and TAIL_CALLri. They are
encoded the same as CALL and BINDri, but are marked with isReturn so
that the epilogue gets emitted. In contrast to CALL, TAIL_CALL is not
marked with isCall. This makes it possible to use the leaf function
optimization when the only call a function makes is a tail call.
TAIL_CALL modifies the return address in %o7, so for leaf functions
the value in %o7 needs to be restored after the call. For normal
functions which uses the restore instruction this is not necessary.
Reviewed By: koakuma
Differential Revision: https://reviews.llvm.org/D51206
Kirill Bobyrev [Tue, 8 Mar 2022 12:42:50 +0000 (13:42 +0100)]
[clangd] NFC: Cleanup IncludeCleaner API
Make a further improvement to decrease verbosity of the API: ASTContext
provides SourceManager access.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D119842
Marek Kurdej [Mon, 7 Mar 2022 17:48:24 +0000 (18:48 +0100)]
[clang-format] Correctly detect `!` as TT_NonNullAssertion after `default`.
Fixes https://github.com/llvm/llvm-project/issues/53153.
Depends on D121132.
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D121136
Marek Kurdej [Mon, 7 Mar 2022 17:28:32 +0000 (18:28 +0100)]
[clang-format] Handle C# 9 `init` accessor specifier.
Before, the code:
```
int Value { get; } = 0;
int Value { init; } = 0;
```
was formatted incoherently:
```
int Value { get; } = 0;
int Value { init; }
= 0;
```
because `init` was not recognised as an accessor specifier.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D121132
Christian Sigg [Tue, 8 Mar 2022 11:59:42 +0000 (12:59 +0100)]
Update more `parseSourceString()` call sites.
Change to non-deprecated function template (see D121075).
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D121102
Lorenzo Chelini [Tue, 8 Mar 2022 11:16:00 +0000 (12:16 +0100)]
[MLIR][Presburger] Silence warnings in GCC (NFC)
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D121205
Simon Pilgrim [Tue, 8 Mar 2022 11:20:44 +0000 (11:20 +0000)]
[X86] Add add / mul identity select tests for D119654
Adrian Kuegel [Tue, 8 Mar 2022 11:26:02 +0000 (12:26 +0100)]
[clang] Fix reference to file that was moved.
Florian Hahn [Tue, 8 Mar 2022 11:11:03 +0000 (11:11 +0000)]
[AArch64] Add test for D120481 with multiple uses.
Krystian Kuzniarek [Tue, 8 Mar 2022 11:06:18 +0000 (11:06 +0000)]
[AST] Fix typo in assert messages
Differential Revision: https://reviews.llvm.org/D120221
Matthias Springer [Tue, 8 Mar 2022 10:39:18 +0000 (19:39 +0900)]
[mlir][bufferize][NFC] Better error messages if analysis fails
Differential Revision: https://reviews.llvm.org/D121203
Luo, Yuanke [Tue, 8 Mar 2022 09:46:54 +0000 (17:46 +0800)]
[X86] Update avx512vbmi2 intrinsic tests to avoid adds
As noticed in D119654, by adding the masked intrinsics results together
we can end up with the selects being canonicalized away from the
intrinsic - this isn't what we want to test here so replace with a
insertvalue chain into a aggregate instead to retain all the results.
Differential Revision: https://reviews.llvm.org/D121196
Dmitry Vyukov [Mon, 7 Mar 2022 19:30:38 +0000 (20:30 +0100)]
tsan: fix false positive during fd close
FdClose is a subjet to the same atomicity problem as MemoryRangeFreed
(memory state is not "monotoic" wrt race detection).
So we need to lock the thread slot in FdClose the same way we do
in MemoryRangeFreed.
This fixes the modified stress.cpp test.
Reviewed By: vitalybuka, melver
Differential Revision: https://reviews.llvm.org/D121143
Muhammad Omair Javaid [Tue, 8 Mar 2022 09:13:25 +0000 (14:13 +0500)]
[LLDB] Skip TestIOHandlerProcessSTDIO.py for Arm/AArch64 Linux
This patch disables TestIOHandlerProcessSTDIO.py for Arm/AArch64 Linux
to silence random test failures on buildbots. IO handler tests are known
to randomly fail on arm/aarch64 linux buildbots due to pexpect timeouts.
Javier Setoain [Thu, 24 Feb 2022 14:50:26 +0000 (14:50 +0000)]
[mlir][Vector] Use create_mask in transfer mask materializations
Currently, the transfer mask is materialized by generating the vector
comparison: [offset + 0, .., offset + length - 1] < [dim, .., dim]
A better alternative is to materialize the transfer mask by using the
operation: `vector.create_mask (dim - offset)`, which will generate
simpler code and compose better with scalable vectors.
Differential Revision: https://reviews.llvm.org/D120487
Argyrios Kyrtzidis [Wed, 23 Feb 2022 19:59:27 +0000 (11:59 -0800)]
[Sema] Mark the referenced destructor during transformation of a `CXXBindTemporaryExpr`
Otherwise we will fail to generate the definition of a defaulted destructor,
if the only reference was in a templated temporary.
rdar://
89366678
Differential Revision: https://reviews.llvm.org/D120426
Groverkss [Tue, 8 Mar 2022 08:50:52 +0000 (14:20 +0530)]
[MLIR][Presburger] Move PresburgerLocalSpace::isEqual from protected to public
This change is done to match the interface of PresburgerSpace, which has
PresburgerSpace::isEqual as public.
Luo, Yuanke [Tue, 8 Mar 2022 08:35:15 +0000 (16:35 +0800)]
[X86] Update avx512vbmi2 intrinsic tests to avoid adds
As noticed in D119654, by adding the masked intrinsics results together
we can end up with the selects being canonicalized away from the
intrinsic - this isn't what we want to test here so replace with a
insertvalue chain into a aggregate instead to retain all the results.
Differential Revision: https://reviews.llvm.org/D121188
River Riddle [Tue, 8 Mar 2022 08:03:27 +0000 (00:03 -0800)]
[mlir][NFC] Properly include PassDetail.h for FoldSubViewOpsPass
River Riddle [Tue, 8 Mar 2022 08:01:41 +0000 (00:01 -0800)]
[mlir][NFC] Remove dead forward declaration of FuncOp
Adrian Kuegel [Tue, 8 Mar 2022 07:55:55 +0000 (08:55 +0100)]
[mlir][Bazel] Adjust regarding StandardToLLVM -> FuncToLLVM rename.
Differential Revision: https://reviews.llvm.org/D121185
Petr Hosek [Tue, 8 Mar 2022 07:59:29 +0000 (23:59 -0800)]
Revert "[CMake][compiler-rt] Make CRT separately buildable"
This reverts commit
ed28461e2716fda004f4f55654ef33bc8c78f203 since
it broke the VE bot.
Arthur Eubanks [Mon, 7 Mar 2022 18:17:09 +0000 (10:17 -0800)]
[NewPM][Inliner] Make inlined calls to functions in same SCC as callee exponentially expensive
Introduce a new attribute "function-inline-cost-multiplier" which
multiplies the inline cost of a call site (or all calls to a callee) by
the multiplier.
When processing the list of calls created by inlining, check each call
to see if the new call's callee is in the same SCC as the original
callee. If so, set the "function-inline-cost-multiplier" attribute of
the new call site to double the original call site's attribute value.
This does not happen when the original call site is intra-SCC.
This is an alternative to D120584, which marks the call sites as
noinline.
Hopefully fixes PR45253.
Reviewed By: davidxl
Differential Revision: https://reviews.llvm.org/D121084
Lorenzo Chelini [Tue, 8 Mar 2022 07:30:20 +0000 (08:30 +0100)]
[MLIR][OpDSL] Silence warning (NFC)
Stanislav Mekhanoshin [Mon, 7 Mar 2022 23:53:16 +0000 (15:53 -0800)]
[AMDGPU] Set noclobber metadata on loads instead of cast to constant
A load via pointer cast to constant will return true from
pointsToConstantMemory which is not necessarily so.
Fixes: SWDEV-326463
Differential Revision: https://reviews.llvm.org/D121172
Petr Hosek [Mon, 28 Feb 2022 20:21:11 +0000 (12:21 -0800)]
[CMake][compiler-rt] Make CRT separately buildable
This is useful when building a complete toolchain to ensure that CRT
is built after builtins but before the rest of the compiler-rt.
Differential Revision: https://reviews.llvm.org/D120682
Zi Xuan Wu [Mon, 7 Mar 2022 10:28:13 +0000 (18:28 +0800)]
[CSKY] Enable TargetAsmStreamer/ELFStreamer and support asm directive of csky_attribute
Add support of parsing .csky_attribute directive and emit related target attributes in .csky.attribute section.
It does not emit attribute directive in assembly code, so only emit target attributes in ELF streamer.
In ELF streamer, it handles the header EFlag and the csky_attribute section which contains some attribute items.
The EFlag and attribute items are calculated from feature bits based on Subtarget.
Yuanfang Chen [Mon, 7 Mar 2022 20:42:09 +0000 (12:42 -0800)]
Reland "[clang][debug] port clang-cl /JMC flag to ELF"
This relands commit
731347431976509823e38329a96fcbc69fe98cd2.
It failed on Windows/Mac because `-fjmc` is only checked for ELF targets.
Check the flag unconditionally instead and issue a warning for non-ELF targets.
Valentin Clement [Tue, 8 Mar 2022 05:51:10 +0000 (06:51 +0100)]
[flang] Remove unused variable in Allocatable.cpp
Fix for buildbot failure: https://lab.llvm.org/buildbot/#/builders/180/builds/3532
Johannes Doerfert [Fri, 25 Feb 2022 00:50:37 +0000 (18:50 -0600)]
[OpenMP][FIX] Ensure flag to disable de-globalization works properly
If the user disables de-globalization we did not seed the AAHeapToShared
and AAHeapToStack but we still could end up with them through in-flight
lookups. With this patch we disable AAHeapToShared completely if the
user disabled de-globalization. Heap-2-stack is still run though.
Differential Revision: https://reviews.llvm.org/D121059
Johannes Doerfert [Fri, 18 Feb 2022 17:49:00 +0000 (11:49 -0600)]
[OpenMP][CUDA] Use one event pool per device
An event pool, similar to the stream pool, needs to be kept per device.
For one, events are associated with cuda contexts which means we cannot
destroy the former after the latter. Also, CUDA documentation states
streams and events need to be associated with the same context, which
we did not ensure at all.
Differential Revision: https://reviews.llvm.org/D120142
Johannes Doerfert [Thu, 17 Feb 2022 22:04:12 +0000 (16:04 -0600)]
[OpenMP] Allow to explicitly deinitialize device resources
There are two problems this patch tries to address:
1) We currently free resources in a random order wrt. plugin and
libomptarget destruction. This patch should ensure the CUDA plugin
is less fragile if something during the deinitialization goes wrong.
2) We need to support (hard) pause runtime calls eventually. This patch
allows us to free all associated resources, though we cannot
reinitialize the device yet.
Follow up patch will associate one event pool per device/context.
Differential Revision: https://reviews.llvm.org/D120089
Johannes Doerfert [Wed, 2 Mar 2022 19:34:24 +0000 (13:34 -0600)]
[OpenMP][NFCI] Use RAII lock guards in libomptarget where possible
Differential Revision: https://reviews.llvm.org/D121060
Uday Bondhugula [Mon, 7 Mar 2022 23:42:54 +0000 (05:12 +0530)]
NFC. Improve isInnermostAffineForOp - drop unnecessary check
Rewrite isInnermostAffineForOp utility to make it more direct/efficient.
Drop unnecessary check. NFC.
Differential Revision: https://reviews.llvm.org/D121170
Shao-Ce SUN [Tue, 8 Mar 2022 04:43:33 +0000 (12:43 +0800)]
[RISCV] Share PatFprFpr classes for F, D, and Zfh
Inspired by D115469
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D121066
Lang Hames [Tue, 8 Mar 2022 04:37:33 +0000 (20:37 -0800)]
[ORC][JITLink] Fix MachO absolute symbol handling, add test case.
This patch removes the unintended resolution of locally scoped absolute symbols
(which was causing unexpected definition errors).
It stops using the JITSymbolFlags::Absolute flag (it isn't set or used elsewhere,
and causes mismatch-flags asserts), and adds JITSymbolFlags::Exported to default
scoped absolute symbols.
Finally, we now set the scope of absolute symbols correctly in
MachOLinkGraphBuilder.