Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RISCV][TTI] Add llvm.vp.select into canSplatOperand. #117982

Merged
merged 2 commits into from
Dec 2, 2024

Conversation

LiqinWeng
Copy link
Contributor

@LiqinWeng LiqinWeng commented Nov 28, 2024

The second operand of llvm.vp.select is a splat operand , it can help llvm.vp.select fold vv instructions to vx instructions.

@llvmbot
Copy link
Member

llvmbot commented Nov 28, 2024

@llvm/pr-subscribers-backend-risc-v

Author: LiqinWeng (LiqinWeng)

Changes

Patch is 134.56 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/117982.diff

2 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp (+1)
  • (modified) llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll (+566-411)
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 8f0ef69258b165..6af6e8b84bef38 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -2404,6 +2404,7 @@ bool RISCVTTIImpl::canSplatOperand(Instruction *I, int Operand) const {
   case Intrinsic::vp_ssub_sat:
   case Intrinsic::usub_sat:
   case Intrinsic::vp_usub_sat:
+  case Intrinsic::vp_select:
     return Operand == 1;
     // These intrinsics are commutative.
   case Intrinsic::vp_add:
diff --git a/llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll b/llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll
index c91b02e8f15e47..e42ad7719707fb 100644
--- a/llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll
@@ -2,7 +2,7 @@
 ; RUN: llc < %s -mtriple=riscv64 -mattr=+m,+v,+f -target-abi=lp64f \
 ; RUN:     | FileCheck %s
 
-define void @sink_splat_mul(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_mul(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_mul:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a2, 1
@@ -22,7 +22,7 @@ entry:
   %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds i32, ptr %a, i64 %index
   %wide.load = load <4 x i32>, ptr %0, align 4
@@ -32,11 +32,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_add(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_add(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_add:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a2, 1
@@ -56,7 +56,7 @@ entry:
   %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds i32, ptr %a, i64 %index
   %wide.load = load <4 x i32>, ptr %0, align 4
@@ -66,11 +66,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_sub(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_sub(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_sub:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a2, 1
@@ -90,7 +90,7 @@ entry:
   %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds i32, ptr %a, i64 %index
   %wide.load = load <4 x i32>, ptr %0, align 4
@@ -100,11 +100,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_rsub(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_rsub(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_rsub:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a2, 1
@@ -124,7 +124,7 @@ entry:
   %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds i32, ptr %a, i64 %index
   %wide.load = load <4 x i32>, ptr %0, align 4
@@ -134,11 +134,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_and(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_and(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_and:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a2, 1
@@ -158,7 +158,7 @@ entry:
   %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds i32, ptr %a, i64 %index
   %wide.load = load <4 x i32>, ptr %0, align 4
@@ -168,11 +168,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_or(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_or(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_or:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a2, 1
@@ -192,7 +192,7 @@ entry:
   %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds i32, ptr %a, i64 %index
   %wide.load = load <4 x i32>, ptr %0, align 4
@@ -202,11 +202,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_xor(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_xor(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_xor:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a2, 1
@@ -226,7 +226,7 @@ entry:
   %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds i32, ptr %a, i64 %index
   %wide.load = load <4 x i32>, ptr %0, align 4
@@ -236,11 +236,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_mul_scalable(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_mul_scalable(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_mul_scalable:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    csrr a5, vlenb
@@ -331,7 +331,7 @@ for.body:                                         ; preds = %for.body.preheader,
   br i1 %cmp.not, label %for.cond.cleanup, label %for.body
 }
 
-define void @sink_splat_add_scalable(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_add_scalable(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_add_scalable:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    csrr a5, vlenb
@@ -422,7 +422,7 @@ for.body:                                         ; preds = %for.body.preheader,
   br i1 %cmp.not, label %for.cond.cleanup, label %for.body
 }
 
-define void @sink_splat_sub_scalable(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_sub_scalable(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_sub_scalable:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    csrr a5, vlenb
@@ -513,7 +513,7 @@ for.body:                                         ; preds = %for.body.preheader,
   br i1 %cmp.not, label %for.cond.cleanup, label %for.body
 }
 
-define void @sink_splat_rsub_scalable(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_rsub_scalable(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_rsub_scalable:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    csrr a5, vlenb
@@ -604,7 +604,7 @@ for.body:                                         ; preds = %for.body.preheader,
   br i1 %cmp.not, label %for.cond.cleanup, label %for.body
 }
 
-define void @sink_splat_and_scalable(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_and_scalable(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_and_scalable:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    csrr a5, vlenb
@@ -695,7 +695,7 @@ for.body:                                         ; preds = %for.body.preheader,
   br i1 %cmp.not, label %for.cond.cleanup, label %for.body
 }
 
-define void @sink_splat_or_scalable(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_or_scalable(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_or_scalable:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    csrr a5, vlenb
@@ -786,7 +786,7 @@ for.body:                                         ; preds = %for.body.preheader,
   br i1 %cmp.not, label %for.cond.cleanup, label %for.body
 }
 
-define void @sink_splat_xor_scalable(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_xor_scalable(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_xor_scalable:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    csrr a5, vlenb
@@ -877,7 +877,7 @@ for.body:                                         ; preds = %for.body.preheader,
   br i1 %cmp.not, label %for.cond.cleanup, label %for.body
 }
 
-define void @sink_splat_shl(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_shl(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_shl:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a2, 1
@@ -897,7 +897,7 @@ entry:
   %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds i32, ptr %a, i64 %index
   %wide.load = load <4 x i32>, ptr %0, align 4
@@ -907,11 +907,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_lshr(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_lshr(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_lshr:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a2, 1
@@ -931,7 +931,7 @@ entry:
   %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds i32, ptr %a, i64 %index
   %wide.load = load <4 x i32>, ptr %0, align 4
@@ -941,11 +941,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_ashr(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_ashr(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_ashr:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a2, 1
@@ -965,7 +965,7 @@ entry:
   %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds i32, ptr %a, i64 %index
   %wide.load = load <4 x i32>, ptr %0, align 4
@@ -975,11 +975,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_shl_scalable(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_shl_scalable(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_shl_scalable:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    csrr a5, vlenb
@@ -1070,7 +1070,7 @@ for.body:                                         ; preds = %for.body.preheader,
   br i1 %cmp.not, label %for.cond.cleanup, label %for.body
 }
 
-define void @sink_splat_lshr_scalable(ptr nocapture %a, i32 signext %x) {
+define void @sink_splat_lshr_scalable(ptr %a, i32 %x) {
 ; CHECK-LABEL: sink_splat_lshr_scalable:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    csrr a5, vlenb
@@ -1161,7 +1161,7 @@ for.body:                                         ; preds = %for.body.preheader,
   br i1 %cmp.not, label %for.cond.cleanup, label %for.body
 }
 
-define void @sink_splat_ashr_scalable(ptr nocapture %a) {
+define void @sink_splat_ashr_scalable(ptr %a) {
 ; CHECK-LABEL: sink_splat_ashr_scalable:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    csrr a4, vlenb
@@ -1250,7 +1250,7 @@ for.body:                                         ; preds = %for.body.preheader,
   br i1 %cmp.not, label %for.cond.cleanup, label %for.body
 }
 
-define void @sink_splat_fmul(ptr nocapture %a, float %x) {
+define void @sink_splat_fmul(ptr %a, float %x) {
 ; CHECK-LABEL: sink_splat_fmul:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a1, 1
@@ -1270,7 +1270,7 @@ entry:
   %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds float, ptr %a, i64 %index
   %wide.load = load <4 x float>, ptr %0, align 4
@@ -1280,11 +1280,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_fdiv(ptr nocapture %a, float %x) {
+define void @sink_splat_fdiv(ptr %a, float %x) {
 ; CHECK-LABEL: sink_splat_fdiv:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a1, 1
@@ -1304,7 +1304,7 @@ entry:
   %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds float, ptr %a, i64 %index
   %wide.load = load <4 x float>, ptr %0, align 4
@@ -1314,11 +1314,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_frdiv(ptr nocapture %a, float %x) {
+define void @sink_splat_frdiv(ptr %a, float %x) {
 ; CHECK-LABEL: sink_splat_frdiv:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a1, 1
@@ -1338,7 +1338,7 @@ entry:
   %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds float, ptr %a, i64 %index
   %wide.load = load <4 x float>, ptr %0, align 4
@@ -1348,11 +1348,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_fadd(ptr nocapture %a, float %x) {
+define void @sink_splat_fadd(ptr %a, float %x) {
 ; CHECK-LABEL: sink_splat_fadd:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a1, 1
@@ -1372,7 +1372,7 @@ entry:
   %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds float, ptr %a, i64 %index
   %wide.load = load <4 x float>, ptr %0, align 4
@@ -1382,11 +1382,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_fsub(ptr nocapture %a, float %x) {
+define void @sink_splat_fsub(ptr %a, float %x) {
 ; CHECK-LABEL: sink_splat_fsub:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a1, 1
@@ -1406,7 +1406,7 @@ entry:
   %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds float, ptr %a, i64 %index
   %wide.load = load <4 x float>, ptr %0, align 4
@@ -1416,11 +1416,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_frsub(ptr nocapture %a, float %x) {
+define void @sink_splat_frsub(ptr %a, float %x) {
 ; CHECK-LABEL: sink_splat_frsub:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    lui a1, 1
@@ -1440,7 +1440,7 @@ entry:
   %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
   br label %vector.body
 
-vector.body:                                      ; preds = %vector.body, %entry
+vector.body:
   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
   %0 = getelementptr inbounds float, ptr %a, i64 %index
   %wide.load = load <4 x float>, ptr %0, align 4
@@ -1450,11 +1450,11 @@ vector.body:                                      ; preds = %vector.body, %entry
   %2 = icmp eq i64 %index.next, 1024
   br i1 %2, label %for.cond.cleanup, label %vector.body
 
-for.cond.cleanup:                                 ; preds = %vector.body
+for.cond.cleanup:
   ret void
 }
 
-define void @sink_splat_fmul_scalable(ptr nocapture %a, float %x) {
+define void @sink_splat_fmul_scalable(ptr %a, float %x) {
 ; CHECK-LABEL: sink_splat_fmul_scalable:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    csrr a1, vlenb
@@...
[truncated]

@@ -2,7 +2,7 @@
; RUN: llc < %s -mtriple=riscv64 -mattr=+m,+v,+f -target-abi=lp64f \
; RUN: | FileCheck %s

define void @sink_splat_mul(ptr nocapture %a, i32 signext %x) {
define void @sink_splat_mul(ptr %a, i32 %x) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to change these existing tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this information is unnecessary, so I deleted it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you split that out into a separate NFC PR just so we can make sure it isn't affecting this diff?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Could you also separate out the new tests in this PR into a separate commit so we can see the diff? Feel free to force push if you need

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -2,7 +2,7 @@
; RUN: llc < %s -mtriple=riscv64 -mattr=+m,+v,+f -target-abi=lp64f \
; RUN: | FileCheck %s

define void @sink_splat_mul(ptr nocapture %a, i32 signext %x) {
define void @sink_splat_mul(ptr %a, i32 %x) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you split that out into a separate NFC PR just so we can make sure it isn't affecting this diff?

@@ -22,7 +22,7 @@ entry:
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body

vector.body: ; preds = %vector.body, %entry
vector.body:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here for these comments, I think these are obscuring the actual code related changes from the diff

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you nean delete it or not?

@lukel97
Copy link
Contributor

lukel97 commented Dec 2, 2024

Thanks. Maybe add a bit in the PR description to mention that this allows us to select vmerge.vxm?

@LiqinWeng LiqinWeng merged commit ede5709 into llvm:main Dec 2, 2024
8 checks passed
@LiqinWeng LiqinWeng deleted the sink-splat-op branch December 10, 2024 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants