)]}'
{
  "commit": "2f1e6eb6c3e731266052536c3f98cce3a71a316e",
  "tree": "d5ab90b1f5bf61eb7b0d760c13e0858d7d90162b",
  "parents": [
    "a08de429e4ae0baaed23060cbae5c73dc6ffcc5d"
  ],
  "author": {
    "name": "yonghong-song",
    "email": "yhs@fb.com",
    "time": "Fri Jun 13 11:58:48 2025 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Fri Jun 13 11:58:48 2025 -0700"
  },
  "message": "[BPF] Report an warning if certain insn imm operand cannot fit in 32bit (#142989)\n\nIhor Solodrai reported a case ([1]) where gcc reports an error but clang\nignores that error and proceeds to generate incorrect code. More\nspecifically, the problematic code looks like:\n   if r1 \u003d\u003d 0xcafefeeddeadbeef goto \u003clabel\u003e\n\nHere, 0xcafefeeddeadbeef needs to be encoded in a 32-bit imm field\nof the insns and the 32-bit imm allows sign extenstion to 64-bit imm.\nObviously, 0xcafefeeddeadbeef cannot encode properly.\n\nThe compilation failed for gcc with the following error:\n  Error: immediate out of range, shall fit in 32 bits\n\nGiven a 64-bit imm value, converting to the proper 32-bit imm value\nmust satisfy the following 64-bit patterns:\n  00000000 00000000 00000000 00000000 xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx\n  11111111 11111111 11111111 11111111 1xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx\n\nSo if the top 32-bits is 0 or the top 33-bits is 0x1ffffffff, then the 64-bit imm\nvalue can be truncated into proper 32-bit imm. Otherwise, a warning\nmessage, the same as gcc, will be issued. If -Werror is enabled during\ncompilation, the warning will turn into an error.\n\n[1] https://lore.kernel.org/bpf/70affb12-327b-4882-bd1d-afda8b8c6f56@linux.dev/",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "10a46f100bbea36c470553f7afff2badeed0277f",
      "old_mode": 33188,
      "old_path": "llvm/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp",
      "new_id": "bd9d2de58c8b2930cbeb84d1bb82cc65a4ebe142",
      "new_mode": 33188,
      "new_path": "llvm/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "109d177b0fb42b38fb962b06d084d1045861474f",
      "new_mode": 33188,
      "new_path": "llvm/test/CodeGen/BPF/warn-cmp.ll"
    }
  ]
}
