diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-10-05 04:45:43 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-10-05 04:45:43 +0000 |
| commit | 91559026d346747886bb4a5a686b29d64efdd640 (patch) | |
| tree | 02aac7815dd1a5a12ba16d7a99ab94a95fb3d0ac /lib/CodeGen | |
| parent | 0cb09f1a7a1bc605b5e45595ed3655e479a9c06c (diff) | |
Fix a crash compiling Olden/tsp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23630 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
| -rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 19c61a5d26..9f83673351 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1069,18 +1069,16 @@ SDOperand DAGCombiner::visitSELECT_CC(SDNode *N) { // Determine if the condition we're dealing with is constant SDOperand SCC = SimplifySetCC(TLI.getSetCCResultTy(), N0, N1, CC); - ConstantSDNode *SCCC = dyn_cast<ConstantSDNode>(SCC); - bool constTrue = SCCC && SCCC->getValue() == 1; - bool constFalse = SCCC && SCCC->isNullValue(); - + ConstantSDNode *SCCC = dyn_cast_or_null<ConstantSDNode>(SCC.Val); + // fold select_cc lhs, rhs, x, x, cc -> x if (N2 == N3) return N2; // fold select_cc true, x, y -> x - if (constTrue) + if (SCCC && SCCC->getValue()) return N2; // fold select_cc false, x, y -> y - if (constFalse) + if (SCCC && SCCC->getValue() == 0) return N3; // fold select_cc into other things, such as min/max/abs return SimplifySelectCC(N0, N1, N2, N3, CC); |
