aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2005-04-12 23:12:17 +0000
committerNate Begeman <natebegeman@mac.com>2005-04-12 23:12:17 +0000
commitb882752bd04602249d391699dc7183de007f8964 (patch)
treecb91088cbb4b4e3a16be13e9663b584184a03d2d /lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent9765c25eb775e223612cd996d78a5a141360dabf (diff)
Fold shift by size larger than type size to undef
Make llvm undef values generate ISD::UNDEF nodes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21261 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 634197c0f9..613d0983ad 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -755,19 +755,12 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
case ISD::SHL:
case ISD::SRL:
- // If the shift amount is bigger than the size of the data, simplify.
+ case ISD::SRA:
+ // If the shift amount is bigger than the size of the data, then all the
+ // bits are shifted out. Simplify to loading constant zero.
if (C2 >= MVT::getSizeInBits(N1.getValueType())) {
- if (TLI.getShiftAmountFlavor() == TargetLowering::Mask) {
- unsigned NewAmt =
- C2 & ((1 << MVT::getSizeInBits(N1.getValueType()))-1);
- return getNode(Opcode, VT, N1, getConstant(NewAmt,N2.getValueType()));
- } else if (TLI.getShiftAmountFlavor() == TargetLowering::Extend) {
- // Shifting all of the bits out?
- return getConstant(0, N1.getValueType());
- }
+ return getNode(ISD::UNDEF, N1.getValueType());
}
- // FALL THROUGH.
- case ISD::SRA:
if (C2 == 0) return N1;
break;