Created attachment 24211 [details] bc file about this bug ******************************************************************************* OS and Platform: CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux ******************************************************************************* Program: int a, b, c; char d, e; int f[10]; static int(g)() { return 0; } char h() { for (;; a) { int i = 0; for (; i; i++) f[i] = 9; if (g()) { long j=0; for (;; d) { int k=0; { short l=0; if (c) break; } if (e & 0) return b; } } } } int main() {} ******************************************************************************* clang version: $ clang --version clang version 12.0.0 (/home/suocy/src/llvm-dev/llvm-project/llvm/tools/clang abbf4802bb4fb519dce436ba16d90c3eeb1135b1) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/suocy/bin/llvm-dev/bin ******************************************************************************* Command Lines: $ clang -O3 -mllvm -disable-llvm-optzns -c -emit-llvm a.c -o a.bc a.c:6:11: warning: expression result unused [-Wunused-value] for (;; a) { ^ a.c:12:15: warning: expression result unused [-Wunused-value] for (;; d) { ^ 2 warnings generated. $ opt -mem2reg -simplifycfg -instcombine -jump-threading -correlated-propagation -lcssa -loop-rotate -loop-vectorize a.bc -o a.opt.bc PHI nodes must have at least one entry. If the block is dead, the PHI should be removed! %cleanup.dest.slot.3 = phi i32 opt: /home/suocy/src/llvm-dev/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8623: bool llvm::LoopVectorizePass::processLoop(llvm::Loop*): Assertion `!verifyFunction(*L->getHeader()->getParent(), &dbgs())' failed. PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: 0. Program arguments: /home/suocy/bin/llvm-dev/bin/opt -mem2reg -simplifycfg -instcombine -jump-threading -correlated-propagation -lcssa -loop-rotate -loop-vectorize a.bc -o a.opt.bc 1. Running pass 'Function Pass Manager' on module 'a.bc'. 2. Running pass 'Loop Vectorization' on function '@h' #0 0x0000000002a7842c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/suocy/bin/llvm-dev/bin/opt+0x2a7842c) #1 0x0000000002a762a4 llvm::sys::RunSignalHandlers() (/home/suocy/bin/llvm-dev/bin/opt+0x2a762a4) #2 0x0000000002a76403 SignalHandler(int) (/home/suocy/bin/llvm-dev/bin/opt+0x2a76403) #3 0x00007f5abdab9630 __restore_rt (/lib64/libpthread.so.0+0xf630) #4 0x00007f5abc6a7387 raise (/lib64/libc.so.6+0x36387) #5 0x00007f5abc6a8a78 abort (/lib64/libc.so.6+0x37a78) #6 0x00007f5abc6a01a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6) #7 0x00007f5abc6a0252 (/lib64/libc.so.6+0x2f252) #8 0x0000000002c5291f llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/home/suocy/bin/llvm-dev/bin/opt+0x2c5291f) #9 0x0000000002c53ab9 llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&, std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) (/home/suocy/bin/llvm-dev/bin/opt+0x2c53ab9) #10 0x0000000002c54354 (anonymous namespace)::LoopVectorize::runOnFunction(llvm::Function&) (/home/suocy/bin/llvm-dev/bin/opt+0x2c54354) #11 0x00000000022b7d38 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/suocy/bin/llvm-dev/bin/opt+0x22b7d38) #12 0x00000000022b87d9 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/suocy/bin/llvm-dev/bin/opt+0x22b87d9) #13 0x00000000022b75e3 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/suocy/bin/llvm-dev/bin/opt+0x22b75e3) #14 0x000000000072ba1b main (/home/suocy/bin/llvm-dev/bin/opt+0x72ba1b) #15 0x00007f5abc693555 __libc_start_main (/lib64/libc.so.6+0x22555) #16 0x00000000007dcc45 _start (/home/suocy/bin/llvm-dev/bin/opt+0x7dcc45) Aborted
Removed the assert: https://reviews.llvm.org/rG9eb2c0113dfe I tried for a possibly better fix with: https://reviews.llvm.org/D92247 ...but that caused other failures as noted in the reverting commit.