diff options
author | Manman Ren <mren@apple.com> | 2012-08-31 23:16:57 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2012-08-31 23:16:57 +0000 |
commit | 26c5d0f60709cf82bdc7b762fa7a9edb8f960c55 (patch) | |
tree | 622bee36726c66896dc5e7a86e5aa7d00106364f /llvm/lib/Target/X86/X86ISelLowering.cpp | |
parent | 908e685102cbdfa8a7caeb77a6f0ac1da3fa0ebf (diff) | |
download | bcm5719-llvm-26c5d0f60709cf82bdc7b762fa7a9edb8f960c55.tar.gz bcm5719-llvm-26c5d0f60709cf82bdc7b762fa7a9edb8f960c55.zip |
SelectionDAG: when constructing VZEXT_LOAD from other loads, make sure its
output chain is correctly setup.
As an example, if the original load must happen before later stores, we need
to make sure the constructed VZEXT_LOAD is constrained to be before the stores.
rdar://11457792
llvm-svn: 163036
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index f4329d3bf9d..2d84860610c 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -4977,6 +4977,18 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, SmallVectorImpl<SDValue> &Elts, LDBase->getAlignment(), false/*isVolatile*/, true/*ReadMem*/, false/*WriteMem*/); + + // Make sure the newly-created LOAD is in the same position as LDBase in + // terms of dependency. We create a TokenFactor for LDBase and ResNode, and + // update uses of LDBase's output chain to use the TokenFactor. + if (LDBase->hasAnyUseOfValue(1)) { + SDValue NewChain = DAG.getNode(ISD::TokenFactor, DL, MVT::Other, + SDValue(LDBase, 1), SDValue(ResNode.getNode(), 1)); + DAG.ReplaceAllUsesOfValueWith(SDValue(LDBase, 1), NewChain); + DAG.UpdateNodeOperands(NewChain.getNode(), SDValue(LDBase, 1), + SDValue(ResNode.getNode(), 1)); + } + return DAG.getNode(ISD::BITCAST, DL, VT, ResNode); } return SDValue(); |