Skip to content

[SPIR-V] Rename internal command line flags for optimization level and mtriple used when passing options into the translate API call #123975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

VyacheslavLevytskyy
Copy link
Contributor

Rename internal command line flags for optimization level and mtriple used when passing options into the translate API call.

@llvmbot
Copy link
Member

llvmbot commented Jan 22, 2025

@llvm/pr-subscribers-backend-spir-v

Author: Vyacheslav Levytskyy (VyacheslavLevytskyy)

Changes

Rename internal command line flags for optimization level and mtriple used when passing options into the translate API call.


Full diff: https://github.com/llvm/llvm-project/pull/123975.diff

2 Files Affected:

  • (modified) llvm/lib/Target/SPIRV/SPIRVAPI.cpp (+3-2)
  • (modified) llvm/unittests/Target/SPIRV/SPIRVAPITest.cpp (+2-2)
diff --git a/llvm/lib/Target/SPIRV/SPIRVAPI.cpp b/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
index 4c806fd7c98882..138054ad1a074e 100644
--- a/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
@@ -42,8 +42,9 @@ namespace {
 
 // Mimic limited number of command line flags from llc to provide a better
 // user experience when passing options into the translate API call.
-static cl::opt<char> SpvOptLevel(" O", cl::Hidden, cl::Prefix, cl::init('0'));
-static cl::opt<std::string> SpvTargetTriple(" mtriple", cl::Hidden,
+static cl::opt<char> SpvOptLevel("spv_O", cl::Hidden, cl::Prefix,
+                                 cl::init('0'));
+static cl::opt<std::string> SpvTargetTriple("spv_mtriple", cl::Hidden,
                                             cl::init(""));
 
 // Utility to accept options in a command line style.
diff --git a/llvm/unittests/Target/SPIRV/SPIRVAPITest.cpp b/llvm/unittests/Target/SPIRV/SPIRVAPITest.cpp
index 149db48c190a09..e9a0ac72e25769 100644
--- a/llvm/unittests/Target/SPIRV/SPIRVAPITest.cpp
+++ b/llvm/unittests/Target/SPIRV/SPIRVAPITest.cpp
@@ -80,7 +80,7 @@ TEST_F(SPIRVAPITest, checkTranslateOk) {
   // Those command line arguments that overlap with registered by llc/codegen
   // are to be started with the ' ' symbol.
   std::vector<std::string> SetOfOpts[] = {
-      {}, {"- mtriple=spirv32-unknown-unknown"}};
+      {}, {"-spv_mtriple=spirv32-unknown-unknown"}};
   for (const auto &Opts : SetOfOpts) {
     for (StringRef &Assembly : Assemblies) {
       std::string Result, Error;
@@ -100,7 +100,7 @@ TEST_F(SPIRVAPITest, checkTranslateError) {
   EXPECT_THAT(Error,
               StartsWith("SPIRVTranslateModule: Unknown command line argument "
                          "'-mtriple=spirv32-unknown-unknown'"));
-  Status = toSpirv(OkAssembly, Result, Error, {}, {"- O 5"});
+  Status = toSpirv(OkAssembly, Result, Error, {}, {"-spv_O 5"});
   EXPECT_FALSE(Status);
   EXPECT_TRUE(Result.empty());
   EXPECT_EQ(Error, "Invalid optimization level!");

@VyacheslavLevytskyy
Copy link
Contributor Author

Failing tests in buildkite are unrelated to the PR: AArch64/aarch64-build-attributes

@VyacheslavLevytskyy VyacheslavLevytskyy merged commit ac94fad into llvm:main Jan 22, 2025
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants