Commit Graph

410739 Commits

Author SHA1 Message Date
Nikita Popov b56f6f1913 [MemoryBuiltins] Remove unused isStrdupLikeFn() function (NFC)
This function is no longer used after
dcbc91f40c.
2022-01-11 12:26:20 +01:00
Nikita Popov 3cef3cf02f [DSE] Check for noalias calls rather than alloc functions
For these "visible on unwind/ret" checks we only care about the
fact that no other code has access to the pointer (unless it
escapes). A noalias call is sufficient for this, it does not
have to be a known allocation function.

This is basically the same change as D116728, but for DSE rather
than LICM.
2022-01-11 12:22:16 +01:00
Florian Hahn ec016681d3
[LSR] Remove duplicated test address-space-loop.ll.
llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll has
exactly the same checks and input. Remove the duplicated test.
2022-01-11 11:18:28 +00:00
Matthias Springer 2c5c5ca868 [mlir][linalg][bufferize] Fix CallOp bufferization
Previously, CallOps did not have any aliasing OpResult/OpOperand pairs. Therefore, CallOps were mostly ignored by the analysis and buffer copies were not inserted when necessary.

This commit introduces the following changes:
* Function bbArgs writable by default. A function can now be bufferized without inspecting its callers.
* Callers must introduce buffer copies of function arguments when necessary. If a function is external, the caller must conservatively assume that a function argument is modified by the callee after bufferization. If the function is not external, the caller inspects the callee to determine if a function argument is modified.

Differential Revision: https://reviews.llvm.org/D116457
2022-01-11 20:10:21 +09:00
Nikita Popov 3d5179febe [DSE] Add additional tests for noalias calls (NFC)
Currently this is special-cased to TLI alloc functions only.
2022-01-11 12:09:54 +01:00
Haojian Wu 41fbdfa4d5 Reland "[AST] Add RParen loc for decltype AutoTypeloc."
Reland 55d96ac and 37ec65e with a clang-tidy fix.
2022-01-11 12:06:18 +01:00
Hans Wennborg 0b48d0fe12 [ADT] Add an in-place version of toHex()
and use that to simplify MD5's hex string code which was previously
using a string stream, as well as Clang's
CGDebugInfo::computeChecksum().

Differential revision: https://reviews.llvm.org/D116960
2022-01-11 11:51:04 +01:00
Nikita Popov fe2c4af905 [DSE] Make test more robust (NFC)
If the allocation is not captured, then all the stores before the
ret are dead anyway.
2022-01-11 11:49:52 +01:00
Hans Wennborg 83797c03d2 [ADT] Use a lookup table in hexdigit() and call that from toHex()
A lookup table, which toHex() was using, seems like the better approach.
Having two implementations is redundant, so put the lookup table in
hexdigit() and make toHex() call that.

Differential revision: https://reviews.llvm.org/D116960
2022-01-11 11:32:22 +01:00
Simon Pilgrim 2e52f76a72 [SemaOverload] compareConversionFunctions - use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointer is dereferenced immediately below, so assert the cast is correct instead of returning nullptr
2022-01-11 10:31:26 +00:00
Simon Pilgrim c61299e2b3 [SemaOverload] Use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointer is always dereferenced inside BuildSimilarlyQualifiedPointerType, so assert the cast is correct instead of returning nullptr
2022-01-11 10:31:25 +00:00
Martin Storsjö 18b2385f2b [clang] [test] Fix clang-cl unused argument tests on paths that start with /U
This reinstates a test that was temporarily removed in
e26bbae302, in a form that works on
Darwin.

Use -LD instead of -link as a linker argument that is unused when
compiling, that produces warnings normally. -LD can be placed anywhere
in the command line, so that the command line ends with "-- %s", making
paths starting with /U correctly interpreted as paths, not options.
2022-01-11 12:28:23 +02:00
Nikita Popov aff9f2dc01 [LICM] Regenerate test checks (NFC) 2022-01-11 11:25:19 +01:00
Julian Gross 4b01968b5e [MLIR] Update allocs to memref.allocs in documentation.
Changed the remaining appearances of alloc to memref.alloc in several
documentation sections, since they lead to misunderstandings, if they
are used.

Differential Revision: https://reviews.llvm.org/D116999
2022-01-11 11:22:22 +01:00
wangpc c6430fade3 [RISCV] Generate 32 bits jumptable entries when code model is small
The code can only address the whole RV32 address space or the lower 2 GiB
of the RV64 address space in small code model, so 32 bits entry is enough.
Cache hit ratio and code size have some improvements.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D116435
2022-01-11 18:20:37 +08:00
Diana Picus 4d3ba4e6c8 [flang] Add tests for converting arrays and refs to arrays. NFC
Cover more of the code paths from LLVMTypeConverter::convertPointerLike
and LLVMTypeConverter::convertSequenceType.

Differential Revision: https://reviews.llvm.org/D116927
2022-01-11 10:05:19 +00:00
Sam McCall 1e9b837585 [clangd] Save more getFileID in Selection
This saves about 10% of SelectionVisitor::pop().
2022-01-11 11:01:54 +01:00
Florian Hahn 2d67a86b7c
[SCEVExpander] Use IntToPtr for temporary instruction.
Use PtrToInt instead Add when creating temporary instructions. The add
might get folded away with more sophisticated folding.
2022-01-11 09:40:21 +00:00
David Sherwood 51497dc0b2 [IR] Change vector.splice intrinsic to reject out-of-bounds indices
I've changed the definition of the experimental.vector.splice
instrinsic to reject indices that are known to be or possibly
out-of-bounds. In practice, this means changing the definition so that
the index is now only valid in the range [-VL, VL-1] where VL is the
known minimum vector length. We use the vscale_range attribute to
take the minimum vscale value into account so that we can permit
more indices when the attribute is present.

The splice intrinsic is currently only ever generated by the vectoriser,
which will never attempt to splice vectors with out-of-bounds values.
Changing the definition also makes things simpler for codegen since we
can always assume that the index is valid.

This patch was created in response to review comments on D115863

Differential Revision: https://reviews.llvm.org/D115933
2022-01-11 09:37:39 +00:00
Sam McCall 22ac067b2d [clangd] Small optimization in SelectionTree
This seems to be strictly faster in all cases. Before fixing D116978 it
was one of the hot paths, and may become one again.
2022-01-11 10:18:44 +01:00
Martin Storsjö e26bbae302 [clang] [test] Remove newly added tests that fail on Darwin
These tests were recently added in
50ec1306d0. The clang-cl invocations
interpret the source path, %s, which begins with /Users, as a cl
option /U. Normally this is worked around by passing -- before
the arguments that must be interpreted as files, not options, but
in the current test, the -link option must be passed last, after any
file names.
2022-01-11 11:06:29 +02:00
Florian Hahn 4a42ce2508
[LoopVersioning] Check the full generated runtime checks in lcssa.ll.
This makes improvements in follow-up patches more obvious.
2022-01-11 08:37:30 +00:00
Diego Caballero e2b658cd5d [mlir][GPU] Fix attribute name of DL specification
D115722 added a DL spec to GPU modules. It happens that the DL
default interface implementation is sensitive to the name of the
DL spec attribute. This patch is fixing the name of the attribute
to be the expected one.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D116956
2022-01-11 08:30:52 +00:00
Nikita Popov 2d1b55ebea [CodeGen] Make element type in emitArrayDestroy() predictable
When calling emitArrayDestroy(), the pointer will usually have
ConvertTypeForMem(EltType) as the element type, as one would expect.
However, globals with initializers sometimes don't use the same
types as values normally would, e.g. here the global uses
{ double, i32 } rather than %struct.T as element type.

Add an early cast to the global destruction path to avoid this
special case. The cast would happen lateron anyway, it only gets
moved to an earlier point.

Differential Revision: https://reviews.llvm.org/D116219
2022-01-11 09:25:29 +01:00
Zi Xuan Wu 065e0324e5 [CSKY] Add CSKYConstantIslands Pass to lift or duplicate constant pool entry
Loading constants inline is expensive on CSKY and it's in general better
to place the constant nearby in code space and then it can be loaded with a
simple 16/32 bit load instruction like lrw.

It needs lift or duplicates constant pool entry to make constant nearby so that lrw instruction can reach.
2022-01-11 16:17:11 +08:00
wangpc 98d51c2542 [RISCV] Override TargetLowering::BuildSDIVPow2 to generate SELECT
When `Zbt` is enabled, we can generate SELECT for division by power
of 2, so that there is no data dependency.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D114856
2022-01-11 15:54:35 +08:00
Martin Storsjö 50ec1306d0 [clang] Add --start-no-unused-arguments/--end-no-unused-arguments to silence some unused argument warnings
When passing a set of flags to configure defaults for a specific
target (similar to the cmake settings `CLANG_DEFAULT_RTLIB`,
`CLANG_DEFAULT_UNWINDLIB`, `CLANG_DEFAULT_CXX_STDLIB` and
`CLANG_DEFAULT_LINKER`, but without hardcoding them in the binary),
some of the flags may cause warnings (e.g. `-stdlib=` when compiling C
code). Allow requesting selectively ignoring unused arguments among
some of the arguments on the command line, without needing to resort
to `-Qunused-arguments` or `-Wno-unused-command-line-argument`.

Fix up the existing diagnostics.c testcase. It was added in
response to PR12181 to fix handling of
`-Werror=unused-command-line-argument`, but the command line option
in the test (`-fzyzzybalubah`) now triggers "error: unknown argument"
instead of the intended warning. Change it into a linker input
(`-lfoo`) which triggers the intended diagnostic. Extend the
existing test case to check more cases and make sure that it keeps
testing the intended case.

Add testing of the new option to this existing test.

Differential Revision: https://reviews.llvm.org/D116503
2022-01-11 09:22:00 +02:00
LLVM GN Syncbot 04867c3c51 [gn build] Port 8d23b7420c 2022-01-11 06:50:34 +00:00
Konstantin Varlamov 8d23b7420c [libc++][ranges] Implement `uninitialized_copy{,_n}` and `uninitialized_move{,_n}`.
Also implement `in_out_result` which is a prerequisite.

Differential Revision: https://reviews.llvm.org/D116023
2022-01-10 22:49:50 -08:00
Esme-Yi b28e8abfd0 [NFC][XCOFF][llvm-readobj] replace binaries with YAMLs (only tests for Symbols).
Summary: Since yaml2obj now supports converting AuxSymbols, we can use YAMLs as input for symbol-related tests of llvm-readobj instead of binaries.

Reviewed By: jhenderson, shchenz

Differential Revision: https://reviews.llvm.org/D114434
2022-01-11 06:17:16 +00:00
John Regehr 4eec1710c5 allow llvm-reduce, if asked, to run its set of passes more than once, taking longer to finish but also potentially resulting in a smaller reduced file. 2022-01-10 22:24:23 -07:00
Fangrui Song 5dbbd4eeb8 [ELF] Move OffsetGetter before some static functions. NFC
to prepare for D116881.
2022-01-10 20:16:02 -08:00
Fangrui Song 477bc36d3b [lld-macho] Change some global pointers to unique_ptr
Similar to D116143. My x86-64 `lld` is ~8KiB smaller.

Reviewed By: keith

Differential Revision: https://reviews.llvm.org/D116902
2022-01-10 19:39:14 -08:00
Fangrui Song 2968467e39 [lld-macho][test] Add missing coverage for archive/dylib resolution after D115092
When `file->fetch(sym)` is replaced with a no-op, no test fails.

The new test catches the case.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D116916
2022-01-10 19:36:24 -08:00
Chenbing.Zheng 9ea772ff81 [RISCV] Block vmsgeu.vi with 0 immediate in Isel
For vmsgeu.vi with 0, we know this is always true. So we can replace
it with vmset.m (unmasked) or vmset.m+vmand.mm (masked).

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D116584
2022-01-11 03:04:44 +00:00
jacquesguan d0554ae4cf [RISCV] Select vl op to X0 when it is equal to ~0.
Now the backend will select ~0 vl to a register and load instruction, we could use X0 to replace it.

Differential Revision: https://reviews.llvm.org/D116798
2022-01-11 10:56:25 +08:00
jacquesguan 99c1acf3f1 [RISCV] Add precommit test for select vl op that equal to ~0.
Precommit test for D116798

Differential Revision: https://reviews.llvm.org/D116799
2022-01-11 10:54:50 +08:00
Jim Lin 905ac777d5 [M68k][test][NFC] Reorder the tests for MxBTST_MI and MxBTST_MR
Follow the order of definitions in M68kInstrBits.td
2022-01-11 10:43:35 +08:00
Haocong.Lu bd653f6406 [RISCV] Use shift for zero extension when Zbb and Zbp are not enabled
Now AND is used for zero extension when both Zbb and Zbp are not enabled.
It may be better to use shift operation if the trailing ones mask exceeds simm12.

This patch optimzes LUI+ADDI+AND to SLLI+SRLI.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D116720
2022-01-11 02:37:03 +00:00
Nick Desaulniers 649b11ef8b git-clang-format HEAD~ 2022-01-10 18:34:30 -08:00
Nick Desaulniers 301e911740 [TargetLowering] precommit refactor from D115688 NFC
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2022-01-10 18:32:13 -08:00
jacquesguan b607cd3928 [RISCV] Use vmv.s.x to build one element splat vector.
When we want to create an splat vector that only the first element is initialized, we could use vmv.s.x or vfmv.s.f to build it.

Differential Revision: https://reviews.llvm.org/D116277
2022-01-11 10:21:18 +08:00
Philip Reames f62f47f5e1 Partial revert of 82fb4f4
Two crashes have been reported.  This change disables the new logic while leaving the new node in tree.  Hopefully, that's enough to allow investigation without breakage while avoiding massive churn.
2022-01-10 18:18:34 -08:00
Philip Reames abc787fbf3 Delete a stale comment 2022-01-10 18:18:34 -08:00
Chuanqi Xu d9d63fc108 [AST] lookup in parent DeclContext for transparent DeclContext
The compiler would crash if we lookup for name in transparent decl
context. See the tests attached for example.

I think this should make sense since the member declared in transparent
DeclContext are semantically defined in the enclosing (non-transparent)
DeclContext, this is the definition for transparent DeclContext.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D116792
2022-01-11 10:16:26 +08:00
Craig Topper 9ef2175f81 [SelectionDAG] Add additional documentation to FP_TO_S/UINT_SAT to justify D116870. NFC
As noted in post-commit review, the value of the bits between
the saturating type and result type were not defined defined. Define
them to be sign extended for FP_TO_SINT_SAT and zero extended for
FP_TO_UINT_SAT.
2022-01-10 18:08:39 -08:00
Chuanqi Xu 86c5b870b2 [AST] Don't consider 'ExportDecl' when calculating DeclContext 'Encloses'
This mimics the style of 90010c2e1 (Don't consider 'LinkageSpec' when
calculating DeclContext 'Encloses'). Since ExportDecl and LinkageSpec
are transparent DeclContext, they share some similarity.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D116911
2022-01-11 09:54:57 +08:00
Mehdi Amini 63f0c00d38 Add a `qualified` directive to the Op, Attribute, and Type declarative assembly format
This patch introduces a new directive that allow to parse/print attributes and types fully
qualified.
This is a follow-up to ee0908703d which introduces the eliding of the `!dialect.mnemonic` by default and allows to force to fully qualify each type/attribute
individually.

Differential Revision: https://reviews.llvm.org/D116905
2022-01-11 01:30:19 +00:00
Jennifer Yu 140a6b1e5c [clang][OpenMP5.1] Initial parsing/sema for 'indirect' clause
Differential Revision: https://reviews.llvm.org/D116764
2022-01-10 16:58:56 -08:00
Sam McCall 4258d68dc7 [Tooling] When transferring compile commands between files, always use '--'
"driver <flags> -- <input>" is a particularly convenient form of the
compile command to manipulate, with fewer special cases to handle.

Guaranteeing that the output command is of that form is cheap and makes
it easier to consume the result in some cases.

Differential Revision: https://reviews.llvm.org/D116721
2022-01-11 01:41:42 +01:00