Don't generate ordered or unordered comparison operations if it is not legal to do so.
authorMicah Villmow <villmow@gmail.com>
Tue, 31 Jul 2012 16:48:03 +0000 (16:48 +0000)
committerMicah Villmow <villmow@gmail.com>
Tue, 31 Jul 2012 16:48:03 +0000 (16:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161053 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/TargetLowering.cpp

index dff9b2c36abc962f88989c50b58264420d14b985..172819369df51bc6f837df3c738600945aff47fd 100644 (file)
@@ -2464,7 +2464,8 @@ TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
     // Otherwise, we can't fold it.  However, we can simplify it to SETUO/SETO
     // if it is not already.
     ISD::CondCode NewCond = UOF == 0 ? ISD::SETO : ISD::SETUO;
-    if (NewCond != Cond)
+    if (NewCond != Cond && (DCI.isBeforeLegalizeOps() 
+        || getCondCodeAction(NewCond, N0.getValueType()) == Legal))
       return DAG.getSetCC(dl, VT, N0, N1, NewCond);
   }