ac: use ResetAllOptionOccurrences instead of ResetCommandLineParser

Fixes -amdgpu-atomic-optimizations=true option.

From CommandLine.h:
/// Reset all command line options to a state that looks as if they have
/// never appeared on the command line.  This is useful for being able to parse
/// a command line multiple times (especially useful for writing tests).
void ResetAllOptionOccurrences();

/// Reset the command line parser back to its initial state.  This
/// removes
/// all options, categories, and subcommands and returns the parser to a state
/// where no options are supported.
void ResetCommandLineParser();

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fixes: 7e2874dc93 ("ac: reset LLVM command line parser")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16850>
This commit is contained in:
Rhys Perry 2022-06-03 12:15:56 +01:00 committed by Marge Bot
parent 2c70b1a217
commit 062b5a9ba1
3 changed files with 4 additions and 6 deletions

View File

@ -51,9 +51,9 @@ bool ac_is_llvm_processor_supported(LLVMTargetMachineRef tm, const char *process
return TM->getMCSubtargetInfo()->isCPUStringValid(processor);
}
void ac_reset_llvm_command_line_parser()
void ac_reset_llvm_all_options_occurences()
{
llvm::cl::ResetCommandLineParser();
llvm::cl::ResetAllOptionOccurrences();
}
void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)

View File

@ -62,9 +62,7 @@ static void ac_init_llvm_target(void)
#endif
};
#if LLVM_VERSION_MAJOR > 11
ac_reset_llvm_command_line_parser();
#endif
ac_reset_llvm_all_options_occurences();
LLVMParseCommandLineOptions(ARRAY_SIZE(argv), argv, NULL);
}

View File

@ -92,7 +92,7 @@ struct ac_llvm_compiler {
LLVMTargetRef ac_get_llvm_target(const char *triple);
const char *ac_get_llvm_processor_name(enum radeon_family family);
bool ac_is_llvm_processor_supported(LLVMTargetMachineRef tm, const char *processor);
void ac_reset_llvm_command_line_parser();
void ac_reset_llvm_all_options_occurences();
void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);
void ac_add_attr_alignment(LLVMValueRef val, uint64_t bytes);
bool ac_is_sgpr_param(LLVMValueRef param);