Commit Graph

417588 Commits

Author SHA1 Message Date
Bixia Zheng 13d3307176 [mlir][linalg] Add a few unary operations.
Add operations abs, ceil, floor, and neg to the C++ API and Python API.

Add test cases.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D121339
2022-03-10 09:38:58 -08:00
Shraiysh Vaishay e0f549a43a [flang] Added basic connect to lower OpenMP constructs
Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D121382
2022-03-10 22:48:25 +05:30
Valentin Clement 589d51ea9f
[flang] Lower basic derived types
This patch lowers basic derived type to FIR.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D121383

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-10 18:07:20 +01:00
Groverkss 58966dd42b [MLIR][Presburger] Remove `spaceKind` from PresburgerSpace
This patch remove `spaceKind` from PresburgerSpace, making PresburgerSpace only
a space supporting relations.

Sets are still implemented in the same way, i.e. with a zero domain but instead
the asserts to check if the space is still set are added to users of
PresburgerSpace which treat it as a Set space.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D121357
2022-03-10 22:20:44 +05:30
Vladislav Khmelevsky 04b87cf0e7 [BOLT] LongJmp: Use per-function alignment values
The per-function alignment values must be used in order to create
tentative layout.

Differential Revision: https://reviews.llvm.org/D121298
2022-03-10 19:48:48 +03:00
Emilio Cota b24de9f684 [mlir] ExecutionEngine: default enableObjectCache to false
The enableObjectCache option was added in
https://reviews.llvm.org/rG06e8101034e, defaulting to false. However,
the init code added there got its logic reversed
(cache(enableObjectCache ? nullptr : new SimpleObjectCache()), which was
fixed in https://reviews.llvm.org/rGd1186fcb04 by setting the default to
true, thereby preserving the existing behavior even if it was
unintentional.

Default now the object cache to false as it was originally intended.
While at it, mention in enableObjectCache's documentation how the
cache can be dumped.

Reviewed-by: mehdi_amini
Differential Revision: https://reviews.llvm.org/D121291
2022-03-10 11:24:48 -05:00
serge-sans-paille f06d487dd6 Cleanup includes: WindowsDriver & WindowsManifest
Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D121330
2022-03-10 17:19:06 +01:00
Dmitry Vyukov 66298e1c54 tsan: fix another false positive related to open/close
The false positive fixed by commit f831d6fc80
("tsan: fix false positive during fd close") still happens episodically
on the added more stressful test which does just open/close.

I don't have a coherent explanation as to what exactly happens
but the fix fixes the false positive on this test as well.
The issue may be related to lost writes during asynchronous MADV_DONTNEED.
I've debugged similar unexplainable false positive related to freed and
reused memory and at the time the only possible explanation I found is that
an asynchronous MADV_DONTNEED may lead to lost writes. That's why commit
302ec7b9bc ("tsan: add memory_limit_mb flag") added StopTheWorld around
the memory flush, but unfortunately the commit does not capture these findings.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D121363
2022-03-10 17:02:51 +01:00
Shraiysh Vaishay a1ac771247 [MLIR][OpenMP][NFC] Move the modifier testcases to correct directory
This patch moves the testcases from
`mlir/test/Target/LLVMIR/openmp-llvm-bad-schedule-modifier.mlir` to
`mlir/test/Dialect/OpenMP/invalid.mlir` as they test the verifier
(not the translation to LLVM IR).

Reviewed By: NimishMishra

Differential Revision: https://reviews.llvm.org/D120877
2022-03-10 21:32:00 +05:30
John Demme cb318526b0 [MLIR] [CMake/Python] Fix ignored Python3_EXECUTABLE
On Windows (at least), cmake ignores Python3_EXECUTABLE unless the
'Interpreter' component is being found. If the user is specifying a
different version than the latest installed (say, 3.8 vs 3.9) with the
Python3_EXECUTABLE, cmake was using a combination of the newest version
and the desired version. Mitigated by adding 'Interpreter' in the first
invocation like the second one.
2022-03-10 07:43:43 -08:00
Sanjay Patel 9fac110bf7 Revert "[InstCombine] fold fcmp with lossy casted constant"
This reverts commit 9397bdc67e.

This optimization is likely to surprise programmers as seen
in post-commit comments, so we should add a clang warning
first (that is proposed in D121306).
2022-03-10 10:22:22 -05:00
David Green 4899e2cab4 [AArch64] Fix type in comment. NFC 2022-03-10 15:03:27 +00:00
Nikita Popov 067c035012 [GlobalOpt] Handle undef global_ctors gracefully
If there are no ctors, then this can have an arbirary zero-sized
value. The current code checks for null, but it could also be
undef or poison.

Replacing the specific null check with a check for
non-ConstantArray.
2022-03-10 16:02:12 +01:00
Nikita Popov 22f9159bed [BitcodeReader] Support GEP without indices
LLVM considers these to be legal, so make sure the bitcode reader
can read them. I broke this when implementing opaque pointer
auto upgrade support.
2022-03-10 15:48:47 +01:00
David Green 21a97a2ac1 [AArch64] TBL uses zero for out of range elements.
A TBL instruction will use zero for any out of range values. We can use
this in GenerateTBL to help turn a TBL2 into a TBL1, avoiding the need
to materialise the zero.

Differential Revision: https://reviews.llvm.org/D121139
2022-03-10 14:45:13 +00:00
Tue Ly 0f031daea8 [libc] Initial support for darwin-aarch64.
Add initial support for darwin-aarch64 (macOS M1).

Some differences compared to linux-aarch64:
- `math.h` defined `math_errhandling` by the compiler builtin `__math_errhandling()` but Apple Clang 13.0.0 on M1 does not support `__math_errhandling()` builtin as a macro function or a constexpr function.
- `math.h` defines `UNDERFLOW` and `OVERFLOW` macros.
- Besides 5 usual floating point exceptions: `FE_INEXACT`, `FE_UNDERFLOW`, `FE_OVERFLOW`, `FE_DIVBYZERO`, and `FE_INVALID`, `fenv.h` also has another floating point exception: `FE_FLUSHTOZERO`.  The corresponding trap for `FE_FLUSHTOZERO` in the control register is at the different location compared to the status register.
- `FE_FLUSHTOZERO` exception flag cannot be raised with the default CPU floating point operation mode.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D120914
2022-03-10 09:26:09 -05:00
Louis Dionne 28e82982fe [libc++] Bump minimum compiler requirements
Now that we've branched for the LLVM 14 release, our support window
moves to clang-13 and clang-14. Similarly, AppleClang 13 has been
released for some time now, so that should be the oldest compiler
we support, per our policy.

A possible follow-up would be to remove _LIBCPP_HAS_NO_CONCEPTS, since
I don't think we support any compiler that doesn't support concepts
anymore.

Differential Revision: https://reviews.llvm.org/D118831
2022-03-10 08:59:19 -05:00
David Green 43591be2aa [AArch64] Extra tests for tbl with zero elements. NFC 2022-03-10 13:51:04 +00:00
Louis Dionne 6b9e0af8db [libc++] Add test coverage for std::shared_ptr<const T>
Those tests were extracted from D120996.

Differential Revision: https://reviews.llvm.org/D121340
2022-03-10 08:49:31 -05:00
serge-sans-paille 2fccde0ea7 Cleanup includes: MCDisassembler
Some extra minor cleanup.

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D121329
2022-03-10 14:43:29 +01:00
Nikita Popov 3c47dd47a4 [FuzzMutate] Support opaque pointers
Avoid checks that are irrelevant for opaque pointers, and pick
load/GEP types independently of the pointer type.

The GEP case at least could be done more efficiently by directly
generating a type, but this would require some significant API
changes.
2022-03-10 14:36:20 +01:00
Simon Pilgrim 808d9d260b [InstCombine] Add vector support to icmp(add(X,C1),add(Y,C2)) -> icmp(add(X,C1-C2),Y) fold
As discussed on Issue #32161 this fold can be generalized a lot more than it currently is, but this patch at least adds vector support.

Differential Revision: https://reviews.llvm.org/D121358
2022-03-10 13:30:48 +00:00
Simon Pilgrim 65e1283384 [X86] Add GFNI shift/rotate/funnel-shift vXi8 by constant splat tests
GFNI can efficiently perform vXi8 shift/rotates by constant splats using X86ISD::GF2P8AFFINEQB
2022-03-10 13:25:06 +00:00
Simon Pilgrim 50efb2ecd4 Fix M68k missing header errors. 2022-03-10 13:18:20 +00:00
Sanjay Patel b1e513ae8e [PhaseOrdering][x86] add TODO comments to test files; NFC
The intended folds were removed because an underlying
analysis was not correct ( b48fe158e0 ).
2022-03-10 08:10:28 -05:00
Nico Weber a278250b0f Revert "Cleanup codegen includes"
This reverts commit 7f230feeea.
Breaks CodeGenCUDA/link-device-bitcode.cu in check-clang,
and many LLVM tests, see comments on https://reviews.llvm.org/D121169
2022-03-10 07:59:22 -05:00
Shraiysh Vaishay 6dd54da5a5 [OpenMP][mlir] Lowering for omp.atomic.update
This patch adds lowering from omp.atomic.update to LLVM IR. Whenever a
special LLVM IR instruction is available for the operation, `atomicrmw`
instruction is emitted, otherwise a compare-exchange loop based update
is emitted.

Depends on D119522

Reviewed By: ftynse, peixin

Differential Revision: https://reviews.llvm.org/D119657
2022-03-10 18:28:51 +05:30
Florian Hahn 697f55e368
[AArch64] Move fp16 cast tests.
Move FP16 tests to fp16cast function, as suggested in D113700.
2022-03-10 12:22:06 +00:00
Nico Weber e32d061abe [gn build] (manually) port af98b0af67 2022-03-10 07:14:47 -05:00
alex-t d159b4444c [AMDGPU] Enable divergence predicates for negative inline constant subtraction
We have a pattern that undo sub x, c -> add x, -c canonicalization since c is more likely
 an inline immediate than -c. This patch enables it to select scalar or vector subtracion by the input node divergence.

Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D121360
2022-03-10 15:03:22 +03:00
Stanislav Gatev af98b0af67 [clang][dataflow] Add analysis that detects unsafe accesses to optionals
This commit reverts e0cc28dfdc and moves
UncheckedOptionalAccessModelTest.cpp into clang/unittests/Analysis/FlowSensitive,
to avoid build failures. The test will be moved back into a Models subdir
in a follow up patch that will address the build configuration issues.

Original description:

Adds a dataflow analysis that detects unsafe accesses to values of type
`std::optional`, `absl::optional`, or `base::Optional`.

Reviewed-by: ymandel, xazax.hun

Differential Revision: https://reviews.llvm.org/D121197
2022-03-10 11:05:31 +00:00
Nikita Popov eb4037ff42 [AMDGPU] Fix regenerated test checks (NFC)
I used the wrong build to generate the checks, sorry :(
2022-03-10 11:56:17 +01:00
Nikita Popov 611da6b582 [AMDGPU] Regenerate test checks (NFC) 2022-03-10 11:53:45 +01:00
Nikita Popov eaac3484ab [AMDGPU] Regenerate test checks (NFC)
Also rename variables to avoid file check clash.
2022-03-10 11:32:45 +01:00
Michel Weber 06eb057738 [MLIR][Presburger] fix vector update in coalesce
When `addCoalescedPolyhedron` was called with `j == n - 1`,
the `polyhedrons`-vector was not properly updated (the
`IntegerPolyhedron` at position `n - 2` was "lost"). This patch adds
special handling to that case and a regression testcase.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D121356
2022-03-10 15:42:11 +05:30
Groverkss c896e6540a [MLIR][Presburger] Use IdKind for removeIdRange in PresburgerSpace
This patch moves PresburgerSpace::removeIdRange(idStart, idLimit) to
PresburgerSpace::removeIdRange(kind, idStart, idLimit), i.e. identifiers
can only be removed at once for a single kind.

This makes users of PresburgerSpace to not assume any inside ordering of
identifier kinds.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D121079
2022-03-10 15:39:32 +05:30
Weining Lu 7898587e94 [LoongArch] Add basic support to Disassembler
With the addition of disassembler now we can do instructions 'round-trip' test
that assembles `.s` to obj with `llvm-mc` and disassembles it with `llvm-objdump`
to check instruction mnemonics.

Reviewed By: xen0n, MaskRay

Differential Revision: https://reviews.llvm.org/D120477
2022-03-10 17:08:31 +08:00
serge-sans-paille 8246ec242a Add missing include in llvm/CodeGen/CodeGenPassBuilder.h
As a follow-up to 7f230feeea
2022-03-10 10:05:25 +01:00
Simon Pilgrim 5979c659aa [InstCombine] Add vector tests for icmp_eq(add(X,C1),add(Y,C2)) -> icmp_eq(add(X,C1-C2),Y)
As mentioned on Issue #32161 we don't even have uniform vector support for this fold
2022-03-10 09:01:19 +00:00
serge-sans-paille 7f230feeea Cleanup codegen includes
after:  1061034926
before: 1063332844

Differential Revision: https://reviews.llvm.org/D121169
2022-03-10 10:00:30 +01:00
serge-sans-paille 3c4410dfca Cleanup includes: LLVMTarget
Most notably, Pass.h is no longer included by TargetMachine.h
before: 1063570306
after:  1063332844

Differential Revision: https://reviews.llvm.org/D121168
2022-03-10 10:00:29 +01:00
Nikita Popov 479d684ba5 [Coroutines] Support opaque pointers in solveTypeName()
As far as I can tell, these names are only intended to be
informative, so just use a generic "PointerType" for opaque pointers.

The code in solveDIType() also treats pointers as basic types (and
does not try to encode the pointed-to type further), so I believe
this should be fine.

Differential Revision: https://reviews.llvm.org/D121280
2022-03-10 09:33:55 +01:00
Luke 0803dba7dd [RISCV] Add fixed-length vector instrinsics for segment load
Inspired by reviews.llvm.org/D107790.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D119834
2022-03-10 16:23:40 +08:00
Craig Topper d53707508a [RISCV] Remove RISCVISD::VLE_VL/VSE_VL. Use intrinsics instead.
Similar to what we do for other loads/stores, use the intrinsic
version that we already have custom isel for.

Reviewed By: rogfer01

Differential Revision: https://reviews.llvm.org/D121166
2022-03-09 22:44:28 -08:00
Craig Topper 7cd78da8da [RISCV] Add tests showing the optimization pipeline for O0 and O3.
Other targets like ARM, AArch64, and X86 have similar tests.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D120840
2022-03-09 21:42:09 -08:00
Amir Ayupov d1638cb0b5 [BOLT][NFC] Fix print-cfg data race
Addresses ThreadSanitizer warning

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D121337
2022-03-09 20:28:06 -08:00
Amir Ayupov d16bbc5340 [BOLT][NFC] Check errors from Obj.dynamicEntries
Addresses fuzzer crash

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D121336
2022-03-09 20:24:44 -08:00
Siva Chandra Reddy 83b8878fbb [libc] Use the constexpr constructor to initialize exit handlers mutex.
Reviewed By: abrachet

Differential Revision: https://reviews.llvm.org/D121334
2022-03-10 02:52:35 +00:00
Carl Ritson 3cb9af1be2 [MachineSink] Pre-commit test for D121277. NFC. 2022-03-10 11:33:06 +09:00
Ahmed Bougacha 89c94c242c [clang][Driver] Get darwin -Xarch_ working for subtypes, again.
35ca7d9ddf broke 471c4f8299 for -arch flags that don't map 1:1
to the triple arch.  This has been broken for the many years since.
It hasn't mattered much since then, mostly because few people use it,
but also because it works for x86_64/i386, armv7/armv7s
don't differ much, arm64 is its own arch, and arm64/arm64_32 have
different arches (and it's a rare combination anyway).

But arm64/arm64e exposes this issue again.

Patch by: Justin Bogner <mail@justinbogner.com>
with some added tests.
2022-03-09 18:21:45 -08:00