Set the insertion point correctly for instructions generated by load folding:

they should go *before* the new instruction not after it. 

llvm-svn: 123420
This commit is contained in:
Chris Lattner 2011-01-14 01:33:40 +00:00
parent c0767e029d
commit 3be81e9bd7
1 changed files with 4 additions and 4 deletions

View File

@ -890,10 +890,10 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
if (Inst != Begin)
BeforeInst = llvm::prior(llvm::prior(BI));
if (BeforeInst && isa<LoadInst>(BeforeInst) &&
BeforeInst->hasOneUse() && *BeforeInst->use_begin() == Inst &&
TryToFoldFastISelLoad(cast<LoadInst>(BeforeInst), FastIS)) {
// If we succeeded, don't re-select the load.
--BI;
BeforeInst->hasOneUse() && *BeforeInst->use_begin() == Inst) {
FastIS->recomputeInsertPt();
if (TryToFoldFastISelLoad(cast<LoadInst>(BeforeInst), FastIS))
--BI; // If we succeeded, don't re-select the load.
}
continue;
}