[PM] Don't spend time making self moves no-ops. They're allowed to leave
authorChandler Carruth <chandlerc@gmail.com>
Tue, 20 Jan 2015 18:54:16 +0000 (18:54 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 20 Jan 2015 18:54:16 +0000 (18:54 +0000)
the object in a moved-from state, and its simpler to write the code that
way.

llvm-svn: 226589

llvm/include/llvm/Analysis/LoopInfo.h

index 7811f24..1f8c1db 100644 (file)
@@ -514,14 +514,12 @@ public:
     Arg.TopLevelLoops.clear();
   }
   LoopInfoBase &operator=(LoopInfoBase &&RHS) {
-    if (&RHS != this) {
-      BBMap = std::move(RHS.BBMap);
+    BBMap = std::move(RHS.BBMap);
 
-      for (auto *L : TopLevelLoops)
-        delete L;
-      TopLevelLoops = std::move(RHS.TopLevelLoops);
-      RHS.TopLevelLoops.clear();
-    }
+    for (auto *L : TopLevelLoops)
+      delete L;
+    TopLevelLoops = std::move(RHS.TopLevelLoops);
+    RHS.TopLevelLoops.clear();
     return *this;
   }