[LLVMdev] Segmentation Fault(Modifying BasicBlockPlacement.cpp)

Chris Lattner sabre at nondot.org
Tue Feb 8 18:19:09 PST 2005


On Mon, 7 Feb 2005, Tanu Sharma wrote:

>
> 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.

Ok, that makes sense.  The only thing to be careful about is the entry 
block.  The first block in a function is automatically designated as the 
entry block, so be careful not to move it :)

> 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.

The issue there is that 'opt' already includes all of the scalar 
optimizations.  Please try it again without the -load option and it should 
work.  Note that the -block-placement pass really wants to be profile 
driven, so you need to pass in profile info generated by the 
utils/profile.pl script, and loaded with the -profile-loader pass.

-Chris

> 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
>
>

-Chris

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




More information about the llvm-dev mailing list