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.s...@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@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/beignet