Simona Simona via llvm-dev
2016-Sep-04 20:06 UTC
[llvm-dev] LLVM 3.8.0 - Adding new instruction to a basic block
Hello, I'm trying to add a new instruction after a given instruction in a basic block. Until LLVM 3.7, I was using the following code: BB->getInstList().insertAfter(I, new_inst); [where both I and new_inst are Instruction*] In LLVM 3.8 however, the SymbolTableList was created as a wrapper over iplist. Could anyone please tell me how I can do the same type of insertion in LLVM 3.8? Thank you and Regards, Simona -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160904/d48406cc/attachment.html>
Daniel Berlin via llvm-dev
2016-Sep-05 01:20 UTC
[llvm-dev] LLVM 3.8.0 - Adding new instruction to a basic block
On Sun, Sep 4, 2016 at 1:06 PM, Simona Simona via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > > I'm trying to add a new instruction after a given instruction in a basic > block. > Until LLVM 3.7, I was using the following code: > > BB->getInstList().insertAfter(I, new_inst); > [where both I and new_inst are Instruction*] > > In LLVM 3.8 however, the SymbolTableList was created as a wrapper over > iplist. > Could anyone please tell me how I can do the same type of insertion in > LLVM 3.8? >auto InsertPt = I->getIterator(); BB->getInstList().insert(InsertPt, new_inst); -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160904/4e4e92e3/attachment.html>
Simona Simona via llvm-dev
2016-Sep-05 14:26 UTC
[llvm-dev] LLVM 3.8.0 - Adding new instruction to a basic block
On Mon, Sep 5, 2016 at 3:20 AM, Daniel Berlin <dberlin at dberlin.org> wrote:> > > On Sun, Sep 4, 2016 at 1:06 PM, Simona Simona via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hello, >> >> I'm trying to add a new instruction after a given instruction in a basic >> block. >> Until LLVM 3.7, I was using the following code: >> >> BB->getInstList().insertAfter(I, new_inst); >> [where both I and new_inst are Instruction*] >> >> In LLVM 3.8 however, the SymbolTableList was created as a wrapper over >> iplist. >> Could anyone please tell me how I can do the same type of insertion in >> LLVM 3.8? >> > > auto InsertPt = I->getIterator(); > BB->getInstList().insert(InsertPt, new_inst); > >Thanks, Daniel! In your example, isn't "insert" inserting "new_inst" *before* instruction "I"? As I would like to insert the "new_inst" instruction after "I", shouldn't it be BB->getInstList().insertAfter(InsertPt, new_inst); ? With insert I currently get the following error: Instruction does not dominate all uses! %0 = getelementptr inbounds i8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i32 0, i32 0) call void @myCall(i8* %0) Regards, Simona -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160905/39486a30/attachment.html>
Apparently Analagous Threads
- LLVM 3.8.0 - Adding new instruction to a basic block
- LLVM 3.8.0 - Adding new instruction to a basic block
- InstList insert depreciated?
- InstList insert depreciated?
- R: Re: R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails