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

LLVM assertion error on release-0.6 while building docs #24855

Closed
vchuravy opened this issue Nov 30, 2017 · 15 comments
Closed

LLVM assertion error on release-0.6 while building docs #24855

vchuravy opened this issue Nov 30, 2017 · 15 comments
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request priority This should be addressed urgently
Milestone

Comments

@vchuravy
Copy link
Member

Travis is triggering an LLVM assertions on release-0.6 while building the docs: https://travis-ci.org/JuliaLang/julia/jobs/309198066

julia: /home/travis/build/JuliaLang/julia/deps/srccache/llvm-3.9.1/lib/IR/Instruction.cpp:30: llvm::Instruction::Instruction(llvm::Type*, unsigned int, llvm::Use*, unsigned int, llvm::Instruction*): Assertion `BB && "Instruction to insert before is not in a basic block!"' failed.
signal (6): Aborted
while loading /home/travis/build/JuliaLang/julia/doc/make.jl, in expression starting on line 5
gsignal at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x2b1b157f0bf5)
__assert_fail at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_ZN4llvm11InstructionC2EPNS_4TypeEjPNS_3UseEjPS0_ at /home/travis/build/JuliaLang/julia/usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm8LoadInstC2EPNS_4TypeEPNS_5ValueERKNS_5TwineEbjNS_14AtomicOrderingENS_20SynchronizationScopeEPNS_11InstructionE at /home/travis/build/JuliaLang/julia/usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm8LoadInstC1EPNS_4TypeEPNS_5ValueERKNS_5TwineEbjPNS_11InstructionE at /home/travis/build/JuliaLang/julia/usr/bin/../lib/libLLVM-3.9.so (unknown line)
unknown function (ip: 0x2b1b1674541f)
unknown function (ip: 0x2b1b16748d28)
_ZN4llvm15PromoteMemToRegENS_8ArrayRefIPNS_10AllocaInstEEERNS_13DominatorTreeEPNS_15AliasSetTrackerEPNS_15AssumptionCacheE at /home/travis/build/JuliaLang/julia/usr/bin/../lib/libLLVM-3.9.so (unknown line)
unknown function (ip: 0x2b1b16733bd8)
_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE at /home/travis/build/JuliaLang/julia/usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE at /home/travis/build/JuliaLang/julia/usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE at /home/travis/build/JuliaLang/julia/usr/bin/../lib/libLLVM-3.9.so (unknown line)
operator() at /home/travis/build/JuliaLang/julia/src/jitlayers.cpp:460 [inlined]
_M_invoke at /usr/include/c++/5/functional:1857
operator() at /usr/include/c++/5/functional:2267 [inlined]
addModuleSet<llvm::SmallVector<std::unique_ptr<llvm::Module>, 1u>, llvm::RTDyldMemoryManager*, std::unique_ptr<llvm::orc::LambdaResolver<JuliaOJIT::addModule(std::unique_ptr<llvm::Module>)::<lambda(const string&)>, JuliaOJIT::addModule(std::unique_ptr<llvm::Module>)::<lambda(const string&)> >, std::default_delete<llvm::orc::LambdaResolver<JuliaOJIT::addModule(std::unique_ptr<llvm::Module>)::<lambda(const string&)>, JuliaOJIT::addModule(std::unique_ptr<llvm::Module>)::<lambda(const string&)> > > > > at /home/travis/build/JuliaLang/julia/usr/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h:73 [inlined]
addModule at /home/travis/build/JuliaLang/julia/src/jitlayers.cpp:587
jl_add_to_ee at /home/travis/build/JuliaLang/julia/src/jitlayers.cpp:810 [inlined]
jl_finalize_function at /home/travis/build/JuliaLang/julia/src/jitlayers.cpp:821
getAddressForFunction at /home/travis/build/JuliaLang/julia/src/codegen.cpp:1411
jl_generate_fptr at /home/travis/build/JuliaLang/julia/src/codegen.cpp:1508
jl_compile_method_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:326 [inlined]
jl_call_method_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:354 [inlined]
jl_apply_generic at /home/travis/build/JuliaLang/julia/src/gf.c:1926
#cd#1 at ./pkg/dir.jl:32
jl_call_fptr_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:358 [inlined]
jl_apply_generic at /home/travis/build/JuliaLang/julia/src/gf.c:1926
jl_apply at /home/travis/build/JuliaLang/julia/src/julia.h:1424 [inlined]
jl_invoke at /home/travis/build/JuliaLang/julia/src/gf.c:51
update at ./pkg/pkg.jl:228
jl_call_fptr_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:358 [inlined]
jl_apply_generic at /home/travis/build/JuliaLang/julia/src/gf.c:1926
do_call at /home/travis/build/JuliaLang/julia/src/interpreter.c:75
eval at /home/travis/build/JuliaLang/julia/src/interpreter.c:242
jl_interpret_toplevel_expr at /home/travis/build/JuliaLang/julia/src/interpreter.c:34
jl_toplevel_eval_flex at /home/travis/build/JuliaLang/julia/src/toplevel.c:577
jl_parse_eval_all at /home/travis/build/JuliaLang/julia/src/ast.c:873
jl_load at /home/travis/build/JuliaLang/julia/src/toplevel.c:616
include_from_node1 at ./loading.jl:576
unknown function (ip: 0x2b1b19c916bb)
jl_call_fptr_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:358 [inlined]
jl_apply_generic at /home/travis/build/JuliaLang/julia/src/gf.c:1926
include at ./sysimg.jl:14
unknown function (ip: 0x2b1b19b2394b)
jl_call_fptr_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:358 [inlined]
jl_apply_generic at /home/travis/build/JuliaLang/julia/src/gf.c:1926
process_options at ./client.jl:305
_start at ./client.jl:371
unknown function (ip: 0x2b1b19ca04b8)
jl_call_fptr_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /home/travis/build/JuliaLang/julia/src/julia_internal.h:358 [inlined]
jl_apply_generic at /home/travis/build/JuliaLang/julia/src/gf.c:1926
jl_apply at /home/travis/build/JuliaLang/julia/ui/../src/julia.h:1424 [inlined]
true_main at /home/travis/build/JuliaLang/julia/ui/repl.c:127
main at /home/travis/build/JuliaLang/julia/ui/repl.c:264
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x40160e)
Allocations: 6081730 (Pool: 6080128; Big: 1602); GC: 11
make[2]: *** [html] Aborted (core dumped)
263.939448 make[2]: Leaving directory `/home/travis/build/JuliaLang/julia/doc'
make[1]: *** [docs] Error 2
make: *** [/home/travis/build/JuliaLang/julia/doc/_build/html/en/index.html] Error 2
263.939900 make[1]: Leaving directory `/home/travis/build/JuliaLang/julia

I haven't managed to reproduce that locally. cc: @ararslan

@vtjnash
Copy link
Member

vtjnash commented Nov 30, 2017

Possibly caused by

julia/src/cgutils.cpp

Lines 2092 to 2093 in 3835d80

if (skip) // copy dest -> dest to simulate an undef value / conditional copy
src_ptr = builder.CreateSelect(skip, dest, src_ptr);

This code is intended to trigger runtime UB, but according to Keno, it also triggers LLVM bugs, so on master, he replaced it with a large performance regression (https://github.com/JuliaLang/julia/blame/c1cf539c6cf6915f2870fcddbbe7aeb47a0e11ba/src/cgutils.cpp#L2214 - the comment on that line is wrong now btw).

@ararslan
Copy link
Member

I can't reproduce with a stock build nor with a build with these options:

LLVM_DEBUG=1
LLVM_ASSERTIONS=1
FORCE_ASSERTIONS=1

But it happens on every Travis Linux build on release-0.6. :/

@ararslan
Copy link
Member

I assume this is blocking the release of 0.6.2, so any help would be much appreciated.

@ararslan ararslan added the help wanted Indicates that a maintainer wants help on an issue or pull request label Nov 30, 2017
@ararslan ararslan added this to the 0.6.x milestone Nov 30, 2017
@ViralBShah ViralBShah added the priority This should be addressed urgently label Nov 30, 2017
@vtjnash
Copy link
Member

vtjnash commented Dec 1, 2017

Did the release-0.6 branch get any patches applied to lllvm in the cache at some point? Maybe reset that and try again?

@ararslan
Copy link
Member

ararslan commented Dec 1, 2017

I'm not sure how to do that. Do you have any pointers, @vtjnash?

@vtjnash
Copy link
Member

vtjnash commented Dec 1, 2017

Just click the trash can icon https://travis-ci.org/JuliaLang/julia/caches

@ararslan
Copy link
Member

ararslan commented Dec 1, 2017

It looks like I don't have the necessary permissions to do that.

@Keno
Copy link
Member

Keno commented Dec 1, 2017

@ararslan should be tied to the commit bit, are you signed in on Travis?

@ararslan
Copy link
Member

ararslan commented Dec 1, 2017

Ah yeah, I was getting confused by redirects. I've deleted the cache and restarted the most recent build on release-0.6, so we'll see what happens.

@ararslan
Copy link
Member

ararslan commented Dec 2, 2017

Seems not to have helped: https://travis-ci.org/JuliaLang/julia/builds/309339079. Same error.

@maleadt
Copy link
Member

maleadt commented Dec 6, 2017

Had a quick look with the archive @ararslan put on anubis. A better backtrace:

INFO: Initializing package repository doc/deps/v0.6
INFO: Package directory doc/deps/v0.6 is already initialized.
julia: deps/srccache/llvm-3.9.1/lib/IR/Instruction.cpp:30: llvm::Instruction::Instruction(llvm::Type*, unsigned int, llvm::Use*, unsigned int, llvm::Instruction*): Assertion `BB && "Instruction to insert before is not in a basic block!"' failed.

Thread 1 "julia" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58
58      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58
#1  0x00007ffff6ce83ea in __GI_abort () at abort.c:89
#2  0x00007ffff6cdebb7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7ffff5d32b20 "BB && \"Instruction to insert before is not in a basic block!\"", 
    file=file@entry=0x7ffff5d32a90 "deps/srccache/llvm-3.9.1/lib/IR/Instruction.cpp", line=line@entry=30, 
    function=function@entry=0x7ffff5d36720 <llvm::Instruction::Instruction(llvm::Type*, unsigned int, llvm::Use*, unsigned int, llvm::Instruction*)::__PRETTY_FUNCTION__> "llvm::Instruction::Instruction(llvm::Type*, unsigned int, llvm::Use*, unsigned int, llvm::Instruction*)") at assert.c:92
#3  0x00007ffff6cdec62 in __GI___assert_fail (assertion=0x7ffff5d32b20 "BB && \"Instruction to insert before is not in a basic block!\"", 
    file=0x7ffff5d32a90 "deps/srccache/llvm-3.9.1/lib/IR/Instruction.cpp", line=30, 
    function=0x7ffff5d36720 <llvm::Instruction::Instruction(llvm::Type*, unsigned int, llvm::Use*, unsigned int, llvm::Instruction*)::__PRETTY_FUNCTION__> "llvm::Instruction::Instruction(llvm::Type*, unsigned int, llvm::Use*, unsigned int, llvm::Instruction*)") at assert.c:101
#4  0x00007ffff4bec454 in llvm::Instruction::Instruction(llvm::Type*, unsigned int, llvm::Use*, unsigned int, llvm::Instruction*) () from usr/bin/../lib/libLLVM-3.9.so
#5  0x00007ffff4bf809d in llvm::LoadInst::LoadInst(llvm::Type*, llvm::Value*, llvm::Twine const&, bool, unsigned int, llvm::AtomicOrdering, llvm::SynchronizationScope, llvm::Instruction*) ()
   from usr/bin/../lib/libLLVM-3.9.so
#6  0x00007ffff4bf81e5 in llvm::LoadInst::LoadInst(llvm::Type*, llvm::Value*, llvm::Twine const&, bool, unsigned int, llvm::Instruction*) () from usr/bin/../lib/libLLVM-3.9.so
#7  0x00007ffff5284420 in doMemCpySplit((anonymous namespace)::LargeBlockInfo&, llvm::MemCpyInst*, llvm::AllocaInst*) [clone .constprop.437] () from usr/bin/../lib/libLLVM-3.9.so
#8  0x00007ffff5287d29 in (anonymous namespace)::PromoteMem2Reg::run() [clone .constprop.419] () from usr/bin/../lib/libLLVM-3.9.so
#9  0x00007ffff528a012 in llvm::PromoteMemToReg(llvm::ArrayRef<llvm::AllocaInst*>, llvm::DominatorTree&, llvm::AliasSetTracker*, llvm::AssumptionCache*) () from usr/bin/../lib/libLLVM-3.9.so
#10 0x00007ffff5272bd9 in promoteMemoryToRegister(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&) [clone .constprop.79] () from usr/bin/../lib/libLLVM-3.9.so
#11 0x00007ffff4c1cfc3 in llvm::FPPassManager::runOnFunction(llvm::Function&) () from usr/bin/../lib/libLLVM-3.9.so
#12 0x00007ffff4c1d35b in llvm::FPPassManager::runOnModule(llvm::Module&) () from usr/bin/../lib/libLLVM-3.9.so
#13 0x00007ffff4c1cb5a in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from usr/bin/../lib/libLLVM-3.9.so
#14 0x00007ffff7798dce in JuliaOJIT::<lambda(llvm::Module&)>::operator() (M=..., __closure=0x70a508) at src/jitlayers.cpp:460
#15 std::_Function_handler<llvm::object::OwningBinary<llvm::object::ObjectFile>(llvm::Module&), JuliaOJIT::JuliaOJIT(llvm::TargetMachine&)::<lambda(llvm::Module&)> >::_M_invoke(const std::_Any_data &, llvm::Module &) (__functor=..., 
    __args#0=...) at /usr/include/c++/5/functional:1857
#16 0x00007ffff779b879 in std::function<llvm::object::OwningBinary<llvm::object::ObjectFile> (llvm::Module&)>::operator()(llvm::Module&) const (__args#0=..., this=<optimized out>) at /usr/include/c++/5/functional:2267
#17 llvm::orc::IRCompileLayer<llvm::orc::ObjectLinkingLayer<JuliaOJIT::DebugObjectRegistrar> >::addModuleSet<llvm::SmallVector<std::unique_ptr<llvm::Module>, 1u>, llvm::RTDyldMemoryManager*, std::unique_ptr<llvm::orc::LambdaResolver<JuliaOJIT::addModule(std::unique_ptr<llvm::Module>)::<lambda(const string&)>, JuliaOJIT::addModule(std::unique_ptr<llvm::Module>)::<lambda(const string&)> >, std::default_delete<llvm::orc::LambdaResolver<JuliaOJIT::addModule(std::unique_ptr<llvm::Module>)::<lambda(const string&)>, JuliaOJIT::addModule(std::unique_ptr<llvm::Module>)::<lambda(const string&)> > > > > (Resolver=..., MemMgr=0x717300, Ms=..., this=<optimized out>)
    at usr/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h:73
#18 JuliaOJIT::addModule (this=<optimized out>, M=std::unique_ptr<llvm::Module> containing 0x0) at src/jitlayers.cpp:587
#19 0x00007ffff779c4ee in jl_add_to_ee (m=...) at src/jitlayers.cpp:810
#20 jl_finalize_function (F=F@entry=0x275d298) at src/jitlayers.cpp:821
#21 0x00007ffff774be73 in getAddressForFunction (llvmf=llvmf@entry=0x275d298) at src/codegen.cpp:1411
#22 0x00007ffff7795dfa in jl_generate_fptr (li=0x7fffbae2a290, _F=<optimized out>, world=world@entry=21833) at src/codegen.cpp:1508
#23 0x00007ffff76df4f8 in jl_compile_method_internal (meth=0x7fffbae2a290, fptr=<synthetic pointer>) at src/julia_internal.h:326
#24 jl_call_method_internal (nargs=3, args=0x7fffffffcbc8, meth=<optimized out>) at src/julia_internal.h:354
#25 jl_apply_generic (args=0x7fffffffcbc8, nargs=<optimized out>) at src/gf.c:1926
#26 0x00007fffbee94cc3 in japi1_#cd#1_62782 () at pkg/dir.jl:32
#27 0x00007ffff76df527 in jl_call_fptr_internal (fptr=<synthetic pointer>, fptr=<synthetic pointer>, nargs=6, args=0x7fffffffcd98, meth=<optimized out>) at src/julia_internal.h:339
#28 jl_call_method_internal (nargs=6, args=0x7fffffffcd98, meth=<optimized out>) at src/julia_internal.h:358
#29 jl_apply_generic (args=args@entry=0x7fffffffcd98, nargs=nargs@entry=6) at src/gf.c:1926
#30 0x00007ffff76df6f7 in jl_apply (nargs=6, args=0x7fffffffcd98) at src/julia.h:1424
#31 jl_invoke (meth=<optimized out>, args=0x7fffffffcd98, nargs=6) at src/gf.c:51
#32 0x00007fffbee93fdf in japi1_update_62776 () at pkg/pkg.jl:228
#33 0x00007ffff76df527 in jl_call_fptr_internal (fptr=<synthetic pointer>, fptr=<synthetic pointer>, nargs=1, args=0x7fffffffcee0, meth=<optimized out>) at src/julia_internal.h:339
#34 jl_call_method_internal (nargs=1, args=0x7fffffffcee0, meth=<optimized out>) at src/julia_internal.h:358
#35 jl_apply_generic (args=args@entry=0x7fffffffcee0, nargs=nargs@entry=1) at src/gf.c:1926
#36 0x00007ffff76f599e in do_call (args=args@entry=0x7fffbafafc50, nargs=nargs@entry=1, s=s@entry=0x0) at src/interpreter.c:75
#37 0x00007ffff76f4663 in eval (e=e@entry=0x7fffbafb5150, s=s@entry=0x0) at src/interpreter.c:242
#38 0x00007ffff76f58d4 in jl_interpret_toplevel_expr (e=0x7fffbafb5150) at src/interpreter.c:34
#39 0x00007ffff770f737 in jl_toplevel_eval_flex (e=<optimized out>, fast=fast@entry=1, expanded=expanded@entry=1) at src/toplevel.c:577
#40 0x00007ffff76e9917 in jl_parse_eval_all (fname=fname@entry=0x7ffff00b2fe8 "doc/make.jl", content=content@entry=0x0, contentlen=contentlen@entry=0) at src/ast.c:873
#41 0x00007ffff770fd74 in jl_load (fname=0x7ffff00b2fe8 "doc/make.jl") at src/toplevel.c:616
#42 0x00007ffff11989d6 in julia_include_from_node1_18743 () at loading.jl:576
#43 0x00007ffff1198bac in jlcall_include_from_node1_18742 () from usr/lib/julia/sys.so
#44 0x00007ffff76df527 in jl_call_fptr_internal (fptr=<synthetic pointer>, fptr=<synthetic pointer>, nargs=2, args=0x7fffffffdad8, meth=<optimized out>) at src/julia_internal.h:339
#45 jl_call_method_internal (nargs=2, args=0x7fffffffdad8, meth=<optimized out>) at src/julia_internal.h:358
#46 jl_apply_generic (args=0x7fffffffdad8, nargs=<optimized out>) at src/gf.c:1926
#47 0x00007ffff1030c40 in julia_include_1023 () at sysimg.jl:14
#48 0x00007ffff1030cac in jlcall_include_1022 () from usr/lib/julia/sys.so
---Type <return> to continue, or q <return> to quit---
#49 0x00007ffff76df527 in jl_call_fptr_internal (fptr=<synthetic pointer>, fptr=<synthetic pointer>, nargs=2, args=0x7fffffffdcc0, meth=<optimized out>) at src/julia_internal.h:339
#50 jl_call_method_internal (nargs=2, args=0x7fffffffdcc0, meth=<optimized out>) at src/julia_internal.h:358
#51 jl_apply_generic (args=0x7fffffffdcc0, nargs=<optimized out>) at src/gf.c:1926
#52 0x00007ffff11a4587 in julia_process_options_18989 () at client.jl:305
#53 0x00007ffff11a6bab in julia__start_18982 () at client.jl:371
#54 0x00007ffff11a75f9 in jlcall.start_18981 () from usr/lib/julia/sys.so
#55 0x00007ffff76df527 in jl_call_fptr_internal (fptr=<synthetic pointer>, fptr=<synthetic pointer>, nargs=1, args=0x7fffffffe1f0, meth=<optimized out>) at src/julia_internal.h:339
#56 jl_call_method_internal (nargs=1, args=0x7fffffffe1f0, meth=<optimized out>) at src/julia_internal.h:358
#57 jl_apply_generic (args=args@entry=0x7fffffffe1f0, nargs=nargs@entry=1) at src/gf.c:1926
#58 0x0000000000401d52 in jl_apply (nargs=1, args=0x7fffffffe1f0) at ui/../src/julia.h:1424
#59 true_main (argc=<optimized out>, argv=0x7fffffffe560) at ui/repl.c:127
#60 0x0000000000401563 in main (argc=1, argv=0x7fffffffe560) at ui/repl.c:264

However, lacking julia-debug it's pretty anoying to debug. I managed to capture the IR submitted to the JIT: https://file.io/TvBSgZ (warning: 10MB IR), but haven't managed to reproduce the crash with opt. Somebody have an opt invocation mimicking our pass manager laying around?

EDIT: OK, managed to get a hold of the function that makes mem2reg crash (doing a manual call _ZN4llvm2cl23ParseEnvironmentOptionsEPKcS2_S2_("Julia", "JULIA_LLVM_ARGS") from jl_init_llvm): https://file.io/Trz3ul, run with opt -mem2reg.

@maleadt
Copy link
Member

maleadt commented Dec 6, 2017

MWE after bugpoint:

; ModuleID = 'bugpoint-reduced-simplified.bc'
source_filename = "bugpoint-output-59d46bf.bc"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i1) #0

define void @julia_push() {
top:
  %item = alloca i8
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %item, i8* %item, i32 1, i32 1, i1 false)
  unreachable
}

attributes #0 = { argmemonly nounwind }
$ ./usr/tools/opt -mem2reg bugpoint-reduced-simplified.ll
opt: /home/travis/build/JuliaLang/julia/deps/srccache/llvm-3.9.1/lib/IR/Instruction.cpp:30: llvm::Instruction::Instruction(llvm::Type*, unsigned int, llvm::Use*, unsigned int, llvm::Instruction*): Assertion `BB && "Instruction to insert before is not in a basic block!"' failed.
#0 0x00007f8b9365a935 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (usr/tools/../lib/libLLVM-3.9.so+0x47a935)
#1 0x00007f8b936587de llvm::sys::RunSignalHandlers() (usr/tools/../lib/libLLVM-3.9.so+0x4787de)
#2 0x00007f8b93658942 SignalHandler(int) (usr/tools/../lib/libLLVM-3.9.so+0x478942)
#3 0x00007f8b92ac6860 (/lib/x86_64-linux-gnu/libc.so.6+0x35860)
#4 0x00007f8b92ac67ef gsignal /build/glibc-MECilU/glibc-2.24/signal/../sysdeps/unix/sysv/linux/raise.c:58:0
#5 0x00007f8b92ac83ea abort /build/glibc-MECilU/glibc-2.24/stdlib/abort.c:91:0
#6 0x00007f8b92abebb7 __assert_fail_base /build/glibc-MECilU/glibc-2.24/assert/assert.c:92:0
#7 0x00007f8b92abec62 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc62)
#8 0x00007f8b93703454 llvm::Instruction::Instruction(llvm::Type*, unsigned int, llvm::Use*, unsigned int, llvm::Instruction*) (usr/tools/../lib/libLLVM-3.9.so+0x523454)
#9 0x00007f8b9370f09d llvm::LoadInst::LoadInst(llvm::Type*, llvm::Value*, llvm::Twine const&, bool, unsigned int, llvm::AtomicOrdering, llvm::SynchronizationScope, llvm::Instruction*) (usr/tools/../lib/libLLVM-3.9.so+0x52f09d)
#10 0x00007f8b9370f1e5 llvm::LoadInst::LoadInst(llvm::Type*, llvm::Value*, llvm::Twine const&, bool, unsigned int, llvm::Instruction*) (usr/tools/../lib/libLLVM-3.9.so+0x52f1e5)
#11 0x00007f8b93d9b420 doMemCpySplit((anonymous namespace)::LargeBlockInfo&, llvm::MemCpyInst*, llvm::AllocaInst*) [clone .constprop.437] (usr/tools/../lib/libLLVM-3.9.so+0xbbb420)
#12 0x00007f8b93d9ed29 (anonymous namespace)::PromoteMem2Reg::run() [clone .constprop.419] (usr/tools/../lib/libLLVM-3.9.so+0xbbed29)
#13 0x00007f8b93da1012 llvm::PromoteMemToReg(llvm::ArrayRef<llvm::AllocaInst*>, llvm::DominatorTree&, llvm::AliasSetTracker*, llvm::AssumptionCache*) (usr/tools/../lib/libLLVM-3.9.so+0xbc1012)
#14 0x00007f8b93d89bd9 promoteMemoryToRegister(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&) [clone .constprop.79] (usr/tools/../lib/libLLVM-3.9.so+0xba9bd9)
#15 0x00007f8b93733fc3 llvm::FPPassManager::runOnFunction(llvm::Function&) (usr/tools/../lib/libLLVM-3.9.so+0x553fc3)
#16 0x00007f8b9373435b llvm::FPPassManager::runOnModule(llvm::Module&) (usr/tools/../lib/libLLVM-3.9.so+0x55435b)
#17 0x00007f8b93733b5a llvm::legacy::PassManagerImpl::run(llvm::Module&) (usr/tools/../lib/libLLVM-3.9.so+0x553b5a)
#18 0x000000000041425f main (./usr/tools/opt+0x41425f)
#19 0x00007f8b92ab13f1 __libc_start_main /build/glibc-MECilU/glibc-2.24/csu/../csu/libc-start.c:325:0
#20 0x0000000000414acb _start (./usr/tools/opt+0x414acb)

Strangely only crashes on a build from master on my system; Travis cache issue?

@maleadt
Copy link
Member

maleadt commented Dec 6, 2017

As expected, bisected to 820ec5f #23750. Note this is the first bad commit, and it shouldn't be part of the LLVM version as used by the release-0.6 branch. I'd suspect an issue with the Travis cache.

So this is probably the same issue as #24173.

With respect to the crash, @Keno will be able to judge whether this is a problem with the patch from #23750, or whether the MWE is invalid and cannot get generated post-#23750.

@Keno
Copy link
Member

Keno commented Dec 6, 2017

Yeah, so that IR as illegal and we don't generate it after #23750, though as @vtjnash will point out to me, it should not crash the compiler (it may still crash your program at runtime though). In either case the release-0.6 version of LLVM should not have that patch, so that's the bug we should look at.

@vchuravy
Copy link
Member Author

vchuravy commented Dec 7, 2017

closed by #24953

@vchuravy vchuravy closed this as completed Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request priority This should be addressed urgently
Projects
None yet
Development

No branches or pull requests

6 participants