[llvm] [AMDGPU][SplitModule] Do not create empty modules (PR #135761)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 23 01:58:52 PDT 2025


================
@@ -1487,6 +1491,13 @@ static void splitAMDGPUModule(
     for (unsigned NodeID : (*Proposal)[PID].set_bits())
       FnsInPart.insert(&SG.getNode(NodeID).getFunction());
 
+    // Don't create empty modules.
+    if (FnsInPart.empty()) {
+      LLVM_DEBUG(dbgs() << "[split] P" << PID
+                        << " is empty, not creating module\n");
+      continue;
+    }
+
----------------
jmmartinez wrote:

```suggestion
    // Don't create empty modules.
    if ((*Proposal)[PID].none()) {
      LLVM_DEBUG(dbgs() << "[split] P" << PID
                        << " is empty, not creating module\n");
      continue;
    }
    for (unsigned NodeID : (*Proposal)[PID].set_bits())
      FnsInPart.insert(&SG.getNode(NodeID).getFunction()); 
```

https://github.com/llvm/llvm-project/pull/135761


More information about the llvm-commits mailing list