[llvm-dev] Compiling for AArch64: CommandLine Error: Option 'aarch64-branch-relax' registered more than once!

Justin Bogner via llvm-dev
2016-02-27T21:45:16Z

Kai Nacke via llvm-dev <llvm-dev at lists.llvm.org>
writes:
> Compiling for AArch64: CommandLine Error: Option
> 'aarch64-branch-relax' registered more than once!
>
> Hi all!
>
> I am trying to run LDC (LLVM-based D compiler) on AArch64. The
> compiler contains all IR and target specific passes. You can view it
> as combined llc/opt tool. It uses the same strategy as opt to collect
> the passes with the NameParser. Like llc, it calls
> Target.addPassesToEmitFile() to add the target specific passes.
>
> I now get the following error message:
>
> ldc2.exe: CommandLine Error: Option 'aarch64-branch-relax'
registered
> more than once!
> LLVM ERROR: inconsistency in registered CommandLine options
>
> Reason is that the option 'aarch64-branch-relax' is registered in
file
> lib/Target/AArch64/AArch64BranchRelaxation.cpp and a second time
> through PassRegistry::registerPass() (because of the use of the
> NameParser - the pass is also named 'aarch64-branch-relax').

I wouldn't really recommend using the NameParser outside of a testing
tool. The "throw all of the pass names at cl::opt and see what sticks"
thing is pretty specialized to opt and makes for a pretty messy command
line interface for something that does anything other than just running
passes.

That said, the aarch64-branch-relax option in AArch64BranchRelaxation is
a bit silly: it's only useful for *disabling* the pass, despite the
name, and it isn't tested at all. I suspect it's just leftover from when
this pass was first being implemented and can be removed.

Tim: does it make sense to just remove this flag?

> Is this the intended behavior? If yes, what can I do to fix the compiler?
>
> Regards,
> Kai
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev