[llvm-commits] [llvm] r40660 - in /llvm/trunk: include/llvm/ include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/ExecutionEngine/JIT/ lib/Transforms/IPO/ lib/Transforms/Instrumentation/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ tools/bugpoint/ tools/llvm-upgrade/

Gordon Henriksen gordonhenriksen at mac.com
Wed Aug 1 06:49:49 PDT 2007


On Jul 31, 2007, at 23:43, David Greene wrote:

> Modified: llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ 
> Scalar/LowerGC.cpp?rev=40660&r1=40659&r2=40660&view=diff
>
> ====================================================================== 
> ========
> --- llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp Tue Jul 31  
> 22:43:44 2007
> @@ -27,6 +27,7 @@
>  #include "llvm/Module.h"
>  #include "llvm/Pass.h"
>  #include "llvm/Support/Compiler.h"
> +#include "llvm/ADT/SmallVector.h"
>  using namespace llvm;
>
>  namespace {
> @@ -197,8 +198,18 @@
>                  CI->setOperand(0, GCRead);
>                } else {
>                  // Create a whole new call to replace the old one.
> -                CallInst *NC = new CallInst(GCRead, CI->getOperand 
> (1),
> -                                            CI->getOperand(2),
> +
> +                // It sure would be nice to pass op_begin()+1,
> +                // op_begin()+2 but it runs into trouble with
> +                // CallInst::init's &*ierator, which requires a
> +                // conversion from Use* to Value*.  The conversion
> +                // from Use to Value * is not useful because the
> +                // memory for Value * won't be contiguous.
> +                SmallVector<Value *, 2> Args;
> +                Args.push_back(CI->getOperand(1));
> +                Args.push_back(CI->getOperand(2));
> +                CallInst *NC = new CallInst(GCRead, Args.begin(),
> +                                            Args.end(),
>                                              CI->getName(), CI);
>                  // These functions only deal with ptr type results  
> so BitCast
>                  // is the correct kind of cast (no-op cast).

Hi David,

Can't you just use

                  Value* Args[] = { CI->GetOperand(1),
                                    CI->GetOperand(2) };
                  CallInst *NC = new CallInst(GCRead, Args, Args + 2,
                                              CI->getName(), CI);

here and in UpgradeParser.y?

— Gordon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070801/eb50e5a1/attachment.html>


More information about the llvm-commits mailing list