platform/upstream/llvm.git
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

2 years ago[lld] Remove support for legacy pass manager
Nikita Popov [Wed, 6 Apr 2022 14:21:20 +0000 (16:21 +0200)]
[lld] Remove support for legacy pass manager

This removes options for performing LTO with the legacy pass
manager in LLD. Options that explicitly enable the new pass manager
are retained as no-ops.

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

2 years ago[OpaquePtr][Clang] Add CLANG_ENABLE_OPAQUE_POINTERS cmake option
Nikita Popov [Tue, 5 Apr 2022 12:45:51 +0000 (14:45 +0200)]
[OpaquePtr][Clang] Add CLANG_ENABLE_OPAQUE_POINTERS cmake option

This option controls whether -opaque-pointers or -no-opaque-pointers
is the default. Once opaque pointers are enabled by default, this
will provide a simple way to temporarily opt-out of the change.

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

2 years ago[mlir][CSE] Remove duplicated operations with MemRead side-effect
Valentin Clement [Thu, 7 Apr 2022 08:06:50 +0000 (10:06 +0200)]
[mlir][CSE] Remove duplicated operations with MemRead side-effect

This patch enhances the CSE pass to deal with simple cases of duplicated
operations with MemoryEffects.

It allows the CSE pass to remove safely duplicate operations with the
MemoryEffects::Read that have no other side-effecting operations in
between. Other MemoryEffects::Read operation are allowed.

The use case is pretty simple so far so we can build on top of it to add
more features.

This patch is also meant to avoid a dedicated CSE pass in FIR and was
brought together afetr discussion on https://reviews.llvm.org/D112711.
It does not currently cover the full range of use cases described in
https://reviews.llvm.org/D112711 but the idea is to gradually enhance
the MLIR CSE pass to handle common use cases that can be used by
other dialects.

This patch takes advantage of the new CSE capabilities in Fir.

Reviewed By: mehdi_amini, rriddle, schweitz

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

2 years ago[x86] Improve select lowering for smin(x, 0) & smax(x, 0)
Wei Xiao [Tue, 5 Apr 2022 08:00:46 +0000 (16:00 +0800)]
[x86] Improve select lowering for smin(x, 0) & smax(x, 0)

smin(x, 0):
  (select (x < 0), x, 0) -> ((x >> (size_in_bits(x)-1))) & x

smax(x, 0):
  (select (x > 0), x, 0) -> (~(x >> (size_in_bits(x)-1))) & x
  The comparison is testing for a positive value, we have to invert the sign
  bit mask, so only do that transform if the target has a bitwise 'and not'
  instruction (the invert is free).

The transform is performed only when CMP has a single user to avoid
increasing total instruction number.

https://alive2.llvm.org/ce/z/euUnNm
https://alive2.llvm.org/ce/z/37339J

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

2 years ago[LoopSink] Use MemorySSA with legacy pass manager
Nikita Popov [Wed, 6 Apr 2022 12:39:20 +0000 (14:39 +0200)]
[LoopSink] Use MemorySSA with legacy pass manager

LoopSink with the legacy pass manager still uses AST, because we
can't compute MemorySSA conditionally. I think now that the legacy
pass manager will be removed soon(TM) we don't need to care about
compile-time impact here anymore. Additionally, since MemorySSA is
no longer eagerly optimized, the impact is actually not that high
anymore (~0.2% geomean regression on CTMark).

This just makes legacy PM and new PM behavior line up -- as a
followup I'll drop these options entirely and make MemorySSA use
mandatory.

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

2 years ago[clang-tidy] bugprone-signal-handler: Message improvement and code refactoring.
Balázs Kéri [Thu, 7 Apr 2022 07:00:01 +0000 (09:00 +0200)]
[clang-tidy] bugprone-signal-handler: Message improvement and code refactoring.

Another change of the code design.
Code simplified again, now there is a single place to check
a handler function and less functions for bug report emitting.
More details are added to the bug report messages.

Reviewed By: whisperity

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

2 years ago[LLD][COFF] Fix TypeServerSource matcher with more than one collision
Tobias Hieta [Wed, 6 Apr 2022 15:06:37 +0000 (17:06 +0200)]
[LLD][COFF] Fix TypeServerSource matcher with more than one collision

Follow-up from 98bc304e9faded44f1d8988ffa4c5d8b50c759ec - while that
commit fixed when you had two PDBs colliding on the same Guid it didn't
fix the case where you had more than two PDBs using the same Guid.

This commit fixes that and also tests much more carefully that all
the types are correct no matter the order.

Reviewed By: aganea, saudi

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

2 years ago[AMDGPU] Fix test difference in debug and release. NFC.
Stanislav Mekhanoshin [Thu, 7 Apr 2022 06:47:14 +0000 (23:47 -0700)]
[AMDGPU] Fix test difference in debug and release. NFC.

Added -disable-gisel-legality-check to couple GlobalISel tests
which have not legal instructions to avoid difference in
debug and release builds.

2 years agoCorrect debugserver to write xmm/ymm/zmm reg values
Jason Molenda [Thu, 7 Apr 2022 06:33:19 +0000 (23:33 -0700)]
Correct debugserver to write xmm/ymm/zmm reg values

debugserver does not call thread_set_state when changing xmm/ymm/zmm
register values, so the register contents are never updated.  Fix
that.  Mark the shell tests which xfail'ed these tests on darwin systems
to xfail them when the system debugserver, they will pass when using
the in-tree debugserver.  When this makes it into the installed
system debugservers, we'll remove the xfails.

Differential Revision: https://reviews.llvm.org/D123269
rdar://91258333
rdar://31294382

2 years ago[RISCV] Add CMOV isel pattern for (select (setgt X, Imm), Y, Z)
Liqin Weng [Thu, 7 Apr 2022 05:45:06 +0000 (05:45 +0000)]
[RISCV] Add CMOV isel pattern for (select (setgt X, Imm), Y, Z)

Reviewed By: craig.topper

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

2 years ago[CMake][Fuchsia] Include bolt
Petr Hosek [Thu, 7 Apr 2022 00:37:23 +0000 (17:37 -0700)]
[CMake][Fuchsia] Include bolt

We would like to use bolt with Fuchsia toolchain.

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

2 years ago[ELF] Ignore --no-add-needed
Fangrui Song [Thu, 7 Apr 2022 05:41:27 +0000 (22:41 -0700)]
[ELF] Ignore --no-add-needed

It is used by a few projects like keepassxc and mumble.
Also see https://bugzilla.redhat.com/show_bug.cgi?id=2070813 that Fedora gcc has
an (unneeded) gcc12-no-add-needed.patch which adds --no-add-needed, although
--[no-]add-needed has been deprecated in GNU ld since 2009. Adding this has low
costs and makes several folks happy.

This basically restores 8f13bef575c97db4d6c146c3bb647ac9e73a9248.

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

2 years ago[Driver][test] Fix csky-toolchain.c to be CLANG_DEFAULT_PIE_ON_LINUX agnostic
Fangrui Song [Thu, 7 Apr 2022 04:14:24 +0000 (21:14 -0700)]
[Driver][test] Fix csky-toolchain.c to be CLANG_DEFAULT_PIE_ON_LINUX agnostic

2 years ago[lld-macho][nfc] Rearrange order of statements to clarify data dependencies
Jez Ng [Thu, 7 Apr 2022 04:00:41 +0000 (00:00 -0400)]
[lld-macho][nfc] Rearrange order of statements to clarify data dependencies

2 years ago[Driver][test] Fix csky-toolchain.c to be CLANG_DEFAULT_PIE_ON_LINUX agnostic
Fangrui Song [Thu, 7 Apr 2022 03:41:39 +0000 (20:41 -0700)]
[Driver][test] Fix csky-toolchain.c to be CLANG_DEFAULT_PIE_ON_LINUX agnostic

2 years agoReland "[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON""
Fangrui Song [Thu, 7 Apr 2022 03:19:07 +0000 (20:19 -0700)]
Reland "[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON""

(The upgrade of the ppc64le bot and D121257 have fixed compiler-rt failures. Tested by nemanjai.)

Default the option introduced in D113372 to ON to match all(?) major Linux
distros. This matches GCC and improves consistency with Android and linux-musl
which always default to PIE.
Note: CLANG_DEFAULT_PIE_ON_LINUX may be removed in the future.

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

2 years ago[CSKY] Fix some Clang warnings. NFC
Fangrui Song [Thu, 7 Apr 2022 03:09:32 +0000 (20:09 -0700)]
[CSKY] Fix some Clang warnings. NFC

Reviewed By: zixuan-wu

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

2 years agoLink aganist clangSema to fix broken build.
Jun Zhang [Thu, 7 Apr 2022 02:45:56 +0000 (10:45 +0800)]
Link aganist clangSema to fix broken build.

Signed-off-by: Jun Zhang <jun@junz.org>
2 years agoAMDGPU: Handle private atomics
Matt Arsenault [Tue, 5 Apr 2022 22:42:39 +0000 (18:42 -0400)]
AMDGPU: Handle private atomics

Use new NotAtomic expansion to turn these into the equivalent
non-atomic operations. Independent lanes cannot access the private
memory of other lanes, so there's no possibility for synchronization.

These don't really appear directly in user code, but
InferAddressSpaces can make these appear after optimizations.

Fixes issues 54693 and 54274.

2 years agoAtomicExpand: Add NotAtomic lowering strategy
Matt Arsenault [Tue, 5 Apr 2022 20:38:19 +0000 (16:38 -0400)]
AtomicExpand: Add NotAtomic lowering strategy

Currently LowerAtomics exists as a separate pass which blindly
replaces all atomics. Add a new lowering strategy option to eliminate
the atomics which the target can control on a per-instruction level.

2 years agoAtomicExpand: Change return type for shouldExpandAtomicStoreInIR
Matt Arsenault [Tue, 5 Apr 2022 21:48:50 +0000 (17:48 -0400)]
AtomicExpand: Change return type for shouldExpandAtomicStoreInIR

Use the same enum as the other atomic instructions for consistency, in
preparation for addition of another strategy.

Introduce a new "Expand" option, since the store expansion does not
use cmpxchg. Alternatively, the existing CmpXChg strategy could be
renamed to Expand.

2 years ago[RISCV] Supplement patterns for vnsrl.wx/vnsra.wx when splat shift is sext or zext
Lian Wang [Thu, 31 Mar 2022 07:07:42 +0000 (07:07 +0000)]
[RISCV] Supplement patterns for vnsrl.wx/vnsra.wx when splat shift is sext or zext

Reviewed By: craig.topper

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

2 years ago[clang-format][docs] Fix incorrect 'clang-format 11' option markers
Krystian Kuzniarek [Thu, 7 Apr 2022 01:33:18 +0000 (18:33 -0700)]
[clang-format][docs] Fix incorrect 'clang-format 11' option markers

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

2 years ago[mlir:Parser][NFC] Replace SSAUseInfo with OpAsmParser::UnresolvedOperand
River Riddle [Thu, 7 Apr 2022 01:24:31 +0000 (18:24 -0700)]
[mlir:Parser][NFC] Replace SSAUseInfo with OpAsmParser::UnresolvedOperand

These are functionally identical, and merging the two removes the number of
redundant conversions within the parser.

2 years ago[AMDGPU] Check SI LDS offset bug in the allowsMisalignedMemoryAccesses
Stanislav Mekhanoshin [Wed, 6 Apr 2022 23:02:46 +0000 (16:02 -0700)]
[AMDGPU] Check SI LDS offset bug in the allowsMisalignedMemoryAccesses

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

2 years ago[libomptarget] Add device RTL to regression test dependencies.
Michael Kruse [Thu, 7 Apr 2022 00:20:07 +0000 (19:20 -0500)]
[libomptarget] Add device RTL to regression test dependencies.

In a clean build directory, `check-openmp` or `check-libomptarget` will fail because of missing device RTL .bc files. Ensure that the new targets new custom targets `omptarget.devicertl.nvptx` and `omptarget.devicertl.amdgpu` (corresponding to the plugin rtl targets `omptarget.rtl.cuda`, respectively `omptarget.rlt.amdgpu` ) are dependencies of the regression tests.

Reviewed By: JonChesterfield

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

2 years ago[gn build] Port 39f156863392
LLVM GN Syncbot [Thu, 7 Apr 2022 00:55:44 +0000 (00:55 +0000)]
[gn build] Port 39f156863392

2 years agoTransforms: Split LowerAtomics into separate Utils and pass
Matt Arsenault [Tue, 5 Apr 2022 20:37:58 +0000 (16:37 -0400)]
Transforms: Split LowerAtomics into separate Utils and pass

This will allow code sharing from AtomicExpandPass. Not entirely sure
why these exist as separate passes though.

2 years ago[mlir:PDL] Expand how native constraint/rewrite functions can be defined
River Riddle [Sat, 19 Mar 2022 22:08:09 +0000 (15:08 -0700)]
[mlir:PDL] Expand how native constraint/rewrite functions can be defined

This commit refactors the expected form of native constraint and rewrite
functions, and greatly reduces the necessary user complexity required when
defining a native function. Namely, this commit adds in automatic processing
of the necessary PDLValue glue code, and allows for users to define
constraint/rewrite functions using the C++ types that they actually want to
use.

As an example, lets see a simple example rewrite defined today:

```
static void rewriteFn(PatternRewriter &rewriter, PDLResultList &results,
                      ArrayRef<PDLValue> args) {
  ValueRange operandValues = args[0].cast<ValueRange>();
  TypeRange typeValues = args[1].cast<TypeRange>();
  ...
  // Create an operation at some point and pass it back to PDL.
  Operation *op = rewriter.create<SomeOp>(...);
  results.push_back(op);
}
```

After this commit, that same rewrite could be defined as:

```
static Operation *rewriteFn(PatternRewriter &rewriter ValueRange operandValues,
                            TypeRange typeValues) {
  ...
  // Create an operation at some point and pass it back to PDL.
  return rewriter.create<SomeOp>(...);
}
```

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

2 years ago[CMake][compiler-rt] Include the missing variables
Petr Hosek [Thu, 7 Apr 2022 00:40:29 +0000 (17:40 -0700)]
[CMake][compiler-rt] Include the missing variables

This includes the missing variables as pointed out in
https://reviews.llvm.org/rGb0e2ffe151c3

2 years ago[mlir][sparse] replace stack-based access pattern with dyn-alloc
Aart Bik [Wed, 6 Apr 2022 20:22:08 +0000 (13:22 -0700)]
[mlir][sparse] replace stack-based access pattern with dyn-alloc

Rationale:
Allocating the temporary buffers for access pattern expansion on the stack
(using alloca) is a bit too agressive, since it easily runs out of stack space
for large enveloping tensor dimensions. This revision changes the dynamic
allocation of these buffers with explicit alloc/dealloc pairs.

Reviewed By: bixia, wrengr

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

2 years ago[MIPS] Initial support for MIPS-I load delay slots
Simon Dardis [Wed, 6 Apr 2022 23:31:33 +0000 (00:31 +0100)]
[MIPS] Initial support for MIPS-I load delay slots

LLVM so far has only supported the MIPS-II and above architectures. MIPS-II is pretty close to MIPS-I, the major difference
being that "load" instructions always take one extra instruction slot to propogate to registers. This patch adds support for
MIPS-I by adding hazard handling for load delay slots, alongside MIPSR6 forbidden slots and FPU slots, inserting a NOP
instruction between a load and any instruction immediately following that reads the load's destination register. I also
included a simple regression test. Since no existing tests target MIPS-I, those all still pass.

Issue ref: https://github.com/simias/psx-sdk-rs/issues/1

I also tested by building a simple demo app with Clang and running it in an emulator.

Patch by: @impiaaa

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

2 years ago[AMDGPU] Regenerate global isel lds ops test checks. NFC.
Stanislav Mekhanoshin [Wed, 6 Apr 2022 23:14:08 +0000 (16:14 -0700)]
[AMDGPU] Regenerate global isel lds ops test checks. NFC.

2 years ago[libc++abi] Remove XFAIL on arm64
Louis Dionne [Wed, 6 Apr 2022 23:01:39 +0000 (19:01 -0400)]
[libc++abi] Remove XFAIL on arm64

The underlying TLS destruction order bug has been fixed in the OS. This
would technically still fail when running on top of macOS < 12, however
we don't have a good way of encoding that using Lit features. Indeed,
the existing target=<FOO> Lit feature encodes the deployment target,
not the actual runtime system that the tests are being run on.

If this test starts failing on your machine after this patch, upgrading
to macOS 12 should solve the problem.

2 years ago[MSSA] Print memory phis when inspecting walker.
Alina Sbirlea [Wed, 6 Apr 2022 21:22:52 +0000 (14:22 -0700)]
[MSSA] Print memory phis when inspecting walker.

This makes the MemorySSA and MemorySSA Walker printers consistent.
Invokation `-print<memoryssa-walker>` should also have the MemoryPhis.

2 years agoRevert f7381a795ab235d34c94eaf01dc880eb5b89619d
Alina Sbirlea [Tue, 29 Mar 2022 23:05:08 +0000 (16:05 -0700)]
Revert f7381a795ab235d34c94eaf01dc880eb5b89619d

Roll-forward 29fada4a3d3db309f11f7fa7a0c61cd4021e9947.
Issue triggered was due to UB.

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

2 years ago[mips] Remove stale comment (NFC)
Simon Dardis [Wed, 6 Apr 2022 22:18:26 +0000 (23:18 +0100)]
[mips] Remove stale comment (NFC)

Test commit for my current email address.

2 years ago[Darwin][ASan] Fix "interceptor working?" check for DriverKit platform
Blue Gaston [Wed, 6 Apr 2022 22:47:18 +0000 (15:47 -0700)]
[Darwin][ASan] Fix "interceptor working?" check for DriverKit platform

The previous check for interceptors used `pthread_create()` which is not
available on DriverKit.  We need an intercepted symbol that satisfies
the following constraints:

- Symbol is available in DriverKit
- Symbol is provided by simulator runtime dylibs (`dlsym()` fails to
  look up host-provided symbols)

`puts()` satisfies all of the above constraints.

rdar://87895539

Reviewed By: yln

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

2 years agogn build: Fix some tests for host_os to instead check current_os.
Peter Collingbourne [Wed, 6 Apr 2022 22:40:09 +0000 (15:40 -0700)]
gn build: Fix some tests for host_os to instead check current_os.

Should fix Windows build:
http://45.33.8.238/win/55809/step_4.txt

2 years ago[pseudo] Include missing `count` in test deps.
Sam McCall [Wed, 6 Apr 2022 22:13:59 +0000 (00:13 +0200)]
[pseudo] Include missing `count` in test deps.

We don't use this for testing, but one of the lit python modules requires it :-\

After this, check-clang-pseudo passes with a clean build tree.

2 years ago[AArch64][AMDGPU][WebAssembly] Use static_cast instead of a reinterpret_cast to downc...
Craig Topper [Wed, 6 Apr 2022 21:50:49 +0000 (14:50 -0700)]
[AArch64][AMDGPU][WebAssembly] Use static_cast instead of a reinterpret_cast to downcast in parseMachineFunctionInfo. NFC

static_cast is a little safer here since the compiler will
ensure we're casting to a class derived from
yaml::MachineFunctionInfo.

I believe this first appeared on AMDGPU and was copied to the
other two targets.

Spotted when it was being copied to RISCV in D123178.

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

2 years ago[lldb] Remove duplicate "warning:"
Jonas Devlieghere [Wed, 6 Apr 2022 22:04:02 +0000 (15:04 -0700)]
[lldb] Remove duplicate "warning:"

Remove "warning:" from the warning message itself. The default event
handler is already emitting the appropriate prefix.

2 years agoRemove unused FileEntry::operator<. NFC
Sam McCall [Wed, 6 Apr 2022 21:39:17 +0000 (23:39 +0200)]
Remove unused FileEntry::operator<. NFC

2 years ago[demangler] Node precision dumper
Nathan Sidwell [Wed, 30 Mar 2022 14:21:42 +0000 (07:21 -0700)]
[demangler] Node precision dumper

Add contents to the demangler node dumper's print(Prec) functions.

Reviewed By: dblaikie

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

2 years agoReland "gn build: Fix support for building the builtins for baremetal."
Peter Collingbourne [Fri, 1 Apr 2022 03:34:05 +0000 (20:34 -0700)]
Reland "gn build: Fix support for building the builtins for baremetal."

Our support for building for baremetal was conditional on a default
off arg and would have failed to build if you had somehow arranged
to pass the correct --target flag; presumably nobody noticed because
nobody was turning it on. A better approach is to model baremetal
as a separate "OS" called "baremetal" and build it in the same way
as we cross-compile for other targets. That's what this patch does.
I only hooked up the arm64 target but others can be added.

Relanding after fixing Mac build breakage in D123244.

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

2 years agogn build: Use target OS to control whether to use/depend on llvm-ar.
Peter Collingbourne [Wed, 6 Apr 2022 19:46:05 +0000 (12:46 -0700)]
gn build: Use target OS to control whether to use/depend on llvm-ar.

When cross-compiling from Mac to non-Mac, we need to use the just-built
llvm-ar instead of libtool. We're currently doing the right thing
when determining which archiver command to use, but the path to ar
and the toolchain dependencies were being set based on the host OS
(current_os evaluated in host OS toolchain), instead of the target
OS. Fix the problem by looking up current_os inside toolchain_args.

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

2 years ago[NFC][trace][intelpt] Remove unneeded import
Walter Erquinigo [Wed, 6 Apr 2022 19:24:50 +0000 (12:24 -0700)]
[NFC][trace][intelpt] Remove unneeded import

Remove an unnecessary import to silence a compiler warning.

2 years ago[MLIR] Add block detach func to CAPI and use it in Python bindings
John Demme [Wed, 6 Apr 2022 17:06:30 +0000 (10:06 -0700)]
[MLIR] Add block detach func to CAPI and use it in Python bindings

Adds `mlirBlockDetach` to the CAPI to remove a block from its parent
region. Use it in the Python bindings to implement
`Block.append_to(region)`.

Reviewed By: mehdi_amini

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

2 years ago[demangler][NFC] Rename SwapAndRestore to ScopedOverride
Nathan Sidwell [Mon, 28 Feb 2022 18:18:14 +0000 (10:18 -0800)]
[demangler][NFC] Rename SwapAndRestore to ScopedOverride

The demangler has a utility class 'SwapAndRestore'. That name is
confusing. It's not swapping anything, and the restore part happens at
the object's destruction. What it's actually doing is allowing a
override of some value that is dynamically accessible within the
lifetime of a lexical scope. Thus rename it to ScopedOverride, and
tweak it's member variable names.

Reviewed By: dblaikie

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

2 years ago[libcxx] [test] Stop defining LIBCXX-WINDOWS-FIXME
Martin Storsjö [Fri, 25 Feb 2022 10:03:34 +0000 (12:03 +0200)]
[libcxx] [test] Stop defining LIBCXX-WINDOWS-FIXME

There are no such markings left - all of them have been fixed or
analyzed.

This closes llvm.org/PR32730 (github issue #32077).

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

2 years ago[Support] [BLAKE3] Fix building for Cygwin
Martin Storsjö [Wed, 6 Apr 2022 07:13:31 +0000 (10:13 +0300)]
[Support] [BLAKE3] Fix building for Cygwin

Use the windows-gnu assembly files on x86_64 Cygwin too.

This fixes https://github.com/llvm/llvm-project/issues/54685.

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

2 years ago[AArch64] Fix the upper limit for folded address offsets for COFF
Martin Storsjö [Tue, 5 Apr 2022 21:44:38 +0000 (00:44 +0300)]
[AArch64] Fix the upper limit for folded address offsets for COFF

In COFF, the immediates in IMAGE_REL_ARM64_PAGEBASE_REL21 relocations
are limited to 21 bit signed, i.e. the offset has to be less than
(1 << 20). The previous limit did intend to cover for this case, but
had missed that the 21 bit field was signed.

This fixes issue https://github.com/llvm/llvm-project/issues/54753.

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

2 years ago[lldb] Silence GCC/glibc warnings about ignoring the return value of write(). NFC.
Martin Storsjö [Wed, 6 Apr 2022 11:11:49 +0000 (14:11 +0300)]
[lldb] Silence GCC/glibc warnings about ignoring the return value of write(). NFC.

This matches how another similar warning is silenced in
Host/posix/ProcessLauncherPosixFork.cpp.

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

2 years ago[lldb] Silence GCC warnings about missing returns after fully covered switches. NFC.
Martin Storsjö [Wed, 6 Apr 2022 11:09:22 +0000 (14:09 +0300)]
[lldb] Silence GCC warnings about missing returns after fully covered switches. NFC.

This silences warnings like this:

lldb/source/Core/DebuggerEvents.cpp: In member function ‘llvm::StringRef lldb_private::DiagnosticEventData::GetPrefix() const’:
lldb/source/Core/DebuggerEvents.cpp:55:1: warning: control reaches end of non-void function [-Wreturn-type]
   55 | }

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

2 years ago[lldb] Fix detecting warning options for GCC
Martin Storsjö [Wed, 6 Apr 2022 10:45:20 +0000 (13:45 +0300)]
[lldb] Fix detecting warning options for GCC

If testing for a warning option like -Wno-<foo> with GCC, GCC won't
print any diagnostic at all, leading to the options being accepted
incorrectly. However later, if compiling a file that actually prints
another warning, GCC will also print warnings about these -Wno-<foo>
options being unrecognized.

This avoids warning spam like this, for every lldb source file that
produces build warnings with GCC:

    At global scope:
    cc1plus: warning: unrecognized command line option ‘-Wno-vla-extension’
    cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-register’

This matches how such warning options are detected and added in
llvm/cmake/modules/HandleLLVMOptions.cmake, e.g. like this:

    check_cxx_compiler_flag("-Wclass-memaccess" CXX_SUPPORTS_CLASS_MEMACCESS_FLAG)
    append_if(CXX_SUPPORTS_CLASS_MEMACCESS_FLAG "-Wno-class-memaccess" CMAKE_CXX_FLAGS)

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

2 years ago[gn build] Port c03d6257c58f
LLVM GN Syncbot [Wed, 6 Apr 2022 19:38:53 +0000 (19:38 +0000)]
[gn build] Port c03d6257c58f

2 years ago[pseudo] Rename DirectiveMap -> DirectiveTree. NFC
Sam McCall [Wed, 6 Apr 2022 15:48:52 +0000 (17:48 +0200)]
[pseudo] Rename DirectiveMap -> DirectiveTree. NFC

Addressing comment from previous review
https://reviews.llvm.org/D121165?id=413636#inline-1160757

2 years ago[LoopInterchange] Try to achieve the most optimal access pattern after interchange
Congzhe Cao [Wed, 6 Apr 2022 19:15:37 +0000 (15:15 -0400)]
[LoopInterchange] Try to achieve the most optimal access pattern after interchange

Motivated by pr43326 (https://bugs.llvm.org/show_bug.cgi?id=43326), where a slightly
modified case is as follows.

 void f(int e[10][10][10], int f[10][10][10]) {
   for (int a = 0; a < 10; a++)
     for (int b = 0; b < 10; b++)
       for (int c = 0; c < 10; c++)
         f[c][b][a] = e[c][b][a];
 }

The ideal optimal access pattern after running interchange is supposed to be the following

 void f(int e[10][10][10], int f[10][10][10]) {
   for (int c = 0;  c < 10; c++)
     for (int b = 0; b < 10; b++)
       for (int a = 0; a < 10; a++)
         f[c][b][a] = e[c][b][a];
 }

Currently loop interchange is limited to picking up the innermost loop and finding an order
that is locally optimal for it. However, the pass failed to produce the globally optimal
loop access order. For more complex examples what we get could be quite far from the
globally optimal ordering.

What is proposed in this patch is to do a "bubble-sort" fashion when doing interchange.
By comparing neighbors in `LoopList` in each iteration, we would be able to move each loop
onto a most appropriate place, hence this is an approach that tries to achieve the
globally optimal ordering.

The motivating example above is added as a test case.

Reviewed By: Meinersbur

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

2 years ago[PS4] Fix a buggy cast
Paul Robinson [Wed, 6 Apr 2022 19:28:36 +0000 (12:28 -0700)]
[PS4] Fix a buggy cast

2 years ago[trace][intelpt] Introduce instruction Ids
Walter Erquinigo [Tue, 22 Mar 2022 16:18:53 +0000 (09:18 -0700)]
[trace][intelpt] Introduce instruction Ids

In order to support quick arbitrary access to instructions in the trace, we need
each instruction to have an id. It could be an index or any other value that the
trace plugin defines.

This will be useful for reverse debugging or for creating callstacks, as each
frame will need an instruction id associated with them.

I've updated the `thread trace dump instructions` command accordingly. It now
prints the instruction id instead of relative offset. I've also added a new --id
argument that allows starting the dump from an arbitrary position.

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

2 years ago[RISCV] Merge rv32/rv64 test files. NFC
Craig Topper [Wed, 6 Apr 2022 19:13:26 +0000 (12:13 -0700)]
[RISCV] Merge rv32/rv64 test files. NFC

2 years agoRevert "gn build: Fix support for building the builtins for baremetal."
Peter Collingbourne [Wed, 6 Apr 2022 19:14:47 +0000 (12:14 -0700)]
Revert "gn build: Fix support for building the builtins for baremetal."

This reverts commit b02b9b3dacc8a4afa96e8990f2dda8bc9b959f78.

Broke Mac build: http://45.33.8.238/macm1/32578/step_4.txt

2 years ago[clang][extract-api] Add Objective-C Category support
Zixu Wang [Thu, 31 Mar 2022 00:21:33 +0000 (17:21 -0700)]
[clang][extract-api] Add Objective-C Category support

Add (partial) support for Objective-C category records in ExtractAPI.
The current ExtractAPI collects everything for an Objective-C category,
but not fully serialized in the SymbolGraphSerializer. Categories
extending external interfaces are disgarded during serialization, and
categories extending known interfaces are merged (all members surfaced)
into the interfaces.

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

2 years agoDebugInfo: Make the simplified template names prefix more unique
David Blaikie [Wed, 6 Apr 2022 18:25:16 +0000 (18:25 +0000)]
DebugInfo: Make the simplified template names prefix more unique

2 years ago[gn build] Port 9fc45ca00a19
LLVM GN Syncbot [Wed, 6 Apr 2022 18:21:38 +0000 (18:21 +0000)]
[gn build] Port 9fc45ca00a19

2 years ago[BOLT][test] Fix X86 tests
Vladislav Khmelevsky [Tue, 5 Apr 2022 15:41:17 +0000 (18:41 +0300)]
[BOLT][test] Fix X86 tests

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

2 years ago[clang][extract-api] Add support for typedefs
Daniel Grumberg [Fri, 1 Apr 2022 18:14:23 +0000 (19:14 +0100)]
[clang][extract-api] Add support for typedefs

Typedef records consist of the symbol associated with the underlying
TypedefDecl and a SymbolReference to the underlying type. Additionally
typedefs for anonymous TagTypes use the typedef'd name as the symbol
name in their respective records and USRs. As a result the declaration
fragments for the anonymous TagType are those for the associated
typedef. This means that when the user is defining a typedef to a
typedef to a anonymous type, we use a reference the anonymous TagType
itself and do not emit the typedef to the anonymous type in the
generated symbol graph, including in the type destination of further
typedef symbol records.

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