[LLVMdev] A case where llvm created different cfg for same code

Bill Wendling isanbard at gmail.com
Tue Aug 12 13:23:52 PDT 2008


On Tue, Aug 12, 2008 at 1:24 AM, Sheng Zhou <zhousheng at autoesl.com> wrote:
> Hi,
>
> The following two segments of code are actually the same,
> but llvm created different cfg for them.
>
...
>
> The prime difference is that: cfg of form2 has additional basic block
> which has a back edge to a non-header-block
> I think the loop in that cfg is not canonical.
>
> I tried -loopsimplify and -indvars , but no improvement.
>
> Any comments for this? Thanks in advance.
>
The code is not the same. 7 is commented out in the first and 8 in the
second. Why would you expect the CFGs to match? Is there something
wrong (inefficient) in the resulting output of these two functions
when compiled?

-bw



More information about the llvm-dev mailing list