Jean Perier [Wed, 1 Mar 2023 09:43:16 +0000 (10:43 +0100)]
[flang][hlfir] Implement hlfir.declare optional codegen
The hlfir fir.box with the local lower bounds and type parameters
must be generated conditionally when the entity is optional.
Differential Revision: https://reviews.llvm.org/D144962
David Green [Wed, 1 Mar 2023 09:39:51 +0000 (09:39 +0000)]
[AArch64] Remove 64bit->128bit vector insert lowering
The AArch64 backend, during lowering, will convert an 64bit vector insert to a
128bit vector:
vector_insert %dreg, %v, %idx
=>
%qreg = insert_subvector undef, %dreg, 0
%ins = vector_insert %qreg, %v, %idx
EXTRACT_SUBREG %ins, dsub
This creates a bit of mess in the DAG, and the EXTRACT_SUBREG being a machine
nodes makes it difficult to simplify. This patch removes that, treating the
64bit vector insert as legal and handling them with extra tablegen patterns.
The end result is a simpler DAG that is easier to write tablegen patterns for.
Differential Revision: https://reviews.llvm.org/D144550
Zhongyunde [Wed, 1 Mar 2023 08:59:26 +0000 (16:59 +0800)]
[InstCombine] Improvement the analytics through the dominating condition
Address the dominating condition, the urem fold is benefit from the analytics improvements.
Fix https://github.com/llvm/llvm-project/issues/60546
NOTE: delete the calls in simplifyBinaryIntrinsic and foldICmpWithDominatingICmp
is used to reduce compile time.
Reviewed By: nikic, arsenm, erikdesjardins
Differential Revision: https://reviews.llvm.org/D144248
Sander de Smalen [Thu, 19 Jan 2023 10:29:16 +0000 (10:29 +0000)]
[LoopVectorize] Remove runtime check and scalar tail loop when tail-folding.
When using tail-folding and using the predicate for both data and control-flow
(the next vector iteration's predicate is generated with the llvm.active.lane.mask
intrinsic and then tested for the backedge), the LoopVectorizer still inserts a
runtime check to see if the 'i + VF' may at any point overflow for the given
trip-count. When it does, it falls back to a scalar epilogue loop.
We can get rid of that runtime check in the pre-header and therefore also
remove the scalar epilogue loop. This reduces code-size and avoids a runtime
check.
Consider the following loop:
void foo(char * __restrict__ dst, char *src, unsigned long N) {
for (unsigned long i=0; i<N; ++i)
dst[i] = src[i] + 42;
}
If 'N' is e.g. ULONG_MAX, and the VF > 1, then the loop iteration counter
will overflow when calculating the predicate for the next vector iteration
at some point, because LLVM does:
vector.ph:
%active.lane.mask.entry = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 %N)
vector.body:
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%active.lane.mask = phi <vscale x 16 x i1> [ %active.lane.mask.entry, %vector.ph ], [ %active.lane.mask.next, %vector.body ]
...
%index.next = add i64 %index, 16
; The add above may overflow, which would affect the lane mask and control flow. Hence a runtime check is needed.
%active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 %index.next, i64 %N)
%8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7
The solution:
What we can do instead is calculate the predicate before incrementing
the loop iteration counter, such that the llvm.active.lane.mask is
calculated from 'i' to 'tripcount > VF ? tripcount - VF : 0', i.e.
vector.ph:
%active.lane.mask.entry = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 %N)
%N_minus_VF = select %N > 16 ? %N - 16 : 0
vector.body:
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%active.lane.mask = phi <vscale x 16 x i1> [ %active.lane.mask.entry, %vector.ph ], [ %active.lane.mask.next, %vector.body ]
...
%active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 %index, i64 %N_minus_VF)
%index.next = add i64 %index, %4
; The add above may still overflow, but this time the active.lane.mask is not affected
%8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7
For N = 20, we'd then get:
vector.ph:
%active.lane.mask.entry = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 %N)
; %active.lane.mask.entry = <1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1>
%N_minus_VF = select 20 > 16 ? 20 - 16 : 0
; %N_minus_VF = 4
vector.body: (1st iteration)
... ; using <1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1> as predicate in the loop
...
%active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 4)
; %active.lane.mask.next = <1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>
%index.next = add i64 0, 16
; %index.next = 16
%8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
; %8 = 1
br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7
; branch to %vector.body
vector.body: (2nd iteration)
... ; using <1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> as predicate in the loop
...
%active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 16, i64 4)
; %active.lane.mask.next = <0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>
%index.next = add i64 16, 16
; %index.next = 32
%8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
; %8 = 0
br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7
; branch to %for.cond.cleanup
Reviewed By: fhahn, david-arm
Differential Revision: https://reviews.llvm.org/D142109
Sander de Smalen [Thu, 19 Jan 2023 11:50:21 +0000 (11:50 +0000)]
NFC: Use generate_test_checks script for LV tests which seem to have been auto-generated.
Nikita Popov [Wed, 1 Mar 2023 08:51:29 +0000 (09:51 +0100)]
[Orc] Remove LLVMInitializeCore() calls from examples
Per discussion on D144970, these are no longer necessary.
Valentin Clement [Wed, 1 Mar 2023 08:51:03 +0000 (09:51 +0100)]
[flang][NFC] Remove redundant and incomplete comment
Valentin Clement [Wed, 1 Mar 2023 08:44:39 +0000 (09:44 +0100)]
[flang] Handle dynamic type in move_alloc
Update move_alloc to carry over the dyanmic type of `from` to `to`
and reset the dynamic type of `from` to its declared type when it
is polymorphic.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D144997
Lorenzo Chelini [Tue, 28 Feb 2023 14:31:18 +0000 (15:31 +0100)]
[MLIR][Linalg] Fix propagation for rank-zero tensor
`isScalar` only returns true if the operand is non-shaped.
But we need to handle also rank zero tensors.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D144989
Caroline Concatto [Tue, 28 Feb 2023 17:40:00 +0000 (17:40 +0000)]
[IR][Legalization] Split illegal deinterleave and interleave vectors
To make legalization easier, the operands and outputs have the same size for
these ISD Nodes. When legalizing the results in SplitVectorResult the operands
are legalized to the same size as the outputs.
The ISD Node has two output/results, therefore the legalizing functions update
both results/outputs.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D144744
Tobias Gysi [Wed, 1 Mar 2023 08:15:37 +0000 (09:15 +0100)]
[mlir][llvm] Add AliasAnalysis and AccessGroup interfaces.
The revision introduces two interfaces that provide access to
the alias analysis and access group metadata attributes. The
AliasAnalysis interface combines all alias analysis related
attributes (alias, noalias, and tbaa) similar to LLVM's getAAMetadata
method, while the AccessGroup interface is dedicated to the
access group metadata.
Previously, only the load and store operations supported alias analysis
and access group metadata. This revision extends this support to the
atomic operations. A follow up revision will also add support for the
memcopy, memset, and memove intrinsics. The interfaces then provide
convenient access to the metadata attributes and eliminate the need
of TypeSwitch or string based attribute access.
The revision still relies on string based attribute access for
the translation to LLVM IR (except for tbaa metadata). Only once
the the memory access intrinsics also implement the new interfaces,
the translation to LLVM IR can be fully switched to use interface
based attribute accesses.
Depends on D144875
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D144851
Balázs Kéri [Wed, 1 Mar 2023 07:42:32 +0000 (08:42 +0100)]
[clang][ASTImporter] Improve import of InjectedClassNameType.
During AST import multiple different InjectedClassNameType objects
could be created for a single class template. This can cause problems
and failed assertions when these types are compared and found to be
not the same (because the instance is different and there is no
canonical type).
The import of this type does not use the factory method in ASTContext,
probably because the preconditions are not fulfilled at that state.
The fix tries to make the code in ASTImporter work more like the code
in ASTContext::getInjectedClassNameType. If a type is stored at the
Decl or previous Decl object, it is reused instead of creating a new
one. This avoids crash at least a part of the cases.
Reviewed By: gamesh411, donat.nagy, vabridgers
Differential Revision: https://reviews.llvm.org/D140562
Benjamin Chetioui [Wed, 1 Mar 2023 08:18:14 +0000 (08:18 +0000)]
[mlir][NFC] Address filecheck_lint findings in Vector/CPU/test-broadcast.mlir.
Differential Revision: https://reviews.llvm.org/D144972
Sander de Smalen [Tue, 28 Feb 2023 15:20:46 +0000 (15:20 +0000)]
[IR] Add LLVM IR support for target("aarch64.svcount") type.
The C and C++ Language Extensions for AArch64 SME2 [1] adds a new type called
`svcount_t` which describes a predicate. This is not a predicate vector
mask, but rather a description of a predicate vector mask that can be
expanded into a mask using explicit instructions. The type is a scalable
opaque type.
To implement `svcount_t` type this patch uses the existing Target Extension Type
mechanism, but adds further support so that this type can be a scalable type.
AArch64 CodeGen support will follow in a separate patch.
[1] https://github.com/ARM-software/acle/pull/217
Reviewed By: jcranmer-intel, nikic
Differential Revision: https://reviews.llvm.org/D136861
Christian Ulmann [Wed, 1 Mar 2023 07:57:59 +0000 (08:57 +0100)]
[mlir][llvm] Prioritize DILocalScope over file loc
This commit ensures that the LLVMIR export prioritizes existing
DILocalScope attribute information as location scopes over files
constructed from filenames. All DILocalScope attributes contain file
information, so no information is lost. The previous implementation
caused the introduction of superfluous DILexicalBlockFile nodes in
certain cases. The old implementation remains as a fallback when no
DILocalScope is present.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D144968
Ben Shi [Wed, 1 Mar 2023 07:38:22 +0000 (15:38 +0800)]
[clang][driver] Do not emit default '-Tdata' for AVR devices
Different AVR devices have different data regions. Current clang
driver emits a default '-Tdata' option to the linker. This way
works fine if there is no user specified linker script, but it
will cause conflicts if there is one.
A better solution for setting the default data region to GNU ld
is defining symbol __DATA_REGION_ORIGIN__, which is expected by
GNU ld's default AVR linker script.
Fixes https://github.com/llvm/llvm-project/issues/60362
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D144533
Emilio Cobos Alvarez [Wed, 1 Mar 2023 06:29:11 +0000 (07:29 +0100)]
[libclang] Remove redundant return statements in CXType.cpp
Let the branch fall through the error path like other functions here do.
Differential Revision: https://reviews.llvm.org/D140074
Craig Topper [Tue, 28 Feb 2023 08:09:27 +0000 (00:09 -0800)]
[TableGen] Minor tweak to AssemblerCondDag evaluation to be more consistent with other dags. NFC
Instead of using getAsString on the dag operator, check if the operator
is a DefInit and then get the name of the Def.
Noah Goldstein [Wed, 1 Mar 2023 04:22:47 +0000 (22:22 -0600)]
[X86] Add `TuningPreferShiftShuffle` for when Shifts are preferable to shuffles.
SKX has an objectively faster shift than shuffle, on all other targets
the two have equal performance (with maybe a slight preference for
shifts because p5 is a more common bottleneck).
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D143786
Noah Goldstein [Wed, 1 Mar 2023 04:21:53 +0000 (22:21 -0600)]
[X86] Make `(shift X (xor/sub N-1, Y))` -> `(shift X, (not Y))` check for one use.
`(xor/sub N-1, Y)` -> `(not Y)` is minorly preferable (especially for
`(sub N-1, Y)` where it saves an instruction), but isn't worth
potentially creating an extra instruction for.
So, only do the transformation if `(xor/sub N-1, Y)` has one use.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D144985
Noah Goldstein [Tue, 28 Feb 2023 17:00:35 +0000 (11:00 -0600)]
[X86] Fix `(shift X, (xor Y, N-1))` -> `(shift X, (not Y))` by properly inserting `not Y` into DAG. [#61038]
Previously not inserting the `-1` in `not Y` (`xor Y, -1`) into the
DAG. Not inserting `-1` as a DAG node comes up as a bug when doing
`(xor (shl 1, A), B)` -> `(btc A, B)`. `btc` requires `B` (dst) to be
a register.
Differential Revision: https://reviews.llvm.org/D144984
Ting Wang [Wed, 1 Mar 2023 03:29:16 +0000 (22:29 -0500)]
[PowerPC] update PPCTTIImpl::supportsTailCallFor() check conditions
This patch reuse `PPCTargetLowering::isEligibleForTCO()` to check
`PPCTTIImpl::supportsTailCallFor()`.
Fixes #59315
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D140369
Chuanqi Xu [Wed, 1 Mar 2023 03:18:58 +0000 (11:18 +0800)]
Revert "[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity"
This reverts commit
74565c3add6d683559618973863e78a5e6836e48.
Since it looks like this one causes the modular libcxx build fails.
Chuanqi Xu [Wed, 1 Mar 2023 03:03:37 +0000 (11:03 +0800)]
Revert "[C++20] [Modules] Trying to compare the trailing require clause from the primary template function"
This reverts commit
9e50578ba43c49ee13ac3bb7d4868565824f9b29. Since it
looks like this one prevents us to fix the modular build for libcxx.
Lian Wang [Wed, 1 Mar 2023 02:31:11 +0000 (02:31 +0000)]
[Doc][NFC] Add template type when use MachinePassRegistry.
Reviewed By: serge-sans-paille
Differential Revision: https://reviews.llvm.org/D144945
Wei Xiao [Fri, 24 Feb 2023 06:33:15 +0000 (14:33 +0800)]
[COFF][X86_64] Put jump table in .rdata for Windows
Put jump table in .rdata for Windows to align with that for Linux.
It can avoid loading the same code page into I$ and D$ simultaneously
and thus favor performance.
Differential Revision: https://reviews.llvm.org/D144701
Kazu Hirata [Wed, 1 Mar 2023 01:58:45 +0000 (17:58 -0800)]
Revert "[ControlHeightReduction] Don't combine a "poison" branch"
This reverts commit
38a64aab4a3fbaaeb383638ff654247902796556.
llvm-clang-x86_64-expensive-checks-debian is failing:
https://lab.llvm.org/buildbot/#/builders/16/builds/44249
Vladimir Vereschaka [Tue, 28 Feb 2023 19:47:59 +0000 (11:47 -0800)]
Fix failed libcxx test build on the Windows to Linux cross builders. NFC.
Disable `modules_include.sh.cpp` test on Windows build hosts,
it cannot be executed there anymore.
Differential Revision: https://reviews.llvm.org/D144640
Jim Ingham [Wed, 1 Mar 2023 01:14:46 +0000 (17:14 -0800)]
Fix the run locker setting for async launches that don't stop at the
initial stop. The code was using PrivateResume when it should have
used Resume.
This was allowing expression evaluation while the target was running,
and though that was caught a litle later on, we should never have gotten
that far. To make sure that this is caught immediately I made an error
SBValue when this happens, and test that we get this error.
Differential Revision: https://reviews.llvm.org/D144665
Robert Suderman [Wed, 1 Mar 2023 01:13:42 +0000 (01:13 +0000)]
[mlir][math] Math expansion for math.tan
We can implement a polynomial approximation of math.tan by
decomposing to `math.sin` and `math.cos`. While it is not
technically a polynomial approximation it should be the most
straight forward approximation.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D144980
Benjamin Chetioui [Wed, 1 Mar 2023 01:02:49 +0000 (01:02 +0000)]
[mlir][NFC] Address filecheck_lint findings in tosa-to-linalg-named.mlir.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D144971
Jim Ingham [Wed, 1 Mar 2023 00:57:03 +0000 (16:57 -0800)]
Fix typos in the test command for D144929
Jason Molenda [Wed, 1 Mar 2023 00:55:29 +0000 (16:55 -0800)]
Put the arch-dep debugserver files in main CMakeLists.txt
The architecture dependent files for debugserver were
built out of their own separate CMakeLists.txt for historical
reasons; it's not necessary any longer. Remove that file
and put them in the main debugserver CMakeLists.txt.
Differential Revision: https://reviews.llvm.org/D145020
rdar://
105993317
Jacob Young [Wed, 1 Mar 2023 00:42:32 +0000 (16:42 -0800)]
[Clang][CodeGen] Fix this argument type for certain destructors
With the Microsoft ABI, some destructors need to offset a parameter to
get the derived this pointer, in which case the type of that parameter
should not be a pointer to the derived type.
Fixes #60465
Jim Ingham [Wed, 1 Mar 2023 00:38:50 +0000 (16:38 -0800)]
An SBValue whose underlying ValueObject has no valid value, but does
hold an error should:
(a) return false for IsValid, since that's the current behavior and is
a convenient way to check "should I get the value for this".
(b) preserve the error when an SBValue is made from it, and print the
error in the ValueObjectPrinter.
Make that happen.
Differential Revision: https://reviews.llvm.org/D144664
Shoaib Meenai [Tue, 28 Feb 2023 21:13:45 +0000 (13:13 -0800)]
[builtins] Add option to always build int128 routines
32-bit targets don't build these by default, but e.g. armv7 and x86 can
build them just fine, and it's useful to have the int128 routines
available for certain applications. Add a CMake option to let us include
the int128 routines for architectures which would otherwise lack them.
Reviewed By: compnerd, MaskRay, phosek
Differential Revision: https://reviews.llvm.org/D145003
Kazu Hirata [Tue, 28 Feb 2023 20:35:55 +0000 (12:35 -0800)]
[ControlHeightReduction] Don't combine a "poison" branch
Without this patch, the control height reduction pass would combine a
"poison" branch with an earlier well-defined branch, turning the
earlier branch into a "poison" branch also.
This patch fixes the problem by rejecting "poison" conditional
branches.
Differential Revision: https://reviews.llvm.org/D145008
Jim Ingham [Tue, 28 Feb 2023 23:58:14 +0000 (15:58 -0800)]
Add SBCommandInterpreter::UserCommandExists parallel to CommandExists.
The latter only checks built-in commands. I also added some docs to
make the distinction clear and a test.
Differential Revision: https://reviews.llvm.org/D144929
Alan Hu [Tue, 28 Feb 2023 22:22:27 +0000 (22:22 +0000)]
[OCaml] Migrate from naked pointers to prepare for OCaml 5
The OCaml bindings currently return pointers to LLVM objects as-is to
OCaml. These "naked pointers" end up appearing as values of local
variables in OCaml code, stored as part of other OCaml values,
etc. The safety of this design relies on the OCaml runtime system's
ability to distinguish these pointers from pointers to memory on the
OCaml garbage collected heap. In particular, when the OCaml GC
encounters a pointer to memory known to not be part of the OCaml heap,
it does not follow it.
In OCaml 4.02 an optimized "no naked pointers" mode was introduced
where the runtime system does not perform such checks and requires
that no such naked pointers be passed to OCaml code, instead one of
several encodings needs to be used. In OCaml 5, the no naked pointers
mode is now the only mode. This diff uses one of the potential
encodings to eliminate naked pointers, making the LLVM OCaml bindings
compatible with the "no naked pointers" mode of OCaml >= 4.02 and 5.
The encoding implemented in this diff relies on LLVM objects to be at
least 2-byte aligned, meaning that the lsb of pointers will
necessarily be clear. The encoding sets the lsb when passing LLVM
pointers to OCaml, and clears it on the return path. Setting the lsb
causes the OCaml runtime system to interpret the resulting value as a
tagged integer, which does not participate in garbage collection.
In some cases, particularly functions that receive an OCaml array of
LLVM pointers, this encoding requires allocation of a temporary array,
but otherwise this diff aims to preserve the existing performance
characteristics of the OCaml bindings.
Reviewed By: jberdine
Differential Revision: https://reviews.llvm.org/D136400
Haohai Wen [Mon, 27 Feb 2023 06:42:56 +0000 (14:42 +0800)]
[X86] Revise Alderlake P-Core schedule model
The previous Alderlake P-Core model prefer data from uops.info than intel doc.
Some measures latency from uops.info is larger than real latency. e.g. addpd
latency is 3 in uops.info while 2 in intel doc. This patch adjust the priority
of those two data source so that intel doc is more preferable.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D144388
Wei Wang [Thu, 23 Feb 2023 22:53:49 +0000 (14:53 -0800)]
[Coroutines] Avoid creating conditional cleanup markers in suspend block
We shouldn't access coro frame after returning from `await_suspend()` and before `llvm.coro.suspend()`.
Make sure we always hoist conditional cleanup markers when inside the `await.suspend` block.
Fix https://github.com/llvm/llvm-project/issues/59181
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D144680
Haowei Wu [Tue, 28 Feb 2023 23:12:13 +0000 (15:12 -0800)]
[Fuchsia] Enable LLVM_USE_RELATIVE_PATHS_IN_FILES in bootstrap
This patch enables LLVM_USE_RELATIVE_PATHS_IN_FILES when building the
bootstrap toolchain for 2 stages build.
Differential Revision: https://reviews.llvm.org/D145010
Kazu Hirata [Sun, 5 Feb 2023 05:42:15 +0000 (21:42 -0800)]
[X86] Improve select of constants
Without this patch:
%cmp = icmp eq i32 %a, %b
%cond = select i1 %cmp, i32 1, i32 2
is compiled as:
31 c9 xor %ecx,%ecx
39 f7 cmp %esi,%edi
0f 94 c1 sete %cl
b8 02 00 00 00 mov $0x2,%eax
29 c8 sub %ecx,%eax
With this patch, the compiler generates:
31 c0 xor %eax,%eax
39 f7 cmp %esi,%edi
0f 95 c0 setne %al
ff c0 inc %eax
saving 5 bytes while reducing register usage.
This patch transforms C - setcc into inverted_setcc + (C-1) if C is a
nonzero constant.
This patch fixes:
https://github.com/llvm/llvm-project/issues/60854
Differential Revision: https://reviews.llvm.org/D144449
Mitch Phillips [Tue, 28 Feb 2023 22:05:42 +0000 (14:05 -0800)]
[GWP-ASan] Handle wild touches of the guarded pool.
AllocMeta could be null when returned from __gwp_asan_get_metadata() for
a bad access into the GuardedPagePool that was never allocated.
Currently, then we dereference the null pointer, oops.
Hoist the check up and print a message (only once in recoverable mode)
about the bad memory access.
Reviewed By: fmayer
Differential Revision: https://reviews.llvm.org/D144973
ManuelJBrito [Tue, 28 Feb 2023 21:50:36 +0000 (21:50 +0000)]
Revert "[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS"
This reverts commit
9e58182d6446bb61dbd13c0e6314f291e50d4d7c.
ManuelJBrito [Tue, 28 Feb 2023 21:37:30 +0000 (21:37 +0000)]
[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS
Ignoring freeze(undef) if it has multiple uses in LowerAVXCONCAT_VECTORS
causes the custom INSERT_SUBVECTOR for vector widening to be ignored.
Differential Revision: https://reviews.llvm.org/D14490
Jason Molenda [Tue, 28 Feb 2023 21:36:12 +0000 (13:36 -0800)]
Update debugserver xcode proj to build with c++17
Also a few small fixes for building debugserver on iOS
in c++17.
Jakub Kuderski [Tue, 28 Feb 2023 21:24:10 +0000 (16:24 -0500)]
[ADT] Fix const-correctness issues in `zippy`
This defines the iterator tuple based on the storage type of `zippy`,
instead of its type arguments. This way, we can support temporaries that
gets passed in and allow for them to be modified during iteration.
Because the iterator types to the tuple storage can have different types
when the storage is and isn't const, this defines a const iterator type
and non-const `begin`/`end` functions. This way we avoid unintentional
casts, e.g., trying to cast `vector<bool>::reference` to
`vector<bool>::const_reference`, which may be unrelated types that are
not convertible.
This patch is a general and free-standing improvement but my primary use
is in the implemention a version of `enumerate` that accepts multiple ranges:
D144583.
Reviewed By: dblaikie, zero9178
Differential Revision: https://reviews.llvm.org/D144834
Joseph Huber [Mon, 27 Feb 2023 16:35:30 +0000 (10:35 -0600)]
[clang-format] Only add pragma continuation indentation for 'omp' clauses
The patch in D136100 added custom handling for pragmas to assist in
formatting OpenMP clauses correctly. One of these changes added extra
indentation. This is desirable for OpenMP pragmas as they are several
complete tokens that would otherwise we on the exact same line. However,
this is not desired for the other pragmas.
This solution is extremely hacky, I'm not overly familiar with the
`clang-format` codebase. A better solution would probably require
actually parsing these as tokens, but I just wanted to propose a
solution.
Fixes https://github.com/llvm/llvm-project/issues/59473
Reviewed By: HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D144884
Peiming Liu [Tue, 28 Feb 2023 01:18:12 +0000 (01:18 +0000)]
[mlir][sparse] fix performance bug in matmul with a sparse rhs due to suboptimal iteration graphs.
While dense tensors support random accesses, it is critical to visit them in a row-major order for better cache locality. However, we previously consider dense inputs and outputs together when computing constraints for building iteration graph, it could lead us to less efficient iteration graphs.
This patch adds a new `SortMask::kIncludeDenseInput` to treat dense inputs/outputs separately when building iteration graph, thus increasing the chance for use to construct a better iteration graph.
A more fine-grained approach is to treat each input separately.
Note, related to:
https://github.com/llvm/llvm-project/issues/51651
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D144932
Med Ismail Bennani [Tue, 28 Feb 2023 20:52:21 +0000 (12:52 -0800)]
[lldb] Remove const qualifier on bool argument passed by value
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Siva Chandra Reddy [Mon, 27 Feb 2023 22:27:35 +0000 (22:27 +0000)]
[libc][NFC] Refactor internal errno.
This is in preparation for the transition to a solution to make libc tests
hermetic with respect to their use of errno. The implementation of strdup
has been switched over to libc_errno as an example of what the code looks
like in the new way.
See #61037 for more information.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D144928
Alexey Bataev [Tue, 28 Feb 2023 19:17:21 +0000 (11:17 -0800)]
[OpenMP]Emit captured decls for target data if no devices were specified.
If use_device_ptr/use_device_addr clauses are used on target data
directive and no device was specified during the compilation, only host
part should be emitted. But it still required to emit captured decls for
partially mapped data fields.
Differential Revision: https://reviews.llvm.org/D144993
Fangrui Song [Tue, 28 Feb 2023 20:16:28 +0000 (12:16 -0800)]
[test] Add missing -### to Driver/config-file3.c
Otherwise clang may invoke ld. If ld is a shell script using `~`, the
command will fail since `HOME` is changed.
Fangrui Song [Tue, 28 Feb 2023 20:06:36 +0000 (12:06 -0800)]
[Driver] Revert -mcpu=?/-mtune=? and make -mcpu=help/-mtune=help unnamed
Follow-up to D144914.
-mcpu=help seems fine as a Clang extension not in GCC, because llc supports -mcpu=help.
-mcpu=? is a bad choice as ? may be expanded by the shell.
Anshil Gandhi [Tue, 28 Feb 2023 20:03:44 +0000 (13:03 -0700)]
[AMDGPU] Replace LegacyDA with Uniformity Analysis in AnnotateUniformValues
Reviewed By: sameerds
Differential Revision: https://reviews.llvm.org/D144162
Mehdi Amini [Tue, 28 Feb 2023 20:00:45 +0000 (15:00 -0500)]
Fix SimplifyAllocConst pattern when we have alloc of negative sizes
This is UB, but we shouldn't crash the compiler either.
Fixes #61056
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D144978
Med Ismail Bennani [Tue, 28 Feb 2023 17:24:46 +0000 (09:24 -0800)]
[lldb] Fix {break,watch}point command function stopping behaviour
In order to run a {break,watch}point command, lldb can resolve to the
script interpreter to run an arbitrary piece of code or call into a
user-provided function. To do so, we will generate a wrapping function,
where we first copy lldb's internal dictionary keys into the
interpreter's global dictionary, copied inline the user code before
resetting the global dictionary to its previous state.
However, {break,watch}point commands can optionally return a value that
would tell lldb whether we should stop or not. This feature was
only implemented for breakpoint commands and since we inlined the user
code directly into the wrapping function, introducing an early return,
that caused lldb to let the interpreter global dictionary tinted with the
internal dictionary keys.
This patch fixes that issue while also adding the stopping behaviour to
watchpoint commands.
To do so, this patch refactors the {break,watch}point command creation
method, to let the lldb wrapper function generator know if the user code is
a function call or a arbitrary expression.
Then the wrapper generator, if the user input was a function call, the
wrapper function will call the user function and save the return value into
a variable. If the user input was an arbitrary expression, the wrapper will
inline it into a nested function, call the nested function and save the
return value into the same variable. After resetting the interpreter global
dictionary to its previous state, the generated wrapper function will return
the varible containing the return value.
rdar://
105461140
Differential Revision: https://reviews.llvm.org/D144688
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Valery N Dmitriev [Tue, 28 Feb 2023 18:55:00 +0000 (10:55 -0800)]
[SLP] Add banner argument to SLP costs debug printer method - NFC.
Removed unnecessary warning workaround.
Differential Revision: https://reviews.llvm.org/D144992
Sanjay Patel [Tue, 28 Feb 2023 19:18:28 +0000 (14:18 -0500)]
[InstCombine] reassociate subtract-from-constant to add-constant
(C - X) + Y --> (Y - X) + C
Moving the constant operand to an 'add' gives more
flexibility to subsequent reassociation patterns,
and it may be better for codegen on targets that
don't have subtract-from-immediate instructions.
Sanjay Patel [Tue, 28 Feb 2023 16:14:11 +0000 (11:14 -0500)]
[IR] fix spelling/formatting; NFC
Even within this file, the usual spelling is 'Opcode',
so make it consistent.
Sanjay Patel [Tue, 28 Feb 2023 15:07:54 +0000 (10:07 -0500)]
[InstCombine] simplify test for div/rem; NFC
This is too conservative as noted in the TODO comment.
Craig Topper [Tue, 28 Feb 2023 19:16:45 +0000 (11:16 -0800)]
[Sema] Add missing entries to the arrays in GetImplicitConversionName and GetConversionRank.
It appears that ICK_Zero_Queue_Conversion was inserted into the ICK
enum without updating this table. Easy to do since the table size
was set to ICK_Num_Conversion_Kinds.
I've used ICR_Exact_Match to match what was previously done for
ICK_Zero_Event_Conversion that last time someone noticed this had happened.
To prevent this from happening again, I've removed the explicit size
and used a static_assert to check the size against ICK_Num_Conversion_Kinds.
Differential Revision: https://reviews.llvm.org/D144990
Mark de Wever [Tue, 28 Feb 2023 19:03:54 +0000 (20:03 +0100)]
Revert "Revert "[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity""
This fixes the Clang modular CI, but breaks other CIs.
This reverts commit
2ae39902506f38d6368a7dbe3d64109f57ad6f99.
Michael Jones [Tue, 28 Feb 2023 18:58:02 +0000 (10:58 -0800)]
[libc] fix strtofloat test with 128 bit floats
Differential Revision: https://reviews.llvm.org/D144991
Yitzhak Mandelbaum [Tue, 28 Feb 2023 18:19:40 +0000 (18:19 +0000)]
[clang][dataflow] Fix missed fields in field set construction.
When building the set of referenced fields for the `DataflowAnalysisContext`,
include fields referenced only in default member initializers. These
initializers are visited in the CFGs of constructors and so the fields must be
included when analysing constructor bodies.
Differential Revision: https://reviews.llvm.org/D144987
Michael Jones [Fri, 17 Feb 2023 19:14:37 +0000 (11:14 -0800)]
[libc] Refactor string to float return values
The internal implementation of the string to float function previously
used pointer arguments for returning several values. Additionally it
set errno in several unexpected places. Now all of that goes through
return structs. For readability I also moved the function away from raw
pointer arithmetic towards proper indexing. I also added support for
rounding modes.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D144597
Michael Maitland [Mon, 27 Feb 2023 21:54:06 +0000 (13:54 -0800)]
[Clang][Driver] Add -mcpu=help and -mtune=help to clang
Clang currently uses `-mcpu=?` and `-mtune=?`. The `?` causes errors on some
shells such as zsh since it is a special character. In order for it to work on
shells such as zsh, the option must be passed in quotes or escaped. This patch
adds `-mcpu=help` and `-mtune=help` as another alias for `--print-supported-cpus`.
In llc, `-mcpu=help` is an alias to print supported cpus.
Differential Revision: https://reviews.llvm.org/D144914
Mark de Wever [Tue, 28 Feb 2023 18:36:56 +0000 (19:36 +0100)]
Revert "[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity"
This commits breaks the libc++ modular build in the precommit CI.
This reverts commit
74565c3add6d683559618973863e78a5e6836e48.
Nikolas Klauser [Sun, 5 Feb 2023 10:09:23 +0000 (11:09 +0100)]
[libc++] Run clang-tidy in all configurations that are run in the Docker container
Reviewed By: ldionne, Mordante, #libc
Spies: libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D143333
V Donaldson [Mon, 27 Feb 2023 22:05:53 +0000 (14:05 -0800)]
[flang] Block construct
A block construct is an execution control construct that supports
declaration scopes contained within a parent subprogram scope or another
block scope. (blocks may be nested.) This is implemented by applying
basic scope processing to the block level.
Name uniquing/mangling is extended to support this. The term "block" is
heavily overloaded in Fortran standards. Prior name uniquing used tag `B`
for common block objects. Existing tag choices were modified to free up `B`
for block construct entities, and `C` for common blocks, and resolve
additional issues with other tags. The "old tag -> new tag" changes can
be summarized as:
-> B -- block construct -> new
B -> C -- common block
C -> YI -- intrinsic type descriptor; not currently generated
CT -> Y -- nonintrinsic type descriptor; not currently generated
G -> N -- namelist group
L -> -- block data; not needed -> deleted
Existing name uniquing components consist of a tag followed by a name
from user source code, such as a module, subprogram, or variable name.
Block constructs are different in that they may be anonymous. (Like other
constructs, a block may have a `block-construct-name` that can be used
in exit statements, but this name is optional.) So blocks are given a
numeric compiler-generated preorder index starting with `B1`, `B2`,
and so on, on a per-procedure basis.
Name uniquing is also modified to include component names for all
containing procedures rather than for just the immediate host. This
fixes an existing name clash bug with same-named entities in same-named
host subprograms contained in different-named containing subprograms,
and variations of the bug involving modules and submodules.
F18 clause 9.7.3.1 (Deallocation of allocatable variables) paragraph 1
has a requirement that an allocated, unsaved allocatable local variable
must be deallocated on procedure exit. The following paragraph 2 states:
When a BLOCK construct terminates, any unsaved allocated allocatable
local variable of the construct is deallocated.
Similarly, F18 clause 7.5.6.3 (When finalization occurs) paragraph 3
has a requirement that a nonpointer, nonallocatable object must be
finalized on procedure exit. The following paragraph 4 states:
A nonpointer nonallocatable local variable of a BLOCK construct
is finalized immediately before it would become undefined due to
termination of the BLOCK construct.
These deallocation and finalization requirements, along with stack
restoration requirements, require knowledge of block exits. In addition
to normal block termination at an end-block-stmt, a block may be
terminated by executing a branching statement that targets a statement
outside of the block. This includes
Single-target branch statements:
- goto
- exit
- cycle
- return
Bounded multiple-target branch statements:
- arithmetic goto
- IO statement with END, EOR, or ERR specifiers
Unbounded multiple-target branch statements:
- call with alternate return specs
- computed goto
- assigned goto
Lowering code is extended to determine if one of these branches exits
one or more relevant blocks or other constructs, and adds a mechanism to
insert any necessary deallocation, finalization, or stack restoration
code at the source of the branch. For a single-target branch it suffices
to generate the exit code just prior to taking the indicated branch.
Each target of a multiple-target branch must be analyzed individually.
Where necessary, the code must first branch to an intermediate basic
block that contains exit code, followed by a branch to the original target
statement.
This patch implements an `activeConstructStack` construct exit mechanism
that queries a new `activeConstruct` PFT bit to insert stack restoration
code at block exits. It ties in to existing code in ConvertVariable.cpp
routine `instantiateLocal` which has code for finalization, making block
exit finalization on par with subprogram exit finalization. Deallocation
is as yet unimplemented for subprograms or blocks. This may result in
memory leaks for affected objects at either the subprogram or block level.
Deallocation cases can be addressed uniformly for both scopes in a future
patch, presumably with code insertion in routine `instantiateLocal`.
The exit code mechanism is not limited to block construct exits. It is
also available for use with other constructs. In particular, it is used
to replace custom deallocation code for a select case construct character
selector expression where applicable. This functionality is also added
to select type and associate constructs. It is available for use with
other constructs, such as select rank and image control constructs,
if that turns out to be necessary.
Overlapping nonfunctional changes include eliminating "FIR" from some
routine names and eliminating obsolete spaces in comments.
Yaxun (Sam) Liu [Fri, 24 Feb 2023 20:32:57 +0000 (15:32 -0500)]
[SimplifyCFG] Do not hoist/sink convergent function calls
Currently SimplifyCFG hoists/sink common instructions in then/else basic blocks
when certain options are enabled, which is the case for default clang optimization
pipelines for -O3. It tries to hoist/sink convergent function calls in divergent
control flow, which causes incorrect ISA generated for GPU, e.g.
https://github.com/ROCm-Developer-Tools/HIP/issues/3172
This patch fixes that by conservatively disable hoisting/sinking common
convergent function calls in then/else blocks.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D144756
Arthur Eubanks [Tue, 28 Feb 2023 17:35:58 +0000 (09:35 -0800)]
[gn build] Manually port D140588
Mark de Wever [Sat, 21 Jan 2023 12:38:44 +0000 (13:38 +0100)]
[libc++] Addresses LWG3782.
3782. Should <math.h> declare ::lerp?
Libc++ doesn't declare ::lerp, adds tests to validate the requirement.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D142817
Philip Reames [Tue, 28 Feb 2023 17:21:56 +0000 (09:21 -0800)]
[RISCV] Use !listremove for LMUL lists in V scheduling info [nfc]
Using listremove makes it easier to confirm that the code matches the comments. The only in tree users of these lists are not order sensative.
Arthur O'Dwyer [Fri, 20 Jan 2023 19:49:55 +0000 (14:49 -0500)]
[libc++] Refactor allocator_mismatch.compile.fail.cpp -> .verify.cpp
compile.fail.cpp tests are an anti-feature since they are too easy to
break when evolving code. This patch moves various allocator_mismatch
tests to .verify.cpp and normalizes the error messages from various
containers.
Differential Revision: https://reviews.llvm.org/D144913
Mark de Wever [Mon, 27 Feb 2023 18:35:20 +0000 (19:35 +0100)]
[clang] Documents clang-scan-deps requirements.
This was discussed in https://llvm.org/PR61006.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D144894
Sacha Ballantyne [Tue, 28 Feb 2023 16:42:18 +0000 (16:42 +0000)]
[flang] Fix a bug with simplified minloc that treated logicals with even values > 1 as 0
Previously the mask would be loaded as the appropriate integer type and cast to I1 to pass to
fir.if, however this truncates the integer and so would cast 6 to 0. By loading values as logicals
and casting to I1 this problem is avoided.
Reviewed By: Leporacanthicus
Differential Revision: https://reviews.llvm.org/D144974
Alex Brachet [Tue, 28 Feb 2023 17:09:33 +0000 (17:09 +0000)]
[X86] Add DwarfRegNums for segment registers
Differential Revision: https://reviews.llvm.org/D144900
Philip Reames [Tue, 28 Feb 2023 16:49:25 +0000 (08:49 -0800)]
[RISCV] Factor out multiclass definitions for V scheduling info [nfc]
Factoring out a shared multiclass imply makes it easier to see that all of these do the same thing, just on different lists. It also makes it easier to see differences - such as we don't define read related pieces for FWRed.
Differential Revision: https://reviews.llvm.org/D144899
Manupa Karunaratne [Tue, 28 Feb 2023 16:24:41 +0000 (16:24 +0000)]
[MLIR][AMDGPU][ROCDL] Adding raw.buffer.atomic.fmax/smax/umin support
This commit adds support for atomic fmax/smax/umin support
for AMDGPU dialect and the dependent dialects to allow such
a lowering.
Reviewed By: krzysz00
Differential Revision: https://reviews.llvm.org/D144097
Chia-hung Duan [Tue, 28 Feb 2023 03:28:12 +0000 (03:28 +0000)]
Revert "Revert "[scudo] Only prepare PageMap entry for partial region""
Fixed the bug in merging BatchGroups back to the FreeList. Added DCHECKs
to ensure the order of BatchGroups
This reverts commit
387452ec591c81def6d8869b23c2ab2f1c56f999.
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D144920
Nikita Popov [Tue, 28 Feb 2023 16:41:43 +0000 (17:41 +0100)]
[Orc] Try to fix linker error
Try to fix flang-aarch64-sharedlibs build.
7344f8a8442a9c3cef159445f71b4f2886ed2798 introduced a use of
LLVMCreatePassBuilderOptions(), which is part of the Passes
library, while previously only InstCombine was linked.
ibricchi [Tue, 28 Feb 2023 16:19:48 +0000 (08:19 -0800)]
[unittest] Restructure plugin cmake target
Move plugin source and cmake files into separate directory.
Typically cmake targets in LLVM have a single target per directory.
This change brings this unittest more inline with that structure.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D140588
bixia1 [Tue, 28 Feb 2023 15:45:27 +0000 (07:45 -0800)]
[mlir][sparse] Add runtime support for reading a COO tensor and writing the data to the given indices and values buffers.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D143862
Corentin Jabot [Fri, 17 Feb 2023 18:45:30 +0000 (19:45 +0100)]
[Clang] Implement CWG2518 - static_assert(false)
This allows `static_assert(false)` to not be ill-formed
in template definitions.
This change is applied as a DR in all C++ modes.
Of notes, a couple of tests were relying of the eager nature
of static_assert
* test/SemaTemplate/instantiation-dependence.cpp
* test/SemaTemplate/instantiate-var-template.cpp
I don't know if the changes to `static_assert`
still allow that sort of tests to be expressed.
Reviewed By: #clang-language-wg, erichkeane, aaron.ballman
Differential Revision: https://reviews.llvm.org/D144285
Nikita Popov [Tue, 28 Feb 2023 15:51:06 +0000 (16:51 +0100)]
[Orc] Use new pass manager in example
Invoke InstCombine via the new pass manager, instead of the
legacy pass manager.
Alexey Bataev [Tue, 28 Feb 2023 14:56:25 +0000 (06:56 -0800)]
[SLP]Fix PR61050: Assertion `I->use_empty() && "trying to erase instruction with users."
When gathering the counter for the reused scalars, need to use reduced
value, not the original reduced value. Same values counter is gathered
for reduced values, not original ones.
Peter Steinfeld [Fri, 24 Feb 2023 22:40:20 +0000 (14:40 -0800)]
[Flang] Fix ALLOCATE with MOLD for scalars
When we allocate a variable using a MOLD argument, the function that
applies the type of the MOLD argument first checks to see if the
variable is already allocated by looking at its descriptor. But in the
case of allocating a scalar, the descriptor was not yet been created and
the associated memory is uninitialized. This change fixes that.
Differential Revision: https://reviews.llvm.org/D144761
Paul Semel [Mon, 27 Feb 2023 18:15:39 +0000 (18:15 +0000)]
[clang][dataflow] unnamed bitfields should be discarded in InitListExpr
Differential Revision: https://reviews.llvm.org/D144892
Chuanqi Xu [Tue, 28 Feb 2023 15:14:51 +0000 (23:14 +0800)]
[C++20] [Modules] Trying to compare the trailing require clause from the primary template function
Close https://github.com/llvm/llvm-project/issues/60890.
For the following example:
```
export module a;
export template<typename T>
struct a {
friend void aa(a) requires(true) {
}
};
```
```
export module b;
import a;
struct b {
a<int> m;
};
```
```
export module c;
import a;
struct c {
void f() const {
aa(a<int>());
}
};
```
```
import a;
import b;
import c;
void d() {
aa(a<int>());
}
```
The current clang will reject this incorrectly. The reason is that the
require clause will be replaced with the evaluated version
(https://github.com/llvm/llvm-project/blob/
efae3174f09560353fb0f3d528bcbffe060d5438/clang/lib/Sema/SemaConcept.cpp#L664-L665).
In module 'b', the friend function is instantiated but not used so the
require clause of the friend function is `(true)`. However, in module
'c', the friend function is used so the require clause is `true`. So
deserializer classify these two function to two different functions
instead of one. Then here is the bug report.
The proposed solution is to try to compare the trailing require clause
of the primary template when performing ODR checking.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D144626
Timm Bäder [Mon, 6 Feb 2023 14:23:39 +0000 (15:23 +0100)]
[clang][Interp][NFC] Clean up InterpState.cpp
Remove unused includes, an unused using alias and braces in single-line
if statements.
Tom Eccles [Tue, 28 Feb 2023 15:21:00 +0000 (15:21 +0000)]
[flang] lower hlfir.transpose into fir runtime call
Depends on D144881
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D144882
Tom Eccles [Mon, 27 Feb 2023 14:31:39 +0000 (14:31 +0000)]
[flang] lower transpose intrinsic to hlfir.transpose operation
Depends on D144880
Differential Revision: https://reviews.llvm.org/D144881
Tom Eccles [Mon, 27 Feb 2023 13:49:29 +0000 (13:49 +0000)]
[flang] add hlfir.transpose operation
Add a HLFIR operation for the TRANSPOSE transformational intrinsic,
according to the design set out in flang/doc/HighLevelFIR.md
Differential Revision: https://reviews.llvm.org/D144880
Timm Bäder [Thu, 16 Feb 2023 07:22:26 +0000 (08:22 +0100)]
[clang][Interp][NFC] Use qualified name in Function::getName()
Sanjay Patel [Tue, 28 Feb 2023 14:15:24 +0000 (09:15 -0500)]
[InstCombine] use demanded vector elements to eliminate partially redundant instructions
In issue #60632, we have vector math ops that differ because an
operand is shuffled, but the math has limited demanded elements,
so it can be replaced by another instruction:
https://alive2.llvm.org/ce/z/TKqq7H
I don't think we have anything like this yet - it's like a
CSE/GVN fold, but driven by demanded elements of a vector op.
This is limited to splat-0 as a first step to keep it simple.
Differential Revision: https://reviews.llvm.org/D144760
David Truby [Tue, 28 Feb 2023 14:32:37 +0000 (14:32 +0000)]
[flang] Allow `to` argument of move_alloc to be class(*)
This patch expands the runtime check in move_alloc to allow the
destination to be unlimited polymorphic.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D143571
Nikita Popov [Tue, 28 Feb 2023 13:49:38 +0000 (14:49 +0100)]
[CGProfile] Don't fetch BFI without profile (NFCI)
Don't fetch BFI if the function has no entry count. Peculiarly,
the implementation was already doing this for the (no longer
existing) legacy PM implementation, but the same principle applies
to the new pass manager. The only reason why the new PM doesn't
have LazyBFI is that with the new pass manager all passes are
lazy.
This improves compile-time for non-PGO builds.
Jean Perier [Tue, 28 Feb 2023 14:15:29 +0000 (15:15 +0100)]
[flang][hlfir] Support type descriptor for initialized character component
These compiler generated component descriptor include designators packaged
as CLASS(*) for simplicity. HLFIR hit an assert in an std::get trying to
recover an Expr<SomeChar> while translating the expression type.
Use the dynamic type of the CLASS(*) expr in that case to recover the
compiler length.
Differential Revision: https://reviews.llvm.org/D144960