diff options
author | Evan Cheng <evan.cheng@apple.com> | 2012-03-06 23:33:32 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2012-03-06 23:33:32 +0000 |
commit | 80893ce5f517f416d96313b74d416adfd41aaf08 (patch) | |
tree | 6cbd22f941848f5db1ef862a1d58cd6579cf0704 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 297e69f15e501efdbcb8063ab25496144742cd89 (diff) | |
download | bcm5719-llvm-80893ce5f517f416d96313b74d416adfd41aaf08.tar.gz bcm5719-llvm-80893ce5f517f416d96313b74d416adfd41aaf08.zip |
Extend r148086 to check for [r +/- reg] address mode. This fixes queens performance regression (due to increased register pressure from overly aggressive pre-inc formation).
llvm-svn: 152162
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index b55d84cab89..2532c123ba3 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -6142,8 +6142,7 @@ SDValue DAGCombiner::visitBR_CC(SDNode *N) { /// canFoldInAddressingMode - Return true if 'Use' is a load or a store that /// uses N as its base pointer and that N may be folded in the load / store -/// addressing mode. FIXME: This currently only looks for folding of -/// [reg +/- imm] addressing modes. +/// addressing mode. static bool canFoldInAddressingMode(SDNode *N, SDNode *Use, SelectionDAG &DAG, const TargetLowering &TLI) { @@ -6163,15 +6162,19 @@ static bool canFoldInAddressingMode(SDNode *N, SDNode *Use, if (N->getOpcode() == ISD::ADD) { ConstantSDNode *Offset = dyn_cast<ConstantSDNode>(N->getOperand(1)); if (Offset) + // [reg +/- imm] AM.BaseOffs = Offset->getSExtValue(); else - return false; + // [reg +/- reg] + AM.Scale = 1; } else if (N->getOpcode() == ISD::SUB) { ConstantSDNode *Offset = dyn_cast<ConstantSDNode>(N->getOperand(1)); if (Offset) + // [reg +/- imm] AM.BaseOffs = -Offset->getSExtValue(); else - return false; + // [reg +/- reg] + AM.Scale = 1; } else return false; |