[cfe-dev] no-alias generated as result of restrict function arguments

Joerg Sonnenberger joerg at britannica.bec.de
Sat Dec 8 17:09:22 PST 2012


Hi all,
consider the following input:

int y;

void foo(int * restrict x)
{
	if (x == &y)
		(*x)++;
	(*x)++;
}

The clang codegen gives the argument of foo the noalias attribute and
GVN will optimise the condition to false.

When discussing this on IRC, Chandler suggested that Clang shouldn't be
creating the noalias attribute here, i.e. do alias interference. I'm not
sure he is correct, but this is subtle enough to warrant some discussion
before filling a PR.

Joerg



More information about the cfe-dev mailing list