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

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 5 16:21:52 PST 2025


================
@@ -84,15 +129,21 @@ void ComputedShaderFlags::print(raw_ostream &OS) const {
 /// Return the shader flags mask of the specified function Func.
 const ComputedShaderFlags &
 ModuleShaderFlags::getFunctionFlags(const Function *Func) const {
-  const auto Iter = llvm::lower_bound(
-      FunctionFlags, Func,
-      [](const std::pair<const Function *, ComputedShaderFlags> FSM,
-         const Function *FindFunc) { return (FSM.first < FindFunc); });
+  auto Iter = FunctionFlags.find(Func);
   assert((Iter != FunctionFlags.end() && Iter->first == Func) &&
-         "No Shader Flags Mask exists for function");
+         "Get Shader Flags : No Shader Flags Mask exists for function");
   return Iter->second;
 }
 
+/// Merge specified shader flags mask SF with current mask of the specified
+/// function Func.
+void ModuleShaderFlags::mergeFunctionShaderFlags(const Function *Func,
+                                                 ComputedShaderFlags SF) {
+  assert(FunctionFlags.contains(Func) &&
+         "Merge Shader Flags : No Shader Flags Mask exists for function");
+  FunctionFlags[Func].merge(SF);
+}
----------------
bogner wrote:

This doesn't appear to be used.

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


More information about the llvm-commits mailing list