[PATCH] D51207: Introduce llvm.experimental.widenable_condition intrinsic

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 16 21:03:21 PDT 2018


mkazantsev added inline comments.
Herald added a subscriber: nhaehnle.


================
Comment at: docs/LangRef.rst:15161
+
+  %widenable_cond = call i1 @llvm.experimental.widenable.condition()
+  %new_cond = and i1 %any_other_cond, %widenable_cond
----------------
sanjoy wrote:
> mkazantsev wrote:
> > sanjoy wrote:
> > > Not sure if this belongs in the langref, but the intrinsic must be RAUW'ed with the stronger condition, replacing just one use is unsound right?
> > I see no problem in replacing only one use. It maybe makes no sense, but by definition it should be no bug.
> What happens if the initial program is:
> 
> ```
> %c = widenable_cond();
> %x = xor %c, %c
> ```
> 
> In this original program `%x` is always `false`, but if you replace one use of `%c` with a different value than the other use then `%x` may not be `false`.
We should preserve the invariant that the program is correct whether `%c` is `true` or `false`; even in your example we should guarantee that any value of `%x` that can be produced this way still leads to correct program execution. But I agree that there can be something fishy there; I'll make this correction.


https://reviews.llvm.org/D51207





More information about the llvm-commits mailing list