[llvm-dev] InstList insert depreciated?

Jonathan Roelofs via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 25 06:38:59 PDT 2016



On 8/25/16 7:01 AM, Shehbaz Jaffer via llvm-dev wrote:
> I tried an alternative way of adding instruction by first getting the
> first instruction of the basic block, and then calling insertAfter()
> on it as follows:
>
>   auto &B = F->getEntryBlock();
>   auto &IList = B.getInstList();
>   auto &FirstI = *IList.begin();
>     auto TaintVar = new AllocaInst(IntPtrTy);
>     // IList.insert(FirstI, TaintVar);  // OLD
>      FirstI.insertAfter(TaintVar); // NEW

You want:

    TaintVar->insertAfter(FirstI);


Jon

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded


More information about the llvm-dev mailing list