[llvm-bugs] [Bug 40454] New: opt crashes with "opt -instcombine -mem2reg -globalopt -inline -correlated-propagation -indvars"

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 24 17:30:37 PST 2019


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

            Bug ID: 40454
           Summary: opt crashes with "opt -instcombine -mem2reg -globalopt
                    -inline -correlated-propagation -indvars"
           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 21378
  --> https://bugs.llvm.org/attachment.cgi?id=21378&action=edit
.bc file of the source code

$ ~/Documents/llvm/llvm_truck/llvm/build/bin/clang -v
clang version 9.0.0 (trunk 351668) (llvm/trunk 351667)
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
-I'path to csmith's runtime'

$opt  -instcombine -mem2reg -globalopt  -inline -correlated-propagation
-indvars small.bc -o small-opt.bc
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:249:
llvm::Instruction* getInsertPointForUses(llvm::Instruction*, llvm::Value*,
llvm::DominatorTree*, llvm::LoopInfo*): Assertion `!L ||
L->contains(LI->getLoopFor(InsertPt->getParent()))' failed.
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build/bin/opt -instcombine
-mem2reg -globalopt -inline -correlated-propagation -indvars small.bc -o
small-opt.bc 
1.      Running pass 'CallGraph Pass Manager' on module 'small.bc'.
2.      Running pass 'Loop Pass Manager' on function '@bm'
3.      Running pass 'Induction Variable Simplification' on basic block
'%for.cond.i'
 #0 0x00005587aef1ad37 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:494:0
 #1 0x00005587aef1adca PrintStackTraceSignalHandler(void*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:558:0
 #2 0x00005587aef189ae llvm::sys::RunSignalHandlers()
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Signals.cpp:68:0
 #3 0x00005587aef1a759 SignalHandler(int)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:357:0
 #4 0x00007f9053889890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #5 0x00007f905253be97 gsignal
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #6 0x00007f905253d801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #7 0x00007f905252d39a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #8 0x00007f905252d412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #9 0x00005587aebda0ea getInsertPointForUses(llvm::Instruction*, llvm::Value*,
llvm::DominatorTree*, llvm::LoopInfo*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:251:0
#10 0x00005587aebde17a truncateIVUse((anonymous namespace)::NarrowIVDefUse,
llvm::DominatorTree*, llvm::LoopInfo*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1313:0
#11 0x00005587aebdf2e3 (anonymous namespace)::WidenIV::widenIVUse((anonymous
namespace)::NarrowIVDefUse, llvm::SCEVExpander&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1515:0
#12 0x00005587aebe0419 (anonymous
namespace)::WidenIV::createWideIV(llvm::SCEVExpander&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1758:0
#13 0x00005587aebe13c8 (anonymous
namespace)::IndVarSimplify::simplifyAndExtend(llvm::Loop*, llvm::SCEVExpander&,
llvm::LoopInfo*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1966:0
#14 0x00005587aebe3986 (anonymous namespace)::IndVarSimplify::run(llvm::Loop*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2601:0
#15 0x00005587aebe41fb (anonymous
namespace)::IndVarSimplifyLegacyPass::runOnLoop(llvm::Loop*,
llvm::LPPassManager&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2724:0
#16 0x00005587addb1be2 llvm::LPPassManager::runOnFunction(llvm::Function&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Analysis/LoopPass.cpp:222:0
#17 0x00005587ae62614c llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1643:0
#18 0x00005587adc6e319 (anonymous
namespace)::CGPassManager::RunPassOnSCC(llvm::Pass*, llvm::CallGraphSCC&,
llvm::CallGraph&, bool&, bool&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Analysis/CallGraphSCCPass.cpp:177:0
#19 0x00005587adc6f340 (anonymous
namespace)::CGPassManager::RunAllPassesOnSCC(llvm::CallGraphSCC&,
llvm::CallGraph&, bool&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Analysis/CallGraphSCCPass.cpp:441:0
#20 0x00005587adc6f6c8 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Analysis/CallGraphSCCPass.cpp:497:0
#21 0x00005587ae6267c4 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1743:0
#22 0x00005587ae626fe7 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1856:0
#23 0x00005587ae627217 llvm::legacy::PassManager::run(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1888:0
#24 0x00005587ac6ea072 main
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/tools/opt/opt.cpp:862:0
#25 0x00007f905251eb97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#26 0x00005587ac6a9bca _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build/bin/opt+0x17babca)
Aborted (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"
struct a {
  uint64_t b
};
struct {
  uint64_t c
} ba;
struct d {};
af;
static struct a ak = {4};
struct d bj(int32_t, struct d *, struct d *, uint64_t);
bm() { bn(bj(bn, bn, af, ak.b)); }
struct d bj(int32_t bq, struct d *br, struct d *bs, uint64_t bt) {
  uint32_t bu = 18446744073709551607;
  int32_t bw;
  int16_t by;
cf:
  for (ba.c = 9; ba.c < 5; ba.c = safe_sub_func_int64_t_s_s) {
    int e;
    if (g(bu--, bw), bt)
      f(bu & safe_div_func_uint64_t_u_u(bq, by));
    else
      goto cf;
  }
}

-- 
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/20190125/a94d8778/attachment-0001.html>


More information about the llvm-bugs mailing list