AArch64: Handle opts_set parameter properly in aarch64_option_restore
The AArch64 backend now correctly restores options, avoiding potential inconsistencies when target options are overridden.
The AArch64 backend’s TARGET_OPTION_RESTORE implementation now correctly handles the opts_set parameter, ensuring consistent option restoration. Previously, it was assumed that cl_target_option_restore would only be called with &global_options_set, which could lead to incorrect option overriding or failure to override as expected if options were set differently in opts_set and global_options_set. This change improves maintainability and prevents potential bugs related to target option handling.
In Details
This commit addresses an issue in the AArch64 backend's aarch64_option_restore function within aarch64.cc. The function was ignoring the opts_set parameter, potentially leading to incorrect option restoration when cl_target_option_restore is called with a different options set than &global_options_set. The fix ensures consistent option restoration by correctly passing the opts_set parameter to aarch64_override_options_internal and using it when invoking SET_OPTION_IF_UNSET.
For Context
GCC uses a system of options to control how code is compiled for different target architectures. The TARGET_OPTION_RESTORE mechanism allows the compiler to restore option settings to a previous state, which is important when dealing with target-specific pragmas or attributes that temporarily modify compilation settings. This commit fixes an issue in the AArch64 backend where option restoration was not happening correctly, which could lead to unexpected behavior when compiling code with target-specific options.