[arm-perf-staging branch] Add support for -fno-alias

Tamar Christina tamar.christina@arm.com
Tue Oct 13 08:36:00 GMT 2020


Hi,

I am sending some old patches that we have internally since GCC 10 to the Arm Branch but feel free to comment as we will be looking to submit them for GCC 12 to mainline.

This patch adds the option '-fno-alias'. The option makes the compiler treat any pointer being passed as a parameter as if it had the keyword restrict.
This option makes it easier to check whether using restrict gives a performance boost, without having to change the sources.
Of course this option can only be used if you know for a fact that all pointers do not alias, or just like with the restrict keyword, things can go very wrong.

The way this patch implements this option is when the option is passed, create a qualified pointer type for any pointer type encountered as a parameter.
This qualified pointer type will have the TYPE_QUAL_RESTRICT bit set, just as if we had parsed a 'restrict' keyword.

Bootstraped on aarch64-none-linux-gnu, to make sure I didn't break anything obvious in the build.

Is this OK for trunk?

gcc/ChangeLog:

2020-xx-xx  Andre Vieira  <andre.simoesdiasvieira@arm.com>

        * common.opt (fno-alias): New option.
        * c/cdecl.c (grokdeclarator): When flag_no_alias make all
        pointers passed as parameters restrict.
        * cp/decl.c (grokdeclarator): Likewise.
        * doc/invoke.texi (fno-alias): Document new option.

gcc/testsuite/ChangeLog:

2020-xx-xx  Andre Vieira  <andre.simoesdiasvieira@arm.com>

        * gcc.dg/vect/vect-no-alias.c: New test.
        * gcc.dg/vect/noalias.h: New include file used in test.
        * g++.dg/vect/simd-no-alias.cc: New test.

-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rb12783.patch
Type: text/x-diff
Size: 5465 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201013/f15aba96/attachment.bin>


More information about the Gcc-patches mailing list