diff --git a/include/llvm/Transforms/Scalar/ConstantHoisting.h b/include/llvm/Transforms/Scalar/ConstantHoisting.h index 29311ca2dae..f947dafb906 100644 --- a/include/llvm/Transforms/Scalar/ConstantHoisting.h +++ b/include/llvm/Transforms/Scalar/ConstantHoisting.h @@ -126,7 +126,7 @@ public: bool runImpl(Function &F, TargetTransformInfo &TTI, DominatorTree &DT, BlockFrequencyInfo *BFI, BasicBlock &Entry); - void releaseMemory() { + void cleanup() { ClonedCastMap.clear(); ConstIntCandVec.clear(); for (auto MapEntry : ConstGEPCandMap) diff --git a/lib/Transforms/Scalar/ConstantHoisting.cpp b/lib/Transforms/Scalar/ConstantHoisting.cpp index 27d4f67ccc0..1af14ea73b8 100644 --- a/lib/Transforms/Scalar/ConstantHoisting.cpp +++ b/lib/Transforms/Scalar/ConstantHoisting.cpp @@ -114,8 +114,6 @@ public: AU.addRequired(); } - void releaseMemory() override { Impl.releaseMemory(); } - private: ConstantHoistingPass Impl; }; @@ -947,6 +945,8 @@ bool ConstantHoistingPass::runImpl(Function &Fn, TargetTransformInfo &TTI, // Cleanup dead instructions. deleteDeadCastInst(); + cleanup(); + return MadeChange; } diff --git a/test/Transforms/ConstantHoisting/X86/phi.ll b/test/Transforms/ConstantHoisting/X86/phi.ll index 086df140470..f9fba3ee26a 100644 --- a/test/Transforms/ConstantHoisting/X86/phi.ll +++ b/test/Transforms/ConstantHoisting/X86/phi.ll @@ -1,4 +1,5 @@ ; RUN: opt -S -consthoist < %s | FileCheck %s +; RUN: opt -S -passes=consthoist < %s | FileCheck %s target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.9.0"