[LLVMdev] GCC vs. LLVM difference on simple code example

Eli Friedman eli.friedman at gmail.com
Thu Mar 24 12:31:47 PDT 2011


On Thu, Mar 24, 2011 at 11:59 AM, Marc de Kruijf <dekruijf at cs.wisc.edu> wrote:
> Hi,
> I have a question on why gcc and llvm-gcc compile the following simple code
> snippet differently:
> extern int a;
> extern int *b;
> void foo() {
>   int i;
>   for (i = 1; i < 100; ++i)
>     a += b[i];
> }

Missed optimization, which appears to be fixed in newer versions.

-Eli




More information about the llvm-dev mailing list