platform/upstream/llvm.git
2 years ago[DSE] Check for noalias calls rather than alloc functions
Nikita Popov [Tue, 11 Jan 2022 11:08:44 +0000 (12:08 +0100)]
[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.

2 years ago[LSR] Remove duplicated test address-space-loop.ll.
Florian Hahn [Tue, 11 Jan 2022 11:18:28 +0000 (11:18 +0000)]
[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.

2 years ago[mlir][linalg][bufferize] Fix CallOp bufferization
Matthias Springer [Tue, 11 Jan 2022 11:04:55 +0000 (20:04 +0900)]
[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

2 years ago[DSE] Add additional tests for noalias calls (NFC)
Nikita Popov [Tue, 11 Jan 2022 10:55:59 +0000 (11:55 +0100)]
[DSE] Add additional tests for noalias calls (NFC)

Currently this is special-cased to TLI alloc functions only.

2 years agoReland "[AST] Add RParen loc for decltype AutoTypeloc."
Haojian Wu [Mon, 10 Jan 2022 14:19:05 +0000 (15:19 +0100)]
Reland "[AST] Add RParen loc for decltype AutoTypeloc."

Reland 55d96ac and 37ec65e with a clang-tidy fix.

2 years ago[ADT] Add an in-place version of toHex()
Hans Wennborg [Mon, 10 Jan 2022 18:45:13 +0000 (19:45 +0100)]
[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

2 years ago[DSE] Make test more robust (NFC)
Nikita Popov [Tue, 11 Jan 2022 10:49:08 +0000 (11:49 +0100)]
[DSE] Make test more robust (NFC)

If the allocation is not captured, then all the stores before the
ret are dead anyway.

2 years ago[ADT] Use a lookup table in hexdigit() and call that from toHex()
Hans Wennborg [Tue, 11 Jan 2022 09:08:25 +0000 (10:08 +0100)]
[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

2 years ago[SemaOverload] compareConversionFunctions - use castAs<> instead of getAs<> to avoid...
Simon Pilgrim [Mon, 10 Jan 2022 17:44:18 +0000 (17:44 +0000)]
[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

2 years ago[SemaOverload] Use castAs<> instead of getAs<> to avoid dereference of nullptr
Simon Pilgrim [Mon, 10 Jan 2022 17:31:35 +0000 (17:31 +0000)]
[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

2 years ago[clang] [test] Fix clang-cl unused argument tests on paths that start with /U
Martin Storsjö [Tue, 11 Jan 2022 10:22:42 +0000 (12:22 +0200)]
[clang] [test] Fix clang-cl unused argument tests on paths that start with /U

This reinstates a test that was temporarily removed in
e26bbae30218a35d76a79fe90b0e41dd0f71b779, 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.

2 years ago[LICM] Regenerate test checks (NFC)
Nikita Popov [Tue, 11 Jan 2022 09:55:50 +0000 (10:55 +0100)]
[LICM] Regenerate test checks (NFC)

2 years ago[MLIR] Update allocs to memref.allocs in documentation.
Julian Gross [Tue, 11 Jan 2022 10:04:15 +0000 (11:04 +0100)]
[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

2 years ago[RISCV] Generate 32 bits jumptable entries when code model is small
wangpc [Tue, 11 Jan 2022 10:19:05 +0000 (18:19 +0800)]
[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

2 years ago[flang] Add tests for converting arrays and refs to arrays. NFC
Diana Picus [Wed, 22 Dec 2021 09:06:37 +0000 (09:06 +0000)]
[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

2 years ago[clangd] Save more getFileID in Selection
Sam McCall [Tue, 11 Jan 2022 10:01:02 +0000 (11:01 +0100)]
[clangd] Save more getFileID in Selection

This saves about 10% of SelectionVisitor::pop().

2 years ago[SCEVExpander] Use IntToPtr for temporary instruction.
Florian Hahn [Tue, 11 Jan 2022 09:40:21 +0000 (09:40 +0000)]
[SCEVExpander] Use IntToPtr for temporary instruction.

Use PtrToInt instead Add when creating temporary instructions. The add
might get folded away with more sophisticated folding.

2 years ago[IR] Change vector.splice intrinsic to reject out-of-bounds indices
David Sherwood [Fri, 17 Dec 2021 09:39:21 +0000 (09:39 +0000)]
[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

2 years ago[clangd] Small optimization in SelectionTree
Sam McCall [Tue, 11 Jan 2022 09:15:12 +0000 (10:15 +0100)]
[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.

2 years ago[clang] [test] Remove newly added tests that fail on Darwin
Martin Storsjö [Tue, 11 Jan 2022 09:06:29 +0000 (11:06 +0200)]
[clang] [test] Remove newly added tests that fail on Darwin

These tests were recently added in
50ec1306d060e46e0d53c9f5d8a052e1b0d10d3b. 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.

2 years ago[LoopVersioning] Check the full generated runtime checks in lcssa.ll.
Florian Hahn [Tue, 11 Jan 2022 08:37:29 +0000 (08:37 +0000)]
[LoopVersioning] Check the full generated runtime checks in lcssa.ll.

This makes improvements in follow-up patches more obvious.

2 years ago[mlir][GPU] Fix attribute name of DL specification
Diego Caballero [Tue, 11 Jan 2022 08:30:33 +0000 (08:30 +0000)]
[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

2 years ago[CodeGen] Make element type in emitArrayDestroy() predictable
Nikita Popov [Tue, 4 Jan 2022 14:24:14 +0000 (15:24 +0100)]
[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

2 years ago[CSKY] Add CSKYConstantIslands Pass to lift or duplicate constant pool entry
Zi Xuan Wu [Tue, 11 Jan 2022 08:13:21 +0000 (16:13 +0800)]
[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.

2 years ago[RISCV] Override TargetLowering::BuildSDIVPow2 to generate SELECT
wangpc [Tue, 11 Jan 2022 07:52:00 +0000 (15:52 +0800)]
[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

2 years ago[clang] Add --start-no-unused-arguments/--end-no-unused-arguments to silence some...
Martin Storsjö [Sat, 1 Jan 2022 13:54:29 +0000 (15:54 +0200)]
[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

2 years ago[gn build] Port 8d23b7420c92
LLVM GN Syncbot [Tue, 11 Jan 2022 06:50:34 +0000 (06:50 +0000)]
[gn build] Port 8d23b7420c92

2 years ago[libc++][ranges] Implement `uninitialized_copy{,_n}` and `uninitialized_move{,_n}`.
Konstantin Varlamov [Tue, 11 Jan 2022 06:49:37 +0000 (22:49 -0800)]
[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

2 years ago[NFC][XCOFF][llvm-readobj] replace binaries with YAMLs (only tests for Symbols).
Esme-Yi [Tue, 11 Jan 2022 06:17:16 +0000 (06:17 +0000)]
[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

2 years agoallow llvm-reduce, if asked, to run its set of passes more than once, taking longer...
John Regehr [Tue, 11 Jan 2022 05:24:23 +0000 (22:24 -0700)]
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.

2 years ago[ELF] Move OffsetGetter before some static functions. NFC
Fangrui Song [Tue, 11 Jan 2022 04:16:02 +0000 (20:16 -0800)]
[ELF] Move OffsetGetter before some static functions. NFC

to prepare for D116881.

2 years ago[lld-macho] Change some global pointers to unique_ptr
Fangrui Song [Tue, 11 Jan 2022 03:39:14 +0000 (19:39 -0800)]
[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

2 years ago[lld-macho][test] Add missing coverage for archive/dylib resolution after D115092
Fangrui Song [Tue, 11 Jan 2022 03:36:24 +0000 (19:36 -0800)]
[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

2 years ago[RISCV] Block vmsgeu.vi with 0 immediate in Isel
Chenbing.Zheng [Tue, 11 Jan 2022 03:00:09 +0000 (03:00 +0000)]
[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

2 years ago[RISCV] Select vl op to X0 when it is equal to ~0.
jacquesguan [Fri, 7 Jan 2022 08:35:23 +0000 (16:35 +0800)]
[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

2 years ago[RISCV] Add precommit test for select vl op that equal to ~0.
jacquesguan [Fri, 7 Jan 2022 08:53:02 +0000 (16:53 +0800)]
[RISCV] Add precommit test for select vl op that equal to ~0.

Precommit test for D116798

Differential Revision: https://reviews.llvm.org/D116799

2 years ago[M68k][test][NFC] Reorder the tests for MxBTST_MI and MxBTST_MR
Jim Lin [Tue, 11 Jan 2022 02:16:01 +0000 (10:16 +0800)]
[M68k][test][NFC] Reorder the tests for MxBTST_MI and MxBTST_MR

Follow the order of definitions in M68kInstrBits.td

2 years ago[RISCV] Use shift for zero extension when Zbb and Zbp are not enabled
Haocong.Lu [Tue, 11 Jan 2022 02:32:25 +0000 (02:32 +0000)]
[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

2 years agogit-clang-format HEAD~
Nick Desaulniers [Tue, 11 Jan 2022 02:34:30 +0000 (18:34 -0800)]
git-clang-format HEAD~

2 years ago[TargetLowering] precommit refactor from D115688 NFC
Nick Desaulniers [Tue, 11 Jan 2022 02:31:29 +0000 (18:31 -0800)]
[TargetLowering] precommit refactor from D115688 NFC

Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2 years ago[RISCV] Use vmv.s.x to build one element splat vector.
jacquesguan [Sat, 25 Dec 2021 10:09:27 +0000 (18:09 +0800)]
[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

2 years agoPartial revert of 82fb4f4
Philip Reames [Tue, 11 Jan 2022 02:17:34 +0000 (18:17 -0800)]
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.

2 years agoDelete a stale comment
Philip Reames [Tue, 11 Jan 2022 00:15:39 +0000 (16:15 -0800)]
Delete a stale comment

2 years ago[AST] lookup in parent DeclContext for transparent DeclContext
Chuanqi Xu [Tue, 11 Jan 2022 02:15:46 +0000 (10:15 +0800)]
[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

2 years ago[SelectionDAG] Add additional documentation to FP_TO_S/UINT_SAT to justify D116870...
Craig Topper [Tue, 11 Jan 2022 02:07:12 +0000 (18:07 -0800)]
[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.

2 years ago[AST] Don't consider 'ExportDecl' when calculating DeclContext 'Encloses'
Chuanqi Xu [Tue, 11 Jan 2022 01:54:57 +0000 (09:54 +0800)]
[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

2 years agoAdd a `qualified` directive to the Op, Attribute, and Type declarative assembly format
Mehdi Amini [Tue, 11 Jan 2022 01:26:44 +0000 (01:26 +0000)]
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 ee0908703d29 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

2 years ago[clang][OpenMP5.1] Initial parsing/sema for 'indirect' clause
Jennifer Yu [Tue, 11 Jan 2022 00:20:02 +0000 (16:20 -0800)]
[clang][OpenMP5.1] Initial parsing/sema for 'indirect' clause

Differential Revision: https://reviews.llvm.org/D116764

2 years ago[Tooling] When transferring compile commands between files, always use '--'
Sam McCall [Thu, 6 Jan 2022 04:00:11 +0000 (05:00 +0100)]
[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

2 years ago[Diagnostics] Don't drop a statically set NoWarningAsError flag during option processing
Wolfgang Pieb [Fri, 17 Sep 2021 00:22:31 +0000 (17:22 -0700)]
[Diagnostics] Don't drop a statically set NoWarningAsError flag during option processing

When a -W<diag> option is given on the command line, and the corresponding diagnostic has
the NoWarnOnError flag set, prevent the flag from being dropped when the severity is reevaluated.
This fixes PR51837.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D109981

2 years ago[libcxx][test] Make LIBCPP_STATIC_ASSERT usable at namespace scope
Casey Carter [Tue, 11 Jan 2022 00:35:31 +0000 (16:35 -0800)]
[libcxx][test] Make LIBCPP_STATIC_ASSERT usable at namespace scope

... even when `!defined(_LIBCPP_VERSION)`. (Note that the previous definition for this case - `((void)0);` - is ill-formed at namespace scope.) Ditto for `LIBCPP_ASSERT`, `LIBCPP_ASSERT_NOEXCEPT`, `LIBCPP_ASSERT_NOT_NOEXCEPT`, and `LIBCPP_ONLY`.

Differential Revision: https://reviews.llvm.org/D116880

2 years agoEmit the C++ dialect in -gmodules .pcm files.
Adrian Prantl [Mon, 10 Jan 2022 22:55:03 +0000 (14:55 -0800)]
Emit the C++ dialect in -gmodules .pcm files.

Because of commit: https://reviews.llvm.org/D104291 the -gmodules .pcm
files do not have the same DW_AT_language dialect as the .o file. This
was a simple matter of passing the DebugStrictDwarf flag to the
PCHContainerGenerator object's CodeGenOpts from the CompilerInstance
passed in to it.

Before this change if you ran dwarfdump on the gmodule cache folder
you would get DW_AT_language (DW_LANG_C_plus_plus) even when using
-std=c++14 with clang

Patch by Shubham Rastogi!

Differential Revision: https://reviews.llvm.org/D116790

2 years agodocs: update some bug tracker references (NFC)
Keith Smiley [Sun, 9 Jan 2022 02:36:49 +0000 (18:36 -0800)]
docs: update some bug tracker references (NFC)

Fixes https://github.com/llvm/llvm-project/issues/53091

Differential Revision: https://reviews.llvm.org/D116898

2 years ago[CodeCompletion] Complete designators for fields in anonymous structs/unions
Sam McCall [Thu, 6 Jan 2022 02:34:41 +0000 (03:34 +0100)]
[CodeCompletion] Complete designators for fields in anonymous structs/unions

Fixes https://github.com/clangd/clangd/issues/836

Differential Revision: https://reviews.llvm.org/D116717

2 years agoAdd coverage of GlobalsModRef's indirect global case
Philip Reames [Mon, 10 Jan 2022 23:54:18 +0000 (15:54 -0800)]
Add coverage of GlobalsModRef's indirect global case

2 years ago[libc] Add linux aarch64 syscall implementation.
Siva Chandra [Mon, 10 Jan 2022 07:02:41 +0000 (23:02 -0800)]
[libc] Add linux aarch64 syscall implementation.

Add mmap and munmap to the linux aarch64 entrypoint list as the first
user of these syscalls.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D116949

2 years ago[NFC][regalloc] Pull out some AllocationOrder/CostPerUseLimit eviction logic
Mircea Trofin [Tue, 21 Dec 2021 04:03:40 +0000 (20:03 -0800)]
[NFC][regalloc] Pull out some AllocationOrder/CostPerUseLimit eviction logic

We are reusing that logic in the ML implementation.

Differential Revision: https://reviews.llvm.org/D116075

2 years ago[MemoryBuiltin] Add an API for checking if an unused allocation can be removed [NFC]
Philip Reames [Mon, 10 Jan 2022 17:50:01 +0000 (09:50 -0800)]
[MemoryBuiltin] Add an API for checking if an unused allocation can be removed [NFC]

Not all allocation functions are removable if unused.  An example of a non-removable allocation would be a direct call to the replaceable global allocation function in C++.  An example of a removable one - at least according to historical practice - would be malloc.

2 years ago[LowerMatrixIntrinsics] Call getRegisterClassForType before getNumberOfRegisters.
Craig Topper [Mon, 10 Jan 2022 22:42:23 +0000 (14:42 -0800)]
[LowerMatrixIntrinsics] Call getRegisterClassForType before getNumberOfRegisters.

getNumberOfRegisters takes a ClassID as it's argument. It shouldn't be passed a bool. Assuming the bool meant vector or not, we should call getRegisterClassForType first.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D116903

2 years ago[clang-tidy] Refactor: Extract Class CheckRunner on check_clang_tidy.py
Richard [Sat, 1 Jan 2022 22:17:08 +0000 (15:17 -0700)]
[clang-tidy] Refactor: Extract Class CheckRunner on check_clang_tidy.py

Break up the huge function by extracting a class, storing intermediate
state as class members and breaking up the big function into a group
of class methods all at the same level of abstraction.

Differential Revision: https://reviews.llvm.org/D56343

2 years ago[HIP] Fix device only linking for -fgpu-rdc
Yaxun (Sam) Liu [Fri, 7 Jan 2022 18:33:00 +0000 (13:33 -0500)]
[HIP] Fix device only linking for -fgpu-rdc

Currently when -fgpu-rdc is specified, HIP toolchain always does host linking even
if --cuda-device-only is specified.

This patch fixes that. Only device linking is performed when --cuda-device-only
is specified.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D116840

2 years ago[lldb] fix memory leak in "GetGDBServerRegisterInfoXMLAndProcess"
Lirong Yuan [Mon, 10 Jan 2022 22:32:15 +0000 (14:32 -0800)]
[lldb] fix memory leak in "GetGDBServerRegisterInfoXMLAndProcess"

While running heap checker on a test that uses LLDB API, the following memory leak is found:

RAW: HeapChecker started...
RAW: Leak check _main_ detected leaks of 34 bytes in 4 objects
RAW: The 2 largest leaks:
RAW: Leak of 17 bytes in 2 objects allocated from:
@ 0x7fb93bd20166 NewHook()
@ 0x7fb929372a73 absl::base_internal::MallocHook::InvokeNewHookSlow()
@ 0x5600d1046093 libc_malloc
@ 0x7fb974529c03 xmlStrdup
@ 0x7fb9744c2a0b xmlGetProp
@ 0x7fb9749d9ed6 lldb_private::XMLNode::GetAttributeValue()
@ 0x7fb979043001 std::u::function::policy_invoker<>::__call_impl<>()
@ 0x7fb9749da06d lldb_private::XMLNode::ForEachChildElement()
@ 0x7fb97903c54d lldb_private::process_gdb_remote::ProcessGDBRemote::GetGDBServerRegisterInfoXMLAndProcess()
@ 0x7fb97902cfe4 lldb_private::process_gdb_remote::ProcessGDBRemote::GetGDBServerRegisterInfo()
@ 0x7fb97902c1d0 lldb_private::process_gdb_remote::ProcessGDBRemote::BuildDynamicRegisterInfo()
@ 0x7fb97902e92a lldb_private::process_gdb_remote::ProcessGDBRemote::SetThreadStopInfo()
@ 0x7fb97902db18 lldb_private::process_gdb_remote::ProcessGDBRemote::DoConnectRemote()
@ 0x7fb97584965e lldb_private::Process::ConnectRemote()
@ 0x7fb975839fa6 lldb_private::Platform::DoConnectProcess()
@ 0x7fb97583a39e lldb_private::Platform::ConnectProcessSynchronous()
@ 0x7fb97545b28b CommandObjectProcessConnect::DoExecute()
@ 0x7fb9755a70c9 lldb_private::CommandObjectParsed::Execute()
@ 0x7fb97559c0e9 lldb_private::CommandInterpreter::HandleCommand()
@ 0x7fb975460145 lldb_private::CommandObjectRegexCommand::DoExecute()
@ 0x7fb9755a72d2 lldb_private::CommandObjectRaw::Execute()
@ 0x7fb97559c0e9 lldb_private::CommandInterpreter::HandleCommand()
@ 0x7fb997a5f22e lldb::SBCommandInterpreter::HandleCommand()
@ 0x7fb997a5ef9b lldb::SBCommandInterpreter::HandleCommand()

This change fixes the memory leaks by freeing memory after it is no
longer in use. Tested with "ninja check-lldb".

Differential revision: https://reviews.llvm.org/D116707

2 years agoDon't fail if unable to promote loops during unrolling
Tyler Augustine [Mon, 10 Jan 2022 21:42:03 +0000 (21:42 +0000)]
Don't fail if unable to promote loops during unrolling

When the unroll factor is 1, we should only fail "unrolling" when the trip count also is determined to be 1 and it is unable to be promoted.

Reviewed By: bondhugula

Differential Revision: https://reviews.llvm.org/D115365

2 years ago[libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <list>
Nikolas Klauser [Mon, 10 Jan 2022 15:31:04 +0000 (16:31 +0100)]
[libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <list>

Use `_LIBCPP_DEBUG_ASSERT` in `<list>`

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116938

2 years ago[openmp][amdgpu] Replace unsigned long with uint64_t
Jon Chesterfield [Mon, 10 Jan 2022 22:19:29 +0000 (22:19 +0000)]
[openmp][amdgpu] Replace unsigned long with uint64_t

Some types need to be 64 bit. Unsigned long is a hazard there.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D116963

2 years ago[libcxx][test] Auto-detect _LIBCPP_HAS_NO_UNICODE for MSVC STL
Casey Carter [Mon, 10 Jan 2022 21:56:22 +0000 (13:56 -0800)]
[libcxx][test] Auto-detect _LIBCPP_HAS_NO_UNICODE for MSVC STL

... by examining `_MSVC_EXECUTION_CHARACTER_SET` in the force-include header.

Differential Revision: https://reviews.llvm.org/D116883

2 years agoFix a missed opportunity to merge stores.
Nadav Rotem [Mon, 10 Jan 2022 20:51:37 +0000 (12:51 -0800)]
Fix a missed opportunity to merge stores.

This commit fixes a missed opportunity in merging consecutive stores.
The code that searches for stores skipped the case of stores that
directly connect to the root. The comment above the implementation lists
this case but the code did not handle it. I found this pattern when
looking into the shared_ptr destructor. GCC generates the right
sequence. Here is a small repo:

    int foo(int* buff) {
        buff[0] = 0;
        int x = buff[1];
        buff[1] = 0;
        return x;
    }

Differential Revision: https://reviews.llvm.org/D116895

2 years ago[llvm] Fix the module build
Jonas Devlieghere [Mon, 10 Jan 2022 21:39:49 +0000 (13:39 -0800)]
[llvm] Fix the module build

Fix the module build after 2c0fb96254fef2509b66d75290fedafd4adede95

2 years ago[doc][cmake] Convert read-me for the common CMake utils to reST
John Ericson [Sat, 8 Jan 2022 06:08:45 +0000 (06:08 +0000)]
[doc][cmake] Convert read-me for the common CMake utils to reST

@phosek mentioned others might want it reST for consistency. As I
personally do not like Markdown at all and just did the "usual GitHub
read-me thing" out of habit, I am more than happy to oblige.

Also fix the typos found in the original.

Reviewed By: phosek, lebedev.ri

Differential Revision: https://reviews.llvm.org/D116524

2 years ago[libc++] Refactor the tests for std::random_device
Louis Dionne [Mon, 10 Jan 2022 21:30:28 +0000 (16:30 -0500)]
[libc++] Refactor the tests for std::random_device

That will make it easier to change the behavior of the arc4random()
based implementation. Note that in particular, the eval.pass.cpp test
used to work with non "/dev/random" based implementations because we'd
throw an exception upon constructing the random_device. This patch makes
the intent of the test clearer.

2 years ago[libunwind][cmake] Create `LIBUNWIND_INSTALL_INCLUDE_DIR` CACHE PATH
John Ericson [Sun, 9 Jan 2022 00:08:15 +0000 (00:08 +0000)]
[libunwind][cmake] Create `LIBUNWIND_INSTALL_INCLUDE_DIR` CACHE PATH

This is created on analogy with the other CACHE PATHs in this package,
and other `*_INSTALL_INCLUDE_DIR` in other packages.

The branching is adjusted to deduplicate some existing code, and
likewise avoid having to define this new variable more than once.

This will be used for D99484.

Reviewed By: #libunwind, compnerd

Differential Revision: https://reviews.llvm.org/D116873

2 years ago[libc++] Alphabetize header #includes. NFCI.
Arthur O'Dwyer [Fri, 7 Jan 2022 14:45:05 +0000 (09:45 -0500)]
[libc++] Alphabetize header #includes. NFCI.

The NFC part of D116809. We still want to enforce this in CI,
but the mechanism for that is still to-be-determined.

Differential Revision: https://reviews.llvm.org/D116809

2 years ago[libcxx] Use Fuchsia-native monotonic clock for std::chrono::steady_clock
Roland McGrath [Tue, 4 Jan 2022 18:25:20 +0000 (10:25 -0800)]
[libcxx] Use Fuchsia-native monotonic clock for std::chrono::steady_clock

Use the zx_clock_get_monotonic system call directly rather than
going through the POSIX clock_gettime function.  The libc function
is a trivial wrapper around the system call, and is not a standard C
function.  Avoiding it reduces the Fuchsia libc ABI surface that
libc++ depends on.

Reviewed By: phosek, ldionne, #libc

Differential Revision: https://reviews.llvm.org/D116606

2 years ago[libc++] Alphabetize CMakeLists.txt and module.modulemap. NFC.
Arthur O'Dwyer [Mon, 10 Jan 2022 18:23:19 +0000 (13:23 -0500)]
[libc++] Alphabetize CMakeLists.txt and module.modulemap. NFC.

The NFC part of D116958. We still want to enforce this in CI,
but the mechanism for that is still to-be-determined.

2 years ago[lldb] Remove LLDB_RECORD_DUMMY_* macros
Jonas Devlieghere [Mon, 10 Jan 2022 20:05:54 +0000 (12:05 -0800)]
[lldb] Remove LLDB_RECORD_DUMMY_* macros

2 years ago[lldb] Remove LLDB_RECORD_CHAR_PTR_* macros
Jonas Devlieghere [Mon, 10 Jan 2022 19:55:50 +0000 (11:55 -0800)]
[lldb] Remove LLDB_RECORD_CHAR_PTR_* macros

2 years ago[NFC][regalloc] Pass RAGreedy to eviction adviser
Mircea Trofin [Wed, 5 Jan 2022 17:22:02 +0000 (09:22 -0800)]
[NFC][regalloc] Pass RAGreedy to eviction adviser

This patch simplifies the interface between RAGreedy and the eviction
adviser by passing the allocator to the adviser, which allows the latter
to extract needed information as needed, rather than requiring it be passed
piecemeal at construction time (which would also complicate later
evolution).

Part of this, the patch also moves ExtraRegInfo back to RAGreedy. We
keep the encapsulation of ExtraRegInfo because it has benefits (e.g.
improved readability by abstracting access to the cascade info) and also
simpler re-initialization at regalloc pass re-entry time (we just flush
the Optional).

Differential Revision: https://reviews.llvm.org/D116669

2 years ago[flang] Fix the documentation on how to build flang
Peter Steinfeld [Tue, 4 Jan 2022 00:13:28 +0000 (16:13 -0800)]
[flang] Fix the documentation on how to build flang

I recently had an email exchange on flang-dev that revealed that the
documentation on how to build flang is incorrect.  This update fixes
that.

Differential Revision: https://reviews.llvm.org/D116566

2 years ago[lldb] Remove lldb-instr
Jonas Devlieghere [Mon, 10 Jan 2022 19:41:31 +0000 (11:41 -0800)]
[lldb] Remove lldb-instr

2 years ago[TSan] Avoid deadlock in test for compiler-rt debug build
Julian Lettner [Mon, 10 Jan 2022 19:15:39 +0000 (11:15 -0800)]
[TSan] Avoid deadlock in test for compiler-rt debug build

rdar://86776155

2 years ago[clang][dataflow] Add transfer functions for assignment
Stanislav Gatev [Tue, 4 Jan 2022 13:47:14 +0000 (13:47 +0000)]
[clang][dataflow] Add transfer functions for assignment

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Differential Revision: https://reviews.llvm.org/D116596

2 years agoRevert "[CodeGen] Mark fma as const for Android"
Alex Xu (Hello71) [Mon, 10 Jan 2022 17:42:56 +0000 (09:42 -0800)]
Revert "[CodeGen] Mark fma as const for Android"

This code is intended to give a special exception for platforms which set errno in some math functions but not fma. This does not apply to Android, which does not set errno in any math functions (https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/math.h;drc=master;l=59). The correct implementation for Android is to set -fno-math-errno by default, which was done in https://reviews.llvm.org/D51068. Therefore, this special exception is no longer needed for Android. Deleting it slightly reduces code complexity, clang executable size, compile time, and test time.

This reverts fbfba29d74748b8fffd2f7cc654fb4c3659c8f67.

Reviewed By: pirama

Differential Revision: https://reviews.llvm.org/D116755

2 years agoAMDGPU/GlobalISel: Explicitly track d16 for image legalization
Matt Arsenault [Sun, 9 Jan 2022 17:32:15 +0000 (12:32 -0500)]
AMDGPU/GlobalISel: Explicitly track d16 for image legalization

We were trying to guess at the original IR type for image intrinsics
after legalization to figure out if they were d16, but this didn't
work. Explicitly track if this is a d16 operation or not in the
opcode, as is done for the buffer intrinsics.

The OpenCL library is using f32 image writes with a dmask of 15 for
some reason, and this was incorrectly switching them to use d16. Fixes
image failures in the OpenCL conformance test. The equivalent dmask
for loads doesn't even select in either selector.

2 years ago[cmake] Enable users to specify archive creation commands
Alexander Shaposhnikov [Mon, 10 Jan 2022 18:53:31 +0000 (18:53 +0000)]
[cmake] Enable users to specify archive creation commands

This diff enables users to override CMAKE_C_ARCHIVE_CREATE & CMAKE_CXX_ARCHIVE_CREATE
(currently set in HandleLLVMOptions.cmake).

For example, one can specify
cmake -DCMAKE_C_ARCHIVE_CREATE="<CMAKE_AR> TDqc <TARGET> <LINK_FLAGS> <OBJECTS>" \
      -DCMAKE_CXX_ARCHIVE_CREATE="<CMAKE_AR> TDqc <TARGET> <LINK_FLAGS> <OBJECTS>" ...
to make the build create thin archives instead of regular ones.
For a clean run `ninja lld` using thin archives seems to reduce the size
of the build directory from ~14GB to ~8GB

Differential revision: https://reviews.llvm.org/D116850

2 years agoGlobalISel: Pass DebugLoc to getFunctionLiveInPhysReg
Matt Arsenault [Sun, 9 Jan 2022 15:25:36 +0000 (10:25 -0500)]
GlobalISel: Pass DebugLoc to getFunctionLiveInPhysReg

Fixes crash in assertion about dropping debug info.

2 years ago[clang-tidy] Fix RenamerClangTidyChecks suggesting invalid macro identifiers
Logan Smith [Fri, 7 Jan 2022 18:22:56 +0000 (10:22 -0800)]
[clang-tidy] Fix RenamerClangTidyChecks suggesting invalid macro identifiers

This behavior was fixed for regular identifiers in
9f3edc323a88c1a179a0a5a9dc9a87a2964c0d48, but the same fix was not applied to
macro fixits. This addresses https://github.com/llvm/llvm-project/issues/52895.

Differential Revision: https://reviews.llvm.org/D116824

2 years agoAMDGPU: Avoid null check during addrspacecast lowering
Matt Arsenault [Tue, 28 Dec 2021 15:22:13 +0000 (10:22 -0500)]
AMDGPU: Avoid null check during addrspacecast lowering

If we know the source is a valid object, we do not need to insert a
null check. This misses a lot of opportunities from
metadata/attributes not tracked in codegen.

2 years ago[mlir][NFC] Fully spell mlir typenames in BaseOpWithOffsetSizesAndStrides
Ivan Butygin [Mon, 10 Jan 2022 14:52:41 +0000 (17:52 +0300)]
[mlir][NFC] Fully spell mlir typenames in BaseOpWithOffsetSizesAndStrides

Differential Revision: https://reviews.llvm.org/D116951

2 years ago[lldb] Disable several lldb tests that are flaky on Windows
Stella Stamenova [Mon, 10 Jan 2022 18:21:12 +0000 (10:21 -0800)]
[lldb] Disable several lldb tests that are flaky on Windows

This tests have recently become flaky (flakier?) causing occasional failures in the windows lldb buildbot

2 years ago[flang] Do not lose call in shape inquiry on function reference
Jean Perier [Mon, 10 Jan 2022 18:09:45 +0000 (19:09 +0100)]
[flang] Do not lose call in shape inquiry on function reference

Currently, something like `print *, size(foo(n,m))` was rewritten
to `print *, size(foo_result_symbol)` when foo result is a non constant
shape array. This cannot be processed by lowering or reprocessed by a
Fortran compiler since the syntax is wrong (`foo_result_symbol` is
unknown on the caller side) and the arguments are lost when they might
be required to compute the result shape.

It is not possible (and probably not desired) to make GetShape fail in
general in such case since returning nullopt seems only expected for
scalars or assumed rank (see GetRank usage in lib/Semantics/check-call.cpp),
and returning a vector with nullopt extent may trigger some checks to
believe they are facing an assumed size (like here in intrinsic argument
checks: https://github.com/llvm/llvm-project/blob/196204c72c68a577c72af95d70f18e3550939a5e/flang/lib/Evaluate/intrinsics.cpp#L1530).

Hence, I went for a solution that limits the rewrite change to folding
(where the original expression is returned if the shape depends on a non
constant shape from a call).

I added a non default option to GetShapeHelper that prevents the rewrite
of shape inquiry on calls to descriptor inquiries. At first I wanted to
avoid touching GetShapeHelper, but it would require to re-implement all
its logic to determine if the shape comes from a function call or not
(the expression could be `size(1+foo(n,m))`). So added an alternate
entry point to GetShapeHelper seemed the cleanest solution to me.

Differential Revision: https://reviews.llvm.org/D116933

2 years ago[ELF] Support mixed TLSDESC and TLS GD
Fangrui Song [Mon, 10 Jan 2022 18:03:21 +0000 (10:03 -0800)]
[ELF] Support mixed TLSDESC and TLS GD

We only support both TLSDESC and TLS GD for x86 so this is an x86-specific
problem. If both are used, only one R_X86_64_TLSDESC is produced and TLS GD
accesses will incorrectly reference R_X86_64_TLSDESC. Fix this by introducing
SymbolAux::tlsDescIdx.

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D116900

2 years ago[SCEV] Sequential/in-order `UMin` expression
Roman Lebedev [Mon, 10 Jan 2022 17:49:41 +0000 (20:49 +0300)]
[SCEV] Sequential/in-order `UMin` expression

As discussed in https://github.com/llvm/llvm-project/issues/53020 / https://reviews.llvm.org/D116692,
SCEV is forbidden from reasoning about 'backedge taken count'
if the branch condition is a poison-safe logical operation,
which is conservatively correct, but is severely limiting.

Instead, we should have a way to express those
poison blocking properties in SCEV expressions.

The proposed semantics is:
```
Sequential/in-order min/max SCEV expressions are non-commutative variants
of commutative min/max SCEV expressions. If none of their operands
are poison, then they are functionally equivalent, otherwise,
if the operand that represents the saturation point* of given expression,
comes before the first poison operand, then the whole expression is not poison,
but is said saturation point.
```
* saturation point - the maximal/minimal possible integer value for the given type

The lowering is straight-forward:
```
compare each operand to the saturation point,
perform sequential in-order logical-or (poison-safe!) ordered reduction
over those checks, and if reduction returned true then return
saturation point else return the naive min/max reduction over the operands
```
https://alive2.llvm.org/ce/z/Q7jxvH (2 ops)
https://alive2.llvm.org/ce/z/QCRrhk (3 ops)
Note that we don't need to check the last operand: https://alive2.llvm.org/ce/z/abvHQS
Note that this is not commutative: https://alive2.llvm.org/ce/z/FK9e97

That allows us to handle the patterns in question.

Reviewed By: nikic, reames

Differential Revision: https://reviews.llvm.org/D116766

2 years ago[libc++] Properly handle specializations of std::is_placeholder.
Arthur O'Dwyer [Thu, 30 Dec 2021 01:45:08 +0000 (20:45 -0500)]
[libc++] Properly handle specializations of std::is_placeholder.

Before this patch, the user needed to specialize both of
`is_placeholder<MyType>` and `is_placeholder<const MyType>`.
After this patch, only the former is needed (although the
latter is harmless if provided).

The new tests don't actually fail unless return type deduction
is used, which is a C++14 feature. Specializing `is_placeholder`
is still allowed in C++11, though.

Fixes #51095.

Differential Revision: https://reviews.llvm.org/D116388

2 years agoMinor style tweaks following fb93659
Philip Reames [Mon, 10 Jan 2022 17:32:23 +0000 (09:32 -0800)]
Minor style tweaks following fb93659

2 years ago[clang][HeaderSearch] Support framework includes in suggestPath...
David Goldman [Mon, 6 Dec 2021 21:33:29 +0000 (16:33 -0500)]
[clang][HeaderSearch] Support framework includes in suggestPath...

Clang will now search through the framework includes to identify
the framework include path to a file, and then suggest a framework
style include spelling for the file.

Differential Revision: https://reviews.llvm.org/D115183

2 years agoRevert "[clang] Remove redundant member initialization (NFC)"
Kazu Hirata [Mon, 10 Jan 2022 17:21:59 +0000 (09:21 -0800)]
Revert "[clang] Remove redundant member initialization (NFC)"

This reverts commit 80e2c587498a7b2bf14dde47a33a058da6e88a9a.

The original patch causes a lot of warnings on gcc like:

  llvm-project/clang/include/clang/Basic/Diagnostic.h:1329:3: warning:
  base class ‘class clang::StreamingDiagnostic’ should be explicitly
  initialized in the copy constructor [-Wextra]

2 years ago[instcombine] Add align return attributes for operator new(..., align_val)
Bryce Wilson [Mon, 10 Jan 2022 17:08:55 +0000 (09:08 -0800)]
[instcombine] Add align return attributes for operator new(..., align_val)

(Split from original patch to separate non-NFC part and add coverage.  I typoed when adding the new test, so this change includes the typo fix to let libfunc recongize the signature.  Didn't figure it was worth another separate commit.)

Differential Revision: https://reviews.llvm.org/D116851 (part 2 of 2)

2 years ago[MemoryBuiltins] Add field for alignment argument [NFC]
Bryce Wilson [Mon, 10 Jan 2022 16:58:44 +0000 (08:58 -0800)]
[MemoryBuiltins] Add field for alignment argument [NFC]

There are a few places where the alignment argument for AlignedAllocLike functions was previously hardcoded. This patch adds an getAllocAlignment function and a change to the MemoryBuiltin table to allow alignment arguments to be found generically.

This will shortly allow alignment inference on operator new's with align_val params and an extension to Attributor's HeapToStack.  The former will follow shortly - I split Bryce's patch for purpose of having the large change be NFC.  The later will be reviewed separately.

Differential Revision: https://reviews.llvm.org/D116851 (part 1 of 2)

2 years ago[RISCV] Use FP ABI on some of the FP tests to reduce the number of CHECK lines. NFC
Craig Topper [Mon, 10 Jan 2022 16:57:38 +0000 (08:57 -0800)]
[RISCV] Use FP ABI on some of the FP tests to reduce the number of CHECK lines. NFC

These tests are interested in the FP instructions being used, not
the conversions needed to pass the arguments/returns in GPRs.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D116869

2 years ago[ConstantFolding] Clean up Intrinsics::abs undef handling
Simon Pilgrim [Mon, 10 Jan 2022 17:03:43 +0000 (17:03 +0000)]
[ConstantFolding] Clean up Intrinsics::abs undef handling

Match cttz/ctlz handling by assuming C1 == 0 if C1 != 1 - I've added an assertion as well.

Fixes static analyzer nullptr dereference warnings.