llvm.org GIT mirror llvm / cfe9240
DAG Combiner: Fold SelectCC When Cond is UNDEF In case folding a node end up with a NaN as operand for the select, the folding of the condition of the selectcc node returns "UNDEF". Differential Revision: http://reviews.llvm.org/D6889 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225952 91177308-0d34-0410-b5e6-96231b3b80d8 Mehdi Amini 5 years ago
1 changed file(s) with 7 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
50995099 return N2; // cond always true -> true val
51005100 else
51015101 return N3; // cond always false -> false val
5102 }
5103
5104 // Fold to a simpler select_cc
5105 if (SCC.getOpcode() == ISD::SETCC)
5102 } else if (SCC->getOpcode() == ISD::UNDEF) {
5103 // When the condition is UNDEF, just return the first operand. This is
5104 // coherent the DAG creation, no setcc node is created in this case
5105 return N2;
5106 } else if (SCC.getOpcode() == ISD::SETCC) {
5107 // Fold to a simpler select_cc
51065108 return DAG.getNode(ISD::SELECT_CC, SDLoc(N), N2.getValueType(),
51075109 SCC.getOperand(0), SCC.getOperand(1), N2, N3,
51085110 SCC.getOperand(2));
5111 }
51095112 }
51105113
51115114 // If we can fold this based on the true/false value, do so.