Skip to content

Commit

Permalink
[DAGCombine] visitTRUNCATE - remove GetDemandedBits call
Browse files Browse the repository at this point in the history
rL368553 added SimplifyMultipleUseDemandedBits handling for ISD::TRUNCATE to SimplifyDemandedBits so we don't need to duplicate this (and it gets rid of another GetDemandedBits call which is slowly being replaced with SimplifyMultipleUseDemandedBits anyhow).
  • Loading branch information
RKSimon committed May 2, 2020
1 parent 9e194a3 commit 8e05ac0
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Expand Up @@ -11112,18 +11112,6 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
}
}

// See if we can simplify the input to this truncate through knowledge that
// only the low bits are being used.
// For example "trunc (or (shl x, 8), y)" // -> trunc y
// Currently we only perform this optimization on scalars because vectors
// may have different active low bits.
if (!VT.isVector()) {
APInt Mask =
APInt::getLowBitsSet(N0.getValueSizeInBits(), VT.getSizeInBits());
if (SDValue Shorter = DAG.GetDemandedBits(N0, Mask))
return DAG.getNode(ISD::TRUNCATE, SDLoc(N), VT, Shorter);
}

// fold (truncate (load x)) -> (smaller load x)
// fold (truncate (srl (load x), c)) -> (smaller load (x+c/evtbits))
if (!LegalTypes || TLI.isTypeDesirableForOp(N0.getOpcode(), VT)) {
Expand Down

0 comments on commit 8e05ac0

Please sign in to comment.