)]}'
{
  "commit": "bb03cdcb441fd68da9d1ebb7d5f39f73667cd39c",
  "tree": "27d76f4d725a8b0a1cc8eb3f9d7ca9fcc3a2a4b0",
  "parents": [
    "d5802c30ae6cf296489daf12b36582e9e1d658bb"
  ],
  "author": {
    "name": "Fangrui Song",
    "email": "i@maskray.me",
    "time": "Fri May 23 18:44:15 2025 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Fri May 23 18:44:15 2025 -0700"
  },
  "message": "RISCV: Remove shouldForceRelocation and unneeded relocations\n\nFollow-up to #140494\n\n`shouldForceRelocation` is conservative and produces redundant\nrelocations.\n\nFor example, RISCVAsmBackend::ForceRelocs (introduced to support mixed\nrelax/norelax code) leads to redundant relocations in the following\nexample adapted from #77436\n\n```\n.option norelax\nj label\n// For assembly input, RISCVAsmParser::ParseInstruction sets ForceRelocs (https://reviews.llvm.org/D46423).\n// For direct object emission, RISCVELFStreamer sets ForceRelocs (#77436)\n.option relax\ncall foo  // linker-relaxable\n\n.option norelax\nj label   // redundant relocation due to ForceRelocs\n.option relax\n\nlabel:\n```\n\nRoot problem: The `isSymbolRefDifferenceFullyResolvedImpl` condition in\nMCAssembler::evaluateFixup does not check whether two locations are\nseparated by a fragment whose size can be indeterminate due to linker\ninstruction (e.g. MCDataFragment with relaxation, or MCAlignFragment\ndue to indeterminate start offst).\n\nThis patch\n\n* Updates the fragment walk code in\n  `attemptToFoldSymbolOffsetDifference` to treat MCRelaxableFragment\n  (for --riscv-asm-relax-branches) as fixed size after finishLayout.\n* Adds a condition in `addReloc` to complement\n  `isSymbolRefDifferenceFullyResolvedImpl`.\n* Removes the no longer needed `shouldForceRelocation`.\n\nThis fragment walk code path handles nicely handles\nmixed relax/norelax case from\nhttps://discourse.llvm.org/t/possible-problem-related-to-subtarget-usage/75283\nand allows us to remove `MCSubtargetInfo` argument (#73721) as a follow-up.\n\nThis fragment walk code should be avoided in the absence of\nlinker-relaxable fragments within the current section.\n\nAdjust two bolt/test/RISCV tests (#141310)\n\nPull Request: https://github.com/llvm/llvm-project/pull/140692\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9ad38f86ff541421b82f0bf88e4db342384e3a5d",
      "old_mode": 33188,
      "old_path": "bolt/test/RISCV/reloc-label-diff.s",
      "new_id": "f1144767714b1453fba40516d400de3fc21076e9",
      "new_mode": 33188,
      "new_path": "bolt/test/RISCV/reloc-label-diff.s"
    },
    {
      "type": "modify",
      "old_id": "6909fde59a4801945f04f133e8fe9804fc892ec0",
      "old_mode": 33188,
      "old_path": "bolt/test/RISCV/reorder-blocks-reverse.s",
      "new_id": "6a9c879128278bda703de87c6c96bd4972264f63",
      "new_mode": 33188,
      "new_path": "bolt/test/RISCV/reorder-blocks-reverse.s"
    },
    {
      "type": "modify",
      "old_id": "d463b40cbd14271acb945d2ddb9565974b226e27",
      "old_mode": 33188,
      "old_path": "llvm/include/llvm/MC/MCAssembler.h",
      "new_id": "becd7cf6e8d1b36524ed23d3edc0d552ccaa6b75",
      "new_mode": 33188,
      "new_path": "llvm/include/llvm/MC/MCAssembler.h"
    },
    {
      "type": "modify",
      "old_id": "b52124437ff0d451ef7eac1ddea0da51869d645e",
      "old_mode": 33188,
      "old_path": "llvm/include/llvm/MC/MCFixup.h",
      "new_id": "85ae555f9326f0e9a2533adbd571404eee5ceec7",
      "new_mode": 33188,
      "new_path": "llvm/include/llvm/MC/MCFixup.h"
    },
    {
      "type": "modify",
      "old_id": "be50fd2bd21df00c110588b7be0b213e26a7aa76",
      "old_mode": 33188,
      "old_path": "llvm/include/llvm/MC/MCSection.h",
      "new_id": "6b301a002e45ced434511676677cf6980f04edf4",
      "new_mode": 33188,
      "new_path": "llvm/include/llvm/MC/MCSection.h"
    },
    {
      "type": "modify",
      "old_id": "3a974f3591631d2bdcd656a56ab5238ba733cef4",
      "old_mode": 33188,
      "old_path": "llvm/lib/MC/MCAssembler.cpp",
      "new_id": "ec39d3ba64ca054169c973f7521776582dd2af75",
      "new_mode": 33188,
      "new_path": "llvm/lib/MC/MCAssembler.cpp"
    },
    {
      "type": "modify",
      "old_id": "29499e7b5c83beef6a29e1c0feea50d6a801b50f",
      "old_mode": 33188,
      "old_path": "llvm/lib/MC/MCELFStreamer.cpp",
      "new_id": "17c8266289217eb305dafab88437ef25f889e4e6",
      "new_mode": 33188,
      "new_path": "llvm/lib/MC/MCELFStreamer.cpp"
    },
    {
      "type": "modify",
      "old_id": "4c159feea48f815b8ecb551ef48de176283dbc3f",
      "old_mode": 33188,
      "old_path": "llvm/lib/MC/MCExpr.cpp",
      "new_id": "765f1a2e42b9e2978988b2524cc7c08454ae9a64",
      "new_mode": 33188,
      "new_path": "llvm/lib/MC/MCExpr.cpp"
    },
    {
      "type": "modify",
      "old_id": "94f12dd0490e1ec857ec38e36f5cc85c88c56ead",
      "old_mode": 33188,
      "old_path": "llvm/lib/MC/MCSection.cpp",
      "new_id": "8409eebad404b719e0b0fdf4719eb6bbf8f71b21",
      "new_mode": 33188,
      "new_path": "llvm/lib/MC/MCSection.cpp"
    },
    {
      "type": "modify",
      "old_id": "91c40a63a4e50e3995199900193558b1941bb7ff",
      "old_mode": 33188,
      "old_path": "llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp",
      "new_id": "970a6d9c121860151b23980847147675f7544480",
      "new_mode": 33188,
      "new_path": "llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp"
    },
    {
      "type": "modify",
      "old_id": "1fb6b9b0e319d8ec3c6a6d10c0c7538251fb7e35",
      "old_mode": 33188,
      "old_path": "llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp",
      "new_id": "ef0bf683afc7b3010087ddd1c0163f80e7d446a2",
      "new_mode": 33188,
      "new_path": "llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp"
    },
    {
      "type": "modify",
      "old_id": "42d6da25805bddbe607918d22687e2f066577ded",
      "old_mode": 33188,
      "old_path": "llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp",
      "new_id": "130cec2825f270f24ec755385b9cc14923a64629",
      "new_mode": 33188,
      "new_path": "llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp"
    },
    {
      "type": "modify",
      "old_id": "bcab114c0ecf0021cd9493fc95908d8a48e7905a",
      "old_mode": 33188,
      "old_path": "llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp",
      "new_id": "f5950979a20584e448cfb1ad8990e03e55a13825",
      "new_mode": 33188,
      "new_path": "llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp"
    },
    {
      "type": "modify",
      "old_id": "874cf654e7eef470d6361d7d90fcdc866f6ab277",
      "old_mode": 33188,
      "old_path": "llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h",
      "new_id": "6e59d2520548039251b1f32f0f79d91fb08d418f",
      "new_mode": 33188,
      "new_path": "llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h"
    },
    {
      "type": "modify",
      "old_id": "5a81c829e3a898e7a0fc2c189744843c2aeff8b8",
      "old_mode": 33188,
      "old_path": "llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp",
      "new_id": "c654fd2b5cbe0dbfd9608ee69cef9a1d69a01433",
      "new_mode": 33188,
      "new_path": "llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp"
    },
    {
      "type": "modify",
      "old_id": "5c29e1a55f986289595bdad1d5821001e834efff",
      "old_mode": 33188,
      "old_path": "llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp",
      "new_id": "8f9ce37a4de24111172507b91ce2e2305b037eb7",
      "new_mode": 33188,
      "new_path": "llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp"
    },
    {
      "type": "modify",
      "old_id": "64e81048a955982aa334305f863bc66243909b1d",
      "old_mode": 33188,
      "old_path": "llvm/test/CodeGen/RISCV/option-relax-relocation.ll",
      "new_id": "fd3d9435e22a3db56fba7f22fa93b750f0d9632b",
      "new_mode": 33188,
      "new_path": "llvm/test/CodeGen/RISCV/option-relax-relocation.ll"
    },
    {
      "type": "modify",
      "old_id": "3d1f72ffd46be876ec1cdaa2734fe418f573d664",
      "old_mode": 33188,
      "old_path": "llvm/test/MC/RISCV/fixups-binary-expression.s",
      "new_id": "7d4dfd30e3fb7bcdb6eb3d86d7105587f1377226",
      "new_mode": 33188,
      "new_path": "llvm/test/MC/RISCV/fixups-binary-expression.s"
    },
    {
      "type": "modify",
      "old_id": "7ecc14cc779e40909bb57f9c3a62e89d73b4b627",
      "old_mode": 33188,
      "old_path": "llvm/test/MC/RISCV/linker-relaxation.s",
      "new_id": "6b0685baaa69e9147f51dbfb429bd9bb9cfd2005",
      "new_mode": 33188,
      "new_path": "llvm/test/MC/RISCV/linker-relaxation.s"
    },
    {
      "type": "modify",
      "old_id": "c48cf4f0454163c088ff7cfd0501e7e20fcaa99c",
      "old_mode": 33188,
      "old_path": "llvm/test/MC/RISCV/long-conditional-jump.s",
      "new_id": "5f10baed498296516deb8ffbbbce38886d65c06f",
      "new_mode": 33188,
      "new_path": "llvm/test/MC/RISCV/long-conditional-jump.s"
    },
    {
      "type": "modify",
      "old_id": "8a6a929ad0241f0afce9a3e64cfee991091e97c2",
      "old_mode": 33188,
      "old_path": "llvm/test/MC/RISCV/option-relax.s",
      "new_id": "55cdbeae01a4e78358b1486627659234cc059405",
      "new_mode": 33188,
      "new_path": "llvm/test/MC/RISCV/option-relax.s"
    },
    {
      "type": "modify",
      "old_id": "788fddaa9446337e08e56732abdc79337db4bd2d",
      "old_mode": 33188,
      "old_path": "llvm/test/MC/RISCV/xqcibi-long-conditional-jump.s",
      "new_id": "aab664f2a75fd015b6001d4438522b8d84dc2de3",
      "new_mode": 33188,
      "new_path": "llvm/test/MC/RISCV/xqcibi-long-conditional-jump.s"
    }
  ]
}
