[PATCH] D93065: [InstCombine] Disable optimizations of select instructions that causes propagation of poison values

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 10:17:43 PST 2020


aqjune added a comment.

In D93065#2464486 <https://reviews.llvm.org/D93065#2464486>, @aqjune wrote:

> Assuming that all relevant optimizations are fully implemented in both scenarios (and/or with freeze vs. select), I think their performance diff should be zero because C/C++ constrains variables to have well-defined values.
> Currently, this isn't enforced by clang. We already have !noundef, and simply attaching it to loads will do the trick.

Thinking about this again, this isn't true. Since !noundef can be stripped when the load is hoisted, there still is a possible UB loss.
So, in terms of preserving UB, using select will be the better approach.

But, there are so many transformations to consider if select is used; from InstCombine optimizations that involve `And`/`Or` to analysis, simplifycfg, etc. It seems to fix all of them is a hard job.


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

https://reviews.llvm.org/D93065



More information about the llvm-commits mailing list