Fix SimplifyLibCalls to transfer attributes from callees rather than
[oota-llvm.git] / docs / LangRef.html
index b0bb562e7f3962b2b1652228f8a835f34f8c0555..039b81ab825cd506fdc083fe6b4a029619630b36 100644 (file)
@@ -2021,7 +2021,7 @@ Classifications</a> </div>
    Undefined values may be of any type (other than label or void) and be used
    anywhere a constant is permitted.</p>
 
-<p>Undefined values are useful, because it indicates to the compiler that the
+<p>Undefined values are useful because they indicate to the compiler that the
    program is well defined no matter what value is used.  This gives the
    compiler more freedom to optimize.  Here are some examples of (potentially
    surprising) transformations that are valid (in pseudo IR):</p>
@@ -2058,10 +2058,11 @@ Unsafe:
 <p>These logical operations have bits that are not always affected by the input.
 For example, if "%X" has a zero bit, then the output of the 'and' operation will
 always be a zero, no matter what the corresponding bit from the undef is.  As
-such, it is unsafe to optimizer or assume that the result of the and is undef.
-However, it is safe to assume that all bits of the undef are 0, and optimize the
-and to 0.  Likewise, it is safe to assume that all the bits of the undef operand
-to the or could be set, allowing the or to be folded to -1.</p>
+such, it is unsafe to optimize or assume that the result of the and is undef.
+However, it is safe to assume that all bits of the undef could be 0, and 
+optimize the and to 0.  Likewise, it is safe to assume that all the bits of 
+the undef operand to the or could be set, allowing the or to be folded to 
+-1.</p>
 
 <div class="doc_code">
 <pre>
@@ -2136,7 +2137,7 @@ can be constant folded to undef because the undef could be an SNaN, and fdiv is
 not (currently) defined on SNaN's.  However, in the second example, we can make
 a more aggressive assumption: because the undef is allowed to be an arbitrary
 value, we are allowed to assume that it could be zero.  Since a divide by zero
-it has <em>undefined behavior</em>, we are allowed to assume that the operation
+has <em>undefined behavior</em>, we are allowed to assume that the operation
 does not execute at all.  This allows us to delete the divide and all code after
 it: since the undefined operation "can't happen", the optimizer can assume that
 it occurs in dead code.
@@ -5044,6 +5045,12 @@ Loop:       ; Infinite loop that counts from 0 on up...
   %ZZ = call zeroext i32 @bar()                     <i>; Return value is %zero extended</i>
 </pre>
 
+<p>llvm treats calls to some functions with names and arguments that match the
+standard C99 library as being the C99 library functions, and may perform
+optimizations or generate code for them under that assumption.  This is
+something we'd like to change in the future to provide better support for
+freestanding environments and non-C-based langauges.</p>
+
 </div>
 
 <!-- _______________________________________________________________________ -->