[llvm] r323689 - [globalisel][legalizer] Change identity() to changeTo() to clarify that it changes things. NFC

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 12:46:16 PST 2018


Author: dsanders
Date: Mon Jan 29 12:46:16 2018
New Revision: 323689

URL: http://llvm.org/viewvc/llvm-project?rev=323689&view=rev
Log:
[globalisel][legalizer] Change identity() to changeTo() to clarify that it changes things. NFC

Prior to committing r323681, we decided to change pick() to identity() since
it wasn't clear from the name what pick() did. However, identity() isn't a very
good name either since it implies that no changes are made. For some reason,
naming it changeTo() didn't occur to me until just after the commit. This
should resolve the lack of clarity that pick() had while still implying that
it changes the MIR.


Modified:
    llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
    llvm/trunk/lib/CodeGen/GlobalISel/LegalizeMutations.cpp

Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h?rev=323689&r1=323688&r2=323689&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h Mon Jan 29 12:46:16 2018
@@ -158,7 +158,7 @@ LegalityPredicate numElementsNotPow2(uns
 } // end namespace LegalityPredicates
 
 namespace LegalizeMutations {
-LegalizeMutation identity(unsigned TypeIdx, LLT Ty);
+LegalizeMutation changeTo(unsigned TypeIdx, LLT Ty);
 LegalizeMutation widenScalarToNextPow2(unsigned TypeIdx, unsigned Min = 0);
 LegalizeMutation moreElementsToNextPow2(unsigned TypeIdx, unsigned Min = 0);
 } // end namespace LegalizeMutations
@@ -339,14 +339,14 @@ public:
     using namespace LegalityPredicates;
     using namespace LegalizeMutations;
     return widenScalarIf(narrowerThan(TypeIdx, Ty.getSizeInBits()),
-                         LegalizeMutations::identity(TypeIdx, Ty));
+                         changeTo(TypeIdx, Ty));
   }
 
   LegalizeRuleSet &maxScalar(unsigned TypeIdx, const LLT &Ty) {
     using namespace LegalityPredicates;
     using namespace LegalizeMutations;
     return narrowScalarIf(widerThan(TypeIdx, Ty.getSizeInBits()),
-                          LegalizeMutations::identity(TypeIdx, Ty));
+                          changeTo(TypeIdx, Ty));
   }
 
   LegalizeRuleSet &maxScalarIf(LegalityPredicate Predicate, unsigned TypeIdx, const LLT &Ty) {
@@ -357,7 +357,7 @@ public:
           return widerThan(TypeIdx, Ty.getSizeInBits()) &&
                  Predicate(Query);
         },
-        LegalizeMutations::identity(TypeIdx, Ty));
+        changeTo(TypeIdx, Ty));
   }
 
   LegalizeRuleSet &clampScalar(unsigned TypeIdx, const LLT &MinTy, const LLT &MaxTy) {

Modified: llvm/trunk/lib/CodeGen/GlobalISel/LegalizeMutations.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/LegalizeMutations.cpp?rev=323689&r1=323688&r2=323689&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/LegalizeMutations.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/LegalizeMutations.cpp Mon Jan 29 12:46:16 2018
@@ -15,7 +15,7 @@
 
 using namespace llvm;
 
-LegalizeMutation LegalizeMutations::identity(unsigned TypeIdx, LLT Ty) {
+LegalizeMutation LegalizeMutations::changeTo(unsigned TypeIdx, LLT Ty) {
   return
       [=](const LegalityQuery &Query) { return std::make_pair(TypeIdx, Ty); };
 }




More information about the llvm-commits mailing list