)]}'
{
  "commit": "bee1fc56c2fae6fb96cc54b24a3a7ed7767a2f4a",
  "tree": "941502e41d890d81e258dd8c671f2ae25c37a4ba",
  "parents": [
    "60ca584b8af0de525656f959991a440f8c191f12"
  ],
  "author": {
    "name": "Matheus Tavares Bernardino",
    "email": "quic_mathbern@quicinc.com",
    "time": "Wed Mar 22 18:17:10 2023 -0300"
  },
  "committer": {
    "name": "Taylor Simpson",
    "email": "tsimpson@quicinc.com",
    "time": "Fri Apr 21 09:32:51 2023 -0700"
  },
  "message": "Hexagon (translate.c): avoid redundant PC updates on COF\n\nWhen there is a conditional change of flow or an endloop instruction, we\npreload HEX_REG_PC with ctx-\u003enext_PC at gen_start_packet(). Nonetheless,\nwe still generate TCG code to do this update again at gen_goto_tb() when\nthe condition for the COF is not met, thus producing redundant\ninstructions. This can be seen with the following packet:\n\n 0x004002e4:  0x5c20d000 {       if (!P0) jump:t PC+0 }\n\nWhich generates this TCG code:\n\n   ---- 004002e4\n-\u003e mov_i32 pc,$0x4002e8\n   and_i32 loc9,p0,$0x1\n   mov_i32 branch_taken,loc9\n   add_i32 pkt_cnt,pkt_cnt,$0x2\n   add_i32 insn_cnt,insn_cnt,$0x2\n   brcond_i32 branch_taken,$0x0,ne,$L1\n   goto_tb $0x0\n   mov_i32 pc,$0x4002e4\n   exit_tb $0x7fb0c36e5200\n   set_label $L1\n   goto_tb $0x1\n-\u003e mov_i32 pc,$0x4002e8\n   exit_tb $0x7fb0c36e5201\n   set_label $L0\n   exit_tb $0x7fb0c36e5203\n\nNote that even after optimizations, the redundant PC update is still\npresent:\n\n   ---- 004002e4\n-\u003e mov_i32 pc,$0x4002e8                     sync: 0  dead: 0 1  pref\u003d0xffff\n   mov_i32 branch_taken,$0x1                sync: 0  dead: 0 1  pref\u003d0xffff\n   add_i32 pkt_cnt,pkt_cnt,$0x2             sync: 0  dead: 0 1  pref\u003d0xffff\n   add_i32 insn_cnt,insn_cnt,$0x2           sync: 0  dead: 0 1 2  pref\u003d0xffff\n   goto_tb $0x1\n-\u003e mov_i32 pc,$0x4002e8                     sync: 0  dead: 0 1  pref\u003d0xffff\n   exit_tb $0x7fb0c36e5201\n   set_label $L0\n   exit_tb $0x7fb0c36e5203\n\nWith this patch, the second redundant update is properly discarded.\n\nNote that we need the additional \"move_to_pc\" flag instead of just\navoiding the update whenever `dest \u003d\u003d ctx-\u003enext_PC`, as that could\npotentially skip updates from a COF with met condition, whose\nctx-\u003ebranch_dest just happens to be equal to ctx-\u003enext_PC.\n\nSigned-off-by: Matheus Tavares Bernardino \u003cquic_mathbern@quicinc.com\u003e\nSigned-off-by: Taylor Simpson \u003ctsimpson@quicinc.com\u003e\nReviewed-by: Anton Johansson \u003canjo@rev.ng\u003e\nReviewed-by: Taylor Simpson \u003ctsimpson@quicinc.com\u003e\nMessage-Id: \u003cfc059153c3f0526d97b7f13450c02b276b0908e1.1679519341.git.quic_mathbern@quicinc.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "665476ab489520473644d796eb34c95a4343a75f",
      "old_mode": 33188,
      "old_path": "target/hexagon/translate.c",
      "new_id": "58d638f734d74a0db372985ffbe7ae0dd2806d24",
      "new_mode": 33188,
      "new_path": "target/hexagon/translate.c"
    }
  ]
}
