platform/upstream/llvm.git
2 years ago[PS5] Defaults for -fdeclspec, -ffunction/data-sections
Paul Robinson [Thu, 28 Apr 2022 16:58:47 +0000 (09:58 -0700)]
[PS5] Defaults for -fdeclspec, -ffunction/data-sections

2 years ago[RISCV] Use default promotion for (i32 (shl 1, X)) on RV64 when Zbs is enabled.
Craig Topper [Thu, 28 Apr 2022 16:21:13 +0000 (09:21 -0700)]
[RISCV] Use default promotion for (i32 (shl 1, X)) on RV64 when Zbs is enabled.

This improves opportunities to use bset/bclr/binv. Unfortunately,
there are no W versions of these instrcutions so this isn't always
a clear win. If we use SLLW we get free sign extend and shift masking,
but need to put a 1 in a register and can't remove an or/xor. If
we use bset/bclr/binv we remove the immediate materializationg and
logic op, but might need a mask on the shift amount and sext.w.

Reviewed By: luismarques

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

2 years agoFix "not all control paths return a value" diagnostic; NFC
Aaron Ballman [Thu, 28 Apr 2022 16:57:07 +0000 (12:57 -0400)]
Fix "not all control paths return a value" diagnostic; NFC

2 years ago[ArgPromotion] Move ArgPart and OffsetAndArgPart to anonymous namespace
Pavel Samolysov [Thu, 28 Apr 2022 16:51:39 +0000 (09:51 -0700)]
[ArgPromotion] Move ArgPart and OffsetAndArgPart to anonymous namespace

The structure ArgPart and alias OffsetAndArgPart have been moved
into the anonymous namespace. NFC.

Reviewed By: aeubanks

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

2 years ago[ArgPromotion] Change the condition to check the promotion limit
Pavel Samolysov [Thu, 28 Apr 2022 16:37:35 +0000 (09:37 -0700)]
[ArgPromotion] Change the condition to check the promotion limit

The condition should be 'ArgParts.size() > MaxElements', so that if we
have exactly 3 elements in the 'ArgParts' vector, the promotion should
be allowed because the 'MaxElement' threshold is not exceeded yet.

The default value for 'MaxElement' has been decreased to 2 in order
to avoid an actual change in argument promoting behavior. However,
this changes byval argument transformation behavior by allowing
adding not more than 2 arguments to the function instead of 3 allowed
before.

Reviewed By: aeubanks

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

2 years ago[SelectionDAG] Use correct boolean representation in FoldConstantArithmetic
Bjorn Pettersson [Thu, 28 Apr 2022 16:31:05 +0000 (18:31 +0200)]
[SelectionDAG] Use correct boolean representation in FoldConstantArithmetic

The description of SETCC says
  /// SetCC operator - This evaluates to a true value iff the condition is
  /// true.  If the result value type is not i1 then the high bits conform
  /// to getBooleanContents.

Without this patch, we sign extended the i1 to the used larger type
regardless of getBooleanContents. This resulted in miscompiles, as
shown in the attached testcase that ended up returning -1 instead of
1 when using -mattr=+v.

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

Reviewed By: craig.topper

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

2 years ago[libunwind][AArch64] Fix _Unwind_ForcedUnwind via sigreturn.
Daniel Kiss [Thu, 28 Apr 2022 08:01:22 +0000 (10:01 +0200)]
[libunwind][AArch64] Fix _Unwind_ForcedUnwind via sigreturn.

When the sigreturn trampoline is found the unw_proc_info_t.end_ip need to be set to
indicate a stack frame is found.

Reviewed By: cjdb, #libunwind, MaskRay

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

2 years ago[InstCombine][X86] Add exhaustive simplify demanded vector elts tests for avx2 per...
Simon Pilgrim [Thu, 28 Apr 2022 16:14:39 +0000 (17:14 +0100)]
[InstCombine][X86] Add exhaustive simplify demanded vector elts tests for avx2 per-element vector shifts

2 years ago[bazel] Port 84fe39a45b73
Benjamin Kramer [Thu, 28 Apr 2022 16:29:43 +0000 (18:29 +0200)]
[bazel] Port 84fe39a45b73

2 years ago[flang][runtime] Correct emission & reading of unterminated final records
Peter Klausler [Tue, 26 Apr 2022 23:09:42 +0000 (16:09 -0700)]
[flang][runtime] Correct emission & reading of unterminated final records

When the last operation on a foramtted sequential or stream file (prior
to an implied or explicit ENDFILE) is a non-advancing WRITE, ensure
that any partial record data is emitted to the file without a line
terminator.  Further, when that last record is read with a non-advancing
READ, ensure that it won't raise an end-of-record condition after its
data, but instead will signal an end-of-file.

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

2 years ago[X86] getTargetVShiftByConstNode - use SelectionDAG::FoldConstantArithmetic to perfor...
Simon Pilgrim [Thu, 28 Apr 2022 16:08:20 +0000 (17:08 +0100)]
[X86] getTargetVShiftByConstNode - use SelectionDAG::FoldConstantArithmetic to perform constant folding. NFCI.

Remove some unnecessary code duplication.

2 years ago[COST][NFC]Add a test for non-power-2 shuffles, NFC.
Alexey Bataev [Thu, 28 Apr 2022 15:49:52 +0000 (08:49 -0700)]
[COST][NFC]Add a test for non-power-2 shuffles, NFC.

2 years ago[mlir] Don't iterate mutable user list
Vitaly Buka [Wed, 27 Apr 2022 23:16:39 +0000 (16:16 -0700)]
[mlir] Don't iterate mutable user list

executeOp.operandsMutable().append(asyncTokens) in
addAsyncDependencyAfter can resize and invalidate iterators.

Fixes reports like https://reviews.llvm.org/P8286

Reviewed By: herhut

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

2 years ago[mlir][msan] Don't access destroyed node
Vitaly Buka [Wed, 27 Apr 2022 23:07:21 +0000 (16:07 -0700)]
[mlir][msan] Don't access destroyed node

2 years ago[mlir][emitc] Add a cast op
Marius Brehler [Mon, 11 Apr 2022 14:14:51 +0000 (14:14 +0000)]
[mlir][emitc] Add a cast op

This adds a cast operation that allows to perform an explicit type
conversion. The cast op is emitted as a C-style cast. It can be applied
to integer, float, index and EmitC types.

Reviewed By: jpienaar

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

2 years ago[mlir][msan][test] Disable jit tests
Vitaly Buka [Wed, 27 Apr 2022 23:04:47 +0000 (16:04 -0700)]
[mlir][msan][test] Disable jit tests

I am going to enable MLIR test on msan bot
https://lab.llvm.org/buildbot/#/builders/sanitizer-x86_64-linux-bootstrap-msan

Reviewed By: ftynse

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

2 years ago[llvm] Ignore .rej files in .gitignore
Jonas Devlieghere [Thu, 28 Apr 2022 15:43:12 +0000 (08:43 -0700)]
[llvm] Ignore .rej files in .gitignore

Ignore reject files (.rej) files generated by patch. I can't imagine a
reason they should ever be checked in. I considered ignoring patch files
as well but decided to err on the side of caution because we might not
want them to be easily deleted by something like git clean.

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

2 years ago[HLSL] Adjust access specifier behavior
Chris Bieneman [Thu, 28 Apr 2022 15:13:20 +0000 (10:13 -0500)]
[HLSL] Adjust access specifier behavior

HLSL doesn't support access specifiers. This change has two components:

1) Make default access for classes public
2) Diagnose the use of access specifiers as a clang HLSL extension

As long as the default behavior for access specifiers matches HLSL,
allowing them to be used doesn't cause sourece incompatability with
valid code. As such enabling them as a clang extension seems like a
reasonable approach.

Fixes #55124

Reviewed By: aaron.ballman

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

2 years ago[Driver] Add f16 support to -mrecip parsing.
Craig Topper [Thu, 28 Apr 2022 15:21:02 +0000 (08:21 -0700)]
[Driver] Add f16 support to -mrecip parsing.

This is a followup to D120158 which added an 'h' suffix to the
backend handling.

Reviewed By: spatel

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

2 years ago[RISCV] Fix alias printing for vmnot.m
Craig Topper [Thu, 28 Apr 2022 15:20:42 +0000 (08:20 -0700)]
[RISCV] Fix alias printing for vmnot.m

By clearing the HasDummyMask flag from mask register binary operations
and mask load/store.

HasDummyMask was causing an extra operand to get appended when
converting from MachineInstr to MCInst. This extra operand doesn't
appear in the assembly string so was mostly ignored, but it prevented
the alias instruction printing from working correctly.

Reviewed By: arcbbb

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

2 years ago[VPlan] Fix comment formatting from 43842b887e.
Florian Hahn [Thu, 28 Apr 2022 15:31:48 +0000 (16:31 +0100)]
[VPlan] Fix comment formatting from 43842b887e.

2 years ago[VPlan] Remove uneeded needsVectorIV check.
Florian Hahn [Thu, 28 Apr 2022 15:27:34 +0000 (16:27 +0100)]
[VPlan] Remove uneeded needsVectorIV check.

Remove one of the last remaining uses of ::needsVectorIV, preparing for
its removal. Now that usesScalars is available and based on the
information explicit in VPlan, there is no need to use the pre-computed
needsVectorIV.

Reviewed By: Ayal

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

2 years ago[mlir][emitc] Replace !emitc.opaque pointers
Marius Brehler [Thu, 28 Apr 2022 15:18:12 +0000 (15:18 +0000)]
[mlir][emitc] Replace !emitc.opaque pointers

Replaces using !emitc.opaque pointers which using !emitc.ptr types.

2 years ago[lldb] Remove patch reject file (.rej)
Jonas Devlieghere [Thu, 28 Apr 2022 15:16:26 +0000 (08:16 -0700)]
[lldb] Remove patch reject file (.rej)

2 years ago[HIP] Add HIP runtime library arguments for linker
Yaxun (Sam) Liu [Wed, 27 Apr 2022 16:23:52 +0000 (12:23 -0400)]
[HIP] Add HIP runtime library arguments for linker

Add -L -l options for linker.

Reviewed by: Artem Belevich

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

2 years agoRevert "[COST]Improve cost model for shuffles in SLP."
Alexey Bataev [Thu, 28 Apr 2022 14:49:37 +0000 (07:49 -0700)]
Revert "[COST]Improve cost model for shuffles in SLP."

This reverts commit 29a470e3804ca216d4e76c88a38086eb61c200f9 to fix
a crash reported in https://reviews.llvm.org/D100486#3479989.

2 years ago[NFC][libc++][format] Enable unit tests.
Mark de Wever [Sat, 23 Apr 2022 17:50:31 +0000 (19:50 +0200)]
[NFC][libc++][format] Enable unit tests.

The GCC failures were partly fixed in D124103.

The format functions tests are fixed on GCC but they require a huge
amount of RAM (>10 GB). This fails with parallel testing in the CI. It
can be solved by splitting the test, but GCC-12 will be released shortly
and might fix the memory usage in these tests. Therefore these tests
remain disabled.

Reviewed By: #libc, ldionne

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

2 years ago[X86] getBT - attempt to peek through aext(and(trunc(x),c)) mask/modulo
Simon Pilgrim [Thu, 28 Apr 2022 15:01:33 +0000 (16:01 +0100)]
[X86] getBT - attempt to peek through aext(and(trunc(x),c)) mask/modulo

Ideally we'd fold this with generic DAGCombiner, but that only works for !isTruncateFree cases - we might be able to adapt IsDesirableToPromoteOp to find truncated src ops in the future, but for now just use this peephole.

Noticed in Issue #55138

2 years ago[mlir][emitc] Disallow !emitc.opaque pointers
Marius Brehler [Tue, 19 Apr 2022 09:23:44 +0000 (09:23 +0000)]
[mlir][emitc] Disallow !emitc.opaque pointers

Fordbids to express pointer via the `!emitc.opaque` type. Point the user
to use the `!emitc.ptr` type instead.

Reviewed By: jpienaar

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

2 years ago[PS5] Rename a test to reflect its new purpose
Paul Robinson [Thu, 28 Apr 2022 15:07:36 +0000 (08:07 -0700)]
[PS5] Rename a test to reflect its new purpose

2 years ago[demangler] Fix demangling a template argument which happens to be a null pointer
gbreynoo [Thu, 28 Apr 2022 14:55:26 +0000 (15:55 +0100)]
[demangler] Fix demangling a template argument which happens to be a null pointer

As seen in https://github.com/llvm/llvm-project/issues/51854
llvm-cxxfilt was having trouble demangling the case "_Z1fIDnLDn0EEvv".
We handled the "LDNE" case and "LPi0E" but not "LDn0E". This change adds
that handling.

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

2 years ago[PS5] Set default cpu to znver2, with no tuning
Paul Robinson [Thu, 28 Apr 2022 14:50:20 +0000 (07:50 -0700)]
[PS5] Set default cpu to znver2, with no tuning

2 years ago[test][NewPM] Use -passes=loop-vectorize instead of -loop-vectorize
Bjorn Pettersson [Thu, 28 Apr 2022 14:46:00 +0000 (16:46 +0200)]
[test][NewPM] Use -passes=loop-vectorize instead of -loop-vectorize

Update a bunch of loop-vectorize regression tests to use the new PM
syntax (opt -passes=loop-vectorize) instead of the deprecated legacy
PM syntax (opt -loop-vectorize).

2 years ago[PS5] Disable exceptions by default
Paul Robinson [Thu, 28 Apr 2022 14:16:01 +0000 (07:16 -0700)]
[PS5] Disable exceptions by default

2 years ago[VecCombine] Add tests for removing shuffles from reductions. NFC
David Green [Thu, 28 Apr 2022 14:06:24 +0000 (15:06 +0100)]
[VecCombine] Add tests for removing shuffles from reductions. NFC

2 years ago[InstCombine][X86] Show failure to simplify demanded vector elts for x86 per-element...
Simon Pilgrim [Thu, 28 Apr 2022 14:00:38 +0000 (15:00 +0100)]
[InstCombine][X86] Show failure to simplify demanded vector elts for x86 per-element vector shifts

2 years ago[lldb] Add FixAnyAddress to ABI plugins
David Spickett [Wed, 13 Apr 2022 12:27:46 +0000 (13:27 +0100)]
[lldb] Add FixAnyAddress to ABI plugins

FixAnyAddress is to be used when we don't know or don't care
whether we're fixing a code or data address.

By using FixAnyAddress over the others, you document that no
specific choice was made.

On all existing platforms apart from Arm Thumb, you could use
either FixCodeAddress or FixDataAddress and be fine. Up until
now I've chosen to use FixDataAddress but if I had
chosen to use FixCodeAddress that would have broken Arm Thumb.

Hence FixAnyAddress, to give you the "safest" option when you're
in generic code.

Uses of FixDataAddress in memory region code have been changed
to FixAnyAddress. The functionality is unchanged.

Reviewed By: omjavaid, JDevlieghere

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

2 years ago[ArgPromotion] Rename variables according to the code style. NFC
Pavel Samolysov [Thu, 28 Apr 2022 13:31:00 +0000 (15:31 +0200)]
[ArgPromotion] Rename variables according to the code style. NFC

Some loop counters ('i', 'e') and variables ('type') were named not
in accordance with the code style and clang-tidy issues warnings
about the using of such variables. This patch renames the variables
and fixes some typos in the comments within the source file.

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

2 years ago[AArch64] Add a fp128 shuffle test. NFC
David Green [Thu, 28 Apr 2022 13:28:45 +0000 (14:28 +0100)]
[AArch64] Add a fp128 shuffle test. NFC

These legalize to scalar types, so it's useful to have a test case that
covers them.

2 years ago[Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [2/2]
Chris Jackson [Thu, 28 Apr 2022 13:10:25 +0000 (14:10 +0100)]
[Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [2/2]

Reland 3f2b76ec90b5f108272a3072a1345ba55d8ec75b with the test corrected
to require x86-registered-target.

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

2 years agotry to fix check-llvm on windows after e39e9d33
Nico Weber [Thu, 28 Apr 2022 13:16:10 +0000 (09:16 -0400)]
try to fix check-llvm on windows after e39e9d33

2 years ago[lldb/DWARF] Fix a typo in 57f99d0dc3
Pavel Labath [Thu, 28 Apr 2022 12:43:55 +0000 (14:43 +0200)]
[lldb/DWARF] Fix a typo in 57f99d0dc3

The lambda should take a reference argument.

2 years agollvm-reduce: Don't check tool name in error message check
Matt Arsenault [Thu, 28 Apr 2022 13:09:41 +0000 (09:09 -0400)]
llvm-reduce: Don't check tool name in error message check

Windows is being difficult and I don't know how to check the program name here

2 years agoRevert "[Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [2/2]"
Chris Jackson [Thu, 28 Apr 2022 13:06:34 +0000 (14:06 +0100)]
Revert "[Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [2/2]"

This reverts commit 3f2b76ec90b5f108272a3072a1345ba55d8ec75b.

2 years ago[InstCombine] Fold or of icmp ne trunc/and
Nikita Popov [Thu, 28 Apr 2022 12:44:24 +0000 (14:44 +0200)]
[InstCombine] Fold or of icmp ne trunc/and

This adds the de Morgan conjugated variant for the existing
"and eq" style fold.

Proof: https://alive2.llvm.org/ce/z/tkNAcG

2 years ago[Flang] Initial lowering of the Fortran Do loop
Kiran Chandramohan [Thu, 28 Apr 2022 12:20:11 +0000 (12:20 +0000)]
[Flang] Initial lowering of the Fortran Do loop

This patch adds code to lower simple Fortran Do loops with loop control.
Lowering is performed by the the `genFIR` function when called with a
`Fortran::parser::DoConstruct`. `genFIR` function calls `genFIRIncrementLoopBegin`
then calls functions to lower the body of the loop and finally calls
the function `genFIRIncrementLoopEnd`. `genFIRIncrementLoopBegin` is
responsible for creating the FIR `do_loop` as well as storing the value of
the loop index to the loop variable. `genFIRIncrementLoopEnd` returns
the incremented value of the loop index and also stores the index value
outside the loop. This is important since the loop variable can be used
outside the loop. Information about a loop is collected in a structure
`IncrementLoopInfo`.

Note 1: Future patches will bring in lowering for unstructured,
infinite, while loops
Note 2: This patch is part of upstreaming code from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project.

Reviewed By: awarzynski

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Val Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Peter Klausler <pklausler@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
2 years ago[Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [2/2]
Chris Jackson [Thu, 28 Apr 2022 11:52:03 +0000 (12:52 +0100)]
[Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [2/2]

Reland commit 74273d575f9938d751a1c67862cffe553fe2de8b following a fix
for a memory leak. The DVIRecoveryRecord vectors now use unique_ptr.

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

2 years agore-roll-forward "[clang] Mark `trivial_abi` types as "trivially relocatable"".""
Devin Jeanpierre [Thu, 28 Apr 2022 12:02:36 +0000 (14:02 +0200)]
re-roll-forward "[clang] Mark `trivial_abi` types as "trivially relocatable"".""

This reverts commit b0bc93da926a943cdc2d8b04f8dcbe23a774520c.

Changes: `s/_WIN32/_WIN64/g` in clang/test/SemaCXX/attr-trivial-abi.cpp.

The calling convention is specific to 64-bit windows. It's even in the name: `CCK_MicrosoftWin64`.

After this, the test passes with both `-triple i686-pc-win32` and `-triple x86_64-pc-win32`. Phew!

Reviewed By: gribozavr2

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

2 years ago[InstCombine] Add tests for or of icmp trunc/and (NFC)
Nikita Popov [Thu, 28 Apr 2022 12:40:42 +0000 (14:40 +0200)]
[InstCombine] Add tests for or of icmp trunc/and (NFC)

2 years ago[Sema][SVE2] Move/simplify Sema testing for SVE2 ACLE builtins
Rosie Sumpter [Tue, 12 Apr 2022 12:17:49 +0000 (13:17 +0100)]
[Sema][SVE2] Move/simplify Sema testing for SVE2 ACLE builtins

Currently for SVE2 ACLE builtins, single tests are used to verify both
clang code generation (when the feature is available) and semantic
error/warning messages (when the feature is unavailable). This WIP
patch moves the semantic testing for the values of immediate arguments
into dedicated Sema tests.

2 years ago[gn build] (manually) port 0f1b5f115a7f
Nico Weber [Thu, 28 Apr 2022 12:39:12 +0000 (08:39 -0400)]
[gn build] (manually) port 0f1b5f115a7f

2 years ago[clangd] Record latency for ASTSignal derivation
Kadir Cetinkaya [Thu, 28 Apr 2022 12:27:43 +0000 (14:27 +0200)]
[clangd] Record latency for ASTSignal derivation

2 years agoUse `-text` git attribute instead of `text eol=...`
Michael Forster [Thu, 28 Apr 2022 10:54:49 +0000 (12:54 +0200)]
Use `-text` git attribute instead of `text eol=...`

These automatic conversions lead to issues in various workflows, and all
we want here are files that retain their line endings under all
circumstances. `-text` captures that perfectly well and leads to fewer
issues.

It is preferable to `binary`, because with `-text` we still get textual
diffs.

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

2 years ago[mlir][spirv] Remove layout decoration on unneeded storage classes
Lei Zhang [Thu, 28 Apr 2022 12:18:08 +0000 (08:18 -0400)]
[mlir][spirv] Remove layout decoration on unneeded storage classes

Per SPIR-V validation rules, explict layout decorations are only
needed for StorageBuffer, PhysicalStorageBuffer, Uniform, and
PushConstant storage classes. (And even that is for Shader
capabilities). So we don't need such decorations on the rest.

Reviewed By: hanchung

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

2 years ago[mlir][spirv] Convert memref.alloca to spv.Variable
Lei Zhang [Thu, 28 Apr 2022 12:13:22 +0000 (08:13 -0400)]
[mlir][spirv] Convert memref.alloca to spv.Variable

Reviewed By: hanchung

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

2 years ago[X86] Add test case for Issue #55158
Simon Pilgrim [Thu, 28 Apr 2022 12:06:48 +0000 (13:06 +0100)]
[X86] Add test case for Issue #55158

2 years ago[NVPTX] Integrate ptxas to LIT tests
Andrew Savonichev [Wed, 27 Apr 2022 19:43:55 +0000 (22:43 +0300)]
[NVPTX] Integrate ptxas to LIT tests

ptxas is a proprietary compiler from Nvidia that can compile PTX to
machine code (SASS). It has a lot of diagnostics to catch errors
in PTX, which can be used to verify PTX output from llc.

Set -DPXTAS_EXECUTABLE=/path/to/ptxas CMake option to enable it.
If this option is not set, then ptxas is substituted to true which
effectively disables all ptxas RUN lines.

LLVM_PTXAS_EXECUTABLE environment variable takes precedence over
the CMake option, and allows to override ptxas executable that is used for LIT
without complete re-configuration.

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

2 years ago[clang-tidy] support --load in clang-tidy-diff.py/run-clang-tidy.py
Bernhard Manfred Gruber [Fri, 8 Apr 2022 12:45:00 +0000 (14:45 +0200)]
[clang-tidy] support --load in clang-tidy-diff.py/run-clang-tidy.py

Support for loading shared objects as plugins into clang-tidy was added
in http://reviews.llvm.org/D111100. Unfortunately, the utility scripts
`clang-tidy-diff.py` and `run-clang-tidy.py` did not receive
corresponding arguments to forward such plugins to clang-tidy.
This diff adds a `-load=plugin` option to both scripts.

Differential Revision: http://reviews.llvm.org/D12306

Reviewed By: aaron.ballman

2 years ago[X86] getFauxShuffle - don't assume an UNDEF src element for AND/ANDNP results in...
Simon Pilgrim [Thu, 28 Apr 2022 11:32:58 +0000 (12:32 +0100)]
[X86] getFauxShuffle - don't assume an UNDEF src element for AND/ANDNP results in an UNDEF shuffle mask index

The other src element might be zero, guaranteeing zero.

Fixes #55157

2 years agoRevert rG8680dd5117b0c36f807fecc4360122ae1dd73b6d "[X86] getFauxShuffle - don't assum...
Simon Pilgrim [Thu, 28 Apr 2022 11:25:14 +0000 (12:25 +0100)]
Revert rG8680dd5117b0c36f807fecc4360122ae1dd73b6d "[X86] getFauxShuffle - don't assume an UNDEF src element for AND/ANDNP results in an UNDEF shuffle mask index"

I screwed up the merge somehow.

2 years ago[X86] getFauxShuffle - don't assume an UNDEF src element for AND/ANDNP results in...
Simon Pilgrim [Thu, 28 Apr 2022 10:54:18 +0000 (11:54 +0100)]
[X86] getFauxShuffle - don't assume an UNDEF src element for AND/ANDNP results in an UNDEF shuffle mask index

The other src element might be zero, guaranteeing zero.

Fixes #55157

2 years agoRevert "[llvm-pdbutil] Add options to only dump symbol record at specified offset...
Michael Forster [Thu, 28 Apr 2022 10:38:03 +0000 (12:38 +0200)]
Revert "[llvm-pdbutil] Add options to only dump symbol record at specified offset and its parents or children with spcified depth."

This reverts commit a3b7cb015fd5fd2aa98afda8ae22759576ce2888.

symbol-offset.test fails under MSAN:

[  1] ; RUN: llvm-pdbutil yaml2pdb %p/Inputs/symbol-offset.yaml --pdb=%t.pdb [FAIL]
llvm-pdbutil yaml2pdb <REDACTED>/llvm/test/tools/llvm-pdbutil/Inputs/symbol-offset.yaml --pdb=<REDACTED>/tmp/symbol-offset.test/symbol-offset.test.tmp.pdb
==9283==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55f975e5eb91 in __libcpp_tls_set <REDACTED>/include/c++/v1/__threading_support:428:12
    #1 0x55f975e5eb91 in set_pointer <REDACTED>/include/c++/v1/thread:196:5
    #2 0x55f975e5eb91 in void* std::__msan::__thread_proxy<std::__msan::tuple<std::__msan::unique_ptr<std::__msan::__thread_struct, std::__msan::default_delete<std::__msan::__thread_struct> >, llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::ThreadPoolExecutor(llvm::ThreadPoolStrategy)::'lambda'()::operator()() const::'lambda'()> >(void*) <REDACTED>/include/c++/v1/thread:285:27
    #3 0x7f74a1e55b54 in start_thread (<REDACTED>/libpthread.so.0+0xbb54) (BuildId: 64752de50ebd1a108f4b3f8d0d7e1a13)
    #4 0x7f74a1dc9f7e in clone (<REDACTED>/libc.so.6+0x13cf7e) (BuildId: 7cfed7708e5ab7fcb286b373de21ee76)

2 years ago[flang][driver] Fix spelling (nfc)
Andrzej Warzynski [Thu, 28 Apr 2022 10:07:13 +0000 (10:07 +0000)]
[flang][driver] Fix spelling (nfc)

Merely making sure that we use consistent spelling.

2 years ago[X86] Add test case for Issue #55157
Simon Pilgrim [Thu, 28 Apr 2022 10:18:37 +0000 (11:18 +0100)]
[X86] Add test case for Issue #55157

2 years ago[RS4GC] Add tests showing cases in which we could find a better base (NFC)
Dmitry Makogon [Thu, 28 Apr 2022 10:01:58 +0000 (17:01 +0700)]
[RS4GC] Add tests showing cases in which we could find a better base (NFC)

2 years ago[flang] Support FINDLOC/MAXLOC/MINLOC with scalar mask
Mike Kashkarov [Thu, 28 Apr 2022 09:57:51 +0000 (18:57 +0900)]
[flang] Support FINDLOC/MAXLOC/MINLOC with scalar mask

Previously MASK= elements were accessed in assumption that mask is an array of
input argument rank (and in combination with explicit DIM= argument we had
out-of-bounds access), but for MAXLOC/MINLOC/FINDLOC mask should be be
conformable and could be scalar.

Add new regression tests with scalar mask for verification.

Reviewed By: klausler

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

2 years ago[flang] Fix UBOUND() constant folding for parentheses expr
Mike Kashkarov [Thu, 28 Apr 2022 09:56:16 +0000 (18:56 +0900)]
[flang] Fix UBOUND() constant folding for parentheses expr

Similarly to LBOUND((x)) in https://reviews.llvm.org/D123838 - fix UBOUND((x))
folding for constant arrays to return shape instead of recurse scan.

Depends on D123520

Reviewed By: jeanPerier

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

2 years ago[Analyzer] Remove undefined function
Marco Antognini [Wed, 20 Apr 2022 09:56:19 +0000 (11:56 +0200)]
[Analyzer] Remove undefined function

This getLValue function was declared in 98db1f990fc2 ([Analyzer] [NFC]
Parameter Regions, 2020-05-11) but was never implemented.

Reviewed By: NoQ

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

2 years ago[ARM] add Armv9 build attribute
Ties Stuij [Thu, 28 Apr 2022 09:23:54 +0000 (10:23 +0100)]
[ARM] add Armv9 build attribute

The build attribute number can be found in the Arm ABI addenda32 document:
https://github.com/ARM-software/abi-aa/blob/main/addenda32/addenda32.rst#335target-related-attributes

Reviewed By: tmatheson

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

2 years ago[AST] Improve traversal of concepts and concept requirements
Ilya Biryukov [Thu, 28 Apr 2022 08:39:47 +0000 (08:39 +0000)]
[AST] Improve traversal of concepts and concept requirements

- Do not traverse concept decl inside `AutoType`. We only traverse
  declaration and definitions, not references to a declaration.
- Do not visit implicit AST node the relevant traversal mode.
- Add traversal extension points for concept requirements.
- Renamed `TraverseConceptReference` to mark as helper to share
  the code. Having an extension point there seems confusing given that
  there are many concept refences in the AST that do not call the
  helper. Those are `AutoType`, `AutoTypeLoc` and constraint requirements.

Only clangd code requires an update.

There are no use-cases for concept requirement traversals yet, but
I added them in the earlier version of the patch and decided to keep
them for completeness.

Reviewed By: sammccall

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

2 years ago[clang-format] add a regression test for include sorting
Krasimir Georgiev [Thu, 28 Apr 2022 09:01:27 +0000 (11:01 +0200)]
[clang-format] add a regression test for include sorting

This adds a regression test from the comments
on https://reviews.llvm.org/D121370.

Reviewed By: MyDeveloperDay, curdeius

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

2 years agoRevert "[clang-format] SortIncludes should support "@import" lines in Objective-C"
Krasimir Georgiev [Thu, 28 Apr 2022 08:58:46 +0000 (10:58 +0200)]
Revert "[clang-format] SortIncludes should support "@import" lines in Objective-C"

This reverts commit d46fa023caa2db5a9f1e21dd038bcb626261d958.
Regressed include order in some cases with trailing comments, see the
comments on https://reviews.llvm.org/D121370. Will add a regression test
in a follow-up commit.

2 years ago[lldb] Reduce duplication in DWARFASTParserClang::CopyUniqueClassMethodTypes
Pavel Labath [Thu, 28 Apr 2022 08:57:35 +0000 (10:57 +0200)]
[lldb] Reduce duplication in DWARFASTParserClang::CopyUniqueClassMethodTypes

Use lambdas to replace identical bits of code.

2 years ago[RISCV] Support VP_SETCC mask operations
Lian Wang [Tue, 26 Apr 2022 01:46:27 +0000 (01:46 +0000)]
[RISCV] Support VP_SETCC mask operations

Support VP_SETCC mask operations, turn it to logical operation.

Reviewed By: craig.topper

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

2 years ago[mlir][SparseTensor] Enable VLA ops in index value generation
Javier Setoain [Tue, 26 Apr 2022 13:39:29 +0000 (14:39 +0100)]
[mlir][SparseTensor] Enable VLA ops in index value generation

Current index value generation uses fixed-length vector ops, this patch
adds an alterantive codegen path compatible with scalable vectors by
using `LLVM::StepVectorOp`.

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

2 years ago[CodeGen] Remove an outdated comment in MachinePointerInfo
Jay Foad [Thu, 28 Apr 2022 08:06:36 +0000 (09:06 +0100)]
[CodeGen] Remove an outdated comment in MachinePointerInfo

This comment has been untrue since D39758 changed
MachinePointerInfo to store AddrSpace separately from V.

2 years ago[GVN] Encode GEPs in offset representation
Nikita Popov [Wed, 27 Apr 2022 12:40:07 +0000 (14:40 +0200)]
[GVN] Encode GEPs in offset representation

When using opaque pointers, convert GEPs into offset representation
of the form P + V1 * Scale1 + V2 * Scale2 + ... + ConstantOffset.
This allows us to recognize equivalent address calculations even if
the GEPs don't use the same source element type.

This fixes an opaque pointer codegen regression seen in rustc.

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

2 years ago[X86][AMX] combine tile cast and load/store instruction.
Luo, Yuanke [Mon, 25 Apr 2022 11:23:28 +0000 (19:23 +0800)]
[X86][AMX] combine tile cast and load/store instruction.

The `llvm.x86.cast.tile.to.vector` intrinsic is lowered to
`llvm.x86.tilestored64.internal` and `load <256 x i32>`. The
`llvm.x86.cast.vector.to.tile` is lowered to `store <256 x i32>` and
`llvm.x86.tileloadd64.internal`. When `llvm.x86.cast.tile.to.vector` is
used by `store <256 x i32>` or `load <256 x i32>` is used by
`llvm.x86.cast.vector.to.tile`, they can be combined by
`llvm.x86.tilestored64.internal` and `llvm.x86.tileloadd64.internal`.

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

2 years ago[Driver][Solaris] -r: imply -nostdlib like GCC
Brad Smith [Thu, 28 Apr 2022 04:17:48 +0000 (00:17 -0400)]
[Driver][Solaris] -r: imply -nostdlib like GCC

Similar to D116843 for Gnu.cpp

Reviewed By: MaskRay

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

2 years ago[JumpThreading][NFC][CompileTime] Do not recompute BPI/BFI analyzes
Max Kazantsev [Thu, 28 Apr 2022 03:46:08 +0000 (10:46 +0700)]
[JumpThreading][NFC][CompileTime] Do not recompute BPI/BFI analyzes

They can already be available, and even if not, DT/LI can be available.
We should not recompute them. Old PM is unchanged because it would
require changing dependencies, and we don't care enough about it.

Differential Revision: https://reviews.llvm.org/D124439
Reviewed By: nikic, aeubanks

2 years ago[InferAddressSpaces] Check if AS are the same in isNoopPtrIntCastPair
Wenju He [Thu, 28 Apr 2022 02:47:26 +0000 (10:47 +0800)]
[InferAddressSpaces] Check if AS are the same in isNoopPtrIntCastPair

isNoopAddrSpaceCast is expecting SrcAS is different from DestAS.
If the two AS are the same, consider ptrtoint/inttoptr as noop cast.

Reviewed By: arsenm

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

2 years ago[XCORE][CodeGen][NFC] Use ArrayRef in TargetLowering functions
Liqin.Weng [Thu, 28 Apr 2022 02:06:27 +0000 (02:06 +0000)]
[XCORE][CodeGen][NFC] Use ArrayRef in TargetLowering functions

Reviewed By: nigelp-xmos

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

2 years ago[X86] Check the address in machine verifier
Shengchen Kan [Tue, 26 Apr 2022 14:29:09 +0000 (22:29 +0800)]
[X86] Check the address in machine verifier

1. The scale factor must be 1, 2, 4, 8
2. The displacement must fit in 32-bit signed integer

Noticed by: https://github.com/llvm/llvm-project/issues/55091

Reviewed By: pengfei

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

2 years ago[OpaquePtr][GlobalOpt] Don't attempt to evaluate global constructors with arguments
Arthur Eubanks [Wed, 27 Apr 2022 20:44:50 +0000 (13:44 -0700)]
[OpaquePtr][GlobalOpt] Don't attempt to evaluate global constructors with arguments

Previously all entries in global_ctors had to have the void()* type and
we'd skip evaluating bitcasted functions. With opaque pointers we may
see the function directly.

Fixes #55147.

Reviewed By: #opaque-pointers, nikic

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

2 years ago[flang] Add lowering stubs for OpenMP/OpenACC declarative constructs
Peixin-Qiao [Thu, 28 Apr 2022 01:40:30 +0000 (09:40 +0800)]
[flang] Add lowering stubs for OpenMP/OpenACC declarative constructs

This patch provides the basic infrastructure for lowering declarative
constructs for OpenMP and OpenACC.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: kiranchandramohan, shraiysh, clementval

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

2 years agoDrop '* text=auto' from .gitattributes and normalize
Aaron Puchert [Thu, 28 Apr 2022 01:05:09 +0000 (03:05 +0200)]
Drop '* text=auto' from .gitattributes and normalize

Git wants to check in 'text' files with LF endings, so this changes them
in the repository but not in the checkout, where they keep CRLF endings.

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

2 years agoFix test fail-file-open.test on Windows to hopefully fix the Windows buildbots.
Douglas Yung [Thu, 28 Apr 2022 00:28:57 +0000 (17:28 -0700)]
Fix test fail-file-open.test on Windows to hopefully fix the Windows buildbots.

2 years ago[lldb] Fix escaping when launching in terminal with AppleScript
Jonas Devlieghere [Wed, 27 Apr 2022 23:37:42 +0000 (16:37 -0700)]
[lldb] Fix escaping when launching in terminal with AppleScript

Fix escaping when launching in terminal with AppleScript. The invocation
we're building up is wrapped in single quotes when passed to bash and
wrapped in double quotes for AppleScript.

Here's an example invocation with the new escaping:

  tell application "Terminal"
    activate
          do script "/bin/bash -c 'arch -arch arm64 'darwin-debug'
            --unix-socket=/tmp/dL2jSh --arch=arm64 --working-dir
            \"/private/tmp/with spaces\" --disable-aslr --  \"foo\"
            \"bar\" \"baz\" ; echo Process exited with status $?';exit"
  end tell

Previously we were using unescaped single quotes which resulted in the
whole bash invocation being passed in pieces. That works most of the
time but breaks when you have a space in your current working directory
for example.

rdar://91870763

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

2 years ago[dsymutil] Fix memory issue in the BinaryHolder
Jonas Devlieghere [Wed, 27 Apr 2022 23:32:38 +0000 (16:32 -0700)]
[dsymutil] Fix memory issue in the BinaryHolder

The BinaryHolder has two caches for object and archive entries. These
are implemented as StringMaps of ObjectEntry and ArchiveEntry
respectively. The fact that they're stored by value is problematic
because the BinaryHolder hands out references that become invalidate
when the data structure grows. This patch wraps those object instances
in unique pointers and changes the interface to hand out pointers. This
resulted in transient failures.

rdar://90412671

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

2 years ago[LegacyPM] Remove ThreadSanitizerLegacyPass
Fangrui Song [Wed, 27 Apr 2022 23:25:41 +0000 (16:25 -0700)]
[LegacyPM] Remove ThreadSanitizerLegacyPass

Using the legacy PM for the optimization pipeline was deprecated in 13.0.0.
Following recent changes to remove non-core features of the legacy
PM/optimization pipeline, remove ThreadSanitizerLegacyPass.

Reviewed By: #sanitizers, vitalybuka

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

2 years agoRevert "[Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [2/2]"
Kirill Stoimenov [Wed, 27 Apr 2022 23:10:36 +0000 (23:10 +0000)]
Revert "[Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [2/2]"

This reverts commit 74273d575f9938d751a1c67862cffe553fe2de8b.

Buildbot: https://lab.llvm.org/buildbot/#/builders/5/builds/22795
Failing with memory leak.

2 years ago[llvm-symbolizer][native-pdb] Don't reset CurLineOffset if NextLineOffset is none
Zequan Wu [Wed, 27 Apr 2022 23:05:09 +0000 (16:05 -0700)]
[llvm-symbolizer][native-pdb] Don't reset CurLineOffset if NextLineOffset is none

2 years agoRevert "BranchFolder: Assert on SSA functions"
Matt Arsenault [Wed, 27 Apr 2022 23:01:24 +0000 (19:01 -0400)]
Revert "BranchFolder: Assert on SSA functions"

This reverts commit 6ff91d17d66da46572e97f9a0b042182762cbe9e.

2 years ago[modules] Merge equivalent extensions and diagnose ivar redeclarations for extensions...
Volodymyr Sapsai [Wed, 2 Mar 2022 04:08:01 +0000 (20:08 -0800)]
[modules] Merge equivalent extensions and diagnose ivar redeclarations for extensions loaded from different modules.

Emitting metadata for the same ivar multiple times can lead to
miscompilations. Objective-C runtime adds offsets to calculate ivar
position in memory and presence of duplicate offsets causes wrong final
position thus overwriting unrelated memory.

Such a situation is impossible with modules disabled as clang diagnoses
ivar redeclarations during sema checks after parsing
(`Sema::ActOnFields`). Fix the case with modules enabled by checking
during deserialization if ivar is already declared. We also support
a use case where the same category ends up in multiple modules. We
don't want to treat this case as ivar redeclaration and instead merge
corresponding ivars.

rdar://83468070

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

2 years agollvm-reduce: Fix incorrect cloning of MachineMemOperands
Matt Arsenault [Tue, 19 Apr 2022 17:51:20 +0000 (13:51 -0400)]
llvm-reduce: Fix incorrect cloning of MachineMemOperands

There were two problems with directly copying the MMOs from the old
function. The MMOs are owned by the function's Allocator, so need to
be reallocated anyways (surprisingly I didn't notice breakage on
this). Second, the PseudoSourceValues are also allocated per function
and need to be reallocated.

2 years agoBranchFolder: Assert on SSA functions
Matt Arsenault [Mon, 25 Apr 2022 12:12:32 +0000 (08:12 -0400)]
BranchFolder: Assert on SSA functions

We probably should have the opposite of getRequiredProperties for this

2 years ago[PS5] Enable dead-stripping globals in ASan
Paul Robinson [Wed, 27 Apr 2022 22:44:22 +0000 (15:44 -0700)]
[PS5] Enable dead-stripping globals in ASan

2 years ago[X86] Move target-generic code into CodeGen [NFC]
Bill Wendling [Wed, 27 Apr 2022 22:37:08 +0000 (15:37 -0700)]
[X86] Move target-generic code into CodeGen [NFC]

This code is the same for all platforms.

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

2 years agollvm-reduce: Fix crashing on file opening error for mir path
Matt Arsenault [Fri, 22 Apr 2022 21:40:25 +0000 (17:40 -0400)]
llvm-reduce: Fix crashing on file opening error for mir path

2 years agollvm-reduce: Support multiple MachineFunctions
Matt Arsenault [Tue, 19 Apr 2022 02:19:57 +0000 (22:19 -0400)]
llvm-reduce: Support multiple MachineFunctions

The current testcase I'm trying to reduce only reproduces with IPRA
enabled and requires handling multiple functions.

The only real difference vs. the IR is the extra indirect to look for
the underlying MachineFunction, so treat the ReduceWorkItem as the
module instead of the function.

The ugliest piece of this is really the ugliness of
MachineModuleInfo. It not only tracks actual module state, but has a
number of transient fields used for isel and/or the asm printer. These
shouldn't do any harm for the use here, though they should be
separated out.