Mesa (main): ac: use ResetAllOptionOccurrences instead of ResetCommandLineParser

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 7 11:00:46 UTC 2022


Module: Mesa
Branch: main
Commit: 062b5a9ba1b3e005d21b8c9253b266e53315d9c9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=062b5a9ba1b3e005d21b8c9253b266e53315d9c9

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Fri Jun  3 12:15:56 2022 +0100

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 at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Fixes: 7e2874dc93a ("ac: reset LLVM command line parser")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16850>

---

 src/amd/llvm/ac_llvm_helper.cpp | 4 ++--
 src/amd/llvm/ac_llvm_util.c     | 4 +---
 src/amd/llvm/ac_llvm_util.h     | 2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/amd/llvm/ac_llvm_helper.cpp b/src/amd/llvm/ac_llvm_helper.cpp
index 77034a06d53..71ed11a283b 100644
--- a/src/amd/llvm/ac_llvm_helper.cpp
+++ b/src/amd/llvm/ac_llvm_helper.cpp
@@ -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)
diff --git a/src/amd/llvm/ac_llvm_util.c b/src/amd/llvm/ac_llvm_util.c
index e4688933cc9..bfd9ec70325 100644
--- a/src/amd/llvm/ac_llvm_util.c
+++ b/src/amd/llvm/ac_llvm_util.c
@@ -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);
 }
 
diff --git a/src/amd/llvm/ac_llvm_util.h b/src/amd/llvm/ac_llvm_util.h
index b3ef2f617c8..f35c3aecbe4 100644
--- a/src/amd/llvm/ac_llvm_util.h
+++ b/src/amd/llvm/ac_llvm_util.h
@@ -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);



More information about the mesa-commit mailing list