Julia: armv7l: ptrtoint not supported for non-integral pointers

Created on 28 May 2020  路  13Comments  路  Source: JuliaLang/julia

Armv7l bootstrap is failing right at the end during the link step with this:

ptrtoint not supported for non-integral pointers
inttoptr not supported for non-integral pointers
ptrtoint not supported for non-integral pointers
inttoptr not supported for non-integral pointers
in function julia__unsafe_copytoNOT._53532
LLVM ERROR: Broken function found, compilation aborted!

Exemplary build: https://build.julialang.org/#/builders/57/builds/231

32-bit arm bug upstream

Most helpful comment

Bugpoint reduced IR:

target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64-ni:10:11:12:13"
target triple = "armv7l-unknown-linux-gnueabihf"

define dso_local void @julia_roundup_19730() {
top:
  br label %L37

L37:                                              ; preds = %L49, %top
  %value_phi7 = phi i32 [ %3, %L49 ], [ 0, %top ]
  br i1 undef, label %L49, label %L47

L47:                                              ; preds = %L37
  unreachable

L49:                                              ; preds = %L37
  %0 = add i32 %value_phi7, -2
  %1 = getelementptr inbounds i8, i8 addrspace(13)* null, i32 %0
  %2 = load i8, i8 addrspace(13)* %1, align 1
  %3 = add i32 %value_phi7, -1
  br label %L37
}

Reported as https://bugs.llvm.org/show_bug.cgi?id=46757

All 13 comments

Looks very similar to this LLVM issue https://github.com/JuliaLang/julia/issues/31156#issuecomment-586449043

ptrtoint not supported for non-integral pointers
inttoptr not supported for non-integral pointers
ptrtoint not supported for non-integral pointers
inttoptr not supported for non-integral pointers
in function julia_copyto!_18518
LLVM ERROR: Broken function found, compilation aborted!

which was patched by @Keno and ultimately merged in https://github.com/JuliaLang/julia/pull/35313

Seems like the patch didn't fix julia__unsafe_copytoNOT.?

@terasakisatoshi has been able to build julia v1.4.2 for armv7l: https://discourse.julialang.org/t/have-a-try-julia-v1-4-2-for-arm32bit/40284

Inttoptr issues like this indicate an un-soundness in some LLVM pass. They need to be fixed one by one.

Will this hurt us on those new arm macs? I imagine they are aarch64, and so this may not be an issue.

@Keno Is this something we can communicate to our various ARM contacts?

Correct; armv7l is separate from aarch64 (otherwise known as armv8)

It's not an ARM issue, it's an LLVM issue.

Right - but is it only an LLVM issue on arm - and hence the ARM llvm team should look at it, or is it a general LLVM issue that needs to be fixed by the LLVM community?

It's specific to how we are using LLVM. It's unlikely the ARM LLVM team would care enough to understand how we're using LLVM.

Bugpoint reduced repro:

; ModuleID = 'bugpoint-reduced-simplified.bc'
source_filename = "text"
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64-ni:10:11:12:13"
target triple = "armv7l-unknown-linux-gnueabihf"

define void @julia_show_tuple_as_call_23179() local_unnamed_addr {
top:
  br i1 undef, label %L16.lr.ph, label %L51

L16.lr.ph:                                        ; preds = %top
  unreachable

L51:                                              ; preds = %top
  %0 = addrspacecast [2 x {} addrspace(10)*]* undef to [2 x {} addrspace(10)*] addrspace(11)*
  call fastcc void @julia_show_signature_function_32381([2 x {} addrspace(10)*] addrspace(11)* nocapture readonly %0)
  ret void
}

define dso_local fastcc void @julia_show_signature_function_32381([2 x {} addrspace(10)*] addrspace(11)* nocapture nonnull readonly align 4 dereferenceable(8) %0) unnamed_addr {
top:
  %1 = bitcast [2 x {} addrspace(10)*] addrspace(11)* %0 to i64 addrspace(11)*
  ret void
}

!llvm.module.flags = !{!0}

!0 = !{i32 1, !"Debug Info Version", i32 3}

reproducible with opt bugpoint-reduced-simplified.ll -inline.

Not 100% sure if this is the original one but this is what I got by running opt -O2 on the dumpped unoptimized IR. I had to strip other unrelated functions first before feeding it to bugpoint since it otherwise go OOM....

That's actually not related and is fixed on LLVM master already. The actual one seems to be caused by Loop Strength Reduction.

What I currently have is.

*** IR Dump Before Loop Strength Reduction ***
; Preheader:
L37.preheader:                                    ; preds = %idxend4
  %110 = bitcast {} addrspace(10)* %1 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)*, !dbg !8332
  %111 = addrspacecast { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)* %110 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)*, !dbg !8332
  %112 = getelementptr inbounds { i8 addrspace(13)*, i32, i16, i16, i32 }, { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)* %111, i32 0, i32 1, !dbg !8332
  %113 = load i32, i32 addrspace(11)* %112, align 4, !dbg !8332, !tbaa !8259
  %114 = bitcast {} addrspace(10)* %1 to i8 addrspace(13)* addrspace(10)*, !dbg !8332
  %115 = addrspacecast i8 addrspace(13)* addrspace(10)* %114 to i8 addrspace(13)* addrspace(11)*, !dbg !8332
  %116 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %115, align 4, !dbg !8332
  %117 = bitcast {} addrspace(10)* %1 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)*, !dbg !8333
  %118 = addrspacecast { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)* %117 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)*, !dbg !8333
  %119 = getelementptr inbounds { i8 addrspace(13)*, i32, i16, i16, i32 }, { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)* %118, i32 0, i32 1, !dbg !8333
  %120 = load i32, i32 addrspace(11)* %119, align 4, !dbg !8333
  %121 = bitcast {} addrspace(10)* %1 to i8 addrspace(13)* addrspace(10)*, !dbg !8333
  %122 = addrspacecast i8 addrspace(13)* addrspace(10)* %121 to i8 addrspace(13)* addrspace(11)*, !dbg !8333
  %123 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %122, align 4, !dbg !8333
  %124 = bitcast {} addrspace(10)* %1 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)*, !dbg !8334
  %125 = addrspacecast { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)* %124 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)*, !dbg !8334
  %126 = getelementptr inbounds { i8 addrspace(13)*, i32, i16, i16, i32 }, { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)* %125, i32 0, i32 1, !dbg !8334
  %127 = load i32, i32 addrspace(11)* %126, align 4, !dbg !8334
  %128 = bitcast {} addrspace(10)* %1 to i8 addrspace(13)* addrspace(10)*, !dbg !8334
  %129 = addrspacecast i8 addrspace(13)* addrspace(10)* %128 to i8 addrspace(13)* addrspace(11)*, !dbg !8334
  %130 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %129, align 4, !dbg !8334
  %131 = bitcast {} addrspace(10)* %1 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)*, !dbg !8335
  %132 = addrspacecast { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)* %131 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)*, !dbg !8335
  %133 = getelementptr inbounds { i8 addrspace(13)*, i32, i16, i16, i32 }, { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)* %132, i32 0, i32 1, !dbg !8335
  %134 = load i32, i32 addrspace(11)* %133, align 4, !dbg !8335
  %135 = bitcast {} addrspace(10)* %1 to i8 addrspace(13)* addrspace(10)*, !dbg !8335
  %136 = addrspacecast i8 addrspace(13)* addrspace(10)* %135 to i8 addrspace(13)* addrspace(11)*, !dbg !8335
  %137 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %136, align 4, !dbg !8335
  br label %L37, !dbg !8280

; Loop:
L37:                                              ; preds = %L37.preheader, %idxend16
  %value_phi7 = phi i32 [ %162, %idxend16 ], [ %107, %L37.preheader ]
  %44 = add i32 %value_phi7, -1, !dbg !8280
  %45 = icmp ult i32 %44, %113, !dbg !8280
  br i1 %45, label %idxend10, label %oob9, !dbg !8280

idxend10:                                         ; preds = %L37
  %140 = getelementptr inbounds i8, i8 addrspace(13)* %116, i32 %44, !dbg !8280
  %141 = load i8, i8 addrspace(13)* %140, align 1, !dbg !8280, !tbaa !8300
  %142 = icmp eq i8 %141, 58, !dbg !8336
  br i1 %142, label %L49, label %L47, !dbg !8281

L49:                                              ; preds = %idxend10
  %50 = add i32 %value_phi7, -1, !dbg !8282
  %51 = icmp ult i32 %50, %120, !dbg !8282
  br i1 %51, label %idxend12, label %oob11, !dbg !8282

idxend12:                                         ; preds = %L49
  %145 = getelementptr inbounds i8, i8 addrspace(13)* %123, i32 %50, !dbg !8282
  store i8 48, i8 addrspace(13)* %145, align 1, !dbg !8282, !tbaa !8300
  %146 = add i32 %value_phi7, -2, !dbg !8342
  %147 = icmp ult i32 %146, %127, !dbg !8342
  br i1 %147, label %idxend14, label %oob13, !dbg !8342

idxend14:                                         ; preds = %idxend12
  %151 = getelementptr inbounds i8, i8 addrspace(13)* %130, i32 %146, !dbg !8342
  %152 = load i8, i8 addrspace(13)* %151, align 1, !dbg !8342, !tbaa !8300
  %153 = zext i8 %152 to i32, !dbg !8344
  %154 = add nuw nsw i32 %153, 1, !dbg !8284
  %155 = trunc i32 %154 to i8, !dbg !8349
  %156 = icmp eq i8 %152, -1, !dbg !8288
  br i1 %156, label %L59, label %L64, !dbg !8288

L64:                                              ; preds = %idxend14
  %64 = add i32 %value_phi7, -2, !dbg !8292
  %65 = icmp ult i32 %64, %134, !dbg !8292
  br i1 %65, label %idxend16, label %oob15, !dbg !8292

idxend16:                                         ; preds = %L64
  %160 = getelementptr inbounds i8, i8 addrspace(13)* %137, i32 %64, !dbg !8292
  store i8 %155, i8 addrspace(13)* %160, align 1, !dbg !8292, !tbaa !8300
  %161 = icmp eq i32 %value_phi7, %108, !dbg !8350
  %162 = add i32 %value_phi7, -1, !dbg !8351
  br i1 %161, label %L77.loopexit, label %L37, !dbg !8287

; Exit blocks
oob9:                                             ; preds = %L37
  %value_phi7.lcssa = phi i32 [ %value_phi7, %L37 ]
  %138 = alloca i32, align 4, !dbg !8280
  store i32 %value_phi7.lcssa, i32* %138, align 4, !dbg !8280
  %139 = addrspacecast {} addrspace(10)* %1 to {} addrspace(12)*, !dbg !8280
  call void @jl_bounds_error_ints({} addrspace(12)* %139, i32* nonnull %138, i32 1), !dbg !8280
  unreachable, !dbg !8280

L47:                                              ; preds = %idxend10
  %.sroa.027.0..sroa_idx = getelementptr inbounds [2 x i32], [2 x i32]* %0, i32 0, i32 0, !dbg !8281
  store i32 %2, i32* %.sroa.027.0..sroa_idx, align 4, !dbg !8281
  %.sroa.228.0..sroa_idx29 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i32 0, i32 1, !dbg !8281
  store i32 %3, i32* %.sroa.228.0..sroa_idx29, align 4, !dbg !8281
  %46 = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 1
  %47 = load {} addrspace(10)*, {} addrspace(10)** %46, align 4, !tbaa !8249
  %48 = getelementptr {}**, {}*** %ptls, i32 0
  %49 = bitcast {}*** %48 to {} addrspace(10)**
  store {} addrspace(10)* %47, {} addrspace(10)** %49, align 4, !tbaa !8249
  ret void, !dbg !8281

oob11:                                            ; preds = %L49
  %value_phi7.lcssa39 = phi i32 [ %value_phi7, %L49 ]
  %143 = alloca i32, align 4, !dbg !8282
  store i32 %value_phi7.lcssa39, i32* %143, align 4, !dbg !8282
  %144 = addrspacecast {} addrspace(10)* %1 to {} addrspace(12)*, !dbg !8282
  call void @jl_bounds_error_ints({} addrspace(12)* %144, i32* nonnull %143, i32 1), !dbg !8282
  unreachable, !dbg !8282

oob13:                                            ; preds = %idxend12
  %value_phi7.lcssa51 = phi i32 [ %value_phi7, %idxend12 ]
  %148 = add i32 %value_phi7.lcssa51, -1, !dbg !8343
  %149 = alloca i32, align 4, !dbg !8342
  store i32 %148, i32* %149, align 4, !dbg !8342
  %150 = addrspacecast {} addrspace(10)* %1 to {} addrspace(12)*, !dbg !8342
  call void @jl_bounds_error_ints({} addrspace(12)* %150, i32* nonnull %149, i32 1), !dbg !8342
  unreachable, !dbg !8342

L59:                                              ; preds = %idxend14
  %.lcssa47 = phi i32 [ %154, %idxend14 ], !dbg !8284
  %52 = load {}*, {}** @jl_globalYY.16, align 4, !dbg !8288, !tbaa !8276, !nonnull !4
  %53 = addrspacecast {}* %52 to {} addrspace(10)*, !dbg !8288
  %54 = load {}*, {}** @jl_symYY.trunc61, align 4, !dbg !8288, !tbaa !8276, !nonnull !4
  %55 = addrspacecast {}* %54 to {} addrspace(10)*, !dbg !8288
  %56 = load {}*, {}** @SUM.CoreDOT.UInt8254, align 4, !dbg !8288, !tbaa !8276, !nonnull !4, !dereferenceable !8278, !align !8279
  %57 = addrspacecast {}* %56 to {} addrspace(10)*, !dbg !8288
  %58 = call {} addrspace(10)* @jl_box_int32(i32 signext %.lcssa47), !dbg !8288
  %59 = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2
  store {} addrspace(10)* %58, {} addrspace(10)** %59
  %60 = getelementptr {} addrspace(10)*, {} addrspace(10)** %4, i32 0, !dbg !8288
  store {} addrspace(10)* %55, {} addrspace(10)** %60, align 4, !dbg !8288
  %61 = getelementptr {} addrspace(10)*, {} addrspace(10)** %4, i32 1, !dbg !8288
  store {} addrspace(10)* %57, {} addrspace(10)** %61, align 4, !dbg !8288
  %62 = getelementptr {} addrspace(10)*, {} addrspace(10)** %4, i32 2, !dbg !8288
  store {} addrspace(10)* %58, {} addrspace(10)** %62, align 4, !dbg !8288
  %63 = call nonnull {} addrspace(10)* @jl_apply_generic({} addrspace(10)* %53, {} addrspace(10)** %4, i32 3), !dbg !8288
  call void @llvm.trap(), !dbg !8288
  unreachable, !dbg !8288

oob15:                                            ; preds = %L64
  %value_phi7.lcssa50 = phi i32 [ %value_phi7, %L64 ]
  %157 = add i32 %value_phi7.lcssa50, -1, !dbg !8343
  %158 = alloca i32, align 4, !dbg !8292
  store i32 %157, i32* %158, align 4, !dbg !8292
  %159 = addrspacecast {} addrspace(10)* %1 to {} addrspace(12)*, !dbg !8292
  call void @jl_bounds_error_ints({} addrspace(12)* %159, i32* nonnull %158, i32 1), !dbg !8292
  unreachable, !dbg !8292

L77.loopexit:                                     ; preds = %idxend16
  br label %L77, !dbg !8293
*** IR Dump After Loop Strength Reduction ***
; Preheader:
L37.preheader:                                    ; preds = %idxend4
  %112 = bitcast {} addrspace(10)* %1 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)*, !dbg !8332
  %113 = addrspacecast { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)* %112 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)*, !dbg !8332
  %114 = getelementptr inbounds { i8 addrspace(13)*, i32, i16, i16, i32 }, { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)* %113, i32 0, i32 1, !dbg !8332
  %115 = load i32, i32 addrspace(11)* %114, align 4, !dbg !8332, !tbaa !8259
  %116 = bitcast {} addrspace(10)* %1 to i8 addrspace(13)* addrspace(10)*, !dbg !8332
  %117 = addrspacecast i8 addrspace(13)* addrspace(10)* %116 to i8 addrspace(13)* addrspace(11)*, !dbg !8332
  %118 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %117, align 4, !dbg !8332
  %119 = bitcast {} addrspace(10)* %1 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)*, !dbg !8333
  %120 = addrspacecast { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)* %119 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)*, !dbg !8333
  %121 = getelementptr inbounds { i8 addrspace(13)*, i32, i16, i16, i32 }, { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)* %120, i32 0, i32 1, !dbg !8333
  %122 = load i32, i32 addrspace(11)* %121, align 4, !dbg !8333
  %123 = bitcast {} addrspace(10)* %1 to i8 addrspace(13)* addrspace(10)*, !dbg !8333
  %124 = addrspacecast i8 addrspace(13)* addrspace(10)* %123 to i8 addrspace(13)* addrspace(11)*, !dbg !8333
  %125 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %124, align 4, !dbg !8333
  %126 = bitcast {} addrspace(10)* %1 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)*, !dbg !8334
  %127 = addrspacecast { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)* %126 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)*, !dbg !8334
  %128 = getelementptr inbounds { i8 addrspace(13)*, i32, i16, i16, i32 }, { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)* %127, i32 0, i32 1, !dbg !8334
  %129 = load i32, i32 addrspace(11)* %128, align 4, !dbg !8334
  %130 = bitcast {} addrspace(10)* %1 to i8 addrspace(13)* addrspace(10)*, !dbg !8334
  %131 = addrspacecast i8 addrspace(13)* addrspace(10)* %130 to i8 addrspace(13)* addrspace(11)*, !dbg !8334
  %132 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %131, align 4, !dbg !8334
  %133 = ptrtoint i8 addrspace(13)* %132 to i32
  %134 = bitcast {} addrspace(10)* %1 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)*, !dbg !8335
  %135 = addrspacecast { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(10)* %134 to { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)*, !dbg !8335
  %136 = getelementptr inbounds { i8 addrspace(13)*, i32, i16, i16, i32 }, { i8 addrspace(13)*, i32, i16, i16, i32 } addrspace(11)* %135, i32 0, i32 1, !dbg !8335
  %137 = load i32, i32 addrspace(11)* %136, align 4, !dbg !8335
  %138 = bitcast {} addrspace(10)* %1 to i8 addrspace(13)* addrspace(10)*, !dbg !8335
  %139 = addrspacecast i8 addrspace(13)* addrspace(10)* %138 to i8 addrspace(13)* addrspace(11)*, !dbg !8335
  %140 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %139, align 4, !dbg !8335
  %141 = ptrtoint i8 addrspace(13)* %140 to i32
  %142 = add i32 %2, -2, !dbg !8292
  %143 = add i32 %2, -2, !dbg !8336
  %144 = sub i32 0, %141, !dbg !8280
  %145 = inttoptr i32 %144 to i8 addrspace(13)*
  %146 = sub i32 0, %133, !dbg !8280
  %147 = inttoptr i32 %146 to i8 addrspace(13)*
  %148 = add i32 %2, -2, !dbg !8282
  %149 = add i32 %2, -2, !dbg !8280
  %scevgep62 = getelementptr i8, i8 addrspace(13)* %125, i32 -2, !dbg !8280
  %scevgep66 = getelementptr i8, i8 addrspace(13)* %118, i32 -2, !dbg !8280
  %150 = sub i32 0, %110, !dbg !8280
  %151 = add i32 %150, %2, !dbg !8337
  br label %L37, !dbg !8280

; Loop:
L37:                                              ; preds = %L37.preheader, %idxend16
  %lsr.iv67 = phi i8 addrspace(13)* [ %scevgep66, %L37.preheader ], [ %scevgep68, %idxend16 ]
  %lsr.iv63 = phi i8 addrspace(13)* [ %scevgep62, %L37.preheader ], [ %scevgep64, %idxend16 ]
  %lsr.iv58 = phi i8 addrspace(13)* [ %147, %L37.preheader ], [ %scevgep59, %idxend16 ]
  %lsr.iv55 = phi i8 addrspace(13)* [ %145, %L37.preheader ], [ %scevgep, %idxend16 ]
  %lsr.iv53 = phi i32 [ 0, %L37.preheader ], [ %lsr.iv.next54, %idxend16 ]
  %lsr.iv = phi i32 [ -1, %L37.preheader ], [ %lsr.iv.next, %idxend16 ]
  %lsr.iv5860 = ptrtoint i8 addrspace(13)* %lsr.iv58 to i32
  %lsr.iv5556 = ptrtoint i8 addrspace(13)* %lsr.iv55 to i32
  %44 = add i32 %2, %lsr.iv, !dbg !8280
  %45 = add i32 %149, %lsr.iv53, !dbg !8280
  %46 = icmp ult i32 %45, %115, !dbg !8280
  br i1 %46, label %idxend10, label %oob9, !dbg !8280

idxend10:                                         ; preds = %L37
  %scevgep69 = getelementptr i8, i8 addrspace(13)* %lsr.iv67, i32 %2, !dbg !8280
  %154 = load i8, i8 addrspace(13)* %scevgep69, align 1, !dbg !8280, !tbaa !8300
  %155 = icmp eq i8 %154, 58, !dbg !8339
  br i1 %155, label %L49, label %L47, !dbg !8281

L49:                                              ; preds = %idxend10
  %51 = add i32 %148, %lsr.iv53, !dbg !8282
  %52 = icmp ult i32 %51, %122, !dbg !8282
  br i1 %52, label %idxend12, label %oob11, !dbg !8282

idxend12:                                         ; preds = %L49
  %scevgep65 = getelementptr i8, i8 addrspace(13)* %lsr.iv63, i32 %2, !dbg !8282
  store i8 48, i8 addrspace(13)* %scevgep65, align 1, !dbg !8282, !tbaa !8300
  %158 = add i32 %143, %lsr.iv53, !dbg !8336
  %159 = add i32 %158, -1, !dbg !8336
  %160 = icmp ult i32 %159, %129, !dbg !8336
  br i1 %160, label %idxend14, label %oob13, !dbg !8336

idxend14:                                         ; preds = %idxend12
  %164 = sub i32 0, %lsr.iv5860, !dbg !8336
  %165 = add i32 %164, %143, !dbg !8336
  %166 = inttoptr i32 %165 to i8 addrspace(13)*
  %scevgep61 = getelementptr i8, i8 addrspace(13)* %166, i32 -1, !dbg !8336
  %167 = load i8, i8 addrspace(13)* %scevgep61, align 1, !dbg !8336, !tbaa !8300
  %168 = zext i8 %167 to i32, !dbg !8346
  %169 = add nuw nsw i32 %168, 1, !dbg !8284
  %170 = trunc i32 %169 to i8, !dbg !8351
  %171 = icmp eq i8 %167, -1, !dbg !8288
  br i1 %171, label %L59, label %L64, !dbg !8288

L64:                                              ; preds = %idxend14
  %65 = add i32 %142, %lsr.iv53, !dbg !8292
  %66 = add i32 %65, -1, !dbg !8292
  %67 = icmp ult i32 %66, %137, !dbg !8292
  br i1 %67, label %idxend16, label %oob15, !dbg !8292

idxend16:                                         ; preds = %L64
  %175 = sub i32 0, %lsr.iv5556, !dbg !8292
  %176 = add i32 %175, %143, !dbg !8292
  %177 = inttoptr i32 %176 to i8 addrspace(13)*
  %scevgep57 = getelementptr i8, i8 addrspace(13)* %177, i32 -1, !dbg !8292
  store i8 %170, i8 addrspace(13)* %scevgep57, align 1, !dbg !8292, !tbaa !8300
  %lsr.iv.next = add i32 %lsr.iv, -1, !dbg !8337
  %lsr.iv.next54 = add i32 %lsr.iv53, -1, !dbg !8337
  %scevgep = getelementptr i8, i8 addrspace(13)* %lsr.iv55, i32 1, !dbg !8337
  %scevgep59 = getelementptr i8, i8 addrspace(13)* %lsr.iv58, i32 1, !dbg !8337
  %scevgep64 = getelementptr i8, i8 addrspace(13)* %lsr.iv63, i32 -1, !dbg !8337
  %scevgep68 = getelementptr i8, i8 addrspace(13)* %lsr.iv67, i32 -1, !dbg !8337
  %178 = add i32 %151, %lsr.iv.next54, !dbg !8337
  %179 = icmp eq i32 %178, 0, !dbg !8337
  br i1 %179, label %L77.loopexit, label %L37, !dbg !8287

; Exit blocks
oob9:                                             ; preds = %L37
  %value_phi7.lcssa = phi i32 [ %44, %L37 ]
  %152 = alloca i32, align 4, !dbg !8280
  store i32 %value_phi7.lcssa, i32* %152, align 4, !dbg !8280
  %153 = addrspacecast {} addrspace(10)* %1 to {} addrspace(12)*, !dbg !8280
  call void @jl_bounds_error_ints({} addrspace(12)* %153, i32* nonnull %152, i32 1), !dbg !8280
  unreachable, !dbg !8280

L47:                                              ; preds = %idxend10
  %.sroa.027.0..sroa_idx = getelementptr inbounds [2 x i32], [2 x i32]* %0, i32 0, i32 0, !dbg !8281
  store i32 %2, i32* %.sroa.027.0..sroa_idx, align 4, !dbg !8281
  %.sroa.228.0..sroa_idx29 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i32 0, i32 1, !dbg !8281
  store i32 %3, i32* %.sroa.228.0..sroa_idx29, align 4, !dbg !8281
  %47 = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 1
  %48 = load {} addrspace(10)*, {} addrspace(10)** %47, align 4, !tbaa !8249
  %49 = getelementptr {}**, {}*** %ptls, i32 0
  %50 = bitcast {}*** %49 to {} addrspace(10)**
  store {} addrspace(10)* %48, {} addrspace(10)** %50, align 4, !tbaa !8249
  ret void, !dbg !8281

oob11:                                            ; preds = %L49
  %value_phi7.lcssa39 = phi i32 [ %44, %L49 ]
  %156 = alloca i32, align 4, !dbg !8282
  store i32 %value_phi7.lcssa39, i32* %156, align 4, !dbg !8282
  %157 = addrspacecast {} addrspace(10)* %1 to {} addrspace(12)*, !dbg !8282
  call void @jl_bounds_error_ints({} addrspace(12)* %157, i32* nonnull %156, i32 1), !dbg !8282
  unreachable, !dbg !8282

oob13:                                            ; preds = %idxend12
  %value_phi7.lcssa51 = phi i32 [ %44, %idxend12 ]
  %161 = add i32 %value_phi7.lcssa51, -1, !dbg !8345
  %162 = alloca i32, align 4, !dbg !8336
  store i32 %161, i32* %162, align 4, !dbg !8336
  %163 = addrspacecast {} addrspace(10)* %1 to {} addrspace(12)*, !dbg !8336
  call void @jl_bounds_error_ints({} addrspace(12)* %163, i32* nonnull %162, i32 1), !dbg !8336
  unreachable, !dbg !8336

L59:                                              ; preds = %idxend14
  %.lcssa47 = phi i32 [ %169, %idxend14 ], !dbg !8284
  %53 = load {}*, {}** @jl_globalYY.16, align 4, !dbg !8288, !tbaa !8276, !nonnull !4
  %54 = addrspacecast {}* %53 to {} addrspace(10)*, !dbg !8288
  %55 = load {}*, {}** @jl_symYY.trunc61, align 4, !dbg !8288, !tbaa !8276, !nonnull !4
  %56 = addrspacecast {}* %55 to {} addrspace(10)*, !dbg !8288
  %57 = load {}*, {}** @SUM.CoreDOT.UInt8254, align 4, !dbg !8288, !tbaa !8276, !nonnull !4, !dereferenceable !8278, !align !8279
  %58 = addrspacecast {}* %57 to {} addrspace(10)*, !dbg !8288
  %59 = call {} addrspace(10)* @jl_box_int32(i32 signext %.lcssa47), !dbg !8288
  %60 = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2
  store {} addrspace(10)* %59, {} addrspace(10)** %60
  %61 = getelementptr {} addrspace(10)*, {} addrspace(10)** %4, i32 0, !dbg !8288
  store {} addrspace(10)* %56, {} addrspace(10)** %61, align 4, !dbg !8288
  %62 = getelementptr {} addrspace(10)*, {} addrspace(10)** %4, i32 1, !dbg !8288
  store {} addrspace(10)* %58, {} addrspace(10)** %62, align 4, !dbg !8288
  %63 = getelementptr {} addrspace(10)*, {} addrspace(10)** %4, i32 2, !dbg !8288
  store {} addrspace(10)* %59, {} addrspace(10)** %63, align 4, !dbg !8288
  %64 = call nonnull {} addrspace(10)* @jl_apply_generic({} addrspace(10)* %54, {} addrspace(10)** %4, i32 3), !dbg !8288
  call void @llvm.trap(), !dbg !8288
  unreachable, !dbg !8288

oob15:                                            ; preds = %L64
  %value_phi7.lcssa50 = phi i32 [ %44, %L64 ]
  %172 = add i32 %value_phi7.lcssa50, -1, !dbg !8345
  %173 = alloca i32, align 4, !dbg !8292
  store i32 %172, i32* %173, align 4, !dbg !8292
  %174 = addrspacecast {} addrspace(10)* %1 to {} addrspace(12)*, !dbg !8292
  call void @jl_bounds_error_ints({} addrspace(12)* %174, i32* nonnull %173, i32 1), !dbg !8292
  unreachable, !dbg !8292

L77.loopexit:                                     ; preds = %idxend16
  br label %L77, !dbg !8293

Bugpoint reduced IR:

target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64-ni:10:11:12:13"
target triple = "armv7l-unknown-linux-gnueabihf"

define dso_local void @julia_roundup_19730() {
top:
  br label %L37

L37:                                              ; preds = %L49, %top
  %value_phi7 = phi i32 [ %3, %L49 ], [ 0, %top ]
  br i1 undef, label %L49, label %L47

L47:                                              ; preds = %L37
  unreachable

L49:                                              ; preds = %L37
  %0 = add i32 %value_phi7, -2
  %1 = getelementptr inbounds i8, i8 addrspace(13)* null, i32 %0
  %2 = load i8, i8 addrspace(13)* %1, align 1
  %3 = add i32 %value_phi7, -1
  br label %L37
}

Reported as https://bugs.llvm.org/show_bug.cgi?id=46757

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dpsanders picture dpsanders  路  3Comments

sbromberger picture sbromberger  路  3Comments

omus picture omus  路  3Comments

tkoolen picture tkoolen  路  3Comments

yurivish picture yurivish  路  3Comments