Replaces the OpCompositeInsert |inst| that inserts |construct| into the same object as |inst| with final index removed. If the resulting OpCompositeInsert instruction would have no remaining indexes, the instruction is replaced with an OpCopyObject instead.
| 2783 | // OpCompositeInsert instruction would have no remaining indexes, the |
| 2784 | // instruction is replaced with an OpCopyObject instead. |
| 2785 | void InsertConstructedObject(Instruction* inst, const Instruction* construct) { |
| 2786 | if (inst->NumInOperands() == 3) { |
| 2787 | inst->SetOpcode(spv::Op::OpCopyObject); |
| 2788 | inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {construct->result_id()}}}); |
| 2789 | } else { |
| 2790 | inst->SetInOperand(kInsertObjectIdInIdx, {construct->result_id()}); |
| 2791 | inst->RemoveOperand(inst->NumOperands() - 1); |
| 2792 | } |
| 2793 | } |
| 2794 | |
| 2795 | // Replaces a series of |OpCompositeInsert| instruction that cover the entire |
| 2796 | // object with an |OpCompositeConstruct|. |
no test coverage detected