OSDN Git Service

[AMDGPU] Fixed memory leak with inliner replaced
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Wed, 20 Sep 2017 06:34:28 +0000 (06:34 +0000)
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Wed, 20 Sep 2017 06:34:28 +0000 (06:34 +0000)
Delete inliner before replacing it.

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

lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

index 7badd2c..25d3629 100644 (file)
@@ -337,8 +337,10 @@ void AMDGPUTargetMachine::adjustPassManager(PassManagerBuilder &Builder) {
   bool AMDGPUAA = EnableAMDGPUAliasAnalysis && EnableOpt;
   bool LibCallSimplify = EnableLibCallSimplify && EnableOpt;
 
-  if (EnableAMDGPUFunctionCalls)
+  if (EnableAMDGPUFunctionCalls) {
+    delete Builder.Inliner;
     Builder.Inliner = createAMDGPUFunctionInliningPass();
+  }
 
   if (Internalize) {
     // If we're generating code, we always have the whole program available. The