Fix CodeGen/PowerPC/2006-12-07-SelectCrash.ll on PPC64
authorChris Lattner <sabre@nondot.org>
Thu, 7 Dec 2006 22:36:47 +0000 (22:36 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 7 Dec 2006 22:36:47 +0000 (22:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32336 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index b8439a62beef8e49647b693f2c60ea0d4835dc16..4b7c494781f7779bb5a84075f75153c33179894b 100644 (file)
@@ -3755,7 +3755,10 @@ SDOperand DAGCombiner::SimplifySelectCC(SDOperand N0, SDOperand N1,
     // cast from setcc result type to select result type
     if (AfterLegalize) {
       SCC  = DAG.getSetCC(TLI.getSetCCResultTy(), N0, N1, CC);
-      Temp = DAG.getZeroExtendInReg(SCC, N2.getValueType());
+      if (N2.getValueType() < SCC.getValueType())
+        Temp = DAG.getZeroExtendInReg(SCC, N2.getValueType());
+      else
+        Temp = DAG.getNode(ISD::ZERO_EXTEND, N2.getValueType(), SCC);
     } else {
       SCC  = DAG.getSetCC(MVT::i1, N0, N1, CC);
       Temp = DAG.getNode(ISD::ZERO_EXTEND, N2.getValueType(), SCC);