<DIV>
<DIV><BR>Thanks a lot for replying Chris, </DIV>
<DIV> </DIV>
<DIV>I m trying to randomize the blocks in a program.I generate a random number( between the<BR>current "InsertPos" and the last block), and then iterate through the list of basicblocks , picking up block with position equal to that of the random number and place it into the current InsertPos and increment InsertPos.</DIV>
<DIV> </DIV>
<DIV>Running it like this:<BR>-------------------------------------------------------------------</DIV>
<DIV> opt -load /home/tsharma/ankur/llvm/Debug/lib/LLVMHello.so -hello <helloprog.bc> /dev/null<BR>---------------------------------------------------------------------</DIV>
<DIV>I wish to make it more sophisticated but initially was trying to see whether a simple modification to BasicBlockPlacement works or not.</DIV>
<DIV> </DIV>
<DIV>Also when I try to run the -block-placement pass , I get the following message:</DIV>
<DIV>--------------------------------------------------------------------------------- <BR>[tsharma@strauss programs]$ opt -load /home/tsharma/ankur/llvm/Debug/lib/LLVMScalarOpts.so -block-placement <helloprog.bc> /dev/null<BR>Two passes with the same argument (-tailcallelim) attempted to be registered!<BR>Aborted</DIV>
<DIV>---------------------------------------------------------------------------------</DIV>
<DIV> </DIV>
<DIV>I think it is a simple bug but being very new to llvm , not able to detect.</DIV>
<DIV> </DIV>
<DIV>I am attaching the testcase.</DIV>
<DIV> </DIV>
<DIV>Thanks again,</DIV>
<DIV>Tanu<BR></DIV>
<DIV><BR><B><I>Chris Lattner <sabre@nondot.org></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">On Mon, 7 Feb 2005, Tanu Sharma wrote:<BR><BR>> I have been trying to randomize blocks in a program and modified <BR>> "BasicBlockPlacement.cpp" for the purpose but getting segmentation <BR>> fault.I am not able to determine the problem.Can anyone please decrypt <BR>> these error messages or suggest what might be the possible cause of <BR>> failure?<BR><BR>I'd be happy to fix this, but I need a proper testcase and instructions to <BR>reproduce it. Can you please send me the bytecode file and commands you <BR>are using to do this?<BR><BR>Also, have you tried out bugpoint? Please give it a try first, as it will <BR>probably shrink the testcase down to something small. You should be <BR>able to run it like:<BR><BR>bugpoint -block-placement -other-options-you-need test.bc<BR><BR>... and it should hopefully give you a smaller .bc file. Regardless, if <BR>you send me!
  the
 testcase, I'll fix the bug.<BR><BR>Thanks!<BR><BR>-Chris<BR><BR>> -----------------------------------------------------------------------------------------------------<BR>><BR>> opt((anonymous namespace)::PrintStackTrace()+0x18)[0x8691968]<BR>> opt((anonymous namespace)::SignalHandler(int)+0xd8)[0x8691bc8]<BR>> /lib/tls/libc.so.6[0x688a48]<BR>> opt(llvm::BasicBlock::getNext()+0x6)[0x83d36d0]<BR>> opt(llvm::SymbolTableListTraits<?xml:namespace prefix = llvm /><llvm::BasicBlock, llvm::ilist_traits<llvm::BasicBlock llvm::Function,> >::getNext(llvm::BasicBlock*)+0x11)[0x83d36c5]<BR>> opt(llvm::ilist_iterator<llvm::BasicBlock>::operator++()+0x17)[0x83d011d]<BR>> opt(llvm::ilist_iterator<llvm::BasicBlock>::operator++(int)+0x1c)[0x849c64e]<BR>> /home/tsharma/ankur/llvm/Debug/lib/LLVMHello.so((anonymous namespace)::Hello::PlaceBlocks(llvm::BasicBlock*)+0x196)[0x115616]<BR>> /home/tsharma/ankur/llvm/Debug/lib/LLVMHello.so((anonymous
 namespace)::Hello::runOnFunction(llvm::Function&)+0x68)[0x115450]<BR>> opt(llvm::PassManagerTraits<llvm::Function>::runPass(llvm::FunctionPass*, llvm::Function*)+0x1b)[0x8645e0b]<BR>> opt(llvm::PassManagerT<llvm::Function>::runOnUnit(llvm::Function*)+0x5c5)[0x8645739]<BR>> opt(llvm::PassManagerTraits<llvm::Function>::runOnFunction(llvm::Function&)+0x1b)[0x86463af]<BR>> opt(llvm::FunctionPass::runOnModule(llvm::Module&)+0xa4)[0x85ef606]<BR>> opt(llvm::PassManagerTraits<llvm::Module>::runPass(llvm::ModulePass*, llvm::Module*)+0x1b)[0x8640f7b]<BR>> opt(llvm::PassManagerT<llvm::Module>::runOnUnit(llvm::Module*)+0x5c5)[0x863ff8b]<BR>> opt(llvm::PassManagerTraits<llvm::Module>::runOnModule(llvm::Module&)+0x1b)[0x8642f0d]<BR>> opt(llvm::PassManager::run(llvm::Module&)+0x1f)[0x85ee965]<BR>> opt(main+0x988)[0x83b225c]<BR>> /lib/tls/libc.so.6(__libc_start_main+0xe3)[0x675e33]<BR>> opt(__gxx_personality_v0+0x111)[0x83b1751]<BR>>
 Segmentation fault<BR>> ------------------------------------------------------------------------------------------------------<BR>><BR>> Thanks<BR>><BR>> Tanu<BR>><BR>><BR>><BR>><BR>> ---------------------------------<BR>> Do you Yahoo!?<BR>> Yahoo! Mail - Helps protect you from nasty viruses.<BR><BR>-Chris<BR><BR>-- <BR>http://nondot.org/sabre/<BR>http://llvm.cs.uiuc.edu/<BR><BR>_______________________________________________<BR>LLVM Developers mailing list<BR>LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu<BR>http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev<BR></BLOCKQUOTE></llvm::Module></llvm::Module></llvm::Module></llvm::Function></llvm::Function></llvm::Function></llvm::BasicBlock></llvm::BasicBlock></llvm::BasicBlock,></DIV><p>
                <hr size=1>Do you Yahoo!?<br> 
<a href="http://us.rd.yahoo.com/mail_us/taglines/virus/*http://promotions.yahoo.com/new_mail/static/protection.html">Yahoo! Mail</a> - Helps protect you from nasty viruses.