)]}'
{
  "commit": "d56c06e6c9f0cf03d75fd755c099a6844ecf38e6",
  "tree": "48e5ef4e6ca9d621263691694cef5d34c3addf04",
  "parents": [
    "4017dc06e3b5c4b97d8b1089070f88363e0db6f0"
  ],
  "author": {
    "name": "Abid Qadeer",
    "email": "haqadeer@amd.com",
    "time": "Thu Jul 03 10:38:28 2025 +0100"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu Jul 03 10:38:28 2025 +0100"
  },
  "message": "[flang][debug] Generate DISubprogramAttr for omp::TargetOp. (#146532)\n\nThis is combination of https://github.com/llvm/llvm-project/pull/138149\nand https://github.com/llvm/llvm-project/pull/138039 which were opened\nseparately for ease of reviewing. Only other change is adjustments in 2\ntests which have gone in since.\n\nThere are `DeclareOp` present for the variables mapped into target\nregion. That allow us to generate debug information for them. But the\n`TargetOp` is still part of parent function and those variables get the\nparent function\u0027s `DISubprogram` as a scope.\n    \nIn `OMPIRBuilder`, a new function is created for the `TargetOp`. We also\ncreate a new `DISubprogram` for it. All the variables that were in the\ntarget region now have to be updated to have the correct scope. This\nafter the fact updating of\ndebug information becomes very difficult in certain cases. Take the\nexample of variable arrays. The type of those arrays depend on the\nartificial `DILocalVariable`(s) which hold the size(s) of the array.\nThis new function will now require that we generate the new variable and\nand new types. Similar issue exist for character type variables too.\n    \nTo avoid this after the fact updating, this PR generates a\n`DISubprogramAttr` for the `TargetOp` while generating the debug info in\n`flang`. Then we don\u0027t need to generate a `DISubprogram` in\n`OMPIRBuilder`. This change is made a bit more complicated by the the\nfact that in new scheme, the debug location already points to the new\n`DISubprogram` by the time it reaches `convertOmpTarget`. But we need\nsome code generation in the parent function so we have to carefully\nmanage the debug locations.\n    \nThis fixes issue `#134991`.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "8fa2f38818c027c4976bc1a238ebf74713065450",
      "old_mode": 33188,
      "old_path": "flang/lib/Optimizer/Transforms/AddDebugInfo.cpp",
      "new_id": "6eb914e67fd5472114d462aad781e4b733657d02",
      "new_mode": 33188,
      "new_path": "flang/lib/Optimizer/Transforms/AddDebugInfo.cpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "6b895b732c42b6b13882d076397d8a61bcef46c3",
      "new_mode": 33188,
      "new_path": "flang/test/Transforms/debug-omp-target-op-1.fir"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "15dcf2389b21d46a4eb06af012dbf6c0a3ca75a5",
      "new_mode": 33188,
      "new_path": "flang/test/Transforms/debug-omp-target-op-2.fir"
    },
    {
      "type": "modify",
      "old_id": "85451b1233f96d4be0e7196cc89559ebe591da78",
      "old_mode": 33188,
      "old_path": "llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp",
      "new_id": "db792a3b52d249349fb29acd28fb53b3f2402afb",
      "new_mode": 33188,
      "new_path": "llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp"
    },
    {
      "type": "modify",
      "old_id": "7b07243c5f8437e313c9fc64fe639fee2b57c95a",
      "old_mode": 33188,
      "old_path": "mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp",
      "new_id": "883d179580e0c0793c380fa259d994a3a3219f8a",
      "new_mode": 33188,
      "new_path": "mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "45e5d2612e2c2d6a1ca5347a8073a3a50bb1d9fe",
      "new_mode": 33188,
      "new_path": "mlir/test/Target/LLVMIR/omptarget-debug-empty.mlir"
    },
    {
      "type": "modify",
      "old_id": "a755cef98d7c48e30d771624b41498cd0c0eb7b5",
      "old_mode": 33188,
      "old_path": "mlir/test/Target/LLVMIR/omptarget-debug-loop-loc.mlir",
      "new_id": "c3320382f8d452f69e9c1dad21438399d387f60f",
      "new_mode": 33188,
      "new_path": "mlir/test/Target/LLVMIR/omptarget-debug-loop-loc.mlir"
    },
    {
      "type": "modify",
      "old_id": "4495e1559a8891f31759023298362397999641a7",
      "old_mode": 33188,
      "old_path": "mlir/test/Target/LLVMIR/omptarget-debug-map-link-loc.mlir",
      "new_id": "492610251769c69a36c9a8d090f6792666910ebf",
      "new_mode": 33188,
      "new_path": "mlir/test/Target/LLVMIR/omptarget-debug-map-link-loc.mlir"
    },
    {
      "type": "modify",
      "old_id": "eaa88d9dd60535e46682b6105b0f1a06fe51da24",
      "old_mode": 33188,
      "old_path": "mlir/test/Target/LLVMIR/omptarget-debug-nowait.mlir",
      "new_id": "3bd724f42e8cebc312e0264b1d6609adf6ad8f81",
      "new_mode": 33188,
      "new_path": "mlir/test/Target/LLVMIR/omptarget-debug-nowait.mlir"
    },
    {
      "type": "modify",
      "old_id": "ea92589bbd03102278d2c68c3d3856858aea2816",
      "old_mode": 33188,
      "old_path": "mlir/test/Target/LLVMIR/omptarget-debug-var-1.mlir",
      "new_id": "8f42995af23a89265682c358a155017beda6dde6",
      "new_mode": 33188,
      "new_path": "mlir/test/Target/LLVMIR/omptarget-debug-var-1.mlir"
    },
    {
      "type": "modify",
      "old_id": "22db86fd85e2cc27321767c82b695ebf99176960",
      "old_mode": 33188,
      "old_path": "mlir/test/Target/LLVMIR/omptarget-debug-var-2.mlir",
      "new_id": "11a07dfd9a180416ce6656c0f5b0ba1ebe21e46a",
      "new_mode": 33188,
      "new_path": "mlir/test/Target/LLVMIR/omptarget-debug-var-2.mlir"
    },
    {
      "type": "modify",
      "old_id": "9c8344d69dc740b92fd119517765811c6e8e0172",
      "old_mode": 33188,
      "old_path": "mlir/test/Target/LLVMIR/omptarget-debug.mlir",
      "new_id": "ab687f198b9b4e0ca77b81310cff940c2232fa0b",
      "new_mode": 33188,
      "new_path": "mlir/test/Target/LLVMIR/omptarget-debug.mlir"
    },
    {
      "type": "modify",
      "old_id": "78dc6e18a40a78865c875b4721bbe0af290732af",
      "old_mode": 33188,
      "old_path": "mlir/test/Target/LLVMIR/omptarget-debug2.mlir",
      "new_id": "6cf75af38f916f82093b4a1ccc0cb32a7aa012ef",
      "new_mode": 33188,
      "new_path": "mlir/test/Target/LLVMIR/omptarget-debug2.mlir"
    },
    {
      "type": "modify",
      "old_id": "3c45f1f1c76fbe55c9ab8f9efd613a7407272d5d",
      "old_mode": 33188,
      "old_path": "mlir/test/Target/LLVMIR/omptarget-parallel-llvm-debug.mlir",
      "new_id": "b18338ea35cc386cfbb9d34959236be70745e95f",
      "new_mode": 33188,
      "new_path": "mlir/test/Target/LLVMIR/omptarget-parallel-llvm-debug.mlir"
    }
  ]
}
