[PATCH] Vectorizing Global Structures - Take 2

Daniel Berlin dberlin at dberlin.org
Sat Feb 16 16:07:55 PST 2013


On Sat, Feb 16, 2013 at 7:57 AM, Renato Golin <renato.golin at linaro.org> wrote:
> On 16 February 2013 00:38, Daniel Berlin <dberlin at dberlin.org> wrote:
>>
>> you fall into the "otherwise, the behavior is undefined".
>>
>> It would be explicitly valid to convert it to char *, and read it up
>> to and through B, but not using the array access operator.
>
>
> Unfortunately, "undefined behaviour" is valid C. It means you'll have to
> compile that without error (possibly a warning), but you're allowed to do
> whatever you want.
I'm aware.
In practice, this is still invalid however.  It's just not a compile time error.
Undefined means it has no semantics you can rely on.

>
> Clang sometimes remove accesses if they're going to go outside the
> boundaries (if it can tell) as optimization, as we seen in the Livermore
> Loops example. GCC vectorizes a loop when the only aliasing possible is with
> out-of-bounds access (thus getting different results).

This isn't quite right, but it's close enough (I wrote parts of GCC's
dependence analysis).
:)


> All that falls into
> the category of "user error", so both Clang and GCC won't change their
> behaviour on optimized builds.
>
> cheers,
> --renato



More information about the llvm-commits mailing list