[IR] Simplify removeDeadConstantUsers. NFC
authorFangrui Song <maskray@google.com>
Wed, 14 Aug 2019 11:38:45 +0000 (11:38 +0000)
committerFangrui Song <maskray@google.com>
Wed, 14 Aug 2019 11:38:45 +0000 (11:38 +0000)
llvm-svn: 368833

llvm/lib/IR/Constants.cpp

index cc1eaed..a78de6a 100644 (file)
@@ -575,13 +575,10 @@ void Constant::removeDeadConstantUsers() const {
     }
 
     // If the constant was dead, then the iterator is invalidated.
-    if (LastNonDeadUser == E) {
+    if (LastNonDeadUser == E)
       I = user_begin();
-      if (I == E) break;
-    } else {
-      I = LastNonDeadUser;
-      ++I;
-    }
+    else
+      I = std::next(LastNonDeadUser);
   }
 }