Craig Topper [Thu, 22 Sep 2022 20:45:15 +0000 (13:45 -0700)]
[SelectionDAGBuilder] Simplify how VTs is created for constrained intrinsics. NFC
All constrained intrinsics return a single value. We can directly
convert it to an EVT instead of going through ComputeValueTypes.
bipmis [Thu, 22 Sep 2022 20:50:48 +0000 (21:50 +0100)]
Add Load merge tests to AggressiveInstCombine
Yaxun (Sam) Liu [Wed, 21 Sep 2022 04:32:57 +0000 (00:32 -0400)]
[AMDGPU] Emit module flag for all code object versions
Reviewed by: Changpeng Fang, Matt Arsenault, Brian Sumner
Differential Revision: https://reviews.llvm.org/D134355
Teresa Johnson [Thu, 22 Sep 2022 20:26:53 +0000 (13:26 -0700)]
[MemProf] Fix buildbot error due to hasValue deprecation warning
Use has_value instead of hasValue to address a deprecation warning from
a212d8da94d08e229aa8d65283e4b116310bba10. E.g.:
https://lab.llvm.org/buildbot/#/builders/57/builds/22166/steps/5/logs/stdio
Teresa Johnson [Thu, 22 Sep 2022 20:18:03 +0000 (13:18 -0700)]
[MemProf] Fix buildbot error due to unused variable from bad merge
Fix an unused variable warning introduced by
a212d8da94d08e229aa8d65283e4b116310bba10
due to a bad merge with a recent change. E.g. in
https://lab.llvm.org/buildbot/#/builders/77/builds/22095
Fangrui Song [Thu, 22 Sep 2022 20:16:50 +0000 (13:16 -0700)]
[ELF] --compress-debug-sections=zstd: ignore error if zstd was not built with ZSTD_MULTITHREAD
Louis Dionne [Thu, 22 Sep 2022 20:15:33 +0000 (16:15 -0400)]
[NFC] Remove trailing whitespace in CMake file
Teresa Johnson [Thu, 22 Sep 2022 20:10:12 +0000 (13:10 -0700)]
[MemProf] Fix buildbot errors by requiring zlib
This should fix errors like the following from using the raw
memprof_pgo.profraw profile in
a212d8da94d08e229aa8d65283e4b116310bba10:
profile uses zlib compression but the profile reader was built without zlib support
E.g.
https://lab.llvm.org/buildbot/#/builders/196/builds/18536
Craig Topper [Thu, 22 Sep 2022 18:57:21 +0000 (11:57 -0700)]
[RISCV] Remove support for the unratified Zbe, Zbf, and Zbm extensions.
These extensions do not appear to be on their way to ratification.
Chris Bieneman [Thu, 22 Sep 2022 19:49:45 +0000 (14:49 -0500)]
[NFC] Update test case to be flexible
As we add more DXIL metadata, these numbers will shift. Using regex
matches and variables will ensure the code still works as expected while
making the test less fragile.
Jan Svoboda [Thu, 22 Sep 2022 19:36:25 +0000 (12:36 -0700)]
[clang][modules][deps] Preserve module map load order
In `ASTWriter`, input files are sorted based on whether they are system or user. The current implementation used single `std::queue` with `push_back` and `push_front`. This resulted in the user files being reversed.
This patch fixes that by keeping the system/user distinction, but otherwise serializing files in the order they were loaded by the `SourceManager`. This is then used in the dependency scanner to report module map dependencies in the correct order.
Depends on D134224.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D134248
Teresa Johnson [Thu, 30 Jun 2022 21:49:44 +0000 (14:49 -0700)]
[MemProf] Memprof profile matching and annotation
Profile matching and IR annotation for memprof profiles.
See also related RFCs:
RFC: Sanitizer-based Heap Profiler [1]
RFC: A binary serialization format for MemProf [2]
RFC: IR metadata format for MemProf [3]*
* Note that the IR metadata format has changed from the RFC during
implementation, as described in the preceeding patch adding the basic
metadata and verification support.
The matching is performed during the normal PGO annotation phase, to
ensure that the inlines applied in the IR at that point are a subset
of the inlines in the profiled binary and thus reflected in the
profile's call stacks. This is important because the call frames are
associated with functions in the profile based on the inlining in the
symbolized call stacks, and this simplifies locating the subset of
profile data relevant for matching onto each function's IR.
The PGOInstrumentationUse pass is enhanced to perform matching for
whatever combination of memprof and regular PGO profile data exists in
the profile.
Using the utilities introduced in D128854:
The memprof profile data for each context is converted to "cold" or
"notcold" based on parameterized thresholds for size, access count, and
lifetime. The memprof allocation contexts are trimmed to the minimal
amount of context required to uniquely identify whether the context is
cold or not cold. For allocations where all profiled contexts have the
same allocation type, no memprof metadata is attached and instead the
allocation call is directly annotated with an attribute specifying the
alloction type. This is the same attributed that will be applied to
allocation calls once cloned for different contexts, and later used
during LibCall simplification to emit allocation hints [4].
Depends on D128141 and D128854.
[1] https://lists.llvm.org/pipermail/llvm-dev/2020-June/142744.html
[2] https://lists.llvm.org/pipermail/llvm-dev/2021-September/153007.html
[3] https://discourse.llvm.org/t/rfc-ir-metadata-format-for-memprof/59165
[4] https://github.com/google/tcmalloc/commit/
ab87cf382dc56784f783f3aaa43d6d0465d5f385
Differential Revision: https://reviews.llvm.org/D128142
Simon Pilgrim [Thu, 22 Sep 2022 17:14:49 +0000 (18:14 +0100)]
[CostModel][X86] Tidyup sdiv/srem/udiv/urem by constant cost tables
Preparation for adding cost kinds handling
This is necessary to eventually unblock D111968
Jan Svoboda [Thu, 22 Sep 2022 19:17:52 +0000 (12:17 -0700)]
[clang][modules][deps] Report modulemaps describing excluded headers
Module map files describing excluded headers do affect compilation. Track them in the compiler, serialize them into the PCM file and report them in the scanner.
Depends on D134222.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D134224
Philip Reames [Thu, 22 Sep 2022 19:15:56 +0000 (12:15 -0700)]
[DAGCombine] Check both forms of a commutative transform
The transform to fold an add into the base of a scatter/gather was only checking to see if the LHS was a splat. Included test change indicates that splats are not canonicalized to LHS, and that we need to check both sides.
Philip Reames [Thu, 22 Sep 2022 19:13:28 +0000 (12:13 -0700)]
[RISCV] Precommit test showing scatter addressing gap
Yitzhak Mandelbaum [Thu, 22 Sep 2022 12:42:23 +0000 (12:42 +0000)]
[clang][dataflow] Add support for nested method calls.
Extend the context-sensitive analysis to handle a call to a method (of the same
class) from within a method. That, is a member-call expression through `this`.
Differential Revision: https://reviews.llvm.org/D134432
Quentin Colombet [Sat, 10 Sep 2022 00:23:13 +0000 (00:23 +0000)]
[mlir][MemRef] Simplify extract_strided_metadata(expand_shape)
Add a pattern to the pass that simplifies
extract_strided_metadata(other_op(memref)).
The new pattern gets rid of the expand_shape operation while
materializing its effects on the sizes, and the strides of
the base object.
In other words, this simplification replaces:
```
baseBuffer, offset, sizes, strides =
extract_strided_metadata(expand_shape(memref))
```
With
```
baseBuffer, offset, baseSizes, baseStrides =
extract_strided_metadata(memref)
sizes#reassIdx =
baseSizes#reassDim / product(expandShapeSizes#j,
for j in group excluding
reassIdx)
strides#reassIdx =
baseStrides#reassDim * product(expandShapeSizes#j,
for j in
reassIdx+1..
reassIdx+group.size-1)
```
Where `reassIdx` is a reassociation index for the group at
`reassDim` and `expandShapeSizes#j` is either:
- The constant size at dimension j, derived directly from the
result type of the expand_shape op, or
- An affine expression: baseSizes#reassDim / product of all
constant sizes in expandShapeSizes.
Note: baseBuffer and offset are unaffected by the expand_shape
operation.
Differential Revision: https://reviews.llvm.org/D133625
Jan Svoboda [Thu, 22 Sep 2022 18:31:31 +0000 (11:31 -0700)]
[clang][deps] Report module map describing compiled module
This patch fixes compilation failure with explicit modules caused by scanner not reporting the module map describing the module whose implementation is being compiled.
Below is a breakdown of the attached test case. Note the VFS that makes frameworks "A" and "B" share the same header "shared/H.h".
In non-modular build, Clang skips the last import, since the "shared/H.h" header has already been included.
During scan (or implicit build), the compiler handles "tu.m" as follows:
* `@import B` imports module "B", as expected,
* `#import <A/H.h>` is resolved textually (due to `-fmodule-name=A`) to "shared/H.h" (due to the VFS remapping),
* `#import <B/H.h>` is resolved to import module "A_Private", since the header "shared/H.h" is already known to be part of that module, and the import is skipped.
In the end, the only modular dependency of the TU is "B".
In explicit modular build without `-fmodule-name=A`, TU does depend on module "A_Private" properly, not just textually. Clang therefore builds & loads its PCM, and knows to ignore the last import, since "shared/H.h" is known to be part of "A_Private".
But with current scanner behavior and `-fmodule-name=A` present, the last import fails during explicit build. Clang doesn't know about "A_Private" (it's included textually) and tries to import "B_Private" instead, which it doesn't know about either (the scanner correctly didn't report it as dependency). This is fixed by reporting the module map describing "A" and matching the semantics of implicit build.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D134222
Alex Brachet [Thu, 22 Sep 2022 19:03:13 +0000 (19:03 +0000)]
[ELF] Fix std::min error on MacOs
Xiang Li [Mon, 18 Jul 2022 18:50:25 +0000 (11:50 -0700)]
[HLSL] Add resource binding attribute for HLSL.
The resource binding attribute is to set the virtual registers and logical register spaces resources in HLSL are bound to.
Format is ''register(ID, space)'' like register(t3, space1).
ID must be start with
t – for shader resource views (SRV),
s – for samplers,
u – for unordered access views (UAV),
b – for constant buffer views (CBV).
Register space is default to space0.
The full documentation is available here: https://docs.microsoft.com/en-us/windows/win32/direct3d12/resource-binding-in-hlsl
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D130033
Oleg Shyshkov [Thu, 22 Sep 2022 18:05:35 +0000 (18:05 +0000)]
[mlir] Modify LinalgStructuredInterface to allow the computation block to have arguments only for a subset of operands.
Summary:
Currently there is an expectations that there is a corresponsing block argument
for each operand. For some operation, it leads to unused arguments. For example,
in `map`, only input operands are used for the computation.
Differential Revision: https://reviews.llvm.org/D134444
Leonard Chan [Tue, 20 Sep 2022 22:00:20 +0000 (22:00 +0000)]
[llvm] Handle dso_local_equivalent in FunctionComparator
This addresses https://github.com/llvm/llvm-project/issues/51066.
Prior to this, dso_local_equivalent would lead to an llvm_unreachable in
a switch in the FunctionComparator. This adds a conservative case in
that switch that just compares the underlying functions.
Differential Revision: https://reviews.llvm.org/D134300
Greg Clayton [Tue, 20 Sep 2022 02:43:10 +0000 (19:43 -0700)]
Track .dwo/.dwp loading errors and notify user when viewing variables.
When debugging using Fission (-gsplit-dwarf), we can sometimes have issues loading .dwo files if they are missing or if the path was relative and we were unable to locate the file. We can also skip loading due to DWO ID mismatch or if a .dwp file doesn't contain a matching .dwo file. Also .dwo files could be updated due to a recompile and if the user debugs an executable that was linked against the old .dwo file, it could fail to load the information.
This patch adds a m_dwo_error to DWARFUnit that can be get/set and will cause "frame variable" to show errors when there are .dwo/.dwp issues informing the user about the error.
Differential Revision: https://reviews.llvm.org/D134252
Michael Benfield [Thu, 22 Sep 2022 17:17:34 +0000 (17:17 +0000)]
Document WarnOnSizeOfPointerToAggregate.
This option was just landed in D134381. It would make sense to actually
document it.
Differential Revision: https://reviews.llvm.org/D134457
Fangrui Song [Thu, 22 Sep 2022 17:26:47 +0000 (10:26 -0700)]
[llvm-objcopy] --compress-debug-sections: remove tail padding for ELFCLASS32
For an ELFCLASS32 object, a compressed section due to --compress-debug-sections={zlib,zstd} has a
tail padding of 12 zero bytes. zlib happily allows this while zstd is rigid and
reports `error: '{{.*}}': failed to decompress section '.debug_foo': Src size is incorrect`.
Cole Kissane reported the problem.
Reviewed By: jhenderson, phosek
Differential Revision: https://reviews.llvm.org/D134385
Yashwant Singh [Thu, 22 Sep 2022 17:24:50 +0000 (22:54 +0530)]
[NFC] Empty commit to check commit access
Chris Bieneman [Wed, 21 Sep 2022 23:12:43 +0000 (18:12 -0500)]
[NFC] Refactor dxil metadata code
DXIL relies on a whole bunch of IR metadata constructs being populated
in the right shape. Rather than just hard coding or using complicated
arrangements of constant data strings, let's make first-class objects
that reprensent the metadata and manage reading and writing the
metadata from the module.
Reviewed By: python3kgae
Differential Revision: https://reviews.llvm.org/D134397
Nico Weber [Thu, 22 Sep 2022 17:16:49 +0000 (13:16 -0400)]
[gn build] port
47afaf2eb02b (exegesis all targets)
Slava Zakharin [Thu, 22 Sep 2022 16:31:20 +0000 (09:31 -0700)]
[flang][runtime] Fixes for element size calculation.
BytesFor() used to return KIND for the size, which is not always
correct, so I changed it to return the size of the actual CppType
corresponding to the given category and kind.
MinElemLen() used to calculate size incorrectly (e.g. CFI_type_extended_double
was sized 10, whereas it may occupy more bytes on a target), so I changed it
to call BytesFor().
Additional changes were needed to resolve new failures for transformational
intrinsics. These intrinsics used to work for not fully supported
data types (e.g. REAL(3)), but now stopped working because CppType
cannot be computed for those categories/kinds. The solution is to use
known element size from the source argument(s) for establishing
the destination descriptor - the element size is all that is needed
for transformational intrinsics to keep working.
Note that this does not help cases, where runtime still has to
compute the element size, e.g. when it creates descriptors for
components of derived types. If the component has unsupported
data type, BytesFor() will still fail. So these cases require
adding support for the missing types.
New regression unit test in Runtime/Transformational.cpp
demonstrates the case that will start working properly with
this commit.
Michael Benfield [Wed, 21 Sep 2022 19:46:35 +0000 (19:46 +0000)]
[clang-tidy] Add option WarnOnSizeOfPointerToAggregate.
This is now an option under the check bugprone-sizeof-expression.
Differential Revision: https://reviews.llvm.org/D134381
Jonathan Camilleri [Thu, 22 Sep 2022 16:59:00 +0000 (16:59 +0000)]
[clang][DebugInfo] Emit access specifiers for typedefs
The accessibility level of a typedef or using declaration in a
struct or class was being lost when producing debug information.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D134339
Jonathan Camilleri [Thu, 22 Sep 2022 16:47:02 +0000 (16:47 +0000)]
[DebugInfo] Emit access specifiers for typedefs
The accessibility level of a typedef or using declaration in a
struct or class was being lost when producing debug information.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D134339
Aaron Ballman [Thu, 22 Sep 2022 17:04:27 +0000 (13:04 -0400)]
Update the C status page for WG14 N2359
We don't yet implement this paper, so this adds a basic test
demonstrating that.
Christopher Bate [Thu, 22 Sep 2022 16:11:59 +0000 (10:11 -0600)]
[mlir][vector] Fix test for vector-warp-distribute
Test does a "CHECK-NOT" against the function name when it should check
to ensure that the `vector.warp_execute_on_lane_0` is removed.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D134448
Hassnaa Hamdi [Tue, 23 Aug 2022 15:22:52 +0000 (15:22 +0000)]
[AArh64-SVE]: Improve cost model for div/udiv/mul 128-bit vector operations
Differential Revision: https://reviews.llvm.org/D132477
Anastasia Stulova [Thu, 22 Sep 2022 16:46:47 +0000 (17:46 +0100)]
[Doc][OpenCL] Fixed typos in code examples
Simon Pilgrim [Thu, 22 Sep 2022 16:27:20 +0000 (17:27 +0100)]
[CostModel][X86] Remove duplicate ashr v4i64 cost table entry. NFCI.
Saleem Abdulrasool [Fri, 5 Aug 2022 16:52:03 +0000 (16:52 +0000)]
MC: make section classification a bit more thorough
This does *NOT* change the emitted section flags in any way. This only
impacts the internal classification of sections.
Extend the section classification in LLVM for ELF targets. This has one
important change: we now classify sections as text by default rather
than readonly. This matches the behaviour for GAS better.
Ensure that any section that has a writable attribute set is not treated
as readonly. We also special case any section named `.debug_` which is
reserved for DWARF as metadata. In the case none of the attributes are
set (or because no attributes were provided), consult the section name
for classification. We match the well known names and classify the
section accordingly. Any remaining section is now classified as text.
This change allows us to classify sections in the MC layer more
precisely which is needed for subsequent changes for handling target
specific behaviour.
Re-apply the change that was reverted with additional changes to
classify section prefixes appropriately and differentiate the TLS
sections, addressing the FIXME and post-commit review comments by
@MaskRay.
Differential Revision: https://reviews.llvm.org/D133456
Reviewed By: @MaskRay
bixia1 [Wed, 21 Sep 2022 16:26:09 +0000 (09:26 -0700)]
[mlir][sparse] Add codegen rule for the push_back operator.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D134372
Philip Reames [Thu, 22 Sep 2022 16:02:22 +0000 (09:02 -0700)]
[llvm-exegesis] Initialize all supported targets
Enable registration of multiple exegesis targets at once. Use idiomatic approach to defining target select macros, but leave code in the llvm-mca sub-directories for now.
This is a stepping stone towards allowing llvm-exegesis benchmarking via simulator or testing in non-target dependent tests.
Differential Revision: https://reviews.llvm.org/D133605
Philip Reames [Thu, 22 Sep 2022 15:47:19 +0000 (08:47 -0700)]
[VPlan] Only generate single instr for unpredicated stores of varying value to invariant address
This extends the previously added uniform store case to handle stores of loop varying values to a loop invariant address. Note that the placement of this code only allows unpredicated stores; this is important for correctness. (That is "IsPredicated" is always false at this point in the function.)
This patch does not include scalable types. The diff felt "large enough" as it were; I'll handle that in a separate patch. (It requires some changes to cost modeling.)
Differential Revision: https://reviews.llvm.org/D133580
Fraser Cormack [Thu, 22 Sep 2022 15:07:27 +0000 (16:07 +0100)]
[RISCV] Use structured bindings in common RVV lowering code
This patch uses structured bindings to simplify a couple of specific
cases when lowering RVV operations where we commonly declare two
SDValues and immediately 'tie' them to the mask and vector length.
There's also a couple places where we split vectors that structured
bindings make sense to use.
This patch tries to keep these sorts of changes minimal and to cases
where the returned types are commonly understood, rather than applying
this wholesale to the RISCV backend.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D134442
Sanjay Patel [Thu, 22 Sep 2022 15:21:08 +0000 (11:21 -0400)]
[AArch64] add tests for vector load combining; NFC
More coverage for D133584
Simon Pilgrim [Thu, 22 Sep 2022 15:40:50 +0000 (16:40 +0100)]
[CostModel][X86] Add CostKinds test coverage for mul-by-constant patterns
Help check to see the costs predicted for mul->shift conversions
Philip Reames [Thu, 22 Sep 2022 15:27:23 +0000 (08:27 -0700)]
[RISCV] Verify consistency of a couple TSFlags related to vector operands
Various bits of existing code assume the presence of one operand implies the presence of another. Add verifier rules to catch violations.
Differential Revision: https://reviews.llvm.org/D133810
Craig Topper [Thu, 22 Sep 2022 15:13:47 +0000 (08:13 -0700)]
[RISCV] Improve support for vector fp_to_sint_sat/uint_sat.
The default fixed vector legalization is to unroll. The default
scalable vector legalization is to clamp in the FP domain. The
RVV vfcvt instructions have saturating behavior so we can use them
directly. The only difference is that RVV instruction turn nan into
the max value, but the _SAT intrinsics want 0.
I'm only supporting 1 step of narrowing for now. I think we can
support more steps by using VNCLIP to saturate and narrower.
The only case that needs 2 steps of widening is f16->i64 which we can
do as f16->f32->i64.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D134400
Craig Topper [Thu, 22 Sep 2022 02:04:48 +0000 (19:04 -0700)]
[RISCV] Formatting fixes to RISCV.td NFC
Improve indentation. Fix the worst of the 80 column violations.
Dmitri Gribenko [Thu, 22 Sep 2022 15:09:58 +0000 (17:09 +0200)]
Fix -Wunused-local-typedef warning in some build configurations
Amara Emerson [Thu, 22 Sep 2022 14:41:27 +0000 (15:41 +0100)]
[GlobalISel] Enforce G_ASSERT_ALIGN to have a valid alignment > 0.
Nikita Popov [Wed, 14 Sep 2022 15:10:39 +0000 (17:10 +0200)]
[BasicAA] Move experimental.guard modelling to getModRefBehavior()
While we can't express this with attributes yet, we can model
these intrinsics as readonly + writing inaccessible memory (for
the control dependence) in FMRB. This way we don't need to
special-case them in getModRefInfo(), it falls out of the usual
logic.
Nikita Popov [Thu, 22 Sep 2022 14:35:07 +0000 (16:35 +0200)]
[InstCombine] Remove buggy zext of icmp eq with pow2 fold (PR57899)
For the case where the constant is a power of two rather than zero,
the fold is incorrect, because it fails to check that the bit set
in the LHS matches the bit in the RHS.
Rather than fixing this, remove the power of two handling entirely,
as a different fold will already canonicalize such comparisons to
use a zero constant.
Fixes https://github.com/llvm/llvm-project/issues/57899.
Peter Steinfeld [Wed, 21 Sep 2022 20:08:02 +0000 (13:08 -0700)]
[Flang] Finalize IO operations after calling EndIO
The process of passing arguments to IO calls can cause allocations that
get referenced during EndIO calls. Calling "Finalize" causes these
allocations to be deallocated. This means that references to them in
the code in EndIO will be invalid. The fix is to delay the call to
"finalize" until after the call to EndIO.
This particularly causes problems with the IO items are strings that are
produced by calls to functions.
Differential Revision: https://reviews.llvm.org/D134383
Simon Pilgrim [Thu, 22 Sep 2022 13:59:02 +0000 (14:59 +0100)]
[CostModel][X86] Add gep.ll CostKind test coverage
Simon Pilgrim [Thu, 22 Sep 2022 13:51:23 +0000 (14:51 +0100)]
[CostModel][X86] Regenerate gep.ll test checks
Nikita Popov [Thu, 22 Sep 2022 13:59:43 +0000 (15:59 +0200)]
[InstCombine] Add test for PR57899 (NFC)
Joe Loser [Tue, 20 Sep 2022 21:15:26 +0000 (15:15 -0600)]
[clang][docs] Fix supported element types for __builtin_reduce_(add|mul)
The docs mention that `__builtin_reduce_add` and `__builtin_reduce_mul` support
both integer and floating point element types, but only integer element types
are actually supported. See https://github.com/llvm/llvm-project/issues/57847,
and specifically,
https://github.com/llvm/llvm-project/blob/
00874c48ea4d291908517afaab50d1dcbfb016c3/clang/lib/Sema/SemaChecking.cpp#L2631 for the fact that floating point element types are not supported yet.
Fix the docs to only mention support for integer element types.
Matt Arsenault [Wed, 21 Sep 2022 14:42:03 +0000 (10:42 -0400)]
MachineVerifier: Verify REG_SEQUENCE
Somehow there was no verification of this, other than an ad-hoc
assertion in TwoAddressInstructions.
Nikita Popov [Thu, 22 Sep 2022 09:04:22 +0000 (11:04 +0200)]
[InstCombine] Use simplifyWithOpReplaced() for non-bool selects
Perform the simplifyWithOpReplaced() fold even for non-bool
selects. This subsumes a number of recently added folds for
zext/sext of the condition.
We still need to manually handle variations with both sext/zext
and not, because simplifyWithOpReplaced() only performs one
level of replacements.
Erich Keane [Fri, 19 Aug 2022 20:57:45 +0000 (13:57 -0700)]
Re-apply "Deferred Concept Instantiation Implementation"
This reverts commit
95d94a67755620c0a2871ac6f056ca8e9731d5e9.
This implements the deferred concepts instantiation, which should allow
the libstdc++ ranges to properly compile, and for the CRTP to work for
constrained functions.
Since the last attempt, this has fixed the issues from @wlei and
@mordante.
Differential Revision: https://reviews.llvm.org/D126907
Haojian Wu [Thu, 22 Sep 2022 09:50:17 +0000 (11:50 +0200)]
[AST] Better recovery on an expression refers to an invalid decl.
Prior to the patch, we didn't build a DeclRefExpr if the Decl being
referred to is invalid, because many clang downstream AST consumers
assume it, violating it will cause many diagnostic regressions.
With this patch, we build a DeclRefExpr enven for an invalid decl (when the
AcceptInvalidDecl is true), and wrap it with a dependent-type
RecoveryExpr (to prevent follow-up semantic analysis, and diagnostic
regressions).
This is a revised version of https://reviews.llvm.org/D76831
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D121599
Martin Storsjö [Thu, 22 Sep 2022 11:08:45 +0000 (11:08 +0000)]
[LLD] [ELF] Fix building with LLVM_LINK_LLVM_DYLIB since zstd was taken into use
This fixes a regression since
fa74144c64dff6b145b0b3fa9397f913ddaa87bf;
even if we're linking to the dylib (which handles all the dependencies
in LLVMSupport), we're now also directly referencing zstd from
lld/ELF, and thus need to explicitly express our dependency on it.
serge-sans-paille [Thu, 1 Sep 2022 13:15:29 +0000 (15:15 +0200)]
[clang] Rework IsTailPaddedMemberArray into isFlexibleArrayMemberExpr
This fixes a bunch of FIXME within IsTailPaddedMemberArray related code.
As a side effect, this now also triggers a warning when trying to access a
"struct hack" member with an index above address space index range.
Differential Revision: https://reviews.llvm.org/D133108
luxufan [Mon, 19 Sep 2022 03:29:16 +0000 (03:29 +0000)]
[MemorySSA] Reset location size if IsGuaranteedLoopInvariant after phi tranlation
We set the Location size to beforeOrAfter if the Location value is not
guaranteed loop invariant. But in some cases, we need to reset the
location size if the location size is precise after phi tranlation of
location value. This will improve MemorySSA analysis results.
Differential Revision: https://reviews.llvm.org/D134161
Johannes Reifferscheid [Thu, 22 Sep 2022 11:01:28 +0000 (13:01 +0200)]
[mlir] Fix a cast that should be a dyn_cast.
This fixes a crash for certain IR, see the new test case for an
example.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D134424
Tim Northover [Tue, 20 Sep 2022 14:03:26 +0000 (15:03 +0100)]
AArch64: add support for newer Apple CPUs
They're roughly ARMv8.6. This works in the .td file, but in
AArch64TargetParser.def, marking them v8.6 brings in support for the SM4
cryptographic hash and we don't actually have that. So TargetParser side
they're marked as v8.5, with the extra features (BF16 and I8MM added manually).
Finally, A16 supports the HCX extension in addition to v8.6. This has no
TargetParser implications.
Simon Pilgrim [Thu, 22 Sep 2022 10:24:01 +0000 (11:24 +0100)]
[CostModel][X86] Add partial CostKinds handling for funnelshifts/rotates
This mainly just adds costs for the targets where we have actual funnelshift/rotate instructions (VBMI2/XOP etc.) - the cases where we expand still need addressing, although for many the default shift+or expansion, especially for uniform cases, isn't that bad.
This was achieved with the 'cost-tables vs llvm-mca' script D103695
Clement Courbet [Thu, 22 Sep 2022 09:27:44 +0000 (11:27 +0200)]
Re-land "[llvm-exegesis] Support analyzing results from a different target."
With Mips fixes.
This reverts commit
7daf60e3440b22b79084bb325d823aa3ad8df0f3.
Simon Pilgrim [Thu, 22 Sep 2022 09:19:16 +0000 (10:19 +0100)]
[CostModel][X86] Add CostKinds handling for smax/smin/umax/umin instructions
This was achieved with the 'cost-tables vs llvm-mca' script D103695
Clement Courbet [Thu, 22 Sep 2022 09:18:12 +0000 (11:18 +0200)]
Revert "[llvm-exegesis] Support analyzing results from a different target."
Breaks MIPS compile.
This reverts commit
cc61c822e05c51e494c50d1e72f963750116ef08.
Nikita Popov [Thu, 1 Sep 2022 14:51:00 +0000 (16:51 +0200)]
[AA] Model operand bundles more precisely
Based on D130896, we can model operand bundles more precisely. In
addition to the baseline ModRefBehavior, a reading/clobbering operand
bundle may also read/write all locations. For example, a memcpy with
deopt bundle can read any memory, but only write argument memory.
This means that getModRefInfo() for memcpy with a pointer that does
not alias the arguments results in Ref, rather than ModRef, without
the need to implement any special handling.
Differential Revision: https://reviews.llvm.org/D130980
Clement Courbet [Mon, 12 Sep 2022 08:13:14 +0000 (10:13 +0200)]
[llvm-exegesis] Support analyzing results from a different target.
We were using the native triple to parse the benchmarks. Use the triple
from the benchmarks file.
Right now this still only allows analyzing files produced by the current
target until D133605 is in.
This also makes the `Analysis` class much less ad-hoc.
Differential Revision: https://reviews.llvm.org/D133697
Haojian Wu [Thu, 22 Sep 2022 09:07:25 +0000 (11:07 +0200)]
[pseudo] NFC, Remove an extral blank line.
Nikita Popov [Wed, 21 Sep 2022 09:57:49 +0000 (11:57 +0200)]
[InstSimplify] Support vectors in simplifyWithOpReplaced()
We can handle vectors inside simplifyWithOpReplaced(), as long as
cross-lane operations are excluded. The equality can hold (or not
hold) for each vector lane independently, so we shouldn't use the
replacement value from other lanes.
I believe the only operations relevant here are shufflevector (where
all previous bugs were seen) and calls (which might use shuffle-like
intrinsics and would require more careful classification).
Differential Revision: https://reviews.llvm.org/D134348
serge-sans-paille [Tue, 20 Sep 2022 12:45:11 +0000 (14:45 +0200)]
[BOLT] Fix (part of) dylib compatibility
Non-LLVM components should not be listed as part of LLVM_LINK_COMPONENTS.
Differential Revision: https://reviews.llvm.org/D134278
serge-sans-paille [Thu, 22 Sep 2022 08:41:21 +0000 (10:41 +0200)]
Revert "[bolt] Fix (part of) dylib compatibility"
This reverts commit
34ad83d883cc4505412a7c3e1e3da74e5408aa82.
serge-sans-paille [Tue, 20 Sep 2022 12:45:11 +0000 (14:45 +0200)]
[bolt] Fix (part of) dylib compatibility
Non-LLVM component should not be listed as part of LLVM_LINK_COMPONENTS
Differential Revision: https://reviews.llvm.org/D134278
Ivan Radanov Ivanov [Thu, 22 Sep 2022 08:11:41 +0000 (10:11 +0200)]
[MLIR] Revert default NVIDIA GPU version
Due to integration tests failing revert mlir::SerializeToCubinPass defaults to old ones (changed in https://reviews.llvm.org/D134153)
Reviewed By: akuegel
Differential Revision: https://reviews.llvm.org/D134414
Ilia Diachkov [Tue, 20 Sep 2022 13:40:57 +0000 (16:40 +0300)]
[SPIRV] fix build with clang and use PoisonValue instead of UndefValue
The patch fixes the SPIRV backend build using clang. It also replaces
UndefValue with PoisonValue in SPIRVRegularizer.cpp.
Fixes: #57773
Differential Revision: https://reviews.llvm.org/D134071
Florian Hahn [Thu, 22 Sep 2022 07:49:56 +0000 (08:49 +0100)]
[llvm-reduce] Add test with debug nodes not being removed.
Add a test where llvm-reduce at the moment cannot drop unneeded debug
metadata nodes referenced by DICompileUnit and DISubpgoram.
LLVM GN Syncbot [Thu, 22 Sep 2022 07:29:04 +0000 (07:29 +0000)]
[gn build] Port
32a8260ccc8b
serge-sans-paille [Wed, 21 Sep 2022 14:08:45 +0000 (16:08 +0200)]
[clang] Fix interaction between asm labels and inline builtins
One must pick the same name as the one referenced in CodeGenFunction when
generating .inline version of an inline builtin, otherwise they are not
correctly replaced.
Differential Revision: https://reviews.llvm.org/D134362
Christudasan Devadasan [Thu, 22 Sep 2022 05:19:46 +0000 (10:49 +0530)]
-dot-machine-cfg for printing MachineFunction to a dot file
This pass allows a user to dump a MIR function to a dot file
and view it as a graph. It is targeted to provide a similar
functionality as -dot-cfg pass on LLVM-IR. As of now the pass
also support below flags:
-dot-mcfg-only [optional][won't print instructions in the
graph just block name]
-mcfg-dot-filename-prefix [optional][prefix to add to output dot file]
-mcfg-func-name [optional] [specify function name or it's
substring, handy if mir file contains multiple functions and
you need to see graph of just one]
More flags and details can be introduced as per the requirements
in future. This pass is inspired from -dot-cfg IR pass and APIs
are written in almost identical format.
Patch by Yashwant Singh <Yashwant.Singh@amd.com> (yassingh)
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D133709
Chenbing Zheng [Thu, 22 Sep 2022 07:08:38 +0000 (15:08 +0800)]
[InstCombine] Precommit tests for shl_trunc_icmp. nfc
Juan Manuel MARTINEZ CAAMAÑO [Wed, 21 Sep 2022 13:31:40 +0000 (13:31 +0000)]
[NFC] Remove unused set construction from DILocation::getMergedLocation
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D134357
LiaoChunyu [Thu, 22 Sep 2022 03:53:24 +0000 (11:53 +0800)]
[RelocationResolver] Add R_RISCV_SET{16,32}
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D134408
Craig Topper [Thu, 22 Sep 2022 04:54:03 +0000 (21:54 -0700)]
[RISCV] Replace RISCVISD::GREV/GORC/SHFL/UNSHFL with BREV8/ORC_B/ZIP/UNZIP.
With Zbp removed, we no longer need the generalized forms.
The computeKnownBitsForTargetNode code brev8/orc.b is still based
on the general form with the shift amount forced to 7.
Craig Topper [Thu, 22 Sep 2022 04:04:10 +0000 (21:04 -0700)]
[RISCV] Remove support for the unratified Zbp extension.
This extension does not appear to be on its way to ratification.
Still need some follow up to simplify the RISCVISD nodes.
Congzhe Cao [Thu, 22 Sep 2022 04:00:52 +0000 (00:00 -0400)]
[LoopInterchange][PR57148] Ensure the correct form of IR after transformation
This is a bugfix patch that resolves the following two bugs in loop interchange:
1. PR57148 which is an assertion error due to of loss of LCSSA form after interchange,
as referred to test1() in pr57148.ll.
2. Use before def for the outermost loop induction variables after interchange,
as referred to test2() in pr57148.ll.
The fix in this patch is that:
1. In cases where the LCSSA form is not maintained after interchange, we update the IR
to the LCSSA form again.
2. We split the phi nodes in the inner loop header into a separate basic block to avoid
the situation where use of the outer indvar appears before its def after interchange.
Previously we already did this for innermost loops, now we do it for non-innermost
loops (e.g., middle loops) as well.
Reviewed By: bmahjour, Meinersbur, #loopoptwg
Differential Revision: https://reviews.llvm.org/D132055
Fanchen Kong [Thu, 22 Sep 2022 04:05:44 +0000 (21:05 -0700)]
[WebAssembly] Improve codegen for loading scalars from memory to v128
Use load32_zero instead of load32_splat to load the low 32 bits from memory to
v128. Test cases are added to cover this change.
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D134257
Congzhe Cao [Thu, 22 Sep 2022 03:35:10 +0000 (23:35 -0400)]
[LoopPassManager] Ensure to construct loop nests with the outermost loop
This patch is to resolve the bug reported and discussed in
https://reviews.llvm.org/D124926#3718761 and https://reviews.llvm.org/D124926#3719876.
The problem is that loop interchange is a loopnest pass under the new pass manager,
but the loop nest may not be constructed correctly by the loop pass manager after
running loop interchange and before running the next pass, which might cause problems
when it continues running the next pass.
The reason that the loop nest is constructed incorrectly is that the outermost
loop might have changed after interchange, and what was the original outermost
loop is not the current outermost loop anymore. Constructing the loop nest based
on the original outermost loop would generate an invalid loop nest.
The fix in this patch is that, in the loop pass manager before running each loopnest
pass, we re-cosntruct the loop nest based on the current outermost loop, if LPMUpdater
notifies the loop pass manager that the previous loop nest has been invalidated by passes
like loop interchange.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D132199
LiaoChunyu [Wed, 21 Sep 2022 13:46:11 +0000 (21:46 +0800)]
[RelocationResolver] Add R_RISCV_SET8
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D134164
Chuanqi Xu [Thu, 22 Sep 2022 02:59:39 +0000 (10:59 +0800)]
[C++] [Coroutines] Prefer aligned (de)allocation for coroutines -
implement the option2 of P2014R0
This implements the option2 of
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2014r0.pdf.
This also fixes https://github.com/llvm/llvm-project/issues/56671.
Although wg21 didn't get consensus for the direction of the problem,
we're happy to have some implementation and user experience first. And
from issue56671, the option2 should be the pursued one.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D133341
Corentin Jabot [Tue, 13 Sep 2022 18:09:56 +0000 (20:09 +0200)]
Update Unicode to 15.0
Unicode 15.0 adds 4,489 characters, for a total of 149,186 characters.
These additions include 2 new scripts along with 20 new emoji characters,
and 4,193 CJK ideographs.
This changes modify most existing tables including
- XID_Start/XID_Continue in Clang
- The character name database (used by \N{} in Clang)
- The list of formattable/printable codepoints
- The case folding algorithm (which we had not updated since Unicode 9)
- The list of nonspacing/enclosing marks used by the column width
computation algorithm. The rest of the column width algorithm
is not updated.
Reviewed By: tahonermann
Differential Revision: https://reviews.llvm.org/D133807
Craig Topper [Thu, 22 Sep 2022 01:17:22 +0000 (18:17 -0700)]
[RISCV] Remove some unused Predicates from tablegen. NFC
Specifically predicates for extensions that are subsets of other
extensions. These predicates should never be used. Should always
check the superset extension or the superset ORed with the sub extendsion.
River Riddle [Wed, 21 Sep 2022 20:40:47 +0000 (13:40 -0700)]
[mlir] Flip PDL to use Both accessors
This allows for incrementally updating the old API usages without
needing to update everything at once. PDL will be left on Both
for a little bit and then flipped to prefixed when all APIs have been
updated.
Differential Revision: https://reviews.llvm.org/D134387
River Riddle [Wed, 21 Sep 2022 20:08:26 +0000 (13:08 -0700)]
[mlir] Flip Async/GPU/OpenACC/OpenMP to use Both accessors
This allows for incrementally updating the old API usages without
needing to update everything at once. These will be left on Both
for a little bit and then flipped to prefixed when all APIs have been
updated.
Differential Revision: https://reviews.llvm.org/D134386
Jan Korous [Tue, 13 Sep 2022 21:45:45 +0000 (14:45 -0700)]
[analyzer] Support implicit parameter 'self' in path note
showBRParamDiagnostics assumed stores happen only via function parameters while that
can also happen via implicit parameters like 'self' or 'this'.
The regression test caused a failed assert in the original cast to ParmVarDecl.
Differential Revision: https://reviews.llvm.org/D133815
Vitaly Buka [Sun, 18 Sep 2022 06:44:23 +0000 (23:44 -0700)]
[msan] Instrument vtest instrinsics
Instrumentation just ORs shadow of inputs.
I assume some result shadow bits can be reset if we go into specifics of particular checks,
but as-is it is still an improvement against existing default strict instruction handler, when
every set bit of input shadow is reported as an error.
Reviewed By: kda
Differential Revision: https://reviews.llvm.org/D134123
Craig Topper [Wed, 21 Sep 2022 23:44:02 +0000 (16:44 -0700)]
[RISCV] Add a couple more fp_to_sint_sat/uint_sat tests. NFC