Commit Graph

436697 Commits

Author SHA1 Message Date
Michael Benfield 33bc9c3bf2 Document WarnOnSizeOfPointerToAggregate.
This option was just landed in D134381. It would make sense to actually
document it.

Differential Revision: https://reviews.llvm.org/D134457
2022-09-22 17:38:04 +00:00
Fangrui Song c997fe6586 [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
2022-09-22 10:26:47 -07:00
Yashwant Singh 6b93f30b1c [NFC] Empty commit to check commit access 2022-09-22 22:54:50 +05:30
Chris Bieneman 4959bfa060 [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
2022-09-22 12:17:51 -05:00
Nico Weber 711814a652 [gn build] port 47afaf2eb0 (exegesis all targets) 2022-09-22 13:17:05 -04:00
Slava Zakharin d37250c9db [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.
2022-09-22 10:10:42 -07:00
Michael Benfield 0ca5993741 [clang-tidy] Add option WarnOnSizeOfPointerToAggregate.
This is now an option under the check bugprone-sizeof-expression.

Differential Revision: https://reviews.llvm.org/D134381
2022-09-22 17:09:43 +00:00
Jonathan Camilleri 4cd7529e4c [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
2022-09-22 17:08:41 +00:00
Jonathan Camilleri 08288052ae [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
2022-09-22 17:08:41 +00:00
Aaron Ballman 9018fa1745 Update the C status page for WG14 N2359
We don't yet implement this paper, so this adds a basic test
demonstrating that.
2022-09-22 13:05:49 -04:00
Christopher Bate cb3d0260f0 [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
2022-09-22 10:51:10 -06:00
Hassnaa Hamdi f2072e0ae0 [AArh64-SVE]: Improve cost model for div/udiv/mul 128-bit vector operations
Differential Revision: https://reviews.llvm.org/D132477
2022-09-22 16:50:55 +00:00
Anastasia Stulova db664a666c [Doc][OpenCL] Fixed typos in code examples 2022-09-22 17:46:47 +01:00
Simon Pilgrim dc93202b44 [CostModel][X86] Remove duplicate ashr v4i64 cost table entry. NFCI. 2022-09-22 17:27:26 +01:00
Saleem Abdulrasool 463da422f0 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
2022-09-22 16:26:50 +00:00
bixia1 4132bce9e5 [mlir][sparse] Add codegen rule for the push_back operator.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D134372
2022-09-22 09:09:49 -07:00
Philip Reames 47afaf2eb0 [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
2022-09-22 09:02:22 -07:00
Philip Reames 32dc1151e2 [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
2022-09-22 08:53:46 -07:00
Fraser Cormack 92d71c615d [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
2022-09-22 16:38:40 +01:00
Sanjay Patel ef7d61d67c [AArch64] add tests for vector load combining; NFC
More coverage for D133584
2022-09-22 11:43:37 -04:00
Simon Pilgrim e56b507447 [CostModel][X86] Add CostKinds test coverage for mul-by-constant patterns
Help check to see the costs predicted for mul->shift conversions
2022-09-22 16:40:57 +01:00
Philip Reames e41765aa4d [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
2022-09-22 08:35:17 -07:00
Craig Topper bf7c7696fe [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
2022-09-22 08:13:48 -07:00
Craig Topper d6cb8f85bf [RISCV] Formatting fixes to RISCV.td NFC
Improve indentation. Fix the worst of the 80 column violations.
2022-09-22 08:12:59 -07:00
Dmitri Gribenko eda9fdc493 Fix -Wunused-local-typedef warning in some build configurations 2022-09-22 17:10:17 +02:00
Amara Emerson 885a87033c [GlobalISel] Enforce G_ASSERT_ALIGN to have a valid alignment > 0. 2022-09-22 16:05:07 +01:00
Nikita Popov 60990d9042 [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.
2022-09-22 16:48:51 +02:00
Nikita Popov 8df376db72 [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.
2022-09-22 16:37:10 +02:00
Peter Steinfeld 76fd4bf675 [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
2022-09-22 07:13:03 -07:00
Simon Pilgrim e31482fb73 [CostModel][X86] Add gep.ll CostKind test coverage 2022-09-22 15:07:25 +01:00
Simon Pilgrim 867cd843fe [CostModel][X86] Regenerate gep.ll test checks 2022-09-22 15:07:25 +01:00
Nikita Popov 66c6de6c9c [InstCombine] Add test for PR57899 (NFC) 2022-09-22 16:00:14 +02:00
Joe Loser cf77333da9 [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,
00874c48ea/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.
2022-09-22 07:52:22 -06:00
Matt Arsenault 94ebd7d9ff MachineVerifier: Verify REG_SEQUENCE
Somehow there was no verification of this, other than an ad-hoc
assertion in TwoAddressInstructions.
2022-09-22 09:51:15 -04:00
Nikita Popov c2e76f914c [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.
2022-09-22 15:46:00 +02:00
Erich Keane babdef27c5 Re-apply "Deferred Concept Instantiation Implementation"
This reverts commit 95d94a6775.

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
2022-09-22 05:53:59 -07:00
Haojian Wu e0cdafe8d4 [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
2022-09-22 14:23:47 +02:00
Martin Storsjö 525a400c7c [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.
2022-09-22 15:14:24 +03:00
serge-sans-paille dad36245a5 [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
2022-09-22 14:04:35 +02:00
luxufan 2e9118f1e4 [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
2022-09-22 05:08:09 +00:00
Johannes Reifferscheid eaf20c4fc2 [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
2022-09-22 13:13:21 +02:00
Tim Northover 677da09d02 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.
2022-09-22 11:58:51 +01:00
Simon Pilgrim e030be64d8 [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
2022-09-22 11:24:11 +01:00
Clement Courbet e52f8406e8 Re-land "[llvm-exegesis] Support analyzing results from a different target."
With Mips fixes.

This reverts commit 7daf60e344.
2022-09-22 11:39:52 +02:00
Simon Pilgrim b2cd8118d0 [CostModel][X86] Add CostKinds handling for smax/smin/umax/umin instructions
This was achieved with the 'cost-tables vs llvm-mca' script D103695
2022-09-22 10:19:23 +01:00
Clement Courbet 7daf60e344 Revert "[llvm-exegesis] Support analyzing results from a different target."
Breaks MIPS compile.

This reverts commit cc61c822e0.
2022-09-22 11:19:01 +02:00
Nikita Popov ab25ea6d35 [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
2022-09-22 11:15:20 +02:00
Clement Courbet cc61c822e0 [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
2022-09-22 11:11:18 +02:00
Haojian Wu 983cb53845 [pseudo] NFC, Remove an extral blank line. 2022-09-22 11:07:25 +02:00
Nikita Popov 41dde5d858 [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
2022-09-22 10:45:42 +02:00