diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-05-03 23:52:19 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-05-03 23:52:19 +0000 |
commit | a7d4a04d244c5a8c6364af2e39a512ec6b9600a2 (patch) | |
tree | 1334dd4c8fd4e8f9e918759e35e8f3fefa5d1a4a /lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | bdc9869dbfa40579236405db73897a9fd19d1ed0 (diff) |
Don't create indexed load / store with zero offset!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36716 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 5977e88ee1..8396e45be3 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -3110,6 +3110,10 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) { ISD::MemIndexedMode AM = ISD::UNINDEXED; if (!TLI.getPreIndexedAddressParts(N, BasePtr, Offset, AM, DAG)) return false; + // Don't create a indexed load / store with zero offset. + if (isa<ConstantSDNode>(Offset) && + cast<ConstantSDNode>(Offset)->getValue() == 0) + return false; // Try turning it into a pre-indexed load / store except when: // 1) The base is a frame index. @@ -3239,6 +3243,10 @@ bool DAGCombiner::CombineToPostIndexedLoadStore(SDNode *N) { std::swap(BasePtr, Offset); if (Ptr != BasePtr) continue; + // Don't create a indexed load / store with zero offset. + if (isa<ConstantSDNode>(Offset) && + cast<ConstantSDNode>(Offset)->getValue() == 0) + continue; // Try turning it into a post-indexed load / store except when // 1) All uses are load / store ops that use it as base ptr. |