[Beignet] [PATCH] GBE: fix some minor bugs.

Zhigang Gong zhigang.gong at linux.intel.com
Wed Sep 10 22:50:08 PDT 2014


Ok, I will separate them whe push to the repo, thanks.

On Thu, Sep 11, 2014 at 06:28:32AM +0000, Zou, Nanhai wrote:
> You'd better separate it into 2 patches since it fixed 2 different issues.
> 
> Thanks
> Zou Nanhai
> 
> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Zhigang Gong
> Sent: Thursday, September 11, 2014 1:02 PM
> To: beignet at lists.freedesktop.org
> Cc: Gong, Zhigang
> Subject: [Beignet] [PATCH] GBE: fix some minor bugs.
> 
> When compile a empty string, we may get an empty module which is not an error.
> 
> And when we fail to compile a module, the fileName may be NULL, we can't access it unconditionally.
> 
> The last one is to fix a memory leak bug :
> we need to delete unit if we fail to generate Gen unit.
> 
> Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
> ---
>  backend/src/backend/program.cpp  | 4 +++-  backend/src/llvm/llvm_to_gen.cpp | 2 +-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp index cc76493..06c22ac 100644
> --- a/backend/src/backend/program.cpp
> +++ b/backend/src/backend/program.cpp
> @@ -114,7 +114,9 @@ namespace gbe {
>        cloned_module = llvm::CloneModule((llvm::Module*)module);
>      }
>      if (llvmToGen(*unit, fileName, module, optLevel, OCL_STRICT_CONFORMANCE) == false) {
> -      error = std::string(fileName) + " not found";
> +      if (fileName)
> +        error = std::string(fileName) + " not found";
> +      delete unit;
>        return false;
>      }
>      //If unit is not valid, maybe some thing don't support by backend, introduce by some passes diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp
> index 67890d1..e31421f 100644
> --- a/backend/src/llvm/llvm_to_gen.cpp
> +++ b/backend/src/llvm/llvm_to_gen.cpp
> @@ -227,7 +227,7 @@ namespace gbe
>      if (!module)
>        delete cl_mod;
>      if (M.get() == 0)
> -      return false;
> +      return true;
>  
>      Module &mod = *M.get();
>      DataLayout DL(&mod);
> --
> 1.8.3.2
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list