RegionInfo: Do not access a value that was just moved away
authorTobias Grosser <tobias@grosser.es>
Tue, 15 Apr 2014 22:09:36 +0000 (22:09 +0000)
committerTobias Grosser <tobias@grosser.es>
Tue, 15 Apr 2014 22:09:36 +0000 (22:09 +0000)
This fixes a regression introduced in r206310.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206328 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/RegionInfo.cpp

index 6f3b4c29516b860aa2ee60cc4f1985b165697d58..f0bf59972bf3196587261bee960399290437e85d 100644 (file)
@@ -363,8 +363,8 @@ void Region::addSubRegion(Region *SubRegion, bool moveChildren) {
   std::vector<std::unique_ptr<Region>> Keep;
   for (iterator I = begin(), E = end(); I != E; ++I)
     if (SubRegion->contains(I->get()) && I->get() != SubRegion) {
-      SubRegion->children.push_back(std::move(*I));
       (*I)->parent = SubRegion;
+      SubRegion->children.push_back(std::move(*I));
     } else
       Keep.push_back(std::move(*I));