llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.14k stars 12.02k forks source link

llvm::sroa::AllocaSliceRewriter::visitLoadInst assertion Non-byte-multiple bit width #40264

Open andrewrk opened 5 years ago

andrewrk commented 5 years ago
Bugzilla Link 40919
Version 8.0
OS All
Attachments sroa-crash.ll, gzipped
CC @zmodem

Extended Description

$ /store/local/llvm8-debug/bin/opt -O3 sroa-crash.ll | /store/local/llvm8-debug/bin/llc opt: /store/dev/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp:2529: bool llvm::sroa::AllocaSliceRewriter::visitLoadInst(llvm::LoadInst&): Assertion `LI.getType()->getIntegerBitWidth() == DL.getTypeStoreSizeInBits(LI.getType()) && "Non-byte-multiple bit width"' failed. Stack dump:

  1. Program arguments: /store/local/llvm8-debug/bin/opt -O3 sroa-crash.ll
  2. Running pass 'CallGraph Pass Manager' on module 'sroa-crash.ll'.
  3. Running pass 'SROA' on function '@testIntSerializerDeserializer'

    ​0 0x0000000003caa7aa llvm::sys::PrintStackTrace(llvm::raw_ostream&) /store/dev/llvm-project/llvm/lib/Support/Unix/Signals.inc:495:0

    ​1 0x0000000003caa83d PrintStackTraceSignalHandler(void*) /store/dev/llvm-project/llvm/lib/Support/Unix/Signals.inc:559:0

    ​2 0x0000000003ca8719 llvm::sys::RunSignalHandlers() /store/dev/llvm-project/llvm/lib/Support/Signals.cpp:69:0

    ​3 0x0000000003caa26c SignalHandler(int) /store/dev/llvm-project/llvm/lib/Support/Unix/Signals.inc:358:0

    ​4 0x00007f6bcc355dd0 __restore_rt (/nix/store/2kcrj1ksd2a14bm5sky182fv2xwfhfap-glibc-2.26-131/lib/libpthread.so.0+0x11dd0)

    ​5 0x00007f6bcb0c1264 __GI_raise (/nix/store/2kcrj1ksd2a14bm5sky182fv2xwfhfap-glibc-2.26-131/lib/libc.so.6+0x34264)

    ​6 0x00007f6bcb0c2665 __GI_abort (/nix/store/2kcrj1ksd2a14bm5sky182fv2xwfhfap-glibc-2.26-131/lib/libc.so.6+0x35665)

    ​7 0x00007f6bcb0b9ce7 __assert_fail_base (/nix/store/2kcrj1ksd2a14bm5sky182fv2xwfhfap-glibc-2.26-131/lib/libc.so.6+0x2cce7)

    ​8 0x00007f6bcb0b9d92 (/nix/store/2kcrj1ksd2a14bm5sky182fv2xwfhfap-glibc-2.26-131/lib/libc.so.6+0x2cd92)

    ​9 0x0000000003b21330 llvm::sroa::AllocaSliceRewriter::visitLoadInst(llvm::LoadInst&) /store/dev/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp:2527:0

    ​10 0x0000000003b2c537 llvm::InstVisitor<llvm::sroa::AllocaSliceRewriter, bool>::visitLoad(llvm::LoadInst&) /store/dev/llvm-project/llvm/include/llvm/IR/Instruction.def:172:0

    ​11 0x0000000003b2915b llvm::InstVisitor<llvm::sroa::AllocaSliceRewriter, bool>::visit(llvm::Instruction&) /store/dev/llvm-project/llvm/include/llvm/IR/Instruction.def:172:0

    ​12 0x0000000003b26abf llvm::InstVisitor<llvm::sroa::AllocaSliceRewriter, bool>::visit(llvm::Instruction*) /store/dev/llvm-project/llvm/include/llvm/IR/InstVisitor.h:114:0

    ​13 0x0000000003b08d99 llvm::sroa::AllocaSliceRewriter::visit((anonymous namespace)::Slice const*) /store/dev/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp:2333:0

    ​14 0x0000000003b0db9a llvm::SROA::rewritePartition(llvm::AllocaInst&, llvm::sroa::AllocaSlices&, llvm::sroa::Partition&) /store/dev/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp:4130:0

    ​15 0x0000000003b0e4fb llvm::SROA::splitAlloca(llvm::AllocaInst&, llvm::sroa::AllocaSlices&) /store/dev/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp:4269:0

    ​16 0x0000000003b0f117 llvm::SROA::runOnAlloca(llvm::AllocaInst&) /store/dev/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp:4420:0

    ​17 0x0000000003b0f7d9 llvm::SROA::runImpl(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&) /store/dev/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp:4513:0

    ​18 0x0000000003b25795 llvm::sroa::SROALegacyPass::runOnFunction(llvm::Function&) /store/dev/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp:4570:0

    ​19 0x000000000343c716 llvm::FPPassManager::runOnFunction(llvm::Function&) /store/dev/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1644:0

    ​20 0x0000000002b209ec (anonymous namespace)::CGPassManager::RunPassOnSCC(llvm::Pass*, llvm::CallGraphSCC&, llvm::CallGraph&, bool&, bool&) /store/dev/llvm-project/llvm/lib/Analysis/CallGraphSCCPass.cpp:178:0

    ​21 0x0000000002b21978 (anonymous namespace)::CGPassManager::RunAllPassesOnSCC(llvm::CallGraphSCC&, llvm::CallGraph&, bool&) /store/dev/llvm-project/llvm/lib/Analysis/CallGraphSCCPass.cpp:442:0

    ​22 0x0000000002b21c79 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) /store/dev/llvm-project/llvm/lib/Analysis/CallGraphSCCPass.cpp:498:0

    ​23 0x000000000343cce6 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /store/dev/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1744:0

    ​24 0x000000000343d47e llvm::legacy::PassManagerImpl::run(llvm::Module&) /store/dev/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1857:0

    ​25 0x000000000343d6ad llvm::legacy::PassManager::run(llvm::Module&) /store/dev/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1889:0

    ​26 0x00000000015b8340 main /store/dev/llvm-project/llvm/tools/opt/opt.cpp:835:0

    ​27 0x00007f6bcb0ae020 __libc_start_main (/nix/store/2kcrj1ksd2a14bm5sky182fv2xwfhfap-glibc-2.26-131/lib/libc.so.6+0x21020)

    ​28 0x000000000157907a _start /build/glibc-2.26/csu/../sysdeps/x86_64/start.S:122:0

    .text
    .file   "<stdin>"
    
    .section        ".note.GNU-stack","",@progbits

    Aborted

andrewrk commented 5 years ago

That makes sense. I hope it can be fixed in 8.0.1. Downstream bug report: https://github.com/ziglang/zig/issues/2019

zmodem commented 5 years ago

I just tried with my llvm 7 build and got the same assert, so this far into the release process, I don't want to block llvm 8 on it.

andrewrk commented 5 years ago

I can answer that question in about 2.5 hours, when this debug build of LLVM 7 finishes.

zmodem commented 5 years ago

Do you know if this is a regression from llvm 7?