@@ -32,7 +32,6 @@ class VFABIParserTest : public ::testing::Test {
32
32
<< Err.getMessage () << " \n " ;
33
33
// Reset the VFInfo
34
34
Info = VFInfo ();
35
- ScalarFuncParametersNum = 0 ;
36
35
}
37
36
38
37
// Data needed to load the optional IR passed to invokeParser
@@ -47,37 +46,29 @@ class VFABIParserTest : public ::testing::Test {
47
46
ElementCount &VF = Info.Shape.VF;
48
47
VFISAKind &ISA = Info.ISA;
49
48
SmallVector<VFParameter, 8 > &VecFuncParameters = Info.Shape.Parameters;
50
- size_t ScalarFuncParametersNum = 0 ;
51
49
std::string &ScalarName = Info.ScalarName;
52
50
std::string &VectorName = Info.VectorName;
53
- // Invoke the parser. We need to make sure that a function exist in
54
- // the module because the parser fails if such function don't
55
- // exists. Every time this method is invoked the state of the test
56
- // is reset.
57
- //
58
- // \p MangledName -> the string the parser has to demangle.
59
- //
60
- // \p VectorName -> optional vector name that the method needs to
61
- // use to create the function in the module if it differs from the
62
- // standard mangled name.
63
- //
64
- // \p STy -> FunctionType string to be used for the signature of
65
- // the vector function. The correct signature is needed by the
66
- // parser only for scalable functions. For the sake of testing, the
67
- // generic fixed-length case can use as signature `void()`.
68
- //
51
+
52
+ // / Invoke the parser. We need to make sure that a function exist in the
53
+ // / module because the parser fails if such function don't exists. Every time
54
+ // / this method is invoked the state of the test is reset.
55
+ // /
56
+ // / \p MangledName string the parser has to demangle.
57
+ // /
58
+ // / \p ScalarFTyStr FunctionType string to be used to get the signature of
59
+ // / the Scalar function. Used by `tryDemangleForVFABI` to check for the number
60
+ // of arguments on Scalable vectors, and by `matchScalarParamNum` to perform
61
+ // / some additional checking in the tests in this file.
69
62
bool invokeParser (const StringRef MangledName,
70
- const StringRef SFunTy = " void()" ) {
63
+ const StringRef ScalarFTyStr = " void()" ) {
71
64
// Reset the VFInfo and the Module to be able to invoke `invokeParser`
72
65
// multiple times in the same test.
73
- reset (SFunTy );
66
+ reset (ScalarFTyStr );
74
67
75
68
// Fake the arguments to the CallInst.
76
69
const auto OptInfo = VFABI::tryDemangleForVFABI (MangledName, ScalarFTy);
77
70
if (OptInfo) {
78
71
Info = *OptInfo;
79
- ScalarFuncParametersNum =
80
- Info.Shape .getScalarShape (ScalarFTy).Parameters .size ();
81
72
return true ;
82
73
}
83
74
return false ;
@@ -95,10 +86,12 @@ class VFABIParserTest : public ::testing::Test {
95
86
VFParamKind::GlobalPredicate;
96
87
}
97
88
98
- // Checks that the number of vectorized parameters matches the scalar ones.
99
- // Takes into account that vectorized calls may also have a Mask.
89
+ // Checks that the number of vectorized parameters matches the
90
+ // scalar ones. This requires a correct scalar FunctionType string to be fed
91
+ // to the 'invokeParser'. It takes into account that vectorized calls may also
92
+ // have a Mask.
100
93
bool matchScalarParamNum () {
101
- return (VecFuncParameters.size () - isMasked ()) == ScalarFuncParametersNum ;
94
+ return (VecFuncParameters.size () - isMasked ()) == ScalarFTy-> getNumParams () ;
102
95
}
103
96
};
104
97
} // unnamed namespace
0 commit comments