[llvm] [InstCombine] Fix for folding select-like `shufflevector` into floating point binary operators. (PR #85452)

Michele Scandale via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 10:08:34 PDT 2024


================
@@ -380,7 +380,7 @@ define <4 x double> @fdiv_constant_op0(<4 x double> %v) {
   ret <4 x double> %s
 }
 
-define <4 x double> @fdiv_constant_op1(<4 x double> %v) {
+define <4 x double> @fdiv_constant_op1(<4 x double> nofpclass(nan) %v) {
 ; CHECK-LABEL: @fdiv_constant_op1(
 ; CHECK-NEXT:    [[S:%.*]] = fdiv reassoc <4 x double> [[V:%.*]], <double undef, double 1.000000e+00, double 4.300000e+01, double 4.400000e+01>
 ; CHECK-NEXT:    ret <4 x double> [[S]]
----------------
michele-scandale wrote:

I've added the test case `fadd_maybe_nan` to check that the transformation doesn't occur if the value might be a NaN. The other tests cases where I added `nofpclass(nan)` seems to cover the propagation of the fast-math flags in the transformation. Not sure if it is worth duplicating those test cases.

https://github.com/llvm/llvm-project/pull/85452


More information about the llvm-commits mailing list