1405 Commits

Author SHA1 Message Date
Nekotekina 19471fa18c X86: Fix/workaround Small Code Model for JIT
Force RIP-relative jump tables and global values
Force RIP-relative all zeros / all ones constants
These things were causing crashes due to use of absolute addressing
2019-10-23 14:16:16 +03:00
Reid Kleckner c4185e8c3c Prune Analysis includes from SelectionDAG.h
Only forward declarations are needed here. Follow-on to r375311.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375319 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-19 01:07:48 +00:00
Craig Topper e9fa1c7882 [X86] convertToThreeAddress, make sure second operand of SUB32ri is really an immediate before calling getImm().
It might be a symbol instead. We can't fold those since we can't
negate them.

Similar for other SUB with immediates.

Fixes PR43529.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373397 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-01 21:55:55 +00:00
Craig Topper 4b4fd737fd [X86] Add VMOVSSZrrk/VMOVSDZrrk/VMOVSSZrrkz/VMOVSDZrrkz to getUndefRegClearance.
We have isel patterns that can put an IMPLICIT_DEF on one of
the sources for these instructions. So we should make sure
we break any dependencies there. This should be done by
just using one of the other sources.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373025 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-26 22:56:06 +00:00
Simon Pilgrim e8d798abaa [TargetInstrInfo] Let findCommutedOpIndices take const MachineInstr&
Neither the base implementation of findCommutedOpIndices nor any in-tree target modifies the instruction passed in and there is no reason why they would in the future.

Committed on behalf of @hvdijk (Harald van Dijk)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372882 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-25 14:55:57 +00:00
Craig Topper 61044921b4 [X86] Allow masked VBROADCAST instructions to be turned into BLENDM with a broadcast load to avoid a copy.
The BLENDM instructions allow an 2 sources and an independent
destination while masked VBROADCAST has the destination tied
to the source.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372068 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-17 04:41:10 +00:00
Craig Topper 878e3df175 [X86] Add support for commuting EVEX VCMP instructons with any immediate value.
Previously we limited to the EQ/NE/TRUE/FALSE/ORD/UNORD immediates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372067 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-17 04:41:05 +00:00
Craig Topper 66c8578805 [X86] Enable commuting of EVEX VCMP for all immediate values during isel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372065 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-17 04:40:58 +00:00
Craig Topper b13f996da8 [X86] Use xorps to create fp128 +0.0 constants.
This matches what we do for f32/f64. gcc also does this for fp128.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371357 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-09 01:35:00 +00:00
David Stenberg fbe2300a9b [DebugInfo][X86] Describe call site values for zero-valued imms
Summary:
Add zero-materializing XORs to X86's describeLoadedValue() hook in order
to produce call site values.

I have had to change the defs logic in collectCallSiteParameters() a bit
to be able to describe the XORs. The XORs implicitly define $eflags,
which would cause them to never be considered, due to a guard condition
that I->getNumDefs() is one. I have changed that condition so that we
now only consider instructions where a forwarded register overlaps with
the instruction's single explicit define. We still need to collect the implicit
defines of other forwarded registers to remove them from the work list.
I'm not sure how to move towards supporting instructions with multiple
explicit defines, cases where forwarded register are implicitly defined,
and/or cases where an instruction produces values for multiple forwarded
registers. Perhaps the describeLoadedValue() hook should take a register
argument, and we then leave it up to the hook to describe the loaded
value in that register? I have not yet encountered a situation where
that would be necessary though.

Reviewers: aprantl, vsk, djtodoro, NikolaPrica

Reviewed By: vsk

Subscribers: ychen, hiraditya, llvm-commits

Tags: #debug-info, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371333 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-08 14:22:06 +00:00
David Stenberg 49b6fe0ba5 [NFC] Make the describeLoadedValue() hook return machine operand objects
Summary:
This changes the ParamLoadedValue pair which the describeLoadedValue()
hook returns so that MachineOperand objects are returned instead of
pointers.

When describing call site values we may need to describe operands which
are not part of the instruction. One such example is zero-materializing
XORs on x86, which I have implemented support for in a child revision.
Instead of having to return a pointer to an operand stored somewhere
outside the instruction, start returning objects directly instead, as
that simplifies the code.

The MachineOperand class only holds POD members, and on x86-64 it is 32
bytes large. That combined with copy elision means that the overhead of
returning a machine operand object from the hook does not become very
large.

I benchmarked this on a 8-thread i7-8650U machine with 32 GB RAM. The
benchmark consisted of building a clang 8.0 binary configured with:

  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DLLVM_TARGETS_TO_BUILD=X86 \
  -DLLVM_USE_SANITIZER=Address \
  -DCMAKE_CXX_FLAGS="-Xclang -femit-debug-entry-values -stdlib=libc++"

The average wall clock time increased by 4 seconds, from 62:05 to
62:09, which is an 0.1% increase.

Reviewers: aprantl, vsk, djtodoro, NikolaPrica

Reviewed By: vsk

Subscribers: hiraditya, ychen, llvm-commits

Tags: #debug-info, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371332 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-08 14:05:10 +00:00
Simon Pilgrim a10e7d61af [X86] X86InstrInfo::optimizeCompareInstr - fix potential null dereference.
Fixes clang static-analyzer warning.

Technically the MachineInstr *Sub might still be null if we're comparing zero (IsCmpZero == true), although this probably won't happen as SrcReg2 is probably == 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371047 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-05 10:18:24 +00:00
Craig Topper 2484336221 [X86] Add initial support for unfolding broadcast loads from arithmetic instructions to enable LICM hoisting of the load
MachineLICM can hoist an invariant load, but if that load is folded it needs to be unfolded. On AVX512 sometimes this load is an broadcast load which we were previously unable to unfold. This patch adds initial support for that with a very basic list of supported instructions as a starting point.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370620 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-01 22:14:36 +00:00
Craig Topper 1a0d927b5b [X86] Compress the flag bits in the folding tables to make room for more bits in an upcoming patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370600 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-31 23:52:21 +00:00
Craig Topper d785c99705 [X86] Merge X86InstrInfo::loadRegFromAddr/storeRegToAddr into their only call site.
I'm looking at unfolding broadcast loads on AVX512 which will
require refactoring this code to select broadcast opcodes instead
of regular load/stores in some cases. Merging them to avoid
further complicating their interfaces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370484 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-30 16:05:57 +00:00
Craig Topper c6b7d5dbf0 [X86] Explicitly list all the always trivially rematerializable instructions.
Add a default with an llvm_unreachable for anything we don't expect.

This seems safer that just blindly returning true for anything
missing from the switch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370424 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-30 00:54:36 +00:00
Craig Topper fc72162deb [X86] Mark VPDPWSSD and VPDPWSSDS as commutable. Add stack folding tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369792 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-23 18:05:37 +00:00
Craig Topper b11ea06f42 [X86] Use Register/MCRegister in more places in X86
This was a quick pass through some obvious places. I haven't tried the clang-tidy check.

I also replaced the zeroes in getX86SubSuperRegister with X86::NoRegister which is the real sentinel name.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369151 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-16 20:50:23 +00:00
Daniel Sanders 57a8129407 Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).

Partial reverts in:
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
X86FixupLEAs.cpp - Some functions return unsigned and arguably should be MCRegister
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
HexagonBitSimplify.cpp - Function takes BitTracker::RegisterRef which appears to be unsigned&
MachineVerifier.cpp - Ambiguous operator==() given MCRegister and const Register
PPCFastISel.cpp - No Register::operator-=()
PeepholeOptimizer.cpp - TargetInstrInfo::optimizeLoadInstr() takes an unsigned&
MachineTraceMetrics.cpp - MachineTraceMetrics lacks a suitable constructor

Manual fixups in:
ARMFastISel.cpp - ARMEmitLoad() now takes a Register& instead of unsigned&
HexagonSplitDouble.cpp - Ternary operator was ambiguous between unsigned/Register
HexagonConstExtenders.cpp - Has a local class named Register, used llvm::Register instead of Register.
PPCFastISel.cpp - PPCEmitLoad() now takes a Register& instead of unsigned&

Depends on D65919

Reviewers: arsenm, bogner, craig.topper, RKSimon

Reviewed By: arsenm

Subscribers: RKSimon, craig.topper, lenary, aemerson, wuzish, jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369041 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-15 19:22:08 +00:00
Daniel Sanders c7a3c5c5d1 Finish moving TargetRegisterInfo::isVirtualRegister() and friends to llvm::Register as started by r367614. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367633 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-01 23:27:28 +00:00
Djordje Todorovic a782d2cb2d Reland "[DwarfDebug] Dump call site debug info"
The build failure found after the rL365467 has been
resolved.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367446 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-31 16:51:28 +00:00
Craig Topper bbfe0d2878 [X86] Teach convertToThreeAddress to handle SUB with immediate
We mostly avoid sub with immediate but there are a couple cases that can create them. One is the add 128, %rax -> sub -128, %rax trick in isel. The other is when a SUB immediate gets created for a compare where both the flags and the subtract value is used. If we are unable to linearize the SelectionDAG to satisfy the flag user and the sub result user from the same instruction, we will clone the sub immediate for the two uses. The one that produces flags will eventually become a compare. The other will have its flag output dead, and could then be considered for LEA creation.

I added additional test cases to add.ll to show the the sub -128 trick gets converted to LEA and a case where we don't need to convert it.

This showed up in the current codegen for PR42571.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366151 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-15 23:07:56 +00:00
Craig Topper 8ddc185e3e [X86] Remove offset of 8 from the call to FuseInst for UNPCKLPDrr folding added in r365287.
This was copy/pasted from above and I forgot to change it. We just
need the default offset of 0 here.

Fixes PR42616.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366011 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-14 04:13:33 +00:00
Craig Topper a8d9670f9d [X86] Use MachineInstr::findRegisterDefOperand to simplify some code in optimizeCompareInstr. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365946 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 19:26:35 +00:00
Craig Topper 43d8fddec5 [X86] Add NEG to isUseDefConvertible.
We can use the C flag from NEG to detect that the input was zero.

Really we could probably use the Z flag too. But C matches what
we'd do for usubo 0, X.

Haven't found a test case for this due to the usubo formation
in CGP. But I verified if I comment out the CGP code this
transformation catches some of the same cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365929 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 17:52:17 +00:00
Djordje Todorovic 24d43bb78f Revert "[DwarfDebug] Dump call site debug info"
A build failure was found on the SystemZ platform.

This reverts commit 9e7e73578e.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365886 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 09:45:12 +00:00
Craig Topper c37037aa25 [X86] Add BLSR and BLSMSK to isUseDefConvertible.
Unfortunately subo formation in CGP prevents obvious ways of
testing this.

But we already have BLSI in here and the flag behavior is
well understood.

Might become more useful if we improve PR42571.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365702 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-10 22:14:39 +00:00
Djordje Todorovic 9e7e73578e [DwarfDebug] Dump call site debug info
Dump the DWARF information about call sites and call site parameters into
debug info sections.

The patch also provides an interface for the interpretation of instructions
that could load values of a call site parameters in order to generate DWARF
about the call site parameters.

([13/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365467 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-09 11:33:56 +00:00
Craig Topper cf12d88d09 [X86] Allow execution domain fixing to turn SHUFPD into SHUFPS.
This can help with code size on SSE targets where SHUFPD requires
a 0x66 prefix and SHUFPS doesn't.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365293 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-08 06:52:49 +00:00
Craig Topper dbb8cd7048 [X86] Make movsd commutable to shufpd with a 0x02 immediate on pre-SSE4.1 targets.
This can help avoid a copy or enable load folding.

On SSE4.1 targets we can commute it to blendi instead.

I had to make shufpd with a 0x02 immediate commutable as well
since we expect commuting to be reversible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365292 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-08 06:52:43 +00:00
Craig Topper d6c2eb636d [X86] Add MOVSDrr->MOVLPDrm entry to load folding table. Add custom handling to turn UNPCKLPDrr->MOVHPDrm when load is under aligned.
If the load is aligned we can turn UNPCKLPDrr into UNPCKLPDrm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365287 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-08 02:10:20 +00:00
Craig Topper 127061edab [X86] Remove patterns from MOVLPSmr and MOVHPSmr instructions.
These patterns are the same as the MOVLPDmr and MOVHPDmr patterns,
but with a bitcast at the end. We can just select the PD instruction
and let execution domain fixing switch to PS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365267 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-06 17:59:51 +00:00
Craig Topper 3b25260418 [X86] Correct the size check in foldMemoryOperandCustom.
The Size either needs to be 0 meaning we aren't folding
a stack reload. Or the stack slot needs to be at least
16 bytes. I've also added a paranoia check ensure the
RCSize is at leat 16 bytes as well. This avoids any
FR32/FR64 surprises, but I think we already filtered
those earlier.

All of our test case have Size as either 0 or 16 and
RCSize == 16. So the Size <= 16 check worked for those
cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365234 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-05 18:54:00 +00:00
Matt Arsenault a2b05bc24d CodeGen: Introduce a class for registers
Avoids using a plain unsigned for registers throughoug codegen.
Doesn't attempt to change every register use, just something a little
more than the set needed to build after changing the return type of
MachineOperand::getReg().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364191 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-24 15:50:29 +00:00
Craig Topper d99a7ea8cd [X86] Add BLSI to isUseDefConvertible.
Summary:
BLSI sets the C flag is the input is not zero. So if its followed
by a TEST of the input where only the Z flag is consumed, we can
replace it with the opposite check of the C flag.

We should be able to do the same for BLSMSK and BLSR, but the
naive test case for those is being optimized to a subo by
CodeGenPrepare.

Reviewers: spatel, RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363957 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-20 17:52:53 +00:00
Craig Topper 8777d806ba [X86] Remove memory instructions form isUseDefConvertible.
The caller of this is looking for comparisons of the input
to these instructions with 0. But the memory instructions
input is an addess not a value input in a register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363907 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-20 04:58:40 +00:00
Craig Topper c59023cdb5 [X86] Introduce new MOVSSrm/MOVSDrm opcodes that use VR128 register class.
Rename the old versions that use FR32/FR64 to MOVSSrm_alt/MOVSDrm_alt.

Use the new versions in patterns that previously used a COPY_TO_REGCLASS
to VR128. These patterns expect the upper bits to be zero. The
current set up appears to work, but I'm not sure we should be
enforcing upper bits being zero through a COPY_TO_REGCLASS.

I wanted to flip the arrangement and use a COPY_TO_REGCLASS to
FR32/FR64 for the patterns that need an f32/f64 result, but that
complicated fastisel and globalisel.

I've been doing some experiments with reducing some isel patterns
and ended up in a situation where I had a
(SUBREG_TO_REG (COPY_TO_RECLASS (VMOVSSrm), VR128)) and our
post-isel peephole was unable to avoid using an instruction for
the SUBREG_TO_REG due to the COPY_TO_REGCLASS. Having a VR128
instruction removes the COPY_TO_REGCLASS that was breaking this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363643 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-18 03:23:11 +00:00
Simon Pilgrim 994a7d9682 [CodeGen] Add getMachineMemOperand + MachineMemOperand::Flags allocator helper wrapper. NFCI.
Pre-commit for D62726 on behalf of @luke (Luke Lau)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363257 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-13 12:58:55 +00:00
Craig Topper 91d95c4475 [X86] Add VCMPSSZrr_Intk and VCMPSDZrr_Intk to isNonFoldablePartialRegisterLoad.
The non-masked versions are already in there. I'm having some
trouble coming up with a way to test this right now. Most load
folding should happen during isel so I'm not sure how to get
peephole pass to do it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363125 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-12 06:29:53 +00:00
Craig Topper b34ced6c7d [X86] Add load folding isel patterns to scalar_math_patterns and AVX512_scalar_math_fp_patterns.
Also add a FIXME for the peephole pass not being able to handle this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363032 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-11 04:30:53 +00:00
Jonas Paulsson ff136c756d [SystemZ, RegAlloc] Favor 3-address instructions during instruction selection.
This patch aims to reduce spilling and register moves by using the 3-address
versions of instructions per default instead of the 2-address equivalent
ones. It seems that both spilling and register moves are improved noticeably
generally.

Regalloc hints are passed to increase conversions to 2-address instructions
which are done in SystemZShortenInst.cpp (after regalloc).

Since the SystemZ reg/mem instructions are 2-address (dst and lhs regs are
the same), foldMemoryOperandImpl() can no longer trivially fold a spilled
source register since the reg/reg instruction is now 3-address. In order to
remedy this, new 3-address pseudo memory instructions are used to perform the
folding only when the dst and lhs virtual registers are known to be allocated
to the same physreg. In order to not let MachineCopyPropagation run and
change registers on these transformed instructions (making it 3-address), a
new target pass called SystemZPostRewrite.cpp is run just after
VirtRegRewriter, that immediately lowers the pseudo to a target instruction.

If it would have been possibe to insert a COPY instruction and change a
register operand (convert to 2-address) in foldMemoryOperandImpl() while
trusting that the caller (e.g. InlineSpiller) would update/repair the
involved LiveIntervals, the solution involving pseudo instructions would not
have been needed. This is perhaps a potential improvement (see Phabricator
post).

Common code changes:

* A new hook TargetPassConfig::addPostRewrite() is utilized to be able to run a
target pass immediately before MachineCopyPropagation.

* VirtRegMap is passed as an argument to foldMemoryOperand().

Review: Ulrich Weigand, Quentin Colombet
https://reviews.llvm.org/D60888

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362868 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-08 06:19:15 +00:00
Craig Topper 64c4bd40c6 [X86] Make masked floating point equality/ordered compares commutable for load folding purposes.
Same as what is supported for the unmasked form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362717 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-06 16:39:04 +00:00
Craig Topper b342c7ebe8 [X86] Add the vector integer min/max instructions to isAssociativeAndCommutative.
As far as I know these should be freely reassociatable just like
the floating point MAXC/MINC instructions.

The *reduce* test changes are largely regressions and caused by
the "generic" CPU we default to not having a scheduler model.

The machine-combiner-int-vec.ll test shows the positive benefits
of this change.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362629 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-05 18:25:09 +00:00
Craig Topper 74a2795dfd [X86] Add the SSE versions of PMULLW and PMULLD to isAssociativeAndCommutative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362309 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-02 00:42:58 +00:00
Pengfei Wang 6975687611 [X86] Add VP2INTERSECT instructions
Support Intel AVX512 VP2INTERSECT instructions in llvm

Patch by Xiang Zhang (xiangzhangllvm)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362188 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-31 02:50:41 +00:00
David Greene e83effff05 [X86-64] Fix 256-bit SET0 lowering for non-VLX targets
If we don't have VLX then 256-bit SET0 should be lowered
to VPXOR with ZMM registers.  This restores functionality
accidentally removed by r309926.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361843 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-28 15:37:01 +00:00
Philip Reames defb1cae31 Factor out redzone ABI checks [NFCI]
As requested in D58632, cleanup our red zone detection logic in the X86 backend. The existing X86MachineFunctionInfo flag is used to track whether we *use* the redzone (via a particularly optimization?), but there's no common way to check whether the function *has* a red zone.

I'd appreciate careful review of the uses being updated. I think they are NFC, but a careful eye from someone else would be appreciated.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360479 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-10 22:55:42 +00:00
Simon Pilgrim aba1d86ea4 [X86] Reduce scope of variables where possible. NFCI.
Fixes cppcheck warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360131 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-07 10:50:11 +00:00
Simon Pilgrim 14f718c33f [X86] X86InstrInfo::findThreeSrcCommutedOpIndices - fix unread variable warning.
scan-build was reporting that CommutableOpIdx1 never used its original initialized value - move it down to where its first used to make the real initialization more obvious (and matches the comment that's there).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360028 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-06 10:15:34 +00:00
Bjorn Pettersson bba2202bb1 [CodeGen] Add "const" to MachineInstr::mayAlias
Summary:
The basic idea here is to make it possible to use
MachineInstr::mayAlias also when the MachineInstr
is const (or the "Other" MachineInstr is const).

The addition of const in MachineInstr::mayAlias
then rippled down to the need for adding const
in several other places, such as
TargetTransformInfo::getMemOperandWithOffset.

Reviewers: hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, MatzeB, arsenm, jvesely, nhaehnle, hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358744 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-19 09:08:38 +00:00