[llvm-dev] Killing undef and spreading poison
Mehdi Amini via llvm-dev
llvm-dev at lists.llvm.org
Tue Oct 18 14:30:00 PDT 2016
> On Oct 18, 2016, at 12:44 PM, Sanjoy Das via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Hi,
>
> Nuno Lopes wrote:
>
>>> Okay; so the problem is that an instruction that is value-equivalent
>>> to a poison value is not itself necessarily poison?
>>
>> Right.
>> I think there were other examples, but I don't have them here handy. But
>> at least this one is very problematic for GVN.
>
> Another example is this:
>
> void f(int k) {
> if (k != 0) {
> for (< finite loop >) {
> if (always_false_at_runtime) {
> print(1 / k);
> }
> }
> }
> }
>
> We'd like to hoist the `1 / k` computation to the preheader. However, we can't do that today if `k` is undef, and we've defined branching on undef to be a non-deterministic choice.
This one isn’t clear to me: you can fold 1/k -> 1 when k is undef. And then it is a constant which makes no point to hoist?
—
Mehdi
>
> I have some more details at: http://www.playingwithpointers.com/problem-with-undef.html
>
> -- Sanjoy
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list