diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-08-06 14:30:42 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-08-06 14:30:42 +0000 |
commit | dae5ddad9d1954c44a51c4b7bc8be1a5fb61a203 (patch) | |
tree | ec9938d5ee736adb1dfa095b1335f6adea8f5cc4 /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | 5a0794327a6756ec904dfdc1d8015d510ee49526 (diff) | |
download | bcm5719-llvm-dae5ddad9d1954c44a51c4b7bc8be1a5fb61a203.tar.gz bcm5719-llvm-dae5ddad9d1954c44a51c4b7bc8be1a5fb61a203.zip |
[TargetLowering] SimplifyMultipleUseDemandedBits - return UNDEF for undemanded ops
If we demand no bits/elts from an Op, just return UNDEF
llvm-svn: 368043
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index d7427f48e4f..ce166058d35 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -569,9 +569,18 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits, SDValue TargetLowering::SimplifyMultipleUseDemandedBits( SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, SelectionDAG &DAG, unsigned Depth) const { - if (Depth >= 6) // Limit search depth. + // Limit search depth. + if (Depth >= 6) + return SDValue(); + + // Ignore UNDEFs. + if (Op.isUndef()) return SDValue(); + // Not demanding any bits/elts from Op. + if (DemandedBits == 0 || DemandedElts == 0) + return DAG.getUNDEF(Op.getValueType()); + unsigned NumElts = DemandedElts.getBitWidth(); KnownBits LHSKnown, RHSKnown; switch (Op.getOpcode()) { |