Dealing with aliasing using contracts

Speaker: Gábor Horváth

Audience level: Intermediate | Advanced

category

Telling the compiler when aliasing can or cannot happen is an important problem to solve. Lots of crucial compiler optimizations such as load and store elimination, and less crucial such as vectorization rely on alias analysis. I will showcase some examples where alias analysis is playing an important role to get decent performance. Unfortunately, there is no standard way in C++ to give hints to the compiler about aliasing. There is the C restrict keyword which is supported by some compilers but it has its own shortcomings. In this talk, I will show some of the past approaches to move restrict keyword to C++ and propose a new solution which is based on contracts. I will also show some basic tricks how to use type based alias analysis and value types to help compiler reason about aliasing until the related new features being accepted into the language.