Alexander Potapenko
2011-Apr-05 12:23 UTC
[LLVMdev] Transition C->bitcode->assembly->object looses frame pointers
Hi everyone, We're doing some compile-time instrumentation according to the following scheme: llvm-gcc -O1 -g $in -emit-llvm -S -o $name.ll opt -O2 -load Instr.so $INSTR_FLAGS $name.ll -S -o $name-inst.ll llc $name-inst.ll -o $name.S g++ -c $name.S However it turns out that the code instrumented this way is missing frame pointers (e.g. backtrace() and/or libunwind cannot unwind the stack when necessary). Moreover, removing the instrumentation doesn't help: a simple transition to and from bitcode doesn't help: llvm-gcc -O1 -g $in -emit-llvm -S -o $name.ll llc $name.ll -o $name.S g++ -c $name.S We also tried to use Clang and to add -fno-omit-frame-pointers and --disable-fp-elim -- do not work either. On the other hand, compiling the code in a single pass of gcc/llvm-gcc/clang does preserve the frame pointers. Does anyone happen to know where the problem might be? Are there any other flags we're missing? Thanks, Alexander Potapenko
James Molloy
2011-Apr-05 12:40 UTC
[LLVMdev] Transition C->bitcode->assembly->object looses frame pointers
Hi, The -disable-fp-elim flag must be passed to the part of the compilation process that actually performs that optimisation pass - when you run clang/llvm-gcc in one invocation, obviously it will just be that invocation, but in your first case it would be the llc command. That is where the IR gets lowered, so is where the FP elimination takes place. Pass flags are not, as far as I'm aware, propagated in generated bitcode files - the same flags need to be given to each part of the pipeline. Hope this helps, James> -----Original Message----- > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] > On Behalf Of Alexander Potapenko > Sent: 05 April 2011 13:23 > To: llvmdev > Subject: [LLVMdev] Transition C->bitcode->assembly->object looses frame > pointers > > Hi everyone, > > We're doing some compile-time instrumentation according to the > following scheme: > > llvm-gcc -O1 -g $in -emit-llvm -S -o $name.ll > opt -O2 -load Instr.so $INSTR_FLAGS $name.ll -S -o $name-inst.ll > llc $name-inst.ll -o $name.S > g++ -c $name.S > > However it turns out that the code instrumented this way is missing > frame pointers (e.g. backtrace() and/or libunwind cannot unwind the > stack when necessary). > Moreover, removing the instrumentation doesn't help: a simple > transition to and from bitcode doesn't help: > > llvm-gcc -O1 -g $in -emit-llvm -S -o $name.ll > llc $name.ll -o $name.S > g++ -c $name.S > > We also tried to use Clang and to add -fno-omit-frame-pointers and > --disable-fp-elim -- do not work either. > > On the other hand, compiling the code in a single pass of > gcc/llvm-gcc/clang does preserve the frame pointers. > > Does anyone happen to know where the problem might be? Are there any > other flags we're missing? > > Thanks, > Alexander Potapenko > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Alexander Potapenko
2011-Apr-05 12:49 UTC
[LLVMdev] Transition C->bitcode->assembly->object looses frame pointers
Hi James, We've indeed passed the appropriate (and even excessive) flags to the appropriate pipeline parts, that is: llvm-gcc -O1 -fno-omit-frame-pointers -g $in -emit-llvm -S -o $name.ll llc --disable-fp-elim $name.ll -o $name.S g++ -fno-omit-frame-pointers -c $name.S , but that didn't work Alex On Tue, Apr 5, 2011 at 4:40 PM, James Molloy <James.Molloy at arm.com> wrote:> Hi, > > The -disable-fp-elim flag must be passed to the part of the compilation process that actually performs that optimisation pass - when you run clang/llvm-gcc in one invocation, obviously it will just be that invocation, but in your first case it would be the llc command. That is where the IR gets lowered, so is where the FP elimination takes place. > > Pass flags are not, as far as I'm aware, propagated in generated bitcode files - the same flags need to be given to each part of the pipeline. > > Hope this helps, > > James >
Duncan Sands
2011-Apr-05 13:08 UTC
[LLVMdev] Transition C->bitcode->assembly->object looses frame pointers
Hi Alexander,> We're doing some compile-time instrumentation according to the following scheme: > > llvm-gcc -O1 -g $in -emit-llvm -S -o $name.ll > opt -O2 -load Instr.so $INSTR_FLAGS $name.ll -S -o $name-inst.ll > llc $name-inst.ll -o $name.Sllc eliminates frame pointers by default, see the -disable-fp-elim and -disable-non-leaf-fp-elim options. Ciao, Duncan.
Reasonably Related Threads
- [LLVMdev] Transition C->bitcode->assembly->object looses frame pointers
- [LLVMdev] Transition C->bitcode->assembly->object looses frame pointers
- [LLVMdev] Transition C->bitcode->assembly->object looses frame pointers
- [LLVMdev] Transition C->bitcode->assembly->object looses frame pointers
- [LLVMdev] Transition C->bitcode->assembly->object looses frame pointers