platform/upstream/llvm.git
2 years ago[ELF][test] Improve discard-locals.s
Fangrui Song [Thu, 7 Apr 2022 21:24:15 +0000 (14:24 -0700)]
[ELF][test] Improve discard-locals.s

2 years ago[LV] Add test case for PR54427.
Florian Hahn [Thu, 7 Apr 2022 21:21:21 +0000 (23:21 +0200)]
[LV] Add test case for PR54427.

Reduced test for #54427.

2 years ago[PowerPC] Fix EmitPPCBuiltinExpr to emit arguments once
Quinn Pham [Mon, 14 Mar 2022 20:13:47 +0000 (15:13 -0500)]
[PowerPC] Fix EmitPPCBuiltinExpr to emit arguments once

This patch changes `EmitPPCBuiltinExpr` in `CGBuiltin.cpp` to remove
the loop at the beginning of the function that emits the arguments and
to delay emitting the arguments until inside the switch statement. These
changes will put `EmitPPCBuiltinExpr` in line with the strategy of the
target independent function `EmitBuiltinExpr`. Also, this patch
ensures that arguments are only emitted once.

Tests that included builtins affected by these changes have been
modified to match expected behaviour.

Reviewed By: #powerpc, nemanjai, amyk

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

2 years ago[lldb] Use getMainExecutable in SBDebugger::PrintStackTraceOnError
Jonas Devlieghere [Thu, 7 Apr 2022 20:43:47 +0000 (13:43 -0700)]
[lldb] Use getMainExecutable in SBDebugger::PrintStackTraceOnError

Implement Pavel's suggestion to use llvm::sys::fs::getMainExecutable to
find the executable name for llvm::sys::PrintStackTraceOnErrorSignal.

2 years agoRevert "[libc++][format] Use a helper constant."
Mark de Wever [Thu, 7 Apr 2022 20:40:08 +0000 (22:40 +0200)]
Revert "[libc++][format] Use a helper constant."

This reverts commit 82427685ea3732665286d5b1c8a1424b1f96164e.

This seems to break the AIX-32 bit build.

2 years ago[lldb][gui] remove the "expand" diamond for variables where expanding fails
Luboš Luňák [Sun, 3 Apr 2022 23:13:53 +0000 (01:13 +0200)]
[lldb][gui] remove the "expand" diamond for variables where expanding fails

If the variables view shows a variable that is a struct that has
MightHaveChildren(), the expand diamond is shown, but if trying to expand
it and it's not possible (e.g. incomplete type), remove the expand diamond
to visualize that it can't be in fact expanded. Otherwise it feels kinda
weird that a tree item cannot be expanded even though it "should".

I guess the MightHaveChildren() checking means that GetChildren() may
be expensive, so also do not call it for rows that are not expanded.

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

2 years ago[lldb][gui] handle Ctrl+C to stop a running process
Luboš Luňák [Mon, 4 Apr 2022 08:36:54 +0000 (10:36 +0200)]
[lldb][gui] handle Ctrl+C to stop a running process

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

2 years ago[ARM] Add missing return to ARMTTIImpl::isLoweredToCall.
Craig Topper [Thu, 7 Apr 2022 19:52:53 +0000 (12:52 -0700)]
[ARM] Add missing return to ARMTTIImpl::isLoweredToCall.

I assume we meant to return the result of the call to
BaseT::isLoweredToCall(F).

This might not be a functional change in practice because it would
still hit the default case in the switch and call
BaseT::isLoweredToCall(F) at the end.

Reviewed By: efriedma

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

2 years ago[lld/mac] Add some comments and asserts
Nico Weber [Thu, 7 Apr 2022 12:48:52 +0000 (08:48 -0400)]
[lld/mac] Add some comments and asserts

I was wondering if SymtabSection::emitStabs() should check
defined->includeInSymtab. Add asserts and comments explaining why that's not
necessary.

No behavior change.

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

2 years ago[Driver][NFC] Simplify handling of flags in Options.td
Emil Kieri [Thu, 7 Apr 2022 16:00:15 +0000 (18:00 +0200)]
[Driver][NFC] Simplify handling of flags in Options.td

We aim at improving the readability and maintainability of Options.td,
and in particular its handling of 'Flags', by
 - limiting the extent of 'let Flags = [...] in {'s, and
 - adding closing comments to matching '}'s.
 - being more consistent about empty lines around 'let Flags' and '}'.

More concretely,
 - we do not let a 'let Flags' span across several headline comments.
   When all 'def's in two consecutive headlines share the same flags,
   we stil close and start a new 'let Flags' at the intermediate
   headline.
 - when a 'let Flags' span just one or two 'def's, set 'Flags' within
   the 'def's instead.
 - we remove nested 'let Flags'.

Note that nested 'let Flags' can be quite confusing, especially when
the outer was started long before the inner. Moving a 'def' out of the
inner 'let Flags' and setting 'Flags' within the 'def' will not have the
intended effect, as those flags will be overridden by the outer
'let Flags'.

Reviewed By: awarzynski, jansvoboda11, hans

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

2 years agoReland [GreedPatternRewriter] Preprocess constants while building worklist when not...
River Riddle [Thu, 7 Apr 2022 01:52:39 +0000 (18:52 -0700)]
Reland [GreedPatternRewriter] Preprocess constants while building worklist when not processing top down

Reland Note: Adds a fix to properly mark a commutative operation as folded if we change the order
             of its operands. This was uncovered by the fact that we no longer re-process constants.

This avoids accidentally reversing the order of constants during successive
application, e.g. when running the canonicalizer. This helps reduce the number
of iterations, and also avoids unnecessary changes to input IR.

Fixes #51892

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

2 years ago[lld-macho][nfc] Remove indirection when looking up common section members
Jez Ng [Thu, 7 Apr 2022 18:28:44 +0000 (14:28 -0400)]
[lld-macho][nfc] Remove indirection when looking up common section members

{D118797} means that we can now check the name/segname of a given
section directly, instead of having to look those properties up on one
of its subsections. This allows us to simplify our code.

Reviewed By: #lld-macho, oontvoo

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

2 years ago[AArch64] Insert subvector costs
David Green [Thu, 7 Apr 2022 18:27:41 +0000 (19:27 +0100)]
[AArch64] Insert subvector costs

An insert subvector under aarch64 can often be done as a single lane mov
operation. For example a v4i8 inserted into a v16i8 is a s-reg mov, so
long as the index is a multiple of 4. This teaches the cost model that,
using code copied over from the X86 backend.

Some of the costs (v16i16_4_0) are still high because they get matched
as a SK_Select, not an SK_InsertSubvector. D120879 has some codegen
tests for inserting subvectors, which I were added as
llvm/test/CodeGen/AArch64/insert-subvector.ll.

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

2 years ago[OpenMP] Add dynamic memory function to omp.h and add documentation
Joseph Huber [Wed, 6 Apr 2022 19:56:19 +0000 (15:56 -0400)]
[OpenMP] Add dynamic memory function to omp.h and add documentation

This patch adds the `llvm_omp_target_dynamic_shared_alloc` function to
the `omp.h` header file so users can access it by default. Also changed
the name to keep it consistent with the other target allocators. Added
some documentation so users know how to use it. Didn't add the interface
for Fortran since there's no way to test it right now.

Reviewed By: jdoerfert

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

2 years ago[OpenMP] Change target memory tests to use allocators
Joseph Huber [Wed, 6 Apr 2022 19:21:50 +0000 (15:21 -0400)]
[OpenMP] Change target memory tests to use allocators

The target allocators have been supported for NVPTX offloading for
awhile. The tests should use the allocators instead of calling the
functions manually. Also the comments indicating these being a preview
should be removed.

Reviewed By: jdoerfert

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

2 years ago[mlir][ods] Fix builder gen for VariadicRegion with inferred types
Mogball [Thu, 7 Apr 2022 18:22:14 +0000 (18:22 +0000)]
[mlir][ods] Fix builder gen for VariadicRegion with inferred types

Builders generated for ops with variadic regions and inferred return types were not being correctly generated (missing parameter).

2 years ago[lldb] Add Python bindings to print stack traces on crashes.
Jonas Devlieghere [Thu, 7 Apr 2022 18:12:09 +0000 (11:12 -0700)]
[lldb] Add Python bindings to print stack traces on crashes.

As noticed in D87637, when LLDB crashes, we only print stack traces if
LLDB is directly executed, not when used via Python bindings. Enabling
this by default may be undesirable (libraries shouldn't be messing with
signal handlers), so make this an explicit opt-in.

I "commandeered" this patch from Jordan Rupprecht who put this up for
review originally.

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

2 years ago[clang] Use -triple, not -target for %clang_cc1
Alex Brachet [Thu, 7 Apr 2022 18:19:54 +0000 (18:19 +0000)]
[clang] Use -triple, not -target for %clang_cc1

2 years ago[clang] Fix macos build broken after D120989
Alex Brachet [Thu, 7 Apr 2022 18:17:29 +0000 (18:17 +0000)]
[clang] Fix macos build broken after D120989

2 years ago[clang-tidy] Fix invalid fix-it for cppcoreguidelines-prefer-member-initializer
Nathan James [Thu, 7 Apr 2022 18:13:50 +0000 (19:13 +0100)]
[clang-tidy] Fix invalid fix-it for cppcoreguidelines-prefer-member-initializer

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

Reviewed By: LegalizeAdulthood

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

2 years ago[clang][extract-api][NFC] Use dedicated API to check for macro equality
Daniel Grumberg [Thu, 7 Apr 2022 10:17:23 +0000 (11:17 +0100)]
[clang][extract-api][NFC] Use dedicated API to check for macro equality

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

2 years ago[tosa][mlir] Add dynamic width/height support for depthwise convolution in tosa-to...
natashaknk [Thu, 7 Apr 2022 17:22:23 +0000 (10:22 -0700)]
[tosa][mlir] Add dynamic width/height support for depthwise convolution in tosa-to-linalg

In addition, fixed a small bug with padding incorrectly inferring output shape for dynaic inputs in convolution

Reviewed By: jpienaar

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

2 years agoInstCombineCalls: fix annotateAnyAllocCallSite to report changes
Augie Fackler [Wed, 6 Apr 2022 15:59:30 +0000 (11:59 -0400)]
InstCombineCalls: fix annotateAnyAllocCallSite to report changes

Spotted during review of D123052.

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

2 years ago[X86] Add PR35202 test case for commuted cmp merging
Simon Pilgrim [Thu, 7 Apr 2022 17:39:06 +0000 (18:39 +0100)]
[X86] Add PR35202 test case for commuted cmp merging

Test coverage for Issue #34550

2 years ago[clang][NFC] Extract EmitAssemblyHelper::shouldEmitRegularLTOSummary
Pavel Samolysov [Thu, 7 Apr 2022 15:43:10 +0000 (08:43 -0700)]
[clang][NFC] Extract EmitAssemblyHelper::shouldEmitRegularLTOSummary

The code to check if the regular LTO summary should be emitted and to
add the corresponding module flags was duplicated in the
'EmitAssemblyHelper::EmitAssemblyWithLegacyPassManager' and
'EmitAssemblyHelper::RunOptimizationPipeline' methods.

In order to eliminate these code duplications, the
'EmitAssemblyHelper::shouldEmitRegularLTOSummary' method has been
extracted. The method returns a bool value, the value is 'true' if the
module summary should be emitted. The patch keeps the setting of the
module flags inline.

Reviewed By: tejohnson

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

2 years ago[libc++][format] Use a helper constant.
Mark de Wever [Thu, 7 Apr 2022 17:22:14 +0000 (19:22 +0200)]
[libc++][format] Use a helper constant.

The code accidentally uses a hard-coded value. Use a constant to make
sure the same value is used at both places.

2 years ago[clang][ExtractAPI] Fix declaration fragments for ObjC methods
Zixu Wang [Wed, 6 Apr 2022 21:53:52 +0000 (14:53 -0700)]
[clang][ExtractAPI] Fix declaration fragments for ObjC methods

Objective-C methods selector parts should be considered as identifiers.

Depends on D123259

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

2 years ago[CaptureTracking] Ignore ephemeral values when determining pointer escapeness
Arthur Eubanks [Tue, 5 Apr 2022 21:51:53 +0000 (14:51 -0700)]
[CaptureTracking] Ignore ephemeral values when determining pointer escapeness

Ephemeral values cannot cause a pointer to escape.

No change in compile time:
https://llvm-compile-time-tracker.com/compare.php?from=4371710085ba1c376a094948b806ddd3b88319de&to=c5ddbcc4866f38026737762ee8d7b9b00395d4f4&stat=instructions

This partially fixes some regressions caused by more calls to `__builtin_assume` (D122397).

Reviewed By: asbirlea

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

2 years ago[X86] Add PR19752 test case
Simon Pilgrim [Thu, 7 Apr 2022 17:08:42 +0000 (18:08 +0100)]
[X86] Add PR19752 test case

Test coverage for Issue #20126

2 years ago[AArch64] Update tests with the `update_llc_test_checks.py` script (NFC)
Karl Meakin [Wed, 6 Apr 2022 17:35:37 +0000 (18:35 +0100)]
[AArch64] Update tests with the `update_llc_test_checks.py` script (NFC)

Reviewed By: Kmeakin

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

2 years ago[mlir][vector] Fold extract(broadcast) of same rank
Lei Zhang [Thu, 7 Apr 2022 16:59:09 +0000 (12:59 -0400)]
[mlir][vector] Fold extract(broadcast) of same rank

This case is handled in neither the folding or canonicalization
patterns. The folding pattern cannot generate new broadcast ops,
so it should be handled by the canonicalization pattern.

Reviewed By: ThomasRaoux

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

2 years ago[clang][extract-api] Process only APIs declared in inputs
Daniel Grumberg [Tue, 5 Apr 2022 18:49:08 +0000 (19:49 +0100)]
[clang][extract-api] Process only APIs declared in inputs

We should only process APIs declared in the command line inputs to avoid
drowning the ExtractAPI output with symbols the user doesn't care about.
This is achieved by keeping track of the provided input files and
checking that the associated Decl or Macro is declared in one of those files.

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

2 years agoMemoryBuiltins: only claim an allocator family on builtin functions
Augie Fackler [Thu, 24 Feb 2022 22:40:17 +0000 (17:40 -0500)]
MemoryBuiltins: only claim an allocator family on builtin functions

This lines up with other parts of the codebase that only use special
knowledge about allocator functions if they're builtins.

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

2 years agoBuildLibCalls: also set allocsize() attributes
Augie Fackler [Thu, 10 Feb 2022 22:38:12 +0000 (17:38 -0500)]
BuildLibCalls: also set allocsize() attributes

This is part of being able to get rid of two more columns in
MemoryBuiltins.cpp's large table. We'll have two more changes before
we can finish the job.

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

2 years agoInstCombineCalls: when adding an align attribute, never reduce it
Augie Fackler [Mon, 14 Mar 2022 20:25:56 +0000 (16:25 -0400)]
InstCombineCalls: when adding an align attribute, never reduce it

Sometimes we can infer an align from an allocalign but the function
already promised it'd be more-aligned than the allocalign and there's an
existing align that we shouldn't reduce. Make sure we handle that
correctly.

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

2 years agoMemoryBuiltins: also check function definition for allocalign
Augie Fackler [Mon, 14 Mar 2022 20:55:44 +0000 (16:55 -0400)]
MemoryBuiltins: also check function definition for allocalign

This got changed to use hasAttrSomewhere() during review, and I didn't
notice until today when I was writing some tests for another part of
this system that using hasAttrSomewhere only checked the callsite for
allocalign, rather than both the callsite and the definition. This fixes
that by introducing a helper method.

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

2 years agoInstCombineCalls: infer return alignment from allocalign attributes
Augie Fackler [Mon, 4 Apr 2022 16:43:16 +0000 (12:43 -0400)]
InstCombineCalls: infer return alignment from allocalign attributes

This exposes a couple of lingering bugs, which will be fixed in
the next two commits.

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

2 years ago[crt][test] Fix dso_handle.cpp for Linux systems which default to PIE
Fangrui Song [Thu, 7 Apr 2022 16:37:59 +0000 (09:37 -0700)]
[crt][test] Fix dso_handle.cpp for Linux systems which default to PIE

2 years ago[x86] Replace getNodeIfExists to doesNodeExist when only check node exist
chenglin.bi [Thu, 7 Apr 2022 16:33:05 +0000 (00:33 +0800)]
[x86] Replace getNodeIfExists to doesNodeExist when only check node exist

Reviewed By: craig.topper

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

2 years ago[RISCV] Add more .vx patterns for VLMax integer setccs.
Craig Topper [Thu, 7 Apr 2022 16:17:30 +0000 (09:17 -0700)]
[RISCV] Add more .vx patterns for VLMax integer setccs.

This patch synchronizes the structure of the templates with those
in RISCVInstrInfoVVLPatterns.td so that we get patterns with .vx
on the left hand side.

Reviewed By: rogfer01

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

2 years ago[clang][ExtractAPI] Fix appendSpace in DeclarationFragments
Zixu Wang [Wed, 6 Apr 2022 21:45:35 +0000 (14:45 -0700)]
[clang][ExtractAPI] Fix appendSpace in DeclarationFragments

There is a bug in `DeclarationFragments::appendSpace` where the space
character is added to a local copy of the last fragment.

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

2 years ago[RISCV] Add swapped patterns to VPatIntegerSetCCVL_VIPlus1.
Craig Topper [Thu, 7 Apr 2022 16:05:51 +0000 (09:05 -0700)]
[RISCV] Add swapped patterns to VPatIntegerSetCCVL_VIPlus1.

This matches VPatIntegerSetCCVL_VI_Swappable. But as noted in the
FIXME this may only be needed due to lack of canonicalization on
VP_SETCC.

Reviewed By: rogfer01

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

2 years ago[SVE] Add more gather/scatter tests to highlight bugs in their generated code.
Paul Walker [Thu, 7 Apr 2022 15:42:08 +0000 (16:42 +0100)]
[SVE] Add more gather/scatter tests to highlight bugs in their generated code.

2 years ago[libc] Add a linux Thread class in __support/threads.
Siva Chandra Reddy [Fri, 1 Apr 2022 06:42:14 +0000 (06:42 +0000)]
[libc] Add a linux Thread class in __support/threads.

This change is essentially a mechanical change which moves the thread
creation and join implementations from src/threads/linux to
src/__support/threads/linux/thread.h. The idea being that, in future, a
pthread implementation can reuse the common thread implementations in
src/__support/threads.

Reviewed By: lntue

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

2 years ago[libcxx] Add flag to disable __builtin_assume in _LIBCPP_ASSERT
Arthur Eubanks [Wed, 6 Apr 2022 02:16:39 +0000 (19:16 -0700)]
[libcxx] Add flag to disable __builtin_assume in _LIBCPP_ASSERT

Introduce _LIBCPP_ASSERTIONS_DISABLE_ASSUME which makes _LIBCPP_ASSERT
not call __builtin_assume when _LIBCPP_ENABLE_ASSERTIONS == 0.

Calling __builtin_assume was introduced in D122397.

__builtin_assume is generally supposed to improve optimizations, but can
cause regressions when LLVM has trouble handling the calls to
`llvm.assume()` (see comments in D122397).

Reviewed By: philnik

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

2 years agoAMDGPU: Set implicit kernarg size to be of 256 bytes for code object version 5
Changpeng Fang [Thu, 7 Apr 2022 15:35:23 +0000 (08:35 -0700)]
AMDGPU: Set implicit kernarg size to be of 256 bytes for code object version 5

Summary:
  If implicitarg_ptr intrinsic is not used, set implicit kernarg size to 0, otherwise
set it to 256 bytes for code object version 5 (and beyond).

Reviewers: arsenm

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

2 years ago[X86] Enable fast variable per-lane shuffle tuning on all Ryzen targets (PR44795)
Simon Pilgrim [Thu, 7 Apr 2022 15:00:42 +0000 (16:00 +0100)]
[X86] Enable fast variable per-lane shuffle tuning on all Ryzen targets (PR44795)

rGa3b8695bf592 enabled this for znver3, but AMD SoG, Agner and uops.info all agree that even znver1 has a fast per-lane shuffle op (VPSHUFB), but cross-lane shuffles seem to be slow (PERMPS etc.)

Fixes #44140

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

2 years agoRemove a few effectively-unused FileEntry APIs. NFC
Sam McCall [Wed, 6 Apr 2022 09:37:25 +0000 (11:37 +0200)]
Remove a few effectively-unused FileEntry APIs. NFC

- isValid: FileManager only ever returns valid FileEntries (see next point)

- construction from outside FileManager (both FileEntry and DirectoryEntry).
  It's not possible to create a useful FileEntry this way, there are no setters.
  This was only used in FileEntryTest, added a friend to enable this.
  A real constructor is cleaner but requires larger changes to FileManager.

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

2 years ago[mlir] specify dialect names in doc generation
Alex Zinenko [Thu, 7 Apr 2022 14:36:30 +0000 (16:36 +0200)]
[mlir] specify dialect names in doc generation

In several cases, a doc is being generated from a .td file that includes
files containing other dialects. Specify the dialect for which the
documentation is being generated explicitly.

2 years ago[Sink] Don't sink non-willreturn calls (PR51188)
Nikita Popov [Thu, 7 Apr 2022 14:23:56 +0000 (16:23 +0200)]
[Sink] Don't sink non-willreturn calls (PR51188)

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

2 years ago[Sink] Add willreturn test
Nikita Popov [Thu, 7 Apr 2022 14:21:23 +0000 (16:21 +0200)]
[Sink] Add willreturn test

Explicitly test the nounwind/willreturn combinations.

2 years ago[InstCombine] SimplifyDemandedUseBits - allow and(srem(X,Pow2),C) -> and(X,C) to...
Simon Pilgrim [Thu, 7 Apr 2022 14:13:46 +0000 (15:13 +0100)]
[InstCombine] SimplifyDemandedUseBits - allow and(srem(X,Pow2),C) -> and(X,C) to work on vector types

Replace m_ConstantInt with m_APInt to match uniform (no-undef) vector remainder amounts.

2 years ago[MLIR][Presburger] refactor subtraction to be non-recursive
Arjun P [Thu, 7 Apr 2022 13:41:04 +0000 (14:41 +0100)]
[MLIR][Presburger] refactor subtraction to be non-recursive

Subtraction was previously implemented recursively. This refactors it to be
non-recursive to avoid issues with potential stack overflows.

Reviewed By: Groverkss

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

2 years ago[libc++] Add back-deployment testing on arm64 macs
Louis Dionne [Mon, 4 Apr 2022 21:53:31 +0000 (17:53 -0400)]
[libc++] Add back-deployment testing on arm64 macs

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

2 years agoAdd missing template keywords
Alexey Bataev [Thu, 7 Apr 2022 13:18:17 +0000 (06:18 -0700)]
Add missing template keywords

GCC 14 warns about these.

Reviewed By: ABataev

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

2 years agoRevert "Reland "[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON"""
Nico Weber [Thu, 7 Apr 2022 14:06:45 +0000 (10:06 -0400)]
Revert "Reland "[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON"""

This reverts commit 2aca33baf15926afe2520a06b1427a9894226fd2.
Broke tests on several bots, see comments on https://reviews.llvm.org/D120305

2 years ago[AMDGPU][MC][GFX10] Added syntactic sugar for s_waitcnt_depctr operand
Dmitry Preobrazhensky [Thu, 7 Apr 2022 14:02:50 +0000 (17:02 +0300)]
[AMDGPU][MC][GFX10] Added syntactic sugar for s_waitcnt_depctr operand

Added the following helpers:

    depctr_hold_cnt(...)
    depctr_sa_sdst(...)
    depctr_va_vdst(...)
    depctr_va_sdst(...)
    depctr_va_ssrc(...)
    depctr_va_vcc(...)
    depctr_vm_vsrc(...)

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

2 years ago[InstCombine] Regenerate and(srem(X,Pow2),C) test and add vector coverage
Simon Pilgrim [Thu, 7 Apr 2022 13:58:39 +0000 (14:58 +0100)]
[InstCombine] Regenerate and(srem(X,Pow2),C) test and add vector coverage

2 years agoremove dead code in parseRegisterList checking for ARM::RA_AUTH_CODE
Ties Stuij [Thu, 7 Apr 2022 13:35:30 +0000 (14:35 +0100)]
remove dead code in parseRegisterList checking for ARM::RA_AUTH_CODE

Reviewed By: RKSimon

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

2 years ago[InstCombine] SimplifyDemandedUseBits - add TODO to remove shl node if we only demand...
Simon Pilgrim [Thu, 7 Apr 2022 13:35:11 +0000 (14:35 +0100)]
[InstCombine] SimplifyDemandedUseBits - add TODO to remove shl node if we only demand known sign bits of the shift source

Similar to what we already perform for ashr/lshr

2 years ago[InstCombine] SimplifyDemandedUseBits - remove lshr node if we only demand known...
Simon Pilgrim [Thu, 7 Apr 2022 13:33:31 +0000 (14:33 +0100)]
[InstCombine] SimplifyDemandedUseBits - remove lshr node if we only demand known sign bit

This is a lshr equivalent to D122340 - if we don't demand any of the additional sign bits introduced by the ashr, the lshr can be treated as an ashr and we can remove the shift entirely if we only demand already known sign bits.

Another step towards PR21929

https://alive2.llvm.org/ce/z/6f3kjq

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

2 years ago[gn build] Port 1306b1025c50
LLVM GN Syncbot [Thu, 7 Apr 2022 13:18:45 +0000 (13:18 +0000)]
[gn build] Port 1306b1025c50

2 years ago[libc++][ranges] Implement ranges::count{, _if}
Nikolas Klauser [Thu, 7 Apr 2022 11:02:02 +0000 (13:02 +0200)]
[libc++][ranges] Implement ranges::count{, _if}

Reviewed By: var-const, Mordante, ldionne, #libc

Spies: tcanens, libcxx-commits, mgorny

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

2 years ago[lld-macho][nfc] Factor out findSymbolAtOffset
Jez Ng [Thu, 7 Apr 2022 13:05:33 +0000 (09:05 -0400)]
[lld-macho][nfc] Factor out findSymbolAtOffset

Our compact unwind handling code currently has some logic to locate a
symbol at a given offset in an InputSection. The EH frame code will need
to do something similar, so let's factor out the code.

Reviewed By: #lld-macho, thakis

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

2 years agoFix MSVC "not all control paths return a value" warning
Simon Pilgrim [Thu, 7 Apr 2022 13:01:06 +0000 (14:01 +0100)]
Fix MSVC "not all control paths return a value" warning

2 years ago[X86] Ensure ZN3Tuning inherits from ZN2Tuning instead of ZNTuning
Simon Pilgrim [Thu, 7 Apr 2022 12:38:21 +0000 (13:38 +0100)]
[X86] Ensure ZN3Tuning inherits from ZN2Tuning instead of ZNTuning

At the moment ZN2Tuning is just a copy of ZNTuning, but we should try to keep a clean inheritance.

2 years ago[X86] Add test case for PR44795
Simon Pilgrim [Thu, 7 Apr 2022 12:36:37 +0000 (13:36 +0100)]
[X86] Add test case for PR44795

2 years ago[clang] Verify internal entity module mangling
Nathan Sidwell [Wed, 6 Apr 2022 14:24:06 +0000 (07:24 -0700)]
[clang] Verify internal entity module mangling

Internal symbol mangling is implementation-defined.  We do not mangle
any module attachment, and this adds a test to verify that.

Reviewed By: dblaikie

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

2 years agoFix warnings when `-Wdeprecated-enum-enum-conversion` is enabled
Antonio Frighetto [Thu, 7 Apr 2022 12:20:54 +0000 (08:20 -0400)]
Fix warnings when `-Wdeprecated-enum-enum-conversion` is enabled

clang may throw the following warning:
include/clang/AST/DeclarationName.h:210:52: error: arithmetic between
different enumeration types ('clang::DeclarationName::StoredNameKind'
and 'clang::detail::DeclarationNameExtra::ExtraKind') is deprecated
when flags -Werror,-Wdeprecated-enum-enum-conversion are on.

This adds the `addEnumValues()` helper function to STLExtras.h to hide
the details of adding enumeration values together from two different
enumerations.

2 years ago[gn build] (manually) port 3031fa88f01e
Nico Weber [Thu, 7 Apr 2022 12:15:33 +0000 (08:15 -0400)]
[gn build] (manually) port 3031fa88f01e

2 years ago[gn build] (manually) port 5390606aa963
Nico Weber [Thu, 7 Apr 2022 12:13:26 +0000 (08:13 -0400)]
[gn build] (manually) port 5390606aa963

2 years ago[lld/mac] Don't emit stabs entries for functions folded during ICF
Nico Weber [Wed, 6 Apr 2022 19:55:42 +0000 (15:55 -0400)]
[lld/mac] Don't emit stabs entries for functions folded during ICF

This matches ld64, and makes dsymutil work better with lld's output.
Fixes PR54783, see there for details.

Reduces time needed to run dsymutil on Chromium Framework from 8m30s
(which is already down from 26 min with D123218) to 6m30s and removes
many lines of "could not find object file symbol for symbol" from dsymutil output
(previously: several MB of those messages, now dsymutil is completely silent).

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

2 years ago[libc++] Remove redundant __invoke_constexpr functions
Nikolas Klauser [Wed, 6 Apr 2022 21:10:21 +0000 (23:10 +0200)]
[libc++] Remove redundant __invoke_constexpr functions

There are `constexpr` versions for the different `__invoke` functions, which seem to be identical other than begin `constexpr` since C++11 instead of being `constexpr` since C++20.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years ago[Clang] Remove redundant -no-opaque-pointers flag in test (NFC)
Nikita Popov [Thu, 7 Apr 2022 11:52:19 +0000 (13:52 +0200)]
[Clang] Remove redundant -no-opaque-pointers flag in test (NFC)

This was accidentally caught in an automated replacement. This
test is testing the -opaque-pointers flag itself, so we shouldn't
add -no-opaque-pointers here (though it doesn't hurt either).

Also drop the line testing the default, as the default is now
determined by a cmake option.

2 years ago[clang][DebugInfo] Support debug info for alias variable
Kavitha Natarajan [Mon, 7 Mar 2022 07:15:52 +0000 (12:45 +0530)]
[clang][DebugInfo] Support debug info for alias variable

clang to emit DWARF information for global alias variable as
DW_TAG_imported_declaration. This change also handles nested
(recursive) imported declarations.

Reviewed by: dblaikie, aprantl

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

2 years ago[LoongArch] Split asmstr to opcstr and opnstr in LAInst class definition. NFC
Weining Lu [Thu, 7 Apr 2022 08:07:42 +0000 (16:07 +0800)]
[LoongArch] Split asmstr to opcstr and opnstr in LAInst class definition. NFC

This change removes a lot of redundant strconcat usings.

2 years ago[bugpoint] ReduceCrashingFunctions::TestFuncs - fix dereference of null point static...
Simon Pilgrim [Thu, 7 Apr 2022 11:13:55 +0000 (12:13 +0100)]
[bugpoint] ReduceCrashingFunctions::TestFuncs - fix dereference of null point static analyzer warning

Alias.getAliaseeObject() shouldn't be null, do use dyn_cast instead of dyn_cast_or_null

Also, remove redundant `else if (!F)` test - that is always true at the point in the if-else chain

2 years agoFix grammar and punctuation across several docs; NFC
Priyansh Singh [Thu, 7 Apr 2022 11:11:11 +0000 (07:11 -0400)]
Fix grammar and punctuation across several docs; NFC

2 years ago[AMDGPU] Regenerate xor3-i1-const.ll test(NFC)
chenglin.bi [Thu, 7 Apr 2022 11:08:59 +0000 (19:08 +0800)]
[AMDGPU] Regenerate xor3-i1-const.ll test(NFC)

2 years ago[RISCV] Fix crash for section alignment with .option norvc
Luís Marques [Thu, 7 Apr 2022 11:00:41 +0000 (12:00 +0100)]
[RISCV] Fix crash for section alignment with .option norvc

The existing code wasn't getting the subtarget info from the fragment,
so the current status of RVC would be ignored. This would cause a crash
for the new test case when the target then reported it couldn't write
the requested number of code alignment bytes.

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

2 years ago[DebugInfo] Use DW_ATE_signed encoding when creating a Fortran
Chih-Ping Chen [Mon, 28 Mar 2022 13:45:19 +0000 (09:45 -0400)]
[DebugInfo] Use DW_ATE_signed encoding when creating a Fortran
array index type.

2 years ago[clangd] NFC: Fix doc typos
Kirill Bobyrev [Thu, 7 Apr 2022 10:56:56 +0000 (12:56 +0200)]
[clangd] NFC: Fix doc typos

2 years ago[Clang] Add -no-opaque-pointers to more tests (NFC)
Nikita Popov [Thu, 7 Apr 2022 10:15:37 +0000 (12:15 +0200)]
[Clang] Add -no-opaque-pointers to more tests (NFC)

This adds the flag to more tests that were not caught by the
mass-migration in 532dc62b907554b3f07f17205674aa71e76fc863.

2 years ago[CSKY] Support bitcast operation from/to double to/from two GPRs
Zi Xuan Wu [Thu, 7 Apr 2022 10:24:34 +0000 (18:24 +0800)]
[CSKY] Support bitcast operation from/to double to/from two GPRs

In soft ABI, floating num is passing in GPRs. So we need support
bitcovert from double to Hi and Lo GPRs and vice versa

2 years ago[X86] Add Issue #50412 fcmp-logic test case
Simon Pilgrim [Thu, 7 Apr 2022 10:24:56 +0000 (11:24 +0100)]
[X86] Add Issue #50412 fcmp-logic test case

2 years agoFix "result of 32-bit shift implicitly converted to 64 bits" MSVC warning. NFC.
Simon Pilgrim [Thu, 7 Apr 2022 10:19:54 +0000 (11:19 +0100)]
Fix "result of 32-bit shift implicitly converted to 64 bits" MSVC warning. NFC.

2 years ago[bazel] Port 3031fa88f0
Benjamin Kramer [Thu, 7 Apr 2022 10:14:14 +0000 (12:14 +0200)]
[bazel] Port 3031fa88f0

2 years ago[OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC)
Nikita Popov [Thu, 7 Apr 2022 10:03:55 +0000 (12:03 +0200)]
[OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC)

This adds -no-opaque-pointers to clang tests whose output will
change when opaque pointers are enabled by default. This is
intended to be part of the migration approach described in
https://discourse.llvm.org/t/enabling-opaque-pointers-by-default/61322/9.

The patch has been produced by replacing %clang_cc1 with
%clang_cc1 -no-opaque-pointers for tests that fail with opaque
pointers enabled. Worth noting that this doesn't cover all tests,
there's a remaining ~40 tests not using %clang_cc1 that will need
a followup change.

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

2 years ago[libc++][ranges] Add implicit conversion to bool test for ranges::find{, if, if_not}
Nikolas Klauser [Thu, 7 Apr 2022 10:01:49 +0000 (12:01 +0200)]
[libc++][ranges] Add implicit conversion to bool test for ranges::find{, if, if_not}

Reviewed By: ldionne, var-const, #libc

Spies: libcxx-commits

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

2 years ago[lldb] Fix building standalone LLDB on Windows.
Mehdi Chinoune [Thu, 7 Apr 2022 09:11:52 +0000 (12:11 +0300)]
[lldb] Fix building standalone LLDB on Windows.

It was broken since https://reviews.llvm.org/D110172

Reviewed By: JDevlieghere

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

2 years ago[MLIR] Standalone: Fix copy-and-paste typo (NFC)
Lorenzo Chelini [Thu, 7 Apr 2022 09:17:21 +0000 (11:17 +0200)]
[MLIR] Standalone: Fix copy-and-paste typo (NFC)

Remove duplicate statements.

2 years ago[lldb] [CMake] Disable GCC's -Wstringop-truncation warning. NFC.
Martin Storsjö [Wed, 6 Apr 2022 20:18:55 +0000 (23:18 +0300)]
[lldb] [CMake] Disable GCC's -Wstringop-truncation warning. NFC.

This warning gives false positives about lldb's correct use of
strncpy to fill fixed length fields that don't need null termination,
in lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp, like this:

    In file included from /usr/include/string.h:495,
                     from /usr/include/c++/9/cstring:42,
                     from ../include/llvm/ADT/StringRef.h:19,
                     from ../tools/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:10:
    In function ‘char* strncpy(char*, const char*, size_t)’,
        inlined from ‘lldb::offset_t CreateAllImageInfosPayload(const ProcessSP&, lldb::offset_t, lldb_private::StreamString&, lldb::SaveCoreStyle)’ at ../tools/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:6341:16:
    /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 16 equals destination size [-Wstringop-truncation]
      106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

The warning could be squelched locally with

    #pragma GCC diagnostic ignored "-Wstringop-truncation"

too, but Clang also interprets those GCC pragmas, and produces
a -Wunknown-warning-option warning instead. That could be remedied
by wrapping the pragma in an "#ifndef __clang__" - but that makes
things even more messy. Instead, just silence this warning entirely.

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

2 years ago[clang][ASTImporter] Not using consumeError at failed import of in-class initializer.
Balázs Kéri [Thu, 7 Apr 2022 08:31:09 +0000 (10:31 +0200)]
[clang][ASTImporter] Not using consumeError at failed import of in-class initializer.

The error can be returned from the function, the problem written in comment before
does not exist. The same is done already in ASTImporter at various import failures.

After a declaration is created in an `ASTNodeImporter` import function
with `GetImportedOrCreateDecl`, that function registers it with
`MapImported`. At many places import errors can happen after this
and the error is returned. The same can be done in the place where
the in-class initializer is imported.

Reviewed By: martong

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

2 years ago[clang-tidy] Silence unused variable warning in release builds. NFCI.
Benjamin Kramer [Thu, 7 Apr 2022 09:00:28 +0000 (11:00 +0200)]
[clang-tidy] Silence unused variable warning in release builds. NFCI.

2 years ago[LoongArch] Improve td files indentation a little bit. NFC
Weining Lu [Thu, 7 Apr 2022 07:16:59 +0000 (15:16 +0800)]
[LoongArch] Improve td files indentation a little bit. NFC

2 years ago[RISCV] Select unmasked integer setcc insts via ISel post-process
Fraser Cormack [Wed, 6 Apr 2022 13:26:20 +0000 (14:26 +0100)]
[RISCV] Select unmasked integer setcc insts via ISel post-process

This patch has no effect on the generated code, whilst mitigating the
increase in ISel table size caused by the recent addition of masked
patterns.

I aim to do the same for floating-point patterns once D123051 lands,
giving us a reason to use masked floating-point patterns.

Reviewed By: arcbbb

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

2 years ago[bazel] Port 5390606aa963
Benjamin Kramer [Thu, 7 Apr 2022 08:40:55 +0000 (10:40 +0200)]
[bazel] Port 5390606aa963

2 years agoTransforms: Remove unused include
Benjamin Kramer [Thu, 7 Apr 2022 08:40:28 +0000 (10:40 +0200)]
Transforms: Remove unused include

Utils can't depend on Scalar transforms.

2 years ago[VPlan] Use vector.body as header name in VPlan native path.
Florian Hahn [Thu, 7 Apr 2022 08:31:12 +0000 (10:31 +0200)]
[VPlan] Use vector.body as header name in VPlan native path.

This brings the VPlan block naming in line with the naming of the
generated basic blocks.

2 years ago[RISCV][VP] Add basic RVV codegen for vp.fcmp
Fraser Cormack [Mon, 4 Apr 2022 17:19:11 +0000 (18:19 +0100)]
[RISCV][VP] Add basic RVV codegen for vp.fcmp

This patch adds the necessary infrastructure to lower vp.fcmp via
ISD::VP_SETCC to RVV instructions.

Most notably this patch adds cond-code legalization for VP_SETCC,
reusing the existing TargetLowering::LegalizeSetCCCondCode by passing in
additional SDValue parameters for the Mask and EVL. This method then
uses VP operations to legalize the condcode.

There is still a general lack of canonicalization on VP_SETCC as opposed
to SETCC which results in worse code than is theoretically possible.

Reviewed By: craig.topper

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