From 67d98916900a68b5902428e39f9c865c8d02c1bf Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 14 Jan 2011 01:33:40 +0000 Subject: [PATCH] Set the insertion point correctly for instructions generated by load folding: they should go *before* the new instruction not after it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123420 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 4ac3257ecbe..6a999c2dc9f 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -890,10 +890,10 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) { if (Inst != Begin) BeforeInst = llvm::prior(llvm::prior(BI)); if (BeforeInst && isa(BeforeInst) && - BeforeInst->hasOneUse() && *BeforeInst->use_begin() == Inst && - TryToFoldFastISelLoad(cast(BeforeInst), FastIS)) { - // If we succeeded, don't re-select the load. - --BI; + BeforeInst->hasOneUse() && *BeforeInst->use_begin() == Inst) { + FastIS->recomputeInsertPt(); + if (TryToFoldFastISelLoad(cast(BeforeInst), FastIS)) + --BI; // If we succeeded, don't re-select the load. } continue; }