[llvm-dev] Simple program fails to compile depending on target os

Moritz Angermann via llvm-dev llvm-dev at lists.llvm.org
Sun Jul 3 18:26:19 PDT 2016


Hi *,

in the process of improving the ios experience with ghc, I ran into the following issue:
the produced llvm code[1] compiles for `armv7-apple-darwin`, unless optimization level is 0,
however it fails to compile at all for `armv7-apple-ios`.

I was able to reduce the produced code, while retaining the compilation issue on `armv7-apple-ios`
to the following sample case:

————————————————————— 8< —————————————————————
define ghccc void @"f$def"(i32* noalias nocapture %Base_Arg,
                           i32* noalias nocapture %Sp_Arg,
                           i32* noalias nocapture %Hp_Arg,
                           i32 %R1_Arg, i32 %R2_Arg, i32 %R3_Arg, i32 %R4_Arg,
                           i32 %SpLim_Arg,
                           float %F1_Arg, float %F2_Arg, float %F3_Arg, float %F4_Arg,
                           double %D1_Arg, double %D2_Arg) #0
                           align 4 prefix <{ i32, i32 }> <{ i32 1, i32 37 }> {

  %someElem = getelementptr inbounds i32, i32* %Base_Arg, i32 203
  
  %someValue = load i32, i32* %someElem
  %somePtr = inttoptr i32 %someValue to void (i32*, i32*, i32*, i32, i32, i32, i32, i32, float, float, float, float, double, double)*
  tail call ghccc void %somePtr(i32* %Base_Arg,
                                i32* %Sp_Arg,
                                i32* %Hp_Arg,
                                i32 %R1_Arg, i32 %R2_Arg, i32 %R3_Arg, i32 %R4_Arg,
                                i32 %SpLim_Arg,
                                float %F1_Arg, float %F2_Arg, float %F3_Arg, float %F4_Arg,
                                double %D1_Arg, double %D2_Arg) #0
  ret void
}

attributes #0 = { nounwind }
————————————————————— 8< —————————————————————

$ llc sample.ll -mtriple=armv7-apple-darwin # succeeds for 3.7 and 3.8
$ llc sample.ll -mtriple=armv7-apple-ios    # fails    for 3.7 and 3.8


Any hints as to why this code only compiles for darwin and not for ios, would be greatly appreciated.

Cheers,
 Moritz

[1]: http://lpaste.net/1177160917046001664


More information about the llvm-dev mailing list