<div dir="ltr"><div><div><div><div>1- I need the first example.<br></div>2- I set the Address uninitialized according to the documentation<br>"<span class=""> Setting the name on the Value</span><span class=""> automatically updates the module's symbol table"<br>
</span></div><span class="">from Value.h source code<br></span></div><span class="">3- I'm not sure about "select" instruction, you mean that the address is the new destination (basic block)that will be added<br>
</span></div><span class="">Thanks<br></span></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 23 July 2013 16:38, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Rasha,<br>
<div class="im"><br>
> I need to addDestination to some basic blocks<br>
<br>
</div>Just to make sure there's no confusion here: you really are trying to<br>
create code like:<br>
<br>
define i32 @foo(i1 %tst) {<br>
  %Address = select i1 %tst, i8* blockaddress(@foo, %true), i8*<br>
blockaddress(@foo, %false)<br>
  indirectbr i8* %Address, [label %true, label %false] ; This is what<br>
you're creating<br>
true:<br>
  ret i32 42<br>
false:<br>
  ret i32 0<br>
}<br>
<br>
and not:<br>
<br>
define i32 @bar(i1 %tst) {<br>
  br i1 %tst, label %true, label %false ; You're not trying to create this<br>
true:<br>
  ret i32 42<br>
false:<br>
  ret i32 0<br>
}<br>
<br>
If that's incorrect, you're going about it entirely the wrong way. We<br>
can help with either, but it's best not to go too far on a<br>
misunderstanding.<br>
<div class="im"><br>
>  Value* Address;<br>
>   IndirectBrInst *IBI = IndirectBrInst::Create(Address, Result.size(),i->getTerminator() );<br>
><br>
> IBI->addDestination(i);<br>
<br>
</div>The problem seems to be that "Address" is uninitialised but it needs<br>
to be set to some valid pointer value before creating your IndirectBr.<br>
To replicate my first example it would be set to the "select"<br>
instruction, for example; whatever produces your testination<br>
blockaddress.<br>
<br>
Cheers.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><b><span style="color:rgb(0,0,102)">Rasha Salah Omar</span><br style="color:rgb(0,0,102)"><span style="color:rgb(0,0,102)">Msc Student at E-JUST</span><br style="color:rgb(0,0,102)">
<span style="color:rgb(0,0,102)">Demonestrator  at Faculty of Computers and Informatics</span><br style="color:rgb(0,0,102)"><span style="color:rgb(0,0,102)">Benha University</span><br></b></div>
</div>