Skip to content

Commit 47a10a8

Browse files
committed
Code cleanup and format.
1 parent 5473d6d commit 47a10a8

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

lib/DXIL/DxilShaderFlags.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ ShaderFlags ShaderFlags::CollectShaderFlags(const Function *F,
573573
if (!OP::IsDxilOpFunc(CI->getCalledFunction()))
574574
continue;
575575
DXIL::OpCode dxilOp = hlsl::OP::getOpCode(CI);
576-
if (dxilOp >= DXIL::OpCode::NumOpCodes)
576+
if (dxilOp == DXIL::OpCode::NumOpCodes)
577577
continue;
578578
if (hlsl::OP::IsDxilOpWave(dxilOp))
579579
hasWaveOps = true;

lib/HLSL/DxilValidation.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,15 +3239,14 @@ static void ValidateFunctionBody(Function *F, ValidationContext &ValCtx) {
32393239
}
32403240

32413241
unsigned opcode = OpcodeConst->getLimitedValue();
3242-
DXIL::OpCode dxilOpcode = (DXIL::OpCode)opcode;
3243-
3244-
if (dxilOpcode >= DXIL::OpCode::NumOpCodes) {
3242+
if (opcode >= static_cast<unsigned>(DXIL::OpCode::NumOpCodes)) {
32453243
ValCtx.EmitInstrFormatError(
32463244
&I, ValidationRule::InstrIllegalDXILOpCode,
32473245
{std::to_string((unsigned)DXIL::OpCode::NumOpCodes),
32483246
std::to_string(opcode)});
32493247
continue;
32503248
}
3249+
DXIL::OpCode dxilOpcode = (DXIL::OpCode)opcode;
32513250

32523251
bool IllegalOpFunc = true;
32533252
for (auto &it : hlslOP->GetOpFuncList(dxilOpcode)) {

utils/hct/hctdb_instrhelp.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,12 @@ def print_opfunc_oload_type(self):
722722
for opcode in opcodes:
723723
line = line + "case OpCode::{name}".format(name=opcode + ":\n")
724724

725-
line = line + " if (FT->getNumParams() <= " + str(index) + ") return nullptr;\n"
725+
line = (
726+
line
727+
+ " if (FT->getNumParams() <= "
728+
+ str(index)
729+
+ ") return nullptr;\n"
730+
)
726731
line = line + " return FT->getParamType(" + str(index) + ");"
727732
print(line)
728733

@@ -732,7 +737,12 @@ def print_opfunc_oload_type(self):
732737
for opcode in opcodes:
733738
line = line + "case OpCode::{name}".format(name=opcode + ":\n")
734739

735-
line = line + " if (FT->getNumParams() <= " + str(index) + ") return nullptr;\n"
740+
line = (
741+
line
742+
+ " if (FT->getNumParams() <= "
743+
+ str(index)
744+
+ ") return nullptr;\n"
745+
)
736746
line = (
737747
line
738748
+ " return FT->getParamType("

0 commit comments

Comments
 (0)