[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Chris Lattner
sabre at nondot.org
Fri May 18 17:44:04 PDT 2007
Changes in directory llvm/lib/CodeGen/SelectionDAG:
TargetLowering.cpp updated: 1.116 -> 1.117
---
Log message:
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.
---
Diffs of the changes: (+1 -1)
TargetLowering.cpp | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.116 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.117
--- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.116 Fri May 18 12:52:13 2007
+++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri May 18 19:43:44 2007
@@ -1785,7 +1785,7 @@
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(),
More information about the llvm-commits
mailing list