[PATCH] D92270: [ConstantFold] Fold more operations to poison

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 05:27:56 PST 2020


uabelho added a comment.

In D92270#2422625 <https://reviews.llvm.org/D92270#2422625>, @aqjune wrote:

> Hi,
>
> It seems it is related to two optimizations:
> (1) `select i1 x, true, y` -> `or i1 x, y`
> (2) `or i1 x, poison` -> `poison`
>
> Semantically, the first one is broken. It needs to freeze y. But, it will introduce a lot of freeze instructions. The clang patches that introduce noundef to function arguments is still ongoing.
> Another workaround is to weaken (2) to `or i1 x, poison` -> `x`. This fixes the miscompilation; I'll push a commit that does this.

Should langref also be updated to describe this? Or does it already?
I just found this "An instruction that depends on a poison value, produces a poison value itself.".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92270/new/

https://reviews.llvm.org/D92270



More information about the llvm-commits mailing list