[Beignet] [PATCH] GBE: Only emit multiply when immediate is not one.

Zhigang Gong zhigang.gong at linux.intel.com
Thu Mar 12 01:10:27 PDT 2015


Nice catch, ruiling. Just pushed.

Thanks,
Zhigang Gong.

On Wed, Mar 11, 2015 at 02:39:24PM +0800, Ruiling Song wrote:
> As constant propagation will introduce constantExpr and gep instruction,
> I choose not to run constant propagation pass after RemoveGep pass.
> So, here only generate Multiply as needed.
> We may do such kind of optimization in Gen IR level in the future.
> 
> This could fix the performance regression introduced by:
> "GBE: Import constantexpr lower pass from pNaCl"
> to the opencv case:
> opencv_perf_imgproc/OCL_BilateralFixture_Bilateral
> 
> Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> ---
>  backend/src/llvm/llvm_passes.cpp |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/backend/src/llvm/llvm_passes.cpp b/backend/src/llvm/llvm_passes.cpp
> index 1b40389..223f61b 100644
> --- a/backend/src/llvm/llvm_passes.cpp
> +++ b/backend/src/llvm/llvm_passes.cpp
> @@ -346,9 +346,11 @@ namespace gbe
>            }
>          }
>  
> -        BinaryOperator* tmpMul = 
> -          BinaryOperator::Create(Instruction::Mul, newConstSize, operand,
> -              "", GEPInst);
> +        Value* tmpMul = operand;
> +        if (size != 1) {
> +          tmpMul = BinaryOperator::Create(Instruction::Mul, newConstSize, operand,
> +                                         "", GEPInst);
> +        }
>          currentAddrInst = 
>            BinaryOperator::Create(Instruction::Add, currentAddrInst, tmpMul,
>                "", GEPInst);
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list