mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-01 16:26:29 +00:00
Fold (zext (and x, cst)) -> (and (zext x), cst).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91380 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3202,6 +3202,19 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
|
||||
X, DAG.getConstant(Mask, VT));
|
||||
}
|
||||
|
||||
// Fold (zext (and x, cst)) -> (and (zext x), cst)
|
||||
if (N0.getOpcode() == ISD::AND &&
|
||||
N0.getOperand(1).getOpcode() == ISD::Constant &&
|
||||
N0.getOperand(0).getOpcode() != ISD::TRUNCATE &&
|
||||
N0.getOperand(0).hasOneUse()) {
|
||||
APInt Mask = cast<ConstantSDNode>(N0.getOperand(1))->getAPIntValue();
|
||||
Mask.zext(VT.getSizeInBits());
|
||||
return DAG.getNode(ISD::AND, N->getDebugLoc(), VT,
|
||||
DAG.getNode(ISD::ZERO_EXTEND, N->getDebugLoc(), VT,
|
||||
N0.getOperand(0)),
|
||||
DAG.getConstant(Mask, VT));
|
||||
}
|
||||
|
||||
// fold (zext (load x)) -> (zext (truncate (zextload x)))
|
||||
if (ISD::isNON_EXTLoad(N0.getNode()) &&
|
||||
((!LegalOperations && !cast<LoadSDNode>(N0)->isVolatile()) ||
|
||||
|
Reference in New Issue
Block a user