Files
clang-p2996/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
Sanjay Patel 452279efe2 [InstCombine] prevent miscompiles from select-of-div/rem transform
This avoids the danger shown in issue #60906.
There were no regression tests for these patterns, so these potential
failures have been around for a long time.

We freeze the condition and preserve the optimization because
getting rid of a div/rem is always a win.

Here are a couple of examples that can be corrected by freezing the
condition:
https://alive2.llvm.org/ce/z/sXHTTC

Differential Revision: https://reviews.llvm.org/D144671
2023-03-01 08:54:23 -05:00

138 KiB