[LLVMdev] Help needed on debugging llvm

Anitha Boyapati anitha.boyapati at gmail.com
Wed Nov 7 03:09:27 PST 2012

On 7 November 2012 15:29, Duncan Sands <baldrick at free.fr> wrote:

>  I could corner down the segfault to a single function in source file. But
>> the
>> problem is - if that function is responsible for segfault or if it is the
>> optimization somewhere else that is driving the segfault. In the worst
>> case
>> it could be so. I am yet to dive deeper there.
> you should try to determine which compilation stage introduces the
> segmentation
> fault (optimizers, codegen?).  It sounds like you are trying to do so
> already,
> more comments below.

One of the many combinations that gives me some clue that Code Generation
(or optimizations during CodeGen) is going wrong.

I have compiled the problematic function with DragonEgg to emit llvm IR
(say test.ll). This is now fed to llc as follows:

Original Buggy Case: [Turns off FMA3, Turns on FMA4]

 llc -fp-contract=fast -O0 -mcpu=bdver2 -mattr=-fma,+fma4 test.ll -o
Correct Case: [Turns on FMA3]

llc -fp-contract=fast -O0 -mcpu=bdver2 -mattr=+fma test.ll -o
Then compiled and linked as usual with clang. The first case where FMA4 is
turned on reproduces the bug even though -O0 is used. Thus, it rules out
any front-end specific possibilities.

However it is a little surprising why the same does not show when dragonegg
is fully used for end-to-end compilation.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121107/4bc40780/attachment.html>

More information about the llvm-dev mailing list