diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-01-07 19:09:40 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-01-07 19:09:40 +0000 |
commit | 998180dad3e007f7ad53836fbc4c4b42f39140d4 (patch) | |
tree | 7be06a58e84396bf4895bb02ff7f2db101ef4258 /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | c1ec57c3e236b620ce0ebeb7773c429fb579d938 (diff) | |
download | bcm5719-llvm-998180dad3e007f7ad53836fbc4c4b42f39140d4.tar.gz bcm5719-llvm-998180dad3e007f7ad53836fbc4c4b42f39140d4.zip |
[DAG] Fix for Bug PR34620 - Allow SimplifyDemandedBits to look through bitcasts
Allow SimplifyDemandedBits to use TargetLoweringOpt::computeKnownBits to look through bitcasts. This can help simplifying in some cases where bitcasts of constants generated during or after legalization can't be folded away, and thus didn't get picked up by SimplifyDemandedBits. This fixes PR34620, where a redundant pand created during legalization from lowering and lshr <16xi8> wasn't being simplified due to the presence of a bitcasted build_vector as an operand.
Committed on the behalf of @sameconrad (Sam Conrad)
Differential Revision: https://reviews.llvm.org/D41643
llvm-svn: 321969
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index d76e52d7887..b8bfec19481 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1220,6 +1220,12 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op, Sign, ShAmt)); } } + // If this is a bitcast, let computeKnownBits handle it. Only do this on a + // recursive call where Known may be useful to the caller. + if (Depth > 0) { + TLO.DAG.computeKnownBits(Op, Known, Depth); + return false; + } break; case ISD::ADD: case ISD::MUL: |