]> granicus.if.org Git - llvm/log
llvm
5 years agoAdd encode and decode methods to InlineInfo and document encoding format to the GSYM...
Greg Clayton [Wed, 4 Sep 2019 17:32:51 +0000 (17:32 +0000)]
Add encode and decode methods to InlineInfo and document encoding format to the GSYM file format.

This patch adds the ability to encode and decode InlineInfo objects and adds test coverage. Error handling is introduced in the encoding and decoding which will be used from here on out for remaining patches.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370936 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Fold sub (and A, B) (or A, B)) to neg (xor A, B)
David Bolvansky [Wed, 4 Sep 2019 17:30:53 +0000 (17:30 +0000)]
[InstCombine] Fold sub (and A, B) (or A, B)) to neg (xor A, B)

Summary:
```
Name: sub(and(x, y), or(x, y)) -> neg(xor(x, y))
%or = or i32 %y, %x
%and = and i32 %x, %y
%sub = sub i32 %and, %or
  =>
%sub1 = xor i32 %x, %y
%sub = sub i32 0, %sub1

Optimization: sub(and(x, y), or(x, y)) -> neg(xor(x, y))
Done: 1
Optimization is correct!
```

https://rise4fun.com/Alive/VI6

Found by @lebedev.ri. Also author of the proof.

Reviewers: lebedev.ri, spatel

Reviewed By: lebedev.ri

Subscribers: llvm-commits, lebedev.ri

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370934 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Instruction] Add hasMetadata(Kind) helper [NFC]
Philip Reames [Wed, 4 Sep 2019 17:28:48 +0000 (17:28 +0000)]
[Instruction] Add hasMetadata(Kind) helper [NFC]

It's a common idiom, so let's add the obvious wrapper for metadata kinds which are basically booleans.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370933 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Handle frame index expansion with no free SGPRs pre gfx9
Matt Arsenault [Wed, 4 Sep 2019 17:12:57 +0000 (17:12 +0000)]
AMDGPU: Handle frame index expansion with no free SGPRs pre gfx9

Since an add instruction must produce an unused carry out, this
requires additional SGPRs. This can be avoided by keeping the entire
offset computation in SGPRs. If one SGPR is still available, this only
costs one extra mov. If none are available, the entire computation can
be done in place and reversed.

This does assume the use is a VGPR operand. This was already assumed,
and we currently only select frame indexes to VALU instructions. This
should probably be fixed at some point to handle more possible MIR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370929 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Add G_BITREVERSE
Matt Arsenault [Wed, 4 Sep 2019 17:06:53 +0000 (17:06 +0000)]
GlobalISel: Add G_BITREVERSE

This is the first failing pattern for AMDGPU and is trivial to handle.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370927 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor][NFC] Add assertion to guard against accidental misuse
Johannes Doerfert [Wed, 4 Sep 2019 16:36:54 +0000 (16:36 +0000)]
[Attributor][NFC] Add assertion to guard against accidental misuse

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370925 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Look at internal functions only on-demand
Johannes Doerfert [Wed, 4 Sep 2019 16:35:20 +0000 (16:35 +0000)]
[Attributor] Look at internal functions only on-demand

Summary:
Instead of building attributes for internal functions which we do not
update as long as we assume they are dead, we now do not create
attributes until we assume the internal function to be live. This
improves the number of required iterations, as well as the number of
required updates, in real code. On our tests, the results are mixed.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370924 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Use the white list for attributes consistently
Johannes Doerfert [Wed, 4 Sep 2019 16:26:20 +0000 (16:26 +0000)]
[Attributor] Use the white list for attributes consistently

Summary:
We create attributes on-demand so we need to check the white list
on-demand. This also unifies the location at which we create,
initialize, and eventually invalidate new abstract attributes.

The tests show mixed results, a few more call site attributes are
determined which can cause more iterations.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370922 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/GlobalISel: Make 16-bit constants legal
Matt Arsenault [Wed, 4 Sep 2019 16:19:45 +0000 (16:19 +0000)]
AMDGPU/GlobalISel: Make 16-bit constants legal

This is mostly for the benefit of patterns which use 16-bit constants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370921 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel/TableGen: Don't skip REG_SEQUENCE based on patterns
Matt Arsenault [Wed, 4 Sep 2019 16:19:34 +0000 (16:19 +0000)]
GlobalISel/TableGen: Don't skip REG_SEQUENCE based on patterns

This partially adds support for patterns with REG_SEQUENCE. The source
patterns are now accepted, but the pattern is still rejected due to
missing support for the instruction renderer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370920 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Define GINodeEquiv for undef
Matt Arsenault [Wed, 4 Sep 2019 16:19:29 +0000 (16:19 +0000)]
GlobalISel: Define GINodeEquiv for undef

AMDGPU uses this for undef vector elements in some patterns which will
be enabled in a future patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370918 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Deal more explicit with non-exact definitions
Johannes Doerfert [Wed, 4 Sep 2019 16:16:13 +0000 (16:16 +0000)]
[Attributor] Deal more explicit with non-exact definitions

Summary:
Before we tried to rule out non-exact definitions early but that lead to
on-demand attributes created for them anyway. As a consequence we needed
to look at the definition in the initialize of each attribute again.
This patch centralized this lookup and tightens the condition under
which we give up on non-exact definitions.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370917 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add support for avx512bf16 for __builtin_cpu_supports and compiler-rt's cpu...
Craig Topper [Wed, 4 Sep 2019 16:01:43 +0000 (16:01 +0000)]
[X86] Add support for avx512bf16 for __builtin_cpu_supports and compiler-rt's cpu indicator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370915 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Ensure AAIsDead correctly overrides getIRPosition
Simon Pilgrim [Wed, 4 Sep 2019 16:01:09 +0000 (16:01 +0000)]
[Attributor] Ensure AAIsDead correctly overrides getIRPosition

As commented on D65712, the getIRPosition methods weren't correctly being overridden.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370914 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Hexagon] Improve generated code for test-if-bit-clear, one more time
Krzysztof Parzyszek [Wed, 4 Sep 2019 15:22:36 +0000 (15:22 +0000)]
[Hexagon] Improve generated code for test-if-bit-clear, one more time

Adjust isel patterns after recent commit. Fixes https://llvm.org/PR43194.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370913 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstSimplify] guard against unreachable code (PR43218)
Sanjay Patel [Wed, 4 Sep 2019 15:12:55 +0000 (15:12 +0000)]
[InstSimplify] guard against unreachable code (PR43218)

This would crash:
https://bugs.llvm.org/show_bug.cgi?id=43218

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370911 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Debuginfo][SROA] Need to handle dbg.value in SROA pass.
Alexey Lapshin [Wed, 4 Sep 2019 14:19:49 +0000 (14:19 +0000)]
[Debuginfo][SROA] Need to handle dbg.value in SROA pass.

SROA pass processes debug info incorrecly if applied twice.
Specifically, after SROA works first time, instcombine converts dbg.declare
intrinsics into dbg.value. Inlining creates new opportunities for SROA,
so it is called again. This time it does not handle correctly previously
inserted dbg.value intrinsics.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370906 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] add tests for insert/extract with identity shuffles; NFC
Sanjay Patel [Wed, 4 Sep 2019 13:38:49 +0000 (13:38 +0000)]
[InstCombine] add tests for insert/extract with identity shuffles; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370901 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ModuloSchedule] Fix no-asserts build
James Molloy [Wed, 4 Sep 2019 12:57:23 +0000 (12:57 +0000)]
[ModuloSchedule] Fix no-asserts build

Apologies, due to a git SNAFU this fix (dump doesn't exist and silence unused variables) stayed in my index rather than applying to rL370893.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370894 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ModuloSchedule] Introduce PeelingModuloScheduleExpander
James Molloy [Wed, 4 Sep 2019 12:54:24 +0000 (12:54 +0000)]
[ModuloSchedule] Introduce PeelingModuloScheduleExpander

This is the beginnings of a reimplementation of ModuloScheduleExpander. It works
by generating a single-block correct pipelined kernel and then peeling out the
prolog and epilogs.

This patch implements kernel generation as well as a validator that will
confirm the number of phis added is the same as the ModuloScheduleExpander.

Prolog and epilog peeling will come in a different patch.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370893 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix "enumeral and non-enumeral type in conditional expression" warnings. NFCI.
Simon Pilgrim [Wed, 4 Sep 2019 12:51:40 +0000 (12:51 +0000)]
Fix "enumeral and non-enumeral type in conditional expression" warnings. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370892 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Added a negative test for new fold
David Bolvansky [Wed, 4 Sep 2019 12:46:25 +0000 (12:46 +0000)]
[NFC] Added a negative test for new fold

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370890 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Fixed test
David Bolvansky [Wed, 4 Sep 2019 12:43:14 +0000 (12:43 +0000)]
[NFC] Fixed test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370888 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Adjust tests for new fold
David Bolvansky [Wed, 4 Sep 2019 12:22:28 +0000 (12:22 +0000)]
[NFC] Adjust tests for new fold

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370886 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Added tests for new fold
David Bolvansky [Wed, 4 Sep 2019 12:18:53 +0000 (12:18 +0000)]
[NFC] Added tests for new fold

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370885 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Fold sub (or A, B) (and A, B) to (xor A, B)
David Bolvansky [Wed, 4 Sep 2019 12:00:33 +0000 (12:00 +0000)]
[InstCombine] Fold sub (or A, B) (and A, B) to (xor A, B)

Summary:
```
Name: sub or and to xor
%or = or i32 %y, %x
%and = and i32 %x, %y
%sub = sub i32 %or, %and
  =>
%sub = xor i32 %x, %y

Optimization: sub or and to xor
Done: 1
Optimization is correct!
```
https://rise4fun.com/Alive/eJu

Reviewers: spatel, lebedev.ri

Reviewed By: lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370883 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix address sizes in the dwarfdump-debug-loc-error-cases test
Pavel Labath [Wed, 4 Sep 2019 11:47:20 +0000 (11:47 +0000)]
Fix address sizes in the dwarfdump-debug-loc-error-cases test

the test is building a 64-bit executable, so the addresses should be
64-bit too. The test was still passing even with smaller address size,
but it was hitting the "unexpected end of data" error sooner than it
should.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370882 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Added a new test for D67153
David Bolvansky [Wed, 4 Sep 2019 11:44:00 +0000 (11:44 +0000)]
[NFC] Added a new test for D67153

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370881 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Added tests for 'SUB of OR and AND to XOR' fold
David Bolvansky [Wed, 4 Sep 2019 11:17:08 +0000 (11:17 +0000)]
[NFC] Added tests for 'SUB of OR and AND to XOR' fold

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370878 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] LiveDebugValues: locations with different exprs should not be merged
Jeremy Morse [Wed, 4 Sep 2019 11:09:05 +0000 (11:09 +0000)]
[DebugInfo] LiveDebugValues: locations with different exprs should not be merged

When comparing variable locations, LiveDebugValues currently considers only
the machine location, ignoring any DIExpression applied to it. This is a
problem because that DIExpression can do pretty much anything to the machine
location, for example dereferencing it.

This patch adds DIExpressions to that comparison; now variables based on the
same register/memory-location but with different expressions will compare
differently, and be dropped if we attempt to merge them between blocks. This
reduces variable coverage-range a little, but only because we were producing
broken locations.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370877 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r370862
Nico Weber [Wed, 4 Sep 2019 11:08:09 +0000 (11:08 +0000)]
gn build: Merge r370862

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370876 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[Clang Interpreter] Initial patch for the constexpr interpreter"
Roman Lebedev [Wed, 4 Sep 2019 10:57:06 +0000 (10:57 +0000)]
Revert "[Clang Interpreter] Initial patch for the constexpr interpreter"

Breaks BUILD_SHARED_LIBS build, introduces cycles in library dependency
graphs. (clangInterp depends on clangAST which depends on clangInterp)

This reverts r370839, which is an yet another recommit of D64146.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370874 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cmake] Remove MSVC C4180 override
Simon Pilgrim [Wed, 4 Sep 2019 10:26:39 +0000 (10:26 +0000)]
[cmake] Remove MSVC C4180 override

Tested on VS2017 and VS2019 llvm/clang builds with WX enabled - its no longer necessary to disable this warning.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370871 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LiveDebugValues][NFC] Silence an unused variable warning
Jeremy Morse [Wed, 4 Sep 2019 10:18:03 +0000 (10:18 +0000)]
[LiveDebugValues][NFC] Silence an unused variable warning

On release builds, 'MI' isn't used by anything (it's already inserted into a
block by BuildMI), while on non-release builds it's used by a LLVM_DEBUG
statement. Mark as explicitly used to avoid the warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370870 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDWARF: Fix a regression in location list dumping
Pavel Labath [Wed, 4 Sep 2019 10:09:12 +0000 (10:09 +0000)]
DWARF: Fix a regression in location list dumping

Summary:
While fixing the handling of some error cases, r370363 introduced new
problems -- assertion failures due to unchecked errors (my excuse is that a very
early version of that patch used Optional<T> instead of Expected).

This patch adds proper handling of parsing errors encountered when
dumping location lists from inside DWARF DIEs, and adds a bunch of
additional tests.

I reorder the arguments of the location list dumping functions to make
them consistent, and also be able to dump the two kinds of location
lists generically.

Reviewers: JDevlieghere, dblaikie, probinson

Subscribers: aprantl, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370868 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cmake] Remove MSVC C4258 override
Simon Pilgrim [Wed, 4 Sep 2019 10:01:31 +0000 (10:01 +0000)]
[cmake] Remove MSVC C4258 override

Tested on VS2017 and VS2019 llvm/clang builds with WX enabled - its no longer necessary to disable this warning.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370866 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-dwarfdump] Fix spelling in the comments. NFC
Djordje Todorovic [Wed, 4 Sep 2019 09:44:09 +0000 (09:44 +0000)]
[llvm-dwarfdump] Fix spelling in the comments. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370861 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy] Add objcopy::elf::Object::allocSections to simplify loops on SHF_ALLOC...
Fangrui Song [Wed, 4 Sep 2019 09:35:32 +0000 (09:35 +0000)]
[llvm-objcopy] Add objcopy::elf::Object::allocSections to simplify loops on SHF_ALLOC sections

Reviewed By: jhenderson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370860 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[yaml2obj] Support PT_GNU_STACK and PT_GNU_RELRO
Fangrui Song [Wed, 4 Sep 2019 09:19:31 +0000 (09:19 +0000)]
[yaml2obj] Support PT_GNU_STACK and PT_GNU_RELRO

PT_GNU_STACK is used in an llvm-objcopy test.

I plan to use PT_GNU_RELRO in a patch to improve nested segment
processing in llvm-objcopy (PR42963).

Reviewed By: grimar

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370857 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy] Rename variable names "Section" to "Sec". NFC
Fangrui Song [Wed, 4 Sep 2019 08:43:27 +0000 (08:43 +0000)]
[llvm-objcopy] Rename variable names "Section" to "Sec". NFC

"Section" can refer to the type llvm::objcopy::elf::Section or the
variable name. Rename it to "Sec" for clarity. "Sec" is already used a
lot, so this change improves consistency as well.

Also change `auto` to `const SectionBase` for readability.

Reviewed By: grimar

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370852 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM][ParallelDSP] SExt mul for accumulation
Sam Parker [Wed, 4 Sep 2019 08:41:34 +0000 (08:41 +0000)]
[ARM][ParallelDSP] SExt mul for accumulation

For any unpaired muls, we accumulate them as an input to the
reduction. Check the type of the mul and perform a sext if the
existing accumlator input type is not the same.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370851 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[IRPrinting] Improve module pass printer to work better with -filter-print-funcs
Taewook Oh [Wed, 4 Sep 2019 08:08:58 +0000 (08:08 +0000)]
[IRPrinting] Improve module pass printer to work better with -filter-print-funcs

Summary: Previously module pass printer pass prints the banner even when the module doesn't include any function provided with `-filter-print-funcs` option. This introduced a lot of noise, especailly with ThinLTO. This diff addresses the issue and makes the banner printed only when the module includes functions in `-filter-print-funcs` list.

Reviewers: fedor.sergeev

Subscribers: mehdi_amini, hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370849 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel] Fix G_SEXT narrowScalar to bail out of unsupported type combination.
Amara Emerson [Wed, 4 Sep 2019 07:58:45 +0000 (07:58 +0000)]
[GlobalISel] Fix G_SEXT narrowScalar to bail out of unsupported type combination.

Similar to the issue with G_ZEXT that was fixed earlier, this is a quick
to fall back if the source type is not exactly half of the dest type.

Fixes the clang-cmake-aarch64-lld bot build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370847 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r370843
Nico Weber [Wed, 4 Sep 2019 07:40:03 +0000 (07:40 +0000)]
gn build: Merge r370843

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370844 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Wed, 4 Sep 2019 05:49:41 +0000 (05:49 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370839 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy] Fix some identifier names in comments. NFC
Fangrui Song [Wed, 4 Sep 2019 03:54:43 +0000 (03:54 +0000)]
[llvm-objcopy] Fix some identifier names in comments. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370838 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Enable tail call opt for variadic function
Jim Lin [Wed, 4 Sep 2019 02:03:36 +0000 (02:03 +0000)]
[RISCV] Enable tail call opt for variadic function

Summary: Tail call opt can treat variadic function call the same as normal function call

Reviewers: mgrang, asb, lenary, lewis-revill

Reviewed By: lenary

Subscribers: luismarques, pzheng, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, s.egerton, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370835 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MemorySSA] Move two verify calls under expensive checks.
Alina Sbirlea [Wed, 4 Sep 2019 00:44:54 +0000 (00:44 +0000)]
[MemorySSA] Move two verify calls under expensive checks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370831 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][llvm-ifs] Adding .ifs files to the test list for llvm-ifs tool.
Puyan Lotfi [Wed, 4 Sep 2019 00:07:49 +0000 (00:07 +0000)]
[NFC][llvm-ifs] Adding .ifs files to the test list for llvm-ifs tool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370830 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert [Windows] Disable TrapUnreachable for Win64, add SEH_NoReturn
Reid Kleckner [Tue, 3 Sep 2019 22:27:27 +0000 (22:27 +0000)]
Revert [Windows] Disable TrapUnreachable for Win64, add SEH_NoReturn

This reverts r370525 (git commit 0bb1630685fba255fa93def92603f064c2ffd203)
Also reverts r370543 (git commit 185ddc08eed6542781040b8499ef7ad15c8ae9f4)

The approach I took only works for functions marked `noreturn`. In
general, a call that is not known to be noreturn may be followed by
unreachable for other reasons. For example, there could be multiple call
sites to a function that throws sometimes, and at some call sites, it is
known to always throw, so it is followed by unreachable. We need to
insert an `int3` in these cases to pacify the Windows unwinder.

I think this probably deserves its own standalone, Win64-only fixup pass
that runs after block placement. Implementing that will take some time,
so let's revert to TrapUnreachable in the mean time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370829 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Compare functions by names in Emscripten Sjlj
Heejin Ahn [Tue, 3 Sep 2019 22:26:49 +0000 (22:26 +0000)]
[WebAssembly] Compare functions by names in Emscripten Sjlj

Summary:
This removes all string constants for function names and compares
functions by string directly when needed. Many of these constants are
used only once or twice so the benefit of defining them separately is
not very clear, and this actually fixes a bug.

When we already have a `malloc` declaration which is an alias to
something else within the module,
```
@malloc = weak hidden alias i8* (i32), i8* (i32)* @dlmalloc
```
(this happens compiling with emscripten with `-s WASM_OBJECT_FILES=0`
because all bc files are merged before being fed into `wasm-ld` which
runs the backend optimizations as LTO)

`Module::getFunction("malloc")` in `canLongjmp` returns `nullptr`
because `Module::getFunction` dyncasts pointer into `Function`, but the
alias is a `GlobalValue` but not a `Function`. This makes `canLongjmp`
return false for `malloc` in this case, and we end up adding a lot of
longjmp handling code around malloc. This is not only a code size
increase but actually a bug because `malloc` is used in the entry block
when preparing for setjmp tables for emscripten sjlj handling, and this
makes initial setjmp preparation, which has to happen in the entry
block, move to another split block, and this interferes with SSA update
later.

This also adds two more functions, `getTempRet0` and `setTempRet0`, in
the list of not longjmp-able functions.

Fixes https://github.com/emscripten-core/emscripten/issues/8935.

Reviewers: sbc100

Subscribers: mehdi_amini, jgravelle-google, hiraditya, sunfish, dexonsmith, dschuff, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370828 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-profdata] Add mode to recover from profile read failures
Vedant Kumar [Tue, 3 Sep 2019 22:23:16 +0000 (22:23 +0000)]
[llvm-profdata] Add mode to recover from profile read failures

Add a mode in which profile read errors are not immediately treated as
fatal. In this mode, merging makes forward progress and reports failure
only if no inputs can be read.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370827 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstrProf] Tighten a check for malformed data records in raw profiles
Vedant Kumar [Tue, 3 Sep 2019 22:23:14 +0000 (22:23 +0000)]
[InstrProf] Tighten a check for malformed data records in raw profiles

The check needs to validate a counter offset before performing pointer
arithmetic with the (potentially corrupt) offset.

Found by UBSan's pointer overflow check.

rdar://54843625

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370826 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GVN] Remove a todo introduced w/rL370791
Philip Reames [Tue, 3 Sep 2019 21:56:17 +0000 (21:56 +0000)]
[GVN] Remove a todo introduced w/rL370791

When I dug into this, it turns out to be *much* more involved than I'd realized and doesn't actually simplify anything.

The general purpose of the leader table is that we want to find the most-dominating definition quickly.  The problem for equivalance folding is slightly different; we want to find the most dominating *value* whose definition block dominates our use quickly.

To make this change, we'd end up having to restructure the leader table (either the sorting thereof, or maybe even introducing multiple leader tables per value) and that complexity is just not worth it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370824 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Legalize 128 bit divisions to libcalls.
Amara Emerson [Tue, 3 Sep 2019 21:42:32 +0000 (21:42 +0000)]
[AArch64][GlobalISel] Legalize 128 bit divisions to libcalls.

Now that we have the infrastructure to support s128 types as parameters
we can expand these to libcalls.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370823 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel][CallLowering] Add support for splitting types according to calling conve...
Amara Emerson [Tue, 3 Sep 2019 21:42:28 +0000 (21:42 +0000)]
[GlobalISel][CallLowering] Add support for splitting types according to calling conventions.

On AArch64, s128 types have to be split into s64 GPRs when passed as arguments.
This change adds the generic support in call lowering for dealing with multiple
registers, for incoming and outgoing args.

Support for splitting for return types not yet implemented.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370822 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MemorySSA] Disable MemorySSA use.
Alina Sbirlea [Tue, 3 Sep 2019 21:20:46 +0000 (21:20 +0000)]
[MemorySSA] Disable MemorySSA use.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370821 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Use the delete API for liveness
Johannes Doerfert [Tue, 3 Sep 2019 20:42:16 +0000 (20:42 +0000)]
[Attributor] Use the delete API for liveness

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370818 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Deduce "no-capture" argument attribute
Johannes Doerfert [Tue, 3 Sep 2019 20:37:24 +0000 (20:37 +0000)]
[Attributor] Deduce "no-capture" argument attribute

Add the no-capture argument attribute deduction to the Attributor
fixpoint framework.

The new string attributed "no-capture-maybe-returned" is introduced to
allow deduction of no-capture through functions that "capture" an
argument but only by "returning" it. It is only used by the Attributor
for testing.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370817 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen] Use FSHR in DAGTypeLegalizer::ExpandIntRes_MULFIX
Bjorn Pettersson [Tue, 3 Sep 2019 19:35:07 +0000 (19:35 +0000)]
[CodeGen] Use FSHR in DAGTypeLegalizer::ExpandIntRes_MULFIX

Summary:
Simplify the right shift of the intermediate result (given
in four parts) by using funnel shift.

There are some impact on lit tests, but that seems to be
related to register allocation differences due to how FSHR
is expanded on X86 (giving a slightly different operand order
for the OR operations compared to the old code).

Reviewers: leonardchan, RKSimon, spatel, lebedev.ri

Reviewed By: RKSimon

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

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370813 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSkip MCJIT unit tests if LLVM is not configured for native compilation
David Blaikie [Tue, 3 Sep 2019 19:30:45 +0000 (19:30 +0000)]
Skip MCJIT unit tests if LLVM is not configured for native compilation

Patch by Sergej Jaskiewicz!

Differential Revision: D67089

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370812 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MemorySSA] Re-enable MemorySSA use.
Alina Sbirlea [Tue, 3 Sep 2019 19:28:37 +0000 (19:28 +0000)]
[MemorySSA] Re-enable MemorySSA use.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370811 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MC] Pass through .code16/32/64 and .syntax unified for COFF
Reid Kleckner [Tue, 3 Sep 2019 18:16:52 +0000 (18:16 +0000)]
[MC] Pass through .code16/32/64 and .syntax unified for COFF

These flags should simply be passed through to the target, which will do
the right thing. Add an MC/X86 test that uses these directives with the
three primary object file formats and shows that they disassemble the
same everywhere.

There is a missing test for .code32 on Windows ARM, since I'm not sure
exactly how to construct one.

Fixes PR43203

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370805 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GVN] Propagate simple equalities from assumes within the tail of the block
Philip Reames [Tue, 3 Sep 2019 17:31:19 +0000 (17:31 +0000)]
[GVN] Propagate simple equalities from assumes within the tail of the block

This extends the existing logic for propagating constant expressions in an analogous manner for what we do across basic blocks. The core point is that we chose some order of operands, and canonicalize uses towards that one.

The heuristic used is inspired by the one used across blocks; in a follow up change, I'd plan to common them so that the cross block version uses the slightly stronger ordering herein.

As noted by the TODOs in the code, there's a good amount of room for improving the existing code and making it more powerful.  Some follow up work planned.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370791 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Don't import i64imm_32bit pattern at -O0
Jessica Paquette [Tue, 3 Sep 2019 17:21:12 +0000 (17:21 +0000)]
[AArch64][GlobalISel] Don't import i64imm_32bit pattern at -O0

This pattern, when imported at -O0 adds an extra copy via the SUBREG_TO_REG.

This is because the SUBREG_TO_REG is not eliminated. At all other opt levels,
it is eliminated.

This is a 1% geomean code size savings at -O0 on CTMark.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370789 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r370454 "[LoopIdiomRecognize] BCmp loop idiom recognition"
Roman Lebedev [Tue, 3 Sep 2019 17:14:56 +0000 (17:14 +0000)]
Revert r370454 "[LoopIdiomRecognize] BCmp loop idiom recognition"

https://bugs.llvm.org/show_bug.cgi?id=43206 was filed,
claiming that there is a miscompilation.
Reverting until i investigate.

This reverts commit r370454

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370788 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tests/GVN] Precommit requested test additions from D66977
Philip Reames [Tue, 3 Sep 2019 17:02:55 +0000 (17:02 +0000)]
[Tests/GVN] Precommit requested test additions from D66977

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370784 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cmake] Improve comment describing the C4245 warning. NFCI.
Simon Pilgrim [Tue, 3 Sep 2019 16:11:37 +0000 (16:11 +0000)]
[cmake] Improve comment describing the C4245 warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370772 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SVE][Inline-Asm] Fix -Wimplicit-fallthrough in AArch64ISelLowering.cpp
Kerry McLaughlin [Tue, 3 Sep 2019 15:45:42 +0000 (15:45 +0000)]
[SVE][Inline-Asm] Fix -Wimplicit-fallthrough in AArch64ISelLowering.cpp

Summary: Adds break to 'x' case in getRegForInlineAsmConstraint added by D66302, fixing the unintentional fallthrough.

Reviewers: sdesmalen, rovka, cameron.mcinally, greened, gribozavr, ruiu

Reviewed By: sdesmalen

Subscribers: bjope, javed.absar, tschuett, kristof.beyls, rkruppe, psnobl, llvm-commits, cfe-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370769 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Merge 2 consecutive HasInt256 branches. NFCI.
Simon Pilgrim [Tue, 3 Sep 2019 14:39:06 +0000 (14:39 +0000)]
[X86] Merge 2 consecutive HasInt256 branches. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370761 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SystemZ] Recognize INLINEASM_BR in backend.
Jonas Paulsson [Tue, 3 Sep 2019 13:31:22 +0000 (13:31 +0000)]
[SystemZ]  Recognize INLINEASM_BR in backend.

SystemZInstrInfo::analyzeBranch() needs to check for INLINEASM_BR
instructions, or it will crash.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370753 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: (manually) merge r370499
Nico Weber [Tue, 3 Sep 2019 13:17:16 +0000 (13:17 +0000)]
gn build: (manually) merge r370499

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370752 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r370746
Nico Weber [Tue, 3 Sep 2019 13:01:17 +0000 (13:01 +0000)]
gn build: Merge r370746

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370749 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Ignore Implicit CPSR regs when lowering from Machine to MC operands
David Green [Tue, 3 Sep 2019 11:30:54 +0000 (11:30 +0000)]
[ARM] Ignore Implicit CPSR regs when lowering from Machine to MC operands

The code here seems to date back to r134705, when tablegen lowering was first
being added. I don't believe that we need to include CPSR implicit operands on
the MCInst. This now works more like other backends (like AArch64), where all
implicit registers are skipped.

This allows the AliasInst for CSEL's to match correctly, as can be seen in the
test changes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370745 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SystemZ] Add support for fentry.
Jonas Paulsson [Tue, 3 Sep 2019 11:21:12 +0000 (11:21 +0000)]
[SystemZ]  Add support for fentry.

SystemZAsmPrinter now properly emits function calls to __fentry__.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370743 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Invert CSEL predicates if the opposite is a simpler constant to materialise
David Green [Tue, 3 Sep 2019 11:06:24 +0000 (11:06 +0000)]
[ARM] Invert CSEL predicates if the opposite is a simpler constant to materialise

This moves ConstantMaterializationCost into ARMBaseInstrInfo so that it can
also be used in ISel Lowering, adding codesize values to the computed costs, to
be able to compare either approximate instruction counts or codesize costs.

It also adds a HasLowerConstantMaterializationCost, which compares the
ConstantMaterializationCost of two values, returning true if the first is
smaller either in instruction count/codesize, or falling back to the other in
the case that they are equal.

This is used in constant CSEL lowering to invert the predicate if the opposite
is easier to materialise.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370741 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Generate 8.1-m CSINC, CSNEG and CSINV instructions.
David Green [Tue, 3 Sep 2019 10:53:07 +0000 (10:53 +0000)]
[ARM] Generate 8.1-m CSINC, CSNEG and CSINV instructions.

Arm 8.1-M adds a number of related CSEL instructions, including CSINC, CSNEG and CSINV. These choose between two values given the content in CPSR and a condition, performing an increment, negation or inverse of the false value.

This adds some selection for them, either from constant values or patterns. It does not include CSEL directly, which is currently not always making code better. It is still useful, but we will have to check more carefully where it should and shouldn't be used.

Code by Ranjeet Singh and Simon Tatham, with some modifications from me.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370739 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Add csel tests. NFC
David Green [Tue, 3 Sep 2019 10:32:46 +0000 (10:32 +0000)]
[ARM] Add csel tests. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370738 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[mips] Switch to the `.text` section after emitting asm file preamble
Simon Atanasyan [Tue, 3 Sep 2019 10:24:07 +0000 (10:24 +0000)]
[mips] Switch to the `.text` section after emitting asm file preamble

Now the last `.section` directive in the MIPS asm file preamble
is the `.section .mdebug.abi`. If assembler code injected for example
by the LLVM `module asm` or the C ` __asm` directives do not contain
explicit switching to the `.text` section it goes to the `.mdebug.abi`
section. It might be unexpected to the user and in fact for example
breaks building some existing code like FreeBSD libc [1].

The patch forces switching to the `.text` section after emitting MIPS
assembler file preamble.

[1] https://bugs.llvm.org/show_bug.cgi?id=43119

Fix PR43119.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370735 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Fix MVE ldst offset ranges
David Green [Tue, 3 Sep 2019 09:57:02 +0000 (09:57 +0000)]
[ARM] Fix MVE ldst offset ranges

We were using isShiftedInt<7, Shift>(RHSC) to detect the ranges of offsets to
fold into MVE loads/stores. The instructions actually take a 7 bit unsigned
integer which is either added or subtracted. So something more like
isShiftedUInt<7, Shift>(abs(RHSC)).

Instead I've changes this to use the isScaledConstantInRange method, same as in
SelectT2AddrModeImm7Offset used by pre/post inc, which seemed to already be
getting this correct.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370731 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM][MVE] Decoding of VMSR doesn't diagnose some unpredictable encodings
Oliver Stannard [Tue, 3 Sep 2019 09:55:30 +0000 (09:55 +0000)]
[ARM][MVE] Decoding of VMSR doesn't diagnose some unpredictable encodings

Decoding of VMSR doesn't diagnose some unpredictable encodings, as the unpredictable bits are not correctly set.

Diff-reduce this instruction's internals WRT VMRS so I can see the differences better. Mostly this is s/src/Rt/g.

Fill in the "should-be-(0)" bits.

Designate the Unpredictable{} bits for both VMRS and VMSR.

Patch by Mark Murray!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370729 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoBug fix on function epilog optimization (ARM backend)
Oliver Stannard [Tue, 3 Sep 2019 09:51:19 +0000 (09:51 +0000)]
Bug fix on function epilog optimization (ARM backend)

To save a 'add sp,#val' instruction by adding registers to the final pop instruction,
the first register transferred by this pop instruction need to be found.
If the function to be optimized has a non-void return value, the operand list contains
r0 (implicit) which prevents the optimization to take place.
Therefore implicit register references should be skipped in the search loop,
because this registers are never popped from the stack.

Patch by Rainer Herbertz (rOptimizer)!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370728 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] More MVE load/store tests for offsets around the negative limit. NFC
David Green [Tue, 3 Sep 2019 09:42:16 +0000 (09:42 +0000)]
[ARM] More MVE load/store tests for offsets around the negative limit. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370726 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LV] Fix miscompiles by adding non-header PHI nodes to AllowedExit
Bjorn Pettersson [Tue, 3 Sep 2019 09:33:55 +0000 (09:33 +0000)]
[LV] Fix miscompiles by adding non-header PHI nodes to AllowedExit

Summary:
Fold-tail currently supports reduction last-vector-value live-out's,
but has yet to support last-scalar-value live-outs, including
non-header phi's. As it relies on AllowedExit in order to detect
them and bail out we need to add the non-header PHI nodes to
AllowedExit, otherwise we end up with miscompiles.

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

Reviewers: fhahn, Ayal

Reviewed By: fhahn, Ayal

Subscribers: anna, hiraditya, rkruppe, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370721 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LV] Precommit test case showing miscompile from PR43166. NFC
Bjorn Pettersson [Tue, 3 Sep 2019 09:33:40 +0000 (09:33 +0000)]
[LV] Precommit test case showing miscompile from PR43166. NFC

Summary:  Precommit test case showing miscompile from PR43166.

Reviewers: fhahn, Ayal

Reviewed By: fhahn

Subscribers: rkruppe, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370720 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LV] Tail-folding, runtime scev checks
Sjoerd Meijer [Tue, 3 Sep 2019 08:53:02 +0000 (08:53 +0000)]
[LV] Tail-folding, runtime scev checks

Now that we allow tail-folding, not only when we optimise for size, make
sure we do not run in this assert.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370711 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LV] Tail-folding with runtime memory checks
Sjoerd Meijer [Tue, 3 Sep 2019 08:38:24 +0000 (08:38 +0000)]
[LV] Tail-folding with runtime memory checks

The loop vectorizer was running in an assert when it tried to fold the tail and
had to emit runtime memory disambiguation checks.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370707 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MachinePipeliner] Add a way to unit-test the schedule emitter
James Molloy [Tue, 3 Sep 2019 08:20:31 +0000 (08:20 +0000)]
[MachinePipeliner] Add a way to unit-test the schedule emitter

Emitting a schedule is really hard. There are lots of corner cases to take care of; in fact, of the 60+ SWP-specific testcases in the Hexagon backend most of those are testing codegen rather than the schedule creation itself.

One issue is that to test an emission corner case we must craft an input such that the generated schedule uses that corner case; sometimes this is very hard and convolutes testcases. Other times it is impossible but we want to test it anyway.

This patch adds a simple test pass that will consume a module containing a loop and generate pipelined code from it. We use post-instr-symbols as a way to annotate instructions with the stage and cycle that we want to schedule them at.

We also provide a flag that causes the MachinePipeliner to generate these annotations instead of actually emitting code; this allows us to generate an input testcase with:

  llc < %s -stop-after=pipeliner -pipeliner-annotate-for-testing -o test.mir

And run the emission in isolation with:

  llc < test.mir -run-pass=modulo-schedule-test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370705 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Select vmla
Sam Tebbs [Tue, 3 Sep 2019 08:17:46 +0000 (08:17 +0000)]
[ARM] Select vmla

This patch adds vmla selection.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370704 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Simplify the setOperationAction handling for fp_to_uint by improving the Custom...
Craig Topper [Tue, 3 Sep 2019 05:57:22 +0000 (05:57 +0000)]
[X86] Simplify the setOperationAction handling for fp_to_uint by improving the Custom handler a bit.

This merges the 32-bit and 64-bit mode code to just use Custom
for both i32 and i64. We already had most of the handling in
the custom handling due to the AVX512 having legal fp_to_uint.
Just needed to add the i32->i64 promotion handling. Refactor
the fp_to_uint code in the custom handler to simplify the
number of times we check things.

Tweak cost model tables to match the default handling we were
getting due to Expand before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370700 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Don't use Expand for i32 fp_to_uint on SSE1/2 targets on 32-bit target.
Craig Topper [Tue, 3 Sep 2019 05:57:18 +0000 (05:57 +0000)]
[X86] Don't use Expand for i32 fp_to_uint on SSE1/2 targets on 32-bit target.

Use Custom lowering instead. Fall back to default expansion only
when the scalar FP type belongs in an XMM register. This improves
lowering for i32 to fp80, and also i32 to double on SSE1 only.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370699 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add an exhaustive test for i32 fptosi/fptoui across different triples and features.
Craig Topper [Tue, 3 Sep 2019 05:57:14 +0000 (05:57 +0000)]
[X86] Add an exhaustive test for i32 fptosi/fptoui across different triples and features.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370698 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LegalizeDAG] Pass DAG to two calls to SDNode::dump in debug prints so that they...
Craig Topper [Tue, 3 Sep 2019 02:51:14 +0000 (02:51 +0000)]
[LegalizeDAG] Pass DAG to two calls to SDNode::dump in debug prints so that they will print target specific nodes correctly.

The dump methods can only print target node names correctly if
they can get access to the TLI object.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370694 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Custom promote i32->f80 uint_to_fp on AVX512 64-bit targets.
Craig Topper [Tue, 3 Sep 2019 02:51:10 +0000 (02:51 +0000)]
[X86] Custom promote i32->f80 uint_to_fp on AVX512 64-bit targets.

Reuse the same code to promote all i32 uint_to_fp on 64-bit targets
to simplify the X86ISelLowering constructor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370693 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CostModel][X86] Add scalar sext/zext cost tests
Simon Pilgrim [Mon, 2 Sep 2019 21:02:51 +0000 (21:02 +0000)]
[CostModel][X86] Add scalar sext/zext cost tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370684 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Enable fp128 as a legal type with SSE1 rather than with MMX.
Craig Topper [Mon, 2 Sep 2019 20:16:30 +0000 (20:16 +0000)]
[X86] Enable fp128 as a legal type with SSE1 rather than with MMX.

FP128 values are passed in xmm registers so should be asssociated
with an SSE feature rather than MMX which uses a different set
of registers.

llc enables sse1 and sse2 by default with x86_64. But does not
enable mmx. Clang enables all 3 features by default.

I've tried to add command lines to test with -sse
where possible, but any test that returns a value in an xmm
register fails with a fatal error with -sse since we have no
defined ABI for that scenario.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370682 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] MVE predicate bitcast test and VPSEL adjustment. NFC
David Green [Mon, 2 Sep 2019 19:03:35 +0000 (19:03 +0000)]
[ARM] MVE predicate bitcast test and VPSEL adjustment. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370678 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Use MQPR not QPR for MVE registers
David Green [Mon, 2 Sep 2019 17:18:23 +0000 (17:18 +0000)]
[ARM] Use MQPR not QPR for MVE registers

We should be using MQPR, and if we don't we can get COPYs and PHIs created for
QPR. These get folded into instructions, failing verification checks.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370676 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TargetLowering][PS4] Add sincos(f) lib functions when target is PS4
Robert Lougher [Mon, 2 Sep 2019 16:53:32 +0000 (16:53 +0000)]
[TargetLowering][PS4] Add sincos(f) lib functions when target is PS4

PS4 supports sincosf and sincos. Adding the library functions enables
the sin(f)+cos(f) -> sincos(f) optimization.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370675 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SystemZ] Support constrained fpto[su]i intrinsics
Ulrich Weigand [Mon, 2 Sep 2019 16:49:29 +0000 (16:49 +0000)]
[SystemZ] Support constrained fpto[su]i intrinsics

Now that constrained fpto[su]i intrinsic are available,
add codegen support to the SystemZ backend.

In addition to pure back-end changes, I've also needed
to add the strict_fp_to_[su]int and any_fp_to_[su]int
pattern fragments in the obvious way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370674 91177308-0d34-0410-b5e6-96231b3b80d8