Skip to content

Commit 072467d

Browse files
author
John Criswell
committed
Merged in revision 1.60.
llvm-svn: 24160
1 parent 39a12ac commit 072467d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -963,14 +963,14 @@ SDOperand DAGCombiner::visitAND(SDNode *N) {
963963
DAG.getConstant(N1C->getValue()&N01C->getValue(), VT));
964964
}
965965
// fold (and (sign_extend_inreg x, i16 to i32), 1) -> (and x, 1)
966-
if (N0.getOpcode() == ISD::SIGN_EXTEND_INREG) {
966+
if (N1C && N0.getOpcode() == ISD::SIGN_EXTEND_INREG) {
967967
unsigned ExtendBits =
968968
MVT::getSizeInBits(cast<VTSDNode>(N0.getOperand(1))->getVT());
969-
if ((N1C->getValue() & (~0ULL << ExtendBits)) == 0)
969+
if (ExtendBits == 64 || (N1C->getValue() & (~0ULL << ExtendBits) == 0))
970970
return DAG.getNode(ISD::AND, VT, N0.getOperand(0), N1);
971971
}
972972
// fold (and (or x, 0xFFFF), 0xFF) -> 0xFF
973-
if (N0.getOpcode() == ISD::OR && N1C)
973+
if (N1C && N0.getOpcode() == ISD::OR)
974974
if (ConstantSDNode *ORI = dyn_cast<ConstantSDNode>(N0.getOperand(1)))
975975
if ((ORI->getValue() & N1C->getValue()) == N1C->getValue())
976976
return N1;
@@ -1031,7 +1031,7 @@ SDOperand DAGCombiner::visitAND(SDNode *N) {
10311031
return DAG.getNode(N0.getOpcode(), VT, ANDNode, N0.getOperand(1));
10321032
}
10331033
// fold (and (sra)) -> (and (srl)) when possible.
1034-
if (N0.getOpcode() == ISD::SRA && N0.Val->hasOneUse())
1034+
if (N0.getOpcode() == ISD::SRA && N0.Val->hasOneUse()) {
10351035
if (ConstantSDNode *N01C = dyn_cast<ConstantSDNode>(N0.getOperand(1))) {
10361036
// If the RHS of the AND has zeros where the sign bits of the SRA will
10371037
// land, turn the SRA into an SRL.
@@ -1043,7 +1043,7 @@ SDOperand DAGCombiner::visitAND(SDNode *N) {
10431043
return SDOperand();
10441044
}
10451045
}
1046-
1046+
}
10471047
// fold (zext_inreg (extload x)) -> (zextload x)
10481048
if (N0.getOpcode() == ISD::EXTLOAD) {
10491049
MVT::ValueType EVT = cast<VTSDNode>(N0.getOperand(3))->getVT();

0 commit comments

Comments
 (0)