- tree stmt = bsi_stmt (i);
- tree call;
-
- if (TREE_CODE (stmt) == MODIFY_EXPR
- && (call = TREE_OPERAND (stmt, 1),
- TREE_CODE (call) == CALL_EXPR)
- && !CALL_EXPR_RETURN_SLOT_OPT (call)
- && aggregate_value_p (call, call))
- /* Check if the location being assigned to is
- call-clobbered. */
- CALL_EXPR_RETURN_SLOT_OPT (call) =
- dest_safe_for_nrv_p (TREE_OPERAND (stmt, 0)) ? 1 : 0;
+ gimple stmt = gsi_stmt (gsi);
+ bool slot_opt_p;
+
+ if (is_gimple_call (stmt)
+ && gimple_call_lhs (stmt)
+ && !gimple_call_return_slot_opt_p (stmt)
+ && aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)),
+ gimple_call_fndecl (stmt)))
+ {
+ /* Check if the location being assigned to is
+ clobbered by the call. */
+ slot_opt_p = dest_safe_for_nrv_p (stmt);
+ gimple_call_set_return_slot_opt (stmt, slot_opt_p);
+ }