[llvm-commits] [llvm] r129404 - /llvm/trunk/docs/LangRef.html

Dan Gohman gohman at apple.com
Tue Apr 12 16:05:59 PDT 2011


Author: djg
Date: Tue Apr 12 18:05:59 2011
New Revision: 129404

URL: http://llvm.org/viewvc/llvm-project?rev=129404&view=rev
Log:
Fix a hole in the definition of "dependence" used by trap values. Trap
values are also transmitted through branches which cause side effects to
be skipped altogether.

Modified:
    llvm/trunk/docs/LangRef.html

Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=129404&r1=129403&r2=129404&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Tue Apr 12 18:05:59 2011
@@ -2371,6 +2371,11 @@
     is always executed when control transfers to one of the successors, and
     may not be executed when control is transfered to another.</li>
 
+<li>Additionally, an instruction also <i>control-depends</i> on a terminator
+    instruction if the set of instructions it otherwise depends on would be
+    different if the terminator had transfered control to a different
+    successor.</li>
+
 <li>Dependence is transitive.</li>
 
 </ul>
@@ -2413,8 +2418,23 @@
                                      ; control-dependent on %cmp, so this
                                      ; always results in a trap value.
 
-  volatile store i32 0, i32* @g      ; %end is control-equivalent to %entry
-                                     ; so this is defined (ignoring earlier
+  volatile store i32 0, i32* @g      ; This would depend on the store in %true
+                                     ; if %cmp is true, or the store in %entry
+                                     ; otherwise, so this is undefined behavior.
+
+  %br i1 %cmp, %second_true, %second_end
+                                     ; The same branch again, but this time the
+                                     ; true block doesn't have side effects.
+
+second_true:
+  ; No side effects!
+  br label %end
+
+second_end:
+  volatile store i32 0, i32* @g      ; This time, the instruction always depends
+                                     ; on the store in %end. Also, it is
+                                     ; control-equivalent to %end, so this is
+                                     ; well- defined (again, ignoring earlier
                                      ; undefined behavior in this example).
 </pre>
 





More information about the llvm-commits mailing list