[llvm] [DirectX] Propagate shader flags mask of callees to callers (PR #118306)

Chris B via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 08:44:58 PST 2025


================
@@ -62,27 +73,65 @@ static void updateFunctionFlags(ComputedShaderFlags &CSF, const Instruction &I,
     }
     }
   }
+  // Handle call instructions
+  if (auto *CI = dyn_cast<CallInst>(&I)) {
+    const Function *CF = CI->getCalledFunction();
+    // Merge-in shader flags mask of the called function in the current module
+    if (FunctionFlags.contains(CF)) {
+      CSF.merge(FunctionFlags[CF]);
+    }
----------------
llvm-beanz wrote:

nit:
```suggestion
    if (FunctionFlags.contains(CF))
      CSF.merge(FunctionFlags[CF]);
```
see: https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements


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


More information about the llvm-commits mailing list