[flang-commits] [flang] 9f3a611 - [flang] Don't needlessly instantiate distinct UNSIGNED cases for FINDLOC (#120471)

via flang-commits flang-commits at lists.llvm.org
Wed Dec 18 11:37:29 PST 2024


Author: Peter Klausler
Date: 2024-12-18T11:37:26-08:00
New Revision: 9f3a6114807b66738585af060012927bd0f05b88

URL: https://github.com/llvm/llvm-project/commit/9f3a6114807b66738585af060012927bd0f05b88
DIFF: https://github.com/llvm/llvm-project/commit/9f3a6114807b66738585af060012927bd0f05b88.diff

LOG: [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.

Added: 
    

Modified: 
    flang/runtime/findloc.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/findloc.cpp b/flang/runtime/findloc.cpp
index d05e9c58074c73..b9b1d7f7ab689f 100644
--- a/flang/runtime/findloc.cpp
+++ b/flang/runtime/findloc.cpp
@@ -159,14 +159,9 @@ struct NumericFindlocHelper {
         Terminator &terminator) const {
       switch (targetCat) {
       case TypeCategory::Integer:
-        ApplyIntegerKind<
-            HELPER<CAT, KIND, TypeCategory::Integer>::template Functor, void>(
-            targetKind, terminator, result, x, target, kind, dim, mask, back,
-            terminator);
-        break;
       case TypeCategory::Unsigned:
         ApplyIntegerKind<
-            HELPER<CAT, KIND, TypeCategory::Unsigned>::template Functor, void>(
+            HELPER<CAT, KIND, TypeCategory::Integer>::template Functor, void>(
             targetKind, terminator, result, x, target, kind, dim, mask, back,
             terminator);
         break;
@@ -235,13 +230,8 @@ void RTDEF(Findloc)(Descriptor &result, const Descriptor &x,
   RUNTIME_CHECK(terminator, xType.has_value() && targetType.has_value());
   switch (xType->first) {
   case TypeCategory::Integer:
-    ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Integer,
-                         TotalNumericFindlocHelper>::template Functor,
-        void>(xType->second, terminator, targetType->first, targetType->second,
-        result, x, target, kind, 0, mask, back, terminator);
-    break;
   case TypeCategory::Unsigned:
-    ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Unsigned,
+    ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Integer,
                          TotalNumericFindlocHelper>::template Functor,
         void>(xType->second, terminator, targetType->first, targetType->second,
         result, x, target, kind, 0, mask, back, terminator);
@@ -331,13 +321,8 @@ void RTDEF(FindlocDim)(Descriptor &result, const Descriptor &x,
   RUNTIME_CHECK(terminator, xType.has_value() && targetType.has_value());
   switch (xType->first) {
   case TypeCategory::Integer:
-    ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Integer,
-                         PartialNumericFindlocHelper>::template Functor,
-        void>(xType->second, terminator, targetType->first, targetType->second,
-        result, x, target, kind, dim, mask, back, terminator);
-    break;
   case TypeCategory::Unsigned:
-    ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Unsigned,
+    ApplyIntegerKind<NumericFindlocHelper<TypeCategory::Integer,
                          PartialNumericFindlocHelper>::template Functor,
         void>(xType->second, terminator, targetType->first, targetType->second,
         result, x, target, kind, dim, mask, back, terminator);


        


More information about the flang-commits mailing list