diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -14958,7 +14958,8 @@ or the memory layout) can be expressed using the matrix intrinsics. Matrixes are embedded in a flat vector and the intrinsics take the dimensions as arguments. Currently column-major layout is assumed. The intrinsics support both integer -and floating point matrixes. +and floating point matrixes. Functions containing calls to matrix intrinsics +must have the 'may-contain-matrix-intrinsics' attribute set to true. '``llvm.matrix.transpose.*``' Intrinsic diff --git a/llvm/include/llvm/IR/Attributes.td b/llvm/include/llvm/IR/Attributes.td --- a/llvm/include/llvm/IR/Attributes.td +++ b/llvm/include/llvm/IR/Attributes.td @@ -222,6 +222,7 @@ def NoJumpTables : StrBoolAttr<"no-jump-tables">; def NoInlineLineTables : StrBoolAttr<"no-inline-line-tables">; def ProfileSampleAccurate : StrBoolAttr<"profile-sample-accurate">; +def MayContainMatrixIntrinsics : StrBoolAttr<"may-contain-matrix-intrinsics">; class CompatRule { // The name of the function called to check the attribute of the caller and @@ -258,6 +259,7 @@ def : MergeRule<"setOR">; def : MergeRule<"setOR">; def : MergeRule<"setOR">; +def : MergeRule<"setOR">; def : MergeRule<"adjustCallerSSPLevel">; def : MergeRule<"adjustCallerStackProbes">; def : MergeRule<"adjustCallerStackProbeSize">; diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -4791,6 +4791,17 @@ Assert(Size % 16 == 0, "bswap must be an even number of bytes", &Call); break; } + case Intrinsic::matrix_multiply: + case Intrinsic::matrix_transpose: + case Intrinsic::matrix_columnwise_load: + case Intrinsic::matrix_columnwise_store: { + Function *ParentFn = Call.getParent()->getParent(); + Assert(ParentFn->getFnAttribute("may-contain-matrix-intrinsics") + .getValueAsString() == "true", + "functions with matrix intrinsics must have the " + "may-contain-matrix-intrinsics attribute"); + break; + } }; } diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -149,10 +149,6 @@ "enable-order-file-instrumentation", cl::init(false), cl::Hidden, cl::desc("Enable order file instrumentation (default = off)")); -static cl::opt - EnableMatrix("enable-matrix", cl::init(false), cl::Hidden, - cl::desc("Enable lowering of the matrix intrinsics")); - PassManagerBuilder::PassManagerBuilder() { OptLevel = 2; SizeLevel = 0; @@ -701,13 +697,7 @@ MPM.add(createFloat2IntPass()); MPM.add(createLowerConstantIntrinsicsPass()); - if (EnableMatrix) { - MPM.add(createLowerMatrixIntrinsicsPass()); - // CSE the pointer arithmetic of the column vectors. This allows alias - // analysis to establish no-aliasing between loads and stores of different - // columns of the same matrix. - MPM.add(createEarlyCSEPass(false)); - } + MPM.add(createLowerMatrixIntrinsicsPass()); addExtensionsToPM(EP_VectorizerStart, MPM); diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp --- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp +++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp @@ -614,6 +614,8 @@ for (Instruction *Inst : reverse(ToRemove)) Inst->eraseFromParent(); + // All matrix intrinsics have been removed. + Func.removeFnAttr("may-contain-matrix-intrinsics"); return Changed; } @@ -1479,6 +1481,11 @@ }; } // namespace +static bool shouldRunMatrixLowering(Function &F) { + return F.getFnAttribute("may-contain-matrix-intrinsics").getValueAsString() == + "true"; +} + PreservedAnalyses LowerMatrixIntrinsicsPass::run(Function &F, FunctionAnalysisManager &AM) { auto &TTI = AM.getResult(F); @@ -1504,6 +1511,8 @@ } bool runOnFunction(Function &F) override { + if (!shouldRunMatrixLowering(F)) + return false; auto &TTI = getAnalysis().getTTI(F); auto &ORE = getAnalysis().getORE(); LowerMatrixIntrinsics LMT(F, TTI, &ORE); diff --git a/llvm/test/Other/opt-O2-pipeline.ll b/llvm/test/Other/opt-O2-pipeline.ll --- a/llvm/test/Other/opt-O2-pipeline.ll +++ b/llvm/test/Other/opt-O2-pipeline.ll @@ -200,6 +200,10 @@ ; CHECK-NEXT: Lower constant intrinsics ; CHECK-NEXT: Dominator Tree Construction ; CHECK-NEXT: Natural Loop Information +; CHECK-NEXT: Lazy Branch Probability Analysis +; CHECK-NEXT: Lazy Block Frequency Analysis +; CHECK-NEXT: Optimization Remark Emitter +; CHECK-NEXT: Lower the matrix intrinsics ; CHECK-NEXT: Canonicalize natural loops ; CHECK-NEXT: LCSSA Verifier ; CHECK-NEXT: Loop-Closed SSA Form Pass diff --git a/llvm/test/Other/opt-O3-pipeline.ll b/llvm/test/Other/opt-O3-pipeline.ll --- a/llvm/test/Other/opt-O3-pipeline.ll +++ b/llvm/test/Other/opt-O3-pipeline.ll @@ -205,6 +205,10 @@ ; CHECK-NEXT: Lower constant intrinsics ; CHECK-NEXT: Dominator Tree Construction ; CHECK-NEXT: Natural Loop Information +; CHECK-NEXT: Lazy Branch Probability Analysis +; CHECK-NEXT: Lazy Block Frequency Analysis +; CHECK-NEXT: Optimization Remark Emitter +; CHECK-NEXT: Lower the matrix intrinsics ; CHECK-NEXT: Canonicalize natural loops ; CHECK-NEXT: LCSSA Verifier ; CHECK-NEXT: Loop-Closed SSA Form Pass diff --git a/llvm/test/Other/opt-Os-pipeline.ll b/llvm/test/Other/opt-Os-pipeline.ll --- a/llvm/test/Other/opt-Os-pipeline.ll +++ b/llvm/test/Other/opt-Os-pipeline.ll @@ -187,6 +187,10 @@ ; CHECK-NEXT: Lower constant intrinsics ; CHECK-NEXT: Dominator Tree Construction ; CHECK-NEXT: Natural Loop Information +; CHECK-NEXT: Lazy Branch Probability Analysis +; CHECK-NEXT: Lazy Block Frequency Analysis +; CHECK-NEXT: Optimization Remark Emitter +; CHECK-NEXT: Lower the matrix intrinsics ; CHECK-NEXT: Canonicalize natural loops ; CHECK-NEXT: LCSSA Verifier ; CHECK-NEXT: Loop-Closed SSA Form Pass diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/bigger-expressions-double.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/bigger-expressions-double.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/bigger-expressions-double.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/bigger-expressions-double.ll @@ -2,7 +2,7 @@ ; RUN: opt -lower-matrix-intrinsics -S < %s | FileCheck %s ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define void @transpose_multiply(<9 x double>* %A.Ptr, <9 x double>* %B.Ptr, <9 x double>* %C.Ptr) { +define void @transpose_multiply(<9 x double>* %A.Ptr, <9 x double>* %B.Ptr, <9 x double>* %C.Ptr) #0 { ; CHECK-LABEL: @transpose_multiply( ; CHECK-NEXT: entry: @@ -248,7 +248,7 @@ declare <9 x double> @llvm.matrix.transpose(<9 x double>, i32, i32) declare <9 x double> @llvm.matrix.multiply.v9f64.v9f64.v9f64(<9 x double>, <9 x double>, i32, i32, i32) -define void @transpose_multiply_add(<9 x double>* %A.Ptr, <9 x double>* %B.Ptr, <9 x double>* %C.Ptr) { +define void @transpose_multiply_add(<9 x double>* %A.Ptr, <9 x double>* %B.Ptr, <9 x double>* %C.Ptr) #0 { ; CHECK-LABEL: @transpose_multiply_add( ; CHECK-NEXT: entry: @@ -511,3 +511,5 @@ store <9 x double> %res, <9 x double>* %C.Ptr ret void } + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/lowering-drops-attr.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/lowering-drops-attr.ll new file mode 100644 --- /dev/null +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/lowering-drops-attr.ll @@ -0,0 +1,42 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -lower-matrix-intrinsics -S < %s | FileCheck %s +; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s + +; Check that the running -lower-matrix-intrinsics removes the +; "may-contain-matrix-intrinsics". Because it's the only attribute for +; @transpose, the attribute reference will be dropped from the definition. + +define <8 x i32> @transpose(<8 x i32> %a) #0 { +; CHECK-LABEL: define <8 x i32> @transpose(<8 x i32> %a) { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> undef, <2 x i32> +; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> undef, <2 x i32> +; CHECK-NEXT: [[SPLIT2:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> undef, <2 x i32> +; CHECK-NEXT: [[SPLIT3:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> undef, <2 x i32> +; CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i32> [[SPLIT]], i64 0 +; CHECK-NEXT: [[TMP1:%.*]] = insertelement <4 x i32> undef, i32 [[TMP0]], i64 0 +; CHECK-NEXT: [[TMP2:%.*]] = extractelement <2 x i32> [[SPLIT1]], i64 0 +; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x i32> [[TMP1]], i32 [[TMP2]], i64 1 +; CHECK-NEXT: [[TMP4:%.*]] = extractelement <2 x i32> [[SPLIT2]], i64 0 +; CHECK-NEXT: [[TMP5:%.*]] = insertelement <4 x i32> [[TMP3]], i32 [[TMP4]], i64 2 +; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x i32> [[SPLIT3]], i64 0 +; CHECK-NEXT: [[TMP7:%.*]] = insertelement <4 x i32> [[TMP5]], i32 [[TMP6]], i64 3 +; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x i32> [[SPLIT]], i64 1 +; CHECK-NEXT: [[TMP9:%.*]] = insertelement <4 x i32> undef, i32 [[TMP8]], i64 0 +; CHECK-NEXT: [[TMP10:%.*]] = extractelement <2 x i32> [[SPLIT1]], i64 1 +; CHECK-NEXT: [[TMP11:%.*]] = insertelement <4 x i32> [[TMP9]], i32 [[TMP10]], i64 1 +; CHECK-NEXT: [[TMP12:%.*]] = extractelement <2 x i32> [[SPLIT2]], i64 1 +; CHECK-NEXT: [[TMP13:%.*]] = insertelement <4 x i32> [[TMP11]], i32 [[TMP12]], i64 2 +; CHECK-NEXT: [[TMP14:%.*]] = extractelement <2 x i32> [[SPLIT3]], i64 1 +; CHECK-NEXT: [[TMP15:%.*]] = insertelement <4 x i32> [[TMP13]], i32 [[TMP14]], i64 3 +; CHECK-NEXT: [[TMP16:%.*]] = shufflevector <4 x i32> [[TMP7]], <4 x i32> [[TMP15]], <8 x i32> +; CHECK-NEXT: ret <8 x i32> [[TMP16]] +; +entry: + %c = call <8 x i32> @llvm.matrix.transpose(<8 x i32> %a, i32 2, i32 4) + ret <8 x i32> %c +} + +declare <8 x i32> @llvm.matrix.transpose(<8 x i32>, i32, i32) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction-fmf.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction-fmf.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction-fmf.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction-fmf.ll @@ -3,7 +3,7 @@ ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <4 x double> @multiply_2x2(<4 x double> %a, <4 x double> %b) { +define <4 x double> @multiply_2x2(<4 x double> %a, <4 x double> %b) #0 { ; CHECK-LABEL: @multiply_2x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <4 x double> [[A:%.*]], <4 x double> undef, <2 x i32> @@ -67,3 +67,5 @@ } declare <4 x double> @llvm.matrix.multiply.v4f64.v4f64.v4f64(<4 x double>, <4 x double>, i32, i32, i32) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction.ll @@ -3,7 +3,7 @@ ; RUN: opt -passes='lower-matrix-intrinsics' -matrix-allow-contract -S < %s | FileCheck %s -define <4 x double> @multiply_2x2(<4 x double> %a, <4 x double> %b) { +define <4 x double> @multiply_2x2(<4 x double> %a, <4 x double> %b) #0 { ; CHECK-LABEL: @multiply_2x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <4 x double> [[A:%.*]], <4 x double> undef, <2 x i32> @@ -67,3 +67,5 @@ } declare <4 x double> @llvm.matrix.multiply.v4f64.v4f64.v4f64(<4 x double>, <4 x double>, i32, i32, i32) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double.ll @@ -3,7 +3,7 @@ ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <4 x double> @multiply_2x2(<4 x double> %a, <4 x double> %b) { +define <4 x double> @multiply_2x2(<4 x double> %a, <4 x double> %b) #0 { ; CHECK-LABEL: @multiply_2x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <4 x double> [[A:%.*]], <4 x double> undef, <2 x i32> @@ -72,7 +72,7 @@ declare <4 x double> @llvm.matrix.multiply.v4f64.v4f64.v4f64(<4 x double>, <4 x double>, i32, i32, i32) -define <4 x double> @multiply_1x2(<2 x double> %a, <2 x double> %b) { +define <4 x double> @multiply_1x2(<2 x double> %a, <2 x double> %b) #0 { ; CHECK-LABEL: @multiply_1x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <2 x double> [[A:%.*]], <2 x double> undef, <2 x i32> @@ -116,7 +116,7 @@ declare <4 x double> @llvm.matrix.multiply.v4f64.v2f64.v2f64(<2 x double>, <2 x double>, i32, i32, i32) -define <9 x double> @multiply_2x3(<6 x double> %a, <6 x double> %b) { +define <9 x double> @multiply_2x3(<6 x double> %a, <6 x double> %b) #0 { ; CHECK-LABEL: @multiply_2x3( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <6 x double> [[A:%.*]], <6 x double> undef, <3 x i32> @@ -252,3 +252,5 @@ } declare <9 x double> @llvm.matrix.multiply.v6f64.v6f64.v6f64(<6 x double>, <6 x double>, i32, i32, i32) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction-fmf.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction-fmf.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction-fmf.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction-fmf.ll @@ -3,7 +3,7 @@ ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <4 x float> @multiply_2x2(<4 x float> %a, <4 x float> %b) { +define <4 x float> @multiply_2x2(<4 x float> %a, <4 x float> %b) #0 { ; CHECK-LABEL: @multiply_2x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <4 x float> [[A:%.*]], <4 x float> undef, <2 x i32> @@ -67,3 +67,5 @@ } declare <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction.ll @@ -3,7 +3,7 @@ ; RUN: opt -passes='lower-matrix-intrinsics' -matrix-allow-contract -S < %s | FileCheck %s -define <4 x float> @multiply_2x2(<4 x float> %a, <4 x float> %b) { +define <4 x float> @multiply_2x2(<4 x float> %a, <4 x float> %b) #0 { ; CHECK-LABEL: @multiply_2x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <4 x float> [[A:%.*]], <4 x float> undef, <2 x i32> @@ -67,3 +67,5 @@ } declare <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float.ll @@ -3,7 +3,7 @@ ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <4 x float> @multiply_2x2(<4 x float> %a, <4 x float> %b) { +define <4 x float> @multiply_2x2(<4 x float> %a, <4 x float> %b) #0 { ; CHECK-LABEL: @multiply_2x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <4 x float> [[A:%.*]], <4 x float> undef, <2 x i32> @@ -72,7 +72,7 @@ declare <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32) -define <4 x float> @multiply_1x2(<2 x float> %a, <2 x float> %b) { +define <4 x float> @multiply_1x2(<2 x float> %a, <2 x float> %b) #0 { ; CHECK-LABEL: @multiply_1x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <2 x float> [[A:%.*]], <2 x float> undef, <2 x i32> @@ -116,7 +116,7 @@ declare <4 x float> @llvm.matrix.multiply.v4f32.v2f32.v2f32(<2 x float>, <2 x float>, i32, i32, i32) -define <9 x float> @multiply_2x3(<6 x float> %a, <6 x float> %b) { +define <9 x float> @multiply_2x3(<6 x float> %a, <6 x float> %b) #0 { ; CHECK-LABEL: @multiply_2x3( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <6 x float> [[A:%.*]], <6 x float> undef, <3 x i32> @@ -252,3 +252,5 @@ } declare <9 x float> @llvm.matrix.multiply.v6f32.v6f32.v6f32(<6 x float>, <6 x float>, i32, i32, i32) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32.ll @@ -3,7 +3,7 @@ ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <4 x i32> @multiply_2x2(<4 x i32> %a, <4 x i32> %b) { +define <4 x i32> @multiply_2x2(<4 x i32> %a, <4 x i32> %b) #0 { ; CHECK-LABEL: @multiply_2x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <4 x i32> [[A:%.*]], <4 x i32> undef, <2 x i32> @@ -72,7 +72,7 @@ declare <4 x i32> @llvm.matrix.multiply.v4i32.v4i32.v4i32(<4 x i32>, <4 x i32>, i32, i32, i32) -define <4 x i32> @multiply_1x2(<2 x i32> %a, <2 x i32> %b) { +define <4 x i32> @multiply_1x2(<2 x i32> %a, <2 x i32> %b) #0 { ; CHECK-LABEL: @multiply_1x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <2 x i32> [[A:%.*]], <2 x i32> undef, <2 x i32> @@ -116,7 +116,7 @@ declare <4 x i32> @llvm.matrix.multiply.v4i32.v2i32.v2i32(<2 x i32>, <2 x i32>, i32, i32, i32) -define <9 x i32> @multiply_2x3(<6 x i32> %a, <6 x i32> %b) { +define <9 x i32> @multiply_2x3(<6 x i32> %a, <6 x i32> %b) #0 { ; CHECK-LABEL: @multiply_2x3( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <6 x i32> [[A:%.*]], <6 x i32> undef, <3 x i32> @@ -252,3 +252,5 @@ } declare <9 x i32> @llvm.matrix.multiply.v6i32.v6i32.v6i32(<6 x i32>, <6 x i32>, i32, i32, i32) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backward.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backward.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backward.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backward.ll @@ -2,7 +2,7 @@ ; RUN: opt -lower-matrix-intrinsics -S < %s | FileCheck %s ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <8 x double> @fadd_transpose(<8 x double> %a, <8 x double> %b) { +define <8 x double> @fadd_transpose(<8 x double> %a, <8 x double> %b) #0 { ; CHECK-LABEL: @fadd_transpose( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x double> [[A:%.*]], <8 x double> undef, <2 x i32> @@ -42,7 +42,7 @@ ret <8 x double> %c } -define <8 x double> @load_fadd_transpose(<8 x double>* %A.Ptr, <8 x double> %b) { +define <8 x double> @load_fadd_transpose(<8 x double>* %A.Ptr, <8 x double> %b) #0 { ; CHECK-LABEL: @load_fadd_transpose( ; CHECK-NEXT: entry: @@ -94,3 +94,5 @@ } declare <8 x double> @llvm.matrix.transpose(<8 x double>, i32, i32) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backwards-unsupported.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backwards-unsupported.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backwards-unsupported.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backwards-unsupported.ll @@ -3,7 +3,7 @@ ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s ; Check that we we use flattened vectors for PHI operands and extract the columns afterwards. -define <9 x double> @unsupported_phi(i1 %cond, <9 x double> %A, <9 x double> %B, <9 x double> %C) { +define <9 x double> @unsupported_phi(i1 %cond, <9 x double> %A, <9 x double> %B, <9 x double> %C) #0 { ; CHECK-LABEL: @unsupported_phi( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[COND:%.*]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] @@ -90,7 +90,7 @@ } ; Make sure we use a flattened vector when calling @foo and the use its flat vector result properly. -define <9 x double> @unsupported_call(i1 %cond, <9 x double> %A, <9 x double> %B) { +define <9 x double> @unsupported_call(i1 %cond, <9 x double> %A, <9 x double> %B) #0 { ; CHECK-LABEL: @unsupported_call( ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <9 x double> [[A:%.*]], <9 x double> undef, <3 x i32> ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <9 x double> [[A]], <9 x double> undef, <3 x i32> @@ -133,3 +133,5 @@ declare <9 x double> @llvm.matrix.multiply.v9f64.v9f64.v9f64(<9 x double>, <9 x double>, i32 immarg, i32 immarg, i32 immarg) declare <9 x double> @llvm.matrix.transpose.v9f64(<9 x double>, i32 immarg, i32 immarg) declare <9 x double> @foo(<9 x double>) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-forward.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-forward.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-forward.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-forward.ll @@ -4,7 +4,7 @@ ; Check that we do not emit shufflevectors to flatten the result of the ; transpose and store the columns directly. -define void @transpose_store(<8 x double> %a, <8 x double>* %Ptr) { +define void @transpose_store(<8 x double> %a, <8 x double>* %Ptr) #0 { ; CHECK-LABEL: @transpose_store( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x double> [[A:%.*]], <8 x double> undef, <2 x i32> @@ -43,7 +43,7 @@ declare <8 x double> @llvm.matrix.transpose(<8 x double>, i32, i32) -define <8 x double> @transpose_fadd(<8 x double> %a) { +define <8 x double> @transpose_fadd(<8 x double> %a) #0 { ; CHECK-LABEL: @transpose_fadd( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x double> [[A:%.*]], <8 x double> undef, <2 x i32> @@ -79,7 +79,7 @@ ret <8 x double> %res } -define <8 x double> @transpose_fmul(<8 x double> %a) { +define <8 x double> @transpose_fmul(<8 x double> %a) #0 { ; CHECK-LABEL: @transpose_fmul( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x double> [[A:%.*]], <8 x double> undef, <2 x i32> @@ -114,3 +114,5 @@ %res = fmul <8 x double> %c, %a ret <8 x double> %res } + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-mixed-users.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-mixed-users.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-mixed-users.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-mixed-users.ll @@ -4,7 +4,7 @@ ; Currently we only lower stores with shape information, but need to embed the ; matrix in a flat vector for function calls and returns. -define <8 x double> @strided_load_4x4(<8 x double> %in, <8 x double>* %Ptr) { +define <8 x double> @strided_load_4x4(<8 x double> %in, <8 x double>* %Ptr) #0 { ; CHECK-LABEL: @strided_load_4x4( ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x double> [[IN:%.*]], <8 x double> undef, <4 x i32> ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <8 x double> [[IN]], <8 x double> undef, <4 x i32> @@ -51,3 +51,5 @@ declare <8 x double> @llvm.matrix.transpose(<8 x double>, i32, i32) declare void @foo(<8 x double>) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-multiple-iterations.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-multiple-iterations.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-multiple-iterations.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/propagate-multiple-iterations.ll @@ -6,7 +6,7 @@ ; Make sure we propagate in multiple iterations. First, we back-propagate the ; shape information from the transpose to %A, in the next iteration we ; forward-propagate it to %Mul, and then back to %B. -define <16 x double> @backpropagation_iterations(<16 x double>* %A.Ptr, <16 x double>* %B.Ptr) { +define <16 x double> @backpropagation_iterations(<16 x double>* %A.Ptr, <16 x double>* %B.Ptr) #0 { ; CHECK-LABEL: @backpropagation_iterations( ; CHECK-NEXT: [[TMP1:%.*]] = bitcast <16 x double>* [[A_PTR:%.*]] to double* ; CHECK-NEXT: [[TMP2:%.*]] = bitcast double* [[TMP1]] to <4 x double>* @@ -82,3 +82,5 @@ declare <16 x double> @llvm.matrix.multiply.v16f64.v16f64.v16f64(<16 x double>, <16 x double>, i32 immarg, i32 immarg, i32 immarg) declare <16 x double> @llvm.matrix.transpose.v16f64(<16 x double>, i32 immarg, i32 immarg) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/remarks-inlining.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/remarks-inlining.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/remarks-inlining.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/remarks-inlining.ll @@ -92,7 +92,7 @@ ; CHECK-LABEL: remark: transpose.h:13:11: Lowered with 0 stores, 0 loads, 8 compute ops ; CHECK-NEXT: transpose.1x2.float(transpose.2x1.float(addr %D)) -define void @toplevel(<15 x double>* %A, <15 x double>* %B, <15 x double>* %C, <2 x float>* %D) !dbg !16 { +define void @toplevel(<15 x double>* %A, <15 x double>* %B, <15 x double>* %C, <2 x float>* %D) #0 !dbg !16 { entry: %a = load <15 x double>, <15 x double> *%A, align 16, !dbg !3791 %b = call <15 x double> @llvm.matrix.columnwise.load(<15 x double>* %B, i32 5, i32 3, i32 5), !dbg !3793 @@ -164,3 +164,5 @@ !108 = !DILocation(line: 66, column: 11, scope: !23, inlinedAt: !109) !109 = !DILocation(line: 510, column: 0, scope: !16) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/remarks-shared-subtrees.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/remarks-shared-subtrees.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/remarks-shared-subtrees.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/remarks-shared-subtrees.ll @@ -87,7 +87,7 @@ ; STDERR-NEXT: columnwise.load.2x15.double(addr %arg3, scalar))), ; STDERR-NEXT: addr %arg2, ; STDERR-NEXT: 10) -define void @test_2leafs(double* %arg1, double* %arg2, double* %arg3, i32 %stride, i32 %offset) !dbg !8 { +define void @test_2leafs(double* %arg1, double* %arg2, double* %arg3, i32 %stride, i32 %offset) #0 !dbg !8 { bb: %shared.load = tail call <8 x double> @llvm.matrix.columnwise.load.v8f64.p0f64(double* %arg1, i32 %stride, i32 2, i32 4), !dbg !10, !noalias !10 %shared.load.2 = tail call <30 x double> @llvm.matrix.columnwise.load.v30f64.p0f64(double* %arg3, i32 %stride, i32 2, i32 15), !dbg !10, !noalias !10 @@ -108,6 +108,8 @@ declare void @llvm.matrix.columnwise.store.v8f64.p0f64(<8 x double>, double* writeonly, i32, i32 immarg, i32 immarg) declare <60 x double> @llvm.matrix.multiply.v60f64.v8f64.v30f64(<8 x double>, <30 x double>, i32 immarg, i32 immarg, i32 immarg) +attributes #0 = { "may-contain-matrix-intrinsics"="true" } + !llvm.module.flags = !{!0, !1, !2, !3} !llvm.dbg.cu = !{!4} !llvm.ident = !{!7} diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/remarks.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/remarks.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/remarks.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/remarks.ll @@ -8,7 +8,7 @@ ; CHECK-NEXT: store( ; CHECK-NEXT: transpose.2x6.double(load(addr %A)), ; CHECK-NEXT: addr %B) -define void @transpose(<12 x double>* %A, <12 x double>* %B) !dbg !23 { +define void @transpose(<12 x double>* %A, <12 x double>* %B) #0 !dbg !23 { %load = load <12 x double>, <12 x double>* %A, !dbg !24 %t = call <12 x double> @llvm.matrix.transpose.v12f64.v12f64(<12 x double> %load, i32 2, i32 6), !dbg !24 store <12 x double> %t, <12 x double>* %B, !dbg !24 @@ -24,7 +24,7 @@ ; CHECK-NEXT: load(addr %A), ; CHECK-NEXT: load(addr %B)), ; CHECK-NEXT: addr %C) -define void @multiply(<12 x double>* %A, <12 x double>* %B, <4 x double>* %C) !dbg !25 { +define void @multiply(<12 x double>* %A, <12 x double>* %B, <4 x double>* %C) #0 !dbg !25 { %A.matrix = load <12 x double>, <12 x double>* %A, !dbg !26 %B.matrix = load <12 x double>, <12 x double>* %B, !dbg !26 %t = call <4 x double> @llvm.matrix.multiply(<12 x double> %A.matrix, <12 x double> %B.matrix, i32 2, i32 6, i32 2), !dbg !26 @@ -38,7 +38,7 @@ ; CHECK-NEXT: store( ; CHECK-NEXT: columnwise.load.3x3.double(addr %A, 5), ; CHECK-NEXT: addr %B) -define void @columnwise.load(<9 x double>* %A, <9 x double>* %B) !dbg !27 { +define void @columnwise.load(<9 x double>* %A, <9 x double>* %B) #0 !dbg !27 { %A.matrix = call <9 x double> @llvm.matrix.columnwise.load(<9 x double>* %A, i32 5, i32 3, i32 3), !dbg !28 store <9 x double> %A.matrix, <9 x double>* %B, !dbg !28 ret void @@ -51,7 +51,7 @@ ; CHECK-NEXT: columnwise.load.3x3.double(addr %A, 5), ; CHECK-NEXT: addr %B, ; CHECK-NEXT: 10) -define void @columnwise.store(<9 x double>* %A, <9 x double>* %B) !dbg !29 { +define void @columnwise.store(<9 x double>* %A, <9 x double>* %B) #0 !dbg !29 { %A.matrix = call <9 x double> @llvm.matrix.columnwise.load(<9 x double>* %A, i32 5, i32 3, i32 3), !dbg !30 call void @llvm.matrix.columnwise.store(<9 x double> %A.matrix, <9 x double>* %B, i32 10, i32 3, i32 3), !dbg !30 ret void @@ -69,7 +69,7 @@ ; CHECK-NEXT: addr %B, ; CHECK-NEXT: 10) -define void @binaryops(<9 x double>* %A, <9 x double>* %B) !dbg !31 { +define void @binaryops(<9 x double>* %A, <9 x double>* %B) #0 !dbg !31 { %A.matrix = call <9 x double> @llvm.matrix.columnwise.load(<9 x double>* %A, i32 5, i32 3, i32 3), !dbg !32 %R1.matrix = fadd <9 x double> %A.matrix, %A.matrix, !dbg !32 %R2.matrix = fmul <9 x double> %R1.matrix, %A.matrix, !dbg !32 @@ -93,7 +93,7 @@ ; CHECK-NEXT: load(addr %D)), ; CHECK-NEXT: addr %E) -define void @multiple_expressions(<9 x double>* %A, <9 x double>* %B, <12 x double>* %C, <12 x double>* %D, <4 x double>* %E) !dbg !33 { +define void @multiple_expressions(<9 x double>* %A, <9 x double>* %B, <12 x double>* %C, <12 x double>* %D, <4 x double>* %E) #0 !dbg !33 { %A.matrix = call <9 x double> @llvm.matrix.columnwise.load(<9 x double>* %A, i32 5, i32 3, i32 3), !dbg !34 %R1.matrix = fadd <9 x double> %A.matrix, %A.matrix, !dbg !34 %R2.matrix = fmul <9 x double> %R1.matrix, %A.matrix, !dbg !34 @@ -116,7 +116,7 @@ ; CHECK-NEXT: (reused) columnwise.load.3x3.double(addr %A, 5)), ; CHECK-NEXT: stack addr %B, ; CHECK-NEXT: 10) -define void @stackaddresses(<9 x double>* %A) !dbg !35 { +define void @stackaddresses(<9 x double>* %A) #0 !dbg !35 { %B = alloca <9 x double> %A.matrix = call <9 x double> @llvm.matrix.columnwise.load(<9 x double>* %A, i32 5, i32 3, i32 3), !dbg !36 %R1.matrix = fadd <9 x double> %A.matrix, %A.matrix, !dbg !36 @@ -130,7 +130,7 @@ ; CHECK-NEXT: transpose.5x3.double(load(addr %A)), ; CHECK-NEXT: stack addr %s1) %S1 = type {<15 x double>*} -define void @get_underlying_object(%S1* %A) !dbg !21 { +define void @get_underlying_object(%S1* %A) #0 !dbg !21 { entry: %s1 = alloca <15 x double>, !dbg !22 %a1 = getelementptr %S1, %S1* %A, i32 0, i32 0, !dbg !22 @@ -148,6 +148,8 @@ declare <15 x double> @llvm.matrix.transpose.v15f64.v15f64(<15 x double>, i32, i32) +attributes #0 = { "may-contain-matrix-intrinsics"="true" } + !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!3, !4} diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-double.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-double.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-double.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-double.ll @@ -2,7 +2,7 @@ ; RUN: opt -lower-matrix-intrinsics -S < %s | FileCheck %s ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <9 x double> @strided_load_3x3(<9 x double>* %in, i32 %stride) { +define <9 x double> @strided_load_3x3(<9 x double>* %in, i32 %stride) #0 { ; CHECK-LABEL: @strided_load_3x3( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <9 x double>* [[IN:%.*]] to double* @@ -30,7 +30,7 @@ declare <9 x double> @llvm.matrix.columnwise.load(<9 x double>*, i32, i32, i32) -define <9 x double> @strided_load_9x1(<9 x double>* %in, i32 %stride) { +define <9 x double> @strided_load_9x1(<9 x double>* %in, i32 %stride) #0 { ; CHECK-LABEL: @strided_load_9x1( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <9 x double>* [[IN:%.*]] to double* @@ -47,7 +47,7 @@ declare <8 x double> @llvm.matrix.columnwise.load.v8f64(<8 x double>*, i32, i32, i32) -define <8 x double> @strided_load_4x2(<8 x double>* %in, i32 %stride) { +define <8 x double> @strided_load_4x2(<8 x double>* %in, i32 %stride) #0 { ; CHECK-LABEL: @strided_load_4x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <8 x double>* [[IN:%.*]] to double* @@ -72,3 +72,5 @@ ; CHECK: declare <8 x double> @llvm.matrix.columnwise.load.v8f64.p0v8f64(<8 x double>*, i32, i32 immarg, i32 immarg) [[READONLY]] ; CHECK: attributes [[READONLY]] = { argmemonly nounwind readonly willreturn } + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-float.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-float.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-float.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-float.ll @@ -2,7 +2,7 @@ ; RUN: opt -lower-matrix-intrinsics -S < %s | FileCheck %s ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <9 x float> @strided_load_3x3(<9 x float>* %in, i32 %stride) { +define <9 x float> @strided_load_3x3(<9 x float>* %in, i32 %stride) #0 { ; CHECK-LABEL: @strided_load_3x3( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <9 x float>* [[IN:%.*]] to float* @@ -30,7 +30,7 @@ declare <9 x float> @llvm.matrix.columnwise.load(<9 x float>*, i32, i32, i32) -define <9 x float> @strided_load_9x1(<9 x float>* %in, i32 %stride) { +define <9 x float> @strided_load_9x1(<9 x float>* %in, i32 %stride) #0 { ; CHECK-LABEL: @strided_load_9x1( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <9 x float>* [[IN:%.*]] to float* @@ -47,7 +47,7 @@ declare <8 x float> @llvm.matrix.columnwise.load.v8f32(<8 x float>*, i32, i32, i32) -define <8 x float> @strided_load_4x2(<8 x float>* %in, i32 %stride) { +define <8 x float> @strided_load_4x2(<8 x float>* %in, i32 %stride) #0 { ; CHECK-LABEL: @strided_load_4x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <8 x float>* [[IN:%.*]] to float* @@ -66,3 +66,5 @@ %load = call <8 x float> @llvm.matrix.columnwise.load.v8f32(<8 x float>* %in, i32 %stride, i32 4, i32 2) ret <8 x float> %load } + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-i32.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-i32.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-i32.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-i32.ll @@ -2,7 +2,7 @@ ; RUN: opt -lower-matrix-intrinsics -S < %s | FileCheck %s ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <9 x i32> @strided_load_3x3(<9 x i32>* %in, i32 %stride) { +define <9 x i32> @strided_load_3x3(<9 x i32>* %in, i32 %stride) #0 { ; CHECK-LABEL: @strided_load_3x3( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <9 x i32>* [[IN:%.*]] to i32* @@ -30,7 +30,7 @@ declare <9 x i32> @llvm.matrix.columnwise.load(<9 x i32>*, i32, i32, i32) -define <9 x i32> @strided_load_9x1(<9 x i32>* %in, i32 %stride) { +define <9 x i32> @strided_load_9x1(<9 x i32>* %in, i32 %stride) #0 { ; CHECK-LABEL: @strided_load_9x1( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <9 x i32>* [[IN:%.*]] to i32* @@ -47,7 +47,7 @@ declare <8 x i32> @llvm.matrix.columnwise.load.v8i32(<8 x i32>*, i32, i32, i32) -define <8 x i32> @strided_load_4x2(<8 x i32>* %in, i32 %stride) { +define <8 x i32> @strided_load_4x2(<8 x i32>* %in, i32 %stride) #0 { ; CHECK-LABEL: @strided_load_4x2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <8 x i32>* [[IN:%.*]] to i32* @@ -66,3 +66,5 @@ %load = call <8 x i32> @llvm.matrix.columnwise.load.v8i32(<8 x i32>* %in, i32 %stride, i32 4, i32 2) ret <8 x i32> %load } + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-double.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-double.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-double.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-double.ll @@ -2,7 +2,7 @@ ; RUN: opt -lower-matrix-intrinsics -S < %s | FileCheck %s ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define void @strided_store_3x2(<6 x double> %in, double* %out) { +define void @strided_store_3x2(<6 x double> %in, double* %out) #0 { ; CHECK-LABEL: @strided_store_3x2( ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <6 x double> [[IN:%.*]], <6 x double> undef, <3 x i32> ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <6 x double> [[IN]], <6 x double> undef, <3 x i32> @@ -17,7 +17,7 @@ ret void } -define void @strided_store_3x2_nonconst_stride(<6 x double> %in, i32 %stride, double* %out) { +define void @strided_store_3x2_nonconst_stride(<6 x double> %in, i32 %stride, double* %out) #0 { ; CHECK-LABEL: @strided_store_3x2_nonconst_stride( ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <6 x double> [[IN:%.*]], <6 x double> undef, <3 x i32> ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <6 x double> [[IN]], <6 x double> undef, <3 x i32> @@ -38,7 +38,7 @@ declare void @llvm.matrix.columnwise.store(<6 x double>, double*, i32, i32, i32) -define void @strided_store_2x3(<10 x double> %in, double* %out) { +define void @strided_store_2x3(<10 x double> %in, double* %out) #0 { ; CHECK-LABEL: @strided_store_2x3( ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <10 x double> [[IN:%.*]], <10 x double> undef, <2 x i32> ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <10 x double> [[IN]], <10 x double> undef, <2 x i32> @@ -72,3 +72,6 @@ ; CHECK: declare void @llvm.matrix.columnwise.store.v10f64.p0f64(<10 x double>, double* writeonly, i32, i32 immarg, i32 immarg) [[WRITEONLY]] ; CHECK: attributes [[WRITEONLY]] = { argmemonly nounwind willreturn writeonly } + + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-float.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-float.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-float.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-float.ll @@ -2,7 +2,7 @@ ; RUN: opt -lower-matrix-intrinsics -S < %s | FileCheck %s ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define void @strided_store_3x2(<6 x float> %in, float* %out) { +define void @strided_store_3x2(<6 x float> %in, float* %out) #0 { ; CHECK-LABEL: @strided_store_3x2( ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <6 x float> [[IN:%.*]], <6 x float> undef, <3 x i32> ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <6 x float> [[IN]], <6 x float> undef, <3 x i32> @@ -17,7 +17,7 @@ ret void } -define void @strided_store_3x2_nonconst_stride(<6 x float> %in, i32 %stride, float* %out) { +define void @strided_store_3x2_nonconst_stride(<6 x float> %in, i32 %stride, float* %out) #0 { ; CHECK-LABEL: @strided_store_3x2_nonconst_stride( ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <6 x float> [[IN:%.*]], <6 x float> undef, <3 x i32> ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <6 x float> [[IN]], <6 x float> undef, <3 x i32> @@ -38,7 +38,7 @@ declare void @llvm.matrix.columnwise.store(<6 x float>, float*, i32, i32, i32) -define void @strided_store_2x3(<10 x float> %in, float* %out) { +define void @strided_store_2x3(<10 x float> %in, float* %out) #0 { ; CHECK-LABEL: @strided_store_2x3( ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <10 x float> [[IN:%.*]], <10 x float> undef, <2 x i32> ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <10 x float> [[IN]], <10 x float> undef, <2 x i32> @@ -66,3 +66,5 @@ } declare void @llvm.matrix.columnwise.store.v10f32(<10 x float>, float*, i32, i32, i32) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-i32.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-i32.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-i32.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-i32.ll @@ -2,7 +2,7 @@ ; RUN: opt -lower-matrix-intrinsics -S < %s | FileCheck %s ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define void @strided_store_3x2(<6 x i32> %in, i32* %out) { +define void @strided_store_3x2(<6 x i32> %in, i32* %out) #0 { ; CHECK-LABEL: @strided_store_3x2( ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <6 x i32> [[IN:%.*]], <6 x i32> undef, <3 x i32> ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <6 x i32> [[IN]], <6 x i32> undef, <3 x i32> @@ -17,7 +17,7 @@ ret void } -define void @strided_store_3x2_nonconst_stride(<6 x i32> %in, i32 %stride, i32* %out) { +define void @strided_store_3x2_nonconst_stride(<6 x i32> %in, i32 %stride, i32* %out) #0 { ; CHECK-LABEL: @strided_store_3x2_nonconst_stride( ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <6 x i32> [[IN:%.*]], <6 x i32> undef, <3 x i32> ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <6 x i32> [[IN]], <6 x i32> undef, <3 x i32> @@ -38,7 +38,7 @@ declare void @llvm.matrix.columnwise.store(<6 x i32>, i32*, i32, i32, i32) -define void @strided_store_2x3(<10 x i32> %in, i32* %out) { +define void @strided_store_2x3(<10 x i32> %in, i32* %out) #0 { ; CHECK-LABEL: @strided_store_2x3( ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <10 x i32> [[IN:%.*]], <10 x i32> undef, <2 x i32> ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <10 x i32> [[IN]], <10 x i32> undef, <2 x i32> @@ -66,3 +66,5 @@ } declare void @llvm.matrix.columnwise.store.v10i32(<10 x i32>, i32*, i32, i32, i32) + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-double.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-double.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-double.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-double.ll @@ -3,7 +3,7 @@ ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <8 x double> @transpose(<8 x double> %a) { +define <8 x double> @transpose(<8 x double> %a) #0 { ; CHECK-LABEL: @transpose( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x double> [[A:%.*]], <8 x double> undef, <2 x i32> @@ -36,7 +36,7 @@ declare <8 x double> @llvm.matrix.transpose(<8 x double>, i32, i32) -define <8 x double> @transpose_single_column(<8 x double> %a) { +define <8 x double> @transpose_single_column(<8 x double> %a) #0 { ; CHECK-LABEL: @transpose_single_column( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x double> [[A:%.*]], <8 x double> undef, <8 x i32> @@ -72,7 +72,7 @@ declare <12 x double> @llvm.matrix.transpose.v12f64(<12 x double>, i32, i32) -define <12 x double> @transpose_double_3x4(<12 x double> %a) { +define <12 x double> @transpose_double_3x4(<12 x double> %a) #0 { ; CHECK-LABEL: @transpose_double_3x4( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <12 x double> [[A:%.*]], <12 x double> undef, <3 x i32> @@ -112,3 +112,5 @@ %c = call <12 x double> @llvm.matrix.transpose.v12f64(<12 x double> %a, i32 3, i32 4) ret <12 x double> %c } + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-float.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-float.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-float.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-float.ll @@ -3,7 +3,7 @@ ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <8 x float> @transpose(<8 x float> %a) { +define <8 x float> @transpose(<8 x float> %a) #0 { ; CHECK-LABEL: @transpose( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x float> [[A:%.*]], <8 x float> undef, <2 x i32> @@ -36,7 +36,7 @@ declare <8 x float> @llvm.matrix.transpose(<8 x float>, i32, i32) -define <8 x float> @transpose_single_column(<8 x float> %a) { +define <8 x float> @transpose_single_column(<8 x float> %a) #0 { ; CHECK-LABEL: @transpose_single_column( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x float> [[A:%.*]], <8 x float> undef, <8 x i32> @@ -72,7 +72,7 @@ declare <12 x float> @llvm.matrix.transpose.v12f32(<12 x float>, i32, i32) -define <12 x float> @transpose_float_3x4(<12 x float> %a) { +define <12 x float> @transpose_float_3x4(<12 x float> %a) #0 { ; CHECK-LABEL: @transpose_float_3x4( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <12 x float> [[A:%.*]], <12 x float> undef, <3 x i32> @@ -112,3 +112,5 @@ %c = call <12 x float> @llvm.matrix.transpose.v12f32(<12 x float> %a, i32 3, i32 4) ret <12 x float> %c } + +attributes #0 = { "may-contain-matrix-intrinsics"="true" } diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-i32.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-i32.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-i32.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/transpose-i32.ll @@ -3,7 +3,7 @@ ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s -define <8 x i32> @transpose(<8 x i32> %a) { +define <8 x i32> @transpose(<8 x i32> %a) #0 { ; CHECK-LABEL: @transpose( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> undef, <2 x i32> @@ -36,7 +36,7 @@ declare <8 x i32> @llvm.matrix.transpose(<8 x i32>, i32, i32) -define <8 x i32> @transpose_single_column(<8 x i32> %a) { +define <8 x i32> @transpose_single_column(<8 x i32> %a) #0 { ; CHECK-LABEL: @transpose_single_column( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> undef, <8 x i32> @@ -72,7 +72,7 @@ declare <12 x i32> @llvm.matrix.transpose.v12i32(<12 x i32>, i32, i32) -define <12 x i32> @transpose_i32_3x4(<12 x i32> %a) { +define <12 x i32> @transpose_i32_3x4(<12 x i32> %a) #0 { ; CHECK-LABEL: @transpose_i32_3x4( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <12 x i32> [[A:%.*]], <12 x i32> undef, <3 x i32> @@ -112,3 +112,5 @@ %c = call <12 x i32> @llvm.matrix.transpose.v12i32(<12 x i32> %a, i32 3, i32 4) ret <12 x i32> %c } + +attributes #0 = { "may-contain-matrix-intrinsics"="true" }