diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2006-11-09 19:10:46 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2006-11-09 19:10:46 +0000 |
| commit | 6878378390519acc868d48733bfc59b3ec2298f8 (patch) | |
| tree | 5828830777a3e1dd24edced429b6251d533ac8d8 /llvm/lib/CodeGen | |
| parent | d550248f2cddc3a2560675e56f3a9b1278996102 (diff) | |
| download | bcm5719-llvm-6878378390519acc868d48733bfc59b3ec2298f8.tar.gz bcm5719-llvm-6878378390519acc868d48733bfc59b3ec2298f8.zip | |
Don't attempt expensive pre-/post- indexed dag combine if target does not support them.
llvm-svn: 31598
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 8bbcd2651ca..b74de8e843b 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -190,9 +190,18 @@ namespace { bool isLoad = true; SDOperand Ptr; + MVT::ValueType VT; if (LoadSDNode *LD = dyn_cast<LoadSDNode>(N)) { + VT = LD->getLoadedVT(); + if (!TLI.isIndexedLoadLegal(ISD::PRE_INC, VT) && + !TLI.isIndexedLoadLegal(ISD::PRE_DEC, VT)) + return false; Ptr = LD->getBasePtr(); } else if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N)) { + VT = ST->getStoredVT(); + if (!TLI.isIndexedStoreLegal(ISD::PRE_INC, VT) && + !TLI.isIndexedStoreLegal(ISD::PRE_DEC, VT)) + return false; Ptr = ST->getBasePtr(); isLoad = false; } else @@ -281,8 +290,16 @@ namespace { SDOperand Ptr; MVT::ValueType VT; if (LoadSDNode *LD = dyn_cast<LoadSDNode>(N)) { + VT = LD->getLoadedVT(); + if (!TLI.isIndexedLoadLegal(ISD::POST_INC, VT) && + !TLI.isIndexedLoadLegal(ISD::POST_DEC, VT)) + return false; Ptr = LD->getBasePtr(); } else if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N)) { + VT = ST->getStoredVT(); + if (!TLI.isIndexedStoreLegal(ISD::POST_INC, VT) && + !TLI.isIndexedStoreLegal(ISD::POST_DEC, VT)) + return false; Ptr = ST->getBasePtr(); isLoad = false; } else @@ -299,7 +316,7 @@ namespace { SDOperand BasePtr; SDOperand Offset; ISD::MemIndexedMode AM = ISD::UNINDEXED; - if (TLI.getPostIndexedAddressParts(N, Op, BasePtr, Offset, AM,DAG)) { + if (TLI.getPostIndexedAddressParts(N, Op, BasePtr, Offset, AM, DAG)) { if (Ptr == Offset) std::swap(BasePtr, Offset); if (Ptr != BasePtr) |

