Commit Graph

421848 Commits

Author SHA1 Message Date
Biplob Mishra 237c4bada9 InstCombine: Add tests to show or-and scenarios which can be possibly be combined by ORing the masks 2022-04-22 15:23:57 +01:00
Paul Walker 3c382ed71f [AArch64][SVE] Remove BIC from logical operation DestructiveBinaryComm patterns
This reverts part of https://reviews.llvm.org/D124224 that causes
an assert because the register allocator triggers a pathological
situation where there's no safe way to insert a zeroing MOVPFRX
instruction.
2022-04-22 15:07:55 +01:00
Nikita Popov 074abdcc60 [InstCombine] Add tests for and of icmp ne zero and icmp uge (NFC)
Partially based on the conjugated or tests.
2022-04-22 15:53:33 +02:00
Nico Weber 9c00e3d49e [lld/win] Mention in release notes that /winsysroot: currently requires /machine:
Differential Revision: https://reviews.llvm.org/D124254
2022-04-22 09:40:39 -04:00
Iain Sandoe 4c4ff004a2 [C++20][Modules][Driver][HU 2/N] Add fmodule-header, fmodule-header=
These command-line flags are alternates to providing the -x
c++-*-header indicators that we are building a header unit.

Act on fmodule-header= for headers on the c/l:

If we have x.hh -fmodule-header, then we should treat that header
as a header unit input (equivalent to -xc++-header-unit-header x.hh).

Likewise, for fmodule-header={user,system} the source should be now
recognised as a header unit input (since this can affect the job list
that we need).

It's not practical to recognise a header without any suffix so
-fmodule-header=system foo isn't going to happen. Although
-fmodule-header=system foo.hh will work OK.  However we can make it
work if the user indicates that the item without a suffix is a valid
header. (so -fmodule-header=system -xc++-header vector)

Differential Revision: https://reviews.llvm.org/D121589
2022-04-22 14:14:19 +01:00
Lei Zhang fc760c0260 [mlir][vector] Fold cancelling vector.shape_cast(vector.broadcast)
vector.broadcast can inject all size one dimensions. If it's
followed by a vector.shape_cast to the original type, we can
cancel the op pair, like cancelling consecutive shape_cast ops.

Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D124094
2022-04-22 08:58:26 -04:00
Byoungchan Lee f69328049e [cc1as] Add support for emitting the build version load command for -darwin-target-variant
This patch extends cc1as to export the build version load command with
LC_VERSION_MIN_MACOSX.
This is especially important for Mac Catalyst as Mac Catalyst uses
the MacOS's compiler rt built-ins.

Differential Revision: https://reviews.llvm.org/D121868
2022-04-22 08:38:07 -04:00
zhongyunde e1afae0311 [AArch64][SVE] Add some logical operation DestructiveBinaryComm patterns
Add DestructiveBinaryComm* patterns for ORR, EOR, AND and BIC.
The above instructions requires that the source and destination registers are
equal, so use movprfx should be beneficial to performance.
note: BIC (i.e. A & ~B) is not a commutative operation.

Reviewed By: paulwalker-arm, david-arm

Differential Revision: https://reviews.llvm.org/D124224
2022-04-22 20:31:00 +08:00
Vasileios Porpodas ad12f468a3 [SLP][AArch64][NFC] Add test for a follow-up patch that fixes the lookahead cost of splat-loads for AArch64 2022-04-22 05:29:34 -07:00
Haojian Wu 864752cfeb [AST] QualifiedTemplateName::getTemplateDecl cleanup.
This is a followup cleanup of 1234b1c6d8

Differential Revision: https://reviews.llvm.org/D124238
2022-04-22 14:28:48 +02:00
Nico Weber 8dbc6b5600 Revert "[randstruct] Check final randomized layout ordering"
This reverts commit a7815d33bf.
Test fails on Windows, see comments on https://reviews.llvm.org/D124199
2022-04-22 08:27:32 -04:00
Matthias Springer 494505f39f [mlir][bufferize][NFC] Move SCF test cases to SCF dialect
Differential Revision: https://reviews.llvm.org/D124249
2022-04-22 20:35:20 +09:00
Daniel Kiss de07cde67b [AArch64] Emit .cfi_negate_ra_state for PAC-auth instructions.
autiasp, autibsp instructions are the counterpart of paciasp/pacibsp instructions
therefore let's emit .cfi_negate_ra_state for these too.
In case of Armv8.3 instruction set the retaa/retbb will do the return and authentication
in one step here we can't emit the . cfi_negate_ra_state because that would be point after
the ret* instruction.

Reviewed By: nickdesaulniers, MaskRay

Differential Revision: https://reviews.llvm.org/D111780
2022-04-22 13:25:57 +02:00
Ying Yi b09ba42620 Bug 51277: [DWARF] DW_AT_alignment incorrect when
attribute((__aligned__)) is present but ignored`

In the original code, the 'getDeclAlignIfRequired' function is used.
The 'getDeclAlignIfRequired' function will return the max alignment
of all aligned attributes if the type has aligned attributes. The
function doesn't consider the type at all.

The 'getTypeAlignIfRequired' function uses the type's alignment value,
which also used by the 'alignof' function. I think we should use the
function of 'getTypeAlignIfRequired'.

Reviewed By: dblaikie, jmorse, wolfgangp

Differential Revision: https://reviews.llvm.org/D124006
2022-04-22 12:15:00 +01:00
Nikita Popov ba46ae7bd8 [InstCombine] Merge foldAndOfICmps() and foldOrOfICmps() (NFCI)
Folds are supposed to always be added in conjugated pairs for and
and or. Merge the two functions to make folds for which this is
currently not the case more obvious.
2022-04-22 12:48:03 +02:00
Matthias Springer e07a7fd5c0 [mlir][bufferization] Move ModuleBufferization to bufferization dialect
* Move Module Bufferization to the bufferization dialect. The implementation is split into `OneShotModuleBufferize.cpp` and `FuncBufferizableOpInterfaceImpl.cpp`, so that the external model implementation can be easily moved to the func dialect in the future.
* Split and clean up test cases. A few test cases are still remaining in Linalg and will be updated separately.
* `linalg.inplaceable` is renamed to `bufferization.writable` to accurately reflect its current usage.
* Attributes and their verifiers are moved from the Linalg dialect to the Bufferization dialect.
* Expand documentation.
* Add a new flag to One-Shot Bufferize to allow for function boundary bufferization.

Differential Revision: https://reviews.llvm.org/D122229
2022-04-22 19:37:28 +09:00
Nikita Popov 3e1d2c352c [InstCombine] Fix or of commuted foldable predicates
1d90e53044 switch this code to store
the predicates and operands in variables, but retained a
swapOperands() call here. Thus the commuted cases were no longer
folded. Additionally, as the change was not reported, the next
InstCombine iteration would not pick it up either.
2022-04-22 12:31:26 +02:00
Nikita Popov 2b252c159f [InstCombine] Add commuted or of icmp test (NFC) 2022-04-22 12:28:12 +02:00
Matthias Springer bd1d87e3d1 [mlir][bufferization][NFC] Remove layout post processing step
The layout postprocessing step was removed and is now part of the FuncOp bufferization. If the user specified a certain layout map for a tensor function arg, use that layout map directly when bufferizing the function signature. Previously, the bufferization used a generic layout map for every tensor function arg and then updated function signatures and CallOps in a separate step.

Differential Revision: https://reviews.llvm.org/D122228
2022-04-22 18:49:47 +09:00
Matthias Springer 70777d967f [mlir][bufferize][NFC] Move FuncOp bufferization to BufferizableOpInterface impl
FuncOps are now less special. They must still be analyzed + bufferized in a certain order, but they are now bufferized same as other ops that have a region: Bufferize the op first (`bufferize` interface method), then bufferize the region body with other bufferization patterns. In the case of FuncOps, the function signature is bufferized together with ReturnOps. Similar to how, e.g., scf.for ops are bufferized together with scf.yield ops.

This change is essentially a reimplementation of the FuncOp bufferization, but mostly NFC from a user's perspective (apart from error messages). This change is in preparation of moving the code to the bufferization dialect.

Differential Revision: https://reviews.llvm.org/D123214
2022-04-22 18:47:12 +09:00
Florian Hahn 85eb8b7244
[IndVars] Add test for crash exposed by D114650. 2022-04-22 10:44:29 +01:00
Matthias Springer d820acdde1 [mlir][bufferize][NFC] Use custom walk instead of GreedyPatternRewriter
The bufferization driver was previously using a GreedyPatternRewriter. This was problematic because bufferization must traverse ops top-to-bottom. The GreedyPatternRewriter was previously configured via `useTopDownTraversal`, but this was a hack; this API was just meant for performance improvements and should not affect the result of the rewrite.

BEGIN_PUBLIC
No public commit message needed.
END_PUBLIC

Differential Revision: https://reviews.llvm.org/D123618
2022-04-22 18:23:09 +09:00
jacquesguan 9b32886e7e [mlir][Arithmetic] Use common constant fold function in RemSI and RemUI to cover splat.
This patch replaces current fold function with the common constant fold funtion in order to cover the situation of constant splat.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D124236
2022-04-22 09:20:18 +00:00
Andrzej Warzynski 2186a4aea0 [flang] Make the plugin API independent of the driver internals
This patch adds a few new member methods in the `PluginParseTreeAction`
frontend action base class. With these new methods, the plugin API
becomes independent of the driver internals. In particular, plugin
writers no longer require the `CompilerInstance.h` header file to access
various driver data structures (instead, they can use newly added
hooks).

This change is desirable as `CompilerInstance.h` includes various
headers from Clang (both explicitly and implicitly). Some of these
header files are generated at build time (through TableGen) and
including them creates a dependency on some of Clang's build targets.
However, plugins in Flang should not depend on Clang build targets.

Note that plugins might still work fine most of the time, even without
this change and without adding Clang build targets as dependency in
plugin's CMake definition. Indeed, these Clang build targets are often
generated early in the build process. However, that's not guaranteed and
we did notice that on occasions plugins would fail to build.

Differential Revision: https://reviews.llvm.org/D120999
2022-04-22 09:18:04 +00:00
Nikita Popov e69c21f75b [InstCombine] Add test for atomic load from constant global (NFC) 2022-04-22 11:15:50 +02:00
jacquesguan abc17a6751 [mlir][Arithmetic] Use matchPattern to simplify code.
This patch replaces some code with matchPattern and move them before the constant folder function in order to avoid redundant invoking.

Differential Revision: https://reviews.llvm.org/D124235
2022-04-22 08:42:51 +00:00
David Green 091c2f953d [AArch64] Add some splat of load cost model tests. NFC
They do not work yet, but we can hopefully adjust the cost for them to
get them to be recognized
2022-04-22 09:38:06 +01:00
Adrian Kuegel a74e5a89b9 [mlir] Move isGuaranteedCollapsible to CollapseShapeOp (NFC).
It seems more natural than to have it as a static method of ExpandShapeOp.
Also fix a typo ("the the" -> "the").

Differential Revision: https://reviews.llvm.org/D124234
2022-04-22 10:31:25 +02:00
Abinav Puthan Purayil 561af89fed [AMDGPU] Use a wrapper multiclass for buffer atomic intrinsic patterns. NFC 2022-04-22 13:59:34 +05:30
Nikita Popov 993b166deb Reapply [SimplifyCFG] Handle branch on same condition in pred more directly
Reapplying without changes, after a fix to a dependent patch.

-----

Rather than creating a PHI node and then using the PHI threading
code, directly handle this case in
FoldCondBranchOnValueKnownInPredecessor().

This change is supposed to be NFC-ish, but may cause changes due
to different transform order.
2022-04-22 10:27:38 +02:00
Iain Sandoe 5c6a146498 [C++20][Modules][Driver][HU 1/N] Initial handling for -xc++-{system,user}-header.
This adds file types and handling for three input types, representing a C++20
header unit source:

 1. When provided with a complete pathname for the header.
 2. For a header to be looked up (by the frontend) in the user search paths
 3. For a header to be looked up in the system search paths.

We also add a pre-processed file type (although that is a single type, regardless
of the original input type).

These types may be specified with -xc++-{user,system,header-unit}-header xxxx.

These types allow us to disambiguate header unit jobs from PCH ones, and thus
we handle these differently from other header jobs in two ways:

 1. The job construction is altered to build a C++20 header unit (rather than a
    PCH file, as would be the case for other headers).
 2. When the type is "user" or "system" we defer checking for the file until the
    front end is run, since we need to look up the header in the relevant paths
    which are not known at this point.

Differential Revision: https://reviews.llvm.org/D121588
2022-04-22 09:24:29 +01:00
Siva Chandra Reddy 19a6dd33ee [libc] Add the implementation of the GNU extension function fopencookie.
Reviewed By: lntue, michaelrj

Differential Revision: https://reviews.llvm.org/D124141
2022-04-22 08:02:25 +00:00
Nikita Popov df18e37541 Reapply [SimplifyCFG] Make FoldCondBranchOnPHI more amenable to extension (NFCI)
Reapply with SmallMapVector instead of SmallDenseMap, which should
address the non-determinism issue.

-----

This general threading transform can be performed whenever we know
a constant value for the condition in a predecessor, which would
currently just be the case of a phi node with constant arguments.
2022-04-22 09:42:11 +02:00
Jean Perier 6c81b4a01e [flang] Fold transformational bessels when host runtime has bessels
Transformational bessel intrinsic functions require the same math runtime
as elemental bessel intrinsics.

Currently elemental bessels could be folded if f18 was linked with pgmath
(cmake -DLIBPGMATH_DIR option). `j0`, `y0`, ... C libm functions were not
used because they are not standard C functions: they are Posix
extensions.

This patch enable:
- Using the Posix bessel host runtime functions when available.
- folding the transformational bessel using the elemental version.

Differential Revision: https://reviews.llvm.org/D124167
2022-04-22 09:37:49 +02:00
Fraser Cormack 9687ca970f [RISCV] Update test from SEW to Log2SEW
This test somehow slipped through the cracks during the time we switched
from encoding SEW to its log2 form.
2022-04-22 07:38:36 +01:00
Michael Liao 036aeac36c [Testing] Fix the shared build. NFC. 2022-04-22 02:46:54 -04:00
Brad Smith 7898c79b74 Fix test for c7ee0b8bda
OpenBSD/sparc is dead and support was removed awhile ago.
2022-04-22 02:27:10 -04:00
Abinav Puthan Purayil 272a876804 [AMDGPU] Rename the FlatSignedIntrPat multiclass to FlatSignedAtomicIntrPat. NFC 2022-04-22 11:47:23 +05:30
Mark Kettenis c7ee0b8bda [Clang] Fix the guaranteed alignment of memory returned by malloc/new on OpenBSD
The guaranteed alignment is 16 bytes on OpenBSD.
2022-04-22 02:03:55 -04:00
Jun Zhang 3b3dd76d8d
Use range based for loop in Sema::CheckParameterPacksForExpansion. NFC
Signed-off-by: Jun Zhang <jun@junz.org>
2022-04-22 13:31:31 +08:00
wangpc 5c3ea07848 [RISCV] Do not outline CFI instructions when they are needed in EH
We saw a failure caused by unwinding with incomplete CFIs, so we
can't outline CFI instructions when they are needed in EH.

This is a recommit of 0d40688, which was reverted in ce83883 as
related precommit test 360d44e caused some errors.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D122634
2022-04-22 12:28:19 +08:00
wangpc 6ee890b79e [RISCV] Precommit test for D122634
This is a recommit of 360d44e, which was reverted
in b1620d4 because it caused some errors due to no
`nounwind` attrs in `machine-outliner-cfi.mir`.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D123364
2022-04-22 12:19:55 +08:00
Abinav Puthan Purayil 2147b6c89d [AMDGPU] Remove no-ret atomic ops selection in the post-isel hook
No-ret atomic ops are now selected in tblgen.

Differential Revision: https://reviews.llvm.org/D124086
2022-04-22 09:37:41 +05:30
Abinav Puthan Purayil 165ae7276c [AMDGPU] Remove atomic pattern args in FLAT_[Global_]Atomic_Pseudo defs
We already have explicit patterns for these.

Differential Revision: https://reviews.llvm.org/D124084
2022-04-22 09:37:40 +05:30
Abinav Puthan Purayil f935908d7b [AMDGPU] Select no-return DS_PK_ADD_F16 in tblgen
Differential Revision: https://reviews.llvm.org/D123584
2022-04-22 09:37:40 +05:30
Abinav Puthan Purayil 45ca94334e [AMDGPU] Select no-return atomic intrinsics in tblgen
This is to avoid relying on the post-isel hook.

This change also enable the saddr pattern selection for atomic
intrinsics in GlobalISel.

Differential Revision: https://reviews.llvm.org/D123583
2022-04-22 09:37:40 +05:30
Fangrui Song ed58a01f66 [tsan][test] Change -tsan to -passes=tsan 2022-04-21 20:44:56 -07:00
Xiang1 Zhang afa536e33e [x86] Support 3 builtin functions for 32-bits mode
_mm_cvtsi128_si64, _mm_cvtsi64_si128, _mm_extract_epi64

Reviewed By:RKSimon, Topper Craig
Differential Revision: https://reviews.llvm.org/D124067
2022-04-22 11:28:28 +08:00
Ping Deng 7493d9ffb6 [RISCV][NFC] Use defvar to simplify pattern definations.
Reviewed By: jacquesguan, frasercrmck

Differential Revision: https://reviews.llvm.org/D123839
2022-04-22 02:45:14 +00:00
Bill Wendling a7815d33bf [randstruct] Check final randomized layout ordering
This uses "llvm::shuffle" to stop differences in shuffle ordering on
different platforms.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D124199
2022-04-21 19:41:00 -07:00