Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE on Android/ARM, related to recent LTO change in master #1860

Closed
joakim-noah opened this issue Oct 27, 2016 · 7 comments
Closed

ICE on Android/ARM, related to recent LTO change in master #1860

joakim-noah opened this issue Oct 27, 2016 · 7 comments

Comments

@joakim-noah
Copy link
Contributor

I've been building natively on Android/ARM with the latest llvm 3.9.0 release, I ran into this ICE when building druntime synced against latest master:

LLVM ERROR: Cannot select: 0xb592b708: f64 = bitcast 0xb592b3f0
  0xb592b3f0: i64 = build_pair 0xb592b090, 0xb592b5e8
    0xb592b090: i32,ch = CopyFromReg 0xb597de18, Register:i32 %vreg16
      0xb592b1b0: i32 = Register %vreg16
    0xb592b5e8: i32,ch = CopyFromReg 0xb592b090:1, Register:i32 %vreg17
      0xb592b0d8: i32 = Register %vreg17
In function: _d_array_init_double

I bisected and found that the issue is #1811, reverting that patch has master passing all stdlib and dmd tests again (there's an unrelated failure in the dmd testsuite because of the recently added test16225, which adds the -m64 flag and doesn't work because I don't compile in the ARM64 backend on ARM32).

This is the command run on my Android tablet, same as on any other platform:

/data/data/com.termux/files/home/ldc/build71/bin/ldc2 --output-o -c -I/data/data/com.termux/files/home/ldc/runtime/druntime/src -I/data/data/com.termux/files/home/ldc/runtime/druntime/src/gc /data/data/com.termux/files/home/ldc/runtime/druntime/src/ldc/arrayinit.d -of/data/data/com.termux/files/home/ldc/build71/runtime/src/ldc/arrayinit-unittest.o -w -O3 -release -unittest -disable-invariants

You should be able to reproduce by using an ldc compiled against llvm with an ARM backend and adding the flag -mtriple=armv7-none-linux-android or -mtriple=armv7-unknown-linux-gnueabi. If not, let me know.

@JohanEngelen
Copy link
Member

JohanEngelen commented Oct 27, 2016

What if you comment-out setting the "use-soft-float" attribute? It wasn't clear to me how to set it for the SoftFP ABI type.

@joakim-noah
Copy link
Contributor Author

Yeah, commenting that line out fixes it and gets all stdlib tests passing again.

@JohanEngelen
Copy link
Member

Thanks for testing, so now I have to figure out how to set things correctly for ARM. Perhaps an extra setting is needed. I'll have a look at what clang generates for the triples you specified.

@JohanEngelen
Copy link
Member

I think I've fixed it in #1863 . Sorry for breaking things, it's an underdocumented part of LLVM :(

@joakim-noah
Copy link
Contributor Author

Fixed by #1863.

@lyrachord
Copy link

Follow guides at https://wiki.dlang.org/Build_D_for_Android
cmake 3.9.6/3.10.0-rc5
NDK 16
ninja 1.8.2
ldc2 1.5.0

ldc-build-runtime --reset --ninja --targetPreset=Android-arm failed

LLVM ERROR: Cannot select: 0x1a81f10fb40: f64 = bitcast 0x1a81f10f458
0x1a81f10f458: i64 = build_pair 0x1a81f10f590, 0x1a81f10f250
0x1a81f10f590: i32,ch = CopyFromReg 0x1a81f37dfd8, Register:i32 %vreg16
0x1a81f10fce0: i32 = Register %vreg16
0x1a81f10f250: i32,ch = CopyFromReg 0x1a81f10f590:1, Register:i32 %vreg17
0x1a81f10f5f8: i32 = Register %vreg17
In function: _d_array_init_double

Any advice?

Thanks

@lyrachord
Copy link

lyrachord commented Nov 12, 2017

see #2406

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants