Chris,

I have a question ..

On Mon, 2007-02-12 at 19:54 -0600, Chris Lattner wrote:
> 
> Changes in directory llvm/lib/Bytecode/Reader:
> 
> Reader.cpp updated: 1.236 -> 1.237
> ---
> Log message:
> 
> stop passing vector into ctors
> 
> 
> ---
> Diffs of the changes:  (+2 -2)
> 
>  Reader.cpp |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> 
> Index: llvm/lib/Bytecode/Reader/Reader.cpp
> diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.236 
> llvm/lib/Bytecode/Reader/Reader.cpp:1.237
> --- llvm/lib/Bytecode/Reader/Reader.cpp:1.236 Mon Feb 12 12:53:43 2007
> +++ llvm/lib/Bytecode/Reader/Reader.cpp       Mon Feb 12 19:53:54 2007
> @@ -702,7 +702,7 @@
>            Params.push_back(getValue(Oprnds[i], Oprnds[i+1]));
>        }
>  
> -      Result = new CallInst(F, Params);
> +      Result = new CallInst(F, &Params[0], Params.size());

I don't see why this series of changes is better for performance. The
Constructor is currently defined as:

CallInst(Value *F, const std::vector<Value*> &Par,
         const std::string &Name = "", Instruction *InsertBefore = 0);

Because Par is a reference to a const std::vector<Value*> there should
be no copying of the vector when the argument is passed. It would just
pass the pointer implied by the reference. Your change makes it pass two
arguments, which can't be faster. 

Is there something I'm missing here?

Reid.

>        if (isTailCall) cast<CallInst>(Result)->setTailCall();
>        if (CallingConv) cast<CallInst>(Result)->setCallingConv(CallingConv);
>        break;
> @@ -756,7 +756,7 @@
>            Params.push_back(getValue(Oprnds[i], Oprnds[i+1]));
>        }
>  
> -      Result = new InvokeInst(F, Normal, Except, Params);
> +      Result = new InvokeInst(F, Normal, Except, &Params[0], Params.size());
>        if (CallingConv) cast<InvokeInst>(Result)->setCallingConv(CallingConv);
>        break;
>      }
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to