Commit Graph

2099 Commits

Author SHA1 Message Date
David Blaikie
b91d9a7128 Fix layering by moving ValueTypes.h from CodeGen to IR
ValueTypes.h is implemented in IR already.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328397 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-23 23:58:31 +00:00
David Blaikie
9d9a46a465 Fix layering of MachineValueType.h by moving it from CodeGen to Support
This is used by llvm tblgen as well as by LLVM Targets, so the only
common place is Support for now. (maybe we need another target for these
sorts of things - but for now I'm at least making them correct & we can
make them better if/when people have strong feelings)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328395 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-23 23:58:25 +00:00
Martin Storsjo
c5f9aedb72 Revert "[DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))"
This reverts commit r328252. This change broke building a number
of projects when targeting ARM and AArch64, see PR36873.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328297 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-23 08:36:47 +00:00
Guozhi Wei
423eb96060 [DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))
In our real world application, we found the following optimization is missed in DAGCombiner

(zext (and/or/xor (shl/shr (load x), cst), cst)) -> (and/or/xor (shl/shr (zextload x), (zext cst)), (zext cst))

If the user of original zext is an add, it may enable further lea optimization on x86.

This patch add a new function CombineZExtLogicopShiftLoad to do this optimization.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328252 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-22 21:47:25 +00:00
Craig Topper
a1b5897aa3 [DAGCombiner] Fix type in comment. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327916 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-19 22:25:26 +00:00
Craig Topper
3a48b7c274 [X86] Teach X86TargetLowering::targetShrinkDemandedConstant to set non-demanded bits if it helps created an and mask that can be matched as a zero extend.
I had to modify the bswap recognition to allow unshrunk masks to make this work.

Fixes PR36689.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327530 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 16:55:15 +00:00
Craig Topper
0d74daca01 [DAGCombiner] Allow visitEXTRACT_SUBVECTOR to combine with BUILD_VECTORS between LegalizeVectorOps and LegalizeDAG.
BUILD_VECTORs aren't themselves legalized until LegalizeDAG so we should still be able to create an "illegal" one before that. This helps combine with BUILD_VECTORS that are introduced during LegalizeVectorOps due to unrolling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327446 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-13 20:36:28 +00:00
Simon Pilgrim
38ac5997de [DAGCombine] visitREM - Don't assume that one divrem isn't driving another
Under some circumstances the divrems won't have been combined together before getting to this code.

So replace the assertion with a if() guard to not expand to X-((X/C)*C) to give the other combine chance to happen.

Reduced from OSS-Fuzz #6883
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6883


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327424 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-13 17:17:15 +00:00
Nirav Dave
493154d6d0 Make early exit hasPredecessorHelper return true. NFCI.
All uses conservatively assume in early exit case that it will be a
predecessor. Changing default removes checking code in all uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327169 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-09 20:56:51 +00:00
Craig Topper
bc41688d2c [DAGCombiner] Add a peekThroughBitcast to MergeStoresOfConstantsOrVecElts to fix a crash if we are storing a bitcast of a constant.
Loading a constant into a k-register in AVX512 requires a bitcast from a scalar constant. In the test case here we have a k-register store that gets split into multiple parts of KNL. MergeConsecutiveStores sees each of these pieces as a consecutive store and looks through the bitcast to find the underly scalar constant. But when we went to create the combined store we didn't look through the same bitcast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326677 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-04 18:51:46 +00:00
Craig Topper
5af2fadb04 [DAGCombiner] When combining zero_extend of a truncate, only mask before extending for vectors.
Masking first, prevents the extend from being combine with loads. Its also interfering with some vXi1 extraction code.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326500 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-01 22:32:25 +00:00
Amaury Sechet
d76d0bdf82 [DAGCOmbine] Ensure that (brcond (setcc ...)) is handled in a canonical manner.
Summary:
There are transformation that change setcc into other constructs, and transform that try to reconstruct a setcc from the brcond condition. Depending on what order these transform are done, the end result differs.

Most of the time, it is preferable to get a setcc as a brcond argument (and this is why brcond try to recreate the setcc in the first place) so we ensure this is done every time by also doing it at the setcc level when the only user is a brcond.

Reviewers: spatel, hfinkel, niravd, craig.topper

Subscribers: nhaehnle, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325892 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-23 11:50:42 +00:00
Simon Pilgrim
e07827f03b [SelectionDAG] Move matchUnaryPredicate/matchBinaryPredicate into SelectionDAGNodes.h
This allows us to improve vector constant matching in more DAG code (backends, TargetLowering etc.).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325815 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-22 18:45:13 +00:00
Craig Topper
de866c328a [DAGCombiner] Add two calls to isVector before making calls to getVectorElementType/getVectorNumElements to avoid an assert.
We looked through a BITCAST, but the bitcast might be a from a scalar type rather than a vector.

I don't have a test case. I stumbled onto it while prototyping another change that isn't ready yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325750 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-22 07:05:27 +00:00
Craig Topper
bff6449bb8 [SelectionDAG] Add LegalTypes flag to getShiftAmountTy. Use it to unify and simplify DAGCombiner and simplifySetCC code and fix a bug.
DAGCombiner and SimplifySetCC both use getPointerTy for shift amounts pre-legalization. DAGCombiner uses a single helper function to hide this. SimplifySetCC does it in multiple places.

This patch adds a defaulted parameter to getShiftAmountTy that can make it return getPointerTy for scalar types. Use this parameter to simplify the SimplifySetCC and DAGCombiner.

Additionally, there were two places in SimplifySetCC that were creating shifts using the target's preferred shift amount pre-legalization. If the target uses a narrow type and the type is illegal, this can cause SimplfiySetCC to create a shift with an amount that can't represent all possible shift values for the type. To fix this we should use pointer type there too.

Alternatively we could make getScalarShiftAmountTy for each target return a safe value for large types as proposed in D43445. And maybe we should still do that, but fixing the SimplifySetCC code keeps other targets from tripping over this in the future.

Fixes PR36250.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325602 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-20 17:41:05 +00:00
Simon Pilgrim
c26f626148 [DAGCombiner] Remove simplifyShuffleMask - now handled more generally by SimplifyDemandedVectorElts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325429 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-17 12:36:56 +00:00
Craig Topper
297d461b01 [DAGCombiner] Call ExtendUsesToFormExtLoad in (zext (and (load)))->(and (zextload)) even when the and does not have multiple uses
Same for the sign extend case.

Currently we check for multiple uses on the binop. Then we call ExtendUsesToFormExtLoad to capture SetCCs that use the load. So we only end up finding any setccs when the and has additional uses and the load is used by a setcc. I don't think the and having multiple uses is relevant here. I think we should only be checking for the load having multiple uses.

This changes an NVPTX test because we now find that the load has a second use by a truncate, but ExtendUsesToFormExtLoad only looks at setccs it can extend. All other operations just check isTruncateFree. Maybe we should allow widening of an existing truncate even if its not free?

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325289 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15 20:20:32 +00:00
Simon Pilgrim
371e6cc130 [SelectionDAG] Add initial implementation of TargetLowering::SimplifyDemandedVectorElts
This is mainly a move of simplifyShuffleOperands from DAGCombiner::visitVECTOR_SHUFFLE to create a more general purpose TargetLowering::SimplifyDemandedVectorElts implementation.

Further features can be moved/added in future patches.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325232 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15 12:14:15 +00:00
Alexander Ivchenko
ba2e473a53 [SelectionDAG][X86] Fix incorrect offset generated for VMASKMOV
When creating high MachineMemOperand for MSTORE/MLOAD we supply
it with the original PointerInfo, while the pointer itself had been incremented.
The patch adds the proper offset to the PointerInfo.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325135 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 15:55:24 +00:00
Craig Topper
7947e7211b [DAGCombiner] Add one use check to fold (not (and x, y)) -> (or (not x), (not y))
Summary:
If the and has an additional use we shouldn't invert it. That creates an additional instruction.

While there add a one use check to the transform above that looked similar.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325019 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 16:25:27 +00:00
Simon Pilgrim
43e7c1ccf9 [X86][SSE] Enable SMIN/SMAX/UMIN/UMAX custom lowering for all legal types
This allows us to recognise more saturation patterns and also simplify some MINMAX codegen that was failing to combine CMPGE comparisons to a legal CMPGT.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324837 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 10:52:37 +00:00
Craig Topper
a7d13fbe24 [SelectionDAG] Remove TargetLowering::getConstTrueVal. Use SelectionDAG::getBoolConstant in the one place it was used.
SelectionDAG::getBoolConstant was recently introduced. At the time I didn't know getConstTrueVal existed, but I think getBoolConstant is better as it will use the source VT to make sure it can properly detect floating point if it is configured differently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324832 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 04:58:58 +00:00
Vedant Kumar
5309a7b3dd Revert "WIP: [DAGCombiner] Assert that debug info is preserved"
This reverts commit r324648. It was committed accidentally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324650 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 20:27:35 +00:00
Vedant Kumar
deeff3d70b WIP: [DAGCombiner] Assert that debug info is preserved
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324648 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 20:27:09 +00:00
Craig Topper
f1980331db [DAGCombiner] Fix a couple mistakes from r324311 by really passing the original load to ExtendSetCCUses.
We're passing the binary op that uses the load instead of the load.

Noticed by inspection. Not sure how to test this because this just prevents the introduction of an extend that will later be truncated and will probably be combined out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324568 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 06:27:18 +00:00
Craig Topper
d758b76106 [DAGCombiner] Don't create truncate nodes in (aext (zextload x)) -> (zextload x) and similar folds. NFCI
The truncate is being used to replace other users of of the load, but we checked that the load only has one use so there are no other uses to replace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324567 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 06:04:18 +00:00
Craig Topper
1176aede92 [DAGCombiner] Avoid creating truncate nodes in (zext (and (load)))->(and (zextload)) fold until we know for sure we're going to need it. NFCI
The truncate is only needed if the load has additional users. It used to get passed to extendSetCCUses so was created early, but that's no longer the case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324562 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 04:38:04 +00:00
Craig Topper
4892373b32 [DAGCombiner] Rename variable to be slightly better. NFC
We were calling a load LN0 but it came from N0.getOperand(0) so its really more like LN00 if we follow the name used in other places.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324561 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 04:38:02 +00:00
Craig Topper
c8c76d329a [DAGCombiner][AMDGPU][X86] Turn cttz/ctlz into cttz_zero_undef/ctlz_zero_undef if we can prove the input is never zero
X86 currently has a late DAG combine after cttz/ctlz are turned into BSR+BSF+CMOV to detect this and remove the CMOV. But we should be able to do this much earlier and avoid creating the cmov all together.

For the changed AMDGPU test case it appears that previously the i8 cttz was type legalized to i16 which introduced an OR with 256 in order to limit the result to 8 on the widened type. At this point the result is known to never be zero, but nothing checked that. Then operation legalization is told to promote all i16 cttz to i32. This introduces an extend and a truncate and another OR with 65536 to limit the result to 16. With the DAG combiner change we are able to prevent the creation of the second OR since the opcode will have been changed to cttz_zero_undef after the first OR. I the lack of the OR caused the instruction to change to v_ffbl_b32_sdwa

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324427 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 23:54:37 +00:00
Craig Topper
e48a32e195 [DAGCombiner] Pass the original load to ExtendSetCCUses not the turncate.
Summary:
This method is trying to use the truncate node to find which SETCC operand should be replaced directly with the extended load.

This used to work correctly because all uses of the original load were replaced by the truncate before this function was called. So this was used to effectively bypass the truncate and find the load under it.

All but one of the callers now call this before the truncate has replaced the laod so the setcc doesn't yet use the truncate. To account for this we should pass the original load instead.

I changed the order of that one caller to make this work there too.

I don't have a test case because this is probably hidden by later DAG combines causing the extend and truncate to cancel out. I assume this way is a little more efficient and matches what was originally intended.

Reviewers: RKSimon, spatel, niravd

Reviewed By: niravd

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324311 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 03:23:27 +00:00
Craig Topper
616c32878e [DAGCombiner] When folding fold (sext/zext (and/or/xor (sextload/zextload x), cst)) -> (and/or/xor (sextload/zextload x), (sext/zext cst)) make sure we check the legality of the full extended load.
Summary:
If the load is already an extended load we should be using the memory VT for the legality check, not just the VT of the current extension.

I don't have a test case, just noticed it while investigating some load extension improvements.

Reviewers: RKSimon, spatel, niravd

Reviewed By: niravd

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324181 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-03 23:00:31 +00:00
Craig Topper
3b21b563ed [DAGCombiner] When folding (insert_subvector undef, (bitcast (extract_subvector N1, Idx)), Idx) -> (bitcast N1) make sure that N1 has the same total size as the original output
We were only checking the element count, but not the total width. This could cause illegal bitcasts to be created if for example the output was 512-bits, but N1 is 256 bits, and the extraction size was 128-bits.

Fixes PR36199

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324002 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01 20:48:50 +00:00
Sanjay Patel
f712d3af43 [DAGCombiner] filter out denorm inputs when calculating sqrt estimate (PR34994)
As shown in the example in PR34994:
https://bugs.llvm.org/show_bug.cgi?id=34994
...we can return a very wrong answer (inf instead of 0.0) for square root when 
using a reciprocal square root estimate instruction.

Here, I've conditionalized the filtering out of denorms based on the function 
having "denormal-fp-math"="ieee" in its attributes. The other options for this 
attribute are 'preserve-sign' and 'positive-zero'.

So we don't generate this extra code by default with just '-ffast-math' (because 
then there's no denormal attribute string at all), but it works if you specify 
'-ffast-math -fdenormal-fp-math=ieee' from clang. 

As noted in the review, there may be other problems in clang that affect the 
results depending on platform (Linux x86 at least), but this should allow 
creating the desired codegen.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323981 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01 16:57:18 +00:00
Craig Topper
175e3ee84d [X86] Make foldLogicOfSetCCs work better for vectors pre legal types/operations
Summary:
There's a check in the code to only check getSetCCResultType after LegalOperations or if the type is MVT::i1. But the i1 check is only allowing scalar types through. I think it should check that the scalar type is MVT::i1 so that it will work for vectors.

The changed test already does this combine with AVX512VL where getSetCCResultType returns vXi1. But with avx512f and no VLX getSetCCResultType returns a type matching the width of the input type.

Reviewers: spatel, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323631 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-29 07:52:55 +00:00
Simon Pilgrim
17d3ed3a32 [DAGCombine] reduceBuildVecToShuffle - ensure EXTRACT_VECTOR_ELT index is in range
From OSS Fuzz Test Case #5688

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323535 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26 15:50:20 +00:00
Sven van Haastregt
d1c00f7109 [DAGCombiner] Bail out if vector size is not a multiple
For the included test case, the DAG transformation
  concat_vectors(scalar, undef) -> scalar_to_vector(sclr)
would attempt to create a v2i32 vector for a v9i8
concat_vector.  Bail out to avoid creating a bitcast with
mismatching sizes later on.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323312 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 09:53:47 +00:00
Craig Topper
2871d3aefe [DAGCombiner] Add a DAG combine to turn a splat build_vector where the splat elemnt is a bitcast from a vector type into a concat_vector
For example, a build_vector of i64 bitcasted from v2i32 can be turned into a concat_vectors of the v2i32 vectors with a bitcast to a vXi64 type

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322811 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-18 04:17:06 +00:00
Benjamin Kramer
6f0bf733f3 Revert "[DAG] Elide overlapping stores"
This reverts commit r322085. Internal PPC testing is still showing the
same symptoms as when this patch landed the last time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322474 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 10:57:24 +00:00
Adrian Prantl
3d4e94d187 dag-combine: Transfer debug information when folding (zext (truncate x))
-> (zext (truncate x))

This patch adds debug info support to the dagcombine rule (zext
(truncate x)) -> (zext (truncate x)).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322304 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-11 18:35:12 +00:00
Zvi Rackover
20afd373f6 DAGCombine: Let truncates negate extension through extract-subvector
Summary:
Fold cases such as:
(v8i8 truncate (v8i32 extract_subvector (v16i32 sext (v16i8 V), Idx)))
->
(v8i8 extract_subvector (v16i8 V), Idx)

This can be generalized to cases where the truncate and extend do not
fully cancel each other out, but it may require querying the target
about profitability.

Reviewers: RKSimon, craig.topper, spatel, efriedma

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322300 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-11 18:02:33 +00:00
Craig Topper
703dd67544 [SelectionDAG][X86] Explicitly store the scale in the gather/scatter ISD nodes
Currently we infer the scale at isel time by analyzing whether the base is a constant 0 or not. If it is we assume scale is 1, else we take it from the element size of the pass thru or stored value. This seems a little weird and I think it makes more sense to make it explicit in the DAG rather than doing tricky things in the backend.

Most of this patch is just making sure we copy the scale around everywhere.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322210 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-10 19:16:05 +00:00
Nirav Dave
b56f822bc7 [DAG] Elide overlapping stores
Relanding after fixing handling of pre-indexed memory operations in
BaseIndexOffset analysis (r322003).

Extend overlapping store elision to handle overwrites of stores by
larger stores.

Reviewers: craig.topper, rnk, t.p.northover

Subscribers: javed.absar, hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322085 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-09 15:23:12 +00:00
Nirav Dave
80fc28f975 [DAG] Teach BaseIndexOffset to correctly handle with indexed operations
BaseIndexOffset address analysis incorrectly ignores offsets folded
into indexed memory operations causing potential errors in alias
analysis of pre-indexed operations.

Reviewers: efriedma, RKSimon, hfinkel, jyknight

Subscribers: hiraditya, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322003 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 16:21:35 +00:00
Sam Parker
14e29de03d [DAGCombine] Fix for PR35761
I had falsely assumed that constant operands would be operand(1) of
the bin ops that may need their constant operand to be masked.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=35761

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321991 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 13:21:24 +00:00
Sam Parker
8681051b9e [DAGCombine] Fix for PR37563
While searching for loads to be narrowed, equal sized loads were not
added to the list, resulting in anyext loads not being converted to
zext loads.

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

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321862 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 08:47:23 +00:00
Amara Emerson
e5c4445c2d [DAGCombine] Ensure SDNode use iterator is incremented properly.
Fixes an ASAN bug found by oss-fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321813 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 18:38:45 +00:00
Simon Pilgrim
fed8082832 [DAGCombine] Handle out of range EXTRACT_VECTOR_ELT indices
Handle this in DAGCombiner::visitEXTRACT_VECTOR_ELT the same as we already do in SelectionDAG::getNode and use APInt instead of getZExtValue.

This should also fix oss-fuzz #4910

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321767 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 22:42:33 +00:00
Daniel Jasper
7f55be51ae Revert r321089: "[DAG] Elide overlapping store" (and subsequent fix in r321204)
Our internal testing has revealed has discovered bugs in PPC builds.
I have forward reproduction instructions to the original author (Nirav).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321649 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 14:38:52 +00:00
Sam Parker
2714c01fbb [DAGCombine] Fix for PR35765
Remove the acceptance of ANY_EXTEND nodes while trying to move and
nodes back to loads.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=35765

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321641 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 10:19:01 +00:00
Simon Pilgrim
58a0346050 [DAGCombine] foldBinOpIntoSelect can fail to constant fold in some cases.
For example, float operations may fail to constant fold under certain circumstances (inf/nan/denormal creation etc.)

Reduced from oss-fuzz #4802 test case

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321488 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-27 11:36:18 +00:00