digitalmars.D.ldc - lts with llvm 3.8 for ARM
I've tried out native and cross-compiling for Android/ARM with the just-released llvm 3.8. I ran into an error when compiling with any optimizations: ldc2: CommandLine Error: Option 'arm-load-store-opt' registered more than once! LLVM ERROR: inconsistency in registered CommandLine options I tracked it down to llvm's addPassesToEmitFile, which calls that optimization pass in two places, addPreRegAlloc and addPreSched2: https://github.com/llvm-mirror/llvm/blob/master/lib/Target/ARM/ARMTargetMachine.cpp#L386 However, llvm 3.7 does the same, so it appears that llvm 3.8 finally enforces that the same pass isn't inserted twice? I'm able to work around the issue by disabling that pass, using --arm-load-store-opt=false. All the same tests pass on Android/ARM after that. Let me know if anyone else runs into the same issue with llvm 3.8 for ARM. Other tweaks: - I was able to use Kai's longdouble patch to cross-compile, but I had to change ldc-real.h/cpp so that llvm::APFloat::mod only called a single argument. - Dan's PR for std.internal.math.errorfunction (https://github.com/ldc-developers/phobos/pull/25) is not necessary with llvm 3.8, ie those tests pass without it.
Mar 10 2016
Joakim <dlang joakim.fea.st> writes:I've tried out native and cross-compiling for Android/ARM with the just-released llvm 3.8. I ran into an error when compiling with any optimizations: ldc2: CommandLine Error: Option 'arm-load-store-opt' registered more than once! LLVM ERROR: inconsistency in registered CommandLine options I tracked it down to llvm's addPassesToEmitFile, which calls that optimization pass in two places, addPreRegAlloc and addPreSched2: https://github.com/llvm-mirror/llvm/blob/master/lib/Target/ARM/ARMTargetMachine.cpp#L386 However, llvm 3.7 does the same, so it appears that llvm 3.8 finally enforces that the same pass isn't inserted twice? I'm able to work around the issue by disabling that pass, using --arm-load-store-opt=false. All the same tests pass on Android/ARM after that. Let me know if anyone else runs into the same issue with llvm 3.8 for ARM.I was hoping those were only pre-3.8 release. I ran into those when I played with watchOS target. I think LDC needs to use the PassManager differently or the new PassManager? I don't have any deep knowledge here. I ended up patching my fork of LLVM to rename optimization flags so commandline and internal ones did not conflict. AAarch64 has some similar conflicts. There is actually more stuff that doesn't work post 3.7 that needs fixing, like some target option to disable fp elimination and something to do with soft-float ABI. I am writing this from memory but have notes I can go over later this evening. Should make LDC issues for these. -- Dan
Mar 10 2016
On Thursday, 10 March 2016 at 08:18:55 UTC, Joakim wrote:I've tried out native and cross-compiling for Android/ARM with the just-released llvm 3.8. I ran into an error when compiling with any optimizations: ldc2: CommandLine Error: Option 'arm-load-store-opt' registered more than once! LLVM ERROR: inconsistency in registered CommandLine options I tracked it down to llvm's addPassesToEmitFile, which calls that optimization pass in two places, addPreRegAlloc and addPreSched2: https://github.com/llvm-mirror/llvm/blob/master/lib/Target/ARM/ARMTargetMachine.cpp#L386 However, llvm 3.7 does the same, so it appears that llvm 3.8 finally enforces that the same pass isn't inserted twice? I'm able to work around the issue by disabling that pass, using --arm-load-store-opt=false. All the same tests pass on Android/ARM after that. Let me know if anyone else runs into the same issue with llvm 3.8 for ARM.Hi Joakim! I know this error from LLVM 3.7 and aarch64 target. The problem is the PassNameParser used in gen/optimizer (~ line 44). The code is copied from the LLVM opt tool. I asked on the LLVM mailing list about it and got the recommendation to not use this approach in a productive tool because it is for test only. I did not yet prepare a PR because it only affected the AArch64 port. But now we should remove this feature. Regards, KaiOther tweaks: - I was able to use Kai's longdouble patch to cross-compile, but I had to change ldc-real.h/cpp so that llvm::APFloat::mod only called a single argument. - Dan's PR for std.internal.math.errorfunction (https://github.com/ldc-developers/phobos/pull/25) is not necessary with llvm 3.8, ie those tests pass without it.
Mar 10 2016