David Green [Sun, 27 Dec 2020 13:18:10 +0000 (13:18 +0000)]
[ARM] Add some NEON anyextend testing. NFC
This cleans up and regenerates the NEON addw/addl/subw/subl/mlal etc
tests, adding some tests that turn the zext into anyextend using an and
mask.
Pavel Labath [Fri, 18 Dec 2020 20:52:26 +0000 (21:52 +0100)]
[lldb/test] Automatically skip remote lldb-server tests when applicable
The tests don't work with remote debugservers. This isn't a problem with
any particular test, but the test infrastructure itself, which is why
each of these tests has a @skipIfDarwinEmbedded decorator.
This patch replaces that with a central category-based solution. It also
moves the ad-hoc windows skipping mechanism there too.
Pavel Labath [Sun, 27 Dec 2020 12:56:35 +0000 (13:56 +0100)]
[lldb] Surpress "ingoring result" warning in reproducer_handler
Amara Emerson [Sun, 27 Dec 2020 07:49:51 +0000 (23:49 -0800)]
[GlobalISel] Fix assertion failures after "GlobalISel: Return APInt from getConstantVRegVal" landed.
APInt binary ops don't promote types but instead assert, which a combine was
relying on.
Craig Topper [Sun, 27 Dec 2020 07:35:48 +0000 (23:35 -0800)]
[X86] Remove X86Fmadd SDNode from tablegen. Use standard fma instead. NFC
I guess I missed this in
4252f7773a5b98b825d17e5f77c7d349cb2fb7c7
when I modified most patterns.
Craig Topper [Sun, 27 Dec 2020 02:47:58 +0000 (18:47 -0800)]
[RISCV] Improve VMConstraint checking on more unary and nullary instructions.
We weren't consistently marking unary instructions as OneInput
and vid.v is really ZeroInput but we had no way to mark that.
This patch improves this by removing the error prone OneInput constraint.
Instead we just always look for the mask in the last operand.
It appears that the "CheckReg" variable used for the check on the broken
instruction was unitialized or garbage because it was also used for
VS1/VS2 constraints. I've scoped the variable locally to each check now.
I've gone through and set NoConstraint on instructions that don't have
a real VMConstraint and don't have a mask as the last operand.
I've also removed the unused enum values in RISCVBaseInfo.h. We
never use them in C++ and we have separate versions in a td file.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D93784
Chris Lattner [Thu, 24 Dec 2020 02:13:39 +0000 (18:13 -0800)]
[ODS] Make the getType() method on a OneResult instruction return a specific type.
Implement Bug 46698, making ODS synthesize a getType() method that returns a
specific C++ class for OneResult methods where we know that class. This eliminates
a common source of casts in things like:
myOp.getType().cast<FIRRTLType>().getPassive()
because we know that myOp always returns a FIRRTLType. This also encourages
op authors to type their results more tightly (which is also good for
verification).
I chose to implement this by splitting the OneResult trait into itself plus a
OneTypedResult trait, given that many things are using `hasTrait<OneResult>`
to conditionalize various logic.
While this changes makes many many ops get more specific getType() results, it
is generally drop-in compatible with the previous behavior because 'x.cast<T>()'
is allowed when x is already known to be a T. The one exception to this is that
we need declarations of the types used by ops, which is why a couple headers
needed additional #includes.
I updated a few things in tree to remove the now-redundant `.cast<>`'s, but there
are probably many more than can be removed.
Differential Revision: https://reviews.llvm.org/D93790
Arthur Eubanks [Sat, 26 Dec 2020 21:46:02 +0000 (13:46 -0800)]
[test] Pin some tests to legacy PM
These all have NPM RUN lines.
Nikita Popov [Sat, 26 Dec 2020 20:47:14 +0000 (21:47 +0100)]
[CVP] Add tests for select form of and/or (NFC)
This tests their handling inside LVI. See D93065 for wider context.
Kazu Hirata [Sat, 26 Dec 2020 20:06:27 +0000 (12:06 -0800)]
[llvm-cov, llvm-symbolizer] Use llvm::erase_if (NFC)
Kazu Hirata [Sat, 26 Dec 2020 20:06:25 +0000 (12:06 -0800)]
[TableGen] Use llvm::erase_if (NFC)
Kazu Hirata [Sat, 26 Dec 2020 20:06:24 +0000 (12:06 -0800)]
[llvm-pdbutil] Use llvm::is_contained (NFC)
Nathan James [Sat, 26 Dec 2020 17:53:32 +0000 (17:53 +0000)]
[NFC] Refactor some SourceMgr code
Sanjay Patel [Thu, 24 Dec 2020 19:01:12 +0000 (14:01 -0500)]
[SLP] rename reduction variables for readability; NFC
I am hoping to extend the reduction matching code, and it is
hard to distinguish "ReductionData" from "ReducedValueData".
So extend the tree/root metaphor to include leaves.
Another problem is that the name "OperationData" does not
provide insight into its purpose. I'm not sure if we can alter
that underlying data structure to make the code clearer.
Sanjay Patel [Tue, 22 Dec 2020 22:16:30 +0000 (17:16 -0500)]
[SLP] use switch to improve readability; NFC
This will get more complicated when we handle intrinsics like maxnum.
mydeveloperday [Sat, 26 Dec 2020 15:18:14 +0000 (15:18 +0000)]
[clang-format] PR48569 clang-format fails to align case label with `switch` with Whitesmith Indentation
https://bugs.llvm.org/show_bug.cgi?id=48569
This is a tentative fix which addresses a PR raise regarding Case indentation when working with Whitesmiths Indentation
I could not find online any reference sources as to what the case indentation for Whitesmith's should be (or be allowed to be)
But according to the documentation, we don't obey the rules for Whitesmith's
```
In particular, the documentation states that this option is to "indent case labels one level from the switch statement. When false, use the same indentation level as for the switch statement."
```
The behaviour we add here is actually as the TODO in the tests used to state in {D67627}, but when {D82016} was added and I brought these tests out from being TODO I realized I changed the indentation.
Reviewed By: curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D93806
Nikita Popov [Sat, 26 Dec 2020 14:22:20 +0000 (15:22 +0100)]
[ValueTracking] Handle more non-trivial conditions in isKnownNonZero()
In
35676a4f9a536a2aab768af63ddbb15bc722d7f9 I've added handling for
non-trivial dominating conditions that imply non-zero on the true
branch. This adds the same support for the false branch.
The changes in pr45360.ll change block ordering and naming, but
don't change the control flow. The urem is still guaraded by a
non-zero check correctly.
Nikita Popov [Sat, 26 Dec 2020 14:31:49 +0000 (15:31 +0100)]
[ValueTracking] Add more known non zero tests (NFC)
Add tests for non-trivial conditions that imply non-zero on the
false branch rather than the true branch.
The last case already folds due to canonicalization.
Monk Chiang [Sat, 26 Dec 2020 13:21:46 +0000 (21:21 +0800)]
[RISCV] Define vector widening reduction intrinsic.
Define vwredsumu/vwredsum/vfwredosum/vfwredsum
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/D93807
Kazu Hirata [Fri, 25 Dec 2020 18:13:18 +0000 (10:13 -0800)]
[llvm-objcopy] Use llvm::erase_if (NFC)
Kazu Hirata [Fri, 25 Dec 2020 17:35:20 +0000 (09:35 -0800)]
[Local] Remove unused function RemovePredecessorAndSimplify (NFC)
The last use of the function was removed on Sep 29, 2010 in commit
99c985c37dd45dd0fbd03863037d8e93153783e6.
Nikita Popov [Fri, 25 Dec 2020 17:26:00 +0000 (18:26 +0100)]
[BasicAA] Pass AC/DT to isKnownNonEqual()
This allows us to handle assumes etc in the recursive
isKnownNonZero() checks.
Kazu Hirata [Fri, 25 Dec 2020 17:22:37 +0000 (09:22 -0800)]
[llvm-nm, llvm-objdump] Use llvm::is_contained (NFC)
Nikita Popov [Fri, 25 Dec 2020 11:28:01 +0000 (12:28 +0100)]
[InstCombine] Generalize icmp handling in isKnownNonZero()
The dominating condition handling in isKnownNonZero() currently
only takes into account conditions of the form "x != 0" or "x == 0".
However, there are plenty of other conditions that imply non-zero,
a common one being "x s> 0".
Peculiarly, the handling for assumes was already dealing with more
general non-zero-ness conditions, so this just reuses the same
logic for the dominating condition case.
Nikita Popov [Fri, 25 Dec 2020 15:13:42 +0000 (16:13 +0100)]
[InstCombine] Add additional tests for known non zero (NFC)
Check conditions that imply non-zero, even if they are not literally
"x != 0".
Using ctlz for testing, as explicit comparison might get folded by
other reasoning.
Nikita Popov [Fri, 25 Dec 2020 10:43:08 +0000 (11:43 +0100)]
[BasicAA] Pass context instruction to isKnownNonZero()
This allows us to handle additional cases like assumes.
Nikita Popov [Sun, 13 Dec 2020 19:27:16 +0000 (20:27 +0100)]
[BasicAA] Make sure context instruction is symmetric
D71264 started using a context instruction in a computeKnownBits()
call. However, if aliasing between two GEPs is checked, then the
choice of context instruction will be different for alias(GEP1, GEP2)
and alias(GEP2, GEP1), which is not supposed to happen.
Resolve this by remembering which GEP a certain VarIndex belongs to,
and use that as the context instruction. This makes the choice of
context instruction predictable and symmetric.
It should be noted that this choice of context instruction is
non-optimal (just like the previous choice): The AA query result is
only valid at points that are reachable from *both* instructions.
Using either one of them is conservatively correct, but a larger
context may also be valid to use.
Differential Revision: https://reviews.llvm.org/D93183
Eugene Zhulenev [Thu, 24 Dec 2020 13:08:47 +0000 (05:08 -0800)]
[mlir] Async: add support for lowering async value operands to LLVM
Depends On D93592
Add support for `async.execute` async value unwrapping operands:
```
%token = async.execute(%async_value as %unwrapped : !async.value<!my.type>) {
...
async.yield
}
```
Reviewed By: csigg
Differential Revision: https://reviews.llvm.org/D93598
Eugene Zhulenev [Thu, 24 Dec 2020 13:08:09 +0000 (05:08 -0800)]
[mlir] Async: lowering async.value to LLVM
1. Add new methods to Async runtime API to support yielding async values
2. Add lowering from `async.yield` with value payload to the new runtime API calls
`async.value` lowering requires that payload type is convertible to LLVM and supported by `llvm.mlir.cast` (DialectCast) operation.
Reviewed By: csigg
Differential Revision: https://reviews.llvm.org/D93592
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
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
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
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
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.
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
Kazu Hirata [Fri, 25 Dec 2020 03:43:26 +0000 (19:43 -0800)]
[Target] Use llvm::any_of (NFC)
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
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
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
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.
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.
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.
Roman Lebedev [Thu, 24 Dec 2020 09:29:10 +0000 (12:29 +0300)]
[NFC][InstCombine] Add test coverage for `(x ^ C) ^ y` pattern
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!
```
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.
Roman Lebedev [Thu, 24 Dec 2020 10:46:54 +0000 (13:46 +0300)]
[NFC][InstCombine] Autogenerate check lines in vec_shuffle.ll test
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.
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.
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.
Kazu Hirata [Thu, 24 Dec 2020 17:08:36 +0000 (09:08 -0800)]
[CodeGen, Transforms] Use llvm::any_of (NFC)
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.
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.
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.
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
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
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
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
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.
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
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.
Kazu Hirata [Thu, 24 Dec 2020 05:44:39 +0000 (21:44 -0800)]
[ExecutionEngine, Linker] Use erase_if (NFC)
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
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
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
Alexandre Ganea [Thu, 24 Dec 2020 00:24:43 +0000 (19:24 -0500)]
[Clang] Reverse test to save on indentation. NFC.
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
Jacques Pienaar [Thu, 24 Dec 2020 00:13:03 +0000 (16:13 -0800)]
[mlir] Add tensor passes to passes.md
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
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
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
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".
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.
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.
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
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.
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
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
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.
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
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
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.
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.
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.
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
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
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.
Nikita Popov [Wed, 23 Dec 2020 19:56:16 +0000 (20:56 +0100)]
[InstCombine] Add tests for PR48577 (NFC)
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
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
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.
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
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
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
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
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
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
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
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.
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
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.