[llvm-dev] Arguments name IR LLVM

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 29 11:32:06 PDT 2019


Bitcode parser doesn’t like “numerical” names for parameters:

opt: <stdin>:1:22: error: expected ')' at end of argument list
define void @foo(i32 %0) {
                     ^

--
Krzysztof Parzyszek  mailto:kparzysz at quicinc.com   AI tools development

From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Reid Kleckner via llvm-dev
Sent: Monday, July 29, 2019 1:14 PM
To: Hans Wennborg <hans at chromium.org>
Cc: llvm-dev at lists.llvm.org; mohamed messelka <m14m at live.fr>
Subject: [EXT] Re: [llvm-dev] Arguments name IR LLVM

On Mon, Jul 29, 2019 at 4:39 AM Hans Wennborg via llvm-dev <mailto:llvm-dev at lists.llvm.org> wrote:
The arguments are unnamed, which means they will be implicitly named %0, %1, %2.

OP's use case for the names aside, I think we should consider changing LLVM's IR printer to print unnamed arguments in function definitions as %0, %1, etc, like we do for instructions. We can skip the names for Function declarations since nothing can refer to them, but it's confusing to see %0 references with no definition. Unnamed BBs are another common source of confusion, but I'd leave that alone for now.

Reid


More information about the llvm-dev mailing list