<DIV id=RTEContent><FONT size=2>  <div>Hello Andrew ,</div>  <div>Yes , I have missed the phi node since my paths merge together. I'll try this out.</div>  <div>I am implementing a timer based profiling scheme and hope your code will be useful </div>  <div>for me. Please send me a copy of your code. </div>  <div> </div>  <div>Thanks</div>  <div>Sandra</div></FONT><BR><BR><B><I>Andrew Lenharth <andrewl@lenharth.org></I></B> wrote:  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">On Tue, 2005-11-22 at 09:12 -0800, Sandra Johnson wrote:<BR>> Hi ,<BR>> I am trying to clone a BasicBlock. I want both to co-exist and I have<BR>> introduced<BR>> a conditional branch to the original or the cloned BB. <BR><BR>I have a pass I haven't commited that does just this. Well, it does so<BR>to implement Arnold and Ryder style profiling. I can send you a copy of<BR>that if you want (I hope to commit it soon once it is c!
 leaned up
 some).<BR>Your best bet is to run reg2mem, which removes most live values by<BR>placing them in memory. the only live values that remain after that<BR>pass are the allocas for the old registers and values from loads in the<BR>predecessors of phi nodes to those phi nodes. This makes it much easier<BR>to maintain SSA form (as there is only one type of simple live value you<BR>have to worry about). It is also possible to remove the phi nodes<BR>completely with a bit more transform, but that wasn't desirable in my<BR>case, so I didn't, but you could easily extend the pass to do so.<BR><BR>(just for reference, my code clones all BB in a function and the CFG,<BR>then takes backedges and interconnects the backedges of the original and<BR>cloned versions, adding conditional branches at those join points.)<BR><BR>Andrew Lenharth<BR><BR>> I tried mapping the original instruction and the clone as below :<BR>> Instruction *NewInst = II->clone();<BR>> if (II->hasName())<B!
 R>>
 NewInst->setName(II->getName());<BR>> NewBB->getInstList().push_back(NewInst);<BR>> ValueMap[II] = NewInst; <BR>> what I got from this is ,<BR>> --> eventhough I have set the same name , a new name is set<BR>> for the clone.<BR>> original :<BR>> %CS1 = call fastcc int %add( int %tmp.5, int %<BR>> tmp.6 ) ; <INT>[#uses=1]<BR>> clone :<BR>> %CS11 = call fastcc int %add( int %tmp.5, int %<BR>> tmp.6 ) ; <INT>[#uses=1]<BR>> --> the verifier gives the following error<BR>> Instruction does not dominate all uses!<BR>> &n! bsp; for the original instruction.<BR>> Is it possible to have the instructions in the clone to have the same<BR>> name <BR>> as the original BB ?<BR>> Is it possible to make the uses of the original instruction to be the <BR>> uses of the cloned instruction at the same time ? <BR>> What makes the above error ?<BR>> Is it because of SSA ? <BR>> <BR>> <BR>> Thanks in advance!
  for any
 help,<BR>> Sandra<BR>> <BR>> <BR>> <BR>> ______________________________________________________________________<BR>> Yahoo! FareChase - Search multiple travel sites in one click. <BR>> _______________________________________________<BR>> LLVM Developers mailing list<BR>> LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu<BR>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev<BR><BR>_______________________________________________<BR>LLVM Developers mailing list<BR>LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu<BR>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev<BR></BLOCKQUOTE><BR></DIV><p>
                <hr size=1> <a href="http://us.lrd.yahoo.com/_ylc=X3oDMTFqODRtdXQ4BF9TAzMyOTc1MDIEX3MDOTY2ODgxNjkEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw--/SIG=110oav78o/**http%3a//farechase.yahoo.com/">Yahoo! FareChase - Search multiple travel sites in one click.</a>