[llvm] [LLVM][ConstFolds] Verify a scalar src before attempting scalar->vector bitcast transformation. (PR #111149)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 09:44:12 PDT 2024


================
@@ -276,3 +296,14 @@ define <16 x i8> @bitcast_constexpr_16i8_8i16_u256uuu256uu() {
   %cast = bitcast <8 x i16><i16 undef, i16 256, i16 undef, i16 undef, i16 undef, i16 256, i16 undef, i16 undef> to <16 x i8>
   ret <16 x i8> %cast
 }
+
+define <1 x i32> @bitcast_constexpr_scalar_fp_to_vector_int() {
+; CONSTVEC-LABEL: @bitcast_constexpr_scalar_fp_to_vector_int(
+; CONSTVEC-NEXT:    ret <1 x i32> <i32 1065353216>
+;
+; CONSTSPLAT-LABEL: @bitcast_constexpr_scalar_fp_to_vector_int(
+; CONSTSPLAT-NEXT:    ret <1 x i32> bitcast (<1 x float> splat (float 1.000000e+00) to <1 x i32>)
----------------
nikic wrote:

This one should still fold...

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


More information about the llvm-commits mailing list