shader: Address Feedback

This commit is contained in:
FernandoS27 2021-04-03 01:48:39 +02:00 committed by ameerj
parent 45d547af11
commit baec84247f
16 changed files with 60 additions and 211 deletions

View file

@ -374,17 +374,14 @@ std::optional<IR::Value> FoldCompositeExtractImpl(IR::Value inst_value, IR::Opco
if (inst->Opcode() == construct) {
return inst->Arg(first_index);
}
if (inst->Opcode() != insert) {
return std::nullopt;
}
IR::Value value_index{inst->Arg(2)};
if (!value_index.IsImmediate()) {
return std::nullopt;
}
const u32 second_index = value_index.U32();
const u32 second_index{value_index.U32()};
if (first_index != second_index) {
IR::Value value_composite{inst->Arg(0)};
if (value_composite.IsImmediate()) {
@ -404,8 +401,8 @@ void FoldCompositeExtract(IR::Inst& inst, IR::Opcode construct, IR::Opcode inser
if (!value_2.IsImmediate()) {
return;
}
const u32 first_index = value_2.U32();
auto result = FoldCompositeExtractImpl(value_1, insert, construct, first_index);
const u32 first_index{value_2.U32()};
const std::optional result{FoldCompositeExtractImpl(value_1, insert, construct, first_index)};
if (!result) {
return;
}