|
14 | 14 |
|
15 | 15 | #define DEBUG_TYPE "dagcombine"
|
16 | 16 | #include "llvm/CodeGen/SelectionDAG.h"
|
17 |
| -#include "llvm/DerivedTypes.h" |
18 | 17 | #include "llvm/CodeGen/MachineFunction.h"
|
19 | 18 | #include "llvm/CodeGen/MachineFrameInfo.h"
|
20 |
| -#include "llvm/CodeGen/PseudoSourceValue.h" |
21 | 19 | #include "llvm/Analysis/AliasAnalysis.h"
|
22 | 20 | #include "llvm/Target/TargetData.h"
|
23 | 21 | #include "llvm/Target/TargetFrameInfo.h"
|
@@ -2893,7 +2891,8 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) {
|
2893 | 2891 | return DAG.getNode(ISD::SELECT_CC, N->getDebugLoc(), VT,
|
2894 | 2892 | N0.getOperand(0), N0.getOperand(1),
|
2895 | 2893 | N1, N2, N0.getOperand(2));
|
2896 |
| - return SimplifySelect(N->getDebugLoc(), N0, N1, N2); |
| 2894 | + else |
| 2895 | + return SimplifySelect(N->getDebugLoc(), N0, N1, N2); |
2897 | 2896 | }
|
2898 | 2897 |
|
2899 | 2898 | return SDValue();
|
@@ -5676,14 +5675,9 @@ bool DAGCombiner::SimplifySelectOps(SDNode *TheSelect, SDValue LHS,
|
5676 | 5675 | return false;
|
5677 | 5676 | }
|
5678 | 5677 |
|
5679 |
| -/// SimplifySelectCC - Simplify an expression of the form (N0 cond N1) ? N2 : N3 |
5680 |
| -/// where 'cond' is the comparison specified by CC. |
5681 | 5678 | SDValue DAGCombiner::SimplifySelectCC(DebugLoc DL, SDValue N0, SDValue N1,
|
5682 | 5679 | SDValue N2, SDValue N3,
|
5683 | 5680 | ISD::CondCode CC, bool NotExtCompare) {
|
5684 |
| - // (x ? y : y) -> y. |
5685 |
| - if (N2 == N3) return N2; |
5686 |
| - |
5687 | 5681 | MVT VT = N2.getValueType();
|
5688 | 5682 | ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1.getNode());
|
5689 | 5683 | ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(N2.getNode());
|
@@ -5719,51 +5713,6 @@ SDValue DAGCombiner::SimplifySelectCC(DebugLoc DL, SDValue N0, SDValue N1,
|
5719 | 5713 | return DAG.getNode(ISD::FABS, DL, VT, N3);
|
5720 | 5714 | }
|
5721 | 5715 | }
|
5722 |
| - |
5723 |
| - // Turn "(a cond b) ? 1.0f : 2.0f" into "load (tmp + ((a cond b) ? 0 : 4)" |
5724 |
| - // where "tmp" is a constant pool entry containing an array with 1.0 and 2.0 |
5725 |
| - // in it. This is a win when the constant is not otherwise available because |
5726 |
| - // it replaces two constant pool loads with one. We only do this if the FP |
5727 |
| - // type is known to be legal, because if it isn't, then we are before legalize |
5728 |
| - // types an we want the other legalization to happen first (e.g. to avoid |
5729 |
| - // messing with soft float). |
5730 |
| - if (ConstantFPSDNode *TV = dyn_cast<ConstantFPSDNode>(N2)) |
5731 |
| - if (ConstantFPSDNode *FV = dyn_cast<ConstantFPSDNode>(N3)) { |
5732 |
| - if (TLI.isTypeLegal(N2.getValueType()) && |
5733 |
| - // If both constants have multiple uses, then we won't need to do an |
5734 |
| - // extra load, they are likely around in registers for other users. |
5735 |
| - (TV->hasOneUse() || FV->hasOneUse())) { |
5736 |
| - Constant *Elts[] = { |
5737 |
| - const_cast<ConstantFP*>(FV->getConstantFPValue()), |
5738 |
| - const_cast<ConstantFP*>(TV->getConstantFPValue()) |
5739 |
| - }; |
5740 |
| - // Create a ConstantArray of the two constants. |
5741 |
| - Constant *CA = |
5742 |
| - ConstantArray::get(ArrayType::get(Elts[0]->getType(), 2), Elts, 2); |
5743 |
| - SDValue CPIdx = DAG.getConstantPool(CA, TLI.getPointerTy()); |
5744 |
| - unsigned Alignment = |
5745 |
| - 1 << cast<ConstantPoolSDNode>(CPIdx)->getAlignment(); |
5746 |
| - |
5747 |
| - // Get the offsets to the 0 and 1 element of the array so that we can |
5748 |
| - // select between them. |
5749 |
| - SDValue Zero = DAG.getIntPtrConstant(0); |
5750 |
| - unsigned EltSize = |
5751 |
| - (unsigned)TLI.getTargetData()->getTypePaddedSize(Elts[0]->getType()); |
5752 |
| - SDValue One = DAG.getIntPtrConstant(EltSize); |
5753 |
| - |
5754 |
| - SDValue Cond = DAG.getSetCC(DL, |
5755 |
| - TLI.getSetCCResultType(N0.getValueType()), |
5756 |
| - N0, N1, CC); |
5757 |
| - SDValue CstOffset = DAG.getNode(ISD::SELECT, DL, Zero.getValueType(), |
5758 |
| - Cond, One, Zero); |
5759 |
| - CPIdx = DAG.getNode(ISD::ADD, DL, TLI.getPointerTy(), CPIdx, |
5760 |
| - CstOffset); |
5761 |
| - return DAG.getLoad(TV->getValueType(0), DL, DAG.getEntryNode(), CPIdx, |
5762 |
| - PseudoSourceValue::getConstantPool(), 0, false, |
5763 |
| - Alignment); |
5764 |
| - |
5765 |
| - } |
5766 |
| - } |
5767 | 5716 |
|
5768 | 5717 | // Check to see if we can perform the "gzip trick", transforming
|
5769 | 5718 | // (select_cc setlt X, 0, A, 0) -> (and (sra X, (sub size(X), 1), A)
|
|
0 commit comments