aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-04-23 19:10:30 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-04-23 19:10:30 +0000
commitcaf7740f96cdcd47b7ba7fc660b82e1f664363be (patch)
tree765fe36ab8b77273fe1cbb3c3e7ee394d04321d3 /lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parente3ff9ba40c1f0905941d8d696ce354b79031b144 (diff)
Code refactoring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102202 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index c6796be8f4..e586a23441 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -655,25 +655,26 @@ static SDValue PromoteOperand(SDValue Op, EVT PVT, SelectionDAG &DAG,
}
unsigned Opc = Op.getOpcode();
- if (Opc == ISD::AssertSext)
+ switch (Opc) {
+ default: break;
+ case ISD::AssertSext:
return DAG.getNode(ISD::AssertSext, dl, PVT,
SExtPromoteOperand(Op.getOperand(0), PVT, DAG, TLI),
Op.getOperand(1));
- else if (Opc == ISD::AssertZext)
+ case ISD::AssertZext:
return DAG.getNode(ISD::AssertZext, dl, PVT,
ZExtPromoteOperand(Op.getOperand(0), PVT, DAG, TLI),
Op.getOperand(1));
-
- unsigned ExtOpc = ISD::ANY_EXTEND;
- if (Opc == ISD::Constant)
- // Zero extend things like i1, sign extend everything else. It shouldn't
- // matter in theory which one we pick, but this tends to give better code?
- // See DAGTypeLegalizer::PromoteIntRes_Constant.
- ExtOpc =
+ case ISD::Constant: {
+ unsigned ExtOpc =
Op.getValueType().isByteSized() ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND;
- if (!TLI.isOperationLegal(ExtOpc, PVT))
+ return DAG.getNode(ExtOpc, dl, PVT, Op);
+ }
+ }
+
+ if (!TLI.isOperationLegal(ISD::ANY_EXTEND, PVT))
return SDValue();
- return DAG.getNode(ExtOpc, dl, PVT, Op);
+ return DAG.getNode(ISD::ANY_EXTEND, dl, PVT, Op);
}
static SDValue SExtPromoteOperand(SDValue Op, EVT PVT, SelectionDAG &DAG,