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

Kai Nacke via llvm-dev
2016-03-01T17:49:51Z

On 27.02.2016 22:45, Justin Bogner wrote:
> 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?

Hi Justin!

Thanks for the answer! I think I will remove this "feature" from ldc.
Looks like asking for more trouble if I keep it...

Regards,
Kai