[llvm] 6334952 - [rs4gc] minor code style improvement

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 6 08:47:44 PST 2021


Author: Philip Reames
Date: 2021-03-06T08:46:15-08:00
New Revision: 6334952ff00ea32ba4692d3f1a0dcf948409a18b

URL: https://github.com/llvm/llvm-project/commit/6334952ff00ea32ba4692d3f1a0dcf948409a18b
DIFF: https://github.com/llvm/llvm-project/commit/6334952ff00ea32ba4692d3f1a0dcf948409a18b.diff

LOG: [rs4gc] minor code style improvement

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
index 4f98fff65d50..ad1c61c80881 100644
--- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -676,17 +676,21 @@ namespace {
 /// the base of this BDV.
 class BDVState {
 public:
-  enum Status { Unknown, Base, Conflict };
-
-  BDVState() : BaseValue(nullptr) {}
+  enum Status {
+     // Starting state of lattice
+     Unknown,
+     // Some specific base value
+     Base,
+     // Need to insert a node to represent a merge.
+     Conflict
+  };
 
+  BDVState() {}
   explicit BDVState(Status Status, Value *BaseValue = nullptr)
       : Status(Status), BaseValue(BaseValue) {
     assert(Status != Base || BaseValue);
   }
 
-  explicit BDVState(Value *BaseValue) : Status(Base), BaseValue(BaseValue) {}
-
   Status getStatus() const { return Status; }
   Value *getBaseValue() const { return BaseValue; }
 
@@ -724,7 +728,7 @@ class BDVState {
 
 private:
   Status Status = Unknown;
-  AssertingVH<Value> BaseValue; // Non-null only if Status == Base.
+  AssertingVH<Value> BaseValue = nullptr; // Non-null only if Status == Base.
 };
 
 } // end anonymous namespace
@@ -874,7 +878,7 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &Cache) {
   // base state for known bases and expect to find a cached state otherwise.
   auto GetStateForBDV = [&](Value *BaseValue, Value *Input) {
     if (isKnownBaseResult(BaseValue) && areBothVectorOrScalar(BaseValue, Input))
-      return BDVState(BaseValue);
+      return BDVState(BDVState::Base, BaseValue);
     auto I = States.find(BaseValue);
     assert(I != States.end() && "lookup failed!");
     return I->second;


        


More information about the llvm-commits mailing list