@@ -122,9 +122,8 @@ getInsertionRange(BasicBlock &BB) {
122122}
123123
124124void InjectorIRStrategy::mutate (BasicBlock &BB, RandomIRBuilder &IB) {
125- SmallVector<Instruction *, 32 > Insts;
126- for (Instruction &I : getInsertionRange (BB))
127- Insts.push_back (&I);
125+ SmallVector<Instruction *, 32 > Insts (
126+ llvm::make_pointer_range (getInsertionRange (BB)));
128127 if (Insts.size () < 1 )
129128 return ;
130129
@@ -395,9 +394,8 @@ void InsertFunctionStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
395394 return isRetVoid ? nullptr : Call;
396395 };
397396
398- SmallVector<Instruction *, 32 > Insts;
399- for (Instruction &I : getInsertionRange (BB))
400- Insts.push_back (&I);
397+ SmallVector<Instruction *, 32 > Insts (
398+ llvm::make_pointer_range (getInsertionRange (BB)));
401399 if (Insts.size () < 1 )
402400 return ;
403401
@@ -421,9 +419,8 @@ void InsertFunctionStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
421419}
422420
423421void InsertCFGStrategy::mutate (BasicBlock &BB, RandomIRBuilder &IB) {
424- SmallVector<Instruction *, 32 > Insts;
425- for (Instruction &I : getInsertionRange (BB))
426- Insts.push_back (&I);
422+ SmallVector<Instruction *, 32 > Insts (
423+ llvm::make_pointer_range (getInsertionRange (BB)));
427424 if (Insts.size () < 1 )
428425 return ;
429426
@@ -561,9 +558,8 @@ void InsertPHIStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
561558 }
562559 PHI->addIncoming (Src, Pred);
563560 }
564- SmallVector<Instruction *, 32 > InstsAfter;
565- for (Instruction &I : getInsertionRange (BB))
566- InstsAfter.push_back (&I);
561+ SmallVector<Instruction *, 32 > InstsAfter (
562+ llvm::make_pointer_range (getInsertionRange (BB)));
567563 IB.connectToSink (BB, InstsAfter, PHI);
568564}
569565
@@ -573,9 +569,8 @@ void SinkInstructionStrategy::mutate(Function &F, RandomIRBuilder &IB) {
573569 }
574570}
575571void SinkInstructionStrategy::mutate (BasicBlock &BB, RandomIRBuilder &IB) {
576- SmallVector<Instruction *, 32 > Insts;
577- for (Instruction &I : getInsertionRange (BB))
578- Insts.push_back (&I);
572+ SmallVector<Instruction *, 32 > Insts (
573+ llvm::make_pointer_range (getInsertionRange (BB)));
579574 if (Insts.size () < 1 )
580575 return ;
581576 // Choose an Instruction to mutate.
0 commit comments