diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-19 00:43:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-19 00:43:44 +0000 |
commit | b08cbbd737e3b900a287e619f52bf0f593b6b7e7 (patch) | |
tree | 16c848d19de5b43aaca85ab67b3c62da4510dc14 /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | bde968823a888b9401987872d94c56b72107c476 (diff) | |
download | bcm5719-llvm-b08cbbd737e3b900a287e619f52bf0f593b6b7e7.tar.gz bcm5719-llvm-b08cbbd737e3b900a287e619f52bf0f593b6b7e7.zip |
Disable the (A == (B-A)) -> 2*A == B xform when the sub has multiple uses (in
this case, the xform introduces an extra operation). This compiles
PowerPC/compare-duplicate.ll into:
_test:
subf r2, r3, r4
cmplw cr0, r2, r3
bne cr0, LBB1_2 ;F
instead of:
_test:
slwi r2, r3, 1
subf r3, r3, r4
cmplw cr0, r4, r2
bne cr0, LBB1_2 ;F
This is target independent of course.
llvm-svn: 37246
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index a2cd12801dd..e5883f60c53 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1785,7 +1785,7 @@ TargetLowering::SimplifySetCC(MVT::ValueType VT, SDOperand N0, SDOperand N1, if (DAG.isCommutativeBinOp(N0.getOpcode())) return DAG.getSetCC(VT, N0.getOperand(0), DAG.getConstant(0, N0.getValueType()), Cond); - else { + else if (N0.Val->hasOneUse()) { assert(N0.getOpcode() == ISD::SUB && "Unexpected operation!"); // (Z-X) == X --> Z == X<<1 SDOperand SH = DAG.getNode(ISD::SHL, N1.getValueType(), |