Commit Graph

109173 Commits

Author SHA1 Message Date
Sanjay Patel
ccf3928623 [InstCombine] canonicalize shifty abs(): ashr+add+xor --> cmp+neg+sel
We want to do this for 2 reasons:
1. Value tracking does not recognize the ashr variant, so it would fail to match for cases like D39766.
2. DAGCombiner does better at producing optimal codegen when we have the cmp+sel pattern.

More detail about what happens in the backend:
1. DAGCombiner has a generic transform for all targets to convert the scalar cmp+sel variant of abs 
   into the shift variant. That is the opposite of this IR canonicalization.
2. DAGCombiner has a generic transform for all targets to convert the vector cmp+sel variant of abs 
   into either an ABS node or the shift variant. That is again the opposite of this IR canonicalization.
3. DAGCombiner has a generic transform for all targets to convert the exact shift variants produced by #1 or #2
   into an ISD::ABS node. Note: It would be an efficiency improvement if we had #1 go directly to an ABS node 
   when that's legal/custom.
4. The pattern matching above is incomplete, so it is possible to escape the intended/optimal codegen in a 
   variety of ways.
   a. For #2, the vector path is missing the case for setlt with a '1' constant.
   b. For #3, we are missing a match for commuted versions of the shift variants.
5. Therefore, this IR canonicalization can only help get us to the optimal codegen. The version of cmp+sel 
   produced by this patch will be recognized in the DAG and converted to an ABS node when possible or the 
   shift sequence when not.
6. In the following examples with this patch applied, we may get conditional moves rather than the shift 
   produced by the generic DAGCombiner transforms. The conditional move is created using a target-specific 
   decision for any given target. Whether it is optimal or not for a particular subtarget may be up for debate.

define i32 @abs_shifty(i32 %x) {
  %signbit = ashr i32 %x, 31 
  %add = add i32 %signbit, %x  
  %abs = xor i32 %signbit, %add 
  ret i32 %abs
}

define i32 @abs_cmpsubsel(i32 %x) {
  %cmp = icmp slt i32 %x, zeroinitializer
  %sub = sub i32 zeroinitializer, %x
  %abs = select i1 %cmp, i32 %sub, i32 %x
  ret i32 %abs
}

define <4 x i32> @abs_shifty_vec(<4 x i32> %x) {
  %signbit = ashr <4 x i32> %x, <i32 31, i32 31, i32 31, i32 31> 
  %add = add <4 x i32> %signbit, %x  
  %abs = xor <4 x i32> %signbit, %add 
  ret <4 x i32> %abs
}

define <4 x i32> @abs_cmpsubsel_vec(<4 x i32> %x) {
  %cmp = icmp slt <4 x i32> %x, zeroinitializer
  %sub = sub <4 x i32> zeroinitializer, %x
  %abs = select <4 x i1> %cmp, <4 x i32> %sub, <4 x i32> %x
  ret <4 x i32> %abs
}

> $ ./opt -instcombine shiftyabs.ll -S | ./llc -o - -mtriple=x86_64 -mattr=avx 
> abs_shifty:
> 	movl	%edi, %eax
> 	negl	%eax
> 	cmovll	%edi, %eax
> 	retq
> 
> abs_cmpsubsel:
> 	movl	%edi, %eax
> 	negl	%eax
> 	cmovll	%edi, %eax
> 	retq
> 
> abs_shifty_vec:
> 	vpabsd	%xmm0, %xmm0
> 	retq
> 
> abs_cmpsubsel_vec:
> 	vpabsd	%xmm0, %xmm0
> 	retq
> 
> $ ./opt -instcombine shiftyabs.ll -S | ./llc -o - -mtriple=aarch64
> abs_shifty:
> 	cmp	w0, #0                  // =0
> 	cneg	w0, w0, mi
> 	ret
> 
> abs_cmpsubsel: 
> 	cmp	w0, #0                  // =0
> 	cneg	w0, w0, mi
> 	ret
>                                        
> abs_shifty_vec: 
> 	abs	v0.4s, v0.4s
> 	ret
> 
> abs_cmpsubsel_vec: 
> 	abs	v0.4s, v0.4s
> 	ret
> 
> $ ./opt -instcombine shiftyabs.ll -S | ./llc -o - -mtriple=powerpc64le 
> abs_shifty:  
> 	srawi 4, 3, 31
> 	add 3, 3, 4
> 	xor 3, 3, 4
> 	blr
> 
> abs_cmpsubsel:
> 	srawi 4, 3, 31
> 	add 3, 3, 4
> 	xor 3, 3, 4
> 	blr
> 
> abs_shifty_vec:   
> 	vspltisw 3, -16
> 	vspltisw 4, 15
> 	vsubuwm 3, 4, 3
> 	vsraw 3, 2, 3
> 	vadduwm 2, 2, 3
> 	xxlxor 34, 34, 35
> 	blr
> 
> abs_cmpsubsel_vec: 
> 	vspltisw 3, -16
> 	vspltisw 4, 15
> 	vsubuwm 3, 4, 3
> 	vsraw 3, 2, 3
> 	vadduwm 2, 2, 3
> 	xxlxor 34, 34, 35
> 	blr
>

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





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320921 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 16:41:17 +00:00
Craig Topper
53c6a87b9f [X86] Remove unneeded code for handling the old kunpck intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320917 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 06:58:30 +00:00
Hal Finkel
3f92210a79 [LV] Extend InstWidening with CM_Widen_Recursive
Changes to the original scalar loop during LV code gen cause the return value
of Legal->isConsecutivePtr() to be inconsistent with the return value during
legal/cost phases (further analysis and information of the bug is in D39346).
This patch is an alternative fix to PR34965 following the CM_Widen approach
proposed by Ayal and Gil in D39346. It extends InstWidening enum with
CM_Widen_Reverse to properly record the widening decision for consecutive
reverse memory accesses and, consequently, get rid of the
Legal->isConsetuviePtr() call in LV code gen. I think this is a simpler/cleaner
solution to PR34965 than the one in D39346.

Fixes PR34965.

Patch by Diego Caballero, thanks!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320913 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 02:55:24 +00:00
Hal Finkel
4f44d46023 [PowerPC, AsmParser] Enable the mnemonic spell corrector
r307148 added an assembly mnemonic spelling correction support and enabled it
on ARM. This enables that support on PowerPC as well.

Patch by Dmitry Venikov, thanks!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320911 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 02:42:18 +00:00
Craig Topper
196a560857 [X86] Add 128 and 256-bit VPOPCNTDQ instructions. Adjust some tablegen classes LZCNT/POPCNT.
I think when this instruction was first published it was only for a Knights CPU and thus VLX version was missing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320910 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 02:40:28 +00:00
Vitaly Buka
ef76fcda6e [LTO] Make processing of combined module more consistent
Summary:
1. Use stream 0 only for combined module. Previously if combined module was not
processes ThinLTO used the stream for own output. However small changes in input,
could trigger combined module  and shuffle outputs making life of llvm::LTO harder.

2. Always process combined module and write output to stream 0. Processing empty
combined module is cheap and allows llvm::LTO users to avoid implementing processing
which is already done in llvm::LTO.

Subscribers: mehdi_amini, inglorion, eraman, hiraditya

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320905 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 02:10:00 +00:00
Hal Finkel
1d4f2b0d25 [SimplifyLibCalls] Inline calls to cabs when it's safe to do so
When unsafe algerbra is allowed calls to cabs(r) can be replaced by:

  sqrt(creal(r)*creal(r) + cimag(r)*cimag(r))

Patch by Paul Walker, thanks!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320901 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 01:26:25 +00:00
Hal Finkel
625a9ef4f3 [LV] NFC patch for moving VP*Recipe class definitions from LoopVectorize.cpp to VPlan.h
This is a small step forward to move VPlan stuff to where it should belong (i.e., VPlan.*):

  1. VP*Recipe classes in LoopVectorize.cpp are moved to VPlan.h.
  2. Many of VP*Recipe::print() and execute() definitions are still left in
     LoopVectorize.cpp since they refer to things declared in LoopVectorize.cpp. To
     be moved to VPlan.cpp at a later time.
  3. InterleaveGroup class is moved from anonymous namespace to llvm namespace.
     Referencing it in anonymous namespace from VPlan.h ended up in warning.

Patch by Hideki Saito, thanks!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320900 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 01:12:50 +00:00
Craig Topper
fbba83deb2 [X86] Add back the assert from r320830 that was reverted in r320850
Hopefully r320864 has fixed the offending case that failed the assert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320898 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 00:33:16 +00:00
Teresa Johnson
a48c4cca96 Fix NDEBUG build problem in r320895
Fix incorrect placement of #endif causing NDEBUG build failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320897 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 00:29:31 +00:00
Teresa Johnson
2140d926da [ThinLTO] Enable importing of aliases as copy of aliasee
Summary:
This implements a missing feature to allow importing of aliases, which
was previously disabled because alias cannot be available_externally.
We instead import an alias as a copy of its aliasee.

Some additional work was required in the IndexBitcodeWriter for the
distributed build case, to ensure that the aliasee has a value id
in the distributed index file (i.e. even when it is not being
imported directly).

This is a performance win in codes that have many aliases, e.g. C++
applications that have many constructor and destructor aliases.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320895 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 00:18:12 +00:00
David Blaikie
2d82935d1a Fix WebAssembly backend for some LLVM API changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320893 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 23:52:06 +00:00
Paul Robinson
87764e1e35 Revert "Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header.""
This reverts commit 0afef672f63f0e4e91938656bc73424a8c058bfc.
Still failing at runtime on bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320888 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 23:21:52 +00:00
Paul Robinson
bee91d7634 Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header."
Adds missing support for DW_FORM_data16.

Update of r320852, fixing the unittest to use a hand-coded struct
instead of std::array to guarantee data layout.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320886 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 22:57:17 +00:00
Matthias Braun
3587705651 Fix unused variable in non-assert builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320885 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 22:53:33 +00:00
Matthias Braun
d318139827 MachineFunction: Return reference from getFunction(); NFC
The Function can never be nullptr so we can return a reference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320884 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 22:22:58 +00:00
Matthias Braun
dfcb4f5344 MachineFunction: Slight refactoring; NFC
Slight cleanup/refactor in preparation for upcoming commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320882 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 22:22:46 +00:00
Galina Kistanova
4e7906d9cd Fixed the gcc 'enumeral and non-enumeral type in conditional expression [-Werror=extra]' warning introduced by r320750
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320868 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 22:15:29 +00:00
Krzysztof Parzyszek
4d6de6f6af [Hexagon] Remove recursion in visitUsesOf, replace with use queue
This is primarily to reduce stack usage, but ordering the use queue
according to the position in the code (earlier instructions visited
before later ones) reduces the number of unnecessary bottoms due to
visiting instructions out of order, e.g.
  %reg1 = copy %reg0
  %reg2 = copy %reg0
  %reg3 = and %reg1, %reg2
Here, reg3 should be known to be same as reg0-2, but if reg3 is
evaluated after reg1 is updated, but before reg2 is updated, the two
inputs to the and will appear different, causing reg3 to become
bottom.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320866 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 21:34:05 +00:00
Krzysztof Parzyszek
a211d55b2f [Hexagon] Handle concat_vectors of all allowed HVX types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320865 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 21:23:12 +00:00
Craig Topper
2dccaf4e16 [X86] Use AND32ri8 instead of AND64ri8 in Asan code in EmitCallAsanReport for 32-bit mode.
This seemed to work due to a quirk in the X86 MC encoder that didn't emit a REX byte that the AND64ri8 implies when in 32-bit mode. This made the encoding the same as AND32ri8. I tried to add an assert to catch the dropped REX prefix that caught this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 21:18:06 +00:00
Craig Topper
4c29a62efa [X86] In LowerVectorCTPOP use ISD::ZERO_EXTEND/ISD::TRUNCATE instead of the target specific nodes.
The target independent nodes will get legalized to the target specific nodes by their own legalization process. Someday I'd like to stop using a target specific for zero extends and truncates of legal types so the less places we reference the target specific opcode the better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320863 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 21:18:05 +00:00
Craig Topper
6be8b9966d [X86] Remove unnecessary TODO.
When I wrote it I thought we were missing a potential optimization for KNL. But investigating further shows that for KNL we still do the optimal thing by widening to v4f32 and then using special isel patterns to widen again to zmm a register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320862 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 20:57:18 +00:00
Jun Bum Lim
d154dd9bb4 Re-commit : [LICM] Allow sinking when foldable in loop
This recommits r320823 reverted due to the test failure in sink-foldable.ll and
an unused variable. Added "REQUIRES: aarch64-registered-target" in the test
and removed unused variable.

Original commit message:

  Continue trying to sink an instruction if its users in the loop is foldable.
  This will allow the instruction to be folded in the loop by decoupling it from
  the user outside of the loop.

  Reviewers: hfinkel, majnemer, davidxl, efriedma, danielcdh, bmakam, mcrosier

  Reviewed By: hfinkel

  Subscribers: javed.absar, bmakam, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320858 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 20:33:24 +00:00
Paul Robinson
86e9c5d8a8 Revert "[DWARFv5] Dump an MD5 checksum in the line-table header."
Unit test fails on some bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320857 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 20:29:25 +00:00
Krzysztof Parzyszek
f1c8b170f5 [Hexagon] Fix operand-swapping PatFrag for atomic stores
PatFrag now has the atomicity information stored as bit fields. They
need to be copied to the new PatFrag.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320855 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 20:13:57 +00:00
Paul Robinson
17486de5d0 [DWARFv5] Dump an MD5 checksum in the line-table header.
Adds missing support for DW_FORM_data16.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320852 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 19:52:34 +00:00
Craig Topper
185a067ae8 [X86] Remove assert in X86MCCodeEmitter.cpp that was added in r320830.
It seems to be failing real code which is concerning, but we were silently getting away with it. I'll investigate further.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320850 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 19:38:14 +00:00
Craig Topper
af4be705fd [SelectionDAG][X86] Fix insert_vector_elt lowering for v32i1/v64i1 with non-constant index
Summary:
Currently we don't handle v32i1/v64i1 insert_vector_elt correctly as we fail to look at the number of elements closely and assume it can only be v16i1 or v8i1.

We also can't type legalize v64i1 insert_vector_elt correctly on KNL due to the type not being byte addressable as required by the legalizing through memory accesses path requires.

For the first issue, the patch now tries to pick a 512-bit register with the correct number of elements and promotes to that.

For the second issue, we now extend the vector to a byte addressable type, do the stores to memory, load the two halves, and then truncate the halves back to the original type. Technically since we changed the type, we may not need two loads, but actually checking that is more work and for the v64i1 case we do need them.

Reviewers: RKSimon, delena, spatel, zvi

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320849 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 19:35:22 +00:00
Sean Fertile
7edcd376d3 [Memcpy Loop Lowering] Insert loop BB inbetween the split BB.
The original memcpy expansion inserted the loop basic block inbetween
the 2 new basic blocks created by splitting the original block the memcpy
call was in. This commit makes the new memcpy expansion do the same to keep the
layout of the IR matching between the old and new implementations.

Differential Review: https://reviews.llvm.org/D41197

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320848 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 19:29:12 +00:00
Craig Topper
5386758b51 [X86] Add 'Requires<[In64BitMode]>' to a bunch of instructions that only have memory and immediate operands.
The asm parser wasn't preventing these from being accepted in 32-bit mode. Instructions that use a GR64 register are protected by the parser rejecting the register in 32-bit mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320846 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 19:01:51 +00:00
Craig Topper
11e27ba376 [X86] Change BNDLDX to use anymem instead of i64mem for itsmemory operand.
This instruction doesn't access memory. It juse use a similar looking memory encoding. Don't require Intel syntax to put "qword ptr" in front of it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320845 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 19:01:50 +00:00
Craig Topper
f5e35f2da4 [X86] Remove the 'Requires' In64BitMode/Not64BitMode from the LWP instructions.
These aren't doing anything due to a top level "let Predicates =". I think the GR32/GR64 register class protects these anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320844 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 19:01:49 +00:00
Craig Topper
65b5d17d62 [X86] Remove the 'Requires<[In64BitMode]>' from SHSTK instructions.
This has no effect due to a top level "let Predicates =" around the instructions. But its also not required because the GR64 usage in the instruction guarantees it can never match.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320843 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 19:01:48 +00:00
Sanjay Patel
050e890bd4 [TargetLibraryInfo] fix documentation comment; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320842 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 18:54:29 +00:00
Sanjay Patel
05d2a170dd [CodeGen] fix documentation comments; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320840 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 18:34:45 +00:00
Evandro Menezes
9e11f1e423 [AArch64] Fix typo in the ASIMD instruction optimization pass
Fix typo in the representative instruction replacement.

Also, fix formatting and reword some comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320839 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 18:26:54 +00:00
Sanjay Patel
e58640ab75 fix typo in comment and remove inaccurate comment; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320838 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 18:25:13 +00:00
Andrew V. Tischenko
b0364a570b Fix for bug PR35549 - Repeated schedule comments.
Differential Revision: https://reviews.llvm.org/D40960


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320837 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 18:13:05 +00:00
Jun Bum Lim
4b01fd29c0 Revert "Re-commit : [LICM] Allow sinking when foldable in loop"
This reverts commit r320833.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320836 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 18:12:49 +00:00
Jun Bum Lim
33f616e3dc Re-commit : [LICM] Allow sinking when foldable in loop
This recommit r320823 after fixing a test failure.

 Original commit message:

    Continue trying to sink an instruction if its users in the loop is foldable.
    This will allow the instruction to be folded in the loop by decoupling it from
    the user outside of the loop.

    Reviewers: hfinkel, majnemer, davidxl, efriedma, danielcdh, bmakam, mcrosier

    Reviewed By: hfinkel

    Subscribers: javed.absar, bmakam, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320833 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 17:58:59 +00:00
Michael Trent
6469bc65e3 Updated llvm-objdump to display local relocations in Mach-O binaries
Summary:
llvm-objdump's Mach-O parser was updated in r306037 to display external
relocations for MH_KEXT_BUNDLE file types. This change extends the Macho-O
parser to display local relocations for MH_PRELOAD files. When used with
the -macho option relocations will be displayed in a historical format.

All tests are passing for llvm, clang, and lld. llvm-objdump builds without
compiler warnings.

rdar://35778019

Reviewers: enderby

Reviewed By: enderby

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320832 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 17:57:40 +00:00
Craig Topper
2a6a25b91b [X86] Fix XSAVE64 and similar instructions to not be allowed by the assembler in 32-bit mode.
There was a top level "let Predicates =" in the .td file that was overriding the Requires on each instruction.

I've added an assert to the code emitter to catch more cases like this. I'm sure this isn't the only place where the right predicates aren't being applied. This assert already found that we don't block btq/btsq/btrq in 32-bit mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320830 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 17:22:58 +00:00
Jun Bum Lim
5ffe36ba3c Revert "[LICM] Allow sinking when foldable in loop"
This reverts commit r320823.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320828 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 16:35:09 +00:00
Francis Visoiu Mistrih
38e881da88 [CodeGen] Print stack object references as %(fixed-)stack.0 in both MIR and debug output
Work towards the unification of MIR and debug output by printing
`%stack.0` instead of `<fi#0>`, and `%fixed-stack.0` instead of
`<fi#-4>` (supposing there are 4 fixed stack objects).

Only debug syntax is affected.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320827 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 16:33:45 +00:00
Eugene Leviant
bab7762fc5 [ThinLTO] Disallow multiple prevailing defs
https://reviews.llvm.org/D41291


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320825 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 16:27:33 +00:00
Craig Topper
021be3a67e [X86] Widen (v2i32 (fp_to_uint v2f64)) to (v8i32 (fp_to_uint v8f64)) during legalization if we have AVX512F, but not VLX. NFC
Previously we widened it using isel patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320824 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 16:22:20 +00:00
Jun Bum Lim
20ea5a5161 [LICM] Allow sinking when foldable in loop
Summary:
Continue trying to sink an instruction if its users in the loop is foldable.
This will allow the instruction to be folded in the loop by decoupling it from
the user outside of the loop.

Reviewers: hfinkel, majnemer, davidxl, efriedma, danielcdh, bmakam, mcrosier

Reviewed By: hfinkel

Subscribers: javed.absar, bmakam, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320823 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 16:09:54 +00:00
Francis Visoiu Mistrih
278b31c092 [MIR] Add support for missing CFI directives
The following CFI directives are suported by MC but not by MIR:

* .cfi_rel_offset
* .cfi_adjust_cfa_offset
* .cfi_escape
* .cfi_remember_state
* .cfi_restore_state
* .cfi_undefined
* .cfi_register
* .cfi_window_save

Add support for printing, parsing and update tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320819 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 15:17:18 +00:00
Haicheng Wu
147a40056a [InlineCost] Find repeated loads in the callee
SROA analysis of InlineCost can figure out that some stores can be removed
after inlining and then the repeated loads clobbered by these stores are also
free.  This patch finds these clobbered loads and adjust the inline cost
accordingly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320814 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 14:34:41 +00:00
Nemanja Ivanovic
e41a428109 Fix the second build bot break introduced by r320791.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320811 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 14:17:45 +00:00
Nemanja Ivanovic
e2ef9203a9 Fix code causing fallthrough warnings in the PPC back end.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320806 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 11:47:48 +00:00
Alex Bradbury
d25fc4439d [RISCV] Change shift amount operand of RVC shift instructions to uimmlog2xlennonzero
c.slli/c.srli/c.srai allow a 5-bit shift in RV32C and a 6-bit shift in RV64C.
This patch adds uimmlog2xlennonzero to reflect this constraint as well as
tests.

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

Patch by Shiva Chen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320799 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 10:20:51 +00:00
Nemanja Ivanovic
aa177330df Fix the build bot break introduced by r320791.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320798 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 09:51:34 +00:00
Alex Bradbury
ff43d39338 [RISCV] Enable emission of alias instructions by default
This patch switches the default for -riscv-no-aliases to false
and updates all affected MC and CodeGen tests. As recommended in
D41071, MC tests use the canonical instructions and the CodeGen
tests use the aliases.

Additionally, for the f and d instructions with rounding mode,
the tests for the aliased versions are moved and tightened such
that they can actually detect if alias emission is enabled.
(see D40902 for context)

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

Patch by Mario Werner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320797 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 09:47:01 +00:00
Fedor Sergeev
f1b0fdfb70 [PM] port Rewrite Statepoints For GC to the new pass manager.
Summary:
The port is nearly straightforward.
The only complication is related to the analyses handling,
since one of the analyses used in this module pass is domtree,
which is a function analysis. That requires asking for the results
of each function and disallows a single interface for run-on-module
pass action.

Decided to copy-paste the main body of this pass.
Most of its code is requesting analyses anyway, so not that much
of a copy-paste.

The rest of the code movement is to transform all the implementation
helper functions like stripNonValidData into non-member statics.

Extended all the related LLVM tests with new-pass-manager use.
No failures.

Reviewers: sanjoy, anna, reames

Reviewed By: anna

Subscribers: skatkov, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320796 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 09:32:11 +00:00
Eugene Leviant
72044ef693 [LLVMgold] Don't set undefined symbol as prevailing
Differential revision: https://reviews.llvm.org/D41113


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320794 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 09:18:21 +00:00
Nemanja Ivanovic
01cfc43fe4 [PowerPC] Convert r+r instructions to r+i (pre and post RA)
This patch adds the necessary infrastructure to convert instructions that
take two register operands to those that take a register and immediate if
the necessary operand is produced by a load-immediate. Furthermore, it uses
this infrastructure to perform such conversions twice - first at MachineSSA
and then pre-emit.

There are a number of reasons we may end up with opportunities for this
transformation, including but not limited to:
- X-Form instructions chosen since the exact offset isn't available at ISEL time
- Atomic instructions with constant operands (we will add patterns for this
  in the future)
- Tail duplication may duplicate code where one block contains this redundancy
- When emitting compare-free code in PPCDAGToDAGISel, we don't handle constant
  comparands specially

Furthermore, this patch moves the initialization of PPCMIPeepholePass so that
it can be used for MIR tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320791 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 07:27:53 +00:00
Craig Topper
d077c9767c [X86] Fix a couple bugs in my recent changes to vXi1 insert_subvector lowering.
A couple places didn't use the same SDValue variables to connect everything all the way through.

I don't have a test case for a bug in insert into the lower bits of a non-zero, non-undef vector. Not sure the best way to create that. We don't create the case when lowering concat_vectors which is the main way to get insert_subvectors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320790 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 07:16:41 +00:00
Serguei Katkov
a9252d8515 [SCEV] Fix the movement of insertion point in expander. PR35406.
We cannot move the insertion point to header if SCEV contains div/rem
operations due to they may go over check for zero denominator.

Reviewers: sanjoy, mkazantsev, sebpop
Reviewed By: sebpop
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41229


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320789 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 05:24:42 +00:00
Yaxun Liu
06d39e2dc8 Recommit CodeGen: Fix assertion in machine inst sheduler due to llvm.dbg.value
The regression on ppc64 was not due to this commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320788 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 03:56:57 +00:00
Nemanja Ivanovic
20e1861f08 Disabling r312514 as it causes miscompiles that show up on bootstrap
The compare elimination peephole introduced in https://reviews.llvm.org/rL312514
causes a miscompile in AMDGPUInstrInfo.cpp which in turn causes some AMDGPU
test case failures in stage2 bootstrap testing. This miscompile didn't cause any
test case failures until https://reviews.llvm.org/rL320614, so it appeared as if
that patch caused these failures.
Disabling this transformation for now to bring the build bots back to green and
the author of the patch will investigate the miscompile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320786 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 01:38:03 +00:00
Craig Topper
2955f15b7f [X86] Add a TODO about v8i1 CONCAT_VECTORS.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320784 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 01:03:46 +00:00
Craig Topper
9affb7358f [SelectionDAG] Make getNode calls that take an ArrayRef of SDValue for operands call NewSDValueDbgMsg.
This makes it work better with some build_vector and concat_vectors creations.

Adjust the NewSDValueDbgMsg in getConstant to avoid duplicating the print when it calls getSplatBuildVector since getSplatBuildVector didn't trigger a print before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320783 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 01:03:45 +00:00
Craig Topper
31be897d38 [X86] Further rearrange the setOperationAction calls to separate the ones that require 512-bit registers OR VLX into separate sections. NFCI
We have several instructions that were introduced in AVX512F that are only available in 512-bit form on KNL. We still make use of them for 128/256 by artificially widening and extracting during isel.

This commit separates these operations from the true 512-bit operations. This way we can qualify the normal 512-bit operations with needing 512-bit register support. And these special operations will get qualified with needing 512-bit registers OR VLX.

The 512-bit register qualification will be introduced in a future patch this just gets everything grouped to minimize deltas on that patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320782 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 01:03:43 +00:00
Craig Topper
411b939c3c [X86] Group setOperationActions related to vXi1 masks together. NFCI
Previously they were sort of interleaved in with XMM/YMM/ZMM action related code.

Trying to separate things so its easier to split 512-bit vectors later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320781 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 01:03:42 +00:00
Craig Topper
8ffae718f0 [X86] Make ISD::INSERT_SUBVECTOR v8i1 legal with AVX512F because we should be custom lowering inserting v1i1 into v8i1 under this.
I don't have a test case at the moment. Just noticed while auditing things.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320780 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 01:03:40 +00:00
Craig Topper
9a06d0d624 [X86] Move some of the hasVLX qualified code out of the main hasAVX512 block in the X86ISelLowering constructor. NFCI
Move it into the separate hasVLX block later in the constructor.

I'm trying to separate 128/256 and 512-bit related code so we can eventually qualify the hasAVX512 block with support for 512-bit vectors required by the prefer-vector-width feature support being talked about in D41096.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320779 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 01:03:38 +00:00
Saleem Abdulrasool
055a3e3225 FastISel: support no-PLT PIC calls on ELF x86_64
Add support for properly handling PIC code with no-PLT.  This equates to
`-fpic -fno-plt -O0` with the clang frontend.  External functions are
marked with nonlazybind, which must then be indirected through the GOT.
This allows code to be built without optimizations in PIC mode without
going through the PLT.  Addresses PR35653!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320776 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 00:32:09 +00:00
Sam Clegg
5334180cf2 [WebAssembly] Implement @llvm.global_ctors and @llvm.global_dtors
Summary:
- lowers @llvm.global_dtors by adding @llvm.global_ctors
  functions which register the destructors with `__cxa_atexit`.
- impements @llvm.global_ctors with wasm start functions and linker metadata

See [here](https://github.com/WebAssembly/tool-conventions/issues/25) for more background.

Subscribers: jfb, dschuff, mgorny, jgravelle-google, aheejin, sunfish

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320774 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 00:17:10 +00:00
David Blaikie
0584169775 Remove a non-modular header (& inline it into its one use)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320768 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 23:45:58 +00:00
Evandro Menezes
e615040107 [AArch64] Test patch
Fix formatting by adding a missing blank line to test new network setup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320760 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 23:06:18 +00:00
Adrian Prantl
4fddb015f4 EmitFuncArgumentDbgValue: Prefer stack slots over registers for stack arguments
While investigating LLVM PR22316 (http://llvm.org/bugs/show_bug.cgi?id=22316)
I started wondering if it were not always preferable to emit the
initial DBG_VALUEs for stack arguments as FI locations instead of
describing the first register they get copied into. The advantage of
doing this is that the arguments will be available as soon as the
stack is setup. As illustrated by the testcase in the PR, the first
copy of the FI into a register may be sunk by MachineSink.cpp into a
later basic block. By describing the argument on the stack, we nicely
circumvent this problem.

<rdar://problem/19583723>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320758 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 22:55:06 +00:00
Craig Topper
696d9a21a9 [X86] Remove an unnecessary SmallVector that was collecting chains for two SDNode's we're still holding SDValues for. NFCI
We can just get the chains from those SDValues to create the TokenFactor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320757 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 22:50:10 +00:00
Matt Arsenault
45d0bf280d TLI: Allow using PSV for intrinsic mem operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320756 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 22:34:10 +00:00
Zachary Turner
ece9b23b54 Fix many -Wsign-compare and -Wtautological-constant-compare warnings.
Most of the -Wsign-compare warnings are due to the fact that
enums are signed by default in the MS ABI, while the
tautological comparison warnings trigger on x86 builds where
sizeof(size_t) is 4 bytes, so N > numeric_limits<unsigned>::max()
is always false.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320750 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 22:07:03 +00:00
Sanjay Patel
7034870f30 [SimplifyCFG] don't sink common insts too soon (PR34603)
This should solve:
https://bugs.llvm.org/show_bug.cgi?id=34603
...by preventing SimplifyCFG from altering redundant instructions before early-cse has a chance to run.
It changes the default (canonical-forming) behavior of SimplifyCFG, so we're only doing the
sinking transform later in the optimization pipeline.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320749 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 22:05:20 +00:00
Matt Arsenault
a40d3af28e DAG: Expose all MMO flags in getTgtMemIntrinsic
Rather than adding more bits to express every
MMO flag you could want, just directly use the
MMO flags. Also fixes using a bunch of bool arguments to
getMemIntrinsicNode.

On AMDGPU, buffer and image intrinsics should always
have MODereferencable set, but currently there is no
way to do that directly during the initial intrinsic
lowering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320746 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 21:39:51 +00:00
Krzysztof Parzyszek
a9bb60c600 [Hexagon] Generate HVX code for comparisons and selects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320744 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 21:28:48 +00:00
Sam Clegg
e1acb56f11 [WebAssembly] Add support for init functions linking metadata
Summary:
This change lays the groundwork lowering of @llvm.global_ctors
and @llvm.global_dtors for the wasm object format.  Some parts
of this patch are subset of: https://reviews.llvm.org/D40759

See https://github.com/WebAssembly/tool-conventions/issues/25

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320742 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 21:10:03 +00:00
Guozhi Wei
44388667e9 [SLPVectorizer] Don't ignore scalar extraction instructions of aggregate value
In SLPVectorizer, the vector build instructions (insertvalue for aggregate type) is passed to BoUpSLP.buildTree, it is treated as UserIgnoreList, so later in cost estimation, the cost of these instructions are not counted. 
For aggregate value, later usage are more likely to be done in scalar registers, either used as individual scalars or used as a whole for function call or return value. Ignore scalar extraction instructions may cause too aggressive vectorization for aggregate values, and slow down performance. So for vectorization of aggregate value, the scalar extraction instructions are required in cost estimation.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320736 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 19:35:43 +00:00
Krzysztof Parzyszek
a3a5536590 Add MVT::v128i1, NFC
Hexagon HVX has type v128i8, comparing two vectors of that type will
produce v128i1 types in SelectionDAG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320732 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 19:05:21 +00:00
Paul Robinson
1efcc42007 [MC] Allow .file directives to be out-of-order
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320727 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 18:46:43 +00:00
Craig Topper
f74c3ebbfb [X86] Don't zero the upper bits of the k-register before extracting a single bit from a vXi1.
This doesn't match the semantics of the extract_vector_elt operation. Nothing downstream knows the bits were zeroed so they still get masked or sign extended after the extrat anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320723 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 18:35:25 +00:00
Krzysztof Parzyszek
7c66ebefee [Hexagon] Remove vectors of i64 from valid HVX types
HVX does not support operations on 64-bit integers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320722 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 18:35:24 +00:00
Zachary Turner
6b1df4d6a7 [COFF] Teach LLD to use the COFF .debug$H section.
This adds the /DEBUG:GHASH option to LLD which will look for
the existence of .debug$H sections in linker inputs and use them
to accelerate type merging.  The clang-cl side has already been
added, so this completes the work necessary to begin experimenting
with this feature.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320719 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 18:07:04 +00:00
Geoff Berry
c04e9d0dbf [ARM] Fix isRenamable flag setting on expanded VSTMDIA opcode.
Fixes expensive-check ARM buildbot failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320718 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 18:06:25 +00:00
Yaxun Liu
92d81a8d46 Revert CodeGen: Fix assertion in machine inst sheduler due to llvm.dbg.value
This commit might have caused regression on ppc64. Revert it to verify that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320712 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 16:12:04 +00:00
Sander de Smalen
9a94efd832 Re-commit: [TableGen] AsmMatcher: Fix bug with reported diagnostic for operand.
Summary:
The generated diagnostic by the AsmMatcher isn't always applicable to the AsmOperand.

This is because the code will only update the diagnostic if it is more 
specific than the previous diagnostic. However, when having validated
operands and 'moved on' to a next operand (for some instruction/alias for
which all previous operands are valid), if the diagnostic is InvalidOperand,
than that should be set as the diagnostic, not the more specific message
about a previous operand for some other instruction/alias candidate.

(Re-committed with an extra whitespace in SVEInstrFormats.td to trigger rebuild 
of AArch64GenAsmMatcher.inc, since the llvm-clang-x86_64-expensive-checks-win
builder does not seem to rebuild AArch64GenAsmMatcher.inc with the
newly built TableGen due to a missing dependency somewhere (see:
http://lists.llvm.org/pipermail/llvm-dev/2017-December/119555.html))

Reviewers: craig.topper, olista01, rengolin, stoklund

Reviewed By: olista01

Subscribers: javed.absar, llvm-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320711 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 16:09:48 +00:00
Simon Dardis
6ca3095cfb [mips] Add partial support for R6 in the long branch pass
MIPSR6 introduced several new jump instructions and deprecated
the use of the 'j' instruction. For microMIPS32R6, 'j' was removed
entirely and it only has non delay slot jumps.

This patch adds support for MIPSR6 by using some R6 instructions--
'bc' instead of 'j', 'jic $reg, 0' instead of 'jalr $zero, $reg'--
and modifies the sequences not to use delay slots for R6.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: dschuff, arichardson, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320703 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 14:55:25 +00:00
Bjorn Pettersson
e7acf09de4 [ScalarEvolution] Fix base condition in isNormalAddRecPHI.
Summary:
The function is meant to recurse until it comes upon the
phi it's looking for. However, with the current condition,
it will recurse until it finds anything _but_ the phi.

The function will even fail for simple cases like:
  %i = phi i32 [ %inc, %loop ], ...
  ...
  %inc = add i32 %i, 1

because the base condition will not happen when the phi
is recursed to, and the recursion will end with a 'false'
result since the previous instruction is a phi.

Reviewers: sanjoy, atrick

Reviewed By: sanjoy

Subscribers: Ka-Ka, bjope, llvm-commits

Committing on behalf of: Bevin Hansson (bevinh)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320700 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 14:47:52 +00:00
Haicheng Wu
ed49714687 [InlineCost] Tracking Values through PHI Nodes
This patch fix this FIXME in visitPHI()

FIXME: We should potentially be tracking values through phi nodes,
especially when they collapse to a single value due to deleted CFG edges
during inlining.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320699 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 14:36:18 +00:00
Benjamin Kramer
f30ce39f3a Revert "[DAGCombine] Move AND nodes to multiple load leaves"
This reverts commit r320679. Causes miscompiles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320698 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 14:03:07 +00:00
Andrew V. Tischenko
e3c92f3b0d Any Target Asm comments should start from MachineInstr::TAsmComments value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320693 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 12:07:11 +00:00
Michael Zuckerman
74c2e95576 [AVX512] Adding support for load truncate store of I1
store operation on a truncated memory (load) of vXi1 is poorly supported by LLVM and most of the time end with an assertion.
This patch fixes this issue.

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

Change-Id: Ida5523dd09c1ad384acc0a27e9e59273d28cbdc9

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320691 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 11:55:50 +00:00
Fedor Sergeev
bfac46c5f4 [PM][InstCombine] fixing omission of AliasAnalysis in new-pass-manager's version of InstCombine
Summary:
Passing AliasAnalysis results instead of nullptr appears to work just fine.
A couple new-pass-manager tests updated to align with new order of analyses.

Reviewers: chandlerc, spatel, craig.topper

Reviewed By: chandlerc

Subscribers: mehdi_amini, eraman, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320687 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 10:36:31 +00:00
Fedor Sergeev
45b92d7fda Remove redundant includes from lib/Target/AArch64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320686 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 10:36:20 +00:00
Francis Visoiu Mistrih
ee30ab7184 [CodeGen] Print MCSymbol operands as <mcsymbol sym> in both MIR and debug output
Work towards the unification of MIR and debug output by printing
`<mcsymbol sym>` instead of `<MCSym=sym>`.

Only debug syntax is affected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320685 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 10:03:23 +00:00
Francis Visoiu Mistrih
f726becf7c [CodeGen] Move printing MO_Metadata operands to MachineOperand::print
Work towards the unification of MIR and debug output by refactoring the
interfaces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320684 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 10:03:18 +00:00
Francis Visoiu Mistrih
f6cd582907 [CodeGen] Print live-out register lists as liveout(...) in both MIR and debug output
Work towards the unification of MIR and debug output by printing
`liveout(...)` instead of `<regliveout>`.

Only debug syntax is affected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320683 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 10:03:14 +00:00