platform/upstream/llvm.git
2 years ago[NFC][CUDA][HIP] rework mangling number for aux target
Yaxun (Sam) Liu [Tue, 3 May 2022 11:48:37 +0000 (07:48 -0400)]
[NFC][CUDA][HIP] rework mangling number for aux target

CUDA/HIP needs to mangle for aux target. When mangling for aux target,
the mangler should use mangling number for aux target. Previously
in https://reviews.llvm.org/D122734 a state was introduced in
ASTContext to let the mangler get mangling number for aux target
from ASTContext. This patch removes that state from ASTConext
and add an IsAux member to MangleContext to indicate that
the mangle context is for aux target. This reflects the reality that
the mangle context is created for mangling aux target and makes
ASTContext cleaner.

Reviewed by: Artem Belevich, Reid Kleckner

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

2 years ago[mlir][sparse][taco] Support more data types.
Bixia Zheng [Wed, 4 May 2022 14:36:03 +0000 (07:36 -0700)]
[mlir][sparse][taco] Support more data types.

Support int8, int16, int32 and int32. Also fix source code format in mlir_pytaco_utils.py.

Add tests.

Reviewed By: aartbik

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

2 years ago[clang] Track how headers get included generally during lookup time
Cyndy Ishida [Wed, 4 May 2022 14:38:20 +0000 (07:38 -0700)]
[clang] Track how headers get included generally during lookup time

tapi & clang-extractapi both attempt to construct then check against
how a header was included to determine api information when working
against multiple search paths, headermap, and vfsoverlay mechanisms.
Validating this against what the preprocessor sees during lookup time
makes this check more reliable.

Reviewed By: zixuw, jansvoboda11

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

2 years agoFix a crash on invalid with _Generic expressions
Aaron Ballman [Wed, 4 May 2022 16:39:18 +0000 (12:39 -0400)]
Fix a crash on invalid with _Generic expressions

We were failing to check if the controlling expression is dependent or
not when testing whether it has side effects. This would trigger an
assertion. Instead, if the controlling expression is dependent, we
suppress the check and diagnostic.

This fixes Issue 50227.

2 years ago[VPlan] Add test for printing plan with an exit value.
Florian Hahn [Wed, 4 May 2022 16:19:02 +0000 (17:19 +0100)]
[VPlan] Add test for printing plan with an exit value.

Test for printing plan with additions from D123537.

2 years ago[InstCombine] propagate FMF when reordering intrinsics and shuffles
Sanjay Patel [Wed, 4 May 2022 16:01:53 +0000 (12:01 -0400)]
[InstCombine] propagate FMF when reordering intrinsics and shuffles

This was missed when extending the fold to allow fma with
9c4770eaab9d95c

2 years ago[InstCombine] add FMF to tests for better coverage; NFC
Sanjay Patel [Wed, 4 May 2022 15:58:01 +0000 (11:58 -0400)]
[InstCombine] add FMF to tests for better coverage; NFC

The fold added with 9c4770eaab9d95c neglected to propagate FMF.

2 years ago[Sema] Simplify CheckConstraintSatisfaction. NFC
Ilya Biryukov [Wed, 4 May 2022 15:31:59 +0000 (15:31 +0000)]
[Sema] Simplify CheckConstraintSatisfaction. NFC

- Exit early when constraint caching is disabled.
- Use unique_ptr to manage temporary lifetime.
- Fix a typo in a comment (InsertPos instead of InsertNode).

The new code duplicates the forwarding call to CheckConstraintSatisfaction,
but reduces the number of interconnected if statements and simplifies lifetime
management.

This increases the overall readability.

Reviewed By: sammccall

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

2 years ago[InstCombine] move shuffle after fma with same-shuffled operands
Sanjay Patel [Wed, 4 May 2022 15:17:25 +0000 (11:17 -0400)]
[InstCombine] move shuffle after fma with same-shuffled operands

https://alive2.llvm.org/ce/z/sD-JVv

This extends 432c199e8473 with a 3 arg intrinsic to demonstrate
that the code works with the extra operand.

Eventually, we will want to use llvm::isTriviallyVectorizable()
or create some new API for this list, but for now, I am intentionally
making a minimum change to reduce risk and only affect an intrinsic
with regression tests in place.

2 years ago[InstCombine] add tests for fma with shuffled operands; NFC
Sanjay Patel [Wed, 4 May 2022 15:11:47 +0000 (11:11 -0400)]
[InstCombine] add tests for fma with shuffled operands; NFC

2 years ago[mlir] Add a flag to allow equivalent results.
Alexander Belyaev [Wed, 4 May 2022 15:46:17 +0000 (17:46 +0200)]
[mlir] Add a flag to allow equivalent results.

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

2 years ago[clang][dataflow] Only skip ExprWithCleanups when visiting terminators
Eric Li [Mon, 2 May 2022 21:36:04 +0000 (21:36 +0000)]
[clang][dataflow] Only skip ExprWithCleanups when visiting terminators

`IgnoreParenImpCasts` will remove implicit casts to bool
(e.g. `PointerToBoolean`), such that the resulting expression may not
be of the `bool` type. The `cast_or_null<BoolValue>` in
`extendFlowCondition` will then trigger an assert, as the pointer
expression will not have a `BoolValue`.

Instead, we only skip `ExprWithCleanups` and `ParenExpr` nodes, as the
CFG does not emit them.

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

2 years ago[VectorCombine] Add tests for shuffle binops patterns. NFC
David Green [Wed, 4 May 2022 14:07:47 +0000 (15:07 +0100)]
[VectorCombine] Add tests for shuffle binops patterns. NFC

2 years ago[RISCV] Add a test showing incorrect VSETVLI insertion
Fraser Cormack [Wed, 20 Apr 2022 13:12:23 +0000 (14:12 +0100)]
[RISCV] Add a test showing incorrect VSETVLI insertion

This test shows incorrect cross-bb insertion. We'd expect to see
a SEW=8 vsetvli, something like:

        vsetvli zero, zero, e8, mf8, ta, mu
        vluxei64.v      v1, (a2), v8, v0.t

But instead the vsetvli is omitted and instead an inherited SEW=64
vsetvli is used:
        vmv1r.v v9, v1
        vsetvli a3, zero, e64, m1, ta, mu
        vmseq.vi        v9, v1, 0
        vmv1r.v v8, v0
        vmandn.mm       v0, v9, v2
        beqz    a0, .LBB0_2
    # %bb.1:
        vluxei64.v      v1, (a2), v8, v0.t
        vmv1r.v v3, v1

The "mask reg op" vmandn.mm in bb.1 appears to be confusing the insertion
process, as it is able to elide its own vsetvli as its VLMAX (SEW=8,
LMUL=MF8) is identical to the previous one (SEW=64, LMUL=1).

Reviewed By: craig.topper

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

2 years ago[SDAG] Handle truncated not in haveNoCommonBitsSet()
Nikita Popov [Tue, 3 May 2022 15:06:46 +0000 (17:06 +0200)]
[SDAG] Handle truncated not in haveNoCommonBitsSet()

Demanded bits analysis may replace a full-width not with a
any_extend (not (truncate X)) pattern. This patch looks through
this kind of pattern in haveNoCommonBitsSet(). Of course, we can
only do this if we only need negated bits in the non-extended part,
as the other bits may now be arbitrary. For example, if we have
haveNoCommonBitsSet(~X & Y, X) then ~X only needs to actually
negate bits set in Y.

This is only a partial solution to the problem in that it allows
add -> or conversion, but the resulting or doesn't get folded yet.
(I guess that will involve exposing getBitwiseNotOperand() as a
more general helper and using that in the relevant transform.)

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

2 years ago[SCEV] Add additional poison implication tests (NFC)
Nikita Popov [Wed, 4 May 2022 13:23:19 +0000 (15:23 +0200)]
[SCEV] Add additional poison implication tests (NFC)

2 years ago[X86] Fix uninitialized variable warnings in cetintrin.h reported by #55224
Phoebe Wang [Wed, 4 May 2022 11:21:13 +0000 (19:21 +0800)]
[X86] Fix uninitialized variable warnings in cetintrin.h reported by #55224

Fix uninitialized variables introduced by D116325.

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

2 years agoDo not rely on implicit int for this test
Aaron Ballman [Wed, 4 May 2022 13:06:16 +0000 (09:06 -0400)]
Do not rely on implicit int for this test

This should address failing test bots:
https://lab.llvm.org/buildbot/#/builders/68/builds/31828

2 years agoBump the serialization major version number
Aaron Ballman [Wed, 4 May 2022 13:05:07 +0000 (09:05 -0400)]
Bump the serialization major version number

This is a speculative fix for a build bot which does not put the LLVM
revision information into the PCH hash.

http://45.33.8.238/linux/75290/step_7.txt

2 years ago[AArch64][SVE] Restore SP from FP when SVE CSRs and variable sized objects are present
Bradley Smith [Thu, 28 Apr 2022 11:11:11 +0000 (11:11 +0000)]
[AArch64][SVE] Restore SP from FP when SVE CSRs and variable sized objects are present

Without SVE, after a dynamic stack allocation has modified the SP, it is
presumed that a frame pointer restoration will revert the SP back to
it's correct value prior to any caller stack being restored. However the
SVE frame is restored using the stack pointer directly, as it is located
after the frame pointer. This means that in the presence of a dynamic
stack allocation, any SVE callee state gets corrupted as SP has the
incorrect value when the SVE state is restored.

To address this issue, when variable sized objects and SVE CSRs are
present, treat the stack as having been realigned, hence restoring the
stack pointer from the frame pointerr prior to restoring the SVE state.

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

2 years ago[InstCombine] Fix commuted tests (NFC)
Nikita Popov [Wed, 4 May 2022 12:52:31 +0000 (14:52 +0200)]
[InstCombine] Fix commuted tests (NFC)

As pointed out on D124710, these need more thwarting.

2 years ago[SCEV] Add poison implication tests for umin_seq (NFC)
Nikita Popov [Wed, 4 May 2022 12:47:26 +0000 (14:47 +0200)]
[SCEV] Add poison implication tests for umin_seq (NFC)

2 years agoFix failing buildbot for lldb
Aaron Ballman [Wed, 4 May 2022 12:42:52 +0000 (08:42 -0400)]
Fix failing buildbot for lldb

This should address the issue found by:
https://lab.llvm.org/buildbot/#/builders/68/builds/31827

2 years agoChange the behavior of implicit int diagnostics
Aaron Ballman [Wed, 4 May 2022 12:34:26 +0000 (08:34 -0400)]
Change the behavior of implicit int diagnostics

C89 allowed a type specifier to be elided with the resulting type being
int, aka implicit int behavior. This feature was subsequently removed
in C99 without a deprecation period, so implementations continued to
support the feature. Now, as with implicit function declarations, is a
good time to reevaluate the need for this support.

This patch allows -Wimplicit-int to issue warnings in C89 mode (off by
default), defaults the warning to an error in C99 through C17, and
disables support for the feature entirely in C2x. It also removes a
warning about missing declaration specifiers that really was just an
implicit int warning in disguise and other minor related cleanups.

2 years ago[X86] Fix redundant `%s` in RUN command. NFC
Phoebe Wang [Wed, 4 May 2022 12:28:12 +0000 (20:28 +0800)]
[X86] Fix redundant `%s` in RUN command. NFC

2 years ago[flang][driver] Define the default frontend driver triple
Andrzej Warzynski [Thu, 28 Apr 2022 14:12:32 +0000 (14:12 +0000)]
[flang][driver] Define the default frontend driver triple

*SUMMARY*
Currently, the frontend driver assumes that a target triple is either:
  * provided by the frontend itself (e.g. when lowering and generating
    code),
  * specified through the `-triple/-target` command line flags.

If `-triple/-target` is not used, the frontend will simply use the host
triple.

This is going to be insufficient when e.g. consuming an LLVM IR file
that has no triple specified (reading LLVM files is WIP, see D124667).
We shouldn't require the triple to be specified via the command line in
such situation. Instead, the frontend driver should contain a good
default, e.g.  the host triple.

This patch updates Flang's `CompilerInvocation` to do just that, i.e.
defines its default target triple. Similarly to Clang:
 * the default `CompilerInvocation` triple is set as the host triple,
 * the value specified with `-triple` takes precedence over the frontend
   driver default and the current module triple,
 * the frontend driver default takes precedence over the module triple.

*TESTS*
This change requires 2 unit tests to be updated. That's because relevant
frontend actions are updated to assume that there's always a valid
triple available in the current `CompilerInvocation`. This update is
required because the unit tests bypass the regular `CompilerInvocation`
set-up (in particular, they don't call
`CompilerInvocation::CreateFromArgs`). I've also taken the liberty to
disable the pre-precossor formatting in the affected unit tests as well
(it is not required).

No new tests are added. As `flang-new -fc1` does not support consuming
LLVM IR files just yet, it is not possible to compile an LLVM IR file
without a triple. More specifically, atm all LLVM IR files are generated
and stored internally and the driver makes sure that these contain a
valid target triple. This is about to change in D124667 (which adds
support for reading LLVM IR/BC files) and that's where tests for
exercising the default frontend driver triple will be added.

*WHAT DOES CLANG DO?*
For reference, the default target triple for Clang's
`CompilerInvocation` is set through option marshalling infra [1] in
Options.td. Please check the definition of the `-triple` flag:
```
def triple : Separate<["-"], "triple">,
  HelpText<"Specify target triple (e.g. i686-apple-darwin9)">,
  MarshallingInfoString<TargetOpts<"Triple">, "llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple())">,
  AlwaysEmit, Normalizer<"normalizeTriple">;
```
Ideally, we should re-use the marshalling infra in Flang.

[1] https://clang.llvm.org/docs/InternalsManual.html#option-marshalling-infrastructure

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

2 years ago[CMake] Make omitting CMAKE_BUILD_TYPE an error
Tobias Hieta [Fri, 29 Apr 2022 09:42:06 +0000 (11:42 +0200)]
[CMake] Make omitting CMAKE_BUILD_TYPE an error

After a lot of discussion in this diff the consensus was that it is really hard to guess the users intention with their LLVM build. Instead of trying to guess if Debug or Release is the correct default option we opted for just not specifying CMAKE_BUILD_TYPE a error.

Discussion on discourse here:
https://discourse.llvm.org/t/rfc-select-a-better-linker-by-default-or-warn-about-using-bfd

Reviewed By: hans, mehdi_amini, aaron.ballman, jhenderson, MaskRay, awarzynski

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

2 years ago[X86] load-local illegal types tests - expose the load/store stack offsets
Simon Pilgrim [Wed, 4 May 2022 11:21:07 +0000 (12:21 +0100)]
[X86] load-local illegal types tests - expose the load/store stack offsets

Make it easier to track whats going on accessing parts of the custom sized types

2 years agoRecommit "[VPlan] Remove uneeded needsVectorIV check."
Florian Hahn [Wed, 4 May 2022 09:53:42 +0000 (10:53 +0100)]
Recommit "[VPlan] Remove uneeded needsVectorIV check."

This reverts commit f4e1eaa3755a13f85696be3b74b387122b74a558.

The patch was originally reverted because it uncovered an issue that has
now been fixed in 0ef8ca6d88aa7e4abc.

2 years ago[SystemZ] Avoid crashing in tryRISBGZero().
Jonas Paulsson [Tue, 3 May 2022 17:58:56 +0000 (19:58 +0200)]
[SystemZ] Avoid crashing in tryRISBGZero().

Bail out from cases where the result is a ConstantSDNode as it cannot be
selected and should typically not end up here.

Fixes: #55204

Reviewed By: Ulrich Weigand

2 years ago[flang] Fix ICE for passing a label for non alternate return arguments
Daniil Dudkin [Wed, 4 May 2022 09:29:46 +0000 (12:29 +0300)]
[flang] Fix ICE for passing a label for non alternate return arguments

When we pass an alternate return specifier to a regular (not an asterisk)
dummy argument, flang would throw an internal compiler error of
derefencing a null pointer.
To avoid the ICE, a check was added.

Reviewed By: kiranchandramohan

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

2 years ago[docs] Improve documentation around CMAKE_BUILD_TYPE
Tobias Hieta [Mon, 25 Apr 2022 08:28:59 +0000 (10:28 +0200)]
[docs] Improve documentation around CMAKE_BUILD_TYPE

See discussion in: https://reviews.llvm.org/D124153

Reviewed By: jhenderson

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

2 years ago[libunwind][SystemZ] Unwind out of signal handlers
Ulrich Weigand [Wed, 4 May 2022 08:43:11 +0000 (10:43 +0200)]
[libunwind][SystemZ] Unwind out of signal handlers

Unwinding out of signal handlers currently does not work since
the sigreturn trampoline is not annotated with CFI data.

Fix this by detecting the sigreturn trampoline during unwinding
and providing appropriate unwind data manually. This follows
closely the approach used by existing code for the AArch64 target.

Reviewed by: MaskRay

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

2 years agotsan: fix GCC warnings
Martin Liska [Tue, 3 May 2022 08:09:07 +0000 (10:09 +0200)]
tsan: fix GCC warnings

Fixes:

tsan/tsan_shadow.h:93:32: warning: enumerated and non-enumerated type in conditional expression [-Wextra]
tsan/tsan_shadow.h:94:44: warning: enumerated and non-enumerated type in conditional expression [-Wextra]

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

2 years ago[mlir][linalg][bufferize][NFC] Remove remaining Comprehensive Bufferize code
Matthias Springer [Tue, 3 May 2022 14:40:13 +0000 (23:40 +0900)]
[mlir][linalg][bufferize][NFC] Remove remaining Comprehensive Bufferize code

This commit removes the Linalg Comprehensive Bufferize pass.

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

2 years ago[mlir][linalg][bufferize][NFC] Make init_tensor elimination a separate pre-processing...
Matthias Springer [Tue, 3 May 2022 14:39:31 +0000 (23:39 +0900)]
[mlir][linalg][bufferize][NFC] Make init_tensor elimination a separate pre-processing pass

This commit decouples init_tensor elimination from the rest of the bufferization.

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

2 years ago[ELF] Support custom sections between DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END
Fangrui Song [Wed, 4 May 2022 08:10:45 +0000 (01:10 -0700)]
[ELF] Support custom sections between DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END

We currently hard code RELRO sections. When a custom section is between
DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END, we may report a spurious
`error: section: ... is not contiguous with other relro sections`. GNU ld
makes such sections RELRO.

glibc recently switched to default --with-default-link=no. This configuration
places `__libc_atexit` and others between DATA_SEGMENT_ALIGN and
DATA_SEGMENT_RELRO_END. This patch allows such a ld.bfd --verbose
linker script to be fed into lld.

Reviewed By: peter.smith

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

2 years ago[mlir][bufferize] Allow in-place bufferization for writes to init_tensors in loops
Matthias Springer [Tue, 3 May 2022 14:39:07 +0000 (23:39 +0900)]
[mlir][bufferize] Allow in-place bufferization for writes to init_tensors in loops

This commit relaxes the rules around ops that define a value but do not specify the tensor's contents. (The only such op at the moment is init_tensor.)

When such a tensor is written in a loop, it should not cause out-of-place bufferization.

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

2 years ago[iwyu] Handle regressions in libLLVM header include
serge-sans-paille [Tue, 3 May 2022 12:15:24 +0000 (14:15 +0200)]
[iwyu] Handle regressions in libLLVM header include

Running iwyu-diff on LLVM codebase since fa5a4e1b95c8f37796 detected a few
regressions, fixing them.

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

2 years ago[mlir] Add missing CMake deps to mlir-pdll
Marius Brehler [Tue, 3 May 2022 12:56:51 +0000 (12:56 +0000)]
[mlir] Add missing CMake deps to mlir-pdll

Reviewed By: rriddle

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

2 years ago[ThreadPool] delete debug global variable if not needed
Luboš Luňák [Wed, 4 May 2022 06:11:49 +0000 (08:11 +0200)]
[ThreadPool] delete debug global variable if not needed

https://lab.llvm.org/buildbot/#/builders/5/builds/23099

2 years agoMark test icf-safe.s as requiring aarch64 to fix buildbots which don't build that...
Douglas Yung [Wed, 4 May 2022 05:45:43 +0000 (22:45 -0700)]
Mark test icf-safe.s as requiring aarch64 to fix buildbots which don't build that target.

2 years ago[lldb] use one shared ThreadPool and task groups
Luboš Luňák [Wed, 6 Apr 2022 13:48:22 +0000 (15:48 +0200)]
[lldb] use one shared ThreadPool and task groups

As a preparation for parallelizing loading of symbols (D122975),
it is necessary to use just one thread pool to avoid using
a thread pool from inside a task of another thread pool.

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

2 years ago[ThreadPool] add ability to group tasks into separate groups
Luboš Luňák [Tue, 5 Apr 2022 19:27:14 +0000 (21:27 +0200)]
[ThreadPool] add ability to group tasks into separate groups

This is needed for parallelizing of loading modules symbols in LLDB
(D122975). Currently LLDB can parallelize indexing symbols
when loading a module, but modules are loaded sequentially. If LLDB
index cache is enabled, this means that the cache loading is not
parallelized, even though it could. However doing that creates
a threadpool-within-threadpool situation, so the number of threads
would not be properly limited.

This change adds ThreadPoolTaskGroup as a simple type that can be
used with ThreadPool calls to put tasks into groups that can be
independently waited for (even recursively from within a task)
but still run in the same thread pool.

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

2 years ago[fastregalloc] Fix bug when undef value is tied to def.
Luo, Yuanke [Wed, 4 May 2022 03:24:48 +0000 (11:24 +0800)]
[fastregalloc] Fix bug when undef value is tied to def.

If the tied use is undef value, fastregalloc should free the def
register. There is no reload needed for the undef value.

Reviewed By: MatzeB

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

2 years ago[RISCV] Update isLegalAddressingMode for RVV.
Craig Topper [Wed, 4 May 2022 02:42:42 +0000 (19:42 -0700)]
[RISCV] Update isLegalAddressingMode for RVV.

RVV instructions only support base register addressing.

Reviewed By: reames

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

2 years ago[RISCV] Make use of SHXADD instructions in RVV spill/reload code.
Craig Topper [Wed, 4 May 2022 02:29:33 +0000 (19:29 -0700)]
[RISCV] Make use of SHXADD instructions in RVV spill/reload code.

We can use SH1ADD, SH2ADD, SH3ADD to multipy by 3, 5, and 9 respectively.

We could extend this to 3, 5, or 9 multiplied by a power 2 by also
emitting a SLLI.

Reviewed By: reames

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

2 years ago[RISCV] Don't lookup TII in RISCVInstrInfo::getVLENFactoredAmount. NFCI
Craig Topper [Wed, 4 May 2022 02:28:26 +0000 (19:28 -0700)]
[RISCV] Don't lookup TII in RISCVInstrInfo::getVLENFactoredAmount. NFCI

We're already inside of our implementation of TII.

2 years ago[BOLT] Fix ICPJumpTablesTopN option use
Amir Ayupov [Wed, 4 May 2022 02:33:43 +0000 (19:33 -0700)]
[BOLT] Fix ICPJumpTablesTopN option use

Fix non-sensical `opts::ICPJumpTablesTopN != 0 ? opts::ICPTopN : opts::ICPTopN`.
Refactor/simplify another similar assignment.

Reviewed By: rafauler

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

2 years ago[BOLT][NFC] Make ICP options naming uniform
Amir Ayupov [Wed, 4 May 2022 02:32:19 +0000 (19:32 -0700)]
[BOLT][NFC] Make ICP options naming uniform

Rename `opts::IndirectCallPromotion*` to `opts::ICP*`, making option naming
uniform and easier to follow.

Reviewed By: rafauler

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

2 years ago[BOLT][NFC] ICP: simplify findTargetsIndex
Amir Ayupov [Wed, 4 May 2022 02:30:41 +0000 (19:30 -0700)]
[BOLT][NFC] ICP: simplify findTargetsIndex

Unnest lambda and use `llvm::is_contained`.

Reviewed By: rafauler

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

2 years ago[BOLT][NFC] Refactor ICP::findCallTargetSymbols
Amir Ayupov [Wed, 4 May 2022 02:28:24 +0000 (19:28 -0700)]
[BOLT][NFC] Refactor ICP::findCallTargetSymbols

Reduce nesting making it easier to read.

Reviewed By: rafauler

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

2 years ago[BOLT][CMAKE] Fix llvm-bolt-fuzzer build
Amir Ayupov [Tue, 3 May 2022 22:35:45 +0000 (15:35 -0700)]
[BOLT][CMAKE] Fix llvm-bolt-fuzzer build

Add X86/AArch64 targets to resolve missing dependencies, e.g.:
`undefined reference to `LLVMInitializeX86AsmParser'`

Follow-up to D124206

Reviewed By: rafauler

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

2 years ago[riscv] Mark function as used to avoid unused warning.
Weverything [Wed, 4 May 2022 01:10:50 +0000 (18:10 -0700)]
[riscv] Mark function as used to avoid unused warning.

2 years ago[CSSPGO] Relax size limitation for priority inlining with preinlined profile
Hongtao Yu [Mon, 2 May 2022 18:59:55 +0000 (11:59 -0700)]
[CSSPGO] Relax size limitation for priority inlining with preinlined profile

As a follow-up to D124632, I'm turning on unlimited size caps for inlining with preinlined profile. It should be safe as a preinlined profile has "bounded" inline contexts.

No noticeable size or perf delta was seen with two of our internal large services, but I think this is still a good change to be consistent with the other case.

Reviewed By: wenlei

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

2 years ago[CSSPGO][NFC] Replace SampleProfileLoader::ProfileIsCS with FunctionSamples::ProfileIsCS.
Hongtao Yu [Mon, 2 May 2022 17:57:22 +0000 (10:57 -0700)]
[CSSPGO][NFC] Replace SampleProfileLoader::ProfileIsCS with FunctionSamples::ProfileIsCS.

The two fields have the same meaning. Their values come from the reader. Therefore I'm removing one.

Reviewed By: wenlei

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

2 years ago[lld] Implement safe icf for MachO
Alex Borcan [Wed, 4 May 2022 01:00:41 +0000 (21:00 -0400)]
[lld] Implement safe icf for MachO

This change implements --icf=safe for MachO based on addrsig section that is implemented in D123751.

Reviewed By: int3, #lld-macho

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

2 years ago[OpenMP] Fix save-temps name in linker wrapper
Joseph Huber [Wed, 4 May 2022 00:50:26 +0000 (20:50 -0400)]
[OpenMP] Fix save-temps name in linker wrapper

Summary:
The wrapped registration code had a typo in the save-temps version of
the name.

2 years ago[riscv] Add vsetvli tests involving moves to/from scalar regs
Philip Reames [Wed, 4 May 2022 00:25:35 +0000 (17:25 -0700)]
[riscv] Add vsetvli tests involving moves to/from scalar regs

2 years ago[riscv] Add a couple more vsetvli tests
Philip Reames [Tue, 3 May 2022 23:49:47 +0000 (16:49 -0700)]
[riscv] Add a couple more vsetvli tests

2 years ago[psuedo] Fix for unused warning by moving code into debug macro.
Weverything [Tue, 3 May 2022 22:13:17 +0000 (15:13 -0700)]
[psuedo] Fix for unused warning by moving code into debug macro.

2 years ago[trace][intelpt] Fix out-of-bounds access.
Weverything [Tue, 3 May 2022 21:55:34 +0000 (14:55 -0700)]
[trace][intelpt] Fix out-of-bounds access.

The StringRef single argument constructor expects a null-terminated
string.  Explicitly pass the size to prevent reading pass the end
of the array.

2 years agoARM: Fix using undefined virtual registers in test
Matt Arsenault [Mon, 2 May 2022 15:46:57 +0000 (11:46 -0400)]
ARM: Fix using undefined virtual registers in test

The verifier apparently doesn't work correctly and should have
caught this.

2 years agoARM: Cleanup MIR test
Matt Arsenault [Mon, 2 May 2022 15:22:51 +0000 (11:22 -0400)]
ARM: Cleanup MIR test

Drop IR section, renumber registers, regenerate to use -NEXT

2 years agoAMDGPU: Remove some invalid kill flags in tests
Matt Arsenault [Mon, 2 May 2022 13:41:28 +0000 (09:41 -0400)]
AMDGPU: Remove some invalid kill flags in tests

These killed registers need to be live out of the block but the
verifier wasn't catching it.

2 years agoAMDGPU: Regenerate test checks
Matt Arsenault [Mon, 2 May 2022 14:01:05 +0000 (10:01 -0400)]
AMDGPU: Regenerate test checks

2 years agollvm-reduce: Reduce includes
Matt Arsenault [Tue, 19 Apr 2022 20:00:57 +0000 (16:00 -0400)]
llvm-reduce: Reduce includes

2 years ago[BOLT][TEST] Fix test failures on AArch64 builder
Amir Ayupov [Tue, 3 May 2022 21:47:03 +0000 (14:47 -0700)]
[BOLT][TEST] Fix test failures on AArch64 builder

Address X86 tests failures on AArch64 builder:
https://lab.llvm.org/staging/#/builders/211/builds/82

Inputs fail to cross-compile due to a missing header:
```
/usr/include/stdio.h:27:10: fatal error: 'bits/libc-header-start.h' file not found
#include <bits/libc-header-start.h>
```

As inputs are linked with `-nostdlib` anyway, don't include stdio.h.

Reviewed By: yota9

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

2 years agoImplement support for __llvm_addrsig for MachO in llvm-mc
Alex Borcan [Tue, 3 May 2022 22:19:18 +0000 (18:19 -0400)]
Implement support for __llvm_addrsig for MachO in llvm-mc

The __llvm_addrsig section is a section that the linker needs for safe icf.
This was not yet implemented for MachO - this is the implementation.
It has been tested with a safe deduplication implementation inside lld.

Reviewed By: MaskRay

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

2 years ago[lldb] Add a function to check if lldb is running in an interactive session
Jonas Devlieghere [Tue, 3 May 2022 22:04:45 +0000 (15:04 -0700)]
[lldb] Add a function to check if lldb is running in an interactive session

This patch adds a function to check if lldb is running in an interactive
debug session. Currently this API only works on macOS. It's expected to
be used in combination with Host::OpenFileInExternalEditor.

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

2 years ago[lldb] Session transcript should use the async debugger streams
Jonas Devlieghere [Tue, 3 May 2022 20:39:23 +0000 (13:39 -0700)]
[lldb] Session transcript should use the async debugger streams

When writing out the session transcript, print output to the
asynchronous debugger stream to prevent it from potentially interleaving
with other output.

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

2 years ago[mlir][sparse] fix build issue with unused local under opt builds
Aart Bik [Tue, 3 May 2022 21:49:08 +0000 (14:49 -0700)]
[mlir][sparse] fix build issue with unused local under opt builds

Reviewed By: rdzhabarov

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

2 years agoFix zero-width bitfield extracts to emit 0
Jon Roelofs [Tue, 3 May 2022 21:31:50 +0000 (14:31 -0700)]
Fix zero-width bitfield extracts to emit 0

Fixes #55129

2 years agoFix DXBC magic parsing
Chris Bieneman [Tue, 3 May 2022 17:00:02 +0000 (12:00 -0500)]
Fix DXBC magic parsing

This gets identify_magic working correctly for DXContainer files

2 years agoFix a buildbot warning [nfc]
Philip Reames [Tue, 3 May 2022 21:40:20 +0000 (14:40 -0700)]
Fix a buildbot warning [nfc]

2 years ago[mlir][sparse] add missing types to from/to-MLIR conversion routines
Aart Bik [Tue, 3 May 2022 21:01:47 +0000 (14:01 -0700)]
[mlir][sparse] add missing types to from/to-MLIR conversion routines

This will enable our usual set of element types in external
environments, such as PyTACO support.

Reviewed By: bixia

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

2 years ago[SCEV] Removed an unnecessary assertion
Yangguang Li [Tue, 3 May 2022 21:19:28 +0000 (17:19 -0400)]
[SCEV] Removed an unnecessary assertion

The assertion is to check we always get backedge taken count
(`BECount`) of zero when the exit condition is in select form
(`isa<BinaryOperation>(ExitCond)`) and the exit limit for the
first operand is zero `EL0.ExactNotTaken->isZero()`). However
the assertion is checking that the exit condition is NOT in
select form. Removing the the whole assertion since we now handle
select form in ScalarEvolution::getSequentialMinMaxExpr.

Reviewed By: reames, nikic

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

2 years ago[mlir] Fix Visual Studio warnings
Stella Stamenova [Tue, 3 May 2022 19:45:30 +0000 (12:45 -0700)]
[mlir] Fix Visual Studio warnings

There are only a couple of warnings when compiling with VS on Windows. This fixes the last remaining warnings so that we can enable LLVM_ENABLE_WERROR on the mlir windows bot.

Reviewed By: rriddle

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

2 years ago[bazel] Fix the build after 2c3326608460
Benjamin Kramer [Tue, 3 May 2022 21:03:51 +0000 (23:03 +0200)]
[bazel] Fix the build after 2c3326608460

2 years ago[riscv] Add debug printing support for VSETVLIInfo class [nfc]
Philip Reames [Tue, 3 May 2022 20:47:06 +0000 (13:47 -0700)]
[riscv] Add debug printing support for VSETVLIInfo class [nfc]

2 years ago[mlir][sparse] Add lowering for unary and binary ops
Jim Kitchen [Tue, 3 May 2022 20:50:26 +0000 (15:50 -0500)]
[mlir][sparse] Add lowering for unary and binary ops

Adding lowering for Unary and Binary required several changes due to
their unique nature of containing custom code for different "regions"
of the sparse structure being operated on. Along with a Kind, a pointer
to the Operation is passed along to be merged once the lattice
structure is figured out.

The original operation is maintained, as it is required for subsequent
lattice decisions. However, sparse_tensor.binary has some branches
are considered as fully handled and therefore are marked with as
kBinaryBranch to distinguish them.

A unique aspect of the custom code is that sometimes the desired result
is no result at all -- i.e. a user wants overlapping sparse entries to
become empty in the output. The solution to this is to return an
uninitialized Value(), which is checked and handled elsewhere in the
code and results in nothing being written to the output tensor for that
case.

Reviewed By: aartbik

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

2 years ago[pseudo] Use a real language option in the parser.
Haojian Wu [Tue, 3 May 2022 08:31:14 +0000 (10:31 +0200)]
[pseudo] Use a real language option in the parser.

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

2 years ago[InstCombine] move shuffle after min/max with same-shuffled operands
Sanjay Patel [Tue, 3 May 2022 20:04:44 +0000 (16:04 -0400)]
[InstCombine] move shuffle after min/max with same-shuffled operands

This is an intrinsic version of the existing fold for binops.
As a first step, I only allowed min/max, but the code is set
up to make adding more intrinsics easy (with more or less than
2 arguments).

This (and possible follow-ups) are discussed in issue #46238.

2 years ago[InstCombine] add tests for min/max with shuffled operands; NFC
Sanjay Patel [Tue, 3 May 2022 18:42:25 +0000 (14:42 -0400)]
[InstCombine] add tests for min/max with shuffled operands; NFC

Issue #46238

2 years ago[clang][OpenMP] Local variable alignment incorrect with align clause
David Pagan [Tue, 3 May 2022 16:44:03 +0000 (09:44 -0700)]
[clang][OpenMP] Local variable alignment incorrect with align clause

If alignment specified with align clause is less than natural alignment for
list item type, the alignment should be set to the natural alignment.

See OMP5.1 specification, page 185, lines 7-10

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

2 years ago[pseudo] Print the GSS::Node details when the unittest fails, NFC.
Haojian Wu [Tue, 3 May 2022 19:25:50 +0000 (21:25 +0200)]
[pseudo] Print the GSS::Node details when the unittest fails, NFC.

2 years ago[OpenMP] Possible fix for sporadic test failure from loop_dispatch.c
Hansang Bae [Mon, 2 May 2022 18:42:26 +0000 (13:42 -0500)]
[OpenMP] Possible fix for sporadic test failure from loop_dispatch.c

This patch tries to fix sporadic test failure after the change
https://reviews.llvm.org/D122107.
Made the test wait until every thread has at least one loop iteration.

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

2 years agoRevert "[BOLT][TEST] Fix test failures on AArch64 builder"
Amir Ayupov [Tue, 3 May 2022 19:45:15 +0000 (12:45 -0700)]
Revert "[BOLT][TEST] Fix test failures on AArch64 builder"

This reverts commit 88b6d3211c836021a9b570ac6090dd1bf42da449.

2 years ago[BOLT][TEST] Fix test failures on AArch64 builder
Amir Ayupov [Tue, 3 May 2022 17:18:17 +0000 (10:18 -0700)]
[BOLT][TEST] Fix test failures on AArch64 builder

Address X86 tests failures on AArch64 builder:
https://lab.llvm.org/staging/#/builders/211/builds/82

Inputs fail to cross-compile due to a missing header:
```
/usr/include/stdio.h:27:10: fatal error: 'bits/libc-header-start.h' file not found
#include <bits/libc-header-start.h>
```

As inputs are linked with `-nostdlib` anyway, don't include stdio.h.

Reviewed By: yota9

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

2 years agoExtractAPI: Use %clang_cc1 and -verify in enum.c
Duncan P. N. Exon Smith [Thu, 28 Apr 2022 19:44:32 +0000 (12:44 -0700)]
ExtractAPI: Use %clang_cc1 and -verify in enum.c

Fix one test (enum.c) in ExtractAPI to use %clang_cc1 and -verify
instead of calling the full driver and FileCheck. This is an example for
my comment from https://reviews.llvm.org/D121873.

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

2 years agoFix some places where PseudoObjectExpr handling assumed that a
Richard Smith [Mon, 2 May 2022 21:47:52 +0000 (14:47 -0700)]
Fix some places where PseudoObjectExpr handling assumed that a
PseudoObjectExpr is only used for ObjC properties and subscripts.

For now, these assumptions are generally correct, but that's not part of
the design of PseudoObjectExpr. No functionality change intended.

2 years agoMinor correction in bitreverse intrinsic semantics
David Kreitzer [Tue, 3 May 2022 14:57:57 +0000 (07:57 -0700)]
Minor correction in bitreverse intrinsic semantics

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

2 years ago[clang-format][NFC] Clean up tryToParseLambdaIntroducer()
owenca [Tue, 3 May 2022 03:02:57 +0000 (20:02 -0700)]
[clang-format][NFC] Clean up tryToParseLambdaIntroducer()

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

2 years ago[gn build] Port 9f38da258ea7
LLVM GN Syncbot [Tue, 3 May 2022 18:28:46 +0000 (18:28 +0000)]
[gn build] Port 9f38da258ea7

2 years ago[pseudo] Implement the GLR parsing algorithm.
Haojian Wu [Tue, 3 May 2022 13:58:26 +0000 (15:58 +0200)]
[pseudo] Implement the GLR parsing algorithm.

This patch implements a standard GLR parsing algorithm, the
core piece of the pseudoparser.

- it parses preprocessed C++ code, currently it supports correct code
  only and parse them as a translation-unit;
- it produces a forest which stores all possible trees in an efficient
  manner (only a single node being build for per (SymbolID, Token Range));
  no disambiguation yet;

Reland with a fix for g++'s -fpermissive error on previous declaration `GSS& GSS;`.

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

2 years ago[randstruct] Move initializer check to be more effective
Bill Wendling [Tue, 3 May 2022 18:19:52 +0000 (11:19 -0700)]
[randstruct] Move initializer check to be more effective

If a randomized structure has an initializer with a dedicated
initializer in it, the field initialzed by that dedicated initializer
may end up at the end of the RecordDecl. This however may skip the
random layout initization check.

  struct t {
     int a, b, c, d, e;
  } x = { .a = 2, 4, 5, 6 };

Let's say that "a" is lands as the last field after randomization. The
call to CheckDesignatedInitializer sets the iterator to the end of the
initializer list. During the next iteration of the initializer list
check, it detects that and fails to issue the error about initializing
a randomized struct with non-designated initializer. Instead, it issues
an error about "excess elements in struct initializer", which is
confusing under these circumstances.

Reviewed By: aaron.ballman

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

2 years ago[lldb] Add setting for max depth of value object printing (NFC)
Dave Lee [Tue, 26 Apr 2022 23:34:10 +0000 (16:34 -0700)]
[lldb] Add setting for max depth of value object printing (NFC)

This adds a setting (`target.max-children-depth`) that will provide a default value for the `--depth` flag used by `expression` and `frame variable`.

The new setting uses the same default that's currently fixed in source: `UINT32_MAX`.

This provides two purposes:

1. Allowing downstream forks to provide a customized default.
2. Allowing users to set their own default.

Following `target.max-children-count`, a warning is emitted when the max depth is reached. The warning lets users know which flags or settings they can customize. This warning is shown only when the limit is the default value.

rdar://87466495

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

2 years ago[mlir] Add sin & cos ops to complex dialect
Goran Flegar [Tue, 3 May 2022 17:27:22 +0000 (19:27 +0200)]
[mlir] Add sin & cos ops to complex dialect

Also adds conversions for those ops to math + arith.

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

2 years agotsan: for unittests, change to use test fixtures to clear racy stacks
Yuanfang Chen [Tue, 3 May 2022 17:13:15 +0000 (10:13 -0700)]
tsan: for unittests, change to use test fixtures to clear racy stacks

After cd0a5889d71, unittest would run in shard mode where many tests
share a single process. Need to clear some global state to make the test
results stable.

Reviewed By: thetruestblue, rsundahl

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

2 years agoBuildLibCalls: simplify switch statement slightly
Augie Fackler [Tue, 3 May 2022 16:11:34 +0000 (12:11 -0400)]
BuildLibCalls: simplify switch statement slightly

Per feedback on D123086 after submit.

Also added a test for vec_malloc et al attribute inference to show it's
doing the right thing.

The new tests exposed a defect, corrected by adding vec_free to the list of
free functions in MemoryBuiltins.cpp, which had been overlooked all the
way back in D94710, over a year ago.

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