summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-05-08 17:29:49 +0000
committerChris Lattner <sabre@nondot.org>2006-05-08 17:29:49 +0000
commit2cfd6746ae4ab9dbfc25b025bc3e8bccddc47475 (patch)
treefd678773bcdf6b600f63cb16ffc221722456fb3c /lib/CodeGen
parent1b7371331fef3db77999b9c4ca62c2ddbaf1d804 (diff)
downloadllvm-2cfd6746ae4ab9dbfc25b025bc3e8bccddc47475.tar.gz
llvm-2cfd6746ae4ab9dbfc25b025bc3e8bccddc47475.tar.bz2
llvm-2cfd6746ae4ab9dbfc25b025bc3e8bccddc47475.tar.xz
Fold shifts with undef operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28167 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 60a749df2f..ca123f497e 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1439,11 +1439,14 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
case ISD::FSUB:
case ISD::FDIV:
case ISD::FREM:
+ case ISD::SRA:
return N1; // fold op(undef, arg2) -> undef
case ISD::UDIV:
case ISD::SDIV:
case ISD::UREM:
case ISD::SREM:
+ case ISD::SRL:
+ case ISD::SHL:
return getConstant(0, VT); // fold op(undef, arg2) -> 0
}
}
@@ -1467,9 +1470,13 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
return N2; // fold op(arg1, undef) -> undef
case ISD::MUL:
case ISD::AND:
+ case ISD::SRL:
+ case ISD::SHL:
return getConstant(0, VT); // fold op(arg1, undef) -> 0
case ISD::OR:
return getConstant(MVT::getIntVTBitMask(VT), VT);
+ case ISD::SRA:
+ return N1;
}
}