platform/upstream/llvm.git
3 years ago[clang][NFC] Fix a potential assert failure
Ben Shi [Fri, 16 Apr 2021 23:17:34 +0000 (07:17 +0800)]
[clang][NFC] Fix a potential assert failure

Reviewed By: MaskRay, craig.topper

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

3 years agoTarget::ReadMemory read from read-only binary file Section, not memory
Jason Molenda [Fri, 16 Apr 2021 23:10:16 +0000 (16:10 -0700)]
Target::ReadMemory read from read-only binary file Section, not memory

Commiting this patch for Augusto Noronha who is getting set
up still.

This patch changes Target::ReadMemory so the default behavior
when a read is in a Section that is read-only is to fetch the
data from the local binary image, instead of reading it from
memory.  Update all callers to use their old preferences
(the old prefer_file_cache bool) using the new API; we should
revisit these calls and see if they really intend to read
live memory, or if reading from a read-only Section would be
equivalent and important for performance-sensitive cases.

rdar://30634422

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

3 years ago[inferattrs] Don't infer lib func attributes for nobuiltin functions
Philip Reames [Fri, 16 Apr 2021 22:28:15 +0000 (15:28 -0700)]
[inferattrs] Don't infer lib func attributes for nobuiltin functions

If we have a nobuiltin function, we can't assume we know anything about the implementation.

I noticed this when tracing through a log from an in the wild miscompile (https://github.com/emscripten-core/emscripten/issues/9443) triggered after 8666463.  We were incorrectly assuming that a custom allocator could not free.  (It's not clear yet this is the only problem in said issue.)

I also noticed something similiar mentioned in the commit message of ab243e when scrolling back through history.  Through, from what I can tell, that commit fixed symptom not root cause.

The interface we have for library function detection is extremely error prone, but given the interaction between ``nobuiltin`` decls and ``builtin`` callsites, it's really hard to imagine something much cleaner.  I may iterate on that, but it'll be invasive enough I didn't want to hold an obvious functional fix on it.

3 years ago[gn build] (manually) port ca6751043d88 better
Nico Weber [Fri, 16 Apr 2021 22:16:14 +0000 (18:16 -0400)]
[gn build] (manually) port ca6751043d88 better

3 years ago[TableGen] Run GenerateVariants before ExpandHwModeBasedTypes.
Craig Topper [Fri, 16 Apr 2021 21:59:40 +0000 (14:59 -0700)]
[TableGen] Run GenerateVariants before ExpandHwModeBasedTypes.

A large portion of the patterns are duplicated for HwMode on RISCV.
If we expand HwMode first, we need to check nearly twice as many
patterns for variants. HwModes shouldn't affect whether a variant
is valid so we should be able to expand after.

This also reduces the RISCV isel table by 539 bytes due to factoring
working better on this pattern order. Unfortunately it increases
Hexagon table size by ~50 bytes. But I think this is a reasonable
trade.

3 years ago[gn build] (manually) port ca6751043d88
Nico Weber [Fri, 16 Apr 2021 22:03:44 +0000 (18:03 -0400)]
[gn build] (manually) port ca6751043d88

3 years ago[libc] Fix wrongly deduced type
Guillaume Chatelet [Fri, 16 Apr 2021 21:58:27 +0000 (21:58 +0000)]
[libc] Fix wrongly deduced type

3 years ago[OpenMP] Implement GOMP task reductions
Peyton, Jonathan L [Mon, 15 Mar 2021 19:02:34 +0000 (14:02 -0500)]
[OpenMP] Implement GOMP task reductions

Implement the remaining GOMP_* functions to support task reductions
in taskgroup, parallel, loop, and taskloop constructs.  The unused mem
argument to many of the work-sharing constructs has to do with the
scan() directive/ inscan() modifier.  If mem is set, each function
will call KMP_FATAL() and tell the user scan/inscan is unsupported.  The
GOMP reduction implementation is kept separate from our implementation
because of how GOMP presents reduction data and computes the reductions.
GOMP expects the privatized copies to be present even after a #pragma
omp parallel reduction(task:...) region has ended so the data is stored
inside GOMP's uintptr_t* data pseudo-structure.  This style is tightly
coupled with GCC compiler codegen.  There also isn't any init(),
combiner(), fini() functions in GOMP's codegen so the two
implementations were to disparate to try to wrap GOMP's around our own.

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

3 years ago[libc] Add endianness support
Guillaume Chatelet [Fri, 16 Apr 2021 21:34:49 +0000 (21:34 +0000)]
[libc] Add endianness support

Add endianness detection support. This will be useful to implement `memcmp`.

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

3 years ago[OpenMP] Allow affinity to re-detect for child processes
Peyton, Jonathan L [Tue, 23 Mar 2021 19:02:55 +0000 (14:02 -0500)]
[OpenMP] Allow affinity to re-detect for child processes

Current atfork() handler for child processes does not reset
the affinity masks array which prevents users from setting their own
affinity in child processes.

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

3 years ago[funcattrs] Add the maximal set of implied attributes to definitions
Philip Reames [Fri, 16 Apr 2021 21:03:36 +0000 (14:03 -0700)]
[funcattrs] Add the maximal set of implied attributes to definitions

Have funcattrs expand all implied attributes into the IR. This expands the infrastructure from D100400, but for definitions not declarations this time.

Somewhat subtly, this mostly isn't semantic. Because the accessors did the inference, any client which used the accessor was already getting the stronger result. Clients that directly checked presence of attributes (there are some), will see a stronger result now.

The old behavior can end up quite confusing for two reasons:
* Without this change, we have situations where function-attrs appears to fail when inferring an attribute (as seen by a human reading IR), but that consuming code will see that it should have been implied. As a human trying to sanity check test results and study IR for optimization possibilities, this is exceeding error prone and confusing. (I'll note that I wasted several hours recently because of this.)
* We can have transforms which trigger without the IR appearing (on inspection) to meet the preconditions. This change doesn't prevent this from happening (as the accessors still involve multiple checks), but it should make it less frequent.

I'd argue in favor of deleting the extra checks out of the accessors after this lands, but I want that in it's own review as a) it's purely stylistic, and b) I already know there's some disagreement.

Once this lands, I'm also going to do a cleanup change which will delete some now redundant duplicate predicates in the inference code, but again, that deserves to be a change of it's own.

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

3 years ago[libc] Extends the testing framework to support typed test
Guillaume Chatelet [Fri, 16 Apr 2021 09:18:03 +0000 (09:18 +0000)]
[libc] Extends the testing framework to support typed test

This patch provides `TYPED_TEST` and `TYPED_TEST_F` (similar in functionnality to gtest).
This is needed to extensively test building blocks for memory functions.

Example for `TYPED_TEST_F`:
```
template <typename T> class LlvmLibcMyTestFixture : public testing::Test {};

using Types = testing::TypeList<char, int, long>;

TYPED_TEST_F(LlvmLibcMyTestFixture, Simple, Types) {
  EXPECT_LE(sizeof(ParamType), 8UL);
}
```

Example for `TYPED_TEST`:
```
using Types = testing::TypeList<char, int, long>;

TYPED_TEST(LlvmLibcMyTest, Simple, Types) {
  EXPECT_LE(sizeof(ParamType), 8UL);
}
```

`ParamType` is displayed as fully qualified canonical type which can be difficult to read, the user can provide a more readable name by using the `REGISTER_TYPE_NAME` macro.

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

3 years ago[lld] Canonicalize HAVE_LIBXAR
Jez Ng [Fri, 16 Apr 2021 21:20:13 +0000 (17:20 -0400)]
[lld] Canonicalize HAVE_LIBXAR

I think this should unbreak the build after D100650...

3 years ago[sanitizer] GetTls: work around ppc64 with glibc<2.25(?) or GNU ld 2.30
Fangrui Song [Fri, 16 Apr 2021 21:03:28 +0000 (14:03 -0700)]
[sanitizer] GetTls: work around ppc64 with glibc<2.25(?) or GNU ld 2.30

GNU ld 2.26 and GNU ld 2.31 seem fine but GNU ld 2.30 has mysterious
segfaults linking msan tests.

3 years ago[lld-macho] Add separator to error message
Jez Ng [Fri, 16 Apr 2021 20:59:25 +0000 (16:59 -0400)]
[lld-macho] Add separator to error message

3 years ago[lldb] Set addressable bits from qHostInfo
Jonas Devlieghere [Fri, 16 Apr 2021 20:49:24 +0000 (13:49 -0700)]
[lldb] Set addressable bits from qHostInfo

Read the number of addressable bits from the qHostInfo packet and use it
to set the code and data address mask in the process. The data
(addressing_bits) is already present in the packet.

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

3 years ago[lldb] Implement ABI::Fix{Code,Data}Address for AArch64
Jonas Devlieghere [Fri, 16 Apr 2021 19:39:39 +0000 (12:39 -0700)]
[lldb] Implement ABI::Fix{Code,Data}Address for AArch64

Implement FixCodeAddress and FixDataAddress for ABIMacOSX_arm64 and
ABISysV_arm64 and add missing calls to RegisterContextUnwind. We need
this to unwind on Apple Silicon where libraries like libSystem are
arm64e even when the program being debugged is arm64.

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

3 years agoSimplify BitVector code
serge-sans-paille [Tue, 13 Apr 2021 14:14:32 +0000 (16:14 +0200)]
Simplify BitVector code

Instead of managing memory by hand, delegate it to std::vector. This makes the
code much simpler, and also avoids repeatedly computing the storage size.

According to valgrind --tool=callgrind, this also slightly decreases the
instruction count, but by a small margin.

This is a recommit of 82f0e3d3ea6bf927e3397b2fb423abbc5821a30f with one usage
fixed in llvm/lib/CodeGen/RegisterScavenging.cpp.

Not the slight API change: BitVector::clear() now has the same behavior as any
other container: it does not free memory, but indeed sets the size of the
BitVector to 0. It is thus incorrect to access its content right afterwards, a
scenario which wasn't enforced in previous implementation.

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

3 years ago[lld-macho] Initial groundwork for -bitcode_bundle
Jez Ng [Fri, 16 Apr 2021 20:46:45 +0000 (16:46 -0400)]
[lld-macho] Initial groundwork for -bitcode_bundle

This diff creates an empty XAR file and copies it into
`__LLVM,__bundle`. Follow-up work will actually populate the contents of
that XAR.

Reviewed By: #lld-macho, gkm

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

3 years ago[TableGen] Fix -Wparentheses
Fangrui Song [Fri, 16 Apr 2021 20:37:52 +0000 (13:37 -0700)]
[TableGen] Fix -Wparentheses

3 years ago[AMDGPU] Remove redundant field from DPP8 def
Joe Nash [Fri, 16 Apr 2021 17:22:23 +0000 (13:22 -0400)]
[AMDGPU] Remove redundant field from DPP8 def

These lines set the value to what it already was,
so they are redundant. NFC

Reviewed By: rampitec

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

Change-Id: Ibf6f27d50a7fa1f76c127f01b799821378bfd3b3

3 years ago[AMDGPU] NFC, Comment in disassembler for dpp8
Joe Nash [Fri, 16 Apr 2021 17:15:50 +0000 (13:15 -0400)]
[AMDGPU] NFC, Comment in disassembler for dpp8

Gives reasoning for convertDPP8.
Also corrects typo in Operand type comment.

Reviewed By: rampitec

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

Change-Id: I33ff269db8072d83e5e0ecdbfb731d6000fc26c4

3 years ago[TableGen] Predicate::operator== needs to compare the HwMode feature name in addition...
Craig Topper [Fri, 16 Apr 2021 20:16:47 +0000 (13:16 -0700)]
[TableGen] Predicate::operator== needs to compare the HwMode feature name in addition to the HwMode flag.

This was causing GenerateVariants to lose some variants since
HwMode is expanded first. We were mistakenly thinking the HwMode
predicate matched and finding the variant was isomorphic to a
pattern in another HwMode and discarding it.

Found while investigating it if would be better to generate
variants before expanding HwModes to improve RISCV build time.
I noticed an increase in the number of Opc_MorphNodeTo in the table
which indicated that the number of patterns had changed.

3 years ago[AMDGPU] Enforce that gfx802/803/805 do not support XNACK
Tony [Thu, 10 Dec 2020 04:07:04 +0000 (04:07 +0000)]
[AMDGPU] Enforce that gfx802/803/805 do not support XNACK

Reviewed By: kzhuravl

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

3 years ago[lldb] Add code and data address mask to Process
Jonas Devlieghere [Wed, 14 Apr 2021 23:34:04 +0000 (16:34 -0700)]
[lldb] Add code and data address mask to Process

Add a code and data address mask to Process with respective getters and
setters and a setting that allows the user to specify the mast as a
number of addressable bits. The masks will be used by FixCodeAddress and
FixDataAddress respectively in the ABI classes.

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

3 years ago[ELF] Default to -z start-stop-gc with a glibc "__libc_" special case
Fangrui Song [Fri, 16 Apr 2021 19:18:45 +0000 (12:18 -0700)]
[ELF] Default to -z start-stop-gc with a glibc "__libc_" special case

Change the default to facilitate GC for metadata section usage, so that they
don't need SHF_LINK_ORDER or SHF_GROUP just to drop the unhelpful rule (if they
want to be unconditionally retained, use SHF_GNU_RETAIN
(`__attribute__((retain))`) or linker script `KEEP`).

The dropped SHF_GROUP special case makes the behavior of -z start-stop-gc and -z
nostart-stop-gc closer to GNU ld>=2.37 (https://sourceware.org/PR27451).

However, we default to -z start-stop-gc (which actually matches more closely to
GNU ld before 2015-10 https://sourceware.org/PR19167), which is different from
modern GNU ld (which has the unhelpful rule to work around glibc). As a
compensation, we special case `__libc_` sections as a workaround for glibc<2.34
(https://sourceware.org/PR27492).

Since -z start-stop-gc as the default actually matches the traditional GNU ld
behavior, there isn't much to be aware of. There was a systemd usage which has
been fixed by https://github.com/systemd/systemd/pull/19144

3 years ago[WebAssembly] Remove saturating fp-to-int target intrinsics
Thomas Lively [Fri, 16 Apr 2021 19:11:20 +0000 (12:11 -0700)]
[WebAssembly] Remove saturating fp-to-int target intrinsics

Use the target-independent @llvm.fptosi and @llvm.fptoui intrinsics instead.
This includes removing the instrinsics for i32x4.trunc_sat_zero_f64x2_{s,u},
which are now represented in IR as a saturating truncation to a v2i32 followed by
a concatenation with a zero vector.

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

3 years agoDeclContext: Fix iterator category
Björn Schäpers [Thu, 15 Apr 2021 18:49:46 +0000 (20:49 +0200)]
DeclContext: Fix iterator category

This amends 0cb7e7ca0c864e052bf49978f3bcd667c9e16930.
The iterator category of lookup_iterator was changed, but here it stayed
hardcoded as random access. Found while trying to build Clazy.

Differential-Revision: https://reviews.llvm.org/D100590

3 years ago[tblgen] Fold loop into assert to avoid unused variable warnings. NFCI.
Benjamin Kramer [Fri, 16 Apr 2021 18:47:38 +0000 (20:47 +0200)]
[tblgen] Fold loop into assert to avoid unused variable warnings. NFCI.

3 years ago[nofree] Restrict semantics to memory visible to caller
Philip Reames [Fri, 16 Apr 2021 18:37:36 +0000 (11:37 -0700)]
[nofree] Restrict semantics to memory visible to caller

This patch clarifies the semantics of the nofree function attribute to make clear that it provides an "as if" semantic. That is, a nofree function is guaranteed not to free memory which existed before the call, but might allocate and then deallocate that same memory within the lifetime of the callee.

This is the result of the discussion on llvm-dev under the thread "Ambiguity in the nofree function attribute".

The most important part of this change is the LangRef wording. The rest is minor comment changes to emphasize the new semantics where code was accidentally consistent, and fix one place which wasn't consistent. That one place is currently narrowly used as it is primarily part of the ongoing (and not yet enabled) deref-at-point semantics work.

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

3 years ago[Builtins] Add memory allocation builtins (PR12543)
Dávid Bolvanský [Fri, 16 Apr 2021 18:34:03 +0000 (20:34 +0200)]
[Builtins] Add memory allocation builtins (PR12543)

3 years ago[CUDA, FDO] Filter out profiling options from GPU-side compilations.
Artem Belevich [Thu, 15 Apr 2021 20:48:28 +0000 (13:48 -0700)]
[CUDA, FDO] Filter out profiling options from GPU-side compilations.

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

3 years agoAddress D100645 comment
Vitaly Buka [Fri, 16 Apr 2021 18:28:41 +0000 (11:28 -0700)]
Address D100645 comment

3 years agoSanitizer built against glibc 2.34 doesn't work
Vitaly Buka [Fri, 16 Apr 2021 16:50:24 +0000 (09:50 -0700)]
Sanitizer built against glibc 2.34 doesn't work

As mentioned in https://gcc.gnu.org/PR100114 , glibc starting with the
https://sourceware.org/git/?p=glibc.git;a=commit;h=6c57d320484988e87e446e2e60ce42816bf51d53
change doesn't define SIGSTKSZ and MINSIGSTKSZ macros to constants, but to sysconf function call.
sanitizer_posix_libcdep.cpp has
static const uptr kAltStackSize = SIGSTKSZ * 4;  // SIGSTKSZ is not enough.
which is generally fine, just means that when SIGSTKSZ is not a compile time constant will be initialized later.
The problem is that kAltStackSize is used in SetAlternateSignalStack which is called very early, from .preinit_array
initialization, i.e. far before file scope variables are constructed, which means it is not initialized and
mmapping 0 will fail:
==145==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)

Here is one possible fix, another one could be to make kAltStackSize a preprocessor macro if _SG_SIGSTKSZ is defined
(but perhaps with having an automatic const variable initialized to it so that sysconf isn't at least called twice
during SetAlternateSignalStack.

Reviewed By: vitalybuka

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

3 years ago[LLDB] Re-land: Use path relative to binary for finding .dwo files.
Caroline Tice [Fri, 16 Apr 2021 18:06:19 +0000 (11:06 -0700)]
[LLDB] Re-land: Use path relative to binary for finding .dwo files.

DWARF allows .dwo file paths to be relative rather than absolute. When
they are relative, DWARF uses DW_AT_comp_dir to find the .dwo
file. DW_AT_comp_dir can also be relative, making the entire search
patch for the .dwo file relative. In this case, LLDB currently
searches relative to its current working directory, i.e. the directory
from which the debugger was launched. This is not right, as the
compiler, which generated the relative paths, can have no idea where
the debugger will be launched. The correct thing is to search relative
to the location of the executable binary. That is what this patch
does.

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

3 years ago[M68k] Fix empty builtin va_list kind
Min-Yih Hsu [Fri, 16 Apr 2021 17:53:17 +0000 (10:53 -0700)]
[M68k] Fix empty builtin va_list kind

Clang _requires_ every target to provide a va_list kind so we shouldn't
put a llvm_unreachable there. Using `VoidPtrBuiltinVaList` because m68k
doesn't have any special ABI for variadic args.

3 years agoReland "[Support] Don't include <algorithm> in MathExtras.h"
Nico Weber [Fri, 16 Apr 2021 18:05:12 +0000 (14:05 -0400)]
Reland "[Support] Don't include <algorithm> in MathExtras.h"

This reverts commit af2a93fd6e9f9e037d2e2d67b879fe85d7e1cbed.
This time, add the include to APInt.h, which apparently relied
on getting this include transitively.

3 years ago[TableGen] CodeGenDAGPatterns - use const references on for-range loops to avoid...
Simon Pilgrim [Fri, 16 Apr 2021 17:54:35 +0000 (18:54 +0100)]
[TableGen] CodeGenDAGPatterns - use const references on for-range loops to avoid unnecessary copies. NFCI.

3 years ago[TableGen] CodeGenMapTable - use for-range loop. NFCI.
Simon Pilgrim [Fri, 16 Apr 2021 17:32:56 +0000 (18:32 +0100)]
[TableGen] CodeGenMapTable - use for-range loop. NFCI.

3 years ago[AMDGPU] Remove dead dcode (NFC).
Christudasan Devadasan [Fri, 16 Apr 2021 17:24:57 +0000 (22:54 +0530)]
[AMDGPU] Remove dead dcode (NFC).

3 years ago[libc][NFC] Add template tests for a bunch of math functions.
Siva Chandra Reddy [Wed, 14 Apr 2021 20:32:50 +0000 (20:32 +0000)]
[libc][NFC] Add template tests for a bunch of math functions.

Namely, template tests have been added for the following functions:
ceil, copysign, fabs, fmax, fmin, floor, trunc, round.

3 years ago[TableGen] CodeGenDAGPatterns - (style) remove if-else chain when if block always...
Simon Pilgrim [Fri, 16 Apr 2021 17:21:13 +0000 (18:21 +0100)]
[TableGen] CodeGenDAGPatterns - (style) remove if-else chain when if block always returns. NFCI.

3 years ago[DAG] SelectionDAG::isSplatValue - early out if binop is not splat. NFCI.
Simon Pilgrim [Fri, 16 Apr 2021 16:26:32 +0000 (17:26 +0100)]
[DAG] SelectionDAG::isSplatValue - early out if binop is not splat. NFCI.

Just return false if we fail to match splats - the remainder of the code is for (fixed)vector operations - shuffles/insertions etc.

3 years agoRevert "[Support] Don't include <algorithm> in MathExtras.h"
Stella Stamenova [Fri, 16 Apr 2021 17:22:32 +0000 (10:22 -0700)]
Revert "[Support] Don't include <algorithm> in MathExtras.h"

This reverts commit 6580d8a2b14d50b7e067dc86df6e5dd65703d147.

3 years ago[AMDGPU] Refactor VOP3P Profile and AsmParser, NFC
Joe Nash [Thu, 15 Apr 2021 21:41:04 +0000 (17:41 -0400)]
[AMDGPU] Refactor VOP3P Profile and AsmParser, NFC

Refactors VOP3P tablegen and the AsmParser for VOP3P
for better extensibility. NFC intended

Reviewed By: rampitec

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

Change-Id: I038e3a772ac348bb18979cdf3e3ae2e9476dd411

3 years ago[fuzzer] Print reloaded file paths
Alexey Vishnyakov [Fri, 16 Apr 2021 16:21:49 +0000 (09:21 -0700)]
[fuzzer] Print reloaded file paths

In order to integrate libFuzzer with a dynamic symbolic execution tool
Sydr we need to print loaded file paths.

Reviewed By: morehouse

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

3 years ago[mlir][scf] Add scf.for + tensor.cast canonicalization pattern
Nicolas Vasilache [Fri, 16 Apr 2021 14:00:50 +0000 (14:00 +0000)]
[mlir][scf] Add scf.for + tensor.cast canonicalization pattern

Fold scf.for iter_arg/result pairs that go through incoming/ougoing
a tensor.cast op pair so as to pull the tensor.cast inside the scf.for:

```
  %0 = tensor.cast %t0 : tensor<32x1024xf32> to tensor<?x?xf32>
  %1 = scf.for %i = %c0 to %c1024 step %c32 iter_args(%iter_t0 = %0)
     -> (tensor<?x?xf32>) {
    %2 = call @do(%iter_t0) : (tensor<?x?xf32>) -> tensor<?x?xf32>
    scf.yield %2 : tensor<?x?xf32>
  }
  %2 = tensor.cast %1 : tensor<?x?xf32> to tensor<32x1024xf32>
  use_of(%2)
```

folds into:

```
  %0 = scf.for %arg2 = %c0 to %c1024 step %c32 iter_args(%arg3 = %arg0)
      -> (tensor<32x1024xf32>) {
    %2 = tensor.cast %arg3 : tensor<32x1024xf32> to tensor<?x?xf32>
    %3 = call @do(%2) : (tensor<?x?xf32>) -> tensor<?x?xf32>
    %4 = tensor.cast %3 : tensor<?x?xf32> to tensor<32x1024xf32>
    scf.yield %4 : tensor<32x1024xf32>
  }
  use_of(%0)
```

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

3 years agoVerify the LLVMContext that an Attribute belongs to.
Nick Lewycky [Wed, 24 Mar 2021 23:13:29 +0000 (16:13 -0700)]
Verify the LLVMContext that an Attribute belongs to.

Attributes don't know their parent Context, adding this would make Attribute larger. Instead, we add hasParentContext that answers whether this Attribute belongs to a particular LLVMContext by checking for itself inside the context's FoldingSet. Same with AttributeSet and AttributeList. The Verifier checks them with the Module context.

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

3 years ago[RISCV][Clang] Add RVV miscellaneous intrinsic functions.
Zakk Chen [Tue, 13 Apr 2021 02:01:44 +0000 (19:01 -0700)]
[RISCV][Clang] Add RVV miscellaneous intrinsic functions.

1. vreinterpret
2. vundefined
3. LMUL truncation and extension.

Reviewed By: craig.topper

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

3 years agoIgnore assume like calls by default in hasAddressTaken()
Stanislav Mekhanoshin [Fri, 5 Feb 2021 22:02:41 +0000 (14:02 -0800)]
Ignore assume like calls by default in hasAddressTaken()

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

3 years ago[RISCV][Clang] Drop the assembly tests for RVV intrinsics.
Zakk Chen [Fri, 16 Apr 2021 03:16:09 +0000 (20:16 -0700)]
[RISCV][Clang] Drop the assembly tests for RVV intrinsics.

We had verified the correctness of all intrinsics in downstream, so
dropping the assembly tests to decrease the check-clang time.
It would remove 1/3 of the RUN lines.

https://reviews.llvm.org/D99151#2654154 mentions why we need to have
the ASM tests before.

Reviewed By: craig.topper

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

3 years ago[sanitizer] Mark g_use_dlpi_tls_data as unused
Fangrui Song [Fri, 16 Apr 2021 16:28:51 +0000 (09:28 -0700)]
[sanitizer] Mark g_use_dlpi_tls_data as unused

There is a -Wunused-variable warning on Android

3 years ago[ADT] Don't include <algorithm> in iterator.h
Nico Weber [Fri, 16 Apr 2021 16:11:11 +0000 (12:11 -0400)]
[ADT] Don't include <algorithm> in iterator.h

As far as I can tell, nothing in iterator.h uses anything from <algorithm>.

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

3 years agoRevert "[Support] Don't include <algorithm> in Hashing.h"
Michael Liao [Fri, 16 Apr 2021 16:17:42 +0000 (12:17 -0400)]
Revert "[Support] Don't include <algorithm> in Hashing.h"

This reverts commit ef620c40f371e7e3269bd8bef57d069330baa355.

- `std::rotate` still needs <alogirthm>

3 years ago[Support] Don't include <algorithm> in Hashing.h
Nico Weber [Fri, 16 Apr 2021 16:04:09 +0000 (12:04 -0400)]
[Support] Don't include <algorithm> in Hashing.h

The include is for std::swap(), but that's in <utility> in C++11,
and Hashing.h already includes that.

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

3 years ago[Support] Don't include <algorithm> in MathExtras.h
Nico Weber [Fri, 16 Apr 2021 15:40:52 +0000 (11:40 -0400)]
[Support] Don't include <algorithm> in MathExtras.h

MathExtras.h is indirectly included in over 98% of LLVM's
translation units. It currently expands to over 1MB of stuff,
over which far more than half is due to <algorithm>. Since not
using <algorithm> is slightly less code, do that.

No behavior change.

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

3 years ago[ARM] Prevent phi-node-elimination from generating copy above t2WhileLoopStartLR
Malhar Jajoo [Fri, 16 Apr 2021 15:45:07 +0000 (16:45 +0100)]
[ARM] Prevent phi-node-elimination from generating copy above t2WhileLoopStartLR

This patch prevents phi-node-elimination from generating a COPY
operation for the register defined by t2WhileLoopStartLR, as it is a
terminator that defines a value.

This happens because of the presence of phi-nodes in the loop body (the
Preheader of which is the block containing the t2WhileLoopStartLR). If
this is not done, the COPY is generated above/before the terminator
(t2WhileLoopStartLR here), and since it uses the value defined by
t2WhileLoopStartLR, MachineVerifier throws a 'use before define' error.

This essentially adds on to the change in differential D91887/D97729.

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

3 years ago[mlir][vector] Move transferOp on tensor opt to folder/canonicalization
thomasraoux [Thu, 15 Apr 2021 20:43:44 +0000 (13:43 -0700)]
[mlir][vector] Move transferOp on tensor opt to folder/canonicalization

Move the existing optimization for transfer op on tensor to folder and
canonicalization. This handles the write after write case and read after write
and also add write after read case.

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

3 years ago[OpenMP IRBuilder, MLIR] Add support for OpenMP do schedule dynamic
Mats Petersson [Fri, 16 Apr 2021 14:08:56 +0000 (15:08 +0100)]
[OpenMP IRBuilder, MLIR] Add support for OpenMP do schedule dynamic

The implementation supports static schedule for Fortran do loops. This
implements the dynamic variant of the same concept.

Reviewed By: Meinersbur

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

3 years ago[Driver] Allow both lib64 and lib in rocm-detect test.
Troy Johnson [Fri, 16 Apr 2021 14:48:55 +0000 (09:48 -0500)]
[Driver] Allow both lib64 and lib in rocm-detect test.

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

3 years ago[PhaseOrdering] add test for loop-invariant fdiv; NFC
Sanjay Patel [Fri, 16 Apr 2021 14:50:02 +0000 (10:50 -0400)]
[PhaseOrdering] add test for loop-invariant fdiv; NFC

Discussed in D87479 - disabling loop unrolling should
not mean that instcombine or other passes interfere
with LICM.

3 years ago[SystemZ][z/OS] Add IsText Argument to GetFile and GetFileOrSTDIN
Jonathan Crowther [Fri, 16 Apr 2021 14:02:48 +0000 (10:02 -0400)]
[SystemZ][z/OS] Add IsText Argument to GetFile and GetFileOrSTDIN

Add the `IsText` argument to `GetFile` and `GetFileOrSTDIN` which will help z/OS distinguish between text and binary correctly. This is an extension to [this patch](https://reviews.llvm.org/D97785)

Reviewed By: abhina.sreeskantharajan, amccarth

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

3 years ago[TableGen] Allow mnemonics aliases with uppercase
paperchalice [Fri, 16 Apr 2021 13:55:42 +0000 (09:55 -0400)]
[TableGen] Allow mnemonics aliases with uppercase

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

3 years ago[mlir][ArmSVE] Cleanup dialect registration
Javier Setoain [Fri, 16 Apr 2021 13:51:17 +0000 (15:51 +0200)]
[mlir][ArmSVE] Cleanup dialect registration

ArmSVE dialect is behind the recent changes in how the Vector dialect
interacts with backend vector dialects and the MLIR -> LLVM IR
translation module. This patch cleans up ArmSVE initialization within
Vector and removes the need for an LLVMArmSVE dialect.

Reviewed By: ftynse

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

3 years ago[libc++] Fix LWG 2874: Constructor shared_ptr::shared_ptr(Y*) should be constrained.
Louis Dionne [Wed, 14 Apr 2021 19:07:14 +0000 (15:07 -0400)]
[libc++] Fix LWG 2874: Constructor shared_ptr::shared_ptr(Y*) should be constrained.

This patch fixes LWG2874. It is based on the original patch by Zoe Carver
originally uploaded at D81417.

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

3 years ago[mlir][python] Add simple debugging and printing helpers
Nicolas Vasilache [Fri, 16 Apr 2021 12:54:43 +0000 (12:54 +0000)]
[mlir][python] Add simple debugging and printing helpers

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

3 years ago[PhaseOrdering] add test to track PR49785; NFC
Sanjay Patel [Fri, 16 Apr 2021 13:30:25 +0000 (09:30 -0400)]
[PhaseOrdering] add test to track PR49785; NFC

See D99759 / D100573 / bb907b26e2bf for details.

3 years ago[OPENMP]Fix PR49115: Incorrect results for scan directive.
Alexey Bataev [Thu, 8 Apr 2021 17:13:15 +0000 (10:13 -0700)]
[OPENMP]Fix PR49115: Incorrect results for scan directive.

For combined worksharing directives need to emit the temp arrays outside
of the parallel region and update them in the master thread only.

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

3 years ago[docs] Add Pointer Authentication call info
Kristof Beyls [Fri, 16 Apr 2021 13:10:52 +0000 (15:10 +0200)]
[docs] Add Pointer Authentication call info

3 years ago[MLIR] Fix `isValidIndex`
Frederik Gossen [Fri, 16 Apr 2021 12:58:05 +0000 (14:58 +0200)]
[MLIR] Fix `isValidIndex`

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

3 years ago[OpenMP] Add omp_target_is_accessible() to header files
Hansang Bae [Tue, 13 Apr 2021 01:20:27 +0000 (20:20 -0500)]
[OpenMP] Add omp_target_is_accessible() to header files

-- Added omp_target_is_accessible to the header files
-- Added missing const qualifier to device memory routines

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

3 years ago[ValueTracking] don't recursively compute known bits using multiple llvm.assumes
Sanjay Patel [Fri, 16 Apr 2021 12:39:22 +0000 (08:39 -0400)]
[ValueTracking] don't recursively compute known bits using multiple llvm.assumes

This is an alternative to D99759 to avoid the compile-time explosion seen in:
https://llvm.org/PR49785

Another potential solution would make the exclusion logic stronger to avoid
blowing up, but note that we reduced the complexity of the exclusion mechanism
in D16204 because it was too costly.

So I'm questioning the need for recursion/exclusion entirely - what is the
optimization value vs. cost of recursively computing known bits based on
assumptions?
This was built into the implementation from the start with 60db058,
and we have kept adding code/cost to deal with that capability.

By clearing the query's AssumptionCache inside computeKnownBitsFromAssume(),
this patch retains all existing assume functionality except refining known
bits based on even more assumptions.

We have 1 regression test that shows a difference in optimization power.

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

3 years ago[X86][CostModel] Fix cost model for non-power-of-two vector load/stores
Roman Lebedev [Fri, 16 Apr 2021 12:25:23 +0000 (15:25 +0300)]
[X86][CostModel] Fix cost model for non-power-of-two vector load/stores

Sometimes LV has to produce really wide vectors,
and sometimes they end up being not powers of two.
As it can be seen from the diff, the cost computation
is currently completely non-sensical in those cases.

Instead of just scalarizing everything, split/factorize the wide vector
into a number of subvectors, each one having a power-of-two elements,
recurse to get the cost of op on this subvector. Also, check how we'd
legalize this subvector, and if the legalized type is scalar,
also account for the scalarization cost.

Note that for sub-vector loads, we might be able to do better,
when the vectors are properly aligned.

Reviewed By: RKSimon

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

3 years ago[SystemZ][z/OS][Windows] Add new functions that set Text/Binary mode for Stdin and...
Abhina Sreeskantharajan [Fri, 16 Apr 2021 12:06:35 +0000 (08:06 -0400)]
[SystemZ][z/OS][Windows] Add new functions that set Text/Binary mode for Stdin and Stdout based on OpenFlags

On Windows, we want to open a file in Binary mode if OF_CRLF bit is not set. On z/OS, we want to open a file in Binary mode if the OF_Text bit is not set.

This patch creates two new functions called ChangeStdinMode and ChangeStdoutMode which will take OpenFlags as an arg to determine which mode to set stdin and stdout to. This will enable patches like https://reviews.llvm.org/D100056 to not affect Windows when setting the OF_Text flag for raw_fd_streams.

Reviewed By: rnk

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

3 years agoRestore lit feature object-emission. Omit DebugInfo/Generic on XCore.
Nigel Perks [Tue, 18 Aug 2020 12:21:20 +0000 (13:21 +0100)]
Restore lit feature object-emission. Omit DebugInfo/Generic on XCore.

D73568 removed the lit feature object-emission, because it was introduced for a
target which did not support the integrated assembler, and that target no longer
required the feature. XCore still does not support the integrated assembler,
so a build with XCore as the default target fails tests requiring
object-emission. This issue was not publicly visible because there was not a
buildbot for XCore as the default target. We fixed the failures downstream. We
now have builder clang-xcore-ubuntu-20-x64 on the staging buildmaster, which
shows the failures. We would like to make upstream build green.

Omit DebugInfo/Generic on XCore to avoid annotating 70 separate files.

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

3 years ago[MLIR][Shape] Expose `getShapeVec` and add support for extent tensors
Frederik Gossen [Fri, 16 Apr 2021 11:50:14 +0000 (13:50 +0200)]
[MLIR][Shape] Expose `getShapeVec` and add support for extent tensors

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

3 years ago[llvm-objcopy] clang-format a line
Nico Weber [Fri, 16 Apr 2021 11:24:15 +0000 (07:24 -0400)]
[llvm-objcopy] clang-format a line

3 years ago[SimplifyCFG] Regenerate CHECK lines and add test for PR49982.
Florian Hahn [Fri, 16 Apr 2021 10:51:36 +0000 (11:51 +0100)]
[SimplifyCFG] Regenerate CHECK lines and add test for PR49982.

3 years ago[NFC][AArch64][SVE] Move select-sve.ll tests to sve-select.ll
Caroline Concatto [Fri, 16 Apr 2021 09:57:08 +0000 (10:57 +0100)]
[NFC][AArch64][SVE] Move select-sve.ll tests to sve-select.ll

This patch merges the two select tests: select-sve.ll and sve-select.ll into
sve-select.ll as they are both testing SELECT instruction

3 years ago[ARM] Combine sub 0, csinc X, Y, CC -> csinv -X, Y, CC
David Green [Fri, 16 Apr 2021 10:52:31 +0000 (11:52 +0100)]
[ARM] Combine sub 0, csinc X, Y, CC -> csinv -X, Y, CC

Combine sub 0, csinc X, Y, CC to csinv -X, Y, CC providing that the
negation of X is cheap, currently just handling constants. This comes up
during the splat of an i1 to a predicate, where we now generate csetm,
as opposed to cset; rsb.

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

3 years ago[RISCV] Rerun stack test through update_llc_test_checks.py
Fraser Cormack [Fri, 16 Apr 2021 09:58:41 +0000 (10:58 +0100)]
[RISCV] Rerun stack test through update_llc_test_checks.py

Adjusts formatting of comments only. Just to reduce diffs in future
patches.

3 years ago[CostModel][X86] Add fully aligned load/store tests
Simon Pilgrim [Fri, 16 Apr 2021 09:35:13 +0000 (10:35 +0100)]
[CostModel][X86] Add fully aligned load/store tests

As noted on D100099, if these illegal vector types are suitably aligned they should be much cheaper to load (but probably not store).

3 years agoRevert "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"
Pushpinder Singh [Fri, 16 Apr 2021 08:54:06 +0000 (08:54 +0000)]
Revert "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"

This reverts commit 7029cffc4e78556cfe820791c612968bb15b2ffb.

3 years ago[lld] Fix test crashing when AVR target is missing
LemonBoy [Fri, 16 Apr 2021 09:12:29 +0000 (11:12 +0200)]
[lld] Fix test crashing when AVR target is missing

Fixes buildbot error.

3 years ago[docs] Add vector predication call
Simon Moll [Fri, 16 Apr 2021 08:45:40 +0000 (10:45 +0200)]
[docs] Add vector predication call

Add the syncup call to the table

Reviewed By: craig.topper

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

3 years ago[mlir][Python][Linalg] Add support for captures in body builder.
Nicolas Vasilache [Tue, 13 Apr 2021 06:25:47 +0000 (06:25 +0000)]
[mlir][Python][Linalg] Add support for captures in body builder.

When Linalg named ops support was added, captures were omitted
from the body builder. This revision adds support for captures
which allows us to write FillOp in a more idiomatic fashion using
the _linalg_ops_ext mixin support.

This raises an issue in the generation of `_linalg_ops_gen.py` where
```
  @property
  def result(self):
    return self.operation.results[0] if len(self.operation.results) > 1 else None
```.
The condition should be `== 1`.

This will be fixed in a separate commit.

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

3 years ago[LLD][ELF][AVR] Propagate ELF flags to the linked image
LemonBoy [Fri, 16 Apr 2021 08:38:58 +0000 (10:38 +0200)]
[LLD][ELF][AVR] Propagate ELF flags to the linked image

The `e_flags` for a ELF file targeting the AVR ISA contains two fields at the time of writing:
- A 7-bit integer field specifying the ISA revision being targeted
- A 1-bit flag specifying whether the object files being linked are suited for applying the relaxations at link time

The linked ELF file is blessed with the arch revision shared among all the files.
The behaviour in case of mismatch is purposefully different than the one implemented in libbfd: LLD will raise a fatal error while libbfd silently picks a default value of `avr2`.
The relaxation-ready flag is handled as done by libbfd, in order for it to appear in the linked object every source object must be tagged with it.

Reviewed By: MaskRay

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

3 years ago[clang-format] Inconsistent behavior regarding line break before access modifier
Max Sagebaum [Fri, 16 Apr 2021 08:02:02 +0000 (10:02 +0200)]
[clang-format] Inconsistent behavior regarding line break before access modifier

Fixes https://llvm.org/PR41870.

Checks for newlines in option Style.EmptyLineBeforeAccessModifier are now based on the formatted new lines and not on the new lines in the file.

Reviewed By: HazardyKnusperkeks, curdeius

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

3 years ago[mlir][linalg] Add support for WAW fusion on tensors.
Nicolas Vasilache [Thu, 15 Apr 2021 22:47:25 +0000 (22:47 +0000)]
[mlir][linalg] Add support for WAW fusion on tensors.

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

3 years ago[libc] Fix typo
Guillaume Chatelet [Fri, 16 Apr 2021 08:09:28 +0000 (08:09 +0000)]
[libc] Fix typo

3 years ago[libc] Add slice/take/drop methods to ArrayRef
Guillaume Chatelet [Thu, 15 Apr 2021 15:31:15 +0000 (15:31 +0000)]
[libc] Add slice/take/drop methods to ArrayRef

Add various methods from llvm::ArrayRef. Refactor implementation to remove code duplication.

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

3 years ago[Aarch64] handle "o" inline asm memory constraints
Nick Desaulniers [Fri, 16 Apr 2021 06:10:16 +0000 (23:10 -0700)]
[Aarch64] handle "o" inline asm memory constraints

This Linux kernel is making use of this inline asm constraint which is
causing an ICE.

PR49956

Link: https://github.com/ClangBuiltLinux/linux/issues/1348
Reviewed By: MaskRay

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

3 years ago[libcxx] Make the GDB pretty printer test less strict
Petr Hosek [Mon, 29 Mar 2021 19:10:18 +0000 (12:10 -0700)]
[libcxx] Make the GDB pretty printer test less strict

This is a workaround for PR48937. GDB can sometimes print additional
warnings which currently fails the test. Use re.search instead of
re.match to ignore this additional output.

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

3 years ago[Polly][Ast] Partial refactoring of IslAst and IslAstInfo to use isl++. NFC.
patacca [Fri, 16 Apr 2021 04:34:57 +0000 (23:34 -0500)]
[Polly][Ast] Partial refactoring of IslAst and IslAstInfo to use isl++. NFC.

Polly use algorithms from the Integer Set Library (isl), which is a library written in C and which is incompatible with the rest of the LLVM as it is written in C++.

Changes made:
 - Refactoring the following methods of class `IslAst`
  - `getAst()` `getRunCondition()` `buildRunCondition()`
  - Removed the destructor in favor of the default one
 - Change the type of the attribute `IslAst.RunCondition` to `isl::ast_expr`
 - Change the type of the attribute `IslAst.Root` to `isl::ast_node`
 - Change the order of attributes in class `IslAst` to reflect the data dependencies so that the destructor won't complain
 - Refactoring the following methods of class `IslAstInfo`
  - `getAst()` `getRunCondition()`

Reviewed By: Meinersbur

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

3 years ago[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed
Pushpinder Singh [Tue, 6 Apr 2021 06:53:20 +0000 (06:53 +0000)]
[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed

This patch adds new clang tool named amdgpu-arch which uses
HSA to detect installed AMDGPU and report back latter's march.
This tool is built only if system has HSA installed.

The value printed by amdgpu-arch is used to fill -march when
latter is not explicitly provided in -Xopenmp-target.

Reviewed By: JonChesterfield, gregrodgers

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

3 years ago[RISCV] Don't emit save-restore call if function is a interrupt handler
Jim Lin [Fri, 16 Apr 2021 04:50:51 +0000 (12:50 +0800)]
[RISCV] Don't emit save-restore call if function is a interrupt handler

It has to save all caller-saved registers before a call in the handler.
So don't emit a call that save/restore registers.

Reviewed By: simoncook, luismarques, asb

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

3 years agoFix tile-and-pad when padding doesn't span all dimension
Ahmed Taei [Fri, 16 Apr 2021 00:03:17 +0000 (17:03 -0700)]
Fix tile-and-pad when padding doesn't span all dimension

Without this tile-and-pad will never terminate if pad-fails.

Reviewed By: nicolasvasilache

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

3 years agoDon't refer to allocation map entry after deallocating it
Jason Molenda [Fri, 16 Apr 2021 01:58:13 +0000 (18:58 -0700)]
Don't refer to allocation map entry after deallocating it

debugserver's MachTask::DeallocateMemory when removing an
allocate entry from our map (in resposne to an '_m' packet),
copy the size from the entry before removing it from the
map and then using the iterator to fix an ASAN error on
the bots when running TestGdbRemoteMemoryAllocation.py

rdar://76595998

3 years ago[libcxx] adds `cpp17-.*iterator` concepts for iterator_traits
Christopher Di Bella [Sun, 4 Apr 2021 05:12:46 +0000 (05:12 +0000)]
[libcxx] adds `cpp17-.*iterator` concepts for iterator_traits

The `iterator_traits` patch became too large for a concise review, so
the "bloat" —as it were— was moved into this patch. Also tests most
C++[98,17] iterator types to confirm backwards compatibility is
successful (regex iterators are intentionally not present, but directory
iterators are due to a peculiar error encountered while patching
`iterator_traits`).

Depends on D99461.

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

3 years ago[AMDGPU] Refactor ds_read/ds_write related select code for better readability.
hsmahesha [Fri, 16 Apr 2021 02:53:44 +0000 (08:23 +0530)]
[AMDGPU] Refactor ds_read/ds_write related select code for better readability.

Part of the code related to ds_read/ds_write ISel is refactored, and the
corresponding comment is re-written for better readability, which would help
while implementing any future ds_read/ds_write ISel related modifications.

Reviewed By: rampitec

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