Skip to content

Commit 9f3a611

Browse files
authored
[flang] Don't needlessly instantiate distinct UNSIGNED cases for FINDLOC (#120471)
The FINDLOC runtime doesn't need to distinguish between INTEGER and UNSIGNED data, so use the code for INTEGER also for UNSIGNED.
1 parent 6e8b3a3 commit 9f3a611

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

flang/runtime/findloc.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,9 @@ struct NumericFindlocHelper {
159159
Terminator &terminator) const {
160160
switch (targetCat) {
161161
case TypeCategory::Integer:
162-
ApplyIntegerKind<
163-
HELPER<CAT, KIND, TypeCategory::Integer>::template Functor, void>(
164-
targetKind, terminator, result, x, target, kind, dim, mask, back,
165-
terminator);
166-
break;
167162
case TypeCategory::Unsigned:
168163
ApplyIntegerKind<
169-
HELPER<CAT, KIND, TypeCategory::Unsigned>::template Functor, void>(
164+
HELPER<CAT, KIND, TypeCategory::Integer>::template Functor, void>(
170165
targetKind, terminator, result, x, target, kind, dim, mask, back,
171166
terminator);
172167
break;
@@ -235,13 +230,8 @@ void RTDEF(Findloc)(Descriptor &result, const Descriptor &x,
235230
RUNTIME_CHECK(terminator, xType.has_value() && targetType.has_value());
236231
switch (xType->first) {
237232
case TypeCategory::Integer:
238-
ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Integer,
239-
TotalNumericFindlocHelper>::template Functor,
240-
void>(xType->second, terminator, targetType->first, targetType->second,
241-
result, x, target, kind, 0, mask, back, terminator);
242-
break;
243233
case TypeCategory::Unsigned:
244-
ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Unsigned,
234+
ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Integer,
245235
TotalNumericFindlocHelper>::template Functor,
246236
void>(xType->second, terminator, targetType->first, targetType->second,
247237
result, x, target, kind, 0, mask, back, terminator);
@@ -331,13 +321,8 @@ void RTDEF(FindlocDim)(Descriptor &result, const Descriptor &x,
331321
RUNTIME_CHECK(terminator, xType.has_value() && targetType.has_value());
332322
switch (xType->first) {
333323
case TypeCategory::Integer:
334-
ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Integer,
335-
PartialNumericFindlocHelper>::template Functor,
336-
void>(xType->second, terminator, targetType->first, targetType->second,
337-
result, x, target, kind, dim, mask, back, terminator);
338-
break;
339324
case TypeCategory::Unsigned:
340-
ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Unsigned,
325+
ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Integer,
341326
PartialNumericFindlocHelper>::template Functor,
342327
void>(xType->second, terminator, targetType->first, targetType->second,
343328
result, x, target, kind, dim, mask, back, terminator);

0 commit comments

Comments
 (0)