diff options
| author | Tobias Grosser <tobias@grosser.es> | 2016-07-15 10:32:22 +0000 |
|---|---|---|
| committer | Tobias Grosser <tobias@grosser.es> | 2016-07-15 10:32:22 +0000 |
| commit | b307ed4d086212e41ed7896a62cf6afd5bb2117f (patch) | |
| tree | c3d9ce42e6a755b3997838e0d534f4aef38fdc81 /polly/lib/CodeGen/PPCGCodeGeneration.cpp | |
| parent | 713bdc01fb6d29f4698bacd4d18ec98c8b55b6cf (diff) | |
GPGPU: Free options to avoid memory leak
ppcg does not free the option structs for us. To avoid a memory leak we do this
ourselves.
llvm-svn: 275546
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
| -rw-r--r-- | polly/lib/CodeGen/PPCGCodeGeneration.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index b9bad92fe5b7..abc03c405714 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -619,12 +619,26 @@ public: free(PPCGGen); } + /// Free the options in the ppcg scop structure. + /// + /// ppcg is not freeing these options for us. To avoid leaks we do this + /// ourselves. + /// + /// @param PPCGScop The scop referencing the options to free. + void freeOptions(ppcg_scop *PPCGScop) { + free(PPCGScop->options->debug); + PPCGScop->options->debug = nullptr; + free(PPCGScop->options); + PPCGScop->options = nullptr; + } + bool runOnScop(Scop &CurrentScop) override { S = &CurrentScop; auto PPCGScop = createPPCGScop(); auto PPCGProg = createPPCGProg(PPCGScop); auto PPCGGen = generateGPU(PPCGScop, PPCGProg); + freeOptions(PPCGScop); freePPCGGen(PPCGGen); gpu_prog_free(PPCGProg); ppcg_scop_free(PPCGScop); |
