[llvm] [NFC][DirectX] Infrastructure to collect shader flags for each function (PR #112967)
Damyan Pepper via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 22 16:30:22 PDT 2024
================
@@ -20,29 +20,37 @@
using namespace llvm;
using namespace llvm::dxil;
-static void updateFlags(ComputedShaderFlags &Flags, const Instruction &I) {
+static void updateFlags(DXILModuleShaderFlagsInfo &MSFI, const Instruction &I) {
+ ComputedShaderFlags &FSF = MSFI.FuncShaderFlagsMap[I.getFunction()];
Type *Ty = I.getType();
if (Ty->isDoubleTy()) {
- Flags.Doubles = true;
+ FSF.Doubles = true;
switch (I.getOpcode()) {
case Instruction::FDiv:
case Instruction::UIToFP:
case Instruction::SIToFP:
case Instruction::FPToUI:
case Instruction::FPToSI:
- Flags.DX11_1_DoubleExtensions = true;
+ FSF.DX11_1_DoubleExtensions = true;
break;
}
}
}
-ComputedShaderFlags ComputedShaderFlags::computeFlags(Module &M) {
- ComputedShaderFlags Flags;
- for (const auto &F : M)
+static DXILModuleShaderFlagsInfo computeFlags(Module &M) {
+ DXILModuleShaderFlagsInfo MSFI;
+ for (const auto &F : M) {
+ if (F.isDeclaration())
+ continue;
+ if (!MSFI.FuncShaderFlagsMap.contains(&F)) {
----------------
damyanp wrote:
Can F appear multiple times in M? Or in multiple modules? I'm wondering why this is needed here.
Do we have test coverage for this case?
https://github.com/llvm/llvm-project/pull/112967
More information about the llvm-commits
mailing list