[LLVMdev] Help to debug the miscompilation of a loop into an infinite loop

Eli Friedman eli.friedman at gmail.com
Wed Nov 9 13:33:03 PST 2011


On Wed, Nov 9, 2011 at 1:07 PM, Sebastian Pop <spop at codeaurora.org> wrote:
> Hi,
>
> I found out that dumping the IR to disk and taking it back makes
> a miscompile disappear.  I would appreciate your help on how
> to narrow down such a bug.
>
> Here are more details: when I compile one of the SPEC benchmarks
> with clang at -O3, the code is miscompiled producing an infinite loop.
> If I split the compilation using -emit-llvm and then finish the compilation
> from the .ll file with llc (I verified that the same passes are enabled)
> I cannot reproduce the bug exposing the infinite loop.

First, make sure llc is actually doing the same thing as clang (-O3,
the same relocation model, frame pointer elimination, etc.)

clang can handle .ll files directly; that may be useful in some cases.
 Also, the "-mllvm -disable-llvm-optzns" command-line argument to
clang can be useful; it turns off the mid-level optimizers.

-Eli




More information about the llvm-dev mailing list