platform/upstream/llvm.git
2 years ago[compiler-rt] Add -fno-omit-frame-pointer check to builtins
Gwen Mittertreiner [Thu, 30 Sep 2021 20:52:51 +0000 (13:52 -0700)]
[compiler-rt] Add -fno-omit-frame-pointer check to builtins

rG210d72e9d6b4a8e7633921d0bd7186fd3c7a2c8c moved the check from
builtin-config-ix to config-ix so that the check would be made even when
the builtins are not built. However, now the check is no longer made
when the builtins are built standalone which causes the builtins to fail
to build.

Add the check back to builtins-config-ix so that the check gets
performed both when the builtins are not built, and when they are built
standalone.

Reviewed By: smeenai

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

2 years ago[openmp] Add addrspacecast to getOrCreateIdent
Jon Chesterfield [Thu, 30 Sep 2021 20:36:30 +0000 (21:36 +0100)]
[openmp] Add addrspacecast to getOrCreateIdent

Fixes 51982. Adds a missing CreatePointerCast and allocates a global in
the correct address space.

Test case derived from https://github.com/ROCm-Developer-Tools/aomp/\
blob/aomp-dev/test/smoke/nest_call_par2/nest_call_par2.c by deleting
parts while checking the assertion failure still occurred.

Reviewed By: jdoerfert

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

2 years ago[libomptarget] Apply D110029 to amdgpu
Jon Chesterfield [Thu, 30 Sep 2021 20:29:36 +0000 (21:29 +0100)]
[libomptarget] Apply D110029 to amdgpu

Use enum for execution mode.

This is partly a port from ROCm and partly a port from D110029. Attempted to
make the same choices as ROCm as far as comments etc go to reduce the merge
conflicts.

There is some cleanup warranted here - in particular I like the cuda patch
factoring out the comparisons into named variables - but I'd like to leave
that for a follow up patch, keeping this one minimal.

Reviewed By: carlo.bertolli

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

2 years ago[cora async] Cleanup undefined llvm.coro.async.resume
Arnold Schwaighofer [Tue, 21 Sep 2021 18:07:07 +0000 (11:07 -0700)]
[cora async] Cleanup undefined llvm.coro.async.resume

In situations where the coroutine function is not split we can just
replace the async.resume by null.

rdar://82591919

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

2 years ago[mlir][Linalg] Refactor comprehensive bufferize for external uses - NFC
Nicolas Vasilache [Thu, 30 Sep 2021 19:51:45 +0000 (19:51 +0000)]
[mlir][Linalg] Refactor comprehensive bufferize for external uses - NFC

This revision exposes some minimal funcitonality to allow comprehensive
bufferization to interop with external projects.

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

2 years ago[AIX] Rename binder option for PGO support
Jinsong Ji [Thu, 30 Sep 2021 19:58:39 +0000 (19:58 +0000)]
[AIX] Rename binder option for PGO support

Update the binder option.

2 years agoRevert "Recommit "[SCEV] Look through single value PHIs." (take 2)"
Florian Hahn [Thu, 30 Sep 2021 17:52:38 +0000 (18:52 +0100)]
Revert "Recommit "[SCEV] Look through single value PHIs." (take 2)"

This reverts commit 764d9aa97905f202385b4f25f8d234630b4feef3.

This patch exposed a few additional cases where SCEV expressions are not
properly invalidated.

See PR52024, PR52023.

2 years ago[DFSan] Optimize code for writing to shadow. Move SetShadow to namespace.
Andrew Browne [Wed, 29 Sep 2021 17:07:17 +0000 (10:07 -0700)]
[DFSan] Optimize code for writing to shadow. Move SetShadow to namespace.

Writing zeros to shadow (including checking for existing zero) is now ~2x
faster on one example.

Reviewed By: morehouse

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

2 years ago[gn build] Port 050edef8538e
LLVM GN Syncbot [Thu, 30 Sep 2021 19:35:12 +0000 (19:35 +0000)]
[gn build] Port 050edef8538e

2 years ago[MC] Make MCDwarfLineStr class public
Maksim Panchenko [Fri, 17 Sep 2021 20:24:15 +0000 (13:24 -0700)]
[MC] Make MCDwarfLineStr class public

Add MCDwarfLineStr class to the public API.

Note that MCDwarfLineTableHeader::Emit(), takes MCDwarfLineStr as
an Optional<> parameter making it impossible to use the API if the class
is not publicly defined.

Reviewed By: alexander-shaposhnikov

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

2 years ago[PowerPC] Improved codegen related to xscvdpsxws/xscvdpuxws
Albion Fung [Thu, 30 Sep 2021 18:45:29 +0000 (13:45 -0500)]
[PowerPC] Improved codegen related to xscvdpsxws/xscvdpuxws

This patch removes the uneccessary mf/mtvsr generated in conjunction
with xscvdpsxws/xscvdpuxws.

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

2 years ago[GlobalISel] Extend G_SELECT of known condition combine to vectors.
Amara Emerson [Wed, 29 Sep 2021 22:38:59 +0000 (15:38 -0700)]
[GlobalISel] Extend G_SELECT of known condition combine to vectors.

Adds a new utility function: isConstantOrConstantSplatVector().

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

2 years ago[flang] Fold FINDLOC()
Peter Klausler [Tue, 28 Sep 2021 16:56:38 +0000 (09:56 -0700)]
[flang] Fold FINDLOC()

Fold the transformational intrinsic function FINDLOC() for
all combinations of optional arguments and data types.

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

2 years ago[InstCombine] restrict shift-trunc-shift fold to opposite direction shifts
Sanjay Patel [Thu, 30 Sep 2021 18:47:02 +0000 (14:47 -0400)]
[InstCombine] restrict shift-trunc-shift fold to opposite direction shifts

This is NFCI because the pattern with 2 left-shifts should get
folded independently by smaller folds.

The motivation is to refine this block to avoid infinite loops
seen with D110170.

2 years ago[InstCombine] add tests for shift-trunc-shift; NFC
Sanjay Patel [Thu, 30 Sep 2021 18:09:24 +0000 (14:09 -0400)]
[InstCombine] add tests for shift-trunc-shift; NFC

2 years agoReland "[clang-cl] Accept `#pragma warning(disable : N)` for some N"
Nico Weber [Thu, 30 Sep 2021 18:41:58 +0000 (14:41 -0400)]
Reland "[clang-cl] Accept `#pragma warning(disable : N)` for some N"

This reverts commit 0cd9d8a48bdddb17de2c6388f9d775353f9acab9 and
adds the changes described in https://reviews.llvm.org/D110668#3034461.

2 years ago[BasicAA] Move more extension logic into ExtendedValue (NFC)
Nikita Popov [Thu, 30 Sep 2021 17:09:11 +0000 (19:09 +0200)]
[BasicAA] Move more extension logic into ExtendedValue (NFC)

Add methods to appropriately extend KnownBits/ConstantRange there,
same as with APInt. Also clean up the known bits handling by
actually doing that extension rather than checking ZExtBits. This
doesn't matter now, but becomes relevant once truncation is
involved.

2 years ago[mlir][sparse] Correcting a few typos
wren romano [Wed, 29 Sep 2021 22:01:35 +0000 (15:01 -0700)]
[mlir][sparse] Correcting a few typos

Reviewed By: aartbik

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

2 years ago[clang] Don't modify OptRemark if the argument is not relevant
Arthur Eubanks [Wed, 29 Sep 2021 01:33:26 +0000 (18:33 -0700)]
[clang] Don't modify OptRemark if the argument is not relevant

A followup to D110201.

 For example, we'd set OptimizationRemarkMissed's Regex to '.*' when
encountering -Rpass. Normally this doesn't actually affect remarks we
emit because in clang::ProcessWarningOptions() we'll separately look at
all -R arguments and turn on/off corresponding diagnostic groups.
However, this is reproducible with -round-trip-args.

Reviewed By: JamesNagurne

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

2 years ago[flang] Fix test regression from SQRT folding
peter klausler [Tue, 28 Sep 2021 22:43:27 +0000 (15:43 -0700)]
[flang] Fix test regression from SQRT folding

The algorithm used to fold SQRT has some holes that
led to test failures; debug and add more tests.

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

2 years ago[clang] Make crash reproducer work with clang-cl
Nico Weber [Wed, 29 Sep 2021 22:46:24 +0000 (18:46 -0400)]
[clang] Make crash reproducer work with clang-cl

When clang crashes, it writes a standalone source file and shell script
to reproduce the crash.

The Driver used to set `Mode = CPPMode` in generateCompilationDiagnostics()
to force preprocessing mode. This has the side effect of making
IsCLMode() return false, which in turn meant Clang::AddClangCLArgs()
didn't get called when creating the standalone source file, which meant
the stand-alone file was preprocessed with the gcc driver's defaults
In particular, exceptions default to on with the gcc driver, but to
off with the cl driver. The .sh script did use the original command
line, so in the reproducer for a clang-cl crash, the standalone source
file could contain exception-using code after preprocessing that the
compiler invocation in the shell script would then complain about.

This patch removes the `Mode = CPPMode;` line and instead additionally
checks for `CCGenDiagnostics` in most places that check `CCCIsCPP().
This also matches the strategy Clang::ConstructJob() uses to add
-frewrite-includes for creating the standalone source file for a crash
report.

Fixes PR52007.

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

2 years ago[clang] do not emit note for bad conversion when destination type qualifiers are...
Zequan Wu [Wed, 29 Sep 2021 22:00:39 +0000 (15:00 -0700)]
[clang] do not emit note for bad conversion when destination type qualifiers are not compatibly include source type qualifiers

llvm.org/PR52014

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

2 years ago[clang] Remove duplication in types::getCompilationPhases()
Nico Weber [Wed, 29 Sep 2021 19:19:36 +0000 (15:19 -0400)]
[clang] Remove duplication in types::getCompilationPhases()

Call Driver::getFinalPhase() instead of duplicating it.

https://reviews.llvm.org/D65993 added the duplication, then
02e35832c301e maded it more obviously a copy of getFinalPhase().

The only difference is that getCompilationPhases() used to use
LastPhase / IfsMerge where getFinalPhase() used Link. Adapt
getFinalPhase() to return IfsMerge when needed.

No intentional behavior change.

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

2 years ago[libc++abi][NFCI] Consistently group new_handler, unexpected_handler and terminate_ha...
Louis Dionne [Thu, 30 Sep 2021 17:29:12 +0000 (13:29 -0400)]
[libc++abi][NFCI] Consistently group new_handler, unexpected_handler and terminate_handler

Previously, the definitions of __cxa_terminate_handler and __cxa_unexpected_handler
(and their set_xxx_handler functions) were grouped together, but the
definition of __cxa_new_handler wasn't. This commit simply moves those
to the same file to treat all handlers consistently.

2 years agoRevert "[libc++][libc++abi] Add tests for vendor-specific properties"
Haowei Wu [Thu, 30 Sep 2021 18:03:59 +0000 (11:03 -0700)]
Revert "[libc++][libc++abi] Add tests for vendor-specific properties"

This reverts commit 9892d1644f62cf8f5133ee0d2ebafb56f6500cc1, which
causes clang test failures in libcxx tests.

2 years ago[flang] Front-end and runtime support for CALL EXIT and ABORT
peter klausler [Thu, 23 Sep 2021 23:36:04 +0000 (16:36 -0700)]
[flang] Front-end and runtime support for CALL EXIT and ABORT

Support the extension intrinsic subroutines EXIT([status]) and ABORT()
in the intrinsic table and runtime support library.  Lowering remains
to be done.

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

2 years ago[mlir][linalg] Fix incorrect bound calculation for tiling conv
Lei Zhang [Thu, 30 Sep 2021 17:50:44 +0000 (13:50 -0400)]
[mlir][linalg] Fix incorrect bound calculation for tiling conv

For convolution, the input window dimension's access affine map
is of the form `(d0 * s0 + d1)`, where `d0`/`d1` is the output/
filter window dimension, and `s0` is the stride.

When tiling, https://reviews.llvm.org/D109267 changed how the
way dimensions are acquired. Instead of directly querying using
`*.dim` ops on the original convolution op, we now get it by
applying the access affine map to the loop upper bounds. This
is fine for dimensions having single-dimension affine maps,
like matmul, but not for convolution input. It will cause
incorrect compuation and out of bound. A concrete example, say
we have 1x225x225x3 (NHWC) input, 3x3x3x32 (HWCF) filter, and
1x112x112x3 (NHWC) output with stride 2, (112 * 2 + 3) would be
227, which is different from the correct input window dimension
size 225.

Instead, we should first calculate the max indices for each loop,
and apply the affine map to them, and then plus one to get the
dimension size. Note this makes no difference for matmul-like
ops given they will have `d0 - 1 + 1` effectively.

Reviewed By: nicolasvasilache

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

2 years ago[lldb] Remove support for replaying the test suite from a reproducer
Jonas Devlieghere [Thu, 30 Sep 2021 05:32:21 +0000 (22:32 -0700)]
[lldb] Remove support for replaying the test suite from a reproducer

This patch removes the infrastructure to replay the test suite from a
reproducer, as well as the modifications made to the individual tests.

2 years ago[AMDGPU] move hasAGPRs/hasVGPRs into header
Stanislav Mekhanoshin [Wed, 29 Sep 2021 19:43:12 +0000 (12:43 -0700)]
[AMDGPU] move hasAGPRs/hasVGPRs into header

It is now very simple and can go right into the header
allowing optimizer to combine callers, such as isVGPRClass
and similar.

It does not need anything from the TRI itself anymore, so
make it static class member along with the callers.

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

2 years agoManually create unique_ptr in various pass adaptors
Arthur Eubanks [Wed, 29 Sep 2021 23:04:39 +0000 (16:04 -0700)]
Manually create unique_ptr in various pass adaptors

This avoids creating tons of make_unique template instantiations. And we
only create a unique_ptr of the actual pass concept type, rather than
creating a unique_ptr of the pass model subclass then casting it to the
pass concept type.

This reduces the work spent compiling PassBuilder.cpp from 83M -> 73M
instructions according to perf stat.

Reviewed By: rnk

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

2 years ago[BasicAA] Use ExtendedValue in VariableGEPIndex (NFC)
Nikita Popov [Thu, 30 Sep 2021 16:18:15 +0000 (18:18 +0200)]
[BasicAA] Use ExtendedValue in VariableGEPIndex (NFC)

Use the ExtendedValue structure which is used for LinearExpression
in VariableGEPIndex as well.

2 years agoInstantiate fewer templates in PassManager::addPass()
Arthur Eubanks [Wed, 29 Sep 2021 19:12:03 +0000 (12:12 -0700)]
Instantiate fewer templates in PassManager::addPass()

We create many instantiations of PassManager::addPass() in
PassBuilder.cpp.  vector::emplace_back() and make_unique() are both
templated and would have many instantiations based on the number of
times we instantiate addPass().  Now we directly construct the
unique_ptr with the type as the actual unique_ptr type in the vector we
are adding it to, so we only have one unique_ptr constructor
instantiation across all addPass() instantiations and only the
non-templated push_back().

This makes PassBuilder.cpp slightly faster to build.

Reviewed By: rnk

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

2 years ago[CostModel] Update default cost model for sadd/ssub overflow to match TargetLowering
Craig Topper [Wed, 29 Sep 2021 17:21:44 +0000 (10:21 -0700)]
[CostModel] Update default cost model for sadd/ssub overflow to match TargetLowering

The expansion for these was updated in https://reviews.llvm.org/D47927 but the cost model was not adjusted.

I believe the cost model was also incorrect for the old expansion.
The expansion prior to D47927 used 3 icmps using LHS, RHS, and Result
to calculate theirs signs. Then 2 icmps to compare the signs. Followed
by an And. The previous cost model was using 3 icmps and 2 selects.
Digging back through git blame, those 2 selects in the cost model used to
be 2 icmps, but were changed in https://reviews.llvm.org/D90681

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

2 years ago[mlir] Remove old "tc" linalg ods generator.
Stella Laurenzo [Wed, 29 Sep 2021 23:47:17 +0000 (23:47 +0000)]
[mlir] Remove old "tc" linalg ods generator.

* This could have been removed some time ago as it only had one op left in it, which is redundant with the new approach.
* `matmul_i8_i8_i32` (the remaining op) can be trivially replaced by `matmul`, which natively supports mixed precision.

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

2 years agoImprove the effectiveness of BDCE's debug info salvaging
Adrian Prantl [Mon, 27 Sep 2021 17:51:04 +0000 (10:51 -0700)]
Improve the effectiveness of BDCE's debug info salvaging

This patch improves the effectiveness of BDCE's debug info salvaging
by processing the instructions in reverse order and delaying
dropAllReferences until after debug info salvaging. This allows
salvaging of entire chains of deleted instructions!

Previously we would remove all references from an instruction, which
would make it impossible to use that instruction to salvage a later
instruction in the instruction stream, because its operands were
already removed.

This reapplies the previous patch with a fix for a use-after-free.

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

2 years ago[libc++][NFC] Remove stray whitespace
Louis Dionne [Thu, 30 Sep 2021 16:18:30 +0000 (12:18 -0400)]
[libc++][NFC] Remove stray whitespace

2 years ago[fir][NFC] Rename lenParams to typeparams in builders
Eric Schweitz [Thu, 30 Sep 2021 15:55:31 +0000 (17:55 +0200)]
[fir][NFC] Rename lenParams to typeparams in builders

Fine tuning after couple of upstreamed patches.
Rename the lenParams varaiables in buidlers to typeparams.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: kiranchandramohan

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

Co-authored-by: Valentin Clement <clementval@gmail.com>
2 years ago[llvm] Migrate from arg_operands to args (NFC)
Kazu Hirata [Thu, 30 Sep 2021 15:51:21 +0000 (08:51 -0700)]
[llvm] Migrate from arg_operands to args (NFC)

Note that arg_operands is considered a legacy name.  See
llvm/include/llvm/IR/InstrTypes.h for details.

2 years ago[NFC][AMDGPU] Improve cost model tests coverage.
Daniil Fukalov [Thu, 30 Sep 2021 15:13:17 +0000 (18:13 +0300)]
[NFC][AMDGPU] Improve cost model tests coverage.

2 years ago[NFC] [hwasan] Remove unneeded member.
Florian Mayer [Wed, 29 Sep 2021 23:57:57 +0000 (00:57 +0100)]
[NFC] [hwasan] Remove unneeded member.

Reviewed By: hctim

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

2 years ago[x86] add test for 3 fcmps and logic; NFC
Sanjay Patel [Thu, 30 Sep 2021 14:34:29 +0000 (10:34 -0400)]
[x86] add test for 3 fcmps and logic; NFC

This is a more complex pattern than we handled with the
initial patch for PR51245:
D110342 / 09e71c367af3

We could extend the logic matching to allow a setcc as
one operand and an extract of vector setcc (or even an
arbitrary bool?) as the other.

2 years ago[fir] Update fir.alloca op
Kiran Chandramohan [Thu, 30 Sep 2021 15:00:17 +0000 (17:00 +0200)]
[fir] Update fir.alloca op

Add pinned attributes and speicifc builders.

The pinned attribute helps mark those allocas in OpenMP regions that should not
be hoisted out by an alloca hoisting pass.

This patch is part of the upstreaming effort from fir-dev branch.

Coming from PR: https://github.com/flang-compiler/f18-llvm-project/pull/1065

Reviewed By: kiranchandramohan

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

Co-authored-by: Valentin Clement <clementval@gmail.com>
2 years ago[libc++] Add a testing configuration specific to Apple's libc++
Louis Dionne [Wed, 29 Sep 2021 18:56:42 +0000 (14:56 -0400)]
[libc++] Add a testing configuration specific to Apple's libc++

Apple's libc++ has a few differences with the LLVM libc++, and it is
necessary to use a custom configuration file to test it properly.

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

2 years ago[fir][NFC] Removed unused declaration from td file
Valentin Clement [Thu, 30 Sep 2021 14:45:46 +0000 (16:45 +0200)]
[fir][NFC] Removed unused declaration from td file

Remove unused code from FIROps.td file after latest
patches.

Reviewed By: kiranchandramohan

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

2 years ago[clangd] Update comment after dea48079b90d40f2087435b778544dffb0ab1793
Kirill Bobyrev [Thu, 30 Sep 2021 14:45:10 +0000 (16:45 +0200)]
[clangd] Update comment after dea48079b90d40f2087435b778544dffb0ab1793

2 years ago[LoopPredication] Remove unused variable
Anna Thomas [Thu, 30 Sep 2021 14:37:18 +0000 (10:37 -0400)]
[LoopPredication] Remove unused variable

After rG452714f8f8037ff37f9358317651d1652e231db2, the Function `F` retrieved in LoopPredication is not used.
Remove this unused variable to stop some buildbots (ASAN, clang-ppc) from failing.

2 years ago[NFC][X86][Codegen] Add test coverage for interleaved i64 load/store stride=2
Roman Lebedev [Thu, 30 Sep 2021 14:30:57 +0000 (17:30 +0300)]
[NFC][X86][Codegen] Add test coverage for interleaved i64 load/store stride=2

2 years ago[NFC][X86][LV] Add costmodel test coverage for interleaved i64/f64 load/store stride=2
Roman Lebedev [Thu, 30 Sep 2021 14:14:16 +0000 (17:14 +0300)]
[NFC][X86][LV] Add costmodel test coverage for interleaved i64/f64 load/store stride=2

2 years ago[NFC] Improve file-level documentation for Sequence.h
Jakub Kuderski [Thu, 30 Sep 2021 14:28:10 +0000 (10:28 -0400)]
[NFC] Improve file-level documentation for Sequence.h

Add usage samples.

This was extracted from a bigger patch: https://reviews.llvm.org/D107378.

Reviewed By: aaron.ballman, gchatelet

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

2 years ago[fir][NFC] Move parser/printer for fir.global_len
Valentin Clement [Thu, 30 Sep 2021 14:27:02 +0000 (16:27 +0200)]
[fir][NFC] Move parser/printer for fir.global_len

Move parser and printer to the .cpp file.

Follow up to https://reviews.llvm.org/D110626.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

2 years ago[BPI] Keep BPI available in loop passes through LoopStandardAnalysisResults
Anna Thomas [Fri, 24 Sep 2021 18:38:41 +0000 (14:38 -0400)]
[BPI] Keep BPI available in loop passes through LoopStandardAnalysisResults

This is analogous to D86156 (which preserves "lossy" BFI in loop
passes). Lossy means that the analysis preserved may not be up to date
with regards to new blocks that are added in loop passes, but BPI will
not contain stale pointers to basic blocks that are deleted by the loop
passes.

This is achieved through BasicBlockCallbackVH in BPI, which calls
eraseBlock that updates the data structures in BPI whenever a basic
block is deleted.

This patch does not have any changes in the upstream pipeline, since
none of the loop passes in the pipeline use BPI currently.
However, since BPI wasn't previously preserved in loop passes, the loop
predication pass was invoking BPI *on the entire
function* every time it ran in an LPM.  This caused massive compile time
in our downstream LPM invocation which contained loop predication.

See updated test with an invocation of a loop-pipeline containing loop
predication and -debug-pass turned ON.

Reviewed-By: asbirlea, modimo
Differential Revision: https://reviews.llvm.org/D110438

2 years ago[fir][NFC] Move fir.shape verifier to cpp file
Valentin Clement [Thu, 30 Sep 2021 14:26:29 +0000 (16:26 +0200)]
[fir][NFC] Move fir.shape verifier to cpp file

Move verifier code to the .cpp file.

Follow up to https://reviews.llvm.org/D110626.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

2 years ago[fir][NFC] Update and move fir.freemem and fir.store
Valentin Clement [Thu, 30 Sep 2021 14:25:21 +0000 (16:25 +0200)]
[fir][NFC] Update and move fir.freemem and fir.store

Move fir.freemem and fir.store to the Memory SSA operations sections.
Move parser, printer and verifier of fir.store to the .cpp file.

This patch is part of the upstreaming effort from fir-dev branch.

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Reviewed By: jeanPerier

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

2 years ago[mlir][python] provide bindings for ops from the sparse_tensor dialect
Alex Zinenko [Thu, 30 Sep 2021 13:09:30 +0000 (15:09 +0200)]
[mlir][python] provide bindings for ops from the sparse_tensor dialect

Previously, the dialect was exposed for linking and pass management purposes,
but we did not generate op classes for it. Generate them.

Reviewed By: nicolasvasilache

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

2 years ago[ARM] Add more MVE intrinsics to sink splats to
David Green [Thu, 30 Sep 2021 13:41:23 +0000 (14:41 +0100)]
[ARM] Add more MVE intrinsics to sink splats to

This adds a few more unpredicated intrinsics to sink splats to, in order
to create more qr instruction variants. Notably this includes
saddsat/uaddsat but also some of the unpredicated mve intrinsics.

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

2 years ago[CodeView] Recognize Fortran95 as Fortran instead of MASM
Brock Wyma [Wed, 22 Sep 2021 23:41:05 +0000 (19:41 -0400)]
[CodeView] Recognize Fortran95 as Fortran instead of MASM

Map Fortran95 sources to Fortran so the CodeView language is not emitted as
MASM.

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

2 years ago[libc] move benchmark function registration to a different file
Guillaume Chatelet [Thu, 30 Sep 2021 13:10:45 +0000 (13:10 +0000)]
[libc] move benchmark function registration to a different file

2 years ago[clangd] Land D110386 again
Kirill Bobyrev [Thu, 30 Sep 2021 12:41:27 +0000 (14:41 +0200)]
[clangd] Land D110386 again

This time, use llvm::sys::fs::UniqueID instead of unstable
FileEntry::getName(), this should solve the problems on Windows and
elsewhere.

2 years ago[mlir] Remove unused namespace alias.
Adrian Kuegel [Thu, 30 Sep 2021 11:50:31 +0000 (13:50 +0200)]
[mlir] Remove unused namespace alias.

2 years ago[NFC][Costmodel][LV][X86] Add test coverage for f32 interleaved load/store stride=2
Roman Lebedev [Thu, 30 Sep 2021 11:24:42 +0000 (14:24 +0300)]
[NFC][Costmodel][LV][X86] Add test coverage for f32 interleaved load/store stride=2

2 years ago[AArch64][GlobalISel] Re-generate some tests for D110802.
Amara Emerson [Thu, 30 Sep 2021 11:15:30 +0000 (04:15 -0700)]
[AArch64][GlobalISel] Re-generate some tests for D110802.

2 years ago[PowerPC] Truncate element index for vec_insert in altivec.h
Nemanja Ivanovic [Thu, 30 Sep 2021 02:28:38 +0000 (21:28 -0500)]
[PowerPC] Truncate element index for vec_insert in altivec.h

When a user specifies an out-of-range index for vec_insert, we
just produce IR that has undefined behaviour even though the
documentation states that modulo arithmetic is used. This patch
just truncates the value to a valid index.

2 years ago[fir] Update fir.field_index op
Valentin Clement [Thu, 30 Sep 2021 10:51:14 +0000 (12:51 +0200)]
[fir] Update fir.field_index op

Move the parser, printer, verifier and builder out of the .td file.
Rename lenparams to typeparams to be in sync with fir-dev.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: rovka

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

2 years ago[NFC] Cleanup the overload of ASTImporter::import()
Balazs Benics [Thu, 30 Sep 2021 09:53:08 +0000 (11:53 +0200)]
[NFC] Cleanup the overload of ASTImporter::import()

This patch aims to address the comment of a previous review:
https://reviews.llvm.org/D109237#inline-1040678

The original problem was the following:
  `T` is substituted by `clang::Type`

  Expected<T *> import(T *From) {
    auto ToOrErr = Importer.Import(From);
    //             ^^^^^^^^^^^^^^^^^^^^^
    if (!ToOrErr)
      return ToOrErr.takeError();
    return cast_or_null<T>(*ToOrErr);
    //     ^^^^^^^^^^^^^^^^^^^^^^^^^
  }

`Importer.Import()` operates on `const Type *`, thus returns `const Type *`.
Later, at the return statement, we will try to construct an `Expected<Type*>`
from a `const Type *`, which failed with a miserable error message.

In all other cases `importer.Import()` results in a non-const version,
so everything works out just fine, but for `clang::type`s, we should
really return a const version.

So, in case of `T` is a subclass of `clang::Type`, it will return a
`Exprected<const T*>` instead.

Reviewed By: martong

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

2 years agoRevert "[clangd] Reland D110386"
Kirill Bobyrev [Thu, 30 Sep 2021 09:36:34 +0000 (11:36 +0200)]
Revert "[clangd] Reland D110386"

This reverts commits

dd13f45e04366cc4f648b57ec87d20a5569e27c3
d084c42bdfac4a5879bdabe645b14cf72f7685a7
87817bc523daba1d2bd0492144a5d6adba8a649c

2 years ago[fir][NFC] Move parser/printer/builder to cpp file
Valentin Clement [Thu, 30 Sep 2021 09:17:46 +0000 (11:17 +0200)]
[fir][NFC] Move parser/printer/builder to cpp file

Move the parsers, printers and builders from the TableGen file
to the .cpp file. Remaining parsers, printers and builders will be
moved when we update the operations.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

2 years ago[fir] Update fir.alloca op
Eric Schweitz [Thu, 30 Sep 2021 09:04:02 +0000 (11:04 +0200)]
[fir] Update fir.alloca op

Update the fir.alloca operation.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: mehdi_amini

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
2 years ago[fir] Update fir.allocmem op
Valentin Clement [Thu, 30 Sep 2021 08:57:37 +0000 (10:57 +0200)]
[fir] Update fir.allocmem op

Updatet the fir.allocmem operation.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[gn build] Port 13f3c39f3658
LLVM GN Syncbot [Thu, 30 Sep 2021 08:28:24 +0000 (08:28 +0000)]
[gn build] Port 13f3c39f3658

2 years agoSecond Recommit "[AArch64] Split bitmask immediate of bitwise AND operation"
Jingu Kang [Wed, 29 Sep 2021 01:42:21 +0000 (02:42 +0100)]
Second Recommit "[AArch64] Split bitmask immediate of bitwise AND operation"

This reverts the revert commit c07f7099690e8607d119227db1f80ee21eff3a3b with
bug fixes.

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

2 years ago[fir] Update fir.extract_value and fir.insert_value ops
Eric Schweitz [Thu, 30 Sep 2021 08:22:16 +0000 (10:22 +0200)]
[fir] Update fir.extract_value and fir.insert_value ops

Move coor operand from variadic values to ArrayAttr.
Update assembly format.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: kiranchandramohan

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
2 years ago[LiveIntervals] Remove unused subreg ranges in repairIntervalsInRange
Jay Foad [Mon, 27 Sep 2021 10:44:18 +0000 (11:44 +0100)]
[LiveIntervals] Remove unused subreg ranges in repairIntervalsInRange

If the old instructions mentioned a subreg that the new instructions do
not, remove the subrange for that subreg.

For example, in TwoAddressInstructionPass::eliminateRegSequence, if a
use operand in the REG_SEQUENCE has the undef flag then we don't
generate a copy for it so after the elimination there should be no live
interval at all for the corresponding subreg of the def.

This is a small step towards switching TwoAddressInstructionPass over
from LiveVariables to LiveIntervals. Currently this path is only tested
if you explicitly enable -early-live-intervals.

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

2 years ago[fir] Update fir.array_update, fir.array_fetch and fir.array_merge_store
Eric Schweitz [Thu, 30 Sep 2021 07:55:45 +0000 (09:55 +0200)]
[fir] Update fir.array_update, fir.array_fetch and fir.array_merge_store

Add typeparams to fir.array_update, fir.array_fetch and
fir.array_merge_store operations. Add optional slice operands to
fir.array_merge_store op.
Move verifiers to cpp file.

Reviewed By: kiranchandramohan

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

Co-authored-by: Valentin Clement <clementval@gmail.com>
2 years agoFix the build after d084c42bdfac4a5879bdabe645b14cf72f7685a7
Kirill Bobyrev [Thu, 30 Sep 2021 07:52:37 +0000 (09:52 +0200)]
Fix the build after d084c42bdfac4a5879bdabe645b14cf72f7685a7

2 years ago[flang][docs] Remove the new driver sync-up calls
Andrzej Warzynski [Thu, 30 Sep 2021 07:49:15 +0000 (07:49 +0000)]
[flang][docs] Remove the new driver sync-up calls

2 years agoInvestigate failure in rGdd13f45e04366cc4f648b57ec87d20a5569e27c3
Kirill Bobyrev [Thu, 30 Sep 2021 07:49:27 +0000 (09:49 +0200)]
Investigate failure in rGdd13f45e04366cc4f648b57ec87d20a5569e27c3

https://lab.llvm.org/buildbot/#/builders/123/builds/6406/steps/8/logs/stdio

2 years ago[format] [docs] Fix typos and clarify QualifierAlignment/QualifierOrder documentation.
Marek Kurdej [Thu, 30 Sep 2021 07:42:15 +0000 (09:42 +0200)]
[format] [docs] Fix typos and clarify QualifierAlignment/QualifierOrder documentation.

2 years ago[mlir][python] provide bindings for the SCF dialect
Alex Zinenko [Wed, 29 Sep 2021 19:42:53 +0000 (21:42 +0200)]
[mlir][python] provide bindings for the SCF dialect

This is an important core dialect that has not been exposed previously. Set up
the default bindings generation and provide a nicer wrapper for the `for` loop
with access to the loop configuration and body.

Depends On D110758

Reviewed By: stellaraccident

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

2 years ago[mlir][python] provide access to function argument/result attributes
Alex Zinenko [Wed, 29 Sep 2021 19:42:10 +0000 (21:42 +0200)]
[mlir][python] provide access to function argument/result attributes

Without this change, these attributes can only be accessed through the generic
operation attribute dictionary provided the caller knows the special operation
attribute names used for this purpose. Add some Python wrapping to support this
use case.

Also provide access to function arguments usable inside the function along with
a couple of quality-of-life improvements in using block arguments (function
arguments being the arguments of its entry block).

Reviewed By: stellaraccident

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

2 years ago[AA] Teach BasicAA to recognize basic GEP range information.
Clement Courbet [Tue, 14 Sep 2021 07:03:57 +0000 (09:03 +0200)]
[AA] Teach BasicAA to recognize basic GEP range information.

The information can be implicit (from `ValueTracking`) or explicit.

This implements the backend part of the following RFC
https://groups.google.com/g/llvm-dev/c/T9o51zB1JY.

We still need to settle on how to best represent the information in the
IR, but this is a separate discussion.

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

2 years ago[clangd] Reland D110386
Kirill Bobyrev [Thu, 30 Sep 2021 06:25:31 +0000 (08:25 +0200)]
[clangd] Reland D110386

D110711 will fix the bug on Windows side and allows me to reland this
patch.

Also land e50771181b7e0d96b30ee33049dc05172125b927 on top of it.

2 years ago[llvm-profgen] Fix alignment in preferred based calculation
Wenlei He [Thu, 30 Sep 2021 00:41:11 +0000 (17:41 -0700)]
[llvm-profgen] Fix alignment in preferred based calculation

We used the segment alignment in elf header to assume the loader alignment. However this is incorrect because loader alignment is always the same as page size. If segment needs to be aligned at load time, linker will set aligned address as virtual address in elf header.

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

2 years ago[llvm-porfgen] Allow perf data as input
Wenlei He [Thu, 30 Sep 2021 00:03:33 +0000 (17:03 -0700)]
[llvm-porfgen] Allow perf data as input

This change enables llvm-profgen to take raw perf data as alternative input format. Sometimes we need to retrieve evenets for processes with matching binary. Using perf data as input allows us to retrieve process Ids from mmap events for matching binary, then filter by process id during perf script generation.

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

2 years ago[llvm-profgen] Refactor and better diagnostics
Wenlei He [Wed, 29 Sep 2021 16:04:44 +0000 (09:04 -0700)]
[llvm-profgen] Refactor and better diagnostics

This change contains diagnostics improvments, refactoring and preparation for consuming perf data directly.

Diagnostics:
 - We now have more detailed diagnostics when no mmap is found.
 - We also print warning for abnormal transition to external code.

Refactoring:
 - Simplify input perf trace processing to only allow a single input file. This is because 1) using multiple input perf trace (perf script) is error prone because we may miss key mmap events. 2) the functionality is not really being used anyways.
 - Make more functions private for Readers, move non-trivial definitions out of header. Cleanup some inconsistency.
 - Prepare for consuming perf data as input directly.

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

2 years ago[clang] Update Clang version from 13 to 14 in scan-build.1.
Frederic Cambus [Thu, 30 Sep 2021 05:53:07 +0000 (11:23 +0530)]
[clang] Update Clang version from 13 to 14 in scan-build.1.

Reviewed By: NoQ

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

2 years agoAsmParser::getContext() - there can be only one. This should unbreak the build.
Chris Lattner [Thu, 30 Sep 2021 05:23:03 +0000 (22:23 -0700)]
AsmParser::getContext() - there can be only one.  This should unbreak the build.

2 years ago[ODS/AsmParser] Don't pass MLIRContext with DialectAsmParser.
Chris Lattner [Thu, 30 Sep 2021 00:47:08 +0000 (17:47 -0700)]
[ODS/AsmParser] Don't pass MLIRContext with DialectAsmParser.

The former is redundant because the later carries it as part of
its builder.  Add a getContext() helper method to DialectAsmParser
to make this more convenient, and stop passing the context around
explicitly.  This simplifies ODS generated parser hooks for attrs
and types.

This resolves PR51985

Recommit 4b32f8bac4 after fixing a dependency.

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

2 years ago[AsmParser] move AsmParser::getContext to IR library.
Chris Lattner [Thu, 30 Sep 2021 05:05:44 +0000 (22:05 -0700)]
[AsmParser] move AsmParser::getContext to IR library.

This is (perhaps unintuitively) where the other AsmParser method
implementations are, which means that dialects don't generally need
to depend on MLIRParser directly.  This should fix a build failure
building .so files on the mlir-nvidia builder.

2 years agoRevert "[ODS/AsmParser] Don't pass MLIRContext with DialectAsmParser."
Mehdi Amini [Thu, 30 Sep 2021 05:01:17 +0000 (05:01 +0000)]
Revert "[ODS/AsmParser] Don't pass MLIRContext with DialectAsmParser."

This reverts commit 4b32f8bac40dcd1535bfe95757c3de0911bf6d1a.

Seems like the build is broken with -DDBUILD_SHARED_LIBS=ON

2 years ago[ODS/AsmParser] Don't pass MLIRContext with DialectAsmParser.
Chris Lattner [Thu, 30 Sep 2021 00:47:08 +0000 (17:47 -0700)]
[ODS/AsmParser] Don't pass MLIRContext with DialectAsmParser.

The former is redundant because the later carries it as part of
its builder.  Add a getContext() helper method to DialectAsmParser
to make this more convenient, and stop passing the context around
explicitly.  This simplifies ODS generated parser hooks for attrs
and types.

This resolves PR51985

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

2 years agoMake "process attach -c" work correctly, and add a test for it.
Jim Ingham [Thu, 30 Sep 2021 02:38:09 +0000 (19:38 -0700)]
Make "process attach -c" work correctly, and add a test for it.

The issue here was that we were not updating the interpreter's
execution context when calling HandleCommand to continue the process.
Since we had just created the process, it wasn't in the interpreter's
execution context so HandleCommand failed at CheckRequirements.  The
patch fixes that by passing the process execution context directly
to HandleCommand.

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

2 years agoAdd the --relative-to-command-file to "command source" so you can
Jim Ingham [Tue, 28 Sep 2021 00:51:37 +0000 (17:51 -0700)]
Add the --relative-to-command-file to "command source" so you can
have linked command files in a source tree and get to them all from
one main command file.

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

2 years agoSecond attempt to fix Windows failures from test changes
Teresa Johnson [Thu, 30 Sep 2021 02:23:08 +0000 (19:23 -0700)]
Second attempt to fix Windows failures from test changes

Try to address Windows flakes from d87bdc272ba47b7d9109ff5c7191454ab2ae6fcb
by adding "|| true" as suggested in D110276 so the whole test doesn't
fail when Windows thinks it can't remove the binary.

2 years agoAMDGPU: Broadcast scalar boolean to vector boolean explicitly
Ruiling Song [Thu, 16 Sep 2021 15:04:39 +0000 (23:04 +0800)]
AMDGPU: Broadcast scalar boolean to vector boolean explicitly

This is used to fix wrong code generation of s_add_co_select_user in
test/CodeGen/AMDGPU/expand-scalar-carry-out-select-user.ll

  s_addc_u32 s4, s6, 0
  s_cselect_b64 vcc, 1, 0    <-- vcc set as 0x1 if SCC==1
  v_mov_b32_e32 v1, s4
  s_cmp_gt_u32 s6, 31
  v_cndmask_b32_e32 v1, 0, v1, vcc

If the s_addc_u32 set SCC, then we will get value 0x1 in VCC.
The v_cndmask will do per thread selection with VCC as condition
register. As VCC only gets the first bit being set, only the first
thread/lane in destination register can get correct result if the
very first lane is active. In fact, we should broadcast the value to all
active lanes of the final register.

The idea here is doing this broadcast to vector boolean explicitly
instead of lowering it into a COPY from SCC which would be interpreted as
selecting between 0/1.

This is used to replace D109754.

Reviewed-by: foad, alex-t
Differential Revision: https://reviews.llvm.org/D109889

2 years ago[clang] Fix sentence in the usage section of ThinLTO docs.
Frederic Cambus [Thu, 30 Sep 2021 01:56:01 +0000 (07:26 +0530)]
[clang] Fix sentence in the usage section of ThinLTO docs.

Reviewed By: tejohnson

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

2 years agoRevert "[clang-cl] Accept `#pragma warning(disable : N)` for some N"
Amy Huang [Thu, 30 Sep 2021 01:45:08 +0000 (18:45 -0700)]
Revert "[clang-cl] Accept `#pragma warning(disable : N)` for some N"
because it causes `error: error reading '/wd4091'` errors in
compiler-rt builds.

2 years ago[mlir][vector] Fold transfer ops and tensor.extract/insert_slice.
Matthias Springer [Thu, 30 Sep 2021 00:25:40 +0000 (09:25 +0900)]
[mlir][vector] Fold transfer ops and tensor.extract/insert_slice.

* Fold vector.transfer_read and tensor.extract_slice.
* Fold vector.transfer_write and tensor.insert_slice.

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

2 years ago[llvm-objdump/llvm-readobj/obj2yaml/yaml2obj] Support STO_RISCV_VARIANT_CC and DT_RIS...
Fangrui Song [Wed, 29 Sep 2021 23:56:52 +0000 (16:56 -0700)]
[llvm-objdump/llvm-readobj/obj2yaml/yaml2obj] Support STO_RISCV_VARIANT_CC and DT_RISCV_VARIANT_CC

STO_RISCV_VARIANT_CC marks that a symbol uses a non-standard calling
convention or the vector calling convention.

See https://github.com/riscv/riscv-elf-psabi-doc/pull/190

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

2 years ago[IntelJITListener] Fix order in JitListener/multiple.ll
Andy Kaylor [Wed, 29 Sep 2021 19:25:16 +0000 (12:25 -0700)]
[IntelJITListener] Fix order in JitListener/multiple.ll

As reported in Bugzilla 51859, the JitListener/multiple.ll test had
become stale. The function order in the emitted image was changed by an
update to the MC/ElfObjectWriter code and because this test is disabled
by default, it wasn't updated.

2 years ago[libc++] Simplify the _LIBCPP_CONSTEXPR markings on starts_with() etc.
Arthur O'Dwyer [Tue, 28 Sep 2021 16:19:35 +0000 (12:19 -0400)]
[libc++] Simplify the _LIBCPP_CONSTEXPR markings on starts_with() etc.

This came out of review comments on D110598.

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