Commit Graph

428056 Commits

Author SHA1 Message Date
Florian Hahn ca47ab128b
[Clang] Remove unused function declaration after 77475ffd22. 2022-06-27 14:17:53 +01:00
Louis Dionne d6bfedd8ba [libc++] Remove dummy command in Dockerfile
It turns out that the Docker images on CI instances are not updated
based on what's in this file, but instead when a new image is pushed
to ldionne/libcxx-builder on DockerHub. So this is effectively useless.
2022-06-27 09:17:34 -04:00
Javier Setoain f39c2a1142 [mlir][llvm] Add vector insert/extract intrinsics
These intrinsics will be needed to convert between fixed-length vectors
and scalable vectors.

This operation will be needed for VLS (vector-length specific)
vectorization, when interfacing with vector functions or intrinsics that
take scalable vectors as operands in a context where the length of our
vectors is known or assumed at compile time, but we still want to
generate scalable vector instructions.

Differential Revision: https://reviews.llvm.org/D127100
2022-06-27 14:12:18 +01:00
Koakuma 1466d65d9b [SPARC] Don't do leaf optimization on procedures with inline assembly
On SPARC, leaf function optimization omits the register window sliding (and the associated register name changes). This might result in miscompilation of procedures containing inline assembly, as some of the register constraints used may interfere with the register usage of optimized functions, so we disable leaf procedure optimization on those procedures to prevent it from happening.

This is a continuation of patch D102342 by @LemonBoy, the original comment is reproduced below:

> Leaf functions allow the compiler to omit the setup and teardown of a frame pointer, therefore avoiding the exchange of the in/out register. According to the SPARC architecture manual every reference to %i0-%i5 should be replaced with %o0-o5, if the target register is already in use a further remapping step to %g1-%g7 is required to free the output register.
>
> Add a simple check to make sure not to stomp on any output register that's already in use.

Reviewed By: dcederman

Differential Revision: https://reviews.llvm.org/D128263
2022-06-27 15:09:30 +02:00
Lucas Prates 70a5c52534 [ARM][Thumb] Command-line option to ensure AAPCS compliant Frame Records
Currently the a AAPCS compliant frame record is not always created for
functions when it should. Although a consistent frame record might not
be required in some cases, there are still scenarios where applications
may want to make use of the call hierarchy made available trough it.

In order to enable the use of AAPCS compliant frame records whilst keep
backwards compatibility, this patch introduces a new command-line option
(`-mframe-chain=[none|aapcs|aapcs+leaf]`) for Aarch32 and Thumb backends.
The option allows users to explicitly select when to use it, and is also
useful to ensure the extra overhead introduced by the frame records is
only introduced when necessary, in particular for Thumb targets.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D125094
2022-06-27 14:08:48 +01:00
Valentin Clement bd90155df4
[flang][NFC] Add IO lowering tests
These tests were left behind or only partially upstreamed during
the lower code upstreaming.

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2022-06-27 15:01:33 +02:00
Tim Northover 69ae441e4c ARM: don't try to load function pointer before long call.
Deciding to load an arbitrary global based on whether the entire module is
being built for long calls is pretty clearly spurious, and in fact the existing
indirect logic is sufficient.
2022-06-27 13:59:35 +01:00
Nikita Popov cfb4c1a735 [IndVars] Add test for PR56242 (NFC) 2022-06-27 14:54:20 +02:00
Matt Arsenault 97ed2fbc5f MIR: Fix parse error on empty CustomRegMask 2022-06-27 08:50:35 -04:00
LLVM GN Syncbot e84674f7ac [gn build] Port 633d1d0df7 2022-06-27 12:35:34 +00:00
Louis Dionne 633d1d0df7 [libc++] Use bounded iterators in std::span when the debug mode is enabled
Previously, we'd use raw pointers when the debug mode was enabled,
which means we wouldn't get out-of-range checking with std::span's
iterators.

This patch introduces a new class called __bounded_iter which can
be used to wrap iterators and make them carry around bounds-related
information. This allows iterators to assert when they are dereferenced
outside of their bounds.

As a fly-by change, this commit removes the _LIBCPP_ABI_SPAN_POINTER_ITERATORS
knob. Indeed, not using a raw pointer as the iterator type is useful to
avoid users depending on properties of raw pointers in their code.

This is an alternative to D127401.

Differential Revision: https://reviews.llvm.org/D127418
2022-06-27 08:34:45 -04:00
Louis Dionne 92df8c2736 [libc++] Improve Lit's buildhost=XXXX feature on a few platforms
Differential Revision: https://reviews.llvm.org/D128455
2022-06-27 08:33:44 -04:00
Valentin Clement 656b8d6c01
[flang][NFC] Add array lowering tests
These tests were left behind during the upstreaming of parts lowering.

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

Reviewed By: jeanPerier

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

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-06-27 14:19:54 +02:00
Wei Yi Tee b611376e7e [clang][dataflow] Singleton pointer values for null pointers.
When a `nullptr` is assigned to a pointer variable, it is wrapped in a `ImplicitCastExpr` with cast kind `CK_NullTo(Member)Pointer`. This patch assigns singleton pointer values representing null to these expressions.

For each pointee type, a singleton null `PointerValue` is created and stored in the `NullPointerVals` map of the `DataflowAnalysisContext` class. The pointee type is retrieved from the implicit cast expression, and used to initialise the `PointeeLoc` field of the `PointerValue`. The `PointeeLoc` created is not mapped to any `Value`, reflecting the absence of value indicated by null pointers.

Reviewed By: gribozavr2, sgatev, xazax.hun

Differential Revision: https://reviews.llvm.org/D128056
2022-06-27 14:17:34 +02:00
Nicolas Vasilache a0f843fdaf [SCF] Add thread_dim_mapping attribute to scf.foreach_thread
An optional thread_dim_mapping index array attribute specifies for each
virtual thread dimension, how it remaps 1-1 to a set of concrete processing
element resources (e.g. a CUDA grid dimension or a level of concrete nested
async parallelism). At this time, the specification is backend-dependent and
is not verified by the op, beyond being an index array attribute.
It is the reponsibility of the lowering to interpret the index array in the
context of the concrete target the op is lowered to, or to ignore it when
the specification is ill-formed or unsupported for a particular target.

Differential Revision: https://reviews.llvm.org/D128633
2022-06-27 04:58:36 -07:00
Matthias Springer 5d50f51c97 [mlir][bufferization][NFC] Add error handling to getBuffer
This is in preparation of adding memory space support.

Differential Revision: https://reviews.llvm.org/D128277
2022-06-27 13:48:01 +02:00
Matthias Springer 0d0a94a792 [mlir][bufferization][NFC] Fix typo in AllocTensorOp builders 2022-06-27 13:41:18 +02:00
Matthias Springer 3ff93f838e [mlir][SCF][bufferize][NFC] Bufferize scf.for terminator separately
This allows for better type inference during bufferization and is in preparation of supporting memory spaces.

Differential Revision: https://reviews.llvm.org/D128422
2022-06-27 13:26:32 +02:00
Matthias Springer 8e691e1f24 [mlir][SCF][bufferize] Bufferize scf.if/execute_region terminators separately
This allows for better type inference during bufferization and is in preparation of supporting memory spaces.

Differential Revision: https://reviews.llvm.org/D128581
2022-06-27 13:22:19 +02:00
Matthias Springer 7ebf70d85d [mlir][SCF][bufferize][NFC] Bufferize parallel_insert_slice separately
This allows for better type inference during bufferization and is in preparation of supporting memory spaces.

Differential Revision: https://reviews.llvm.org/D128580
2022-06-27 13:16:02 +02:00
Jay Foad 8871c3c562 [AMDGPU] Regenerate MIR checks. NFC. 2022-06-27 12:15:29 +01:00
Aaron Ballman 4588b6fd26 Fix clang docs build; NFC
This should address the break from:
https://lab.llvm.org/buildbot/#/builders/92/builds/28769
2022-06-27 07:12:36 -04:00
Matthias Springer 19efb84c7a [mlir][shape][bufferize][NFC] Bufferize block terminators separately
This allows for better type inference during bufferization and is in preparation of supporting memory spaces.

Differential Revision: https://reviews.llvm.org/D128579
2022-06-27 13:08:13 +02:00
Dmitry Preobrazhensky 480f3e0228 [AMDGPU][GFX9][DOC][NFC] Update assembler syntax description
Summary of changes:
- Updated MUBUF lds syntax (see https://reviews.llvm.org/D124485).
- Updated SMEM syntax (see https://reviews.llvm.org/D127314).
- Enabled src0=literal for v_madak*, v_madmk* (see https://reviews.llvm.org/D111067).
- Removed SYSMSG_OP_HOST_TRAP_ACK message.
- Minor bug fixing and improvements.
2022-06-27 14:03:58 +03:00
Edd Barrett 94fbb147c8
[STACKMAPS] Document+test UINT64_MAX stack size.
When a function does a dynamic stack allocation, the function's stack
size (in the stack map) is reported as UINT64_MAX.

This change tests and documents this property.

Differential Revision: https://reviews.llvm.org/D128525
2022-06-27 11:57:07 +01:00
Bradley Smith a83aa33d1b [IR] Move vector.insert/vector.extract out of experimental namespace
These intrinsics are now fundemental for SVE code generation and have been
present for a year and a half, hence move them out of the experimental
namespace.

Differential Revision: https://reviews.llvm.org/D127976
2022-06-27 10:48:45 +00:00
Simon Pilgrim 0b998053db [X86] combineConcatVectorOps - IsConcatFree must check extraction index
Identified in the regression reported by @alexfh on rGb5d7beeb9792 - IsConcatFree wasn't ensuring the subvector extraction index matched the position it would be concatenated back into.
2022-06-27 11:46:49 +01:00
Matthias Springer ba9d886db4 [mlir][bufferization][NFC] Bufferize with PostOrder traversal
This is useful because the result type of an op can sometimes be inferred from its body (e.g., `scf.if`). This will be utilized in subsequent changes.

Also introduces a new `getBufferType` interface method on BufferizableOpInterface. This method is useful for computing a bufferized block argument type with respect to OpOperand types of the parent op.

Differential Revision: https://reviews.llvm.org/D128420
2022-06-27 12:42:41 +02:00
Jolanta Jensen 5830da1f86 [AArch64] Define __FP_FAST_FMA[F]
Libraries use this flag to decide whether to use the fma builtin.
Author: Paul Walker

Differential Revision: https://reviews.llvm.org/D127655
2022-06-27 11:37:40 +01:00
Matthias Springer c06f01ffee [mlir][bufferization] Add `memory_space` op attribute
This attribute is currently supported on AllocTensorOp only. Future changes will add support to other ops. Furthermore, the memory space is not propagated properly in all bufferization patterns and some of the core bufferization infrastructure. This will be addressed in a subsequent change.

Differential Revision: https://reviews.llvm.org/D128274
2022-06-27 12:33:26 +02:00
gbreynoo 7de277d684 [llvm-ar] Improve MRI script CREATE command handling
I discovered that when compared to GNU the llvm-ar MRI script parsing of
CREATE could lead to some strange behaviour. This fix improves the error
message in the case when no archive name is given and will not allow the
adding of members until CREATE is called. Along with this change I added
more testing of the CREATE command.

Differential Revision: https://reviews.llvm.org/D128055
2022-06-27 11:11:16 +01:00
Andrzej Warzynski 869385b11c [flang][driver] Add support for `-O{0|1|2|3}`
This patch adds support for most common optimisation compiler flags:
`-O{0|1|2|3}`. This is implemented in both the compiler and frontend
drivers. At this point, these options are only used to configure the
LLVM optimisation pipelines (aka middle-end). LLVM backend or MLIR/FIR
optimisations are not supported yet.

Previously, the middle-end pass manager was only required when
generating LLVM bitcode (i.e. for `flang-new -c -emit-llvm <file>` or
`flang-new -fc1 -emit-llvm-bc <file>`). With this change, it becomes
required for all frontend actions that are represented as
`CodeGenAction` and `CodeGenAction::executeAction` is refactored
accordingly (in the spirit of better code re-use).

Additionally, the `-fdebug-pass-manager` option is enabled to facilitate
testing. This flag can be used to configure the pass manager to print
the middle-end passes that are being run. Similar option exists in Clang
and the semantics in Flang are identical. This option translates to
extra configuration when setting up the pass manager. This is
implemented in `CodeGenAction::runOptimizationPipeline`.

This patch also adds some bolier plate code to manage code-gen options
("code-gen" refers to generating machine code in LLVM in this context).
This was extracted from Clang. In Clang, it simplifies defining code-gen
options and enables option marshalling. In Flang, option marshalling is
not yet supported (we might do at some point), but being able to
auto-generate some code with macros is beneficial. This will become
particularly apparent when we start adding more options (at least in
Clang, the list of code-gen options is rather long).

Differential Revision: https://reviews.llvm.org/D128043
2022-06-27 10:06:14 +00:00
Wei Yi Tee bdfe556dd8 [clang][dataflow] Implement functionality for flow condition variable substitution.
This patch introduces `buildAndSubstituteFlowCondition` - given a flow condition token, this function returns the expression of constraints defining the flow condition, with values substituted where specified.

As an example:
Say we have tokens `FC1`, `FC2`, `FC3`:
```
FlowConditionConstraints: {
 FC1: C1,
 FC2: C2,
 FC3: (FC1 v FC2) ^ C3,
}
```
`buildAndSubstituteFlowCondition(FC3, /*Substitutions:*/{{C1 -> C1'}})`
returns a value corresponding to `(C1' v C2) ^ C3`.

Note:
This function returns the flow condition expressed directly as its constraints, which differs to how we currently represent the flow condition as a token bound to a set of constraints and dependencies. Making the representation consistent may be an option to consider in the future.

Depends On D128357

Reviewed By: gribozavr2, xazax.hun

Differential Revision: https://reviews.llvm.org/D128363
2022-06-27 11:37:46 +02:00
Andrzej Warzynski 88c4a4a6be [flang] Update the release notes
Document changes introduced in https://reviews.llvm.org/D126164.

Differential Revision: https://reviews.llvm.org/D128413
2022-06-27 09:19:37 +00:00
Wei Yi Tee 12c7352fa4 [clang][dataflow] Move logic for `createStorageLocation` from `DataflowEnvironment` to `DataflowAnalysisContext`.
`createStorageLocation` in `DataflowEnvironment` is now a trivial wrapper around the logic in `DataflowAnalysisContext`.
Additionally, `getObjectFields` and `getFieldsFromClassHierarchy` (required for the implementation of `createStorageLocation`) are also moved to `DataflowAnalysisContext`.

Reviewed By: gribozavr2, sgatev

Differential Revision: https://reviews.llvm.org/D128359
2022-06-27 11:16:51 +02:00
Siva Chandra Reddy 8bb1dd7d34 [libc] Add a simple arm32 config.
This will be expanded in future as more functions are brought up on arm32.
2022-06-27 09:03:22 +00:00
Sven van Haastregt 663e47a50f [OpenCL] Reduce emitting candidate notes for builtins
When overload resolution fails, clang emits a note diagnostic for each
candidate.  For OpenCL builtins this often leads to many repeated note
diagnostics with no new information.  Stop emitting such notes.

Update a test that was relying on counting those notes to check how
many builtins are available for certain extension configurations.

Differential Revision: https://reviews.llvm.org/D127961
2022-06-27 09:55:44 +01:00
Nikita Popov 327307d9d4 [SCEV] Assert that GEP source element type is sized (NFC)
This is checked by the IR verifier, so replace the condition with
an assert.
2022-06-27 10:51:09 +02:00
Jay Foad 77e63b25f9 [AMDGPU] Fix assertion failure on mad with negative immediate addend
Without this, the new test case would fail with:

AMDGPUInstPrinter.cpp:545: void llvm::AMDGPUInstPrinter::printImmediate64(uint64_t, const llvm::MCSubtargetInfo &, llvm::raw_ostream &): Assertion `isUInt<32>(Imm) || Imm == 0x3fc45f306dc9c882' failed.

Differential Revision: https://reviews.llvm.org/D128435
2022-06-27 09:49:20 +01:00
Siva Chandra Reddy fe8017476c [libc][NFC] Make the support thread library an object library.
It was previously a header library. Making it an object library will
allow us to declare thread local variables which can used to setup a
thread's self object.
2022-06-27 08:47:05 +00:00
Matthias Springer b06614e2e8 [mlir][bufferization][NFC] Change signature of getMemRefType
These functions now accep unsigned attributes for address spaces instead of Attributes.

Differential Revision: https://reviews.llvm.org/D128275
2022-06-27 10:41:40 +02:00
Simon Tatham 43c84e4634 [libunwind,EHABI,ARM] Fix get/set of RA_AUTH_CODE.
According to EHABI32 §8.5.2, the PAC for the return address of a
function described in an exception table is supposed to be addressed
in the _Unwind_VRS_{Get,Set} API by setting regclass=_UVRSC_PSEUDO and
regno=0. (The space of 'regno' values is independent for each
regclass, and for _UVRSC_PSEUDO, there is only one valid regno so far.)

That is indeed what libunwind's _Unwind_VRS_{Get,Set} functions expect
to receive. But at two call sites, the wrong values are passed in:
regno is being set to UNW_ARM_RA_AUTH_CODE (0x8F) instead of 0, and in
one case, regclass is _UVRSC_CORE instead of _UVRSC_PSEUDO.

As a result, those calls to _Unwind_VRS_{Get,Set} return
_UVRSR_FAILED, which their callers ignore. So if you compile in the
AUTG instruction that actually validates the PAC, it will try to
validate what's effectively an uninitialised register as an
authentication code, and trigger a CPU fault even on correct exception
unwinding.

Reviewed By: danielkiss

Differential Revision: https://reviews.llvm.org/D128522
2022-06-27 09:36:21 +01:00
Florian Hahn e4e22b6d80
[SCEV] Use SCEVUnknown(poison) instead of SCEVUnknown(undef).
Use poison instead of undef for SCEVUnkown of unreachable values.
This should be in line with the movement to replace undef with poison
when possible.

Suggested in D114650.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D128586
2022-06-27 09:33:05 +01:00
Mikhail Goncharov fe6db8d03f Revert "[lldb] Fix thread step until to not set breakpoint(s) on incorrect line numbers"
This reverts commit a57b62deef.

lldb-aarch64-ubuntu buildbot test fails since https://lab.llvm.org/buildbot/#/builders/96/builds/25128
2022-06-27 10:18:39 +02:00
Nikita Popov cde402778a [FunctionAttrs] Add missing pass dependency
This pass depends on AAResults. This fixes the ocaml IPO binding
tests.
2022-06-27 10:15:06 +02:00
Nikita Popov 217e85761c [ArgPromotion] Remove legacy PM support
Support for the legacy pass manager in ArgPromotion causes
complications in D125485. As the legacy pass manager for middle-end
optimizations is unsupported, drop ArgPromotion from the legacy
pipeline, rather than introducing additional complexity to deal
with it.

Differential Revision: https://reviews.llvm.org/D128536
2022-06-27 09:42:17 +02:00
Adrian Kuegel ca2933f3f8 [mlir] Fix ClangTidyPerformance finding (NFC) 2022-06-27 09:15:39 +02:00
Chuanqi Xu fd47894d88 [NFC] Add parentheses around && within || to avoid warning 2022-06-27 14:44:10 +08:00
Jacques Pienaar 655dc02cb0 [mlir] Flip MemRef dialect to _Both (NFC) 2022-06-26 20:45:25 -07:00
Chuanqi Xu 24e53b01d5 Revert "[Coroutines] Only do symmetric transfer if optimization is on"
This reverts commit 7782e080e8. According
to the discussion of WG21, symmetric transfer is a desired feature.
2022-06-27 10:54:56 +08:00