diff options
author | Ruiling Song <ruiling.song@intel.com> | 2015-03-11 14:39:24 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2015-03-12 15:57:23 +0800 |
commit | eb40b6a752897c1e8aef76d5630a997859a978c7 (patch) | |
tree | 5af231e7fe7bc1fea1a766e38e298463520ee94e | |
parent | ee89a55555cc02f192172c950ef5605d651356e4 (diff) |
GBE: Only emit multiply when immediate is not one.
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@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r-- | backend/src/llvm/llvm_passes.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/backend/src/llvm/llvm_passes.cpp b/backend/src/llvm/llvm_passes.cpp index 1b403898..223f61b5 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); |