[llvm] 152ed59 - [NFC][LLVM][Tests] Add RUN lines to verify Constant{Int/FP} based splats.

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 03:22:14 PDT 2025


Author: Paul Walker
Date: 2025-09-17T10:20:59Z
New Revision: 152ed59a9f2c644d1888f11b9ba0e7245fd26a54

URL: https://github.com/llvm/llvm-project/commit/152ed59a9f2c644d1888f11b9ba0e7245fd26a54
DIFF: https://github.com/llvm/llvm-project/commit/152ed59a9f2c644d1888f11b9ba0e7245fd26a54.diff

LOG: [NFC][LLVM][Tests] Add RUN lines to verify Constant{Int/FP} based splats.

  llvm/test/Transforms/Attributor/nofpclass.ll
  llvm/test/Transforms/InstCombine/exact.ll
  llvm/test/Transforms/InstCombine/load-store-forward.ll
  llvm/test/Transforms/SCCP/overdefined-ext.ll

Added: 
    

Modified: 
    llvm/test/Transforms/Attributor/nofpclass.ll
    llvm/test/Transforms/InstCombine/exact.ll
    llvm/test/Transforms/InstCombine/load-store-forward.ll
    llvm/test/Transforms/SCCP/overdefined-ext.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/Attributor/nofpclass.ll b/llvm/test/Transforms/Attributor/nofpclass.ll
index 6491f01a6d2a3..a9ebdaa397015 100644
--- a/llvm/test/Transforms/Attributor/nofpclass.ll
+++ b/llvm/test/Transforms/Attributor/nofpclass.ll
@@ -1,6 +1,9 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --version 2
-; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-annotate-decl-cs  -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
-; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -use-constant-fp-for-scalable-splat=false -S < %s | FileCheck %s --check-prefixes=CHECK,CHECK-CV,TUNIT,TUNIT-CV
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -use-constant-fp-for-scalable-splat=false -S < %s | FileCheck %s --check-prefixes=CHECK,CHECK-CV,CGSCC,CGSCC-CV
+
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -use-constant-fp-for-scalable-splat -S < %s | FileCheck %s --check-prefixes=CHECK,CHECK-CI,TUNIT,TUNIT-CI
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -use-constant-fp-for-scalable-splat -S < %s | FileCheck %s --check-prefixes=CHECK,CHECK-CI,CGSCC,CGSCC-CI
 
 declare nofpclass(nan) float @ret_nofpclass_nan()
 declare [2 x [3 x float]] @ret_array()
@@ -2468,7 +2471,7 @@ define internal float @through_memory0(ptr %ptr.arg) {
 ; CGSCC-SAME: (float [[TMP0:%.*]]) #[[ATTR3]] {
 ; CGSCC-NEXT:    [[PTR_ARG_PRIV:%.*]] = alloca float, align 4
 ; CGSCC-NEXT:    store float [[TMP0]], ptr [[PTR_ARG_PRIV]], align 4
-; CGSCC-NEXT:    [[LOAD:%.*]] = load float, ptr [[PTR_ARG_PRIV]], align 4
+; CGSCC-NEXT:    [[LOAD:%.*]] = load float, ptr [[PTR_ARG_PRIV]], align 4, !invariant.load [[META0:![0-9]+]]
 ; CGSCC-NEXT:    ret float [[LOAD]]
 ;
   %load = load float, ptr %ptr.arg
@@ -2491,7 +2494,7 @@ define internal float @through_memory1(ptr %ptr.arg) {
 ; CGSCC-SAME: (float [[TMP0:%.*]]) #[[ATTR3]] {
 ; CGSCC-NEXT:    [[PTR_ARG_PRIV:%.*]] = alloca float, align 4
 ; CGSCC-NEXT:    store float [[TMP0]], ptr [[PTR_ARG_PRIV]], align 4
-; CGSCC-NEXT:    [[LOAD:%.*]] = load float, ptr [[PTR_ARG_PRIV]], align 4
+; CGSCC-NEXT:    [[LOAD:%.*]] = load float, ptr [[PTR_ARG_PRIV]], align 4, !invariant.load [[META0]]
 ; CGSCC-NEXT:    [[CALL:%.*]] = call float @llvm.arithmetic.fence.f32(float [[LOAD]]) #[[ATTR19]]
 ; CGSCC-NEXT:    ret float [[CALL]]
 ;
@@ -2507,7 +2510,7 @@ define internal float @through_memory2(ptr %ptr.arg) {
 ; CHECK-SAME: (float [[TMP0:%.*]]) #[[ATTR15:[0-9]+]] {
 ; CHECK-NEXT:    [[PTR_ARG_PRIV:%.*]] = alloca float, align 4
 ; CHECK-NEXT:    store float [[TMP0]], ptr [[PTR_ARG_PRIV]], align 4
-; CHECK-NEXT:    [[LOAD:%.*]] = load float, ptr [[PTR_ARG_PRIV]], align 4
+; CHECK-NEXT:    [[LOAD:%.*]] = load float, ptr [[PTR_ARG_PRIV]], align 4, !invariant.load [[META0:![0-9]+]]
 ; CHECK-NEXT:    [[CALL:%.*]] = call float @extern.f32(float [[LOAD]])
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
@@ -2664,10 +2667,15 @@ define [4 x float] @constant_aggregate_zero() {
 }
 
 define <vscale x 4 x float> @scalable_splat_pnorm() {
-; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
-; CHECK-LABEL: define noundef <vscale x 4 x float> @scalable_splat_pnorm
-; CHECK-SAME: () #[[ATTR3]] {
-; CHECK-NEXT:    ret <vscale x 4 x float> splat (float 1.000000e+00)
+; CHECK-CV: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; CHECK-CV-LABEL: define noundef <vscale x 4 x float> @scalable_splat_pnorm
+; CHECK-CV-SAME: () #[[ATTR3]] {
+; CHECK-CV-NEXT:    ret <vscale x 4 x float> splat (float 1.000000e+00)
+;
+; CHECK-CI: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; CHECK-CI-LABEL: define noundef nofpclass(nan inf zero sub nnorm) <vscale x 4 x float> @scalable_splat_pnorm
+; CHECK-CI-SAME: () #[[ATTR3]] {
+; CHECK-CI-NEXT:    ret <vscale x 4 x float> splat (float 1.000000e+00)
 ;
   ret <vscale x 4 x float> splat (float 1.0)
 }
@@ -2978,3 +2986,8 @@ attributes #2 = { "denormal-fp-math"="ieee,preserve-sign" }
 attributes #3 = { "denormal-fp-math"="positive-zero,positive-zero" }
 attributes #4 = { "denormal-fp-math"="positive-zero,ieee" }
 attributes #5 = { "denormal-fp-math"="ieee,positive-zero" }
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; CGSCC-CI: {{.*}}
+; CGSCC-CV: {{.*}}
+; TUNIT-CI: {{.*}}
+; TUNIT-CV: {{.*}}

diff  --git a/llvm/test/Transforms/InstCombine/exact.ll b/llvm/test/Transforms/InstCombine/exact.ll
index c7377ab17d540..819e8fbb89b5f 100644
--- a/llvm/test/Transforms/InstCombine/exact.ll
+++ b/llvm/test/Transforms/InstCombine/exact.ll
@@ -1,5 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -passes=instcombine -S | FileCheck %s
+; RUN: opt < %s -passes=instcombine -use-constant-int-for-fixed-length-splat=false -S | FileCheck %s --check-prefixes=CHECK,CHECK-CV
+; RUN: opt < %s -passes=instcombine -use-constant-int-for-fixed-length-splat -S | FileCheck %s --check-prefixes=CHECK,CHECK-CI
 
 define i32 @sdiv1(i32 %x) {
 ; CHECK-LABEL: @sdiv1(
@@ -162,12 +163,16 @@ define i1 @pr9998(i32 %V) {
 
 ; FIXME: Vectors should fold the same way.
 define <2 x i1> @pr9998vec(<2 x i32> %V) {
-; CHECK-LABEL: @pr9998vec(
-; CHECK-NEXT:    [[TMP1:%.*]] = and <2 x i32> [[V:%.*]], splat (i32 1)
-; CHECK-NEXT:    [[X:%.*]] = sub nsw <2 x i32> zeroinitializer, [[TMP1]]
-; CHECK-NEXT:    [[Y:%.*]] = sext <2 x i32> [[X]] to <2 x i64>
-; CHECK-NEXT:    [[Z:%.*]] = icmp ugt <2 x i64> [[Y]], splat (i64 7297771788697658747)
-; CHECK-NEXT:    ret <2 x i1> [[Z]]
+; CHECK-CV-LABEL: @pr9998vec(
+; CHECK-CV-NEXT:    [[TMP1:%.*]] = and <2 x i32> [[V:%.*]], splat (i32 1)
+; CHECK-CV-NEXT:    [[X:%.*]] = sub nsw <2 x i32> zeroinitializer, [[TMP1]]
+; CHECK-CV-NEXT:    [[Y:%.*]] = sext <2 x i32> [[X]] to <2 x i64>
+; CHECK-CV-NEXT:    [[Z:%.*]] = icmp ugt <2 x i64> [[Y]], splat (i64 7297771788697658747)
+; CHECK-CV-NEXT:    ret <2 x i1> [[Z]]
+;
+; CHECK-CI-LABEL: @pr9998vec(
+; CHECK-CI-NEXT:    [[Z:%.*]] = trunc <2 x i32> [[V:%.*]] to <2 x i1>
+; CHECK-CI-NEXT:    ret <2 x i1> [[Z]]
 ;
   %W = shl <2 x i32> %V, <i32 31, i32 31>
   %X = ashr exact <2 x i32> %W, <i32 31, i32 31>

diff  --git a/llvm/test/Transforms/InstCombine/load-store-forward.ll b/llvm/test/Transforms/InstCombine/load-store-forward.ll
index 0f03f16062e52..72329f637d8b3 100644
--- a/llvm/test/Transforms/InstCombine/load-store-forward.ll
+++ b/llvm/test/Transforms/InstCombine/load-store-forward.ll
@@ -1,6 +1,8 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -S -passes=instcombine < %s | FileCheck %s --check-prefixes=CHECK,LITTLE
-; RUN: opt -S -passes=instcombine -data-layout="E" < %s | FileCheck %s --check-prefixes=CHECK,BIG
+; RUN: opt -S -passes=instcombine -use-constant-int-for-scalable-splat=false -use-constant-fp-for-scalable-splat=false < %s | FileCheck %s --check-prefixes=CHECK,CHECK-CV,LITTLE,LITTLE-CV
+; RUN: opt -S -passes=instcombine -use-constant-int-for-scalable-splat -use-constant-fp-for-scalable-splat < %s | FileCheck %s --check-prefixes=CHECK,CHECK-CI,LITTLE,LITTLE-CI
+; RUN: opt -S -passes=instcombine -data-layout="E" -use-constant-int-for-scalable-splat=false -use-constant-fp-for-scalable-splat=false < %s | FileCheck %s --check-prefixes=CHECK,CHECK-CV,BIG,BIG-CV
+; RUN: opt -S -passes=instcombine -data-layout="E" -use-constant-int-for-scalable-splat -use-constant-fp-for-scalable-splat < %s | FileCheck %s --check-prefixes=CHECK,CHECK-CI,BIG,BIG-CI
 
 define i8 @load_smaller_int(ptr %p) {
 ; LITTLE-LABEL: @load_smaller_int(
@@ -101,11 +103,16 @@ define i32 @vec_store_load_overlap(ptr %p) {
 }
 
 define i32 @load_i32_store_nxv4i32(ptr %a) {
-; CHECK-LABEL: @load_i32_store_nxv4i32(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    store <vscale x 4 x i32> splat (i32 1), ptr [[A:%.*]], align 16
-; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr [[A]], align 4
-; CHECK-NEXT:    ret i32 [[TMP0]]
+; CHECK-CV-LABEL: @load_i32_store_nxv4i32(
+; CHECK-CV-NEXT:  entry:
+; CHECK-CV-NEXT:    store <vscale x 4 x i32> splat (i32 1), ptr [[A:%.*]], align 16
+; CHECK-CV-NEXT:    [[TMP0:%.*]] = load i32, ptr [[A]], align 4
+; CHECK-CV-NEXT:    ret i32 [[TMP0]]
+;
+; CHECK-CI-LABEL: @load_i32_store_nxv4i32(
+; CHECK-CI-NEXT:  entry:
+; CHECK-CI-NEXT:    store <vscale x 4 x i32> splat (i32 1), ptr [[A:%.*]], align 16
+; CHECK-CI-NEXT:    ret i32 1
 ;
 entry:
   store <vscale x 4 x i32> splat (i32 1), ptr %a, align 16
@@ -153,11 +160,16 @@ entry:
 }
 
 define float @load_f32_store_nxv4f32(ptr %a) {
-; CHECK-LABEL: @load_f32_store_nxv4f32(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    store <vscale x 4 x float> splat (float 1.000000e+00), ptr [[A:%.*]], align 16
-; CHECK-NEXT:    [[TMP0:%.*]] = load float, ptr [[A]], align 4
-; CHECK-NEXT:    ret float [[TMP0]]
+; CHECK-CV-LABEL: @load_f32_store_nxv4f32(
+; CHECK-CV-NEXT:  entry:
+; CHECK-CV-NEXT:    store <vscale x 4 x float> splat (float 1.000000e+00), ptr [[A:%.*]], align 16
+; CHECK-CV-NEXT:    [[TMP0:%.*]] = load float, ptr [[A]], align 4
+; CHECK-CV-NEXT:    ret float [[TMP0]]
+;
+; CHECK-CI-LABEL: @load_f32_store_nxv4f32(
+; CHECK-CI-NEXT:  entry:
+; CHECK-CI-NEXT:    store <vscale x 4 x float> splat (float 1.000000e+00), ptr [[A:%.*]], align 16
+; CHECK-CI-NEXT:    ret float 1.000000e+00
 ;
 entry:
   store <vscale x 4 x float> splat (float 1.0), ptr %a, align 16
@@ -166,11 +178,16 @@ entry:
 }
 
 define i32 @load_i32_store_nxv4f32(ptr %a) {
-; CHECK-LABEL: @load_i32_store_nxv4f32(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    store <vscale x 4 x float> splat (float 1.000000e+00), ptr [[A:%.*]], align 16
-; CHECK-NEXT:    [[LOAD:%.*]] = load i32, ptr [[A]], align 4
-; CHECK-NEXT:    ret i32 [[LOAD]]
+; CHECK-CV-LABEL: @load_i32_store_nxv4f32(
+; CHECK-CV-NEXT:  entry:
+; CHECK-CV-NEXT:    store <vscale x 4 x float> splat (float 1.000000e+00), ptr [[A:%.*]], align 16
+; CHECK-CV-NEXT:    [[LOAD:%.*]] = load i32, ptr [[A]], align 4
+; CHECK-CV-NEXT:    ret i32 [[LOAD]]
+;
+; CHECK-CI-LABEL: @load_i32_store_nxv4f32(
+; CHECK-CI-NEXT:  entry:
+; CHECK-CI-NEXT:    store <vscale x 4 x float> splat (float 1.000000e+00), ptr [[A:%.*]], align 16
+; CHECK-CI-NEXT:    ret i32 1065353216
 ;
 entry:
   store <vscale x 4 x float> splat (float 1.0), ptr %a, align 16
@@ -506,3 +523,8 @@ define <vscale x 1 x i32> @load_after_memset_0_scalable(ptr %a) {
 }
 
 declare void @llvm.memset.p0.i64(ptr, i8, i64, i1)
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; BIG-CI: {{.*}}
+; BIG-CV: {{.*}}
+; LITTLE-CI: {{.*}}
+; LITTLE-CV: {{.*}}

diff  --git a/llvm/test/Transforms/SCCP/overdefined-ext.ll b/llvm/test/Transforms/SCCP/overdefined-ext.ll
index e08acd20cc2ac..16eecba60d58c 100644
--- a/llvm/test/Transforms/SCCP/overdefined-ext.ll
+++ b/llvm/test/Transforms/SCCP/overdefined-ext.ll
@@ -1,5 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -passes=sccp -S | FileCheck %s
+; RUN: opt < %s -passes=sccp -use-constant-int-for-fixed-length-splat=false -S | FileCheck %s --check-prefixes=CHECK,CHECK-CV
+; RUN: opt < %s -passes=sccp -use-constant-int-for-fixed-length-splat -S | FileCheck %s --check-prefixes=CHECK,CHECK-CI
 
 define i32 @zext_lshr(i1 %t0) {
 ; CHECK-LABEL: @zext_lshr(
@@ -24,10 +25,14 @@ define i1 @zext_icmp(i1 %t0) {
 ; TODO: SCCP operates poorly with vector ranges
 
 define <2 x i1> @zext_vector(<2 x i1> %t0) {
-; CHECK-LABEL: @zext_vector(
-; CHECK-NEXT:    [[T1:%.*]] = zext <2 x i1> [[T0:%.*]] to <2 x i32>
-; CHECK-NEXT:    [[T2:%.*]] = icmp eq <2 x i32> [[T1]], splat (i32 2)
-; CHECK-NEXT:    ret <2 x i1> [[T2]]
+; CHECK-CV-LABEL: @zext_vector(
+; CHECK-CV-NEXT:    [[T1:%.*]] = zext <2 x i1> [[T0:%.*]] to <2 x i32>
+; CHECK-CV-NEXT:    [[T2:%.*]] = icmp eq <2 x i32> [[T1]], splat (i32 2)
+; CHECK-CV-NEXT:    ret <2 x i1> [[T2]]
+;
+; CHECK-CI-LABEL: @zext_vector(
+; CHECK-CI-NEXT:    [[T1:%.*]] = zext <2 x i1> [[T0:%.*]] to <2 x i32>
+; CHECK-CI-NEXT:    ret <2 x i1> zeroinitializer
 ;
   %t1 = zext <2 x i1> %t0 to <2 x i32>
   %t2 = icmp eq <2 x i32> %t1, <i32 2, i32 2>
@@ -72,10 +77,14 @@ define i1 @sext_icmp(i1 %t0) {
 ; TODO: SCCP operates poorly with vector ranges
 
 define <2 x i1> @sext_vector(<2 x i1> %t0) {
-; CHECK-LABEL: @sext_vector(
-; CHECK-NEXT:    [[T1:%.*]] = sext <2 x i1> [[T0:%.*]] to <2 x i32>
-; CHECK-NEXT:    [[T2:%.*]] = icmp eq <2 x i32> [[T1]], splat (i32 2)
-; CHECK-NEXT:    ret <2 x i1> [[T2]]
+; CHECK-CV-LABEL: @sext_vector(
+; CHECK-CV-NEXT:    [[T1:%.*]] = sext <2 x i1> [[T0:%.*]] to <2 x i32>
+; CHECK-CV-NEXT:    [[T2:%.*]] = icmp eq <2 x i32> [[T1]], splat (i32 2)
+; CHECK-CV-NEXT:    ret <2 x i1> [[T2]]
+;
+; CHECK-CI-LABEL: @sext_vector(
+; CHECK-CI-NEXT:    [[T1:%.*]] = sext <2 x i1> [[T0:%.*]] to <2 x i32>
+; CHECK-CI-NEXT:    ret <2 x i1> zeroinitializer
 ;
   %t1 = sext <2 x i1> %t0 to <2 x i32>
   %t2 = icmp eq <2 x i32> %t1, <i32 2, i32 2>


        


More information about the llvm-commits mailing list