@@ -4649,10 +4649,8 @@ void CompilerMSL::emit_instruction(const Instruction &instruction)
46494649 uint32_t result_id = ops[1 ];
46504650 uint32_t op0 = ops[2 ];
46514651 uint32_t op1 = ops[3 ];
4652- forced_temporaries.insert (result_id);
46534652 auto &type = get<SPIRType>(result_type);
4654- statement (variable_decl (type, to_name (result_id)), " ;" );
4655- set<SPIRExpression>(result_id, to_name (result_id), result_type, true );
4653+ emit_uninitialized_temporary_expression (result_type, result_id);
46564654
46574655 auto &res_type = get<SPIRType>(type.member_types [1 ]);
46584656 if (opcode == OpIAddCarry)
@@ -4681,10 +4679,8 @@ void CompilerMSL::emit_instruction(const Instruction &instruction)
46814679 uint32_t result_id = ops[1 ];
46824680 uint32_t op0 = ops[2 ];
46834681 uint32_t op1 = ops[3 ];
4684- forced_temporaries.insert (result_id);
46854682 auto &type = get<SPIRType>(result_type);
4686- statement (variable_decl (type, to_name (result_id)), " ;" );
4687- set<SPIRExpression>(result_id, to_name (result_id), result_type, true );
4683+ emit_uninitialized_temporary_expression (result_type, result_id);
46884684
46894685 statement (to_expression (result_id), " ." , to_member_name (type, 0 ), " = " , to_enclosed_expression (op0), " * " ,
46904686 to_enclosed_expression (op1), " ;" );
@@ -4966,8 +4962,6 @@ void CompilerMSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id,
49664962 uint32_t mem_order_2, bool has_mem_order_2, uint32_t obj, uint32_t op1,
49674963 bool op1_is_pointer, bool op1_is_literal, uint32_t op2)
49684964{
4969- forced_temporaries.insert (result_id);
4970-
49714965 string exp = string (op) + " (" ;
49724966
49734967 auto &type = get_pointee_type (expression_type (obj));
@@ -5006,12 +5000,11 @@ void CompilerMSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id,
50065000 // the CAS loop, otherwise it will loop infinitely, with the comparison test always failing.
50075001 // The function updates the comparitor value from the memory value, so the additional
50085002 // comparison test evaluates the memory value against the expected value.
5009- statement ( variable_decl (type, to_name ( result_id)), " ; " );
5003+ emit_uninitialized_temporary_expression (result_type, result_id);
50105004 statement (" do" );
50115005 begin_scope ();
50125006 statement (to_name (result_id), " = " , to_expression (op1), " ;" );
50135007 end_scope_decl (join (" while (!" , exp, " && " , to_name (result_id), " == " , to_enclosed_expression (op1), " )" ));
5014- set<SPIRExpression>(result_id, to_name (result_id), result_type, true );
50155008 }
50165009 else
50175010 {
0 commit comments