aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStuart Hastings <stuart@apple.com>2010-04-28 00:35:10 +0000
committerStuart Hastings <stuart@apple.com>2010-04-28 00:35:10 +0000
commit5a6a65be468b23fb345211658d935a297fc29245 (patch)
tree2617c4e4b38872f6b4e898b3a2b4fa636a9555e1
parent2d4b8ee1d9b49bfb30afb44e0ed7abccaea2093c (diff)
downloadexternal_llvm-5a6a65be468b23fb345211658d935a297fc29245.zip
external_llvm-5a6a65be468b23fb345211658d935a297fc29245.tar.gz
external_llvm-5a6a65be468b23fb345211658d935a297fc29245.tar.bz2
Tweak x86 INC/DEC generation to look for CopyToReg or SETCC. Radar 7866163.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102477 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index 2766818..58f1d88 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -5918,15 +5918,20 @@ SDValue X86TargetLowering::EmitTest(SDValue Op, unsigned X86CC,
unsigned NumOperands = 0;
switch (Op.getNode()->getOpcode()) {
case ISD::ADD:
- // Due to an isel shortcoming, be conservative if this add is likely to
- // be selected as part of a load-modify-store instruction. When the root
- // node in a match is a store, isel doesn't know how to remap non-chain
- // non-flag uses of other nodes in the match, such as the ADD in this
- // case. This leads to the ADD being left around and reselected, with
- // the result being two adds in the output.
+ // Due to an isel shortcoming, be conservative if this add is
+ // likely to be selected as part of a load-modify-store
+ // instruction. When the root node in a match is a store, isel
+ // doesn't know how to remap non-chain non-flag uses of other
+ // nodes in the match, such as the ADD in this case. This leads
+ // to the ADD being left around and reselected, with the result
+ // being two adds in the output. Alas, even if none our users
+ // are stores, that doesn't prove we're O.K. Ergo, if we have
+ // any parents that aren't CopyToReg or SETCC, eschew INC/DEC.
+ // A better fix seems to require climbing the DAG back to the
+ // root, and it doesn't seem to be worth the effort.
for (SDNode::use_iterator UI = Op.getNode()->use_begin(),
- UE = Op.getNode()->use_end(); UI != UE; ++UI)
- if (UI->getOpcode() == ISD::STORE)
+ UE = Op.getNode()->use_end(); UI != UE; ++UI)
+ if (UI->getOpcode() != ISD::CopyToReg && UI->getOpcode() != ISD::SETCC)
goto default_case;
if (ConstantSDNode *C =
dyn_cast<ConstantSDNode>(Op.getNode()->getOperand(1))) {