From: Junyan He <junyan...@linux.intel.com> After the lowering return pass, a new block which just has one RET instruction will be generated, and all RET INSTs in the middle will be replaced by BRA INST. We want our store_profiling instruction to be inserted just before that return instruction and out of any condition blocks. So we postpone the STORE_PROFILING here.
Signed-off-by: Junyan He <junyan...@linux.intel.com> --- backend/src/ir/lowering.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/src/ir/lowering.cpp b/backend/src/ir/lowering.cpp index 9fcdf74..b312131 100644 --- a/backend/src/ir/lowering.cpp +++ b/backend/src/ir/lowering.cpp @@ -52,6 +52,13 @@ namespace ir { const LabelIndex index = this->label(); this->LABEL(index); const BasicBlock *lastBlock = this->bb; + + /* Append the STORE_PROFILING just before return. */ + if (unit.getInProfilingMode() == true) { + this->STORE_PROFILING(this->getUnit().getProfilingInfo()->getBTI(), + this->getUnit().getProfilingInfo()->getProfilingType()); + } + this->RET(); // Now traverse all instructions and replace all returns by GOTO index -- 1.7.9.5 _______________________________________________ Beignet mailing list Beignet@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/beignet