[llvm-bugs] [Bug 49574] New: loop-extract pass crashes: Assertion `Found && "already unregistered or incorrect cache state"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 13 02:12:49 PST 2021


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

            Bug ID: 49574
           Summary: loop-extract pass crashes: Assertion `Found &&
                    "already unregistered or incorrect cache state"'
                    failed
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: cszide at 163.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24639
  --> https://bugs.llvm.org/attachment.cgi?id=24639&action=edit
small.bc

$clang -v
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
77394c12a48822bb7a9183408f922d90c1d563cd)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
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.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Selected multilib: .;@m64

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

$opt -reg2mem -structurizecfg -mem2reg  -simplifycfg -loop-unswitch
-loop-extract small.bc -o small-opt.bc
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/llvm/lib/Analysis/AssumptionCache.cpp:161:
void llvm::AssumptionCache::unregisterAssumption(llvm::CallInst*): Assertion
`Found && "already unregistered or incorrect cache state"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt -reg2mem
-structurizecfg -mem2reg -simplifycfg -loop-unswitch -loop-extract small.bc -o
small-opt.bc
1.      Running pass 'Extract loops into new functions' on module 'small.bc'.
 #0 0x00005568ce4fb5ec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2e865ec)
 #1 0x00005568ce4f92b4 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2e842b4)
 #2 0x00005568ce4f9423 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f3daedf38a0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #4 0x00007f3dada5af47 raise
/build/glibc-2ORdQG/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f3dada5c8b1 abort /build/glibc-2ORdQG/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f3dada4c42a __assert_fail_base
/build/glibc-2ORdQG/glibc-2.27/assert/assert.c:89:0
 #7 0x00007f3dada4c4a2 (/lib/x86_64-linux-gnu/libc.so.6+0x304a2)
 #8 0x00005568cd36ebe7
llvm::AssumptionCache::unregisterAssumption(llvm::CallInst*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x1cf9be7)
 #9 0x00005568ce55fe00
llvm::CodeExtractor::extractCodeRegion(llvm::CodeExtractorAnalysisCache const&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2eeae00)
#10 0x00005568cde39aa4 (anonymous
namespace)::LoopExtractor::extractLoop(llvm::Loop*, llvm::LoopInfo&,
llvm::DominatorTree&) LoopExtractor.cpp:0:0
#11 0x00005568cde39d12 (anonymous
namespace)::LoopExtractor::extractLoops(__gnu_cxx::__normal_iterator<llvm::Loop*
const*, std::vector<llvm::Loop*, std::allocator<llvm::Loop*> > >,
__gnu_cxx::__normal_iterator<llvm::Loop* const*, std::vector<llvm::Loop*,
std::allocator<llvm::Loop*> > >, llvm::LoopInfo&, llvm::DominatorTree&)
LoopExtractor.cpp:0:0
#12 0x00005568cde39e8b (anonymous
namespace)::LoopExtractor::runOnModule(llvm::Module&) LoopExtractor.cpp:0:0
#13 0x00005568cde3a22c (anonymous
namespace)::LoopExtractorLegacyPass::runOnModule(llvm::Module&)
LoopExtractor.cpp:0:0
#14 0x00005568cdcaa196 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2635196)
#15 0x00005568cbfebc0d main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x976c0d)
#16 0x00007f3dada3db97 __libc_start_main
/build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#17 0x00005568cc0b4eaa _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0xa3feaa)
Aborted (core dumped)

The source code of small.c is as follows.
--------------------------------------------------------
short a;
long b;
void c() {
  char d = 0;
  for (;;) {
    char e;
    if (b)
      break;
    for (; a;) {
      short f;
      if (d)
        continue;
    }
  }
}

-- 
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/20210313/9a20ff3b/attachment.html>


More information about the llvm-bugs mailing list