Commit Graph

544 Commits

Author SHA1 Message Date
David Green
45a375eb6b Revert rL357745: [SelectionDAG] Compute known bits of CopyFromReg
Certain optimisations from ConstantHoisting and CGP rely on Selection DAG not
seeing through to the constant in other blocks. Revert this patch while we come
up with a better way to handle that.

I will try to follow this up with some better tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358113 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-10 18:00:41 +00:00
Craig Topper
b77427871e [DAGCombiner][X86][SystemZ] Canonicalize SSUBO with immediate RHS to SADDO by negating the immediate.
This lines up with what we do for regular subtract and it matches up better with X86 assumptions in isel patterns that add with immediate is more canonical than sub with immediate.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358027 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-09 18:33:56 +00:00
Piotr Sobczak
959b42493f [SelectionDAG] Compute known bits of CopyFromReg
Summary:
Teach SelectionDAG how to compute known bits of ISD::CopyFromReg if
the virtual reg used has one def only.

This can be particularly useful when calling isBaseWithConstantOffset()
with the ISD::CopyFromReg argument, as more optimizations may get enabled
in the result.

Also add a missing truncation on X86, found by testing of this patch.

Change-Id: Id1c9fceec862d118c54a5b53adf72ada5d6daefa

Reviewers: bogner, craig.topper, RKSimon

Reviewed By: RKSimon

Subscribers: lebedev.ri, nemanjai, jvesely, nhaehnle, javed.absar, jsji, jdoerfert, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357745 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-05 07:44:09 +00:00
Jonas Paulsson
8d88d919bb [SystemZ] Bugfix in isFusableLoadOpStorePattern()
This function is responsible for checking the legality of fusing an instance
of load -> op -> store into a single operation. In the SystemZ backend the
check was incomplete and a test case emerged with a cycle in the instruction
selection DAG as a result.

Instead of using the NodeIds to determine node relationships,
hasPredecessorHelper() now is used just like in the X86 backend. This handled
the failing tests and as well gave a few additional transformations on
benchmarks.

The SystemZ isFusableLoadOpStorePattern() is now a very near copy of the X86
function, and it seems this could be made a utility function in common code
instead.

Review: Ulrich Weigand
https://reviews.llvm.org/D60255

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357688 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-04 12:12:35 +00:00
Ulrich Weigand
909ca0c8af [SystemZ] Improve codegen for certain SADDO-immediate cases
When performing an add-with-overflow with an immediate in the
range -2G ... -4G, code currently loads the immediate into a
register, which generally takes two instructions.

In this particular case, it is preferable to load the negated
immediate into a register instead, which always only requires
one instruction, and then perform a subtract.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357597 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-03 15:09:19 +00:00
Jonas Paulsson
1d777c335f [SystemZ] Improve instruction selection of 64 bit shifts and rotates.
For shift and rotate instructions that only use the last 6 bits of the shift
amount, a shift amount of (x*64-s) can be substituted with (-s). This saves
one instruction and a register:

  lhi     %r1, 64
  sr      %r1, %r3
  sllg    %r2, %r2, 0(%r1)
  =>
  lcr     %r1, %r3
  sllg    %r2, %r2, 0(%r1)

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357481 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-02 15:36:30 +00:00
Simon Pilgrim
7598a01597 [SystemZ] Remove fcmp undef from reduced test
Pre-commit for D60006 (Add fcmp UNDEF handling to SelectionDAG::FoldSetCC)

Approved by @uweigand (Ulrich Weigand)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357355 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-30 20:24:26 +00:00
Simon Pilgrim
93cb35b417 [SystemZ] Regenerate double constant comparison test
Prep work for PR40800 (Add UNDEF handling to SelectionDAG::FoldSetCC) 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357295 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-29 18:23:08 +00:00
Jonas Paulsson
6ae1aaade9 [DAGCombiner] Don't allow addcarry if the carry producer is illegal.
getAsCarry() checks that the input argument is a carry-producing node before
allowing a transformation to addcarry. This patch adds a check to make sure
that the carry-producing node is legal. If it is not, it may not remain in a
form that is manageable by the target backend. The test case caused a
compilation failure during instruction selection for this reason on SystemZ.

Patch by Ulrich Weigand.

Review: Sanjay Patel
https://reviews.llvm.org/D59822

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357052 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-27 08:41:46 +00:00
Quentin Colombet
7fce37e34d [LiveRange] Reset the VNIs when splitting subranges
When splitting a subrange we end up with two different subranges covering
two different, non overlapping, lanes.
As part of this splitting the VNIs of the original live-range need
to be dispatched to the subranges according to which lanes they are
actually defining.

Prior to this patch we were assuming that all values were defining
all lanes. This was wrong as demonstrated by llvm.org/PR40835.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357032 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-26 21:27:15 +00:00
Matt Arsenault
51c2ad77cd RegAllocFast: Remove early selection loop, the spill calculation will report cost 0 anyway for free regs
The 2nd loop calculates spill costs but reports free registers as cost
0 anyway, so there is little benefit from having a separate early
loop.

Surprisingly this is not NFC, as many register are marked regDisabled
so the first loop often picks up later registers unnecessarily instead
of the first one available in the allocation order...

Patch by Matthias Braun

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356499 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 19:01:34 +00:00
Simon Pilgrim
7389752eef [SystemZ] Remove icmp undef from reduced tests
Pre-commit for D59363 (Add icmp UNDEF handling to SelectionDAG::FoldSetCC)

Approved by @uweigand (Ulrich Weigand)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356368 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-18 13:55:28 +00:00
Simon Pilgrim
b85628fbc5 [SystemZ] Remove icmp undef
Prep-work for PR40800 (Add UNDEF handling to SelectionDAG::FoldSetCC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356138 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 11:56:41 +00:00
Simon Pilgrim
c69e0f0517 [SystemZ] Regenerate tests to make complete codegen more obvious
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356137 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 11:54:46 +00:00
Craig Topper
b6ab93e6a5 [DAGCombiner][X86][SystemZ][AArch64] Combine some cases of (bitcast (build_vector constants)) between legalize types and legalize dag.
This patch enables combining integer bitcasts of integer build vectors when the new scalar type is legal. I've avoided floating point because the implementation bitcasts float to int along the way and we would need to check the intermediate types for legality

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355324 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-04 19:12:16 +00:00
Jonas Paulsson
96e27952a5 [SystemZ] Pass regalloc hints to help Load-and-Test transformations.
Since there is no "Load-and-Test-High" instruction, the 32 bit load of a
register to be compared with 0 can only be implemented with LT if the virtual
GRX32 register ends up in a low part (GR32 register).

This patch detects these cases and passes the GR32 registers (low parts) as
(soft) hints in getRegAllocationHints().

Review: Ulrich Weigand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354935 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 00:18:28 +00:00
Jonas Paulsson
78b72added [SystemZ] Wait with selection of legal vector/FP constants until Select().
This patch aims to make sure that any such constant that can be generated
with a vector instruction (for example VGBM) is recognized as such during
legalization and kept as a target independent node through post-legalize
DAGCombining.

Two new functions named isVectorConstantLegal() and loadVectorConstant()
replace old ways of handling vector/FP constants.

A new struct named SystemZVectorConstantInfo is used to cache the results of
isVectorConstantLegal() and pass them onto loadVectorConstant().

Support for fp128 constants in the presence of FeatureVectorEnhancements1
(z14) has been added.

Review: Ulrich Weigand
https://reviews.llvm.org/D58270

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354896 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 16:47:59 +00:00
Jonas Paulsson
9129f92efa Recommit "[SystemZ] Do not emit VEXTEND or VROUND nodes without vector support."
It seems there were some problem with using a .mir test. For some reason
doing '-stop-before=codegenprepare' and then '-start-before=codegenprepare'
on the output .mir file results in the NoVRegs Property after instruction
selection.

Recommitting the same test as an .ll file instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354160 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-15 19:13:55 +00:00
Francis Visoiu Mistrih
5716349e30 Revert "[SystemZ] Do not emit VEXTEND or VROUND nodes without vector support."
This reverts commit aa0b77d3395dc6ab91647138139c1a15a3aa088d.

This fails to pass the machine verifier:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/13579/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354096 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-15 03:01:09 +00:00
Jonas Paulsson
05fc6965d5 [SystemZ] Do not emit VEXTEND or VROUND nodes without vector support.
Review: Ulrich Weigand
https://reviews.llvm.org/D58240

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354039 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 17:58:48 +00:00
Jonas Paulsson
3044368de2 [SystemZ] Use VGM whenever possible to load FP immediates.
isFPImmLegal() has been extended to recognize certain FP immediates that can
be built with VGM (Vector Generate Mask).

These scalar FP immediates (that were previously loaded from the constant
pool) are now selected as VGMF/VGMG in Select().

Review: Ulrich Weigand
https://reviews.llvm.org/D58003

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353867 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-12 18:06:06 +00:00
Jonas Paulsson
0e5a502581 [SystemZ] Improved handling of the @llvm.ctlz intrinsic.
Since SystemZ supports counting of leading zeros with the FLOGR instruction,
isCheapToSpeculateCtlz() should return true, which it now does.

ISD::CTLZ_ZERO_UNDEF i32 is now handled the same way as ISD::CTLZ is, which
is needed since promotion to i64 is required and CTLZ_ZERO_UNDEF is only
expanded to CTLZ if it is Legal or Custom.

Review: Ulrich Weigand
https://reviews.llvm.org/D57710

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353330 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06 19:23:31 +00:00
Jonas Paulsson
954d6be705 [SystemZ] Wait with VGBM selection until after DAGCombine2.
Don't lower BUILD_VECTORs to BYTE_MASK, but instead expose the BUILD_VECTORs
to the DAGCombiner and select them to VGBM in Select(). This allows the
DAGCombiner to understand the constant vector values.

For floating point, only all-zeros vectors are now generated with VGBM, as it
turned out to be somewhat complicated to handle any arbitrary constants,
while in practice this is very rare and hardly needed.

The SystemZ ISD opcodes z_byte_mask, z_vzero and z_vones have been removed.

Review: Ulrich Weigand
https://reviews.llvm.org/D57152

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353325 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06 18:59:19 +00:00
Ulrich Weigand
44f220f910 [SystemZ] Do not return INT_MIN from strcmp/memcmp
The IPM sequence currently generated to compute the strcmp/memcmp
result will return INT_MIN for the "less than zero" case.  While
this is in compliance with the standard, strictly speaking, it
turns out that common applications cannot handle this, e.g. because
they negate a comparison result in order to implement reverse
compares.

This patch changes code to use a different sequence that will result
in -2 for the "less than zero" case (same as GCC).  However, this
requires that the two source operands of the compare instructions
are inverted, which breaks the optimization in removeIPMBasedCompare.
Therefore, I've removed this (and all of optimizeCompareInstr), and
replaced it with a mostly equivalent optimization in combineCCMask
at the DAGcombine level.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353304 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-06 15:10:13 +00:00
Jonas Paulsson
1bf1b6f36e [CodeGenPrepare] Handle all debug calls in dupRetToEnableTailCallOpts()
This patch makes sure that a debug value that is after the bitcast in
dupRetToEnableTailCallOpts() is also skipped.

The reduced test case is from SPEC-2006 on SystemZ.

Review: Vedant Kumar, Wolfgang Pieb
https://reviews.llvm.org/D57050

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352462 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-29 09:03:35 +00:00
Jonas Paulsson
1ca3aae406 [SystemZ] Remember to reset the NoPHIs property on MF in createPHIsForSelects()
After creating new PHI instructions during isel pseudo expansion, the NoPHIs
property of MF should be reset in case it was previously set.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352030 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 07:54:41 +00:00
Jonas Paulsson
a61ffd3b7e [SystemZ] Fix test case for buildbot.
llvm-clang-x86_64-expensive-checks-win triggered this assert:

"llvm.dbg.value intrinsic requires a !dbg attachment"

Hopefully, adding reasonable !dbg operands solves this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351939 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 10:29:12 +00:00
Jonas Paulsson
842b69bf63 [SystemZ] Handle DBG_VALUE instructions in two places in backend.
Two backend optimizations failed to handle cases when compiled with -g, due
to failing to consider DBG_VALUE instructions. This was in
SystemZTargetLowering::emitSelect() and
SystemZElimCompare::getRegReferences().

This patch makes sure that DBG_VALUEs are recognized so that they do not
affect these optimizations.

Tests for branch-on-count, load-and-trap and consecutive selects.

Review: Ulrich Weigand
https://reviews.llvm.org/D57048

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351928 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 07:42:26 +00:00
James Y Knight
46d00b498a Remove irrelevant references to legacy git repositories from
compiler identification lines in test-cases.

(Doing so only because it's then easier to search for references which
are actually important and need fixing.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351200 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-15 16:18:52 +00:00
Francis Visoiu Mistrih
08223c34d4 Replace "no-frame-pointer-*" function attributes with "frame-pointer"
Part of the effort to refactoring frame pointer code generation. We used
to use two function attributes "no-frame-pointer-elim" and
"no-frame-pointer-elim-non-leaf" to represent three kinds of frame
pointer usage: (all) frames use frame pointer, (non-leaf) frames use
frame pointer, (none) frame use frame pointer. This CL makes the idea
explicit by using only one enum function attribute "frame-pointer"

Option "-frame-pointer=" replaces "-disable-fp-elim" for tools such as
llc.

"no-frame-pointer-elim" and "no-frame-pointer-elim-non-leaf" are still
supported for easy migration to "frame-pointer".

tests are mostly updated with

// replace command line args ‘-disable-fp-elim=false’ with ‘-frame-pointer=none’
grep -iIrnl '\-disable-fp-elim=false' * | xargs sed -i '' -e "s/-disable-fp-elim=false/-frame-pointer=none/g"

// replace command line args ‘-disable-fp-elim’ with ‘-frame-pointer=all’
grep -iIrnl '\-disable-fp-elim' * | xargs sed -i '' -e "s/-disable-fp-elim/-frame-pointer=all/g"

Patch by Yuanfang Chen (tabloid.adroit)!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351049 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-14 10:55:55 +00:00
Serge Guelton
083a68ec95 Pythran compat - range vs. xrange
Use range instead of xrange whenever possible. The extra list creation in Python2
is generally not a performance bottleneck.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350309 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-03 14:11:58 +00:00
Serge Guelton
60ccceba74 Python compat - print statement
Make sure all print statements are compatible with Python 2 and Python3 using
the `from __future__ import print_function` statement.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350307 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-03 14:11:33 +00:00
Ulrich Weigand
17177f1518 [SystemZ] Make better use of VLLEZ
This patch fixes two deficiencies in current code that recognizes
the VLLEZ idiom:

- For the floating-point versions, we have ISel patterns that match
  on a bitconvert as the top node.  In more complex cases, that
  bitconvert may already have been merged into something else.
  Fix the patterns to match the inner nodes instead.

- For the 64-bit integer versions, depending on the surrounding code,
  we may get either a DAG tree based on JOIN_DWORDS or one based on
  INSERT_VECTOR_ELT.  Use a PatFrags to simply match both variants.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349749 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-20 13:05:03 +00:00
Ulrich Weigand
182b5fec21 [SystemZ] Make better use of VGEF/VGEG
Current code in SystemZDAGToDAGISel::tryGather refuses to perform
any transformation if the Load SDNode has more than one use.  This
(erronously) counts uses of the chain result, which prevents the
optimization in many cases unnecessarily.  Fixed by this patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349748 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-20 13:01:20 +00:00
Ulrich Weigand
6f90d45552 [SystemZ] Make better use of VLDEB
We already have special code (DAG combine support for FP_ROUND)
to recognize cases where we an use a vector version of VLEDB to
perform two floating-point truncates in parallel, but equivalent
support for VLEDB (vector floating-point extends) has been
missing so far.  This patch adds corresponding DAG combine
support for FP_EXTEND.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349746 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-20 12:59:05 +00:00
Simon Pilgrim
1fe1ffe00e [TargetLowering] Add ISD::OR + ISD::XOR handling to SimplifyDemandedVectorElts
Differential Revision: https://reviews.llvm.org/D55600

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349264 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-15 11:36:36 +00:00
Sanjay Patel
74af87e507 [SystemZ] make test immune to scalarization improvements; NFC
The undef operands mean this test is probably still too fragile
to accomplish what the comments suggest.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349164 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-14 17:28:52 +00:00
Jonas Paulsson
d7736b84c4 [SystemZ] Pass copy-hinted regs first from getRegAllocationHints().
When computing register allocation hints for a GRX32Bit register, make sure
that any of the hinted registers that are also copy hints are returned first
in the list.

Review: Ulrich Weigand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349037 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-13 14:37:05 +00:00
Simon Pilgrim
2253059902 [TargetLowering] Add ISD::AND handling to SimplifyDemandedVectorElts
If either of the operand elements are zero then we know the result element is going to be zero (even if the other element is undef).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348926 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-12 13:43:07 +00:00
Simon Pilgrim
cc069de614 Regenerate knownbits test. NFCI.
A future SimplifyDemandedBits patch will affect this code and I want to ensure the codegen diff is obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348925 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-12 13:21:03 +00:00
David Green
e744b686ed [Targets] Fixup incorrect targets in codemodel tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348796 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-10 20:55:34 +00:00
David Green
7135d8b482 [Targets] Add errors for tiny and kernel codemodel on targets that don't support them
Adds fatal errors for any target that does not support the Tiny or Kernel
codemodels by rejigging the getEffectiveCodeModel calls.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348585 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-07 12:10:23 +00:00
Sanjay Patel
8f61bb6941 [SystemZ] make test immune to improvements in undef simplification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347166 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-18 16:50:44 +00:00
Stanislav Mekhanoshin
fbe3eeb333 DAG combiner: fold (select, C, X, undef) -> X
Differential Revision: https://reviews.llvm.org/D54646

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347110 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-16 23:13:38 +00:00
Jonas Paulsson
4cc00e863e [SystemZ] Increase the number of VLREPs
If a loaded value is replicated it is best to combine these two operations
into a VLREP (load and replicate), but isel will not produce this if the load
has other users as well.

This patch handles this by putting the other users of the load to use the
REPLICATE 0-element instead of the load. This way the load has only the
REPLICATE node as user, and we get a VLREP.

Review: Ulrich Weigand
https://reviews.llvm.org/D54264

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346746 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13 08:37:09 +00:00
Jonas Paulsson
79d60f6e81 [SystemZ] Replicate the load with most uses in buildVector()
Iterate over all elements and count the number of uses among them for each
used load. Then make sure to REPLICATE the load which has the most uses in
order to minimize the number of needed element insertions.

Review: Ulrich Weigand
https://reviews.llvm.org/D54322

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346637 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-12 08:12:20 +00:00
Ulrich Weigand
4d8909c55d [SystemZ] Add a couple of missing tests
A few fp128 tests were omitted from test/CodeGen/SystemZ/fp-round-01.ll
since in early days, LLVM couldn't handle implicitly generated library
calls to functions with long double arguments on SystemZ.

This deficiency was actually long since fixed, but those tests are
still missing.  This patch adds the missing tests.  NFC.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346541 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-09 19:16:21 +00:00
Jonas Paulsson
66e6766eea [SystemZ] Avoid inserting same value after replication
A minor improvement of buildVector() that skips creating an
INSERT_VECTOR_ELT for a Value which has already been used for the
REPLICATE.

Review: Ulrich Weigand
https://reviews.llvm.org/D54315

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346504 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-09 15:44:28 +00:00
Nirav Dave
e2baccfd07 [DAGCombine] Improve alias analysis for chain of independent stores.
FindBetterNeighborChains simulateanously improves the chain
dependencies of a chain of related stores avoiding the generation of
extra token factors. For chains longer than the GatherAllAliasDepths,
stores further down in the chain will necessarily fail, a potentially
significant waste and preventing otherwise trivial parallelization.

This patch directly parallelize the chains of stores before improving
each store. This generally improves DAG-level parallelism.

Reviewers: courbet, spatel, RKSimon, bogner, efriedma, craig.topper, rnk

Subscribers: sdardis, javed.absar, hiraditya, jrtc27, atanasyan, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346432 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-08 19:14:20 +00:00
Jonas Paulsson
6355fcebb3 [SystemZ] Bugfix in shouldCoalesce()
It was discovered in randomized testing that the SystemZ implementation of
shouldCoalesce() could be caused to crash when subreg liveness was
enabled. This was because an undef use of the virtual register was copied
outside current MBB at the point of shouldCoalesce() being called. For more
details, see https://bugs.llvm.org/show_bug.cgi?id=39276.

This patch changes the check for MBB locality from livein/liveout checks to
do checks for all instructions of both intervals being inside MBB. This
avoids the cases with dead defs / undef uses outside MBB, which are not
affecting liveness in/out of MBB.

The original test case included as a reduced .mir test case.

Review: Ulrich Weigand
https://reviews.llvm.org/D54197

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346406 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-08 15:29:48 +00:00