From 30dd113d6f670b8c5dc91239869a7fb208aab4a8 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Tue, 20 Jan 2015 18:54:16 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226589 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/LoopInfo.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 7811f24b863..1f8c1dba39b 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -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; } -- 2.11.0