[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Dec 7 10:02:16 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.63 -> 1.64
---
Log message:

Only transform (sext (truncate x)) -> (sextinreg x) if before legalize or
if the target supports the resultant sextinreg


---
Diffs of the changes:  (+3 -1)

 DAGCombiner.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.63 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.64
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.63	Wed Dec  7 01:11:03 2005
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Wed Dec  7 12:02:05 2005
@@ -1547,7 +1547,9 @@
   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)






More information about the llvm-commits mailing list