From c30f6e1c89e5a046ab9a58b08248cbb3c796529c Mon Sep 17 00:00:00 2001
From: Dan Gohman
Date: Mon, 26 Apr 2010 20:54:53 +0000
Subject: [PATCH] Branching or switching on trap transfers imminent undefined
behavior onto control-dependent instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102381 91177308-0d34-0410-b5e6-96231b3b80d8
---
docs/LangRef.html | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/docs/LangRef.html b/docs/LangRef.html
index ab69b05bbf3..c1788ada2b9 100644
--- a/docs/LangRef.html
+++ b/docs/LangRef.html
@@ -2318,6 +2318,15 @@ has undefined behavior.
Any instruction with a trap operand which may have side effects emits
those side effects as if it had an undef operand instead.
+If a br or
+ switch instruction has a trap value
+ operand, all non-phi non-void instructions which control-depend on it
+ have trap as their result value. If any instruction which
+ control-depends on the br or switch invokes externally
+ visible side effects, the behavior of the program is undefined.
+
+
+
For example, an and of a trap value with
zero still has a trap value result. Using that value as an index in a
getelementptr yields a trap