diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-12-01 12:08:55 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-12-01 12:08:55 +0000 |
commit | e017ed32450573c16e981b91e16a883299fee59a (patch) | |
tree | afaa1f7a4e237f62145dd9384a5d029ac10ce9ca /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | 0c5d6ccbfc089b3335a78d910febff44c3dd622c (diff) | |
download | bcm5719-llvm-e017ed32450573c16e981b91e16a883299fee59a.tar.gz bcm5719-llvm-e017ed32450573c16e981b91e16a883299fee59a.zip |
[SelectionDAG] Improve SimplifyDemandedBits to SimplifyDemandedVectorElts simplification
D52935 introduced the ability for SimplifyDemandedBits to call SimplifyDemandedVectorElts through BITCASTs if the demanded bit mask entirely covered the sub element.
This patch relaxes this to demanding an element if we need any bit from it.
Differential Revision: https://reviews.llvm.org/D54761
llvm-svn: 348073
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 0a7ba894866..3ad71d5677e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1248,8 +1248,8 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op, TLO.DAG.getNode(ISD::SHL, dl, VT, Sign, ShAmt)); } } - // If bitcast from a vector and the mask covers entire elements, see if we - // can use SimplifyDemandedVectorElts. + // If bitcast from a vector, see if we can use SimplifyDemandedVectorElts by + // demanding the element if any bits from it are demanded. // TODO - bigendian once we have test coverage. // TODO - bool vectors once SimplifyDemandedVectorElts has SETCC support. if (SrcVT.isVector() && NumSrcEltBits > 1 && @@ -1261,10 +1261,8 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op, for (unsigned i = 0; i != Scale; ++i) { unsigned Offset = i * NumSrcEltBits; APInt Sub = DemandedBits.extractBits(NumSrcEltBits, Offset); - if (Sub.isAllOnesValue()) + if (!Sub.isNullValue()) DemandedSubElts.setBit(i); - else if (!Sub.isNullValue()) - return false; } return true; }; |