[LLVMdev] non-pointer gcroot

Scott Graham scott.llvm at h4ck3r.net
Fri Nov 7 12:29:06 PST 2008


I'm getting an assert in LowerIntrinsics::InsertRootInitializers
because I'm gcroot'ing an alloca to a non-pointer.

I was hoping to modify InsertRootInitializers to memset the structure
in the case that it's not a pointer, but I'm not sure how to. Can
anyone suggest what should go at "todo; something here"?

  for (AllocaInst **I = Roots, **E = Roots + Count; I != E; ++I)
    if (!InitedRoots.count(*I)) {
	  const Type* Ty = cast<PointerType>((*I)->getType())->getElementType();
	  if (Ty->getTypeID() == Type::PointerTyID) {
	    new StoreInst(ConstantPointerNull::get(cast<PointerType>(Ty)),
					*I, IP);
	  } else {
	    // todo; something here
      MadeChange = true;


More information about the llvm-dev mailing list