[cfe-dev] disabling loop idiom recognizer in clang
Damjan Marion
damjan.marion at gmail.com
Sat Apr 30 11:02:54 PDT 2011
On Apr 30, 2011, at 7:15 PM, Eli Friedman wrote:
>>
>> Here it is:
>>
>> # clang -ccc-host-triple arm-unknown-freebsd -O2 -ffreestanding -g -c i.c -o i.o
>>
>> void func1(unsigned *b)
>> {
>> unsigned c[17];
>> unsigned i;
>> for (i=0; i < 17; i++) c[i] = 0;
>> do { c[*b]++; b++; } while (--i);
>> }
>>
>> will produce memset call even with -ffreestanding.
>
> Ah... that isn't -loop-idiom triggering; that's the loop getting
> unrolled and the stores getting merged into a memset by -memcpyopt.
Is this expected behavior? If yes how it can be disabled?
More information about the cfe-dev
mailing list