[llvm-bugs] [Bug 40930] New: opt crashes with "opt -consthoist"

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 2 01:14:57 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40930

            Bug ID: 40930
           Summary: opt crashes with "opt -consthoist"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: cszide at 163.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 21543
  --> https://bugs.llvm.org/attachment.cgi?id=21543&action=edit
.bc file of the source code

$clang -v
clang version 9.0.0 (trunk 354742)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm/build/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$clang -O3 -c -emit-llvm  -mllvm -disable-llvm-optzns small.c -o small.bc

$opt -consthoist small.bc -o small-opt.bc
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build2/bin/opt -consthoist
small.bc -o small-opt.bc 
1.      Running pass 'Function Pass Manager' on module 'small.bc'.
2.      Running pass 'Constant Hoisting' on function '@b'
 #0 0x000055be5f336b7b llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:494:0
 #1 0x000055be5f336c0e PrintStackTraceSignalHandler(void*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:558:0
 #2 0x000055be5f334b92 llvm::sys::RunSignalHandlers()
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Signals.cpp:68:0
 #3 0x000055be5f33659d SignalHandler(int)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:357:0
 #4 0x00007f73df201890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #5 0x000055be5ea2dda2 llvm::DomTreeNodeBase<llvm::BasicBlock>::getIDom() const
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/include/llvm/Support/GenericDomTree.h:82:0
 #6 0x000055be5efa8a5e findBestInsertionSet(llvm::DominatorTree&,
llvm::BlockFrequencyInfo&, llvm::BasicBlock*,
llvm::SmallPtrSet<llvm::BasicBlock*, 8u>&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:225:0
 #7 0x000055be5efa9400
llvm::ConstantHoistingPass::findConstantInsertionPoint(llvm::consthoist::ConstantInfo
const&) const
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:319:0
 #8 0x000055be5efabf1e
llvm::ConstantHoistingPass::emitBaseConstants(llvm::GlobalVariable*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:826:0
 #9 0x000055be5efaca17 llvm::ConstantHoistingPass::runImpl(llvm::Function&,
llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo*,
llvm::BasicBlock&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:941:0
#10 0x000055be5efa85b7 (anonymous
namespace)::ConstantHoistingLegacyPass::runOnFunction(llvm::Function&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:153:0
#11 0x000055be5eab71fc llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1643:0
#12 0x000055be5eab7473 llvm::FPPassManager::runOnModule(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1678:0
#13 0x000055be5eab7844 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1743:0
#14 0x000055be5eab7fd3 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1856:0
#15 0x000055be5eab81c5 llvm::legacy::PassManager::run(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1888:0
#16 0x000055be5cd1515f main
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/tools/opt/opt.cpp:862:0
#17 0x00007f73dde96b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#18 0x000055be5ccd6cba _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build2/bin/opt+0x1808cba)
Segmentation fault (core dumped)

The following is the source code of small.c, which is generated by csmith 2.4.0
and reduced by creduce 2.9.0 (eca4f38).

#include "csmith.h"
const int64_t a = 4208870971;
b() {
  for (;; c(a, a))
    for (;;)
      ;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190302/0110d00b/attachment-0001.html>


More information about the llvm-bugs mailing list