diff options
author | Chris Lattner <sabre@nondot.org> | 2005-12-07 18:02:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-12-07 18:02:05 +0000 |
commit | 57c882edf8eb35e383bf920b4766763b6feaab48 (patch) | |
tree | 2c2de1950d7ab209f8ff4bf792eb09742c6c8b61 /llvm/lib/CodeGen | |
parent | 3225733e65246d55b53aae624038075639059b7f (diff) | |
download | bcm5719-llvm-57c882edf8eb35e383bf920b4766763b6feaab48.tar.gz bcm5719-llvm-57c882edf8eb35e383bf920b4766763b6feaab48.zip |
Only transform (sext (truncate x)) -> (sextinreg x) if before legalize or
if the target supports the resultant sextinreg
llvm-svn: 24632
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index b7f6853f74c..7adfecb2220 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1547,7 +1547,9 @@ SDOperand DAGCombiner::visitSIGN_EXTEND(SDNode *N) { if (N0.getOpcode() == ISD::SEXTLOAD && VT == N0.getValueType()) return N0; // fold (sext (truncate x)) -> (sextinreg x) iff x size == sext size. - if (N0.getOpcode() == ISD::TRUNCATE && N0.getOperand(0).getValueType() == VT) + if (N0.getOpcode() == ISD::TRUNCATE && N0.getOperand(0).getValueType() == VT&& + (!AfterLegalize || + TLI.isOperationLegal(ISD::SIGN_EXTEND_INREG, N0.getValueType()))) return DAG.getNode(ISD::SIGN_EXTEND_INREG, VT, N0.getOperand(0), DAG.getValueType(N0.getValueType())); // fold (sext (load x)) -> (sextload x) |