Lines Matching defs:inst
84 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
85 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
89 if (inst != nullptr) {
90 EXPECT_EQ(inst->opcode(), spv::Op::OpCopyObject);
91 inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0));
92 EXPECT_EQ(inst->opcode(), spv::Op::OpConstant);
94 const analysis::Constant* constant = const_mrg->GetConstantFromInst(inst);
100 const_mrg->GetConstantFromInst(inst)->AsScalarConstant();
948 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
949 spv::Op original_opcode = inst->opcode();
950 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
953 EXPECT_EQ(succeeded, inst == nullptr || inst->opcode() != original_opcode);
954 if (succeeded && inst != nullptr) {
955 EXPECT_EQ(inst->opcode(), spv::Op::OpCopyObject);
956 inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0));
958 EXPECT_THAT(opcodes, Contains(inst->opcode()));
960 const analysis::Constant* result = const_mrg->GetConstantFromInst(inst);
1058 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
1059 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
1063 if (succeeded && inst != nullptr) {
1064 EXPECT_EQ(inst->opcode(), spv::Op::OpCopyObject);
1065 inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0));
1067 EXPECT_THAT(opcodes, Contains(inst->opcode()));
1069 const analysis::Constant* result = const_mrg->GetConstantFromInst(inst);
1134 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
1135 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
1139 if (succeeded && inst != nullptr) {
1140 EXPECT_EQ(inst->opcode(), spv::Op::OpCopyObject);
1141 inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0));
1143 EXPECT_THAT(opcodes, Contains(inst->opcode()));
1145 const analysis::Constant* result = const_mrg->GetConstantFromInst(inst);
1258 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
1259 spv::Op original_opcode = inst->opcode();
1260 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
1263 EXPECT_EQ(succeeded, inst == nullptr || inst->opcode() != original_opcode);
1264 if (succeeded && inst != nullptr) {
1265 EXPECT_EQ(inst->opcode(), spv::Op::OpCopyObject);
1266 inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0));
1268 EXPECT_THAT(opcodes, Contains(inst->opcode()));
1270 const analysis::Constant* result = const_mrg->GetConstantFromInst(inst);
1400 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
1401 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
1405 EXPECT_EQ(inst->opcode(), spv::Op::OpCopyObject);
1407 if (inst->opcode() == spv::Op::OpCopyObject) {
1408 inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0));
1410 const analysis::Constant* result = const_mgr->GetConstantFromInst(inst);
1477 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
1478 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
1482 if (inst != nullptr) {
1483 EXPECT_EQ(inst->opcode(), spv::Op::OpCopyObject);
1484 inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0));
1487 EXPECT_THAT(bool_opcodes, Contains(inst->opcode()));
1490 const_mrg->GetConstantFromInst(inst)->AsBoolConstant();
2089 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
2090 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
2094 if (inst != nullptr) {
2095 EXPECT_EQ(inst->opcode(), spv::Op::OpCopyObject);
2096 inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0));
2097 EXPECT_EQ(inst->opcode(), spv::Op::OpConstant);
2100 const_mrg->GetConstantFromInst(inst)->AsFloatConstant();
2522 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
2523 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
2527 if (inst != nullptr) {
2528 EXPECT_EQ(inst->opcode(), spv::Op::OpCopyObject);
2529 inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0));
2530 EXPECT_EQ(inst->opcode(), spv::Op::OpConstant);
2533 const_mrg->GetConstantFromInst(inst)->AsFloatConstant();
3408 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
3409 inst = context->get_instruction_folder().FoldInstructionToConstant(inst,
3413 EXPECT_NE(inst, nullptr);
3414 if (inst != nullptr) {
3415 EXPECT_EQ(inst->opcode(), spv::Op::OpConstant);
3418 const_mrg->GetConstantFromInst(inst)->AsIntConstant();
3456 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
3457 inst = context->get_instruction_folder().FoldInstructionToConstant(inst,
3461 EXPECT_NE(inst, nullptr);
3462 if (inst != nullptr) {
3465 EXPECT_THAT(bool_opcodes, Contains(inst->opcode()));
3468 const_mrg->GetConstantFromInst(inst)->AsBoolConstant();
3507 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
3508 std::unique_ptr<Instruction> original_inst(inst->Clone(context.get()));
3509 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
3512 EXPECT_EQ(inst->result_id(), original_inst->result_id());
3513 EXPECT_EQ(inst->type_id(), original_inst->type_id());
3516 EXPECT_EQ(inst->opcode(), spv::Op::OpCopyObject);
3517 EXPECT_EQ(inst->GetSingleWordInOperand(0), tc.expected_result);
3519 EXPECT_EQ(inst->NumInOperands(), original_inst->NumInOperands());
3520 for (uint32_t i = 0; i < inst->NumInOperands(); ++i) {
3521 EXPECT_EQ(inst->GetOperand(i), original_inst->GetOperand(i));
5176 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
5177 std::unique_ptr<Instruction> original_inst(inst->Clone(context.get()));
5178 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
5181 EXPECT_EQ(inst->result_id(), original_inst->result_id());
5182 EXPECT_EQ(inst->type_id(), original_inst->type_id());
5185 EXPECT_EQ(inst->opcode(), spv::Op::OpFNegate);
5186 EXPECT_EQ(inst->GetSingleWordInOperand(0), tc.expected_result);
5188 EXPECT_EQ(inst->NumInOperands(), original_inst->NumInOperands());
5189 for (uint32_t i = 0; i < inst->NumInOperands(); ++i) {
5190 EXPECT_EQ(inst->GetOperand(i), original_inst->GetOperand(i));
5298 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
5299 std::unique_ptr<Instruction> original_inst(inst->Clone(context.get()));
5300 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
8056 Instruction* inst = nullptr;
8061 inst = terminator->PreviousNode();
8065 assert(inst && "Invalid test. Could not find instruction to fold.");
8066 std::unique_ptr<Instruction> original_inst(inst->Clone(context.get()));
8067 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
8410 Instruction* inst = nullptr;
8411 inst = &*context->module()->entry_points().begin();
8412 assert(inst && "Invalid test. Could not find entry point instruction to fold.");
8413 std::unique_ptr<Instruction> original_inst(inst->Clone(context.get()));
8414 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
8511 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
8512 std::unique_ptr<Instruction> original_inst(inst->Clone(context.get()));
8513 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);
8624 Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold);
8625 std::unique_ptr<Instruction> original_inst(inst->Clone(context.get()));
8626 bool succeeded = context->get_instruction_folder().FoldInstruction(inst);