Skip to content

Commit aa88765

Browse files
author
Evan Cheng
committed
Revert 66358 for now. It's breaking povray, 450.soplex, and 456.hmmer on x86 / Darwin.
llvm-svn: 66574
1 parent 79cf603 commit aa88765

File tree

3 files changed

+5
-68
lines changed

3 files changed

+5
-68
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414

1515
#define DEBUG_TYPE "dagcombine"
1616
#include "llvm/CodeGen/SelectionDAG.h"
17-
#include "llvm/DerivedTypes.h"
1817
#include "llvm/CodeGen/MachineFunction.h"
1918
#include "llvm/CodeGen/MachineFrameInfo.h"
20-
#include "llvm/CodeGen/PseudoSourceValue.h"
2119
#include "llvm/Analysis/AliasAnalysis.h"
2220
#include "llvm/Target/TargetData.h"
2321
#include "llvm/Target/TargetFrameInfo.h"
@@ -2893,7 +2891,8 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) {
28932891
return DAG.getNode(ISD::SELECT_CC, N->getDebugLoc(), VT,
28942892
N0.getOperand(0), N0.getOperand(1),
28952893
N1, N2, N0.getOperand(2));
2896-
return SimplifySelect(N->getDebugLoc(), N0, N1, N2);
2894+
else
2895+
return SimplifySelect(N->getDebugLoc(), N0, N1, N2);
28972896
}
28982897

28992898
return SDValue();
@@ -5676,14 +5675,9 @@ bool DAGCombiner::SimplifySelectOps(SDNode *TheSelect, SDValue LHS,
56765675
return false;
56775676
}
56785677

5679-
/// SimplifySelectCC - Simplify an expression of the form (N0 cond N1) ? N2 : N3
5680-
/// where 'cond' is the comparison specified by CC.
56815678
SDValue DAGCombiner::SimplifySelectCC(DebugLoc DL, SDValue N0, SDValue N1,
56825679
SDValue N2, SDValue N3,
56835680
ISD::CondCode CC, bool NotExtCompare) {
5684-
// (x ? y : y) -> y.
5685-
if (N2 == N3) return N2;
5686-
56875681
MVT VT = N2.getValueType();
56885682
ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1.getNode());
56895683
ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(N2.getNode());
@@ -5719,51 +5713,6 @@ SDValue DAGCombiner::SimplifySelectCC(DebugLoc DL, SDValue N0, SDValue N1,
57195713
return DAG.getNode(ISD::FABS, DL, VT, N3);
57205714
}
57215715
}
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-
}
57675716

57685717
// Check to see if we can perform the "gzip trick", transforming
57695718
// (select_cc setlt X, 0, A, 0) -> (and (sra X, (sub size(X), 1), A)
Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +0,0 @@
1-
; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah | not grep xmm
2-
; This should do a single load into the fp stack for the return, not diddle with xmm registers.
3-
4-
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
5-
target triple = "i386-apple-darwin7"
6-
7-
define float @f(i32 %x) nounwind readnone {
8-
entry:
9-
%0 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
10-
%iftmp.0.0 = select i1 %0, float 4.200000e+01, float 2.300000e+01
11-
ret float %iftmp.0.0
12-
}

llvm/test/CodeGen/X86/pic-cpool.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
; RUN: -o %t -f
33
; RUN: grep _GLOBAL_OFFSET_TABLE_ %t
44
; RUN: grep piclabel %t | count 3
5-
; RUN: grep GOTOFF %t | count 1
6-
; RUN: grep CPI %t | count 2
5+
; RUN: grep GOTOFF %t | count 2
6+
; RUN: grep CPI %t | count 4
77

8-
define double @foo(i32 %a.u) nounwind {
8+
define double @foo(i32 %a.u) {
99
entry:
1010
%tmp = icmp eq i32 %a.u,0
1111
%retval = select i1 %tmp, double 4.561230e+02, double 1.234560e+02

0 commit comments

Comments
 (0)