From: Pan Xiuli <xiuli....@intel.com> Should pass pointer of new printf_fmt into map for later delete.
Signed-off-by: Pan Xiuli <xiuli....@intel.com> --- backend/src/ir/unit.cpp | 1 + backend/src/ir/unit.hpp | 2 +- backend/src/llvm/llvm_gen_backend.cpp | 2 +- backend/src/llvm/llvm_printf_parser.cpp | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/src/ir/unit.cpp b/backend/src/ir/unit.cpp index 5604244..c9cb15e 100644 --- a/backend/src/ir/unit.cpp +++ b/backend/src/ir/unit.cpp @@ -33,6 +33,7 @@ namespace ir { } Unit::~Unit(void) { for (const auto &pair : functions) GBE_DELETE(pair.second); + for (const auto &pair : printfs) GBE_DELETE(pair.second); delete profilingInfo; } Function *Unit::getFunction(const std::string &name) const { diff --git a/backend/src/ir/unit.hpp b/backend/src/ir/unit.hpp index 9b9e41f..10a1af6 100644 --- a/backend/src/ir/unit.hpp +++ b/backend/src/ir/unit.hpp @@ -47,7 +47,7 @@ namespace ir { public: typedef map<std::string, Function*> FunctionSet; /*! Moved from printf pass */ - map<llvm::CallInst*, PrintfSet::PrintfFmt> printfs; + map<llvm::CallInst*, PrintfSet::PrintfFmt*> printfs; /*! Create an empty unit */ Unit(PointerSize pointerSize = POINTER_32_BITS); /*! Release everything (*including* the function pointers) */ diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp index adc626e..8bcdc49 100644 --- a/backend/src/llvm/llvm_gen_backend.cpp +++ b/backend/src/llvm/llvm_gen_backend.cpp @@ -726,7 +726,7 @@ namespace gbe ir::PrintfSet::PrintfFmt* getPrintfInfo(CallInst* inst) { if (unit.printfs.find(inst) == unit.printfs.end()) return NULL; - return &unit.printfs[inst]; + return unit.printfs[inst]; } private: void setDebugInfo_CTX(llvm::Instruction * insn); // store the debug infomation in context for subsequently passing to Gen insn diff --git a/backend/src/llvm/llvm_printf_parser.cpp b/backend/src/llvm/llvm_printf_parser.cpp index c9ec85f..cdacb57 100644 --- a/backend/src/llvm/llvm_printf_parser.cpp +++ b/backend/src/llvm/llvm_printf_parser.cpp @@ -378,7 +378,7 @@ error: } GBE_ASSERT(unit.printfs.find(call) == unit.printfs.end()); - unit.printfs.insert(std::pair<llvm::CallInst*, PrintfSet::PrintfFmt>(call, *printf_fmt)); + unit.printfs.insert(std::pair<llvm::CallInst*, PrintfSet::PrintfFmt*>(call, printf_fmt)); return true; } -- 2.5.0 _______________________________________________ Beignet mailing list Beignet@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/beignet