[llvm] r226589 - [PM] Don't spend time making self moves no-ops. They're allowed to leave

Chandler Carruth chandlerc at gmail.com
Tue Jan 20 10:54:16 PST 2015


Author: chandlerc
Date: Tue Jan 20 12:54:16 2015
New Revision: 226589

URL: http://llvm.org/viewvc/llvm-project?rev=226589&view=rev
Log:
[PM] Don't spend time making self moves no-ops. They're allowed to leave
the object in a moved-from state, and its simpler to write the code that
way.

Modified:
    llvm/trunk/include/llvm/Analysis/LoopInfo.h

Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=226589&r1=226588&r2=226589&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Tue Jan 20 12:54:16 2015
@@ -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;
   }
 





More information about the llvm-commits mailing list