Piotr Zegar [Fri, 23 Jun 2023 16:14:14 +0000 (16:14 +0000)]
[clang-tidy] Document modernize-raw-string-literal check options
Add missing documentation for DelimiterStem and ReplaceShorterLiterals
options.
Fixes #54662
Reviewed By: Eugene.Zelenko
Differential Revision: https://reviews.llvm.org/D153639
Ties Stuij [Fri, 23 Jun 2023 15:27:22 +0000 (16:27 +0100)]
disable execute-only tests which are failing with expensive checks
Temporarily disabling the execute-only tests. We recently added codegen for
armv6-m, which is still in heavy development (D152795).
Disabling the tests while we're figuring out what's going on is probably the
least disruptive option, as a patch dependent on it also already landed.
Simon Pilgrim [Fri, 23 Jun 2023 15:22:01 +0000 (16:22 +0100)]
[DAG] mergeTruncStores - early out if we collect more than the maximum number of stores
If we have an excessive number of stores in a single chain then the candidate WideVT may exceed the maximum width of an EVT integer type (and will assert) - but since mergeTruncStores doesn't support anything wider than a i64 store we should just early-out if we've collected more than stores than that.
Fixes #63306
Nikita Popov [Fri, 23 Jun 2023 15:07:35 +0000 (17:07 +0200)]
[LSR] Convert some tests to opaque pointers (NFC)
Nikita Popov [Fri, 23 Jun 2023 15:06:51 +0000 (17:06 +0200)]
[LSR] Regenerate test checks (NFC)
Nikita Popov [Fri, 23 Jun 2023 14:54:49 +0000 (16:54 +0200)]
[ArgPromotion] Remove code for handling typed pointers (NFC)
eopXD [Thu, 22 Jun 2023 08:01:51 +0000 (01:01 -0700)]
[RISCV] Add a policy operand to VPseudoBinaryNoMaskTURoundingMode [NFC]
The template was created in D151396 but was not aware of the change in
D153067. This commit adds the operand and keep similar templates
aligned.
Reviewed By: reames, craig.topper
Differential Revision: https://reviews.llvm.org/D153506
Emilia Kond [Fri, 23 Jun 2023 14:30:19 +0000 (17:30 +0300)]
[clang-format] Respect ColumnLimit 0 line breaks in inline asm
Previously, using ColumnLimit: 0 with extended inline asm with the
BreakBeforeInlineASMColon: OnlyMultiline option (the default style),
the formatter would act as if in Always mode, meaning a line break was
added before every colon in an extended inline assembly block.
This patch respects the already existing line breaks, and doesn't add
any new ones, if in ColumnLimit 0 mode.
Behaviour with Always stays as expected, with a break before every colon
regardless of any existing line breaks.
Behaviour with Never was broken before, and remains broken with this patch,
it is just never respected in ColumnLimit 0 mode.
Fixes https://github.com/llvm/llvm-project/issues/62754
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D150848
Nikita Popov [Fri, 23 Jun 2023 13:59:02 +0000 (15:59 +0200)]
[InstCombine] Add created extracts to worklist
Use InstCombine's insertion helper for the created extracts, so
they become part of the worklist and will be revisited.
David Green [Fri, 23 Jun 2023 13:45:14 +0000 (14:45 +0100)]
[DAG] Fix and expand fmin/fmax reassociation fold.
This call to reassociateReduction is used by both fminnum/fmaxnum and
fminimum/fmaximum. In adding support for fminimum/fmaximum we appear to be
fixing the use of an incorrect reduction type, which should have only applied
to minnum/maxnum.
I also believe that it doesn't need nsz and reassoc to perform the
reassociation. For float min/max it should always be valid.
Differential Revision: https://reviews.llvm.org/D153247
Nikita Popov [Fri, 23 Jun 2023 13:09:11 +0000 (15:09 +0200)]
[InstCombine] Track inserted instructions when lowering objectsize
The inserted instructions can usually be simplified. Make sure this
happens in the same InstCombine iteration by adding them to the
worklist.
We happen to get some better optimization in two cases, but this is
just a lucky accident. https://github.com/llvm/llvm-project/issues/63472
tracks implementing a fold for that case.
This doesn't track all inserted instructions yet, for that we would
also have to include those created by ObjectSizeOffsetEvaluator.
Takuya Shimizu [Fri, 23 Jun 2023 13:25:04 +0000 (22:25 +0900)]
[clang][Sema] Fix comments to conform to bugprone-argument-comment (NFC)
Makes some comments conform to bugprone-argument-comment (https://clang.llvm.org/extra/clang-tidy/checks/bugprone/argument-comment.html)
Alex Bradbury [Fri, 23 Jun 2023 13:22:25 +0000 (14:22 +0100)]
[RISCV][doc] Document support for zvfbfmin and zvfbfwma
My MC layer support patches missed adding these to RISCVUsage. Also
update the link to the most recent spec PDF (including the recently
committed encoding fix for vfwmaccbf16.
Alex Bradbury [Fri, 23 Jun 2023 13:17:57 +0000 (14:17 +0100)]
[RISCV] Implement support for bf16 truncate/extend on hard FP targets
For the same reasons as D151284, this requires custom lowering of the
truncate libcall on hard float ABIs (the normal libcall code path is
used on soft ABIs).
The extend operation is implemented by a shift just as in the standard
legalisation, but needs to be custom lowered because i32 isn't a legal
type on RV64.
This patch aims to make the minimal changes that result in correct
codegen for the bfloat.ll tests.
Differential Revision: https://reviews.llvm.org/D151663
Matt Arsenault [Sun, 20 Nov 2022 16:39:15 +0000 (08:39 -0800)]
HIP: Directly call trunc builtins
Matt Arsenault [Tue, 20 Jun 2023 11:53:16 +0000 (07:53 -0400)]
AMDGPU: Don't use old form of fneg in some tests
Matt Arsenault [Wed, 14 Jun 2023 13:15:49 +0000 (09:15 -0400)]
AMDGPU: Modernize exp codegen tests
Find and replace on the new log tests (plus <3 x half> which was
missing). Apparently exp10 never worked.
Alex Bradbury [Fri, 23 Jun 2023 13:00:34 +0000 (14:00 +0100)]
[RISCV][MC] Fix encoding for vfwmaccbf16
The encoding matched the one given in the bf16 extension specification
PDF, but per https://github.com/riscv/riscv-bfloat16/issues/45 it seems
this encoding was not the one that is intended and was incorrectly
modified due to an issue in the PDF generation process. This patch
corrects the opcode to 111011 from 100011.
The correct encoding is shown in the new spec PDF
<https://github.com/riscv/riscv-bfloat16/releases/tag/
20230614>.
Differential Revision: https://reviews.llvm.org/D152894
Aaron Ballman [Fri, 23 Jun 2023 12:56:29 +0000 (08:56 -0400)]
Fixed failed assertion w/attribute on anon unions
This amends
304d1304b7bac190b6c9733eb07be284bfc17030 to process the
declaration attributes rather than assert on them; nothing prevents an
attribute from being written on an anonymous union.
Fixes https://github.com/llvm/llvm-project/issues/48512
John Brawn [Mon, 12 Jun 2023 15:43:12 +0000 (16:43 +0100)]
[lld][ARM] Add support for 16-bit thumb group relocations
This adds support for the following relocations:
* R_ARM_THM_ALU_ABS_G0_NC
* R_ARM_THM_ALU_ABS_G1_NC
* R_ARM_THM_ALU_ABS_G2_NC
* R_ARM_THM_ALU_ABS_G3
as defined in:
https://github.com/ARM-software/abi-aa/blob/main/aaelf32/aaelf32.rst#5615static-thumb16-relocations
Differential Revision: https://reviews.llvm.org/D153407
Matt Arsenault [Sun, 11 Jun 2023 16:41:43 +0000 (12:41 -0400)]
AMDGPU: Use correct lowering for llvm.log2.f32
We previously directly codegened to v_log_f32, which is broken for
denormals. The lowering isn't complicated, you simply need to scale
denormal inputs and adjust the result. Note log and log10 are still
not accurate enough, and will be fixed separately.
Ivan Kosarev [Fri, 23 Jun 2023 12:27:23 +0000 (13:27 +0100)]
[AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 12.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D152905
Matt Arsenault [Thu, 15 Jun 2023 00:12:41 +0000 (20:12 -0400)]
AMDGPU: Add more log vector tests
Marius Brehler [Fri, 5 May 2023 14:56:23 +0000 (14:56 +0000)]
[mlir][emitc] Add add and sub operations
This adds operations for binary additive operators to EmitC. The input
arguments to these ops can be EmitC pointers and thus the operations can
be used for pointer arithmetic.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D149963
Haojian Wu [Fri, 23 Jun 2023 12:07:06 +0000 (14:07 +0200)]
[clangd] Replace the hacky include-cleaner macro-reference implementation.
Now MainFileMacros preserves enough information, we perform a just-in-time
convertion to interop with include-cleaner::Macro for include-cleaer features.
Differential Revision: https://reviews.llvm.org/D147034
Nikita Popov [Fri, 23 Jun 2023 12:08:19 +0000 (14:08 +0200)]
[SCEV] Add test for alloca ranges (NFC)
Ivan Kosarev [Fri, 23 Jun 2023 11:43:39 +0000 (12:43 +0100)]
[AMDGPU][AsmParser] Eliminate cvtMtbuf().
Now that we have proper support for optional operands, the standard LLVM
machinery can take care of converting parsed instructions to MCInsts.
There are likely more cases where the conversion can be done
automatically, probably with some additional treatment. The plan is to
address them separately.
Part of <https://github.com/llvm/llvm-project/issues/62629>.
Reviewed By: arsenm, foad
Differential Revision: https://reviews.llvm.org/D153565
Ivan Kosarev [Fri, 23 Jun 2023 11:24:36 +0000 (12:24 +0100)]
[AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 10.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D152903
Nikita Popov [Fri, 23 Jun 2023 11:08:46 +0000 (13:08 +0200)]
[ValueTracking] Correctly check addrspace of alloca
The DataLayout alloca address space is the address space that should
be used when creating new allocas. However, not all allocas are
required to be in this address space. The isKnownNonZero() check
should work on the actual address space of the alloca, not the
default alloca address space.
Aaron Ballman [Fri, 23 Jun 2023 11:02:21 +0000 (07:02 -0400)]
Fix a failing assertion with implicit function definitions
When implicitly defining a function in C, we would try to find an
appropriate declaration context for the function to be declared within.
However, we did not account for GNU statement expressions, which
masquerade as a compound statement and can be used in other contexts
such as within structure member declarations.
Fixes https://github.com/llvm/llvm-project/issues/48579
Michael Platings [Wed, 21 Jun 2023 13:49:09 +0000 (14:49 +0100)]
[Clang][Driver] Warn on invalid Arm or AArch64 baremetal target triple
A common user mistake is specifying a target of aarch64-none-eabi or
arm-none-elf whereas the correct names are aarch64-none-elf &
arm-none-eabi. Currently if a target of aarch64-none-eabi is specified
then the Generic_ELF toolchain is used, unlike aarch64-none-elf which
will use the BareMetal toolchain. This is unlikely to be intended by the
user so issue a warning that the target is invalid.
The target parser is liberal in what input it accepts so invalid triples
may yield behaviour that's sufficiently close to what the user intended.
Therefore invalid triples were used in many tests. This change updates
those tests to use valid triples.
One test (gnu-mcount.c) relies on the Generic_ELF toolchain behaviour so
change it to explicitly specify aarch64-unknown-none-gnu as the target.
Reviewed By: peter.smith, DavidSpickett
Differential Revision: https://reviews.llvm.org/D153430
Luke Lau [Thu, 22 Jun 2023 16:59:55 +0000 (16:59 +0000)]
[CostModel] Use operands argument in getInstructionCost in more places
The current instruction's pointer operand may be different from the one
specified in the Operands argument. We should use the pointer operand
from here instead in case the user has transformed it.
This manifested itself somewhere down the line in
https://reviews.llvm.org/D149889, but I haven't been able to create a
test case on its own yet unfortunately.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D153574
Nikita Popov [Fri, 23 Jun 2023 10:28:59 +0000 (12:28 +0200)]
[SCEV] Use object size for allocas as well
The object size and alignment based restriction on the possible
allocation range also applies to allocas, not just globals, so
handle them as well.
We shouldn't really need any type restriction here at all, but
for now stay conservative.
Nikita Popov [Fri, 23 Jun 2023 10:30:01 +0000 (12:30 +0200)]
[SCEV] Store getValue() result in variable (NFC)
David Green [Fri, 23 Jun 2023 10:28:09 +0000 (11:28 +0100)]
[AArch64] Add tests for double reducts of vector.reduce.fmaximum/fminimum. NFC
Including some tests with mixed minnum/minimum reductions and removing the fast
from fmin/fmax reductions as those should not be needed.
Serge Pavlov [Fri, 23 Jun 2023 10:19:38 +0000 (17:19 +0700)]
[symbolizer] Check existence of input file in GNU mode
GNU addr2line exits immediately if it cannot open the file specified as
executable/relocatable. In contrast llvm-addr2line does not exit and, if
addresses are not specified in command line, waits for input on stdin. This
causes the test compiler-rt/test/asan/TestCases/Posix/asan-symbolize-bad-path.cc to block
forever on Gentoo (see https://reviews.llvm.org/rG27c4777f41d2ab204c1cf84ff1cccd5ba41354da#1190273).
To fix this issue the behavior llvm-addr2line now exits if
executable/relocatable file cannot be found.
It fixes https://github.com/llvm/llvm-project/issues/42099 (llvm-addr2line
does not exit when passed a non-existent file).
Differential Revision: https://reviews.llvm.org/D147652
Nikita Popov [Fri, 23 Jun 2023 10:15:02 +0000 (12:15 +0200)]
[ConstantRange] Calculate precise range for multiply by -1
These are pretty common in SCEV, so make sure we get a precise
result by mapping to the sub() operation.
Igor Kirillov [Fri, 23 Jun 2023 09:55:34 +0000 (09:55 +0000)]
Revert "Revert "[CodeGen] Extend reduction support in ComplexDeinterleaving pass to support predication""
Adds the capability to recognize SelectInst that appear in the IR.
These instructions are generated during scalable vectorization for reduction
and when the code contains conditions inside the loop body or when
"-prefer-predicate-over-epilogue=predicate-dont-vectorize" is set.
Differential Revision: https://reviews.llvm.org/D152558
This reverts commit
ab09654832dba5cef8baa6400fdfd3e4d1495624.
Reason: Reapplying after removing unnecessary default case in switch expression.
Ties Stuij [Fri, 23 Jun 2023 09:16:48 +0000 (10:16 +0100)]
[ARM] generate armv6m eXecute Only (XO) code
[ARM] generate armv6m eXecute Only (XO) code for immediates, globals
Previously eXecute Only (XO) support was implemented for targets that support
MOVW/MOVT (~armv7+). See: https://reviews.llvm.org/D27449
XO prevents the compiler from generating data accesses to code sections. This
patch implements XO codegen for armv6-M, which does not support MOVW/MOVT, and
must resort to the following general pattern to avoid loads:
movs r3, :upper8_15:foo
lsls r3, #8
adds r3, :upper0_7:foo
lsls r3, #8
adds r3, :lower8_15:foo
lsls r3, #8
adds r3, :lower0_7:foo
ldr r3, [r3]
This is equivalent to the code pattern generated by GCC.
The above relocations are new to LLVM and have been implemented in a parent
patch: https://reviews.llvm.org/D149443.
This patch limits itself to implementing codegen for this pattern and enabling
XO for armv6-M in the backend.
Separate patches will follow for:
- switch tables
- replacing specific loads from constant islands which are spread out over the
ARM backend codebase. Amongst others: FastISel, call lowering, stack frames.
Reviewed By: john.brawn
Differential Revision: https://reviews.llvm.org/D152795
pvanhout [Fri, 23 Jun 2023 09:42:51 +0000 (11:42 +0200)]
[NFC] clang-format GlobalISelEmitter.cpp
It was overdue for a clang-format run, and it avoids unrelated formatting changes sneaking into diffs.
pvanhout [Fri, 23 Jun 2023 09:39:56 +0000 (11:39 +0200)]
[NFC] Remove leftover `inline` on some RuleMatcher functions
Accidentally copy-pasted them into the .cpp while refactoring the file in D151432
Those functions are currently only used in the .cpp so it didn't cause an issue, but it causes an undefined reference if another file attempts to use them.
Jolanta Jensen [Mon, 12 Jun 2023 09:14:13 +0000 (09:14 +0000)]
[SVE ACLE] Remove DAG combines that are no longer relevant.
This patch removes DAG combines that are no longer relevant
because equivalent IR combines have been added.
Differential Revision: https://reviews.llvm.org/D153445
Jeremy Furtek [Fri, 23 Jun 2023 08:54:35 +0000 (10:54 +0200)]
[APFloat] Add APFloat semantic support for TF32
This diff adds APFloat support for a semantic that matches the TF32 data type
used by some accelerators (most notably GPUs from both NVIDIA and AMD).
For more information on the TF32 data type, see https://blogs.nvidia.com/blog/2020/05/14/tensorfloat-32-precision-format/.
Some intrinsics that support the TF32 data type were added in https://reviews.llvm.org/D122044.
For some discussion on supporting common semantics in `APFloat`, see similar
efforts for 8-bit formats at https://reviews.llvm.org/D146441, as well as
https://discourse.llvm.org/t/rfc-adding-the-amd-graphcore-maybe-others-float8-formats-to-apfloat/67969.
A subsequent diff will extend MLIR to use this data type. (Those changes are
not part of this diff to simplify the review process.)
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D151923
Kazu Hirata [Fri, 23 Jun 2023 08:32:38 +0000 (01:32 -0700)]
[LegacyPM] Remove LowerMatrixIntrinsicsLegacyPass and LowerMatrixIntrinsicsMinimalLegacyPass
Differential Revision: https://reviews.llvm.org/D153615
Kazu Hirata [Fri, 23 Jun 2023 08:32:36 +0000 (01:32 -0700)]
[LegacyPM] Remove unused declaration initializeAnnotation2MetadataLegacyPass
The corresponding function definition was removed by:
commit
773d663e4729f55d23cb04f78a9d003643f2cb37
Author: Arthur Eubanks <aeubanks@google.com>
Date: Mon Feb 27 19:00:37 2023 -0800
Tamás Danyluk [Fri, 23 Jun 2023 08:14:25 +0000 (10:14 +0200)]
[SCCPSolver] Speed up SCCPSolver by avoiding repeated work list elements
If a value is already the last element of the worklist, then I think that we don't have to add it again, it is not needed to process it repeatedly.
For some long Triton-generated LLVM IR, this can cause a ~100x speedup.
Differential Revision: https://reviews.llvm.org/D153561
Alex Zinenko [Thu, 22 Jun 2023 13:49:15 +0000 (13:49 +0000)]
[mlir][transform] don't wrap a warning into silenceable failure
Wrapping a warning into a silenceable failure will result in the warning
being interpreted as an error, which it is not.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D153546
Alex Zinenko [Thu, 22 Jun 2023 13:24:55 +0000 (13:24 +0000)]
[mlir][transform] fix handle invalidation check for reentrant regions
When exiting the scope of a region attached to a transform op, clean up
the handle invalidation checks assocaited with handles defined in this
region. Otherwise, these checks may trigger on the next entry to the
region while there is no incorrect usage.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D153545
Balázs Kéri [Fri, 23 Jun 2023 07:31:44 +0000 (09:31 +0200)]
[clang][ASTImporter] Add import of CXXRewrittenBinaryOperator.
Fix for issue #62770.
Reviewed By: donat.nagy
Differential Revision: https://reviews.llvm.org/D153424
Dhruv Chawla [Thu, 22 Jun 2023 17:02:01 +0000 (22:32 +0530)]
[TargetLowering] Better code generation for ISD::SADDSAT/SSUBSAT when operand sign is known
When the sign of either of the operands is known, it is possible to
determine what the saturating value will be without having to compute it
using the sign bits.
Differential Revision: https://reviews.llvm.org/D153575
Dhruv Chawla [Fri, 23 Jun 2023 07:11:08 +0000 (12:41 +0530)]
[AArch64] Pre-commit test for D153575
Kazu Hirata [Fri, 23 Jun 2023 07:36:39 +0000 (00:36 -0700)]
[LegacyPM] Remove LoopAccessLegacyAnalysis
Differential Revision: https://reviews.llvm.org/D153610
Ulrich Weigand [Fri, 23 Jun 2023 07:17:53 +0000 (09:17 +0200)]
Fix bytecode reader/writer on big-endian platforms
This makes the bytecode reader/writer work on big-endian platforms.
The only problem was related to encoding of multi-byte integers,
where both reader and writer code make implicit assumptions about
endianness of the host platform.
This fixes the current test failures on s390x, and in addition allows
to remove the UNSUPPORTED markers from all other bytecode-related
test cases - they now also all pass on s390x.
Also adding a GFAIL_SKIP to the MultiModuleWithResource unit test,
as this still fails due to an unrelated endian bug regarding
decoding of external resources.
Differential Revision: https://reviews.llvm.org/D153567
Reviewed By: mehdi_amini, jpienaar, rriddle
Haojian Wu [Fri, 23 Jun 2023 07:08:35 +0000 (09:08 +0200)]
[clangd] Store offsets in MacroOccurrence
Remove the existing `Rng` field.
From the review comment: https://reviews.llvm.org/D147034
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D153259
Jean Perier [Fri, 23 Jun 2023 07:04:14 +0000 (09:04 +0200)]
[flang][hlfir] Simplify hlfir::convertToValue
Use hlfir::loadTrivialScalars to dereference pointer, allocatables, and
load numerical and logical scalars.
This has a small fallout on tests:
- load is done on the HLFIR entity (#0 of hlfir.declare) and not the FIR one (#1). This makes no difference at the FIR level (#1 and #0 only differs to account for assumed and explicit shape lower bounds).
- loadTrivialScalars get rids of allocatable fir.box for monomoprhic scalars
(it is not needed). This exposed a bug in lowering of MERGE with
a polymorphic and a monomorphic argument: when the monomorphic is not
a fir.box, the polymorphic fir.class should not be reboxed but its
address should be read.
Reviewed By: tblah
Differential Revision: https://reviews.llvm.org/D153252
Martin Braenne [Thu, 22 Jun 2023 14:02:54 +0000 (14:02 +0000)]
[clang][dataflow] Dump useful debugging information when we crash.
- The AST of the function we're currently analyzing
- The CFG
- The CFG element we're currently processing
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D153549
Kazu Hirata [Fri, 23 Jun 2023 06:45:53 +0000 (23:45 -0700)]
[mlir] Remove unused forward declaration QuantizedIntegerType
The declaration was added without a corresponding class definition by:
commit
13bb8f491a1cb429226768cfd4ca6bcea3b938dd
Author: Stella Laurenzo <laurenzo@google.com>
Date: Wed Apr 3 11:16:32 2019 -0700
Kazu Hirata [Fri, 23 Jun 2023 06:45:52 +0000 (23:45 -0700)]
[Transforms] Remove unused forward declaration PredicateScalarEvolution
The declaration was added without a corresponding class definition by:
commit
a84064bcda1a737658d33e96ca58516d01af70a6
Author: Florian Hahn <flo@fhahn.com>
Date: Wed Dec 21 22:02:31 2022 +0000
It is most likely a misspelling of PredicatedScalarEvolution.
Kazu Hirata [Fri, 23 Jun 2023 06:45:50 +0000 (23:45 -0700)]
[llvm] Use llvm::is_contained (NFC)
Jacques Pienaar [Fri, 23 Jun 2023 05:05:31 +0000 (22:05 -0700)]
[mlir][docgen] Change nested check
Allows for single op nested regions.
Kazu Hirata [Fri, 23 Jun 2023 04:21:29 +0000 (21:21 -0700)]
[CodeGen] Remove unused declaration createVLIWSched
The declaration was added without a corresponding function by:
commit
cc3bb85580189d4a004cfd9bd2d6286cd1c1169f
Author: James Nagurne <j-nagurne@ti.com>
Date: Fri Oct 22 17:08:16 2021 -0500
Jon Chesterfield [Fri, 23 Jun 2023 02:45:22 +0000 (03:45 +0100)]
[libc] Factor specifics of packet type out of process
NFC. Simplifies process slightly, gives more options for testing it.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D153604
Jon Chesterfield [Fri, 23 Jun 2023 01:54:21 +0000 (02:54 +0100)]
[libc] Simplify access permissions, change to composition over inheritance
Private member variable minimises scope of access to Process
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D153603
Oleksii Lozovskyi [Fri, 23 Jun 2023 01:41:07 +0000 (18:41 -0700)]
[compiler-rt][CMake] Multiarch build of XRay libraries
Instead of dumping all sources into RTXray object library with a weird
special case for x86, handle multiarch builds better. Build a separate
object library for each arch with its arch-specific sources, then link
in all those libraries.
This fixes the build on platforms that produce fat binaries, such as new
macOS which expects both x86_64 and aarch64 objects in the same library
since Apple Silicon is a thing.
This only enables building XRay support for Apple Silicon. It does not
actually work yet on macOS, neither on Intel nor on Apple Silicon CPUs.
Thus the tests are still disabled.
Reviewed By: MaskRay, phosek
Differential Revision: https://reviews.llvm.org/D153221
Jon Chesterfield [Fri, 23 Jun 2023 01:11:18 +0000 (02:11 +0100)]
[libc] Instantiate and sanity check rpc class
CMake plumbing cargo culted from other tests.
Minor changes to Process to allow statically allocating a buffer.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D153594
Amaury Séchet [Sat, 30 Apr 2022 23:45:28 +0000 (23:45 +0000)]
[DAG] Peek through trunc when combining select into shifts.
This fixes a regression in D127115
Depends on D127115
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D151916
Sheng [Fri, 23 Jun 2023 00:30:53 +0000 (08:30 +0800)]
[m68k] Fix incorrect handling of TLS when matching addressing mode.
`TargetGlobalTLSAddress` is not considered and handled correctly when matching addressing mode, which leads to an incorrect result of instruction selection.
fixes #63162.
Reviewed By: myhsu
Differential Revision: https://reviews.llvm.org/D153103
Vitaly Buka [Fri, 23 Jun 2023 00:13:11 +0000 (17:13 -0700)]
[nfc][msan] Clang-format includes
Vitaly Buka [Fri, 23 Jun 2023 00:05:02 +0000 (17:05 -0700)]
[msan] Release origin pages with shadow
Vitaly Buka [Fri, 23 Jun 2023 00:00:55 +0000 (17:00 -0700)]
[test][hwasan] Reformat comments
Vitaly Buka [Thu, 22 Jun 2023 23:58:56 +0000 (16:58 -0700)]
[test][hwasan] Describe why HWASAN does not work
Alex Langford [Thu, 22 Jun 2023 23:04:06 +0000 (16:04 -0700)]
[lldb] Adjust for changes in objc runtime
The Objective-C runtime and the shared cache has changed slightly.
Given a class_ro_t, the baseMethods ivar is now a pointer union and may
either be a method_list_t pointer or a pointer to a relative list of
lists. The entries of this relative list of lists are indexes that refer
to a specific image in the shared cache in addition to a pointer offset
to find the accompanying method_list_t. We have to go over each of these
entries, parse it, and then if the relevant image is loaded in the
process, we add those methods to the relevant clang Decl.
In order to determine if an image is loaded, the Objective-C runtime
exposes a symbol that lets us determine if a particular image is loaded.
We maintain a data structure SharedCacheImageHeaders to keep track of
that information.
There is a known issue where if an image is loaded after we create a
Decl for a class, the Decl will not have the relevant methods from that
image (i.e. for Categories).
rdar://
107957209
Differential Revision: https://reviews.llvm.org/D153597
Matt Arsenault [Thu, 22 Jun 2023 22:15:19 +0000 (18:15 -0400)]
Revert "AMDGPU: Use generic helper for skipping over allocas"
This reverts commit
aa7e09ebd38c5f23f6d7d6d8394a2aea04715ba9.
Matt Arsenault [Thu, 22 Jun 2023 21:16:43 +0000 (17:16 -0400)]
AMDGPU: Use generic helper for skipping over allocas
Daniel Hoekwater [Thu, 22 Jun 2023 03:56:14 +0000 (03:56 +0000)]
[MC] Detect out of range jumps further than 2^32 bytes
On AArch64, object files may be greater than 2^32 bytes. If an
offset is greater than the max value of a 32-bit unsigned integer,
LLVM silently truncates the offset. Instead, make it return an
error.
Differential Revision: https://reviews.llvm.org/D153494
Fangrui Song [Thu, 22 Jun 2023 21:51:08 +0000 (14:51 -0700)]
[MC] Suppress -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D153096
Philip Reames [Thu, 22 Jun 2023 21:47:03 +0000 (14:47 -0700)]
[RISCV] Document overview of vector pseudos [nfc]
I tried to give a rough overview of our current pseudo structure. I'm mostly focused on the policy handling bits - since that's what I'm in the process of changing - but touched on the other dimensions in the process of framing it.
Differential Revision: https://reviews.llvm.org/D152937
Shatian Wang [Thu, 22 Jun 2023 21:26:21 +0000 (14:26 -0700)]
[BOLT] Fixing relative ordering of cold sections under multi-way function splitting
Order code sections with names in the form of ".text.cold.i" based on the value of i
[Context] SplitFunctions.cpp implements splitting strategies that can potentially split each function into maximum N>2 fragments.
When such N-way splitting happens, new code sections with names ".text.cold.1", ..., ".text.cold.i", ... "text.cold.N-2" will be created
A section with name ".text.cold.i" contains the the (i+2)th fragment of each function.
As an example, if each function is splitted into N=3 fragments: hot, warm, cold, then code sections will now include
- a section with name ".text" containing hot fragments
- a section with name ".text.cold" containing warm fragments
- a section with name ".text.cold.1" containing cold fragments
The order of these new sections in the output binary currently depends on the order in which they are encountered by the emitter.
For example, under N=3-way splitting, if the first function is 2-way splitted into hot and cold and the second function is 3-way splitted into hot, warm, and cold
then the cold fragment is encountered first, resulting in the final section to be in the following order
.text (hot), .text.cold.1 (cold), .text.cold (warm)
The above is suboptimal because the distance of jumps/calls between the hot and the warm sections will be much bigger than when ordering the sections as follows
.text (hot), .text.cold (warm), .text.cold.1 (cold)
This diff orders the sections with names in the form of ".text.cold" or ".text.cold.i" based on the value of i (assuming the i-value of ".text.cold" is 0).
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D152941
Maksim Panchenko [Tue, 20 Jun 2023 22:27:31 +0000 (15:27 -0700)]
[BOLT] Remove unnecessary diagnostics
When optimizations passes do not change anything, skip their diagnostics
output. NFC otherwise.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D153386
Jonas Devlieghere [Thu, 22 Jun 2023 15:57:30 +0000 (08:57 -0700)]
[lldb] Fix variable name mismatch between signature and docs (NFC)
The variable is named `bundle_dir` but the documentation referenced
`directory` which generated a warning.
Tomasz Kuchta [Wed, 21 Jun 2023 21:24:33 +0000 (21:24 +0000)]
[DFSAN] Add support for _tolower
I noticed that in some cases _tolower shows as uninstrumented - I've added it as "functional" in the done_abilist.txt file
Reviewed by: browneee
Differential Revision: https://reviews.llvm.org/D153410
Fangrui Song [Thu, 22 Jun 2023 20:44:15 +0000 (13:44 -0700)]
[MC,x86-32] Remove a gold<2.34 workaround
This workaround appears to apply with gold<2.34 -O2/-O3 (linker -O2, not
compiler driver -O2). This used to be more visible as we used -Wl,-O3 in
CMake, but the option is generally not recommended and has been removed
by
d63016a86548e8231002a760bbe9eb817cd1eb00 (Dec 2021).
This finishes a workaround removal work started by D64327 (2019).
Link: https://github.com/llvm/llvm-project/issues/45269
Manna, Soumi [Thu, 22 Jun 2023 20:24:53 +0000 (13:24 -0700)]
[CLANG] Fix Static Code Analyzer Concerns with bad bit right shift operation in getNVPTXLaneID()
In getNVPTXLaneID(CodeGenFunction &), the value of LaneIDBits is
4294967295 since function call llvm::Log2_32(CGF->getTarget()->getGridValue().GV_Warp_Size) might return
4294967295.
unsigned LaneIDBits =
llvm::Log2_32(CGF.getTarget().getGridValue().GV_Warp_Size);
unsigned LaneIDMask = ~0u >> (32u - LaneIDBits);
The shift amount (32U - LaneIDBits) might be 33, So it has undefined behavior for right shifting by more than 31 bits.
This patch adds an assert to guard the LaneIDBits overflow issue with LaneIDMask value.
Reviewed By: tahonermann
Differential Revision: https://reviews.llvm.org/D151606
Peter Klausler [Thu, 22 Jun 2023 16:25:03 +0000 (09:25 -0700)]
[flang] Avoid crash in statement function error case
The predicate IsPureProcedure() crashes with infinite
recursion when presented with mutually recursive statement
functions -- an error case that should be recoverable.
Fix by adding a visited set.
Fixes bug https://github.com/llvm/llvm-project/issues/63231
Differential Revision: https://reviews.llvm.org/D153569
Jon Chesterfield [Thu, 22 Jun 2023 20:18:43 +0000 (21:18 +0100)]
[libc] Can build amdgpu libc even if rocm is missing
Clang defaults to failing to build if it can't find rocm device libs
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D153581
Valentin Clement [Thu, 22 Jun 2023 20:10:50 +0000 (13:10 -0700)]
[flang][openacc] Add lowering support for multi-dimensional arrays reduction
Lower multi-dimensional arrays reduction for add and mul operator.
Depends on D153448
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D153455
Valentin Clement [Thu, 22 Jun 2023 20:09:15 +0000 (13:09 -0700)]
[flang][openacc] Add lowering support for 1d array reduction for add/mul operator
Lower 1d array reduction for add and mul operator. Multi-dimensional arrays and
other operator will follow.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D153448
Manna, Soumi [Thu, 22 Jun 2023 19:52:25 +0000 (12:52 -0700)]
[CLANG] Fix potential null pointer dereference bugs
This patch uses castAs instead of getAs which will assert if the type doesn't match and adds nullptr check if needed.
Also this patch improves the codes and passes I.getData() instead of doing a lookup in dumpVarDefinitionName()
since we're iterating over the same map in LocalVariableMap::dumpContex().
Reviewed By: aaron.ballman, aaronpuchert
Differential Revision: https://reviews.llvm.org/D153033
Vitaly Buka [Thu, 22 Jun 2023 18:17:12 +0000 (11:17 -0700)]
[NFC][asan] Add FIXME for a posible optimization
Manna, Soumi [Thu, 22 Jun 2023 19:30:01 +0000 (12:30 -0700)]
[Clang] Fix Static Code Analysis Concerns with copy without assign
This patch adds missing assignment operator to the class which has user-defined copy constructor.
Reviewed By: tahonermann, aaronpuchert
Differential Revision: https://reviews.llvm.org/D150931
Vitaly Buka [Thu, 22 Jun 2023 06:18:25 +0000 (23:18 -0700)]
[asan] Don't double poison secondary allocations
Sanitizers allocate shadow and memory as MAP_NORESERVE.
User memory can stay this way and do not increase RSS as long as we
don't store there.
The shadow unpoisoning also can avoid RSS increase for zeroed pages.
However as soon we poison the shadow, we need the page in RSS.
To avoid unnececary RSS increase we should not poison memory just before
unpoisoning them.
Depends on D153497.
Reviewed By: thurston
Differential Revision: https://reviews.llvm.org/D153500
Fangrui Song [Thu, 22 Jun 2023 19:24:19 +0000 (12:24 -0700)]
[MC] Fold A-B when A's fragment precedes B's fragment
When the MCAssembler is non-null and the MCAsmLayout is null, we can fold A-B
when
* A and B are in the same fragment, or
* A's fragment suceeds B's fragment, and they are not separated by non-data fragments (D69411)
This patch allows folding when A's fragment precedes B's fragment so
that `9997b - . == 0` below can be evaluated as true:
```
nop
.arch_extension sec
9997:nop
// old behavior: error: expected absolute expression
.if 9997b - . == 0
.endif
```
Add a case to llvm/test/MC/ARM/directive-if-subtraction.s.
Note: for MCAsmStreamer, we cannot evaluate `.if . - 9997b == 0` at parse
time due to MCAsmStreamer::getAssemblerPtr returning nullptr (D45164).
Some Darwin tests check that this folding does not work. Add `.p2align 2` to
block some label difference folding or adjust the tests.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D153096
Florian Hahn [Thu, 22 Jun 2023 19:15:21 +0000 (20:15 +0100)]
[LV] Add test with reduction start values that are/may be poison/undef.
Test cases for #62565.
Joseph Huber [Thu, 22 Jun 2023 19:03:18 +0000 (14:03 -0500)]
[Clang] Disable `libc` headers for offloading languages
These headers are currently broken when included from the offloading
languages like OpenMP, OpenCL, CUDA, and HIP. Turn this logic off so we
can compile these languages when the GPU libc is installed. I am
currently trying to remedy this and have made an RFC for it in libc,
see https://discourse.llvm.org/t/rfc-implementing-gpu-headers-in-the-llvm-c-library/71523.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D153578
Fangrui Song [Thu, 22 Jun 2023 19:11:52 +0000 (12:11 -0700)]
[MC][test] Clean up MC/ARM/directive-if-subtraction.s
Manna, Soumi [Thu, 22 Jun 2023 19:05:30 +0000 (12:05 -0700)]
[CLANG] Fix uninitialized scalar field issues
Reviewed By: erichkeane, steakhal, tahonermann, shafik
Differential Revision: https://reviews.llvm.org/D150744
Sam McCall [Thu, 22 Jun 2023 02:27:20 +0000 (04:27 +0200)]
[dataflow] Avoid copying environment
This appears to be just an accidental copy rather than move from a scratch
variable.
As well as doing redundant work, these copies introduce extra SAT variables
which make debugging harder (each Enviroment has a unique FC token).
Example flow condition before:
```
(B0:1 = V15)
(B1:1 = V8)
(B2:1 = V10)
(B3:1 = (V4 & (!V7 => V6)))
(V10 = (B3:1 & !V7))
(V12 = B1:1)
(V13 = B2:1)
(V15 = (V12 | V13))
(V3 = V2)
(V4 = V3)
(V8 = (B3:1 & !!V7))
B0:1
V2
```
after:
```
(B0:1 = (V9 | V10))
(B1:1 = (B3:1 & !!V6))
(B2:1 = (B3:1 & !V6))
(B3:1 = (V3 & (!V6 => V5)))
(V10 = B2:1)
(V3 = V2)
(V9 = B1:1)
B0:1
V2
```
(with labelling from D153488)
There are also some more copies that can be avoided here (when multiple blocks
without terminating statements are joined), but they're less trivial, so I'll
put those in another patch.
Differential Revision: https://reviews.llvm.org/D153491
Amy Huang [Thu, 22 Jun 2023 18:36:30 +0000 (11:36 -0700)]
Revert "Try to implement lambdas with inalloca parameters by forwarding without use of inallocas."
Causes a clang crash (see crbug.com/1457256).
This reverts commit
015049338d7e8e0e81f2ad2f94e5a43e2e3f5220.
Joe Nash [Thu, 22 Jun 2023 15:31:50 +0000 (11:31 -0400)]
[AMDGPU] Add _e64_dpp asm suffix to docs
The _e64_dpp suffix can be added to an instruction to force the
AsmParser to encode it as VOP3 with DPP if possible on GFX11+. This has
been the behavior since GFX11 was introduced; this patch only updates
the documentation.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D153564
Vitaly Buka [Thu, 22 Jun 2023 18:24:47 +0000 (11:24 -0700)]
Revert "[CodeGen] Extend reduction support in ComplexDeinterleaving pass to support predication"
ComplexDeinterleavingPass.cpp:1849:3: error: default label in switch which covers all enumeration values
This reverts commit
116953b82130df1ebd817b3587b16154f659c013.