@@ -1937,21 +1937,19 @@ static void adjustCallerStackProbes(Function &Caller, const Function &Callee) {
1937
1937
// / that is no larger.
1938
1938
static void
1939
1939
adjustCallerStackProbeSize (Function &Caller, const Function &Callee) {
1940
- if (Callee.hasFnAttribute (" stack-probe-size" )) {
1941
- uint64_t CalleeStackProbeSize;
1942
- Callee.getFnAttribute (" stack-probe-size" )
1943
- .getValueAsString ()
1944
- .getAsInteger (0 , CalleeStackProbeSize);
1945
- if (Caller.hasFnAttribute (" stack-probe-size" )) {
1946
- uint64_t CallerStackProbeSize;
1947
- Caller.getFnAttribute (" stack-probe-size" )
1948
- .getValueAsString ()
1949
- .getAsInteger (0 , CallerStackProbeSize);
1940
+ Attribute CalleeAttr = Callee.getFnAttribute (" stack-probe-size" );
1941
+ if (CalleeAttr.isValid ()) {
1942
+ Attribute CallerAttr = Caller.getFnAttribute (" stack-probe-size" );
1943
+ if (CallerAttr.isValid ()) {
1944
+ uint64_t CallerStackProbeSize, CalleeStackProbeSize;
1945
+ CallerAttr.getValueAsString ().getAsInteger (0 , CallerStackProbeSize);
1946
+ CalleeAttr.getValueAsString ().getAsInteger (0 , CalleeStackProbeSize);
1947
+
1950
1948
if (CallerStackProbeSize > CalleeStackProbeSize) {
1951
- Caller.addFnAttr (Callee. getFnAttribute ( " stack-probe-size " ) );
1949
+ Caller.addFnAttr (CalleeAttr );
1952
1950
}
1953
1951
} else {
1954
- Caller.addFnAttr (Callee. getFnAttribute ( " stack-probe-size " ) );
1952
+ Caller.addFnAttr (CalleeAttr );
1955
1953
}
1956
1954
}
1957
1955
}
@@ -1967,18 +1965,15 @@ adjustCallerStackProbeSize(Function &Caller, const Function &Callee) {
1967
1965
// / handled as part of inline cost analysis.
1968
1966
static void
1969
1967
adjustMinLegalVectorWidth (Function &Caller, const Function &Callee) {
1970
- if (Caller.hasFnAttribute (" min-legal-vector-width" )) {
1971
- if (Callee.hasFnAttribute (" min-legal-vector-width" )) {
1972
- uint64_t CallerVectorWidth;
1973
- Caller.getFnAttribute (" min-legal-vector-width" )
1974
- .getValueAsString ()
1975
- .getAsInteger (0 , CallerVectorWidth);
1976
- uint64_t CalleeVectorWidth;
1977
- Callee.getFnAttribute (" min-legal-vector-width" )
1978
- .getValueAsString ()
1979
- .getAsInteger (0 , CalleeVectorWidth);
1968
+ Attribute CallerAttr = Caller.getFnAttribute (" min-legal-vector-width" );
1969
+ if (CallerAttr.isValid ()) {
1970
+ Attribute CalleeAttr = Callee.getFnAttribute (" min-legal-vector-width" );
1971
+ if (CalleeAttr.isValid ()) {
1972
+ uint64_t CallerVectorWidth, CalleeVectorWidth;
1973
+ CallerAttr.getValueAsString ().getAsInteger (0 , CallerVectorWidth);
1974
+ CalleeAttr.getValueAsString ().getAsInteger (0 , CalleeVectorWidth);
1980
1975
if (CallerVectorWidth < CalleeVectorWidth)
1981
- Caller.addFnAttr (Callee. getFnAttribute ( " min-legal-vector-width " ) );
1976
+ Caller.addFnAttr (CalleeAttr );
1982
1977
} else {
1983
1978
// If the callee doesn't have the attribute then we don't know anything
1984
1979
// and must drop the attribute from the caller.
0 commit comments