LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 49576 - UNREACHABLE executed at LoopFuse.cpp:416!
Summary: UNREACHABLE executed at LoopFuse.cpp:416!
Status: NEW
Alias: None
Product: libraries
Classification: Unclassified
Component: Scalar Optimizations (show other bugs)
Version: trunk
Hardware: PC Linux
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-13 02:34 PST by Zhide Zhou
Modified: 2021-04-01 16:48 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
small.bc (2.63 KB, application/octet-stream)
2021-03-13 02:34 PST, Zhide Zhou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zhide Zhou 2021-03-13 02:34:46 PST
Created attachment 24641 [details]
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 -sroa -loop-unswitch  -loop-rotate -early-cse -loop-fusion small.bc -o small-opt.bc
No dominance relationship between these fusion candidates!
UNREACHABLE executed at /home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/llvm/lib/Transforms/Scalar/LoopFuse.cpp:416!
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 -sroa -loop-unswitch -loop-rotate -early-cse -loop-fusion small.bc -o small-opt.bc
1.	Running pass 'Function Pass Manager' on module 'small.bc'.
2.	Running pass 'Loop Fusion' on function '@main'
 #0 0x0000562b92ed05ec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2e865ec)
 #1 0x0000562b92ece2b4 llvm::sys::RunSignalHandlers() (/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2e842b4)
 #2 0x0000562b92ece423 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f66754688a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #4 0x00007f66740cff47 raise /build/glibc-2ORdQG/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f66740d18b1 abort /build/glibc-2ORdQG/glibc-2.27/stdlib/abort.c:81:0
 #6 0x0000562b92e2faca (/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2de5aca)
 #7 0x0000562b92dbf8ba (anonymous namespace)::FusionCandidateCompare::operator()((anonymous namespace)::FusionCandidate const&, (anonymous namespace)::FusionCandidate const&) const (.isra.76) LoopFuse.cpp:0:0
 #8 0x0000562b92dc222b std::pair<std::_Rb_tree_iterator<(anonymous namespace)::FusionCandidate>, bool> std::_Rb_tree<(anonymous namespace)::FusionCandidate, (anonymous namespace)::FusionCandidate, std::_Identity<(anonymous namespace)::FusionCandidate>, (anonymous namespace)::FusionCandidateCompare, std::allocator<(anonymous namespace)::FusionCandidate> >::_M_insert_unique<(anonymous namespace)::FusionCandidate const&>((anonymous namespace)::FusionCandidate const&) LoopFuse.cpp:0:0
 #9 0x0000562b92dc287a (anonymous namespace)::LoopFuser::collectFusionCandidates(llvm::SmallVector<llvm::Loop*, 4u> const&) LoopFuse.cpp:0:0
#10 0x0000562b92dcaaeb (anonymous namespace)::LoopFuser::fuseLoops(llvm::Function&) LoopFuse.cpp:0:0
#11 0x0000562b92dcca63 (anonymous namespace)::LoopFuseLegacy::runOnFunction(llvm::Function&) LoopFuse.cpp:0:0
#12 0x0000562b9267f918 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2635918)
#13 0x0000562b92680449 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2636449)
#14 0x0000562b9267f196 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2635196)
#15 0x0000562b909c0c0d main (/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x976c0d)
#16 0x00007f66740b2b97 __libc_start_main /build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#17 0x0000562b90a89eaa _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.
--------------------------------------------------------
void main() {
  int a, b, c = a = b = 0;
  for (; b < 9; b++)
    if (c)
      ;
  for (; a < 3; a++)
    if (c)
      ;
}