[llvm] [Offload] Let binary utility take empty arguments (PR #162317)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 09:25:32 PDT 2025


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/162317

Summary:
There's no real reason to restrict people if they don't want to use
`triple`. It's important for the normal pipeline but I can see people
using these for other purposes.


>From 53e006c7961a35d163f12d44d56c0d964f78cbc7 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 7 Oct 2025 11:24:02 -0500
Subject: [PATCH] [Offload] Let binary utility take empty arguments

Summary:
There's no real reason to restrict people if they don't want to use
`triple`. It's important for the normal pipeline but I can see people
using these for other purposes.
---
 llvm/test/tools/llvm-offload-binary/llvm-offload-binary.ll | 4 ++++
 llvm/tools/llvm-offload-binary/llvm-offload-binary.cpp     | 7 +++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/llvm/test/tools/llvm-offload-binary/llvm-offload-binary.ll b/llvm/test/tools/llvm-offload-binary/llvm-offload-binary.ll
index b196c24b0f6f1..c6027b360e5cc 100644
--- a/llvm/test/tools/llvm-offload-binary/llvm-offload-binary.ll
+++ b/llvm/test/tools/llvm-offload-binary/llvm-offload-binary.ll
@@ -8,3 +8,7 @@
 ; CHECK-NEXT: arch            abc
 ; CHECK-NEXT: triple          x-y-z
 ; CHECK-NEXT: producer        none
+
+; RUN: llvm-offload-binary -o %t3 --image=file=%s
+; RUN: llvm-offload-binary %t3 --image=file=%t4
+; RUN: diff %s %t4
diff --git a/llvm/tools/llvm-offload-binary/llvm-offload-binary.cpp b/llvm/tools/llvm-offload-binary/llvm-offload-binary.cpp
index b1bc335fe5b9e..e22d13b946651 100644
--- a/llvm/tools/llvm-offload-binary/llvm-offload-binary.cpp
+++ b/llvm/tools/llvm-offload-binary/llvm-offload-binary.cpp
@@ -92,10 +92,9 @@ static Error bundleImages() {
     StringSaver Saver(Alloc);
     DenseMap<StringRef, StringRef> Args = getImageArguments(Image, Saver);
 
-    if (!Args.count("triple") || !Args.count("file"))
-      return createStringError(
-          inconvertibleErrorCode(),
-          "'file' and 'triple' are required image arguments");
+    if (!Args.count("file"))
+      return createStringError(inconvertibleErrorCode(),
+                               "'file' is a required image arguments");
 
     // Permit using multiple instances of `file` in a single string.
     for (auto &File : llvm::split(Args["file"], ",")) {



More information about the llvm-commits mailing list