[llvm-dev] InstList insert depreciated?
Shehbaz Jaffer via llvm-dev
llvm-dev at lists.llvm.org
Thu Aug 25 10:17:14 PDT 2016
+ auto t = dyn_cast<Instruction>(TaintVar);
worked for me.
since TaintVar is of type AllocaInst, it does not have an insertAfter
insertBefore defined, so I had to dynamically cast it to Instruction.
Also, making t->insertAfter(&FirstI) causes some errors of type
"llvm-instruction-does-not-dominate-all-uses", since I want alloca to
appear before FirstI, I had to make insertAfter => insertBefore.
On Thu, Aug 25, 2016 at 10:12 AM, Shehbaz Jaffer
<shehbazjaffer007 at gmail.com> wrote:
>> You want:
> This worked! Thank you.
> On Thu, Aug 25, 2016 at 9:38 AM, Jonathan Roelofs
> <jonathan at codesourcery.com> wrote:
>> 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:
>> Jon Roelofs
>> jonathan at codesourcery.com
>> CodeSourcery / Mentor Embedded
> Shehbaz Jaffer
> First Year Graduate Student
> Sir Edward S Rogers Sr Department of Electrical and Computer Engineering
> University of Toronto
First Year Graduate Student
Sir Edward S Rogers Sr Department of Electrical and Computer Engineering
University of Toronto
More information about the llvm-dev