From: Dan Gohman Date: Mon, 26 Apr 2010 20:54:53 +0000 (+0000) Subject: Branching or switching on trap transfers imminent undefined behavior X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=c30f6e1c89e5a046ab9a58b08248cbb3c796529c;p=oota-llvm.git 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 --- 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