platform/upstream/llvm.git
4 years ago[MachineVerifier] Verify that a DBG_VALUE has a debug location
Vedant Kumar [Wed, 27 May 2020 22:44:10 +0000 (15:44 -0700)]
[MachineVerifier] Verify that a DBG_VALUE has a debug location

Summary:
Verify that each DBG_VALUE has a debug location. This is required by
LiveDebugValues, and perhaps by other late passes.

There's an exception for tests: lots of tests use a two-operand form of
DBG_VALUE for convenience. There's no reason to prevent that.

This is an extension of D80665, but there's no dependency.

Reviewers: aprantl, jmorse, davide, chrisjackson

Subscribers: hiraditya, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, llvm-commits

Tags: #llvm

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

4 years ago[MachineLICM] Assert that locations from debug insts are not lost
Vedant Kumar [Wed, 27 May 2020 20:13:13 +0000 (13:13 -0700)]
[MachineLICM] Assert that locations from debug insts are not lost

Summary:
Assert that MachineLICM does not move a debug instruction and then drop
its debug location. Later passes require each debug instruction to have
a location.

Testing: check-llvm, clang stage2 RelWithDebInfo build (x86_64)

Reviewers: aprantl, davide, chrisjackson, jmorse

Subscribers: hiraditya, asbirlea, llvm-commits

Tags: #llvm

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

4 years ago[Statepoints] Sink routines for grabbing projections to GCStatepointInst [NFC]
Philip Reames [Thu, 28 May 2020 20:49:41 +0000 (13:49 -0700)]
[Statepoints] Sink routines for grabbing projections to GCStatepointInst [NFC]

Mechanical movement, nothing more.

4 years ago[Statepoint] Sink actual_args and gc_args to GCStatepointInst [NFC]
Philip Reames [Thu, 28 May 2020 20:34:12 +0000 (13:34 -0700)]
[Statepoint] Sink actual_args and gc_args to GCStatepointInst [NFC]

These are the two operand sets which are expected to survive more than another week or so.  Instead of bothering to update the deopt and gc-transition operands, we'll just wait until those are removed and delete the code.

For those following along, this is likely to be the last (major) change in this sequence for about a week.  I want to wait until all of this has been merged downstream to ensure I haven't introduced any bugs (and migrate some downstream code to the new interfaces).  Once that's done, we should be able to delete Statepoint/ImmutableStatepoint without too much work.

4 years ago[Statepoint] Use iterate_range.empty [NFC]
Philip Reames [Thu, 28 May 2020 19:31:49 +0000 (12:31 -0700)]
[Statepoint] Use iterate_range.empty [NFC]

4 years ago[Clang] Enable KF and KC mode for [_Complex] __float128
Nemanja Ivanovic [Thu, 28 May 2020 20:48:05 +0000 (15:48 -0500)]
[Clang] Enable KF and KC mode for [_Complex] __float128

The headers provided with recent GNU toolchains for PPC have code that includes
typedefs such as:

typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__KC__)))

This patch allows clang to compile programs that contain
#include <math.h>

with -mfloat128 which it currently fails to compile.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=46068

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

4 years ago[lldb-vscode] Make it possible to run vsce package
Greg Clayton [Thu, 28 May 2020 20:29:48 +0000 (13:29 -0700)]
[lldb-vscode] Make it possible to run vsce package

Summary:
Running `vsce package` to package lldb-vscode as an installable .vsix file errors with:

```
ERROR  Invalid publisher name 'llvm.org'. Expected the identifier of a publisher, not its human-friendly name.
```

This patch fixes the publisher name and bumps a required dependency so that `vsce package` succeeds.

Reviewers: clayborg

Reviewed By: clayborg

Tags: #lldb

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

4 years ago[StackSafety] Lazy calculations
Vitaly Buka [Thu, 28 May 2020 08:07:31 +0000 (01:07 -0700)]
[StackSafety] Lazy calculations

We are going to convert this into pure analysis, so
processing will be delayed up to the first safety request.

4 years ago[NFC,StackSafety] Move internal offset calculation
Vitaly Buka [Thu, 28 May 2020 20:01:02 +0000 (13:01 -0700)]
[NFC,StackSafety] Move internal offset calculation

4 years ago[StackSafety] Don't run datafow on allocas
Vitaly Buka [Thu, 28 May 2020 05:21:39 +0000 (22:21 -0700)]
[StackSafety] Don't run datafow on allocas

We need to process only parameters. Allocas access can be calculated
afterwards.
Also don't create fake function for aliases and just resolve them on
initialization.

4 years ago[StackSafety] Remove SetMetadata parameter
Vitaly Buka [Thu, 28 May 2020 03:35:06 +0000 (20:35 -0700)]
[StackSafety] Remove SetMetadata parameter

4 years ago[Docs] Correct description of lldbinit behavior
Jonas Devlieghere [Thu, 28 May 2020 20:06:44 +0000 (13:06 -0700)]
[Docs] Correct description of lldbinit behavior

Jim pointed out that "every time somebody has touched the documentation
on startup files they have stated that we source the application one and
then the global one, even though in actual fact we’ve never done that."

Indeed, when we read the application specific .lldbinit file, the global
one is not read. This patch updates the man page to reflect that.

4 years agoadd isAtPosition narrowing matcher for parmVarDecl
Vy Nguyen [Thu, 28 May 2020 04:33:13 +0000 (00:33 -0400)]
add isAtPosition narrowing matcher for parmVarDecl

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

4 years agoImprove test infrastructure in SyntaxTree
Eduardo Caldas [Thu, 28 May 2020 16:28:36 +0000 (18:28 +0200)]
Improve test infrastructure in SyntaxTree

Summary:
* Test if the code sourcing the SyntaxTree compiles
* Output compiler errors and warnings to err
* Fix tests with code that did not compile

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years agoAdd tests for preallocated + musttail
Arthur Eubanks [Thu, 28 May 2020 17:27:52 +0000 (10:27 -0700)]
Add tests for preallocated + musttail

Summary:
Follow-up to https://reviews.llvm.org/D80581.
Turns out the codegen part already worked, so only needed to add tests.
I manually verified that in these tests the generated code for inalloca
and preallocated were identical.

Reviewers: efriedma, hans

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[llvm] [MatrixIntrinsics] Add row-major support for llvm.matrix.transpose
aartbik [Thu, 28 May 2020 18:04:02 +0000 (11:04 -0700)]
[llvm] [MatrixIntrinsics] Add row-major support for llvm.matrix.transpose

Summary:
Only column-major was supported so far. This adds row-major support as well.
Note that we probably also want very efficient SIMD implementations for the
various target platforms.

Bug:
https://bugs.llvm.org/show_bug.cgi?id=46085

Reviewers: nicolasvasilache, reidtatge, bkramer, fhahn, ftynse, andydavis1, craig.topper, dcaballe, mehdi_amini, anemet

Reviewed By: fhahn

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "[LoopUnroll] Support loops with exiting block that is neither header nor"
Whitney Tsang [Thu, 28 May 2020 19:08:07 +0000 (19:08 +0000)]
Revert "[LoopUnroll] Support loops with exiting block that is neither header nor"

This reverts commit 281058226587d8c70172ff0fb1e55d58876da229.

Revert until
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-debian/builds/7334
is resolved.

4 years ago[AArch64] Add native CPU detection for Neoverse N1
Sjoerd Meijer [Thu, 28 May 2020 18:49:12 +0000 (19:49 +0100)]
[AArch64] Add native CPU detection for Neoverse N1

Map the CPU ID value 0xd0c to "neoverse-n1".

Patch by James Greenhalgh.

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

4 years agoAMDGPU/GlobalISel: precommit extractelement test. NFC.
Stanislav Mekhanoshin [Thu, 28 May 2020 18:36:36 +0000 (11:36 -0700)]
AMDGPU/GlobalISel: precommit extractelement test. NFC.

4 years ago[Statepoint] Convert a few more isStatepoint calls to idiomatic isa/cast
Philip Reames [Thu, 28 May 2020 18:28:58 +0000 (11:28 -0700)]
[Statepoint] Convert a few more isStatepoint calls to idiomatic isa/cast

I'd apparently only grepped in the lib directories and missed a few used in the Statepoint header itself.  Beyond simple mechanical cleanup, changed the type of one routine to reflect the fact it also returns a statepoint.

4 years agoAMDGPU: Handle rewriting ptrmask for more address spaces
Matt Arsenault [Mon, 18 May 2020 15:32:46 +0000 (11:32 -0400)]
AMDGPU: Handle rewriting ptrmask for more address spaces

If this mask only clears bits in the low 32-bit half of a flat
pointer, these bits are always preserved in the result address
space. If the high bits are modified, they may need to be preserved
for some kind of user pointer tagging.

4 years ago[libc++] NFC: Remove outdated numbering in <bit> synopsis
Louis Dionne [Thu, 28 May 2020 18:28:09 +0000 (14:28 -0400)]
[libc++] NFC: Remove outdated numbering in <bit> synopsis

4 years ago[LoopUnroll] Support loops with exiting block that is neither header nor
Whitney Tsang [Thu, 28 May 2020 18:23:56 +0000 (18:23 +0000)]
[LoopUnroll] Support loops with exiting block that is neither header nor
latch.

Summary: Remove the limitation in LoopUnrollPass that exiting block must
be either header or latch.
Reviewer: dmgreen, jdoerfert, Meinersbur, kbarton, bmahjour, etiotto,
fhahn, efriedma
Reviewed By: etiotto, fhahn, efriedma
Subscribers: efriedma, lkail, xbolva00, hiraditya, zzheng, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D80477

4 years agoAMDGPU: Add intrinsic for s_setreg
Matt Arsenault [Wed, 6 May 2020 20:43:33 +0000 (16:43 -0400)]
AMDGPU: Add intrinsic for s_setreg

This will be more useful with fenv access implemented.

4 years ago[libc] Fixing the build command for benchmarks.
Anthony Steinhauser [Thu, 28 May 2020 18:19:20 +0000 (11:19 -0700)]
[libc] Fixing the build command for benchmarks.

Building libc without clang fails with:
CMake Error at /home/asteinhauser/llvm-project/libc/CMakeLists.txt:49 (message):
'clang' and 'clang-tools-extra' are required in LLVM_ENABLE_PROJECTS to
lint llvm-libc. The linting step performs important checks to help prevent
the introduction of subtle bugs, but it may increase build times.

Reviewers: sivachandra

Reviewed By: sivachandra

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

4 years ago[clang] Avoid linking libdl unless needed
Tobias Hieta [Thu, 28 May 2020 18:04:38 +0000 (21:04 +0300)]
[clang] Avoid linking libdl unless needed

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

4 years ago[mlir][Linalg] Add pass to remove unit-extent dims from tensor
MaheshRavishankar [Thu, 28 May 2020 17:19:47 +0000 (10:19 -0700)]
[mlir][Linalg] Add pass to remove unit-extent dims from tensor
operands of Generic ops.

Unit-extent dimensions are typically used for achieving broadcasting
behavior. The pattern added (along with canonicalization patterns
added previously) removes the use of unit-extent dimensions, and
instead uses a more canonical representation of the computation.  This
new pattern is not added as a canonicalization for now since it
entails adding additional reshape operations. A pass is added to
exercise these patterns, along with an API entry to populate a
patterns list with these patterns.

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

4 years ago[mlir][GPU] Link relevant LLVM components in GPUCommon instead of test
Alex Zinenko [Thu, 28 May 2020 16:57:39 +0000 (18:57 +0200)]
[mlir][GPU] Link relevant LLVM components in GPUCommon instead of test

D80142 restructured MLIR-to-GPU-binary conversion to support multiple
targets. It also modified cmake files to link relevant LLVM components
in test/lib, which broke shared-library builds, and likely made the
conversions unusable outside mlir-opt (or other tools that link in test
library targets). Link these components to GPUCommon instead.

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

4 years ago[Statepoint] Sink logic about actual callee into GCStatepointInst
Philip Reames [Thu, 28 May 2020 17:45:07 +0000 (10:45 -0700)]
[Statepoint] Sink logic about actual callee into GCStatepointInst

Sinking logic around actual callee from Statepoint to GCStatepointInst.  While doing so, adjust naming to be consistent about refering to "actual" callee and follow precedent on naming from CallBase otherwise.

Use the result to simplify one consumer.  This is mostly just to ensure the new code is exercised, but is also a helpful cleanup on it's own.

4 years ago[lldb/Reproducers] Add top-level-target check-lldb-reproducers
Jonas Devlieghere [Thu, 28 May 2020 17:39:45 +0000 (10:39 -0700)]
[lldb/Reproducers] Add top-level-target check-lldb-reproducers

This adds a new target `check-lldb-reproducers` that replaces the old
`check-lldb-repro`. The latter would only run the shell tests, while
`check-lldb-reproducers` includes the API tests as well. The new target
will be used on GreenDragon.

It's still possible to run just the shell tests with reproducers,
although now that requires crafting the lit invocation yourself. The
parameters haven't changed and are the shame for the API and shell
tests:

  --param lldb-run-with-repro=capture
  --param lldb-run-with-repro=replay

This patch also updates the reproducer documentation.

4 years ago[analyzer] SATestBuild.py: Make verbosity level a cmd option
Valeriy Savchenko [Wed, 27 May 2020 13:06:45 +0000 (16:06 +0300)]
[analyzer] SATestBuild.py: Make verbosity level a cmd option

Reviewers: NoQ, dcoughlin

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years ago[clang-tidy] Fix build broken by commit 7cfdff7b4a6704b8ef2a1b594e1ec19d2d89f385...
Yitzhak Mandelbaum [Thu, 28 May 2020 17:36:45 +0000 (13:36 -0400)]
[clang-tidy] Fix build broken by commit 7cfdff7b4a6704b8ef2a1b594e1ec19d2d89f385 (D80023)

4 years ago[IR] Avoid linear scan in MDNode::intersect() (NFC)
Nikita Popov [Thu, 28 May 2020 15:15:21 +0000 (17:15 +0200)]
[IR] Avoid linear scan in MDNode::intersect() (NFC)

00940fb8544767ba5217922c4ba96677aabe9eb3 changed this code to
construct a set for the B metadata. However, it still performs a
linear is_contained query, rather than making use of the set
structure.

4 years ago[ThinLTO] Compute the basic block count across modules.
Hiroshi Yamauchi [Thu, 21 May 2020 20:28:24 +0000 (13:28 -0700)]
[ThinLTO] Compute the basic block count across modules.

Summary:
Count the per-module number of basic blocks when the module summary is computed
and sum them up during Thin LTO indexing.

This is used to estimate the working set size under the partial sample PGO.

This is split off of D79831.

Reviewers: davidxl, espindola

Subscribers: emaste, inglorion, hiraditya, MaskRay, steven_wu, dexonsmith, arphaman, llvm-commits

Tags: #llvm

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

4 years ago[analyzer] Remove unused function declaration. NFC.
Valeriy Savchenko [Thu, 28 May 2020 17:28:17 +0000 (20:28 +0300)]
[analyzer] Remove unused function declaration. NFC.

4 years ago[analyzer] Remove unused function. NFC.
Valeriy Savchenko [Thu, 28 May 2020 17:22:18 +0000 (20:22 +0300)]
[analyzer] Remove unused function. NFC.

4 years agoDefault to generating statepoints with deopt and gc-transition bundles if needed
Philip Reames [Thu, 28 May 2020 17:11:08 +0000 (10:11 -0700)]
Default to generating statepoints with deopt and gc-transition bundles if needed

Continues from D80598.

The key point of the change is to default to using operand bundles instead of the inline length prefix argument lists for statepoint nodes. An important subtlety to note is that the presence of a bundle has semantic meaning, even if it is empty. As such, we need to make a somewhat deeper change to the interface than is first obvious.

Existing code treats statepoint deopt arguments and the deopt bundle operands differently during inlining. The former is ignored (resulting in caller state being dropped), the later is merged.

We can't preserve the old behaviour for calls with deopt fed to RS4GC and then inlining, but we can avoid the no-deopt case changing. At least in internal testing, that seem to be the important one. (I'd argue the "stop merging after RS4GC" behaviour for the former was always "unexpected", but that the behaviour for non-deopt calls actually make sense.)

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

4 years ago[PGO] Guard the memcmp/bcmp size value profiling instrumentation behind flag.
Hiroshi Yamauchi [Wed, 27 May 2020 17:13:33 +0000 (10:13 -0700)]
[PGO] Guard the memcmp/bcmp size value profiling instrumentation behind flag.

Summary:
Follow up D79751 and put the instrumentation / value collection side (in
addition to the optimization side) behind the flag as well.

Reviewers: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[X86] Add 'avx512vp2intersect' to getHostCPUFeatures.
Craig Topper [Thu, 28 May 2020 15:28:12 +0000 (08:28 -0700)]
[X86] Add 'avx512vp2intersect' to getHostCPUFeatures.

4 years agoFix the crashlog.py script's use of the load_address property.
Jim Ingham [Thu, 28 May 2020 00:26:32 +0000 (17:26 -0700)]
Fix the crashlog.py script's use of the load_address property.

This property is explicitly for use only in the interactive editor,
and NOT in commands.  It's use worked until we got more careful about
not leaving lldb.target lying around in the script interpreter.

I also added a quick sniff test for the save_crashlog command.

<rdar://problem/60350620>
Differential Revision: https://reviews.llvm.org/D80680

4 years ago[gn build] Port 7cfdff7b4a6
LLVM GN Syncbot [Thu, 28 May 2020 16:49:43 +0000 (16:49 +0000)]
[gn build] Port 7cfdff7b4a6

4 years ago[SDAG] Don't require LazyBlockFrequencyInfo at optnone
Nikita Popov [Thu, 21 May 2020 14:48:05 +0000 (16:48 +0200)]
[SDAG] Don't require LazyBlockFrequencyInfo at optnone

While LazyBlockFrequencyInfo itself is lazy, the dominator tree
and loop info analyses it requires are not. Drop the dependency
on this pass in SelectionDAGIsel at O0.
This makes for a ~0.6% O0 compile-time improvement.

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

4 years agoCreate utility function to Merge Adjacent Basic Blocks
Sidharth Baveja [Thu, 28 May 2020 16:12:45 +0000 (16:12 +0000)]
Create utility function to Merge Adjacent Basic Blocks

Summary: The following code from
/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp can be used by other
transformations:

while (!MergeBlocks.empty()) {
    BasicBlock *BB = *MergeBlocks.begin();
    BranchInst *Term = dyn_cast<BranchInst>(BB->getTerminator());
    if (Term && Term->isUnconditional() &&
L->contains(Term->getSuccessor(0))) {
      BasicBlock *Dest = Term->getSuccessor(0);
      BasicBlock *Fold = Dest->getUniquePredecessor();
      if (MergeBlockIntoPredecessor(Dest, &DTU, LI)) {
        // Don't remove BB and add Fold as they are the same BB
        assert(Fold == BB);
        (void)Fold;
        MergeBlocks.erase(Dest);
      } else
        MergeBlocks.erase(BB);
    } else
      MergeBlocks.erase(BB);
  }
Hence it should be separated into its own utility function.

Authored By: sidbav
Reviewer: Whitney, Meinersbur, asbirlea, dmgreen, etiotto
Reviewed By: asbirlea
Subscribers: hiraditya, zzheng, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D80583

4 years ago[llvm-exegesis] Make a few counter methods virtual to allow targets to provide target...
Vy Nguyen [Wed, 27 May 2020 22:06:40 +0000 (18:06 -0400)]
[llvm-exegesis] Make a few counter methods virtual to allow targets to provide target-specific support.
Misc: Also include errno in failure message.

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

4 years ago[clang-tidy] Add abseil-string-find-str-contains checker.
Tom Lokovic [Thu, 28 May 2020 16:22:30 +0000 (12:22 -0400)]
[clang-tidy] Add abseil-string-find-str-contains checker.

Summary: This adds a checker which suggests replacing string.find(...) == npos with absl::StrContains.

Reviewers: alexfh, hokein, aaron.ballman, njames93, ymandel

Reviewed By: ymandel

Subscribers: ymandel, Eugene.Zelenko, xazax.hun, mgorny, Charusso, phosek, cfe-commits

Tags: #clang, #clang-tools-extra

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

4 years agoMake VE.def a textual header
Adrian Prantl [Thu, 28 May 2020 16:35:06 +0000 (09:35 -0700)]
Make VE.def a textual header

4 years ago[libc++] Complete overhaul of constexpr support in std::array
Louis Dionne [Fri, 22 May 2020 13:59:48 +0000 (09:59 -0400)]
[libc++] Complete overhaul of constexpr support in std::array

This commit adds missing support for constexpr in std::array under all
standard modes up to and including C++20. It also transforms the <array>
tests to check for constexpr-friendliness under the right standard modes.

Fixes https://llvm.org/PR40124
Fixes rdar://57522096
Supersedes https://reviews.llvm.org/D60666

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

4 years ago[AMDGPU] Reject moving PHI to VALU if the only VGPR input originated from move immediate
alex-t [Fri, 22 May 2020 09:15:57 +0000 (12:15 +0300)]
[AMDGPU] Reject moving PHI to VALU if the only VGPR input originated from move immediate

Summary:
PHIs result register class is set to VGPR or SGPR depending on the cross block value divergence.
         In some cases uniform PHI need to be converted to return VGPR to prevent the oddnumber of moves values from VGPR to SGPR and back.
         PHI should certainly return VGPR if it has at least one VGPR input. This change adds the exception.
         We don't want to convert uniform PHI to VGPRs in case the only VGPR input is a VGPR to SGPR COPY and definition od the
         source VGPR in this COPY is move immediate.

  bb.0:

     %0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
     %2:sreg_32 = .....

  bb.1:
     %3:sreg_32 = PHI %1, %bb.3, %2, %bb.1
     S_BRANCH %bb.3

  bb.3:
     %1:sreg_32 = COPY %0
     S_BRANCH %bb.2

Reviewers: rampitec

Reviewed By: rampitec

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Fix mismatched-tags warning
Jacques Pienaar [Thu, 28 May 2020 16:06:47 +0000 (09:06 -0700)]
[mlir] Fix mismatched-tags warning

4 years ago[mlir] Use ValueRange instead of ArrayRef<Value>
Jacques Pienaar [Thu, 28 May 2020 16:05:24 +0000 (09:05 -0700)]
[mlir] Use ValueRange instead of ArrayRef<Value>

This allows constructing operand adaptor from existing op (useful for commonalizing verification as I want to do in a follow up).

I also add ability to use member initializers for the generated adaptor constructors for convenience.

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

4 years agoRemove WrapperMatcherInterface
Dmitri Gribenko [Thu, 28 May 2020 15:36:48 +0000 (17:36 +0200)]
Remove WrapperMatcherInterface

Summary:
WrapperMatcherInterface is an abstraction over a member variable -- in
other words, not much of an abstraction at all. I think it makes code
harder to read more than in helps with deduplication. Not to even
mention the questionable usage of the ~Interface suffix for a type with
state.

Reviewers: ymandel

Reviewed By: ymandel

Subscribers: arichardson, cfe-commits

Tags: #clang

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

4 years ago[analyzer] Introduce reasoning about symbolic remainder operator
Valeriy Savchenko [Thu, 14 May 2020 14:07:54 +0000 (17:07 +0300)]
[analyzer] Introduce reasoning about symbolic remainder operator

Summary:
New logic tries to narrow possible result values of the remainder operation
based on its operands and their ranges.  It also tries to be conservative
with negative operands because according to the standard the sign of
the result is implementation-defined.

rdar://problem/44978988

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

4 years ago[analyzer] Generalize bitwise AND rules for ranges
Valeriy Savchenko [Tue, 5 May 2020 16:42:33 +0000 (19:42 +0300)]
[analyzer] Generalize bitwise AND rules for ranges

Summary:
Previously the current solver started reasoning about bitwise AND
expressions only when one of the operands is a constant.  However,
very similar logic could be applied to ranges.  This commit addresses
this shortcoming.  Additionally, it refines how we deal with negative
operands.

rdar://problem/54359410

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

4 years ago[analyzer] Generalize bitwise OR rules for ranges
Valeriy Savchenko [Mon, 4 May 2020 16:44:43 +0000 (19:44 +0300)]
[analyzer] Generalize bitwise OR rules for ranges

Summary:
Previously the current solver started reasoning about bitwise OR
expressions only when one of the operands is a constant.  However,
very similar logic could be applied to ranges.  This commit addresses
this shortcoming.  Additionally, it refines how we deal with negative
operands.

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

4 years ago[analyzer] Refactor range inference for symbolic expressions
Valeriy Savchenko [Fri, 1 May 2020 08:49:23 +0000 (11:49 +0300)]
[analyzer] Refactor range inference for symbolic expressions

Summary:
This change introduces a new component to unite all of the reasoning
we have about operations on ranges in the analyzer's solver.
In many cases, we might conclude that the range for a symbolic operation
is much more narrow than the type implies.  While reasoning about
runtime conditions (especially in loops), we need to support more and
more of those little pieces of logic.  The new component mostly plays
a role of an organizer for those, and allows us to focus on the actual
reasoning about ranges and not dispatching manually on the types of the
nested symbolic expressions.

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

4 years ago[analyzer] Merge implementations of SymInt, IntSym, and SymSym exprs
Valeriy Savchenko [Thu, 30 Apr 2020 08:09:52 +0000 (11:09 +0300)]
[analyzer] Merge implementations of SymInt, IntSym, and SymSym exprs

Summary:
SymIntExpr, IntSymExpr, and SymSymExpr share a big portion of logic
that used to be duplicated across all three classes.  New
implementation also adds an easy way of introducing another type of
operands into the mix.

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

4 years ago[x86] Propagate memory operands during call frame optimization
Jean-Michel Gorius [Thu, 28 May 2020 15:43:59 +0000 (17:43 +0200)]
[x86] Propagate memory operands during call frame optimization

Summary:
Propagate memory operands when folding load instructions into instructions that directly operate on memory.

The original revision has been split. See D80140 for the other part of the changes.

Reviewers: craig.topper, rnk, lebedev.ri, efriedma

Reviewed By: craig.topper

Subscribers: lebedev.ri, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[libTooling] Fix Transformer to work with ambient traversal kinds.
Yitzhak Mandelbaum [Wed, 27 May 2020 02:59:08 +0000 (22:59 -0400)]
[libTooling] Fix Transformer to work with ambient traversal kinds.

Summary:
`RewriteRule`'s `applyFirst` was brittle with respect to the default setting of the
`TraversalKind`. This patch builds awareness of traversal kinds directly into
rewrite rules so that they are insensitive to any changes in defaults.

Reviewers: steveire, gribozavr

Subscribers: hokein, cfe-commits

Tags: #clang

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

4 years ago[mlir] Make translation libraries available through MLIRConfig.cmake
Jean-Michel Gorius [Thu, 28 May 2020 15:38:00 +0000 (17:38 +0200)]
[mlir] Make translation libraries available through MLIRConfig.cmake

4 years ago[ASTMatchers] Add traversal-kind support to `DynTypedMatcher`
Yitzhak Mandelbaum [Wed, 27 May 2020 22:04:50 +0000 (18:04 -0400)]
[ASTMatchers] Add traversal-kind support to `DynTypedMatcher`

Summary:
This patch exposes `TraversalKind` support in the `DynTypedMatcher` API. While
previously, the `match` method supported traversal logic, it was not possible to
set or get the traversal kind.

Reviewers: gribozavr, steveire

Subscribers: hokein, cfe-commits

Tags: #clang

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

4 years ago[clangd] Work around PS4 -fno-exceptions, easier than disabling tests?
Sam McCall [Thu, 28 May 2020 15:12:43 +0000 (17:12 +0200)]
[clangd] Work around PS4 -fno-exceptions, easier than disabling tests?

4 years agoAMDGPU: Add missing test for s_denorm_mode scheduling
Matt Arsenault [Thu, 28 May 2020 14:46:23 +0000 (10:46 -0400)]
AMDGPU: Add missing test for s_denorm_mode scheduling

Forgot to add this file to 1a9e0d7092145e33175f628f4cdd28acf0d17100

4 years agolibclc: Compile with -nostdlib
Matt Arsenault [Tue, 26 May 2020 21:03:20 +0000 (17:03 -0400)]
libclc: Compile with -nostdlib

This fixes a build error when compiling for amdgcn-amd-amdhsa, which
defaults to trying to link bitcode libraries.

4 years agoAMDGPU: Make S_DENORM_MODE not be a scheduling boundary
Matt Arsenault [Wed, 27 May 2020 18:48:14 +0000 (14:48 -0400)]
AMDGPU: Make S_DENORM_MODE not be a scheduling boundary

Now that the mode register uses/defs should be properly modeled, we
don't need to treat the FP mode switch as an arbitrary side effect.

4 years agoSymbolicFile.h - removed unused FileSystem.h include. NFC.
Simon Pilgrim [Thu, 28 May 2020 14:26:15 +0000 (15:26 +0100)]
SymbolicFile.h - removed unused FileSystem.h include. NFC.

Exposes a number of implicit dependencies that needs fixing in source files and XCOFFObjectFile.h.

4 years agoPrevent test from failing in my home directory
Sam McCall [Thu, 28 May 2020 14:14:49 +0000 (16:14 +0200)]
Prevent test from failing in my home directory

4 years ago[MLIR] Fix operand type in `from_extent_tensor` in the shape dialect
Frederik Gossen [Thu, 28 May 2020 14:10:11 +0000 (14:10 +0000)]
[MLIR] Fix operand type in `from_extent_tensor` in the shape dialect

The operand of `from_extent_tensor` is now of the same index type as the result
type of the inverse operation `to_extent_tensor`.

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

4 years ago[mlir][gpu][mlir-cuda-runner] Refactor ConvertKernelFuncToCubin to be generic.
Wen-Heng (Jack) Chung [Fri, 22 May 2020 21:25:00 +0000 (16:25 -0500)]
[mlir][gpu][mlir-cuda-runner] Refactor ConvertKernelFuncToCubin to be generic.

Make ConvertKernelFuncToCubin pass to be generic:

- Rename to ConvertKernelFuncToBlob.
- Allow specifying triple, target chip, target features.
- Initializing LLVM backend is supplied by a callback function.
- Lowering process from MLIR module to LLVM module is via another callback.
- Change mlir-cuda-runner to adopt the revised pass.
- Add new tests for lowering to ROCm HSA code object (HSACO).
- Tests for CUDA and ROCm are kept in separate directories.

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

4 years ago[MLIR] Add `num_elements` to the shape dialect
Frederik Gossen [Thu, 28 May 2020 14:04:39 +0000 (14:04 +0000)]
[MLIR] Add `num_elements` to the shape dialect

The operation `num_elements` determines the number of elements for a given
shape.
That is the product of its dimensions.

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

4 years agoInferAddressSpaces: Handle ptrmask intrinsic
Matt Arsenault [Fri, 15 May 2020 18:54:51 +0000 (14:54 -0400)]
InferAddressSpaces: Handle ptrmask intrinsic

This one is slightly odd since it counts as an address expression,
which previously could never fail. Allow the existing TTI hook to
return the value to use, and re-use it for handling how to handle
ptrmask.

Handles the no-op addrspacecasts for AMDGPU. We could probably do
something better based on analysis of the mask value based on the
address space, but leave that for now.

4 years agoAMDGPU: Add baseline test for ptrmask infer address space
Matt Arsenault [Fri, 15 May 2020 21:29:40 +0000 (17:29 -0400)]
AMDGPU: Add baseline test for ptrmask infer address space

4 years ago[MLIR] Add `index_to_size` and `size_to_index` to the shape dialect
Frederik Gossen [Thu, 28 May 2020 13:55:02 +0000 (13:55 +0000)]
[MLIR] Add `index_to_size` and `size_to_index` to the shape dialect

Add the two conversion operations `index_to_size` and `size_to_index` to the
shape dialect.
This facilitates the conversion of index types between the shape and the
standard dialect.

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

4 years ago[MLIR] Add TensorFromElementsOp to Standard ops.
Alexander Belyaev [Thu, 28 May 2020 11:36:40 +0000 (13:36 +0200)]
[MLIR] Add TensorFromElementsOp to Standard ops.

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

4 years ago[MLIR] Tidy up documentation for `Shape_JoinOp`, `Shape_ReduceOp`, and
Frederik Gossen [Thu, 28 May 2020 13:40:34 +0000 (13:40 +0000)]
[MLIR] Tidy up documentation for `Shape_JoinOp`, `Shape_ReduceOp`, and
`Shape_ConstSizeOp`

Fix places that refer to `shape.type` instead of `shape.shape`.

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

4 years agoFileOutputBuffer.h - remove unused includes. NFC.
Simon Pilgrim [Thu, 28 May 2020 13:37:17 +0000 (14:37 +0100)]
FileOutputBuffer.h - remove unused includes. NFC.

Move dependent includes down to source files where necessary.

4 years agoWithColor.h - reduce unnecessary includes to forward declarations. NFC.
Simon Pilgrim [Thu, 28 May 2020 12:58:35 +0000 (13:58 +0100)]
WithColor.h - reduce unnecessary includes to forward declarations. NFC.

4 years ago[MLIR] Move `ConcatOp` to its lexicographic position
Frederik Gossen [Thu, 28 May 2020 13:35:51 +0000 (13:35 +0000)]
[MLIR] Move `ConcatOp` to its lexicographic position

Purely cosmetic change.
The operation implementations in `Shape.cpp` are now lexicographic order.

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

4 years ago[X86][SSE] Peek though MOVMSK source sign bits using SimplifyMultipleUseDemandedBits
Simon Pilgrim [Thu, 28 May 2020 12:34:09 +0000 (13:34 +0100)]
[X86][SSE] Peek though MOVMSK source sign bits using SimplifyMultipleUseDemandedBits

Allows SimplifyDemandedBitsForTargetNode to peek through multi-use ops where MOVMSK only demands the signbit of each vector element.

4 years agoFixed bot failure after d20bf5a7258d4b6a7
Alok Kumar Sharma [Thu, 28 May 2020 10:16:06 +0000 (15:46 +0530)]
Fixed bot failure after d20bf5a7258d4b6a7

There was a failure on windows bit due to format mismatch on
different(Hex and Decimal) platforms even if meaning of output is same.

For example on X86 linux =>
DW_OP_plus_uconst 0x70, DW_OP_deref, DW_OP_lit4, DW_OP_mul
              ^
on X86 Windows-gnu =>
DW_AT_location (DW_OP_fbreg +112, DW_OP_deref, DW_OP_lit4, DW_OP_mul)

: error: CHECK-SAME: expected string not found in input
; CHECK-SAME: DW_OP_plus_uconst 0x70, DW_OP_deref, DW_OP_lit4, DW_OP_mul
              ^
<stdin>:28:17: note: scanning from here
 DW_AT_location (DW_OP_fbreg +112, DW_OP_deref, DW_OP_lit4, DW_OP_mul)
                ^
<stdin>:28:18: note: possible intended match here
 DW_AT_location (DW_OP_fbreg +112, DW_OP_deref, DW_OP_lit4, DW_OP_mul)

Now the test is limited to x86 using REQUIRED and -mtriple.

http://45.33.8.238/win/16214/step_11.txt

4 years ago[AMDGPU][MC][GFX908] Corrected src0 of v_accvgpr_write to accept only VGPRs and inlin...
Dmitry Preobrazhensky [Thu, 28 May 2020 12:07:58 +0000 (15:07 +0300)]
[AMDGPU][MC][GFX908] Corrected src0 of v_accvgpr_write to accept only VGPRs and inline constants.

This change disables use of special SGPR registers like scc, vccz, execz, etc as operands of v_accvgpr_write.

See bug 45414: https://bugs.llvm.org/show_bug.cgi?id=45414

Reviewers: arsenm, rampitec

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

4 years agoFix MSVC signed/unsigned comparison warnings. NFC.
Simon Pilgrim [Thu, 28 May 2020 12:07:06 +0000 (13:07 +0100)]
Fix MSVC signed/unsigned comparison warnings. NFC.

4 years agoDWARFDebugMacro.h - remove unnecessary WithColor.h include. NFC.
Simon Pilgrim [Thu, 28 May 2020 12:02:44 +0000 (13:02 +0100)]
DWARFDebugMacro.h - remove unnecessary WithColor.h include. NFC.

4 years agollvm-dwarfdump.h - remove unnecessary WithColor.h include. NFC.
Simon Pilgrim [Thu, 28 May 2020 12:01:53 +0000 (13:01 +0100)]
llvm-dwarfdump.h - remove unnecessary WithColor.h include. NFC.

4 years ago[Clang] Enable _Complex __float128
Nemanja Ivanovic [Thu, 28 May 2020 11:55:37 +0000 (06:55 -0500)]
[Clang] Enable _Complex __float128

When I added __float128 a while ago, I neglected to add support for the complex
variant of the type. This patch just adds that.

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

4 years ago[AMDGPU][MC] Corrected v_writelane_b32 to fix a decoding bug
Dmitry Preobrazhensky [Thu, 28 May 2020 11:25:29 +0000 (14:25 +0300)]
[AMDGPU][MC] Corrected v_writelane_b32 to fix a decoding bug

Corrected vdst_in to match vdst operand type.
See bug 45193: https://bugs.llvm.org/show_bug.cgi?id=45193

Reviewers: arsenm, rampitec

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

4 years ago[clangd] Highlight related control flow.
Sam McCall [Sun, 19 Apr 2020 00:19:25 +0000 (02:19 +0200)]
[clangd] Highlight related control flow.

Summary:
This means e.g. highlighting "return" will show other returns/throws
from the same function, highlighting a case will show all the
return/breaks etc.

This is a bit of an abuse of textDocument/highlight, but seems useful.

Reviewers: adamcz

Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[AMDGPU][MC][DISASSEMBLER] Corrected decoder to consume each code fragment only once
Dmitry Preobrazhensky [Thu, 28 May 2020 11:15:29 +0000 (14:15 +0300)]
[AMDGPU][MC][DISASSEMBLER] Corrected decoder to consume each code fragment only once

Summary: disabled disassembly of successfully decoded fragments of code.

See detailed bug description: https://bugs.llvm.org/show_bug.cgi?id=46101

Reviewers: arsenm, rampitec

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

4 years ago[analyzer] Allow bindings of the CompoundLiteralRegion
Valeriy Savchenko [Tue, 28 Apr 2020 09:21:39 +0000 (12:21 +0300)]
[analyzer] Allow bindings of the CompoundLiteralRegion

Summary:
CompoundLiteralRegions have been properly modeled before, but
'getBindingForElement` was not changed to accommodate this change
properly.

rdar://problem/46144644

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

4 years ago[yaml2obj] - Implement the "SectionHeaderTable" tag.
Georgii Rymar [Thu, 14 May 2020 11:15:40 +0000 (14:15 +0300)]
[yaml2obj] - Implement the "SectionHeaderTable" tag.

With the "SectionHeaderTable" it is now possible to reorder
entries in the section header table.

It also allows to stop emitting the table.

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

4 years ago[DebugInfo] Use SplitTemplateClosers (foo<bar<baz> >) in DWARF too
Sam McCall [Tue, 26 May 2020 13:43:52 +0000 (15:43 +0200)]
[DebugInfo] Use SplitTemplateClosers (foo<bar<baz> >) in DWARF too

Summary:
D76801 caused some regressions in debuginfo compatibility by changing how
certain functions were named.

For CodeView we try to mirror MSVC exactly: this was fixed in a549c0d00486
For DWARF the situation is murkier. Per David Blaikie:
> In general DWARF doesn't specify this at all.
> [...]
> This isn't the only naming divergence between GCC and Clang

Nevertheless, including the space seems to provide better compatibility with
GCC and GDB. E.g. cpexprs.cc in the GDB testsuite requires this formatting.
And there was no particular desire to change the printing of names in debug
info in the first place (just in diagnostics and other more user-facing text).

Fixes PR46052

Reviewers: dblaikie, labath

Subscribers: aprantl, cfe-commits, dyung

Tags: #clang

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

4 years ago[AArch64] Precommit new fp extraction/insertion test.
Florian Hahn [Thu, 28 May 2020 09:43:47 +0000 (10:43 +0100)]
[AArch64] Precommit new fp extraction/insertion test.

4 years agoFixed bot failure after d20bf5a7258d4b6a7
Alok Kumar Sharma [Thu, 28 May 2020 09:42:28 +0000 (15:12 +0530)]
Fixed bot failure after d20bf5a7258d4b6a7

There were some bot failures due unused funtion `rotateSign`
left in code.

http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/3731

error: unused function 'rotateSign' [-Werror,-Wunused-function]
static uint64_t rotateSign(int64_t I)

4 years ago[AArch64][SVE] Add support for spilling/filling ZPR2/3/4
Cullen Rhodes [Thu, 28 May 2020 09:37:55 +0000 (09:37 +0000)]
[AArch64][SVE] Add support for spilling/filling ZPR2/3/4

Summary:
This patch enables the register allocator to spill/fill lists of 2, 3
and 4 SVE vectors registers to/from the stack. This is implemented with
pseudo instructions that get expanded to individual LDR_ZXI/STR_ZXI
instructions in AArch64ExpandPseudoInsts.

Patch by Sander de Smalen.

Reviewed By: efriedma

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

4 years ago[ARM] Improve codegen of volatile load/store of i64
Victor Campos [Mon, 9 Mar 2020 13:29:37 +0000 (13:29 +0000)]
[ARM] Improve codegen of volatile load/store of i64

Summary:
Instead of generating two i32 instructions for each load or store of a volatile
i64 value (two LDRs or STRs), now emit LDRD/STRD.

These improvements cover architectures implementing ARMv5TE or Thumb-2.

The code generation explicitly deviates from using the register-offset
variant of LDRD/STRD. In this variant, the register allocated to the
register-offset cannot be reused in any of the remaining operands. Such
restriction seems to be non-trivial to implement in LLVM, thus it is
left as a to-do.

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

4 years agoFileCheck [10/12]: Add support for signed numeric values
Thomas Preud'homme [Tue, 5 Mar 2019 23:20:29 +0000 (23:20 +0000)]
FileCheck [10/12]: Add support for signed numeric values

Summary:
This patch is part of a patch series to add support for FileCheck
numeric expressions. This specific patch adds support signed numeric
values, thus allowing negative numeric values.

As such, the patch adds a new class to represent a signed or unsigned
value and add the logic for type promotion and type conversion in
numeric expression mixing signed and unsigned values. It also adds
the %d format specifier to represent signed value.

Finally, it also adds underflow and overflow detection when performing a
binary operation.

Copyright:
    - Linaro (changes up to diff 183612 of revision D55940)
    - GraphCore (changes in later versions of revision D55940 and
                 in new revision created off D55940)

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson

Reviewed By: jhenderson, arichardson

Subscribers: MaskRay, hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

4 years ago[TableGen] Fix non-standard escape warnings for braces in InstAlias
Cullen Rhodes [Thu, 28 May 2020 09:00:51 +0000 (09:00 +0000)]
[TableGen] Fix non-standard escape warnings for braces in InstAlias

Summary:
TableGen interprets braces ('{}') in the asm string of instruction aliases as
variants but when defining aliases with literal braces they have to be escaped
to prevent them being removed.

Braces are escaped with '\\', for example:

  def FooBraces : InstAlias<"foo \\{$imm\\}", (foo IntOperand:$imm)>;

Although when TableGen is emitting the assembly writer (-gen-asm-writer)
the AsmString that gets emitted is:

  AsmString = "foo \{$\x01\}";

In c/c++ braces don't need to be escaped which causes compilation
warnings:

  warning: use of non-standard escape character '\{' [-Wpedantic]

This patch fixes the issue by unescaping the flattened alias asm string
in the asm writer, by replacing '\{\}' with '{}'.

Reviewed By: hfinkel

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

4 years ago[Clang][Sanitizers] Expect test failure on {arm,thumb}v7
Marco Elver [Wed, 27 May 2020 21:55:53 +0000 (23:55 +0200)]
[Clang][Sanitizers] Expect test failure on {arm,thumb}v7

Summary:
Versions of LLVM built on {arm,thumb}v7 appear to have differently
configured pass managers, which causes restrictions on which sanitizers
we may use.

As such, expect failure of the recently added "sanitize-coverage.c" test
on these architectures until we can investigate armv7's restrictions.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=46117

Reviewers: vitalybuka, glider

Reviewed By: glider

Subscribers: glider, kristof.beyls, danielkiss, cfe-commits, vvereschaka

Tags: #clang

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

4 years agotsan: disable java_finalizer2 test on darwin
Dmitry Vyukov [Thu, 28 May 2020 09:03:02 +0000 (11:03 +0200)]
tsan: disable java_finalizer2 test on darwin

pthread_barrier_t is not supported on darwin.
Do what other tests that use pthread_barrier_t do.

4 years ago[CodeGen] Specify meaning of ISD opcodes for scalable vectors
Sander de Smalen [Thu, 28 May 2020 08:27:00 +0000 (09:27 +0100)]
[CodeGen] Specify meaning of ISD opcodes for scalable vectors

This patch contains changes to the description of EXTRACT_SUBVECTOR,
INSERT_SUBVECTOR, INSERT_VECTOR_ELT, EXTRACT_VECTOR_ELT and
CONCAT_VECTORS to specify their behaviour for scalable vectors.

For EXTRACT_SUBVECTOR it specifies that the IDX is scaled by the
same runtime scaling as the extracted (or inserted) vector. This
definition is the most natural extension to EXTRACT_SUBVECTOR for
scalable vectors, as most use-cases that work on fixed-width types
will have the same meaning for scalable types. For legalization for
example, it is common to split the vector operation to operate on
the LO and HI halfs of a vector.

For a fixed width vector <16 x i8> this would be expressed with:

  v16i8 %res = EXTRACT_SUBVECTOR v32i8 %v, i32 16

For a scalable vector, this would similarly be expressed as:

  nxv16i8 %res = EXTRACT_SUBVECTOR nxv32i8 %V, i32 16

By extending the meaning of IDX for scalable vectors, most existing
optimisations on EXTRACT/INSERT_SUBVECTOR work for scalable vectors
without any changes. This definition also allows extracting a
fixed-width subvector from a scalable vector, which is useful to
e.g. extract the low N lanes of a scalable vector.

This patch is not NFC because it sets the meaning of these nodes
for scalable vectors, which future patches will build upon.

Reviewers: efriedma, ctetreau, rogfer01, craig.topper

Reviewed By: efriedma

Tags: #llvm

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

4 years ago[DebugInfo] Upgrade DISubrange to support Fortran dynamic arrays
Alok Kumar Sharma [Thu, 28 May 2020 08:01:22 +0000 (13:31 +0530)]
[DebugInfo] Upgrade DISubrange to support Fortran dynamic arrays

This patch upgrades DISubrange to support fortran requirements.

Summary:
Below are the updates/addition of fields.
lowerBound - Now accepts signed integer or DIVariable or DIExpression,
earlier it accepted only signed integer.
upperBound - This field is now added and accepts signed interger or
DIVariable or DIExpression.
stride - This field is now added and accepts signed interger or
DIVariable or DIExpression.
This is required to describe bounds of array which are known at runtime.

Testing:
unit test cases added (hand-written)
check clang
check llvm
check debug-info

Reviewed By: aprantl

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