platform/upstream/llvm.git
21 months ago[LLDB] Make instruction emulation context type private
David Spickett [Mon, 1 Aug 2022 10:17:02 +0000 (10:17 +0000)]
[LLDB] Make instruction emulation context type private

This is the first step to being able to handle non
trivial types in the union.

info_type effects the lifetime of the objects in the union,
so making it private means we know you have to call one of the
Set<...> functions to change it.

Reviewed By: clayborg

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

21 months ago[clang] Update ReleaseNotes about a crash fix (Issue 53628)
Dmitry Polukhin [Sat, 17 Sep 2022 15:30:30 +0000 (08:30 -0700)]
[clang] Update ReleaseNotes about a crash fix (Issue 53628)

Update ReleaseNotes about a crash fix (Issue 53628)

Test Plan: none

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

21 months ago[LLDB] Format lldb-server's target XML
David Spickett [Wed, 17 Aug 2022 13:58:28 +0000 (13:58 +0000)]
[LLDB] Format lldb-server's target XML

So that the XML isn't one giant line. Which wasn't
a problem for lldb but was for me trying to troubleshoot
it using the logs.

It now looks like:
```
<?xml version="1.0"?>
<target version="1.0">
  <architecture>aarch64</architecture>
  <feature>
    <...>
    <reg name="fpcr" .../>
  </feature>
</target>
```

Reviewed By: labath

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

21 months ago[AArch64][NFC] Correctly rename mangling name for ldN.sret
Caroline Concatto [Wed, 31 Aug 2022 13:05:03 +0000 (14:05 +0100)]
[AArch64][NFC] Correctly rename mangling name for ldN.sret

Remove from the function name the predicate type and pointer type, because:
 The predicate type in the name(nxvNi1)  can be deduced from the overloaded
element count(nxvNEltTy).
 The pointer type(p0EltTy) can be deduced from the overloaded element type.

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

21 months ago[Utils] Refactor update_cc_test_checks.py to use shutil
John McIver [Tue, 20 Sep 2022 08:39:40 +0000 (09:39 +0100)]
[Utils] Refactor update_cc_test_checks.py to use shutil

The package distutils is deprecated and removal is planned for Python 3.12.
All calls to distutils.spawn.find_executable are replaced with shutil.which.

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

21 months ago[flang] Deallocate WHERE masks after all assignments
Jean Perier [Tue, 20 Sep 2022 08:39:39 +0000 (10:39 +0200)]
[flang] Deallocate WHERE masks after all assignments

Allocatable assignments were triggering lowering to clean-up
any WHERE mask temporaries, even if some assignments where left
in the WHERE construct.

This is because allocatable assignments lowering was being passed the
wrong statement context. Fix this by selecting the where/forall statement
context instead of a local one when there is one.

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

21 months ago[LSR] Fold terminating condition to other IV when possible
eopXD [Tue, 20 Sep 2022 02:07:43 +0000 (19:07 -0700)]
[LSR] Fold terminating condition to other IV when possible

When the IV is only used by the terminating condition (say IV-A) and the loop
has a predictable back-edge count and we have another IV (say IV-B) that is an
affine add recursion, we will be able to calculate the terminating value of
IV-B in the loop pre-header. This patch adds attempts to replace IV-B as the
new terminating condition and remove IV-A. It is safe to do so since IV-A is
only used as the terminating condition.

This transformation is suitable to be appended after LSR as it may optimize the
loop into the situation mentioned above. The transformation can reduce number of
IV-s in the loop by one.

A cli option `lsr-term-fold` is added and default disabled.

Reviewed By: mcberg2021, craig.topper

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

21 months ago[flang] fix optional pointer TARGET argument lowering in ASSOCIATED
Jean Perier [Tue, 20 Sep 2022 08:15:15 +0000 (10:15 +0200)]
[flang] fix optional pointer TARGET argument lowering in ASSOCIATED

The TARGET argument of ASSOCIATED has a special lowering to deal with
POINTER and ALLOCATABLE optional actual arguments because they may be
dynamically absent. The previous code was doing a ternary
(mlir::SelectOp) to deal with this case, but generated invalid
code for the unused argument (loading a nullptr fir.ref<fir.box>). This
was not detected until D133779 was merged and modified how fir.load are
lowered to LLVM for fir.box types.

Replace the select by a proper if to prevent the fir.load from being
reachable in context where it should not.

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

21 months ago[gn build] Port 55158efe1045
LLVM GN Syncbot [Tue, 20 Sep 2022 08:12:06 +0000 (08:12 +0000)]
[gn build] Port 55158efe1045

21 months ago[libc++] Remove MSVC code
Nikolas Klauser [Tue, 30 Aug 2022 12:57:17 +0000 (14:57 +0200)]
[libc++] Remove MSVC code

It's been one and a half months now and nobody said anything, so I guess this code can be removed.

Reviewed By: ldionne, #libc

Spies: Mordante, libcxx-commits, mgorny, mstorsjo

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

21 months ago[libc++][NFC] Refactor enable_ifs in vector
Nikolas Klauser [Mon, 15 Aug 2022 12:09:49 +0000 (14:09 +0200)]
[libc++][NFC] Refactor enable_ifs in vector

Using the `enable_if_t<..., int> = 0` style has the benefit that it works in all cases and makes function declarations easier to read because the function arguments and return type and SFINAE are separated. Unifying the style also makes it easier for people not super familiar with SFINAE to make sense of the code.

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

Spies: huixie90, libcxx-commits

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

21 months ago[TargetLibraryInfo] Mark memrchr as unavailable on Windows
Mateusz Mikuła [Tue, 20 Sep 2022 07:49:41 +0000 (10:49 +0300)]
[TargetLibraryInfo] Mark memrchr as unavailable on Windows

Otherwise LLVM will optimise strrchr into memrchr on Windows resulting in linker error:
```
$ cat memrchr_test.c
int main(int argc, char **argv) {
    return (long)strrchr("KkMm", argv[argc-1][0]);
}

$ clang memrchr_test.c -O
memrchr_test.c:3:12: warning: cast to smaller integer type 'long' from 'char *' [-Wpointer-to-int-cast]
    return (long)strrchr("KkMm", argv[argc-1][0]);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
ld.lld: error: undefined symbol: memrchr
>>> referenced by D:/msys64/tmp/memrchr_test-e7aabd.o:(main)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

Example taken from MSYS2 Discord and tested with windows-gnu target.

Reviewed By: aeubanks

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

21 months ago[LLD][COFF] Add load config checks to warn if incorrect for CFGuard
Alvin Wong [Tue, 20 Sep 2022 07:49:01 +0000 (10:49 +0300)]
[LLD][COFF] Add load config checks to warn if incorrect for CFGuard

Control Flow Guard requires specific flags and VA's be included in the
load config directory to be functional. In case CFGuard is enabled via
linker flags, we can check to make sure this is the case and give the
user a warning if otherwise.

MSVC provides a proper `_load_config_used` by default, so this is more
relevant for the MinGW target in which current versions of mingw-w64
does not provide this symbol.

The checks (only if CFGuard is enabled) include:

- The `_load_config_used` struct shall exist.
- Alignment of the `_load_config_used` struct (shall be aligned to
  pointer size.)
- The `_load_config_used` struct shall be large enough to contain the
  required fields.
- The values of the following fields are checked against the expected
  values:
  - GuardCFFunctionTable
  - GuardCFFunctionCount
  - GuardFlags
  - GuardAddressTakenIatEntryTable
  - GuardAddressTakenIatEntryCount
  - GuardLongJumpTargetTable
  - GuardLongJumpTargetCount
  - GuardEHContinuationTable
  - GuardEHContinuationCount

Reviewed By: rnk

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

21 months ago[LLD][COFF] Improve symbol table info for import thunk
Alvin Wong [Tue, 20 Sep 2022 07:44:45 +0000 (10:44 +0300)]
[LLD][COFF] Improve symbol table info for import thunk

Import thunks themselves contain a jump or branch, which is code by
nature. Therefore the import thunk symbol should be marked as function
type in the symbol table to help with debugging.

The `__imp_` import symbol associated to the import thunk is also useful
for debugging. However, when the import symbol isn't directly referenced
outside of the import thunk, it doesn't normally get added to the symbol
table. This change teaches LLD to add the import symbol explicitly.

Reviewed By: mstorsjo

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

21 months ago[llvm-rc] [test] Fix the windres-preproc test with other mingw triple forms. NFC.
Martin Storsjö [Sun, 18 Sep 2022 21:08:41 +0000 (00:08 +0300)]
[llvm-rc] [test] Fix the windres-preproc test with other mingw triple forms. NFC.

When invoking the preprocessor, llvm-windres produces a mingw
triple; if the llvm default target triple is a mingw target, it
is used as is - if not, a mingw style triple is generated.

Relax the testcase, to not strictly require "w64" as vendor (allow
the vendor field to be missing entirely), and allow both
"mingw32" and "windows-gnu" as OS/environment (where both forms are
common, while the latter is the normalized form).

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

21 months ago[clang] [Driver] Do not transform explicit --config filename
Michał Górny [Mon, 19 Sep 2022 18:23:44 +0000 (20:23 +0200)]
[clang] [Driver] Do not transform explicit --config filename

Disable transformations (e.g. attempting to replace target architecture)
in the config filename that is passed explicitly via `--config`.  This
behavior is surprising and confusing -- if user passes an explicit
config filename, Clang should use it as is.  The transformations are
still applied when the name is deduced from filename.

Update the tests accordingly.  This primarily ensures that full filename
with .cfg suffix is passed to --config (appending `.cfg` implicitly is
not documented, and would collide with use of filenames with other
suffixes).  The config-file2.c suite is removed entirely as it tested
the transformations on the argument to --config.  However, the aspects
of that that were not tested as part of config-file3.c are now added
there (based on config filename deduced from executable).

This change streamlines the code in Driver::loadConfigFile(), opening
the possibility of further changes, including support for handling
multiple --config options and refactoring of filename deduction.

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

21 months agoremove the internal signatures from perf binaries
wlei [Tue, 20 Sep 2022 05:30:24 +0000 (22:30 -0700)]
remove the internal signatures from perf binaries

21 months ago[lldb] Actually support more than 32 logging categories
Jonas Devlieghere [Mon, 19 Sep 2022 23:20:50 +0000 (16:20 -0700)]
[lldb] Actually support more than 32 logging categories

In January, Greg put up a patch (D117382) to support, among other
things, more than 32 log categories. That led to a bunch of nice
cleanups, but categories remained constrained because different parts of
the code were still using uint32_t. This patch fixes the remaining
issues and makes it possible to add a 32nd log category.

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

21 months ago[X86][GlobalISel] Add support for sret demotion
Serge Pavlov [Mon, 19 Sep 2022 07:14:00 +0000 (14:14 +0700)]
[X86][GlobalISel] Add support for sret demotion

The change add support for the cases when return value is passed in
memory rathen than in registers.

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

21 months ago[flang] Give explicit convert= specifiers precedence over FORT_CONVERT
Jonathon Penix [Fri, 2 Sep 2022 03:04:18 +0000 (20:04 -0700)]
[flang] Give explicit convert= specifiers precedence over FORT_CONVERT

Currently, the FORT_CONVERT environment variable has the highest priority when
setting the endianness conversion for unformatted files. In discussing the
appropriate priority for the fconvert option, convert specifiers were decided
to take highest priority.

This patch also initializes the open statement convert state to unknown
to disambiguate cases where the convert specifier was not provided from
cases where convert=native was set. This makes it possible to defer to the
environment setting where appropriate.

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

21 months ago[MemorySSA] Add test that all incoming values of phi node could be translated
luxufan [Mon, 19 Sep 2022 02:02:49 +0000 (02:02 +0000)]
[MemorySSA] Add test that all incoming values of phi node could be translated

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

21 months ago[MemorySSA][NFC] Use const whenever possible
luxufan [Mon, 19 Sep 2022 02:24:10 +0000 (02:24 +0000)]
[MemorySSA][NFC] Use const whenever possible

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

21 months ago[LSR] Precommit test for D132443
eopXD [Tue, 23 Aug 2022 08:44:15 +0000 (01:44 -0700)]
[LSR] Precommit test for D132443

Pre-commit test for D132443

Reviewed By: craig.topper

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

21 months agorevert 684f76643 [Clang][OpenMP] Codegen generation for has_device_addr claues.
Ron Lieberman [Tue, 20 Sep 2022 01:30:34 +0000 (01:30 +0000)]
revert 684f76643 [Clang][OpenMP] Codegen generation for has_device_addr claues.

breaks amdgpu buildbot

21 months ago[X86][fastcall][vectorcall] Move capability check before free register update
Phoebe Wang [Tue, 20 Sep 2022 00:44:11 +0000 (08:44 +0800)]
[X86][fastcall][vectorcall] Move capability check before free register update

When passing arguments with `__fastcall` or `__vectorcall` in 32-bit MSVC, the following arguments have chance to be passed by register if the current one failed. `__regcall` from ICC is on the contrary: https://godbolt.org/z/4MPbzhaMG
All the three calling conversions are not supported in GCC.

Fixes: #57737

Reviewed By: rnk

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

21 months ago[msan] Handle shadow of masked instruction
Vitaly Buka [Mon, 12 Sep 2022 05:00:37 +0000 (22:00 -0700)]
[msan] Handle shadow of masked instruction

Origin handling is not implemented yet.

Reviewed By: kda

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

21 months ago[lldb] Appease the MSCV compiler
Jonas Devlieghere [Tue, 20 Sep 2022 00:36:19 +0000 (17:36 -0700)]
[lldb] Appease the MSCV compiler

Fix error C2027: use of undefined type 'llvm::MemoryBuffer'.

21 months agoFix test case which is not working for AMDGPU.
Jennifer Yu [Tue, 20 Sep 2022 00:04:09 +0000 (17:04 -0700)]
Fix test case which is not working for AMDGPU.

This is for the change of
Differential Revision: https://reviews.llvm.org/D134186

21 months agoAMDGPU: Add some tests for atomics with excess alignment
Matt Arsenault [Mon, 19 Sep 2022 23:08:10 +0000 (19:08 -0400)]
AMDGPU: Add some tests for atomics with excess alignment

21 months agoVectorCombine: Pass through AssumptionCache
Matt Arsenault [Mon, 19 Sep 2022 22:09:39 +0000 (18:09 -0400)]
VectorCombine: Pass through AssumptionCache

21 months agoMemCpyOpt: Pass through AssumptionCache
Matt Arsenault [Mon, 19 Sep 2022 22:05:31 +0000 (18:05 -0400)]
MemCpyOpt: Pass through AssumptionCache

21 months agoSLPVectorizer: Pass through AssumptionCache
Matt Arsenault [Mon, 19 Sep 2022 21:49:16 +0000 (17:49 -0400)]
SLPVectorizer: Pass through AssumptionCache

21 months agoLoopVectorize: Pass through AssumptionCache
Matt Arsenault [Mon, 19 Sep 2022 21:02:40 +0000 (17:02 -0400)]
LoopVectorize: Pass through AssumptionCache

21 months agoGVN: Pass through AssumptionCache to queries
Matt Arsenault [Mon, 19 Sep 2022 20:52:54 +0000 (16:52 -0400)]
GVN: Pass through AssumptionCache to queries

21 months agoAnalysis: Add AssumptionCache to isSafeToSpeculativelyExecute
Matt Arsenault [Mon, 19 Sep 2022 20:51:42 +0000 (16:51 -0400)]
Analysis: Add AssumptionCache to isSafeToSpeculativelyExecute

Does not update any of the uses.

21 months ago[Clang][OpenMP] Codegen generation for has_device_addr claues.
Jennifer Yu [Mon, 12 Sep 2022 23:57:27 +0000 (16:57 -0700)]
[Clang][OpenMP] Codegen generation for has_device_addr claues.

Summary: This patch add codegen support for the has_device_addr clause.  It
use the same logic of is_device_ptr.

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

21 months agoInstCombine: Pass AssumptionCache through isDereferenceablePointer
Matt Arsenault [Mon, 19 Sep 2022 19:59:13 +0000 (15:59 -0400)]
InstCombine: Pass AssumptionCache through isDereferenceablePointer

21 months agoGlobalISel: Pass through AssumptionCache
Matt Arsenault [Mon, 19 Sep 2022 19:25:29 +0000 (15:25 -0400)]
GlobalISel: Pass through AssumptionCache

21 months agoSelectionDAG: Add AssumptionCache analysis dependency
Matt Arsenault [Mon, 19 Sep 2022 19:25:37 +0000 (15:25 -0400)]
SelectionDAG: Add AssumptionCache analysis dependency

Fixes compile time regression after
bb70b5d40652207c0bd3d385def10ef3ef1d45b4

21 months ago[RISCV] Make computeIncomingVLVTYPE more conservative when merging predecessor state.
Craig Topper [Mon, 19 Sep 2022 22:57:55 +0000 (15:57 -0700)]
[RISCV] Make computeIncomingVLVTYPE more conservative when merging predecessor state.

If we have already calculated the incoming state before, use that
as our starting point to ensure we are conservative.

This fixes an infinite loop found in our downstream where we
we allowed two waves of updates to propagate through a loop and
the merge points allowed us to toggle back and forth between states.
No small reproducer right now.

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

21 months agoAnalysis: Add AssumptionCache argument to isDereferenceableAndAlignedPointer
Matt Arsenault [Mon, 19 Sep 2022 19:06:08 +0000 (15:06 -0400)]
Analysis: Add AssumptionCache argument to isDereferenceableAndAlignedPointer

This does not try to pass it through from the end users.

21 months agoAMDGPU: Update baseline test checks
Matt Arsenault [Mon, 19 Sep 2022 22:17:38 +0000 (18:17 -0400)]
AMDGPU: Update baseline test checks

21 months ago[OpenMP] Add LoongArch64 support
SignKirigami [Mon, 19 Sep 2022 22:49:15 +0000 (22:49 +0000)]
[OpenMP] Add LoongArch64 support

GCC, glibc, binutils, and LLVM have added support for LoongArch64.
This patch adds support for LLVM OpenMP following D59880 for RISCV64.

Reviewed By: MaskRay, SixWeining

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

21 months ago[llvm][TextAPI] add driverkit as supported platform for older tbd
Cyndy Ishida [Mon, 19 Sep 2022 22:05:20 +0000 (15:05 -0700)]
[llvm][TextAPI] add driverkit as supported platform for older tbd
versions

 It looks like being able to write it was added, but missed the ability
  to read it.

21 months ago[clang-format] Update removed brace's next token's WhitespaceRange
owenca [Sun, 18 Sep 2022 20:32:05 +0000 (13:32 -0700)]
[clang-format] Update removed brace's next token's WhitespaceRange

Fixes #57803.

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

21 months ago[clang-doc] Add support for explicitly typed enums
Brett Wilson [Mon, 19 Sep 2022 21:52:24 +0000 (21:52 +0000)]
[clang-doc] Add support for explicitly typed enums

Add support for explicitly typed enums:
  enum Foo : unsigned { ... };
to the internal representation and to the YAML output.

Add support for getting the value of an enum constant, as well as accessing the original expression that produced it. This changes the YAML output of enums from an array of strings for the enum members to an array of dictionaries. These dictionaries now report the name, value, and original expression.

The markdown and HTML outputs are unchanged, they still output the name from the new enhanced internal schema.

Reviewed By: paulkirth

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

21 months ago[mlir][scf] Support simple symbolic expression when simplify loops
Peiming Liu [Mon, 19 Sep 2022 18:41:54 +0000 (18:41 +0000)]
[mlir][scf] Support simple symbolic expression when simplify loops

Reviewed By: aartbik, ThomasRaoux

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

21 months ago[gn build] Port 70599d70273b
LLVM GN Syncbot [Mon, 19 Sep 2022 21:43:51 +0000 (21:43 +0000)]
[gn build] Port 70599d70273b

21 months ago[lldb] Remove LLDB reproducers
Jonas Devlieghere [Mon, 19 Sep 2022 17:47:09 +0000 (10:47 -0700)]
[lldb] Remove LLDB reproducers

This patch removes the remaining reproducer code. The SBReproducer class
remains for ABI stability but is just an empty shell. This completes the
removal process outlined on the mailing list [1].

[1] https://lists.llvm.org/pipermail/lldb-dev/2021-September/017045.html

21 months ago[AMDGPU] SIFixSGPRCopies reworking to use one pass over the MIR for analysis and...
Alexander Timofeev [Wed, 7 Sep 2022 14:14:38 +0000 (16:14 +0200)]
[AMDGPU] SIFixSGPRCopies reworking to use one pass over the MIR for analysis and lowering.

This change finalizes the series of patches aiming to replace the old strategy of VGPR to SGPR copy lowering.

  # Following the https://reviews.llvm.org/D128252 and https://reviews.llvm.org/D130367 code parts that are no longer used were removed.
  # The first pass over the MachineFunctoin collects all the necessary information.
  # Lowering is done in 3 phases:
     - VGPR to SGPR copies analysis  lowering
     - REG_SEQUENCE, PHIs, and SGPR to VGPR copies lowering
     - SCC copies lowering is done in a separate pass over the Machine Function

Reviewed By: rampitec

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

21 months ago[RISCV] Manage the InQueue flag in insertvli correctly.
Craig Topper [Mon, 19 Sep 2022 21:28:22 +0000 (14:28 -0700)]
[RISCV] Manage the InQueue flag in insertvli correctly.

We were only setting this flag the first time we added the blocks
not when we mark them for revisiting.

Reviewed By: reames

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

21 months ago[Clang] Implement fix for DR2628
Roy Jacobson [Sun, 18 Sep 2022 20:07:25 +0000 (23:07 +0300)]
[Clang] Implement fix for DR2628

Implement suggested fix for [[ https://cplusplus.github.io/CWG/issues/2628.html | DR2628. ]] Couldn't update the DR docs because there hasn't been a DR index since it was filed, but the tests still run in CI.

Note: I only transfer the constructor constraints, not the struct constraints. I think that's OK because the struct constraints are the same
for all constructors so they don't affect the overload resolution, and if they deduce to something that doesn't pass the constraints
we catch it anyway. So (hopefully) that should be more efficient without sacrificing correctness.

Closes:
https://github.com/llvm/llvm-project/issues/57646
https://github.com/llvm/llvm-project/issues/43829

Reviewed By: erichkeane

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

21 months ago[SLP][NFC]Reorder gather nodes with reused scalars, NFC.
Alexey Bataev [Mon, 19 Sep 2022 19:43:30 +0000 (12:43 -0700)]
[SLP][NFC]Reorder gather nodes with reused scalars, NFC.

The compiler does not reorder the gather nodes with reused scalars, just
does it for opernads of the user nodes. This currently does not affect
the compiler but breaks internal logic of the SLP graph. In future, it
is supposed to actually use all nodes instead of just list of operands
and this will affect the vectorization result.
Also, did some early check to avoid complex logic in cost estimation
analysis, should improve compiler time a bit.

21 months ago[RISCV] Adding missing test from a4a29438f
Philip Reames [Mon, 19 Sep 2022 20:40:20 +0000 (13:40 -0700)]
[RISCV] Adding missing test from a4a29438f

This change was originally reviewed as part of what became a4a29438f, but apparently forgot to git-add it when applying the patch.  Oops.

21 months agoAdd auto deduce source map setting
Jeffrey Tan [Thu, 8 Sep 2022 18:21:08 +0000 (11:21 -0700)]
Add auto deduce source map setting

    This patch adds a new "target.auto-source-map-relative" setting.

    If enabled, this setting may auto deduce a source map entry based on requested
    breakpoint path and the original path stored in debug info for resolved
    breakpoint.

    As an example, if debug info contains "./a/b/c/main.cpp", user sets a source
    breakpoint at "/root/repo/x/y/z/a/b/c/main.cpp". The breakpoint will resolve
    correctly now with Greg's patch https://reviews.llvm.org/D130401. However, the
    resolved breakpoint will use "./a/b/c/main.cpp" to locate source file during
    stop event which would fail most of the time.

    With the new "target.auto-source-map-relative" setting enabled, a auto deduced
    source map entry "." => "/root/repo/x/y/z" will be added. This new mapping will
    help lldb to map resolved breakpoint path "./a/b/c/main.cpp" back to
    "/root/repo/x/y/z/a/b/c/main.cpp" and locate it on disk.

    If an existing source map entry is used the patch also concatenates the auto
    deduced entry with any stripped reverse mapping prefix (see example below).

    As a second example, debug info contains "./a/b/c/main.cpp" and user sets
    breakpoint at "/root/repo/x/y/z/a/b/c/main.cpp". Let's say there is an existing
    source map entry "." => "/root/repo"; this mapping would strip the prefix out of
    "/root/repo/x/y/z/a/b/c/main.cpp" and use "x/y/z/a/b/c/main.cpp" to resolve
    breakpoint. "target.auto-source-map-relative" setting would auto deduce a new
    potential mapping of "." => "x/y/z", then it detects that there is a stripped
    prefix from reverse mapping and concatenates it as the new mapping:
     "." => "/root/repo/x/y/z" which would correct map "./a/b/c/main.cpp" path to
    new path in disk.

    This patches depends on https://reviews.llvm.org/D130401 to use new added
    SBDebugger::GetSetting() API for testing.

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

21 months ago[BOLT] Control aggregation mode output profile file format
Amir Ayupov [Mon, 19 Sep 2022 20:36:50 +0000 (13:36 -0700)]
[BOLT] Control aggregation mode output profile file format

In perf2bolt and `-aggregate-only` BOLT mode, the output profile file is written
in fdata format by default. Provide a knob `-profile-format=[fdata,yaml]` to
control the format.
Note that `-w` option still dumps in YAML format.

Reviewed By: #bolt, maksfb

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

21 months ago[msan] Check mask and pointers shadow
Vitaly Buka [Sun, 11 Sep 2022 20:17:46 +0000 (13:17 -0700)]
[msan] Check mask and pointers shadow

Msan has default handler for unknown instructions which
previously applied to these as well. However depending on
mask, not all pointers or passthru part will be used. This
allows other passes to insert undef into sum arguments.
As result,  default strict instruction handler can produce false reports.

Reviewed By: kda, kstoimenov

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

21 months ago[clang] Add support for #pragma strict_gs_check
David Majnemer [Mon, 12 Sep 2022 21:32:39 +0000 (21:32 +0000)]
[clang] Add support for #pragma strict_gs_check

21 months ago[mlir][Tensor] Fix ExtractSliceFromReshape transform edge case
Christopher Bate [Fri, 16 Sep 2022 22:11:46 +0000 (16:11 -0600)]
[mlir][Tensor] Fix ExtractSliceFromReshape transform edge case

The transformation would fail if none of the sliced dimensions were
linearized by the producing `tensor.collapse_shape`. This is a trivial
edge case but it wasn't correctly tested. Fixes the issue and adds a test.

Reviewed By: nicolasvasilache

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

21 months ago[test] Update llvm-dwp/X86/nocompress.test
Fangrui Song [Mon, 19 Sep 2022 19:58:50 +0000 (12:58 -0700)]
[test] Update llvm-dwp/X86/nocompress.test

21 months ago[CostModel][X86] Add CostKinds test coverage for min/max intrinsics
Simon Pilgrim [Mon, 19 Sep 2022 19:50:21 +0000 (20:50 +0100)]
[CostModel][X86] Add CostKinds test coverage for min/max intrinsics

21 months ago[docs] Fix build-docs.sh
Tobias Hieta [Mon, 19 Sep 2022 19:42:42 +0000 (21:42 +0200)]
[docs] Fix build-docs.sh

If libcxxabi is not included CMake will error out:

Cannot find target libcxxabi-SHARED

I ran into this doing the 15.0.0 release

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

21 months ago[CUDA][HIP] Fix new driver crashing when using -save-temps in RDC-mode
Joseph Huber [Mon, 19 Sep 2022 15:24:21 +0000 (10:24 -0500)]
[CUDA][HIP] Fix new driver crashing when using -save-temps in RDC-mode

Previously when using the `clang-offload-packager` we did not pass the
active offloading kinds. Then in Clang when we attempted to detect when
there was host-offloading action that needed to be embedded in the host
we did not find it. This patch adds the active offloading kinds so we
know when there is input to be embedded.

Reviewed By: tra

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

21 months ago[libc++] Document the format of _LIBCPP_VERSION
Louis Dionne [Mon, 19 Sep 2022 15:27:50 +0000 (11:27 -0400)]
[libc++] Document the format of _LIBCPP_VERSION

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

22 months ago[bazel] Port ba8424a251d7
Dmitri Gribenko [Mon, 19 Sep 2022 19:20:12 +0000 (21:20 +0200)]
[bazel] Port ba8424a251d7

22 months ago[flang] Support multidimensional reductions in SimplifyIntrinsicsPass.
Slava Zakharin [Tue, 13 Sep 2022 16:41:22 +0000 (09:41 -0700)]
[flang] Support multidimensional reductions in SimplifyIntrinsicsPass.

Create simplified functions for each rank with "x<rank>" suffix
that implement multidimensional reductions. To enable this I had to fix
an issue with taking incorrect box shape in cases of sliced embox/rebox.

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

22 months ago[flang] Support more data types for reduction in SimplifyIntrinsicsPass.
Slava Zakharin [Tue, 13 Sep 2022 01:37:49 +0000 (18:37 -0700)]
[flang] Support more data types for reduction in SimplifyIntrinsicsPass.

All floating point (not complex) and integer types should be supported now.

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

22 months ago[clang][dataflow] Refactor `clang/Analysis/FlowSensitive/MatchSwitchTest.cpp`.
Wei Yi Tee [Mon, 19 Sep 2022 18:41:18 +0000 (18:41 +0000)]
[clang][dataflow] Refactor `clang/Analysis/FlowSensitive/MatchSwitchTest.cpp`.

- Remove use of `runDataflowAnalysis` to keep test isolated.
- Add test for `ASTMatchSwitch<CXXCtorInitializer, ...>`.

Reviewed By: gribozavr2, sgatev

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

22 months ago[lld][thinlto] Include -mllvm options in the thinlto cache key
Mircea Trofin [Fri, 16 Sep 2022 04:01:56 +0000 (21:01 -0700)]
[lld][thinlto] Include -mllvm options in the thinlto cache key

They may modify thinlto optimization.

This patch only extends support for `-mllvm`. There is another way to
pass llvm flags, `-plugin-opt`, but its processing is different and will
be provided in a subsequent patch.

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

22 months agoFix one more unused warning in release build, NFC
Haojian Wu [Mon, 19 Sep 2022 18:56:39 +0000 (20:56 +0200)]
Fix one more unused warning in release build, NFC

22 months agoFix an unused warning in release build, NFC
Haojian Wu [Mon, 19 Sep 2022 18:44:59 +0000 (20:44 +0200)]
Fix an unused warning in release build, NFC

22 months ago[Object] Add zstd decompression support to Decompressor
Fangrui Song [Mon, 19 Sep 2022 18:41:16 +0000 (11:41 -0700)]
[Object] Add zstd decompression support to Decompressor

llvm::object::Decompressor is used by many DWARF consumers like llvm-dwarfdump,
llvm-dwp, llvm-symbolizer. Add tests to them. The lldb test can be left to
D133530.

Reviewed By: dblaikie

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

22 months ago[clang][dataflow] Modify `transfer` in `DataflowModel` to take `CFGElement` as input...
Wei Yi Tee [Mon, 19 Sep 2022 18:13:50 +0000 (18:13 +0000)]
[clang][dataflow] Modify `transfer` in `DataflowModel` to take `CFGElement` as input instead of `Stmt`.

To keep API of transfer functions consistent.

The single use of this transfer function in `ChromiumCheckModel` is also updated.

Reviewed By: gribozavr2, sgatev

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

22 months ago[AMDGPU] [DAGCombiner] Precommit test for D133584
jeff [Mon, 19 Sep 2022 18:08:55 +0000 (18:08 +0000)]
[AMDGPU] [DAGCombiner] Precommit test for D133584

Change-Id: I488ac9b23718f8d0b28db034c4cc455ae736e785

22 months agoadd test for -enable-global-analyses=0 [NFC]
Nuno Lopes [Mon, 19 Sep 2022 18:25:14 +0000 (19:25 +0100)]
add test for -enable-global-analyses=0 [NFC]

22 months ago[Hexagon] Implement [SU]INT_TO_FP and FP_TO_[SU]INT for HVX
Krzysztof Parzyszek [Fri, 2 Sep 2022 19:04:49 +0000 (12:04 -0700)]
[Hexagon] Implement [SU]INT_TO_FP and FP_TO_[SU]INT for HVX

22 months ago[mlir][spirv] fix ordering in Intel joint matrix ops
Nirvedh Meshram [Fri, 16 Sep 2022 19:18:43 +0000 (12:18 -0700)]
[mlir][spirv] fix ordering in Intel joint matrix ops

Reviwed By: antiagainst

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

22 months ago[clang][dataflow] Replace `transfer(const Stmt *, ...)` with `transfer(const CFGEleme...
Wei Yi Tee [Mon, 19 Sep 2022 17:36:50 +0000 (17:36 +0000)]
[clang][dataflow] Replace `transfer(const Stmt *, ...)` with `transfer(const CFGElement *, ...)` in `clang/Analysis/FlowSensitive`.

Reviewed By: gribozavr2, sgatev

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

22 months ago[IRBuilder] Use PoisonValue in CreateMasked*
Vitaly Buka [Thu, 15 Sep 2022 17:39:16 +0000 (10:39 -0700)]
[IRBuilder] Use PoisonValue in CreateMasked*

Followup to 72b776168c7c80d2035c7226488462dcffc97e75

Reviewed By: nlopes

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

22 months agoFix unused variable warnings:
Kazu Hirata [Mon, 19 Sep 2022 17:42:49 +0000 (10:42 -0700)]
Fix unused variable warnings:

This patch fixes warnings during a release build:

  mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp:198:52: error:
  lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture]

  bolt/lib/Rewrite/RewriteInstance.cpp:5318:18: error: unused variable
  'HasNoAddress' [-Werror,-Wunused-variable]

22 months ago[mlir][spirv] Lower arith max/min ops to OpenCL ones
Stanley Winata [Mon, 19 Sep 2022 17:28:55 +0000 (13:28 -0400)]
[mlir][spirv] Lower arith max/min ops to OpenCL ones

Reviewed By: antiagainst

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

22 months ago[clang][dataflow] Replace usage of deprecated functions with the optional check
Wei Yi Tee [Mon, 19 Sep 2022 16:56:35 +0000 (16:56 +0000)]
[clang][dataflow] Replace usage of deprecated functions with the optional check

- Update `transfer` and `diagnose` to take `const CFGElement *` as input in `Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel`.
- Update `clang-tools-extra/clang-tidy/bugprone/UncheckedOptionalAccessCheck.cpp` accordingly.
- Rename `runDataflowAnalysisOnCFG` to `runDataflowAnalysis` and remove the deprecated `runDataflowAnalysis` (this was only used by the now updated optional check).

Reviewed By: gribozavr2, sgatev

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

22 months ago[mlir][spirv] Support OpenCL when lowering memref load/store
Stanley Winata [Mon, 19 Sep 2022 17:14:58 +0000 (13:14 -0400)]
[mlir][spirv] Support OpenCL when lowering memref load/store

-Add awareness to Kernel vs Shader capability for memref to SPIR-V
 lowering.
-Add lowering using spv.PtrAccessChain for Kernel capability.
-Enable lowering from scalar pointee types for kernel capabilities.

Reviewed By: antiagainst

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

22 months ago[clang] Fix a nullptr-access crash in CheckTemplateArgument.
Haojian Wu [Mon, 19 Sep 2022 13:04:42 +0000 (15:04 +0200)]
[clang] Fix a nullptr-access crash in CheckTemplateArgument.

It is possible that we can pass a null ParamType to
CheckNonTypeTemplateParameter -- the ParamType var can be reset to a null
type on Line 6940, and the followed bailout if is not entered.

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

22 months ago[LV] Keep track of cost-based ScalarAfterVec in VPWidenPointerInd.
Florian Hahn [Mon, 19 Sep 2022 17:14:34 +0000 (18:14 +0100)]
[LV] Keep track of cost-based ScalarAfterVec in VPWidenPointerInd.

Epilogue vectorization uses isScalarAfterVectorization to check if
widened versions for inductions need to be generated and bails out in
those cases.

At the moment, there are scenarios where isScalarAfterVectorization
returns true but VPWidenPointerInduction::onlyScalarsGenerated would
return false, causing widening.

This can lead to widened phis with incorrect start values being created
in the epilogue vector body.

This patch addresses the issue by storing the cost-model decision in
VPWidenPointerInductionRecipe and restoring the behavior before 151c144.
This effectively reverts 151c144, but the long-term fix is to properly
support widened inductions during epilogue vectorization

Fixes #57712.

22 months ago[LangRef] Clarify that noimplicitfloat disables all implicit vectors not just floatin...
Craig Topper [Mon, 19 Sep 2022 17:10:57 +0000 (10:10 -0700)]
[LangRef] Clarify that noimplicitfloat disables all implicit vectors not just floating point.

Reviewed By: fhahn

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

22 months ago[LoopIdiom] Add non-LZCNT target test coverage
Simon Pilgrim [Mon, 19 Sep 2022 17:13:05 +0000 (18:13 +0100)]
[LoopIdiom] Add non-LZCNT target test coverage

22 months ago[Hexagon] Add HVX patterns for ISD::ABS
Krzysztof Parzyszek [Mon, 19 Sep 2022 17:05:03 +0000 (10:05 -0700)]
[Hexagon] Add HVX patterns for ISD::ABS

22 months ago[test][clangd] Join back -Xclang and -undef
Vitaly Buka [Mon, 19 Sep 2022 17:10:42 +0000 (10:10 -0700)]
[test][clangd] Join back -Xclang and -undef

22 months ago[LV] Remove FIXME about NoImplicitFloat. NFC
Craig Topper [Mon, 19 Sep 2022 16:45:27 +0000 (09:45 -0700)]
[LV] Remove FIXME about NoImplicitFloat. NFC

My understanding is that NoImplicitFloat, despite it's name, is
supposed to disable all vectors not just float vectors.

Reviewed By: efriedma

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

22 months agoFixed llvm-nm.rst:145:Block quote ends without a blank line; unexpected unindent.
zhijian [Mon, 19 Sep 2022 17:00:25 +0000 (13:00 -0400)]
Fixed llvm-nm.rst:145:Block quote ends without a blank line; unexpected unindent.
ninja: build stopped: subcommand failed.

22 months ago[mlir][tensor] Fold round-tripping extract/insert slice ops
Lei Zhang [Mon, 19 Sep 2022 16:48:43 +0000 (12:48 -0400)]
[mlir][tensor] Fold round-tripping extract/insert slice ops

Reviewed By: ThomasRaoux, nicolasvasilache

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

22 months ago[mlir] Add Dynamic Dialects
Mathieu Fehr [Mon, 19 Sep 2022 16:47:37 +0000 (09:47 -0700)]
[mlir] Add Dynamic Dialects

Dynamic dialects are dialects that can be defined at runtime.
Dynamic dialects are extensible by new operations, types, and
attributes at runtime.

Reviewed By: rriddle

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

22 months ago[clang] Make config-related options CoreOptions
Michał Górny [Mon, 19 Sep 2022 16:00:47 +0000 (18:00 +0200)]
[clang] Make config-related options CoreOptions

Make `--config`, `--no-default-config` and `--config-*-dir` CoreOptions
to enable their availability to all clang driver modes.  This improves
consistency given that the default set of configuration files is
processed independently of mode anyway.

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

22 months ago[NFC][1/n] Remove -enable-new-pm=0 flags from lit tests
Sebastian Peryt [Mon, 19 Sep 2022 16:28:24 +0000 (09:28 -0700)]
[NFC][1/n] Remove -enable-new-pm=0 flags from lit tests

This is the first patch in a series intended for removing flag
-enable-new-pm=0 from lit tests. This is part of a bigger
effort of completely removing legacy code related to legacy
pass manager in favor of currently default new pass manager.

In this patch flag has been removed only from tests where no significant
change has been required because checks has been duplicated for
both PMs.

Reviewed By: fhahn

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

22 months ago[lldb] Reset breakpoint hit count before new runs
Felipe de Azevedo Piovezan [Tue, 13 Sep 2022 15:30:07 +0000 (11:30 -0400)]
[lldb] Reset breakpoint hit count before new runs

A common debugging pattern is to set a breakpoint that only stops after
a number of hits is recorded. The current implementation never resets
the hit count of breakpoints; as such, if a user re-`run`s their
program, the debugger will never stop on such a breakpoint again.

This behavior is arguably undesirable, as it renders such breakpoints
ineffective on all but the first run. This commit changes the
implementation of the `Will{Launch, Attach}` methods so that they reset
the _target's_ breakpoint hitcounts.

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

22 months ago[clang-format] JSON formatting add new option for controlling newlines in json arrays
mydeveloperday [Mon, 19 Sep 2022 16:48:58 +0000 (17:48 +0100)]
[clang-format] JSON formatting add new option for controlling newlines in json arrays

Working in a mixed environment of both vscode/vim with a team configured prettier configuration, this can leave clang-format and prettier fighting each other over the formatting of arrays, both simple arrays of elements.

This review aims to add some "control knobs" to the Json formatting in clang-format to help align the two tools so they can be used interchangeably.

This will allow simply arrays `[1, 2, 3]` to remain on a single line but will break those arrays based on context within that array.

Happy to change the name of the option (this is the third name I tried)

Reviewed By: HazardyKnusperkeks, owenpan

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

22 months ago[ORC] Fix macho section name typo
Keith Smiley [Thu, 21 Jul 2022 03:09:03 +0000 (20:09 -0700)]
[ORC] Fix macho section name typo

I don't think __obj_selrefs is a thing, but __objc_selrefs definitely
is.

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

22 months agoBEGIN_PUBLIC
Rahul Joshi [Fri, 16 Sep 2022 23:02:35 +0000 (16:02 -0700)]
BEGIN_PUBLIC
Use isa<> instead of dyn_cast
END_PUBLIC

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

22 months ago[Hexagon] Rework SplitHvxPairOp to be a general vector splitting utiity
Krzysztof Parzyszek [Mon, 19 Sep 2022 16:35:23 +0000 (09:35 -0700)]
[Hexagon] Rework SplitHvxPairOp to be a general vector splitting utiity

Enable creating an idiom: V -> opJoin(SplitVectorOp(V))