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

Sebastian Pop spop at codeaurora.org
Wed Nov 9 13:07:04 PST 2011


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.

My guess is that one of the target independent passes is invalidating
the results of an analysis without marking it for re-computation.  When
the IR is dumped to disk and read back, the analysis results are forced
to be recomputed, and that makes the bug disappear.

Is there a systematic way to reduce such bugs?
I would like, for example, to invalidate the results of analyses at the end
of a set of passes.  Otherwise, is there a way to enable/disable each
optimization pass from clang without the help of -emit-llvm and opt/llc?

Thanks,
Sebastian
--
Qualcomm Innovation Center, Inc is a member of Code Aurora Forum



More information about the llvm-dev mailing list