[llvm] [VectorCombine] Scalarize binop-like intrinsics (PR #138095)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu May 1 08:12:02 PDT 2025
================
@@ -0,0 +1,97 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -S -p vector-combine | FileCheck %s
+
+define <4 x i32> @umax_fixed(i32 %x, i32 %y) {
+; CHECK-LABEL: define <4 x i32> @umax_fixed(
+; CHECK-SAME: i32 [[X:%.*]], i32 [[Y:%.*]]) {
+; CHECK-NEXT: [[V_SCALAR:%.*]] = call i32 @llvm.umax.i32(i32 [[X]], i32 [[Y]])
+; CHECK-NEXT: [[TMP1:%.*]] = call <4 x i32> @llvm.umax.v4i32(<4 x i32> poison, <4 x i32> poison)
----------------
lukel97 wrote:
It looks like umax and most other intrinsics I've tried only fold to poison if both operands are poison! If only one operand is poison, i.e. what vector combine produces if one argument is constant, then it produces a specific constant as if the poison was an undef.
Alive2 claims it's correct to fold to poison here: https://alive2.llvm.org/ce/z/6d_oHO
Making a note here to fix it later. I don't think this needs to block this patch since I'm not expecting this combine to be hit frequently until instcombine starts canonicalizing intrinsics to this form.
https://github.com/llvm/llvm-project/pull/138095
More information about the llvm-commits
mailing list