[LLVMdev] Segmentation Fault(Modifying BasicBlockPlacement.cpp)

Tanu Sharma tanusharma_04 at yahoo.com
Mon Feb 7 09:43:19 PST 2005


Thanks a lot for replying Chris, 
 
I m trying to randomize the blocks in a program.I generate a random number( between the
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.
 
Running it like this:
-------------------------------------------------------------------
 opt -load /home/tsharma/ankur/llvm/Debug/lib/LLVMHello.so -hello <helloprog.bc> /dev/null
---------------------------------------------------------------------
I wish to make it more sophisticated but initially was trying to see whether a simple modification to BasicBlockPlacement works or not.
 
Also when I try to run the -block-placement pass , I get the following message:
--------------------------------------------------------------------------------- 
[tsharma at strauss programs]$ opt -load /home/tsharma/ankur/llvm/Debug/lib/LLVMScalarOpts.so -block-placement <helloprog.bc> /dev/null
Two passes with the same argument (-tailcallelim) attempted to be registered!
Aborted
---------------------------------------------------------------------------------
 
I think it is a simple bug but being very new to llvm , not able to detect.
 
I am attaching the testcase.
 
Thanks again,
Tanu


Chris Lattner <sabre at nondot.org> wrote:
On Mon, 7 Feb 2005, Tanu Sharma wrote:

> I have been trying to randomize blocks in a program and modified 
> "BasicBlockPlacement.cpp" for the purpose but getting segmentation 
> fault.I am not able to determine the problem.Can anyone please decrypt 
> these error messages or suggest what might be the possible cause of 
> failure?

I'd be happy to fix this, but I need a proper testcase and instructions to 
reproduce it. Can you please send me the bytecode file and commands you 
are using to do this?

Also, have you tried out bugpoint? Please give it a try first, as it will 
probably shrink the testcase down to something small. You should be 
able to run it like:

bugpoint -block-placement -other-options-you-need test.bc

... and it should hopefully give you a smaller .bc file. Regardless, if 
you send me the testcase, I'll fix the bug.

Thanks!

-Chris

> -----------------------------------------------------------------------------------------------------
>
> opt((anonymous namespace)::PrintStackTrace()+0x18)[0x8691968]
> opt((anonymous namespace)::SignalHandler(int)+0xd8)[0x8691bc8]
> /lib/tls/libc.so.6[0x688a48]
> opt(llvm::BasicBlock::getNext()+0x6)[0x83d36d0]
> opt(llvm::SymbolTableListTraits >::getNext(llvm::BasicBlock*)+0x11)[0x83d36c5]
> opt(llvm::ilist_iterator::operator++()+0x17)[0x83d011d]
> opt(llvm::ilist_iterator::operator++(int)+0x1c)[0x849c64e]
> /home/tsharma/ankur/llvm/Debug/lib/LLVMHello.so((anonymous namespace)::Hello::PlaceBlocks(llvm::BasicBlock*)+0x196)[0x115616]
> /home/tsharma/ankur/llvm/Debug/lib/LLVMHello.so((anonymous namespace)::Hello::runOnFunction(llvm::Function&)+0x68)[0x115450]
> opt(llvm::PassManagerTraits::runPass(llvm::FunctionPass*, llvm::Function*)+0x1b)[0x8645e0b]
> opt(llvm::PassManagerT::runOnUnit(llvm::Function*)+0x5c5)[0x8645739]
> opt(llvm::PassManagerTraits::runOnFunction(llvm::Function&)+0x1b)[0x86463af]
> opt(llvm::FunctionPass::runOnModule(llvm::Module&)+0xa4)[0x85ef606]
> opt(llvm::PassManagerTraits::runPass(llvm::ModulePass*, llvm::Module*)+0x1b)[0x8640f7b]
> opt(llvm::PassManagerT::runOnUnit(llvm::Module*)+0x5c5)[0x863ff8b]
> opt(llvm::PassManagerTraits::runOnModule(llvm::Module&)+0x1b)[0x8642f0d]
> opt(llvm::PassManager::run(llvm::Module&)+0x1f)[0x85ee965]
> opt(main+0x988)[0x83b225c]
> /lib/tls/libc.so.6(__libc_start_main+0xe3)[0x675e33]
> opt(__gxx_personality_v0+0x111)[0x83b1751]
> Segmentation fault
> ------------------------------------------------------------------------------------------------------
>
> Thanks
>
> Tanu
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail - Helps protect you from nasty viruses.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/

_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev


		
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - Helps protect you from nasty viruses.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050207/ed4e60bd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Hello.cpp
Type: application/octet-stream
Size: 3172 bytes
Desc: Hello.cpp
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050207/ed4e60bd/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: helloprog.bc
Type: application/octet-stream
Size: 252 bytes
Desc: helloprog.bc
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050207/ed4e60bd/attachment-0001.obj>


More information about the llvm-dev mailing list