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
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits