[LLVMdev] insertions with inst_iterators?

David Blaikie dblaikie at gmail.com
Mon Aug 29 16:25:57 PDT 2011


> When I'm iterating through I only directly add BitCastInsts and a
> single CallInst(Im assuming the functions I also created are
> elsewhere). Unfortunately it doesnt look like theres is a good way to
> convert between the the iterator I and a CallInst *. Am I missing
> something?
>

I'm not entirely sure how this relates to my explanation/suggestion.

How does your algorithm work? If you, say, add an extra CallInst every time
you see a call, then you're going to loop infinitely (inserting calls on the
calls you just inserted, etc) unless you make sure you skip over everything
you insert... that would be an algorithmic bug in your code, nothing to do
with iterator invalidation semantics.

Once you've got that figured out, we can see what kind of loop you'll need
to write/how to deal with iterator invalidation.

- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110829/27398e4e/attachment.html>


More information about the llvm-dev mailing list