@@ -342,7 +342,8 @@ class AlignVectors {
342342 MoveList createLoadGroups (const AddrList &Group) const ;
343343 MoveList createStoreGroups (const AddrList &Group) const ;
344344 bool moveTogether (MoveGroup &Move) const ;
345- template <typename T> InstMap cloneBefore (Instruction *To, T &&Insts) const ;
345+ template <typename T>
346+ InstMap cloneBefore (BasicBlock::iterator To, T &&Insts) const ;
346347
347348 void realignLoadGroup (IRBuilderBase &Builder, const ByteSpan &VSpan,
348349 int ScLen, Value *AlignVal, Value *AlignAddr) const ;
@@ -1046,7 +1047,7 @@ auto AlignVectors::moveTogether(MoveGroup &Move) const -> bool {
10461047 if (Move.IsLoad ) {
10471048 // Move all the loads (and dependencies) to where the first load is.
10481049 // Clone all deps to before Where, keeping order.
1049- Move.Clones = cloneBefore (Where, Move.Deps );
1050+ Move.Clones = cloneBefore (Where-> getIterator () , Move.Deps );
10501051 // Move all main instructions to after Where, keeping order.
10511052 ArrayRef<Instruction *> Main (Move.Main );
10521053 for (Instruction *M : Main) {
@@ -1067,7 +1068,7 @@ auto AlignVectors::moveTogether(MoveGroup &Move) const -> bool {
10671068 // Move all main instructions to before Where, inverting order.
10681069 ArrayRef<Instruction *> Main (Move.Main );
10691070 for (Instruction *M : Main.drop_front (1 )) {
1070- M->moveBefore (Where);
1071+ M->moveBefore (Where-> getIterator () );
10711072 Where = M;
10721073 }
10731074 }
@@ -1076,7 +1077,8 @@ auto AlignVectors::moveTogether(MoveGroup &Move) const -> bool {
10761077}
10771078
10781079template <typename T>
1079- auto AlignVectors::cloneBefore (Instruction *To, T &&Insts) const -> InstMap {
1080+ auto AlignVectors::cloneBefore (BasicBlock::iterator To, T &&Insts) const
1081+ -> InstMap {
10801082 InstMap Map;
10811083
10821084 for (Instruction *I : Insts) {
@@ -1200,10 +1202,10 @@ auto AlignVectors::realignLoadGroup(IRBuilderBase &Builder,
12001202 VSpan.section (Start, Width).values ());
12011203 };
12021204
1203- auto moveBefore = [this ](Instruction * In, Instruction * To) {
1205+ auto moveBefore = [this ](BasicBlock::iterator In, BasicBlock::iterator To) {
12041206 // Move In and its upward dependencies to before To.
12051207 assert (In->getParent () == To->getParent ());
1206- DepList Deps = getUpwardDeps (In, To);
1208+ DepList Deps = getUpwardDeps (&* In, &* To);
12071209 In->moveBefore (To);
12081210 // DepList is sorted with respect to positions in the basic block.
12091211 InstMap Map = cloneBefore (In, Deps);
@@ -1236,7 +1238,7 @@ auto AlignVectors::realignLoadGroup(IRBuilderBase &Builder,
12361238 // in order to check legality.
12371239 if (auto *Load = dyn_cast<Instruction>(Loads[Index])) {
12381240 if (!HVC.isSafeToMoveBeforeInBB (*Load, BasePos))
1239- moveBefore (Load, &* BasePos);
1241+ moveBefore (Load-> getIterator (), BasePos);
12401242 }
12411243 LLVM_DEBUG (dbgs () << " Loads[" << Index << " ]:" << *Loads[Index] << ' \n ' );
12421244 }
0 commit comments