OSDN Git Service

Fix a memory leak after rL341386.
authorHiroshi Yamauchi <yamauchi@google.com>
Tue, 4 Sep 2018 21:28:22 +0000 (21:28 +0000)
committerHiroshi Yamauchi <yamauchi@google.com>
Tue, 4 Sep 2018 21:28:22 +0000 (21:28 +0000)
Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D51658

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

lib/Transforms/Instrumentation/ControlHeightReduction.cpp

index 9a27b4a..5b1f499 100644 (file)
@@ -1753,8 +1753,8 @@ BranchInst *CHR::createMergedBranch(BasicBlock *PreEntryBlock,
          "NewEntryBlock's only pred must be EntryBlock");
   assert(VMap.find(NewEntryBlock) != VMap.end() &&
          "NewEntryBlock must have been copied");
-  OldBR->removeFromParent();
   OldBR->dropAllReferences();
+  OldBR->eraseFromParent();
   // The true predicate is a placeholder. It will be replaced later in
   // fixupBranchesAndSelects().
   BranchInst *NewBR = BranchInst::Create(NewEntryBlock,