)]}'
{
  "commit": "4157a5aa7e7667e7873638ee85535aa3d2ea02b9",
  "tree": "0ac120ad7b12bcbbbd1eaf277d66c2b0a0b6dd72",
  "parents": [
    "8effc5eed2bbadb40af6dde872bb24ef58a16a55"
  ],
  "author": {
    "name": "Vineet Gupta",
    "email": "vineet.gupta@linux.dev",
    "time": "Mon Jul 20 10:59:20 2026 -0700"
  },
  "committer": {
    "name": "Jose E. Marchesi",
    "email": "jemarch@gnu.org",
    "time": "Tue Jul 21 20:08:39 2026 +0200"
  },
  "message": "bpf: TARGET_RTX_COSTS: treat 32-bit CONST_INT as cheap/free\n\nThis is to prefer constant return to be setup from imm constant vs.\nusing a prior reg known to have the same value (by control flow analysis).\nWhile there\u0027s nothing wrong with existing approach, it can sometimes leads\nto additional sign-extensions and other corner cases which trip up the\nbpf kernel verifier bounds checking for return reg.The verifier improvements\nare being worked on but lets adjust the cost model anyways so that constants\nare favored. There\u0027s no additional overhead from new codegen anyways.\n\nFor accompanying test const-cost-model.c, at -O2\n\n          Before               |            After\n-------------------------------+------------------------------\n  r1 \u003d 4                       |  r1 \u003d 4\n  call bpf_copy_from_user_str  |  call bpf_copy_from_user_str\n  r1 \u003d (s32) r0                |  ...\n  ...                          |  r1 \u003d 4                          \u003c---\n  call bpf_copy_from_user_str  |  call bpf_copy_from_user_str\n\nThis causes 4 additioanl bpf kernel selftests to pass (as of v7.1)\n\n| -Summary: 596/5387 PASSED, 123 SKIPPED, 114 FAILED\n| +Summary: 600/5422 PASSED, 123 SKIPPED, 110 FAILED\n|  #77      cgroup_xattr:OK\n|  #112     exe_ctx:OK\n|  #220     mem_rdonly_untrusted:OK\n|  #574     verifier_global_ptr_args:OK\n\ngcc/ChangeLog:\n\n\t* config/bpf/bpf.cc (bpf_rtx_costs): set CONST_INT 0 insns.\n\t* config/bpf/bpf.h (BPF_IMM32_P): New helper macro.\n\t* config/bpf/predicates.md (imm32_operand): Use new macro.\n\ngcc/testsuite/ChangeLog:\n\n\t* gcc.target/bpf/const-cost-model.c: New test prefers const.\n\t* gcc.target/bpf/const-cost-model-2.c: New test prefers const.\n\nSigned-off-by: Vineet Gupta \u003cvineet.gupta@linux.dev\u003e\n(cherry picked from commit e65d38a0dc843d36dd5605c6805645923b44c6a7)\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "58d2318f972b7744d715ac6de9c2f016597d8c36",
      "old_mode": 33188,
      "old_path": "gcc/config/bpf/bpf.cc",
      "new_id": "42fdc695881aab63bfe3804a9d7a39afd047c3ae",
      "new_mode": 33188,
      "new_path": "gcc/config/bpf/bpf.cc"
    },
    {
      "type": "modify",
      "old_id": "c8dad55fd4c49b296ce170915f3b2cae932cda71",
      "old_mode": 33188,
      "old_path": "gcc/config/bpf/bpf.h",
      "new_id": "57084ac3fa156690f95a2e942173cc29c8b2280b",
      "new_mode": 33188,
      "new_path": "gcc/config/bpf/bpf.h"
    },
    {
      "type": "modify",
      "old_id": "c4a06e4f8b8cc4ffe18adf3a9ca33216393ff535",
      "old_mode": 33188,
      "old_path": "gcc/config/bpf/predicates.md",
      "new_id": "bbbf7c2e9e6116104c422148b5b367ea9eacc502",
      "new_mode": 33188,
      "new_path": "gcc/config/bpf/predicates.md"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "063a3f60ababa5bcd9221b0303611b96c93980d6",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.target/bpf/const-cost-model-2.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "8cf2fb58492274115959b28352e8e93b4f830532",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.target/bpf/const-cost-model.c"
    }
  ]
}
