platform/upstream/llvm.git
3 years ago[Flang][OpenMP] Add semantic check for OpenMP Private, Firstprivate and Lastprivate...
Praveen [Fri, 25 Dec 2020 08:49:50 +0000 (14:19 +0530)]
[Flang][OpenMP] Add semantic check for OpenMP Private, Firstprivate and Lastprivate clauses.

OpenMP 4.5 - Variables that appear in expressions for statement function definitions
             may not appear in OpenMP Private, Firstprivate or Lastprivate clauses.

Test case : omp-private03.f90

Reviewed By: kiranchandramohan

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

3 years ago[obj2yaml] - Dump the content of a broken hash table properly.
Georgii Rymar [Thu, 24 Dec 2020 10:05:55 +0000 (13:05 +0300)]
[obj2yaml] - Dump the content of a broken hash table properly.

This is similar to D93760.

When something is wrong with the hash table header we dump
its context as a raw data.

Currently we have the calculation overflow issue and it is possible to
bypass the validation we have (and crash).

The patch fixes it.

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

3 years ago[llvm-readelf/obj] - Improve the warning reported when unable to read the stack size.
Georgii Rymar [Thu, 24 Dec 2020 12:32:34 +0000 (15:32 +0300)]
[llvm-readelf/obj] - Improve the warning reported when unable to read the stack size.

It was discussed in D92545 that we might want to improve messages
reported when something is wrong with the stack size section.
This patch does it.

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

3 years ago[libObject] - Add more ELF types to LLVM_ELF_IMPORT_TYPES_ELFT define (ELFTypes.h).
Georgii Rymar [Thu, 24 Dec 2020 11:48:57 +0000 (14:48 +0300)]
[libObject] - Add more ELF types to LLVM_ELF_IMPORT_TYPES_ELFT define (ELFTypes.h).

This allows to get rid of lots for typedefs/usings from many places.

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

3 years ago[AArch64][GlobalISel] Notify observer of mutated instruction for shift custom legaliz...
Amara Emerson [Fri, 25 Dec 2020 08:31:47 +0000 (00:31 -0800)]
[AArch64][GlobalISel] Notify observer of mutated instruction for shift custom legalization.

No test for this because it's a CSE verifier failure that's only exposed in a
WIP patch for enabling CSE throughout the AArch64 GISel pipeline.

3 years ago[RISCV] Define vpopc/vfirst intrinsics.
Zakk Chen [Wed, 23 Dec 2020 15:42:36 +0000 (07:42 -0800)]
[RISCV] Define vpopc/vfirst intrinsics.

Define vpopc/vfirst intrinsics and lower to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Reviewed By: craig.topper

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

3 years ago[Target] Use llvm::any_of (NFC)
Kazu Hirata [Fri, 25 Dec 2020 03:43:26 +0000 (19:43 -0800)]
[Target] Use llvm::any_of (NFC)

3 years ago[RISCV] Define vector mask-register logical intrinsics.
Zakk Chen [Fri, 25 Dec 2020 02:59:05 +0000 (18:59 -0800)]
[RISCV] Define vector mask-register logical intrinsics.

Define vector mask-register logical intrinsics and lower them
to V instructions. Also define pseudo instructions vmmv.m
and vmnot.m.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>
Differential Revision: https://reviews.llvm.org/D93705

3 years ago[RISCV] Add intrinsics for vrgather instruction
ShihPo Hung [Thu, 24 Dec 2020 08:23:35 +0000 (00:23 -0800)]
[RISCV] Add intrinsics for vrgather instruction

This patch defines vrgather intrinsics and lower to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential revision: https://reviews.llvm.org/D93797

3 years ago[RISCV] Define vector single-width reduction intrinsic.
Monk Chiang [Thu, 24 Dec 2020 02:31:35 +0000 (10:31 +0800)]
[RISCV] Define vector single-width reduction intrinsic.

integer group:
vredsum/vredmaxu/vredmax/vredminu/vredmin/vredand/vredor/vredxor
float group:
vfredosum/vfredsum/vfredmax/vfredmin

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>
Differential Revision: https://reviews.llvm.org/D93746

3 years ago[LoopIdiom] 'left-shift-until-bittest': keep no-wrap flags on shift, fix edge-case...
Roman Lebedev [Thu, 24 Dec 2020 15:05:38 +0000 (18:05 +0300)]
[LoopIdiom] 'left-shift-until-bittest': keep no-wrap flags on shift, fix edge-case miscompilation for %x.next

While `%x.curr` is always safe to compute, because `LoopBackedgeTakenCount`
will always be smaller than `bitwidth(X)`, i.e. we never get poison,
rewriting `%x.next` is more complicated, however, because `X << LoopTripCount`
will be poison iff `LoopTripCount == bitwidth(X)` (which will happen
iff `BitPos` is `bitwidth(x) - 1` and `X` is `1`).

So unless we know that isn't the case (as alive2 notes, we know it's safe
to do iff shift had no-wrap flags, or bitpos does not indicate signbit,
or we know that %x is never `1`), we'll need to emit an alternative,
safe IR, by either just shifting the `%x.curr`, or conditionally selecting
between the computed `%x.next` and `0`..
Former IR looks better so let's do that.

While there, ensure that we don't drop no-wrap flags from said shift.

3 years ago[NFC][LoopIdiom] Improve test coverage for 'left-shift-until-bittest' pattern
Roman Lebedev [Thu, 24 Dec 2020 13:44:17 +0000 (16:44 +0300)]
[NFC][LoopIdiom] Improve test coverage for 'left-shift-until-bittest' pattern

In particular, add tests with no-wrap flags on shift,
a test where %x is not `1`, and ensure that tests where %bit
is a constant bitwidth-1, or is not a constant bitwidth-1
test both liveout values.

3 years ago[InstCombine] Hoist xor-by-constant from xor-by-value
Roman Lebedev [Thu, 24 Dec 2020 09:29:16 +0000 (12:29 +0300)]
[InstCombine] Hoist xor-by-constant from xor-by-value

This is one of the deficiencies that can be observed in
https://godbolt.org/z/YPczsG after D91038 patch set.

This exposed two missing folds, one was fixed by the previous commit,
another one is `(A ^ B) | ~(A ^ B) --> -1` / `(A ^ B) & ~(A ^ B) --> 0`.

`-early-cse` will catch it: https://godbolt.org/z/4n1T1v,
but isn't meaningful to fix it in InstCombine,
because we'd need to essentially do our own CSE,
and we can't even rely on `Instruction::isIdenticalTo()`,
because there are no guarantees that the order of operands matches.
So let's just accept it as a loss.

3 years ago[NFC][InstCombine] Add test coverage for `(x ^ C) ^ y` pattern
Roman Lebedev [Thu, 24 Dec 2020 09:29:10 +0000 (12:29 +0300)]
[NFC][InstCombine] Add test coverage for `(x ^ C) ^ y` pattern

3 years ago[InstCombine] Fold `a & ~(a ^ b)` to `x & y`
Roman Lebedev [Thu, 24 Dec 2020 11:09:49 +0000 (14:09 +0300)]
[InstCombine] Fold `a & ~(a ^ b)` to `x & y`

```
----------------------------------------
define i32 @and_xor_not_common_op(i32 %a, i32 %b) {
%0:
  %b2 = xor i32 %b, 4294967295
  %t2 = xor i32 %a, %b2
  %t4 = and i32 %t2, %a
  ret i32 %t4
}
=>
define i32 @and_xor_not_common_op(i32 %a, i32 %b) {
%0:
  %t4 = and i32 %a, %b
  ret i32 %t4
}
Transformation seems to be correct!
```

3 years ago[NFC][InstCombine] Add test for `a & ~(a ^ b)` pattern
Roman Lebedev [Thu, 24 Dec 2020 10:48:07 +0000 (13:48 +0300)]
[NFC][InstCombine] Add test for `a & ~(a ^ b)` pattern

... which is a variation of `a & (a ^ ~b)` --> a & b`.
A follow-up patch exposes this missing fold, so we need to fix it first.

3 years ago[NFC][InstCombine] Autogenerate check lines in vec_shuffle.ll test
Roman Lebedev [Thu, 24 Dec 2020 10:46:54 +0000 (13:46 +0300)]
[NFC][InstCombine] Autogenerate check lines in vec_shuffle.ll test

3 years ago[IR][InstCombine] Add m_ImmConstant(), that matches on non-ConstantExpr constants...
Roman Lebedev [Thu, 24 Dec 2020 08:57:35 +0000 (11:57 +0300)]
[IR][InstCombine] Add m_ImmConstant(), that matches on non-ConstantExpr constants, and use it

A pattern to ignore ConstantExpr's is quite common, since they frequently
lead into infinite combine loops, so let's make writing it easier.

3 years ago[NFC] SimplifyCFGOpt::simplifyUnreachable(): pacify unused variable warning
Roman Lebedev [Thu, 24 Dec 2020 18:15:13 +0000 (21:15 +0300)]
[NFC] SimplifyCFGOpt::simplifyUnreachable(): pacify unused variable warning

Thanks to Luke Benes for pointing it out.

3 years ago[CodeGen] Remove unused function hasInlineAsmMemConstraint (NFC)
Kazu Hirata [Thu, 24 Dec 2020 17:17:58 +0000 (09:17 -0800)]
[CodeGen] Remove unused function hasInlineAsmMemConstraint (NFC)

The last use of the function was removed on Sep 13, 2010 in commit
1094c80281e3cdd9e9a9d7ee716da6386b33359b.

3 years ago[CodeGen, Transforms] Use llvm::any_of (NFC)
Kazu Hirata [Thu, 24 Dec 2020 17:08:36 +0000 (09:08 -0800)]
[CodeGen, Transforms] Use llvm::any_of (NFC)

3 years ago[InstCombine] foldICmpUsingKnownBits - use KnownBits signed/unsigned getMin/MaxValue...
Simon Pilgrim [Thu, 24 Dec 2020 14:22:26 +0000 (14:22 +0000)]
[InstCombine] foldICmpUsingKnownBits - use KnownBits signed/unsigned getMin/MaxValue helpers. NFCI.

Replace the local compute*SignedMinMaxValuesFromKnownBits methods with the equivalent KnownBits helpers to determine the min/max value ranges.

3 years ago[Support] Add KnownBits::getSignedMinValue/getSignedMaxValue helpers.
Simon Pilgrim [Thu, 24 Dec 2020 12:07:55 +0000 (12:07 +0000)]
[Support] Add KnownBits::getSignedMinValue/getSignedMaxValue helpers.

Add unit test coverage - a followup will update InstCombineCompares.cpp to use this and could be used by D86578 as well.

3 years ago[Support] Explicitly state that KnownBits::getMinValue/getMaxValue are UNSIGNED value...
Simon Pilgrim [Wed, 23 Dec 2020 14:18:07 +0000 (14:18 +0000)]
[Support] Explicitly state that KnownBits::getMinValue/getMaxValue are UNSIGNED values. NFCI.

Update the comment to make this clear, following the same approach as APInt.

3 years agoMoved dwarf_eh_resume.ll from Generic to X86 folder
Evgeniy Brevnov [Thu, 24 Dec 2020 12:44:50 +0000 (19:44 +0700)]
Moved dwarf_eh_resume.ll from Generic to X86 folder

Make test case x86 specific.

Reviewed By: xbolva00

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

3 years agoRevert "[InstCombine] Check inbounds in load/store of gep null transform (PR48577)"
Nikita Popov [Thu, 24 Dec 2020 11:34:14 +0000 (12:34 +0100)]
Revert "[InstCombine] Check inbounds in load/store of gep null transform (PR48577)"

This reverts commit 899faa50f206073cdd8eeaaa130ffa15f850e656.

Upon further consideration, this does not fix the right issue.
Doing this fold for non-inbounds GEPs is legal, because the
resulting pointer is still based-on null, which has no associated
address range, and as such and access to it is UB.

https://bugs.llvm.org/show_bug.cgi?id=48577#c3

3 years ago[CodeGen] Add "noreturn" attirbute to _Unwind_Resume
Evgeniy Brevnov [Wed, 23 Dec 2020 07:50:36 +0000 (14:50 +0700)]
[CodeGen] Add "noreturn" attirbute to _Unwind_Resume

Currently 'resume' is lowered to _Unwind_Resume with out "noreturn" attribute. Semantically _Unwind_Resume  library call is expected to never return and should be marked as such. Though I didn't find any changes in behavior of existing tests there will be a difference once https://reviews.llvm.org/D79485 lands.

I was not able to come up with the test case anything better than just checking for presence of "noreturn" attribute. Please let me know if there is a better way to test the change.

Reviewed By: xbolva00

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

3 years ago[AMDGPU] Use MUBUF instructions for global address space access
Praveen Velliengiri [Thu, 24 Dec 2020 09:44:01 +0000 (09:44 +0000)]
[AMDGPU] Use MUBUF instructions for global address space access

Currently, the compiler crashes in instruction selection of global
load/stores in gfx600 due to the lack of FLAT instructions. This patch
fix the crash by selecting MUBUF instructions for global load/stores
in gfx600.

Authored-by: Praveen Velliengiri <Praveen.Velliengiri@amd.com>
Reviewed by: t-tye

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

3 years agoRevert "[InstCombine] Fold gep inbounds of null to null"
Nikita Popov [Thu, 24 Dec 2020 09:19:11 +0000 (10:19 +0100)]
Revert "[InstCombine] Fold gep inbounds of null to null"

This reverts commit eb79fd3c928dbbb97f7937963361c1dad2bf8222.

This causes stage2 crashes, possibly due to StringMap being
miscompiled. Reverting for now.

3 years ago[obj2yaml] - Dump the content of a broken GNU hash table properly.
Georgii Rymar [Wed, 23 Dec 2020 13:00:54 +0000 (16:00 +0300)]
[obj2yaml] - Dump the content of a broken GNU hash table properly.

When something is wrong with the GNU hash table header we dump
its context as a raw data.

Currently we have the calculation overflow issue and it is possible to
bypass the validation we have (and crash).

The patch fixes it.

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

3 years ago[Analysis] Remove spliceFunction (NFC)
Kazu Hirata [Thu, 24 Dec 2020 05:57:25 +0000 (21:57 -0800)]
[Analysis] Remove spliceFunction (NFC)

The function was introduced without a user on Jan 3, 2011 in commit
0f87ca77333ef59171749544e8dbdba9009f0dc7.  We still don't have a user
yet.

3 years ago[ExecutionEngine, Linker] Use erase_if (NFC)
Kazu Hirata [Thu, 24 Dec 2020 05:44:39 +0000 (21:44 -0800)]
[ExecutionEngine, Linker] Use erase_if (NFC)

3 years agoPrecommit analysis/etc tests for inselt poison placeholder
Juneyoung Lee [Thu, 24 Dec 2020 03:14:19 +0000 (12:14 +0900)]
Precommit analysis/etc tests for inselt poison placeholder

This adds tests in directories missing from https://reviews.llvm.org/rGdb7a2f347f132b3920415013d62d1adfb18d8d58

3 years agoPrecommit transform tests that have poison as insertelement's placeholder
Juneyoung Lee [Thu, 24 Dec 2020 02:41:27 +0000 (11:41 +0900)]
Precommit transform tests that have poison as insertelement's placeholder

This commit copies existing tests at llvm/Transforms and replaces
'insertelement undef' in those files with 'insertelement poison'.
(see https://reviews.llvm.org/D93586)

Tests listed using this script:

grep -R -E '^[^;]*insertelement <.*> undef,' . | cut -d":" -f1 | uniq |
wc -l

Tests updated:

file_org=llvm/test/Transforms/$1
file=${file_org%.ll}-inseltpoison.ll
cp $file_org $file
sed -i -E 's/^([^;]*)insertelement <(.*)> undef/\1insertelement <\2> poison/g' $file
head -1 $file | grep "Assertions have been autogenerated by utils/update_test_checks.py" -q
if [ "$?" == 1 ]; then
  echo "$file : should be manually updated"
  # I manually updated the script
  exit 1
fi
python3 ./llvm/utils/update_test_checks.py --opt-binary=./build-releaseassert/bin/opt $file

3 years ago[IRSim] Adding support for isomorphic predicates
Andrew Litteken [Sun, 23 Aug 2020 05:30:10 +0000 (00:30 -0500)]
[IRSim] Adding support for isomorphic predicates

Some predicates, can be considered the same as long as the operands are
flipped. For example, a > b gives the same result as b > a. This maps
instructions in a greater than form, to their appropriate less than
form, swapping the operands in the IRInstructionData only, allowing for
more flexible matching.

Tests:

llvm/test/Transforms/IROutliner/outlining-isomorphic-predicates.ll
llvm/unittests/Analysis/IRSimilarityIdentifierTest.cpp

Reviewers: jroelofs, paquette

Recommit of commit 050392660249c70c00e909ae4a7151ba2c766235

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

3 years ago[Clang] Reverse test to save on indentation. NFC.
Alexandre Ganea [Thu, 24 Dec 2020 00:24:43 +0000 (19:24 -0500)]
[Clang] Reverse test to save on indentation. NFC.

3 years ago[DAGCombiner] Don't create sexts of deleted xors when they were in-visit replaced
Layton Kifer [Thu, 24 Dec 2020 00:13:52 +0000 (16:13 -0800)]
[DAGCombiner] Don't create sexts of deleted xors when they were in-visit replaced

Fixes a bug introduced by D91589.

When folding `(sext (not i1 x)) -> (add (zext i1 x), -1)`, we try to replace the not first when possible. If we replace the not in-visit, then the now invalidated node will be returned, and subsequently we will return an invalid sext. In cases where the not is replaced in-visit we can simply return SDValue, as the not in the current sext should have already been replaced.

Thanks @jgorbe, for finding the below reproducer.

The following reduced test case crashes clang when built with `clang -O1 -frounding-math`:

```
template <class> class a {
  int b() { return c == 0.0 ? 0 : -1; }
  int c;
};
template class a<long>;
```

A debug build of clang produces this "assertion failed" error:
```
clang: /home/jgorbe/code/llvm/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:264: void {anonymous}::DAGCombiner::AddToWorklist(llvm::
SDNode*): Assertion `N->getOpcode() != ISD::DELETED_NODE && "Deleted Node added to Worklist"' failed.
```

Reviewed By: spatel

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

3 years ago[mlir] Add tensor passes to passes.md
Jacques Pienaar [Thu, 24 Dec 2020 00:13:03 +0000 (16:13 -0800)]
[mlir] Add tensor passes to passes.md

3 years agoBasic: Add native support for stdin to SourceManager and FileManager
Duncan P. N. Exon Smith [Thu, 10 Dec 2020 23:27:51 +0000 (15:27 -0800)]
Basic: Add native support for stdin to SourceManager and FileManager

Add support for stdin to SourceManager and FileManager. Adds
FileManager::getSTDIN, which adds a FileEntryRef for `<stdin>` and reads
the MemoryBuffer, which is stored as `FileEntry::Content`.

Eventually the other buffers in `ContentCache` will sink to here as well
-- we probably usually want to load/save a MemoryBuffer eagerly -- but
it's happening early for stdin to get rid of
CompilerInstance::InitializeSourceManager's final call to
`SourceManager::overrideFileContents`.

clang/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/p1.cpp
relies on building a module from stdin; supporting that requires setting
ContentCache::BufferOverridden.

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

3 years agoBasic: Support named pipes natively in SourceManager and FileManager
Duncan P. N. Exon Smith [Thu, 3 Dec 2020 02:01:28 +0000 (18:01 -0800)]
Basic: Support named pipes natively in SourceManager and FileManager

Handle named pipes natively in SourceManager and FileManager, removing a
call to `SourceManager::overrideFileContents` in
`CompilerInstance::InitializeSourceManager` (removing a blocker for
sinking the content cache to FileManager (which will incidently sink
this new named pipe logic with it)).

SourceManager usually checks if the file entry's size matches the
eventually loaded buffer, but that's now skipped for named pipes since
the `stat` won't reflect the full size.  Since we can't trust
`ContentsEntry->getSize()`, we also need shift the check for files that
are too large until after the buffer is loaded... and load the buffer
immediately in `createFileID` so that no client gets a bad value from
`ContentCache::getSize`. `FileManager::getBufferForFile` also needs to
treat these files as volatile when loading the buffer.

Native support in SourceManager / FileManager means that named pipes can
also be `#include`d, and clang/test/Misc/dev-fd-fs.c was expanded to
check for that.

This is a new version of 3b18a594c7717a328c33b9c1eba675e9f4bd367c, which
was reverted in b34632201987eed369bb7ef4646f341b901c95b8 since it was
missing the `SourceManager` changes.

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

3 years ago[AMDGPU] Fix adjustWritemask subreg handling
Stanislav Mekhanoshin [Wed, 23 Dec 2020 22:15:23 +0000 (14:15 -0800)]
[AMDGPU] Fix adjustWritemask subreg handling

If we happen to extract a non-dword subreg that breaks the
logic of the function and it may shrink the dmask because
it does not recognize the use of a lane(s).

This bug is next to impossible to trigger with the current
lowering in the BE, but it breaks in one of my future patches.

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

3 years ago[lld][test] Relax test assertion of cmake defaults appearing in --version output.
Jordan Rupprecht [Wed, 23 Dec 2020 22:33:04 +0000 (14:33 -0800)]
[lld][test] Relax test assertion of cmake defaults appearing in --version output.

D93491 implemented `--version` for the MachO LLD port, but asserts that the string contains something like "LLD N.N". However, this is just the cmake default for `LLD_VERSION_STRING`, and downstream users may choose a different value, e.g. a rolling distro may print "LLD trunk".

3 years agoFix lldb test failure due to D93082.
Sriraman Tallam [Wed, 23 Dec 2020 22:15:39 +0000 (14:15 -0800)]
Fix lldb test failure due to D93082.

Rename the basic block symbols in the test to reflect the new names.

3 years ago[lldb] Simplify ObjectFile::FindPlugin (NFC)
Jonas Devlieghere [Wed, 23 Dec 2020 21:47:52 +0000 (13:47 -0800)]
[lldb] Simplify ObjectFile::FindPlugin (NFC)

Use early return to reduce the levels of indentation. Extract logic to
find object in container into helper function.

3 years ago[clangd] Fix case mismatch crash on in CDB on windows after 92dd077af1ff8
Sam McCall [Wed, 23 Dec 2020 21:41:46 +0000 (22:41 +0100)]
[clangd] Fix case mismatch crash on in CDB on windows after 92dd077af1ff8

See https://github.com/clangd/clangd/issues/631

3 years agoRevert "[IRSim] Adding support for isomorphic predicates"
Andrew Litteken [Wed, 23 Dec 2020 21:13:03 +0000 (15:13 -0600)]
Revert "[IRSim] Adding support for isomorphic predicates"

Reverting due to unit test errors between commits.

This reverts commit 050392660249c70c00e909ae4a7151ba2c766235.

3 years ago[clang-format] Add SpaceBeforeCaseColon option
Björn Schäpers [Mon, 14 Dec 2020 06:17:24 +0000 (07:17 +0100)]
[clang-format] Add SpaceBeforeCaseColon option

With which you can add a space before the colon of a case or default
statement.

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

3 years ago[clang-format] Fix handling of TextProto comments
Björn Schäpers [Sat, 12 Dec 2020 16:37:35 +0000 (17:37 +0100)]
[clang-format] Fix handling of TextProto comments

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

3 years ago[InstCombine] canonicalizeAbsNabs(): don't propagate NSW flag for NABS patter
Roman Lebedev [Wed, 23 Dec 2020 21:03:01 +0000 (00:03 +0300)]
[InstCombine] canonicalizeAbsNabs(): don't propagate NSW flag for NABS patter

As Nuno is noting in post-commit review in
https://reviews.llvm.org/D87188#2467915
it is not correct to keep NSW for negated abs pattern,
so don't do that.

3 years ago[IRSim] Adding support for isomorphic predicates
Andrew Litteken [Sun, 23 Aug 2020 05:30:10 +0000 (00:30 -0500)]
[IRSim] Adding support for isomorphic predicates

Some predicates, can be considered the same as long as the operands are
flipped. For example, a > b gives the same result as b > a. This maps
instructions in a greater than form, to their appropriate less than
form, swapping the operands in the IRInstructionData only, allowing for
more flexible matching.

Tests:

llvm/test/Transforms/IROutliner/outlining-isomorphic-predicates.ll
llvm/unittests/Analysis/IRSimilarityIdentifierTest.cpp

Reviewers: jroelofs, paquette

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

3 years ago[IRSim] Adding commutativity matching to structure checking
Andrew Litteken [Sat, 22 Aug 2020 03:20:12 +0000 (22:20 -0500)]
[IRSim] Adding commutativity matching to structure checking

Certain instructions, such as adds and multiplies can have the operands
flipped and still be considered the same. When we are analyzing
structure, this gives slightly more flexibility to create a mapping from
one region to another. We can add both operands in a corresponding
instruction to an operand rather than just the exact match. We then try
to eliminate items from the set, until there is only one valid mapping
between the regions of code.

We do this for adds, multiplies, and equality checking. However, this is
not done for floating point instructions, since the order can still
matter in some cases.

Tests:

llvm/test/Transforms/IROutliner/outlining-commutative-fp.ll
llvm/test/Transforms/IROutliner/outlining-commutative.ll
llvm/unittests/Analysis/IRSimilarityIdentifierTest.cpp

Reviewers: jroelofs, paquette

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

3 years ago[InstCombine] Handle different pointer types when folding gep of null
Nikita Popov [Wed, 23 Dec 2020 20:58:26 +0000 (21:58 +0100)]
[InstCombine] Handle different pointer types when folding gep of null

The source pointer type is not necessarily the same as the result
pointer type, so we can't simply return the original null pointer,
it might be a different one.

3 years ago[InstCombine] Fold gep inbounds of null to null
Nikita Popov [Wed, 23 Dec 2020 20:18:48 +0000 (21:18 +0100)]
[InstCombine] Fold gep inbounds of null to null

Effectively, this is what we were previously already doing when
the GEP was used in conjunction with a load or store, but this
fold can also be applied more generally:

> The only in bounds address for a null pointer in the default
> address-space is the null pointer itself.

3 years ago[InstCombine] Add tests for gep of null (NFC)
Nikita Popov [Wed, 23 Dec 2020 20:22:36 +0000 (21:22 +0100)]
[InstCombine] Add tests for gep of null (NFC)

We were only considering the gep of null pattern in conjunction
with a load/store. Also test it independently.

3 years ago[format][NFC] Use unsigned char as the base of all enums in FormatStyle
Nathan James [Wed, 23 Dec 2020 20:27:43 +0000 (20:27 +0000)]
[format][NFC] Use unsigned char as the base of all enums in FormatStyle

This removes alot of unnecessary padding, trimming the size of the struct from 728->608 on 64 bit platforms.

Reviewed By: MyDeveloperDay

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

3 years ago[RISCV] Add ISel support for RVV vector/scalar forms
Fraser Cormack [Tue, 15 Dec 2020 13:05:32 +0000 (13:05 +0000)]
[RISCV] Add ISel support for RVV vector/scalar forms

This patch extends the SDNode ISel support for RVV from only the
vector/vector instructions to include the vector/scalar and
vector/immediate forms.

It uses splat_vector to carry the scalar in each case, except when
XLEN<SEW (RV32 SEW=64) when a custom node `SPLAT_VECTOR_I64` is used for
type-legalization and to encode the fact that the value is sign-extended
to SEW. When the scalar is a full 64-bit value we use a sequence to
materialize the constant into the vector register.

The non-intrinsic ISel patterns have also been split into their own
file.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Fraser Cormack <fraser@codeplay.com>
Reviewed By: craig.topper

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

3 years ago[InstCombine] Check inbounds in load/store of gep null transform (PR48577)
Nikita Popov [Wed, 23 Dec 2020 20:01:00 +0000 (21:01 +0100)]
[InstCombine] Check inbounds in load/store of gep null transform (PR48577)

If the GEP isn't inbounds, then accessing a GEP of null location
is generally not UB.

While this is a minimal fix, the GEP of null handling should
probably be its own fold.

3 years ago[InstCombine] Add tests for PR48577 (NFC)
Nikita Popov [Wed, 23 Dec 2020 19:56:16 +0000 (20:56 +0100)]
[InstCombine] Add tests for PR48577 (NFC)

3 years ago[mlir][spirv] De-template serialization
Lei Zhang [Wed, 23 Dec 2020 19:48:17 +0000 (14:48 -0500)]
[mlir][spirv] De-template serialization

Previously for each op we generate a separate serialization
method for it. Those serialization methods duplicate the logic
of parsing operands/results/attributes and such.

This commit creates a generic method and let suitable op-specific
serialization method to call into it.

wc -l SPIRVSerialization.inc: before 8304; after: 5597 (So -2707)

Reviewed By: hanchung, ThomasRaoux

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

3 years ago[mlir][spirv] De-template deserialization
Lei Zhang [Wed, 23 Dec 2020 19:37:52 +0000 (14:37 -0500)]
[mlir][spirv] De-template deserialization

Previously for each op we generate a separate deserialization
method for it. Those deserialization methods duplicate the logic
of parsing operands/results/attributes and such.

This commit creates a generic method and let suitable op-specific
deserialization method to call into it.

wc -l SPIRVSerialization.inc: before 13290; after: 8304 (So -4986)

Reviewed By: hanchung, ThomasRaoux

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

3 years ago[IROutliner] Use isa instead of dyn_cast where the casted value isn't used. NFC
Craig Topper [Wed, 23 Dec 2020 19:39:50 +0000 (11:39 -0800)]
[IROutliner] Use isa instead of dyn_cast where the casted value isn't used. NFC

Fixes unused variable warnings.

3 years ago[mlir][spirv] NFC: rename SPIR-V conversion files for consistency
Lei Zhang [Wed, 23 Dec 2020 19:32:31 +0000 (14:32 -0500)]
[mlir][spirv] NFC: rename SPIR-V conversion files for consistency

This commit renames various SPIR-V related conversion files for
consistency. It drops the "Convert" prefix to various files and
fixes various comment headers.

Reviewed By: hanchung, ThomasRaoux

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

3 years agoAppend ".__part." to every basic block section symbol.
Sriraman Tallam [Wed, 23 Dec 2020 17:51:35 +0000 (09:51 -0800)]
Append ".__part." to every basic block section symbol.

Every basic block section symbol created by -fbasic-block-sections will contain
".__part." to know that this symbol corresponds to a basic block fragment of
the function.

This patch solves two problems:

a) Like D89617, we want function symbols with suffixes to be properly qualified
   so that external tools like profile aggregators know exactly what this
   symbol corresponds to.
b) The current basic block naming just adds a ".N" to the symbol name where N is
   some integer. This collides with how clang creates __cxx_global_var_init.N.
   clang creates these symbol names to call constructor functions and basic
   block symbol naming should not use the same style.

Fixed all the test cases and added an extra test for __cxx_global_var_init
breakage.

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

3 years ago[mlir][spirv] Create a pass for testing SCFToSPIRV patterns
Lei Zhang [Wed, 23 Dec 2020 18:37:27 +0000 (13:37 -0500)]
[mlir][spirv] Create a pass for testing SCFToSPIRV patterns

Previously all SCF to SPIR-V conversion patterns were tested as
the -convert-gpu-to-spirv pass. That obscured the structure we
want. This commit fixed it.

Reviewed By: ThomasRaoux, hanchung

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

3 years ago[LoopIdiom] 'left-shift until bittest' idiom: support rewriting loop as countable...
Roman Lebedev [Wed, 23 Dec 2020 19:26:40 +0000 (22:26 +0300)]
[LoopIdiom] 'left-shift until bittest' idiom: support rewriting loop as countable, allow extra cruft

The current state of the transform is still not enough to support
my motivational pattern, because it has one more "induction variable".

I have delayed posting this patch, because originally even just rewriting
the loop as countable wasn't enough to nicely transform my motivational pattern,
because i expected that extra IV to be rewritten afterwards,
but it wasn't happening until i fixed that in D91800.

So, this patch allows the  'left-shift until bittest' loop idiom
as long as the inserted ops are cheap,
and lifts any and all extra use checks on the instructions.

Reviewed By: craig.topper

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

3 years ago[LoopIdiom] 'left-shift until bittest' idiom: support canonical sign bit mask
Roman Lebedev [Wed, 23 Dec 2020 19:26:39 +0000 (22:26 +0300)]
[LoopIdiom] 'left-shift until bittest' idiom: support canonical sign bit mask

If the bitmask is for sign bit, instcombine would have canonicalized
the pattern into a proper sign bit check. Supporting that is still
simple, but requires a bit of a roundtrip - we first have to use
`decomposeBitTestICmp()`, and the rest again just works.

Reviewed By: craig.topper

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

3 years ago[LoopIdiom] 'left-shift until bittest' idiom: support constant bit mask
Roman Lebedev [Wed, 23 Dec 2020 19:26:34 +0000 (22:26 +0300)]
[LoopIdiom] 'left-shift until bittest' idiom: support constant bit mask

The handing of the case where the mask is a constant is trivial,
if said constant is a power of two, the bit in question is log2(mask),
rest just works.

Reviewed By: craig.topper

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

3 years ago[LoopIdiom] Introduce 'left-shift until bittest' idiom
Roman Lebedev [Wed, 23 Dec 2020 19:26:28 +0000 (22:26 +0300)]
[LoopIdiom] Introduce 'left-shift until bittest' idiom

The motivation here is the following inner loop in fp16/fp24 -> fp32 expander,
that runs as part of the floating-point DNG decompression in RawSpeed library:
https://github.com/darktable-org/rawspeed/blob/cd380bb9a209bd2e7a0e7022b0cab04528d151e7/src/librawspeed/decompressors/DeflateDecompressor.cpp#L112-L115
```
      while (!(fp32_fraction & (1 << 23))) {
        fp32_exponent -= 1;
        fp32_fraction <<= 1;
      }
```
(https://godbolt.org/z/r13YMh)
As one might notice, that loop is currently uncountable, and that whole code stays scalar.
Yet, it is rather trivial to make that loop countable:
 https://godbolt.org/z/do8WMz
and we can prove that via alive2:
 https://alive2.llvm.org/ce/z/7vQnji (ha nice, isn't it?)
... and that allow for the whole fp16->fp32 code to vectorize:
 https://godbolt.org/z/7hYr13

Now, while i'd love to get there, i feel like i should take it in steps.

For now, this introduces support for the most basic case,
where the bit position is known as a variable,
and the loop *will* go away (has no live-outs other than the recurrence,
no extra instructions in the loop).

I have added sufficient (i believe) test coverage,
and alive2 is happy with those transforms.

Reviewed By: craig.topper

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

3 years agoclang: Build and run FrontendTests with CLANG_ENABLE_STATIC_ANALYZER=OFF too
Nico Weber [Wed, 23 Dec 2020 19:25:34 +0000 (14:25 -0500)]
clang: Build and run FrontendTests with CLANG_ENABLE_STATIC_ANALYZER=OFF too

They seem to pass fine with the analyzer off, and with this I would've
noticed my last check-clang break locally.

3 years ago[mlir][vector] Add more vector Ops canonicalization
Thomas Raoux [Fri, 11 Dec 2020 15:08:55 +0000 (07:08 -0800)]
[mlir][vector] Add more vector Ops canonicalization

Add canonicalization for BroadcastOp, ExtractStrideSlicesOp and ShapeCastOp

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

3 years agoRevert more changes that landed on top of 741978d727
Nico Weber [Wed, 23 Dec 2020 19:13:23 +0000 (14:13 -0500)]
Revert more changes that landed on top of 741978d727

This should've been in 7ad666798f12456d9 but wasn't.

Squashes these twoc commits:
Revert "[clang][cli] Let denormalizer decide how to render the option based on the option class"
This reverts commit 70410a264949101ced3ce3458f37dd4cc2f5af85.

Revert "[clang][cli] Implement `getAllArgValues` marshalling"
This reverts commit 63a24816f561a5d8e28ca7054892bd8602618be4.

3 years agoRevert "This is a test commit"
Alan Phipps [Wed, 23 Dec 2020 19:01:46 +0000 (13:01 -0600)]
Revert "This is a test commit"

This reverts commit b920adf3b4f16bef8dde937b67874d8e8ac1030e.

3 years ago[IROutliner] Adding support for elevating constants that are not the same in each...
Andrew Litteken [Tue, 15 Sep 2020 23:20:09 +0000 (18:20 -0500)]
[IROutliner] Adding support for elevating constants that are not the same in each region to arguments

When there are constants that have the same structural location, but not
the same value, between different regions, we cannot simply outline the
region. Instead, we find the constants that are not the same in each
location, and promote them to arguments to be passed into the respective
functions. At each call site, we pass the constant in as an argument
regardless of type.

Added/Edited Tests:

llvm/test/Transforms/IROutliner/outlining-constants-vs-registers.ll
llvm/test/Transforms/IROutliner/outlining-different-constants.ll
llvm/test/Transforms/IROutliner/outlining-different-globals.ll

Reviewers: paquette, jroelofs

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

3 years agoUpdated GettingInvolved.md to reflect Flang Biweekly Call changes
AlexisPerry [Wed, 23 Dec 2020 17:57:36 +0000 (10:57 -0700)]
Updated GettingInvolved.md to reflect Flang Biweekly Call changes

   - updated the link to join the meeting to reflect the new WebEx information
   - Added a note about the new Google Doc for keeping track of notes, and who
     to contact if you experience access issues with the document
   - Left a reference to the minutes from previous meetings being available
     through a search of the flang-dev mailing list

Reviewed By: jdoerfert

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

3 years agoThis is a test commit
Alan Phipps [Wed, 23 Dec 2020 18:57:27 +0000 (12:57 -0600)]
This is a test commit

3 years ago[RISCV] Add intrinsics for vfmv.v.f
Craig Topper [Wed, 23 Dec 2020 18:01:43 +0000 (10:01 -0800)]
[RISCV] Add intrinsics for vfmv.v.f

Also include a special case pattern to use vmv.v.x vd, zero when
the argument is 0.0.

Reviewed By: khchen

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

3 years ago[lldb] Refactor and simplify GetCommandSPExact interface
Jonas Devlieghere [Tue, 22 Dec 2020 22:02:18 +0000 (14:02 -0800)]
[lldb] Refactor and simplify GetCommandSPExact interface

GetCommandSPExact is called exaclty once with include_aliases set to
true, so make it a default argument. Use early returns to simplify the
implementation.

3 years ago[lldb] Don't instrument demangling.
Jonas Devlieghere [Tue, 22 Dec 2020 21:17:17 +0000 (13:17 -0800)]
[lldb] Don't instrument demangling.

Don't instrument demangling calls. These functions are very hot and
instrumenting them quickly results in too much data to be useful.

3 years ago[mlir][spirv] Convert functions returning one value
Lei Zhang [Wed, 23 Dec 2020 18:21:57 +0000 (13:21 -0500)]
[mlir][spirv] Convert functions returning one value

Reviewed By: hanchung, ThomasRaoux

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

3 years agoRevert 741978d727 and things that landed on top of it.
Nico Weber [Wed, 23 Dec 2020 17:39:16 +0000 (12:39 -0500)]
Revert 741978d727 and things that landed on top of it.

741978d727 made clang produce output that's 2x as large at least in
sanitizer builds. https://reviews.llvm.org/D83892#2470185 has a
standalone repro.

This reverts the following commits:

Revert "[clang][cli] Port CodeGenOpts simple string flags to new option parsing system"
This reverts commit 95d3cc67caac04668ef808f65c30ced60ed14f5d.

Revert "[clang][cli] Port LangOpts simple string based options to new option parsing system"
This reverts commit aec2991d083a9c5b92f94d84a7b3a7bbed405af8.

Revert "[clang][cli] Streamline MarshallingInfoFlag description"
This reverts commit 27b7d646886d499c70dec3481dfc3c82dfc43dd7.

Revert "[clang][cli] Port LangOpts option flags to new option parsing system"
This reverts commit 383778e2171b4993f555433745466e211e713548.

Revert "[clang][cli] Port CodeGen option flags to new option parsing system"
This reverts commit 741978d727a445fa279d5952a86ea634adb7dc52.

3 years ago[OpenMP] Fixing typo on memory size in Documenation
Joseph Huber [Wed, 23 Dec 2020 16:45:46 +0000 (11:45 -0500)]
[OpenMP] Fixing typo on memory size in Documenation

3 years ago[lld-macho] Simulator & DriverKit executables should always be PIE
Jez Ng [Wed, 23 Dec 2020 16:24:02 +0000 (11:24 -0500)]
[lld-macho] Simulator & DriverKit executables should always be PIE

We didn't have support for parsing DriverKit in our `-platform`
flag, so add that too. Also remove a bunch of unnecessary namespace
prefixes.

Reviewed By: #lld-macho, thakis

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

3 years ago[TableGen] Add the !substr() bang operator
Paul C. Anagnostopoulos [Wed, 16 Dec 2020 14:55:16 +0000 (09:55 -0500)]
[TableGen] Add the !substr() bang operator

Update the documentation and add a test.

Build failed: Change SIZE_MAX to std::numeric_limits<int64_t>::max().

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

3 years ago[BPI] Improve static heuristics for "cold" paths.
Evgeniy Brevnov [Thu, 18 Jun 2020 09:20:55 +0000 (16:20 +0700)]
[BPI] Improve static heuristics for "cold" paths.

Current approach doesn't work well in cases when multiple paths are predicted to be "cold". By "cold" paths I mean those containing "unreachable" instruction, call marked with 'cold' attribute and 'unwind' handler of 'invoke' instruction. The issue is that heuristics are applied one by one until the first match and essentially ignores relative hotness/coldness
 of other paths.

New approach unifies processing of "cold" paths by assigning predefined absolute weight to each block estimated to be "cold". Then we propagate these weights up/down IR similarly to existing approach. And finally set up edge probabilities based on estimated block weights.

One important difference is how we propagate weight up. Existing approach propagates the same weight to all blocks that are post-dominated by a block with some "known" weight. This is useless at least because it always gives 50\50 distribution which is assumed by default anyway. Worse, it causes the algorithm to skip further heuristics and can miss setting more accurate probability. New algorithm propagates the weight up only to the blocks that dominates and post-dominated by a block with some "known" weight. In other words, those blocks that are either always executed or not executed together.

In addition new approach processes loops in an uniform way as well. Essentially loop exit edges are estimated as "cold" paths relative to back edges and should be considered uniformly with other coldness/hotness markers.

Reviewed By: yrouban

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

3 years ago[clangd] Do not take stale definition from the static index.
Aleksandr Platonov [Wed, 23 Dec 2020 14:04:54 +0000 (17:04 +0300)]
[clangd] Do not take stale definition from the static index.

This is follow up to D93393.
Without this patch clangd takes the symbol definition from the static index if this definition was removed from the dynamic index.

Reviewed By: sammccall

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

3 years ago[MLIR][SPIRV] Add rewrite pattern to convert select+cmp into GLSL clamp.
ergawy [Wed, 23 Dec 2020 14:32:31 +0000 (15:32 +0100)]
[MLIR][SPIRV] Add rewrite pattern to convert select+cmp into GLSL clamp.

Adds rewrite patterns to convert select+cmp instructions into clamp
instructions whenever possible. Support is added to convert:

- FOrdLessThan, FOrdLessThanEqual to GLSLFClampOp.
- SLessThan, SLessThanEqual to GLSLSClampOp.
- ULessThan, ULessThanEqual to GLSLUClampOp.

Reviewed By: mravishankar

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

3 years ago[clang-format] PR48539 ReflowComments breaks Qt translation comments
mydeveloperday [Wed, 23 Dec 2020 14:44:31 +0000 (14:44 +0000)]
[clang-format] PR48539 ReflowComments breaks Qt translation comments

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

Add support for Qt Translator Comments to reflow

When reflown and a part of the comments are added on a new line, it should repeat these extra characters as part of the comment token.

Reviewed By: curdeius, HazardyKnusperkeks

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

3 years ago[clang-format] PR48535 clang-format Incorrectly Removes Space After C Style Cast...
mydeveloperday [Wed, 23 Dec 2020 14:41:06 +0000 (14:41 +0000)]
[clang-format] PR48535 clang-format Incorrectly Removes Space After C Style Cast When Type Is Not a Pointer

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

using `SpaceAfterCStyleCast: true`

```
size_t idx = (size_t) a;
size_t idx = (size_t) (a - 1);
```

is formatted as:

```
size_t idx = (size_t) a;
size_t idx = (size_t)(a - 1);
```

This revision aims to improve that by improving the function which tries to identify a CastRParen

Reviewed By: curdeius

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

3 years ago[OpenMP] Fixing Typo in Documentation
Joseph Huber [Wed, 23 Dec 2020 14:16:55 +0000 (09:16 -0500)]
[OpenMP] Fixing Typo in Documentation

3 years ago[ARM] Add bank conflict hazarding
David Penry [Wed, 23 Dec 2020 14:00:59 +0000 (14:00 +0000)]
[ARM] Add bank conflict hazarding

Adds ARMBankConflictHazardRecognizer. This hazard recognizer
looks for a few situations where the same base pointer is used and
then checks whether the offsets lead to a bank conflict. Two
parameters are also added to permit overriding of the target
assumptions:

arm-data-bank-mask=<int> - Mask of bits which are to be checked for
conflicts.  If all these bits are equal in the offsets, there is a
conflict.
arm-assume-itcm-bankconflict=<bool> - Assume that there will be bank
conflicts on any loads to a constant pool.

This hazard recognizer is enabled for Cortex-M7, where the Technical
Reference Manual states that there are two DTCM banks banked using bit
2 and one ITCM bank.

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

3 years ago[NFC] Uniquify 'const' in TargetTransformInfoImpl.h
Simon Moll [Wed, 23 Dec 2020 13:21:41 +0000 (14:21 +0100)]
[NFC] Uniquify 'const' in TargetTransformInfoImpl.h

Some member functions of class TargetTransformInfoImplBase in
TargetTransformInfoImpl.h are marked const while others are not. Yet all
of the should be marked const since they are just providing default TTI
values. This patch fixes the inconsistency.

Authored-by: Jinzheng Tu <b1f6c1c4@gmail.com>
Reviewed By: simoll

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

3 years ago[VE] Vector 'and' isel and tests
Simon Moll [Wed, 23 Dec 2020 12:27:55 +0000 (13:27 +0100)]
[VE] Vector 'and' isel and tests

Reviewed By: kaz7

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

3 years ago[mlir] Remove static constructors from LLVMType
Alex Zinenko [Tue, 22 Dec 2020 10:22:56 +0000 (11:22 +0100)]
[mlir] Remove static constructors from LLVMType

LLVMType contains numerous static constructors that were initially introduced
for API compatibility with LLVM. Most of these merely forward to arguments to
`SpecificType::get` (MLIR defines classes for all types, unlike LLVM IR), while
some introduce subtle semantics differences due to different modeling of MLIR
types (e.g., structs are not auto-renamed in case of conflicts). Furthermore,
these constructors don't match MLIR idioms and actively prevent us from making
the LLVM dialect type system more open. Remove them and use `SpecificType::get`
instead.

Depends On D93680

Reviewed By: mehdi_amini

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

3 years ago[format] Add overload to parseConfiguration that accept llvm::MemoryBufferRef
Nathan James [Wed, 23 Dec 2020 12:08:28 +0000 (12:08 +0000)]
[format] Add overload to parseConfiguration that accept llvm::MemoryBufferRef

This overload should be used for better diagnostics when parsing configurations.
Now a failure to parse will list the filename (or <command-line>) instead of just `YAML`.

Reviewed By: MyDeveloperDay

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

3 years agoRevert "PR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of"
Adrian Kuegel [Wed, 23 Dec 2020 11:31:52 +0000 (12:31 +0100)]
Revert "PR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of"

This reverts commit d3bf0bb18952d830fe6df6f791a64552b271000b.
This causes compilation in certain cases to fail.
Reproducer TBD.

3 years ago[mlir] Rename ConvertToLLVMPattern::isSupportedMemRefType() to isConvertibleAndHasIde...
Christian Sigg [Wed, 23 Dec 2020 10:37:49 +0000 (11:37 +0100)]
[mlir] Rename ConvertToLLVMPattern::isSupportedMemRefType() to isConvertibleAndHasIdentityMaps().

Reviewed By: ftynse, herhut

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

3 years ago[mlir] Add translation of omp.wsloop to LLVM IR
Alex Zinenko [Tue, 8 Dec 2020 15:45:19 +0000 (16:45 +0100)]
[mlir] Add translation of omp.wsloop to LLVM IR

Introduce a translation of OpenMP workshare loop construct to LLVM IR. This is
a minimalist version to enable the pipeline and currently only supports static
loop schedule (default in the specification) on non-collapsed loops. Other
features will be added on per-need basis.

Reviewed By: kiranchandramohan

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

3 years ago[mlir] NFC: Remove ConvertToLLVMPattern::getDataPtr(). All call sites use getStridedE...
Christian Sigg [Wed, 23 Dec 2020 09:51:23 +0000 (10:51 +0100)]
[mlir] NFC: Remove ConvertToLLVMPattern::getDataPtr(). All call sites use getStridedElementPtr() now.

Reviewed By: ftynse

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

3 years ago[mlir] Modernize std-to-llvm operation conversion doc
Alex Zinenko [Wed, 23 Dec 2020 10:19:35 +0000 (11:19 +0100)]
[mlir] Modernize std-to-llvm operation conversion doc

This was long overdue. Replace the outdated type syntax with the new syntax,
and update the description of how memref load/stores are handled to reflect the
latest changes in the implementation.

Reviewed By: herhut

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

3 years ago[AMDGPU][GlobalISel] Fold flat vgpr + constant addresses
Sebastian Neubauer [Tue, 22 Dec 2020 12:53:38 +0000 (13:53 +0100)]
[AMDGPU][GlobalISel] Fold flat vgpr + constant addresses

Use getPtrBaseWithConstantOffset in selectFlatOffsetImpl to fold more
vgpr+constant addresses.

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