-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]vectorizers
Description
This IR produces the error
; ModuleID = 'getindex'
source_filename = "getindex"
target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32-ni:10:11:12:13"
target triple = "i686-w64-windows-gnu-elf"
; Function Attrs: alignstack(16)
define swiftcc nonnull ptr addrspace(10) @julia_getindex_4210(ptr nonnull swiftself %pgcstack_arg, double %0, double %1) #0 !dbg !7 {
top:
%vals = alloca [2 x i64], align 8
%pgcstack = call ptr @julia.get_pgcstack()
store double %0, ptr %vals, align 8, !tbaa !11, !alias.scope !15, !noalias !18
%.sroa.2.0.vals.sroa_idx = getelementptr inbounds i8, ptr %vals, i32 8
store double %1, ptr %.sroa.2.0.vals.sroa_idx, align 8, !tbaa !11, !alias.scope !15, !noalias !18
%ptls_field = getelementptr inbounds i8, ptr %pgcstack, i32 8
%ptls_load = load ptr, ptr %ptls_field, align 4, !tbaa !23
%2 = getelementptr inbounds i8, ptr %ptls_load, i32 16
%safepoint = load ptr, ptr %2, align 4, !tbaa !25, !invariant.load !10
fence syncscope("singlethread") seq_cst
call void @julia.safepoint(ptr %safepoint), !dbg !27
fence syncscope("singlethread") seq_cst
%3 = call ptr addrspace(10) @jl_alloc_genericmemory(ptr addrspace(10) addrspacecast (ptr inttoptr (i32 117259808 to ptr) to ptr addrspace(10)), i32 2), !dbg !28
%4 = addrspacecast ptr addrspace(10) %3 to ptr addrspace(11), !dbg !34
%5 = getelementptr inbounds nuw i8, ptr addrspace(11) %4, i32 4, !dbg !34
%6 = load ptr, ptr addrspace(11) %5, align 4, !dbg !34, !tbaa !25, !invariant.load !10, !alias.scope !37, !noalias !38, !nonnull !10
%current_task2 = getelementptr inbounds i8, ptr %pgcstack, i32 -84, !dbg !36
%7 = call noalias nonnull align 4 dereferenceable(12) ptr addrspace(10) @julia.gc_alloc_obj(ptr nonnull %current_task2, i32 12, ptr addrspace(10) addrspacecast (ptr inttoptr (i32 117258272 to ptr) to ptr addrspace(10))) #7, !dbg !36
%8 = addrspacecast ptr addrspace(10) %7 to ptr addrspace(11), !dbg !36
%9 = getelementptr inbounds i8, ptr addrspace(11) %8, i32 4, !dbg !36
store ptr %6, ptr addrspace(11) %8, align 4, !dbg !36, !tbaa !39, !alias.scope !42, !noalias !43
store ptr addrspace(10) %3, ptr addrspace(11) %9, align 4, !dbg !36, !tbaa !39, !alias.scope !42, !noalias !43
%10 = getelementptr inbounds i8, ptr addrspace(11) %8, i32 8, !dbg !36
store i32 2, ptr addrspace(11) %10, align 4, !dbg !36, !tbaa !44, !alias.scope !45, !noalias !46
%invariant.gep = getelementptr i8, ptr %vals, i32 -8, !dbg !36
%11 = call ptr addrspace(13) @julia.gc_loaded(ptr addrspace(10) %3, ptr %6), !dbg !47
%invariant.gep9 = getelementptr i8, ptr addrspace(13) %11, i32 -2, !dbg !36
br label %L5, !dbg !36
L5: ; preds = %L5, %top
%value_phi = phi i32 [ 1, %top ], [ %15, %L5 ]
%gep = getelementptr double, ptr %invariant.gep, i32 %value_phi, !dbg !48
%12 = load double, ptr %gep, align 8, !dbg !52, !tbaa !11, !alias.scope !15, !noalias !18
%13 = fptrunc double %12 to half, !dbg !52
%14 = shl nuw i32 %value_phi, 1, !dbg !60
%gep10 = getelementptr i8, ptr addrspace(13) %invariant.gep9, i32 %14, !dbg !60
store half %13, ptr addrspace(13) %gep10, align 2, !dbg !60, !tbaa !61, !alias.scope !64, !noalias !65
%.not.not = icmp eq i32 %value_phi, 2, !dbg !66
%15 = add nuw nsw i32 %value_phi, 1, !dbg !69
br i1 %.not.not, label %L23, label %L5, !dbg !72
L23: ; preds = %L5
ret ptr addrspace(10) %7, !dbg !73
}
; Function Attrs: noinline optnone alignstack(16)
define nonnull ptr addrspace(10) @jfptr_getindex_4211(ptr addrspace(10) %"function::Core.Function", ptr noalias nocapture noundef readonly %"args::Any[]", i32 %"nargs::UInt32") #1 {
top:
%pgcstack = call ptr @julia.get_pgcstack()
%0 = getelementptr inbounds i8, ptr %"args::Any[]", i32 0
%1 = load ptr addrspace(10), ptr %0, align 4, !tbaa !25, !invariant.load !10, !alias.scope !37, !noalias !38, !nonnull !10
%2 = getelementptr inbounds i8, ptr %"args::Any[]", i32 4
%3 = load ptr addrspace(10), ptr %2, align 4, !tbaa !25, !invariant.load !10, !alias.scope !37, !noalias !38, !nonnull !10, !dereferenceable !74, !align !74
%4 = getelementptr inbounds i8, ptr %"args::Any[]", i32 8
%5 = load ptr addrspace(10), ptr %4, align 4, !tbaa !25, !invariant.load !10, !alias.scope !37, !noalias !38, !nonnull !10, !dereferenceable !74, !align !74
%6 = load double, ptr addrspace(10) %3, align 8, !tbaa !75, !alias.scope !64, !noalias !65
%7 = load double, ptr addrspace(10) %5, align 8, !tbaa !75, !alias.scope !64, !noalias !65
%8 = call swiftcc nonnull ptr addrspace(10) @julia_getindex_4210(ptr nonnull swiftself %pgcstack, double %6, double %7)
ret ptr addrspace(10) %8
}
declare ptr @julia.get_pgcstack()
; Function Attrs: memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @julia.safepoint(ptr) #2
; Function Attrs: willreturn memory(argmem: read, inaccessiblemem: readwrite)
declare nonnull align 16 dereferenceable(16) ptr addrspace(10) @jl_alloc_genericmemory(ptr addrspace(10), i32) #3
; Function Attrs: nounwind willreturn allockind("alloc") allocsize(1) memory(argmem: read, inaccessiblemem: readwrite)
declare noalias nonnull ptr addrspace(10) @julia.gc_alloc_obj(ptr, i32, ptr addrspace(10)) #4
; Function Attrs: norecurse nosync nounwind speculatable willreturn memory(none)
declare noundef nonnull ptr addrspace(13) @julia.gc_loaded(ptr addrspace(10) nocapture noundef nonnull readnone, ptr noundef nonnull readnone) #5
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #6
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #6
attributes #0 = { alignstack=16 "frame-pointer"="all" }
attributes #1 = { noinline optnone alignstack=16 "frame-pointer"="all" }
attributes #2 = { memory(argmem: readwrite, inaccessiblemem: readwrite) }
attributes #3 = { willreturn memory(argmem: read, inaccessiblemem: readwrite) }
attributes #4 = { nounwind willreturn allockind("alloc") allocsize(1) memory(argmem: read, inaccessiblemem: readwrite) }
attributes #5 = { norecurse nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind willreturn allockind("alloc,uninitialized") allocsize(1) memory(argmem: read, inaccessiblemem: readwrite) }
!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.dbg.cu = !{!5}
!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = !{i32 1, !"override-stack-alignment", i32 16}
!3 = !{i32 2, !"julia.debug_level", i32 1}
!4 = !{i32 2, !"julia.optlevel", i32 2}
!5 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !6, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, nameTableKind: None)
!6 = !DIFile(filename: "julia", directory: ".")
!7 = distinct !DISubprogram(name: "getindex", linkageName: "julia_getindex_4210", scope: null, file: !8, line: 390, type: !9, scopeLine: 390, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5)
!8 = !DIFile(filename: "array.jl", directory: ".")
!9 = !DISubroutineType(types: !10)
!10 = !{}
!11 = !{!12, !12, i64 0}
!12 = !{!"jtbaa_stack", !13, i64 0}
!13 = !{!"jtbaa", !14, i64 0}
!14 = !{!"jtbaa"}
!15 = !{!16}
!16 = !{!"jnoalias_stack", !17}
!17 = !{!"jnoalias"}
!18 = !{!19, !20, !21, !22}
!19 = !{!"jnoalias_gcframe", !17}
!20 = !{!"jnoalias_data", !17}
!21 = !{!"jnoalias_typemd", !17}
!22 = !{!"jnoalias_const", !17}
!23 = !{!24, !24, i64 0}
!24 = !{!"jtbaa_gcframe", !13, i64 0}
!25 = !{!26, !26, i64 0, i64 1}
!26 = !{!"jtbaa_const", !13, i64 0}
!27 = !DILocation(line: 390, scope: !7)
!28 = !DILocation(line: 538, scope: !29, inlinedAt: !31)
!29 = distinct !DISubprogram(name: "GenericMemory;", linkageName: "GenericMemory", scope: !30, file: !30, type: !9, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5)
!30 = !DIFile(filename: "boot.jl", directory: ".")
!31 = !DILocation(line: 598, scope: !32, inlinedAt: !33)
!32 = distinct !DISubprogram(name: "Array;", linkageName: "Array", scope: !30, file: !30, type: !9, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5)
!33 = !DILocation(line: 393, scope: !7)
!34 = !DILocation(line: 544, scope: !35, inlinedAt: !36)
!35 = distinct !DISubprogram(name: "memoryref;", linkageName: "memoryref", scope: !30, file: !30, type: !9, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5)
!36 = !DILocation(line: 599, scope: !32, inlinedAt: !33)
!37 = !{!22}
!38 = !{!19, !16, !20, !21}
!39 = !{!40, !40, i64 0}
!40 = !{!"jtbaa_arrayptr", !41, i64 0}
!41 = !{!"jtbaa_array", !13, i64 0}
!42 = !{!21}
!43 = !{!19, !16, !20, !22}
!44 = !{!13, !13, i64 0}
!45 = !{!20, !21}
!46 = !{!19, !16, !22}
!47 = !DILocation(line: 0, scope: !7)
!48 = !DILocation(line: 33, scope: !49, inlinedAt: !51)
!49 = distinct !DISubprogram(name: "__safe_getindex;", linkageName: "__safe_getindex", scope: !50, file: !50, type: !9, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5)
!50 = !DIFile(filename: "tuple.jl", directory: ".")
!51 = !DILocation(line: 396, scope: !7)
!52 = !DILocation(line: 337, scope: !53, inlinedAt: !55)
!53 = distinct !DISubprogram(name: "Float16;", linkageName: "Float16", scope: !54, file: !54, type: !9, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5)
!54 = !DIFile(filename: "float.jl", directory: ".")
!55 = !DILocation(line: 7, scope: !56, inlinedAt: !58)
!56 = distinct !DISubprogram(name: "convert;", linkageName: "convert", scope: !57, file: !57, type: !9, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5)
!57 = !DIFile(filename: "number.jl", directory: ".")
!58 = !DILocation(line: 1015, scope: !59, inlinedAt: !51)
!59 = distinct !DISubprogram(name: "__safe_setindex!;", linkageName: "__safe_setindex!", scope: !8, file: !8, type: !9, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5)
!60 = !DILocation(line: 1013, scope: !59, inlinedAt: !58)
!61 = !{!62, !62, i64 0}
!62 = !{!"jtbaa_arraybuf", !63, i64 0}
!63 = !{!"jtbaa_data", !13, i64 0}
!64 = !{!20}
!65 = !{!19, !16, !21, !22}
!66 = !DILocation(line: 639, scope: !67, inlinedAt: !69)
!67 = distinct !DISubprogram(name: "==;", linkageName: "==", scope: !68, file: !68, type: !9, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5)
!68 = !DIFile(filename: "promotion.jl", directory: ".")
!69 = !DILocation(line: 915, scope: !70, inlinedAt: !72)
!70 = distinct !DISubprogram(name: "iterate;", linkageName: "iterate", scope: !71, file: !71, type: !9, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !5)
!71 = !DIFile(filename: "range.jl", directory: ".")
!72 = !DILocation(line: 397, scope: !7)
!73 = !DILocation(line: 405, scope: !7)
!74 = !{i64 8}
!75 = !{!76, !76, i64 0}
!76 = !{!"jtbaa_immut", !77, i64 0}
!77 = !{!"jtbaa_value", !63, i64 0}opt: /root/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4570: llvm::VectorizationFactor llvm::LoopVectorizationPlanner::selectVectorizationFactor(): Assertion `ExpectedCost.isValid() && "Unexpected invalid cost for scalar loop"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=loop-vectorize -mcpu=haswell <source>
1. Running pass "function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)" on module "<source>"
2. Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "julia_getindex_4210"
#0 0x00000000050e6958 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x50e6958)
#1 0x00000000050e434c SignalHandler(int) Signals.cpp:0:0
#2 0x0000765291842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007652918969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x0000765291842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007652918287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000076529182871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x0000765291839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x00000000040db18f (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x40db18f)
#9 0x00000000040db584 llvm::LoopVectorizationPlanner::computeBestVF() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x40db584)
#10 0x00000000040f6289 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x40f6289)
#11 0x00000000040f95a9 llvm::LoopVectorizePass::runImpl(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x40f95a9)
#12 0x00000000040f9c33 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x40f9c33)
#13 0x0000000002f6e89e llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2f6e89e)
#14 0x0000000004ee83f8 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4ee83f8)
#15 0x0000000000e2cc2e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xe2cc2e)
#16 0x0000000004ee6e1e llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4ee6e1e)
#17 0x0000000000e2c35e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xe2c35e)
#18 0x0000000004ee6850 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4ee6850)
#19 0x000000000090adda llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x90adda)
#20 0x00000000008fdd2a optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8fdd2a)
#21 0x0000765291829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#22 0x0000765291829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#23 0x00000000008f57ae _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8f57ae)
Program terminated with signal: SIGSEGV
Compiler returned: 139
Metadata
Metadata
Assignees
Labels
crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]vectorizers