Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance impact of -fno-strict-aliasing

Tags:

Is there any study or set of benchmarks showing the performance degradation due to specifying -fno-strict-aliasing in GCC (or equivalent in other compilers)?

like image 383
Carlos Avatar asked Aug 04 '09 04:08

Carlos


People also ask

What is the performance Impact?

Performance Impact is a unique, multi-faceted, custom training and development and live events resource with deep experience at the top ranks of organizations in global pharmaceutical, biotech, and healthcare organizations.

What is performance definition in business?

(2) The quality of execution of such an action, operation, or process; the competence or effectiveness of a person or thing in performing an action; especially the capabilities, productivity, or success of a machine, product, or person when measured against a standard.

How marketing resources affect the business?

The findings indicate that marketing resources impact on financial performance indirectly through creating customer satisfaction and loyalty and building superior market performance.


1 Answers

It will vary a lot from compiler to compiler, as different compilers implement it with different levels of aggression. GCC is fairly aggressive about it: enabling strict aliasing will cause it to think that pointers that are "obviously" equivalent to a human (as in, foo *a; bar *b = (bar *) a;) cannot alias, which allows for some very aggressive transformations, but can obviously break non-carefully written code. Apple's GCC disables strict aliasing by default for this reason.

LLVM, by contrast, does not even have strict aliasing, and, while it is planned, the developers have said that they plan to implement it as a fall-back case when nothing else can judge equivalence. In the above example, it would still judge a and b equivalent. It would only use type-based aliasing if it could not determine their relationship in any other way.

In my experience, the performance impact of strict aliasing mostly has to do with loop invariant code motion, where type information can be used to prove that in-loop loads can't alias the array being iterated over, allowing them to be pulled out of the loop. YMMV.

like image 153
Resistor Avatar answered Sep 22 '22 21:09

Resistor