Skip to content

LLVM assertion error on PPC #26221

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

Closed
vchuravy opened this issue Feb 27, 2018 · 1 comment
Closed

LLVM assertion error on PPC #26221

vchuravy opened this issue Feb 27, 2018 · 1 comment
Labels
compiler:codegen Generation of LLVM IR and native code regression Regression in behavior compared to a previous version system:powerpc PowerPC

Comments

@vchuravy
Copy link
Member

While looking into power support I am encountering an assertion failure in LLVM, after applying #26218.

julia: /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/IR/Instructions.cpp:2648: static llvm::CastInst* llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, const llvm::Twine&, llvm::Instruction*): Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.

signal (6): Aborted
in expression starting at sysimg.jl:8
gsignal at /lib64/libc.so.6 (unknown line)
abort at /lib64/libc.so.6 (unknown line)
__assert_fail_base at /lib64/libc.so.6 (unknown line)
__assert_fail at /lib64/libc.so.6 (unknown line)
Create at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/IR/Instructions.cpp:2648
CreateCast at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/include/llvm/IR/IRBuilder.h:1365
CreateBitCast at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/include/llvm/IR/IRBuilder.h:1329 [inlined]
optimizeMemoryInst at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/CodeGen/CodeGenPrepare.cpp:3942
optimizeInst at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/CodeGen/CodeGenPrepare.cpp:5250
optimizeBlock at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/CodeGen/CodeGenPrepare.cpp:5325 [inlined]
runOnFunction at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/CodeGen/CodeGenPrepare.cpp:272
runOnFunction at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/IR/LegacyPassManager.cpp:1526
runOnModule at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/IR/LegacyPassManager.cpp:1547
runOnModule at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/IR/LegacyPassManager.cpp:1603 [inlined]
run at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/IR/LegacyPassManager.cpp:1706
run at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/IR/LegacyPassManager.cpp:1737
operator() at /raid1/home/ibm/valentin/src/julia/src/jitlayers.cpp:465

Bisect log: https://gist.github.com/vchuravy/ad88db5f56688c0538d9bade8ea7dfed
Bisect is not as helpful as I would have hoped since some of the commits are not testable, but everything points towards #21888 (cc: @Keno )

(gdb) f 4
#4  0x00001000012c0848 in llvm::CastInst::Create (op=<optimized out>, S=0x102d8448, Ty=0x1016d400, Name=..., 
    InsertBefore=0x0) at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/lib/IR/Instructions.cpp:2648
2648      assert(castIsValid(op, S, Ty) && "Invalid cast!");
(gdb) f 5
#5  0x00001000011f7944 in llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateCast (
    this=0x3fffffff3400, Op=<optimized out>, V=0x102d8448, DestTy=0x1016d400, Name=...)
    at /raid1/home/ibm/valentin/src/julia/deps/srccache/llvm-3.9.1/include/llvm/IR/IRBuilder.h:1365
1365        return Insert(CastInst::Create(Op, V, DestTy), Name);
(gdb) call V->dump()
  %18 = load %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %1, !nonnull !4, !dereferenceable !10
(gdb) call DestTy->dump()
i8 addrspace(11)*
(gdb) p Op               
$4 = llvm::Instruction::BitCast
(gdb) f 9
(gdb) p BB.dump()

ok17:                                             ; preds = %L60
  %282 = bitcast %jl_value_t addrspace(11)* %70 to i8 addrspace(11)*
  %283 = load %jl_value_t*, %jl_value_t** @"*Main.Core.Compiler.setproperty!55", !dbg !35, !tbaa !13
  %284 = getelementptr i8, i8 addrspace(11)* %282, i64 16, !dbg !35
  %285 = bitcast i8 addrspace(11)* %284 to %jl_value_t addrspace(10)* addrspace(11)*, !dbg !35
  store %jl_value_t addrspace(10)* %278, %jl_value_t addrspace(10)* addrspace(11)* %285, !dbg !35, !tbaa !15
  %286 = bitcast %jl_value_t addrspace(10)* %18 to i64 addrspace(10)*, !dbg !35
  %287 = getelementptr i64, i64 addrspace(10)* %286, i64 -1, !dbg !35
  %288 = load i64, i64 addrspace(10)* %287, !dbg !35, !tbaa !19, !range !21
  %289 = and i64 %288, 3, !dbg !35
  %290 = icmp eq i64 %289, 3, !dbg !35
  br i1 %290, label %291, label %298, !dbg !35

According to the debug information !dbg !35 this is coming from compiler/typeinfer.jl:243 on vc/ppc_as

@vchuravy vchuravy added regression Regression in behavior compared to a previous version compiler:codegen Generation of LLVM IR and native code system:powerpc PowerPC labels Feb 27, 2018
@vchuravy
Copy link
Member Author

fixed by fad170c, found through bugpoint and bisect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code regression Regression in behavior compared to a previous version system:powerpc PowerPC
Projects
None yet
Development

No branches or pull requests

1 participant