1899 Commits

Author SHA1 Message Date
Kevin P. Neal
6c92be1c6c [FPEnv] Add constrained intrinsics for lrint and lround
Earlier in the year intrinsics for lrint, llrint, lround and llround were
added to llvm. The constrained versions are now implemented here.

Reviewed by:	andrew.w.kaylor, craig.topper, cameron.mcinally
Approved by:	craig.topper
Differential Revision:	https://reviews.llvm.org/D64746


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373900 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-07 13:20:00 +00:00
Tamas Berghammer
005dedc6c9 Support MemoryLocation::UnknownSize in TargetLowering::IntrinsicInfo
Summary:
Previously IntrinsicInfo::size was an unsigned what can't represent the
64 bit value used by MemoryLocation::UnknownSize.

Reviewers: jmolloy

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373214 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-30 14:44:24 +00:00
Guillaume Chatelet
71864c0be5 [Alignment][NFC] Remove unneeded llvm:: scoping on Align types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373081 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-27 12:54:21 +00:00
Simon Pilgrim
7324e2c791 [DAG] Pull out minimum shift value calc into a helper function. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372856 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-25 12:28:56 +00:00
Simon Pilgrim
4432ce935e [SelectionDAG] computeKnownBits/ComputeNumSignBits - cleanup demanded/unknown paths. NFCI.
Merge the calls, just adjust the demandedelts if we have a valid extract_subvector constant index, else demand all elts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372521 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-22 18:47:12 +00:00
Simon Pilgrim
23be00fbf3 [DAG] Add SelectionDAG::MaxRecursionDepth constant
As commented on D67557 we have a lot of uses of depth checks all using magic numbers.

This patch adds the SelectionDAG::MaxRecursionDepth constant and moves over some general cases to use this explicitly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372315 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 12:58:43 +00:00
Philip Reames
11df0bc741 [SDAG] Update generic code to conservatively check for isAtomic in addition to isVolatile
This is the first sweep of generic code to add isAtomic bailouts where appropriate. The intention here is to have the switch from AtomicSDNode to LoadSDNode/StoreSDNode be close to NFC; that is, I'm not looking to allow additional optimizations at this time. That will come later.  See D66309 for context.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371786 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-12 22:49:17 +00:00
Guillaume Chatelet
008c0fc12c [Alignment] Use Align for TargetLowering::MinStackArgumentAlignment
Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: sdardis, nemanjai, hiraditya, kbarton, jrtc27, MaskRay, atanasyan, jsji, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371498 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-10 09:01:18 +00:00
Craig Topper
7d4736f09a [SelectionDAG] Remove ISD::FP_ROUND_INREG
I don't think anything in tree creates this node. So all of this
code appears to be dead.

Code coverage agrees
http://lab.llvm.org:8080/coverage/coverage-reports/llvm/coverage/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371431 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-09 17:54:44 +00:00
Kevin P. Neal
dda5f16734 [FPEnv] Add fptosi and fptoui constrained intrinsics.
This implements constrained floating point intrinsics for FP to signed and
unsigned integers.

Quoting from D32319:
The purpose of the constrained intrinsics is to force the optimizer to
respect the restrictions that will be necessary to support things like the
STDC FENV_ACCESS ON pragma without interfering with optimizations when
these restrictions are not needed.

Reviewed by:	Andrew Kaylor, Craig Topper, Hal Finkel, Cameron McInally, Roman Lebedev, Kit Barton
Approved by:	Craig Topper
Differential Revision:	http://reviews.llvm.org/D63782


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370228 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 16:33:36 +00:00
Matt Arsenault
de3ff3a5b1 DAG: computeNumSignBits for MUL
Copied directly from the IR version.

Most of the testcases I've added for this are somewhat problematic
because they really end up testing the yet to be implemented version
for MUL_I24/MUL_U24.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370099 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-27 19:05:33 +00:00
Craig Topper
fef5389ee3 [SelectionDAG] Add a node creation debug message to getMachineNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369204 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-18 06:28:00 +00:00
Sanjay Patel
1652e84951 [SDAG][x86] check for relaxed math when matching an FP reduction
If the last step in an FP add reduction allows reassociation and doesn't care
about -0.0, then we are free to recognize that computation as a reduction
that may reorder the intermediate steps.

This is requested directly by PR42705:
https://bugs.llvm.org/show_bug.cgi?id=42705
and solves PR42947 (if horizontal math instructions are actually faster than
the alternative):
https://bugs.llvm.org/show_bug.cgi?id=42947

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368995 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-15 12:43:15 +00:00
Sanjay Patel
cd4b3e375a [SDAG] move variable closer to use; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368905 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 19:46:15 +00:00
Amy Huang
61e66bd1ef Recommit "[MS] Emit S_HEAPALLOCSITE debug info in Selection DAG"
with a fix to clear the SDNode map when SelectionDAG is cleared.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368230 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-07 22:49:40 +00:00
Cullen Rhodes
2d85110820 [SelectionDAG] Extend base addressing modes supported by MGATHER/MSCATTER
Summary:
Before this patch MGATHER/MSCATTER is capable of representing all
common addressing modes, but only when illegal types are used.
This patch adds an IndexType property so more representations
are available when using legal types only.

Original modes:
 vector of bases
 base + vector of signed scaled offsets

New modes:
 base + vector of signed unscaled offsets
 base + vector of unsigned scaled offsets
 base + vector of unsigned unscaled offsets

The current behaviour of addressing modes for gather/scatter remains
unchanged.

Patch by Paul Walker.

Reviewed By: craig.topper

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368008 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-06 09:46:13 +00:00
Guillaume Chatelet
f76a78bfee [LLVM][Alignment] Introduce Alignment Type in DataLayout
Summary:
This is patch is part of a serie to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet, jfb, jakehehrlich

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

Make getFunctionPtrAlign() return MaybeAlign

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367817 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-05 09:00:43 +00:00
Craig Topper
ae4f203a76 [SelectionDAG] Add node creation debug message to getMemIntrinsicNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367771 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-04 02:32:06 +00:00
Craig Topper
64957c8ce3 [SelectionDAG] Use APInt::isSubsetOf/intersects to simplify some code.
Also use KnownBits::isNegative/isNonNegative to further simplify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367518 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-01 06:06:21 +00:00
Michael Berg
435a375718 Migrate some more fadd and fsub cases away from UnsafeFPMath control to utilize NoSignedZerosFPMath options control
Summary: Honoring no signed zeroes is also available as a user control through clang separately regardless of fastmath or UnsafeFPMath context, DAG guards should reflect this context.

Reviewers: spatel, arsenm, hfinkel, wristow, craig.topper

Reviewed By: spatel

Subscribers: rampitec, foad, nhaehnle, wuzish, nemanjai, jvesely, wdng, javed.absar, MaskRay, jsji

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367486 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-31 21:57:28 +00:00
Peter Collingbourne
5c2d5457dd SelectionDAG, MI, AArch64: Widen target flags fields/arguments from unsigned char to unsigned.
This makes the field wider than MachineOperand::SubReg_TargetFlags so that
we don't end up silently truncating any higher bits. We should still catch
any bits truncated from the MachineOperand field as a consequence of the
assertion in MachineOperand::setTargetFlags().

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367474 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-31 20:14:09 +00:00
Simon Pilgrim
e1534e4ff4 [SelectionDAG] Check for any recursion depth greater than or equal to limit instead of just equal the limit.
If anything called the recursive isKnownNeverNaN/computeKnownBits/ComputeNumSignBits/SimplifyDemandedBits/SimplifyMultipleUseDemandedBits with an incorrect depth then we could continue to recurse if we'd already exceeded the depth limit.

This replaces the limit check (Depth == 6) with a (Depth >= 6) to make sure that we don't circumvent it. 

This causes a couple of regressions as a mixture of calls (SimplifyMultipleUseDemandedBits + combineX86ShufflesRecursively) were calling with depths that were already over the limit. I've fixed SimplifyMultipleUseDemandedBits to not do this. combineX86ShufflesRecursively is trickier as we get a lot of regressions if we reduce its own limit from 8 to 6 (it also starts at Depth == 1 instead of Depth == 0 like the others....) - I'll see what I can do in future patches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367171 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-27 12:48:46 +00:00
Simon Pilgrim
30fe346d0b [SelectionDAG] GetDemandedBits - update SIGN_EXTEND_INREG op to just call SimplifyMultipleUseDemandedBits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367098 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-26 10:03:07 +00:00
Simon Pilgrim
f8a4f9ea4e [SelectionDAG] GetDemandedBits - update OR/XOR ops to just call SimplifyMultipleUseDemandedBits.
Eventually all of these will be moved over, but we create nodes in GetDemandedBits recursion at the moment which causes regressions when we try to remove them all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367092 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-26 09:13:29 +00:00
Simon Pilgrim
0eecf8e56e Fix signed/unsigned comparison warning. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366935 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-24 17:44:22 +00:00
Simon Pilgrim
8acd141e45 [DAGCombine] matchBinOpReduction - add partial reduction matching
This patch adds support for recognizing cases where a larger vector type is being used to reduce just the elements in the lower subvector:

e.g. <8 x i32> reduction pattern in a <16 x i32> vector:

<4,5,6,7,u,u,u,u,u,u,u,u,u,u,u,u>
<2,3,u,u,u,u,u,u,u,u,u,u,u,u,u,u>
<1,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u>

matchBinOpReduction returns the lower extracted subvector in such cases, assuming isExtractSubvectorCheap accepts the extraction.

I've only enabled it for X86 reduction sums so far. I intend to enable it for the bitop/minmax cases in future patches, and eventually I think its worth turning it on all the time. This is mainly just a case of ensuring calls to matchBinOpReduction don't make assumptions on the vector width based on the original vector extraction.

Fixes the x86 partial reduction sum cases in PR33758 and PR42023.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366933 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-24 17:29:56 +00:00
Simon Pilgrim
31ab4e43f9 [SelectionDAG] makeEquivalentMemoryOrdering - early out for equal chains (PR42727)
If we are already using the same chain for the old/new memory ops then just return.

Fixes PR42727 which had getLoad() reusing an existing node.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366922 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-24 16:53:14 +00:00
Guillaume Chatelet
64c8cde655 Fixing @llvm.memcpy not honoring volatile.
This is explicitly not addressing target-specific code, or calls to memcpy.

Summary: https://bugs.llvm.org/show_bug.cgi?id=42254

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365449 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-09 09:53:36 +00:00
James Molloy
755e158b41 [SelectionDAG] Propagate alias metadata to target intrinsic nodes
When a target intrinsic has been determined to touch memory, we construct a MachineMemOperand during SDAG construction. In this case, we should propagate AAMDNodes metadata to the MachineMemOperand where available.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365043 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-03 14:33:29 +00:00
Craig Topper
eb4bea11d2 [SelectionDAG] Use the memory VT instead of result VT for FoldingSet profiling in getMaskedLoad/getMaskedStore.
This matches what is done by the Profile function. Otherwise CSE
won't work properly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364717 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-30 06:46:33 +00:00
Roman Lebedev
a698111256 [X86] X86DAGToDAGISel::matchBitExtract(): pattern b: truncation awareness
Summary:
(Not so) boringly identical to pattern a (D62786)
Not yet sure how do deal with the last pattern c.

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364418 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-26 12:19:39 +00:00
Simon Pilgrim
c69190afaf [DAGCombiner] Support (shl (ext (shl x, c1)), c2) -> 0 non-uniform folds.
Use matchBinaryPredicate instead of isConstOrConstSplat to let us handle non-uniform shift cases. 

This requires us to tweak matchBinaryPredicate to allow it to (optionally) handle constants with different type widths.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363792 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-19 12:25:29 +00:00
Simon Pilgrim
ec69a27d0a [SelectionDAG] Fold insert_subvector(undef, extract_subvector(v, c), c) -> v in getNode
This is already done in DAGCombiner::visitINSERT_SUBVECTOR, but this helps a number of shuffles across different vector widths recognise when they come from the same source.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363542 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-17 10:14:52 +00:00
Simon Pilgrim
4d9a476003 [SelectionDAG] ComputeNumSignBits - support constant pool values from target
As I mentioned on D61887 we don't get many hits on ComputeNumSignBits as we did on computeKnownBits.

The case we do get is interesting though - it allows us to use the 'ConditionalNegate' combine in combineLogicBlendIntoPBLENDV to remove a select.

It comes too late for SSE41 (BLENDV) cases, but SSE2 tests can hit it now. We should probably try to make use of this for SSE41+ targets as well - avoiding variable blends is usually a good idea. I'll investigate as a followup.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362486 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-04 10:49:06 +00:00
Simon Pilgrim
694eea2a3b [SelectionDAG] ComputeNumSignBits - clang-format + improve *EXTLOAD comments. NFCI.
Pre-commit requested for D62777.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362485 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-04 10:17:56 +00:00
Simon Pilgrim
11c4864708 [SelectionDAG] Add fpto[us]i(undef) --> undef constant fold
Follow up to D62807.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362483 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-04 10:04:55 +00:00
Simon Pilgrim
2d2b2ea8ca [SelectionDAG] Add [us]itofp(undef) --> 0 constant fold (PR39205)
We were missing this fold in the DAG, which I've copied directly from llvm::ConstantFoldCastInstruction

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362397 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-03 13:02:07 +00:00
Simon Pilgrim
40263ea2de [DAG] isBitwiseNot / isConstOrConstSplat - add support for build vector undefs + truncation (PR41020)
Add (opt-in) support for implicit truncation to isConstOrConstSplat, which allows us to match truncated 'all ones' cases in isBitwiseNot.

PR41020 compares against using ISD::isBuildVectorAllOnes() instead, but that predicate silently accepts any UNDEF elements in the build vector which might not be what we want in isBitwiseNot - so I've added an opt-in 'AllowUndefs' flag that is set to false by default but will allow us to enable it on individual cases where its safe.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362323 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-02 11:56:39 +00:00
Craig Topper
0560ae24a7 [SelectionDAG] Make the code in mutateStrictFPToFP less aware of how many operands each node has. NFCI
Just copy all of the operands except the chain and call MorphNode on that.
This removes the IsUnary and IsTernary flags.

Also always get the result type from the result type of the original
nodes. Previously we got it from the operand except for two nodes
where that didn't work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362269 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-31 22:18:45 +00:00
Sanjay Patel
5a8a6ab113 [SelectionDAG] fold concat of extract subvectors
This is derived from the related fold for build vectors.
We also have a version of this in DAGCombiner. The benefit of
having this fold at node creation time is (1) efficiency and
(2) preventing infinite looping from creating patterns that
should not exist in the first place.

Currently, the inf-loop could happen with MergeConsecutiveStores()
because it naively creates concat of extracts when forming a wider
vector store. That could fight with target-specific store narrowing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361780 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-27 20:26:21 +00:00
Sanjay Patel
072973eb9b [SelectionDAG] fix formatting and redundant comments; NFC
There's a possible missing fold here for extracting from the
same source vector. It's similar to a check that we use to
squash a build vector with all extracted elements from the
same source vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361778 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-27 18:26:43 +00:00
Simon Pilgrim
b33122639d [SelectionDAG] GetDemandedBits - add demanded elements wrapper implementation
The DemandedElts variable is pretty much inert at the moment - the original GetDemandedBits implementation calls it with an 'all ones' DemandedElts value so the function is active and behaves exactly as it used to.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361773 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-27 16:39:25 +00:00
Simon Pilgrim
8876981fff [SelectionDAG] GetDemandedBits - cleanup to more closely match SimplifyDemandedBits. NFCI.
Prep work before adding demanded elts support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361739 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-26 18:58:14 +00:00
Simon Pilgrim
fc57df06ad [SelectionDAG] MaskedValueIsZero - add demanded elements implementation
Will be used in an upcoming patch but I've updated the original implementation to call this to ensure test coverage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361738 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-26 18:43:44 +00:00
Simon Pilgrim
128852a784 [SelectionDAG] computeKnownBits - support constant pool values from target
This patch adds the overridable TargetLowering::getTargetConstantFromLoad function which allows targets to return any constant value loaded by a LoadSDNode node - only X86 makes use of this so far but everything should be in place for other targets.

computeKnownBits then uses this function to improve codegen, notably vector code after legalization.

A future commit will do the same for ComputeNumSignBits but computeKnownBits sees the bigger benefit.

This required a couple of fixes:
* SimplifyDemandedBits must early-out for getTargetConstantFromLoad cases to prevent infinite loops of constant regeneration (similar to what we already do for BUILD_VECTOR).
* Fix a DAGCombiner::visitTRUNCATE issue as we had trunc(shl(v8i32),v8i16) <-> shl(trunc(v8i16),v8i32) infinite loops after legalization on AVX512 targets.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361620 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-24 10:03:11 +00:00
Sanjay Patel
ba36ccd5d2 [SelectionDAG] fold insert subvector of undef into undef
DAGCombiner simplifies this more liberally as:
  // If inserting an UNDEF, just return the original vector.
  if (N1.isUndef())
    return N0;

So there's no way to make this visible in output AFAIK, but
doing this at node creation time should be slightly more efficient.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361287 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-21 18:53:53 +00:00
Petar Jovanovic
0ddfb52ad6 [DebugInfoMetadata] Refactor DIExpression::prepend constants (NFC)
Refactor DIExpression::With* into a flag enum in order to be less
error-prone to use (as discussed on D60866).

Patch by Djordje Todorovic.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361137 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-20 10:35:57 +00:00
Reid Kleckner
a456f784fa [codeview] Fix SDNode representation of annotation labels
Before this change, they were erroneously constructed with the EH_LABEL
SDNode opcode, which caused other passes to interact with them in
incorrect ways. See the FIXME about fastisel that this addresses in the
existing test case.

Fixes PR41890

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360818 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-15 21:46:05 +00:00
Kevin P. Neal
ff5c498da2 Add constrained fptrunc and fpext intrinsics.
The new fptrunc and fpext intrinsics are constrained versions of the
regular fptrunc and fpext instructions.

Reviewed by:	Andrew Kaylor, Craig Topper, Cameron McInally, Conner Abbot
Approved by:	Craig Topper
Differential Revision: https://reviews.llvm.org/D55897



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360581 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-13 13:23:30 +00:00
Sanjay Patel
98d1398f22 [SelectionDAG] fold 'fneg undef' to undef
This is extracted from the original draft of D61419 with some additional tests.
We don't currently get this in IR (it's conservatively turned into a NaN),
but presumably that'll get updated as we add real IR support for 'fneg'
rather than 'fsub -0.0, x'.

The x86-32 run shows the following, and I haven't looked further to see why,
but that seems to be independent:
  Legalizing: t1: f32 = undef
  Trying to expand node
  Creating fp constant: t4: f32 = ConstantFP<0.000000e+00>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360296 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-08 22:19:52 +00:00