This preview shows page 1. Sign up to view the full content.
Unformatted text preview: destination, which in this case is the ﬁnal vector element. This value is therefore set ﬁrst to 1, then to ¾ ¡ ½ ¾, and then to ¿ ¡ ¾ . On the ﬁnal iteration this value is then multiplied by itself to yield a ﬁnal value of 36. For the case of combine4, the vector remains unchanged until the end, when the ﬁnal element is set to the computed result ½ ¡ ¾ ¡ ¿ ¡ ¿¼. Of course, our example showing the distinction between combine3 and combine4 is highly contrived. One could argue that the behavior of combine4 more closely matches the intention of the function description. Unfortunately, an optimizing compiler cannot make a judgement about the conditions under which a function might be used and what the programmer’s intentions might be. Instead, when given combine3 to compile, it is obligated to preserve its exact functionality, even if this means generating inefﬁcient code. 5.7 Understanding Modern Processors
Up to this point, we have applied optimizations that did not rely on any features of the target machine. They simply red...
View Full Document