InstCombine: incorrect select fast-math folds #49625
Labels
bugzilla
Issues migrated from bugzilla
floating-point
Floating-point math
llvm:instcombine
miscompilation
Extended Description
Alive2 reports a few incorrect optimizations around select w/ fast-math in Transforms/InstCombine/minmax-fp.ll:
nsz allows the output to be +0/-0 non-deterministically. In this example, the source always returns +0 and the target may return +0 or -0. The select in src would need nsz as well:
select nnan only applies to the chosen operand (?). If that's the case then the optimization below isn't correct for a NaN input. If nnan applies to both select operands, then fptrunc_select_true_val_extra_use in fptrunc.ll is incorrect.
The text was updated successfully, but these errors were encountered: