[PATCH] D63044: [LangRef] Clarify poison semantics
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 9 13:55:08 PDT 2019
aqjune added inline comments.
================
Comment at: llvm/docs/LangRef.rst:3274
+- The divisor operand of a ``udiv``, ``sdiv``, ``urem`` or ``srem``
+ instruction.
+
----------------
How about mentioning right-shift operations on poison (e.g. `ashr x, poison`) as well?
Its semantics is equivalent to `x / 2^y` when x and y are non-poison(and non-undef), but LLVM seems to hoist `ashr x, poison` during optimization, implying that it cannot be UB : https://godbolt.org/z/2LG0xX .
================
Comment at: llvm/docs/LangRef.rst:3276
+
+Additionally, undefined behavior occurs if a side effect depends on poison.
----------------
jdoerfert wrote:
> Now, side effects, what do we count and why do we have it explicitly.
>
> Also, should we explicitly mention control flow or is it sufficiently covered by the "*depends*" definition above?
I also think that control flow on poison is an important issue.
https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/Scalar/LoopUnswitch.cpp#L585 also mentions that there's discrepancy between semantics of branch on undef/poison.
My suggestion is to mention the discrepancy explicitly here so people can acknowledge the issue while reading LangRef.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63044/new/
https://reviews.llvm.org/D63044
More information about the llvm-commits
mailing list