[llvm-bugs] [Bug 43325] New: loop-unswitch crashes: Assertion `NewInst && "All instructions that are in SrcBB must be in VMap."' failed.
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 16 05:05:15 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43325
Bug ID: 43325
Summary: loop-unswitch crashes: Assertion `NewInst && "All
instructions that are in SrcBB must be in VMap."'
failed.
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 22506
--> https://bugs.llvm.org/attachment.cgi?id=22506&action=edit
.bc file of the source code
$clang -v
clang version 10.0.0 (trunk 371952)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/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.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$clang -O3 -c -emit-llvm -femit-all-decls -mllvm -disable-llvm-optzns small.c
$opt -mem2reg -simplifycfg -loop-simplifycfg -loop-unswitch small.bc -o
small-opt.bc
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/lib/Transforms/Scalar/LoopUnswitch.cpp:380:
void {anonymous}::LUAnalysisCache::cloneData(const llvm::Loop*, const
llvm::Loop*, const ValueToValueMapTy&): Assertion `NewInst && "All instructions
that are in SrcBB must be in VMap."' failed.
Stack dump:
0. Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt -mem2reg
-simplifycfg -loop-simplifycfg -loop-unswitch small.bc -o small-opt.bc
1. Running pass 'Function Pass Manager' on module 'small.bc'.
2. Running pass 'Loop Pass Manager' on function '@e'
3. Running pass 'Unswitch loops' on basic block '%for.cond.us'
#0 0x000055ed5b1b127a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x277727a)
#1 0x000055ed5b1aef54 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x2774f54)
#2 0x000055ed5b1af092 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x2775092)
#3 0x00007f6629376890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x00007f6628028e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f662802a801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007f662801a39a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#7 0x00007f662801a412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#8 0x000055ed5affe6d5 (anonymous
namespace)::LUAnalysisCache::cloneData(llvm::Loop const*, llvm::Loop const*,
llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH,
llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >
const&) (.isra.503)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x25c46d5)
#9 0x000055ed5afff9e9 (anonymous
namespace)::LoopUnswitch::UnswitchNontrivialCondition(llvm::Value*,
llvm::Constant*, llvm::Loop*, llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x25c59e9)
#10 0x000055ed5b000c60 (anonymous
namespace)::LoopUnswitch::UnswitchIfProfitable(llvm::Value*, llvm::Constant*,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x25c6c60)
#11 0x000055ed5b001e71 (anonymous
namespace)::LoopUnswitch::processCurrentLoop()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x25c7e71)
#12 0x000055ed5b002947 (anonymous
namespace)::LoopUnswitch::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x25c8947)
#13 0x000055ed5a48442b llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x1a4a42b)
#14 0x000055ed5aaf0de9 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6de9)
#15 0x000055ed5aaf0ee1 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6ee1)
#16 0x000055ed5aaf0041 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6041)
#17 0x000055ed592c974f main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x88f74f)
#18 0x00007f662800bb97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#19 0x000055ed5934154a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x90754a)
Aborted (core dumped)
By using bugpoint, the optimization sequences can be reduced to
"-loop-simplifycfg -loop-unswitch"
$opt bugpoint-reduced-simplified.bc -loop-simplifycfg -loop-unswitch
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/lib/Transforms/Scalar/LoopUnswitch.cpp:380:
void {anonymous}::LUAnalysisCache::cloneData(const llvm::Loop*, const
llvm::Loop*, const ValueToValueMapTy&): Assertion `NewInst && "All instructions
that are in SrcBB must be in VMap."' failed.
Stack dump:
0. Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt
bugpoint-reduced-simplified.bc -loop-simplifycfg -loop-unswitch
1. Running pass 'Function Pass Manager' on module
'bugpoint-reduced-simplified.bc'.
2. Running pass 'Loop Pass Manager' on function '@e'
3. Running pass 'Unswitch loops' on basic block '%for.cond.us'
#0 0x000055898fb9927a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x277727a)
#1 0x000055898fb96f54 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x2774f54)
#2 0x000055898fb97092 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x2775092)
#3 0x00007f73f9df1890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x00007f73f8aa3e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f73f8aa5801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007f73f8a9539a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#7 0x00007f73f8a95412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#8 0x000055898f9e66d5 (anonymous
namespace)::LUAnalysisCache::cloneData(llvm::Loop const*, llvm::Loop const*,
llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH,
llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >
const&) (.isra.503)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x25c46d5)
#9 0x000055898f9e79e9 (anonymous
namespace)::LoopUnswitch::UnswitchNontrivialCondition(llvm::Value*,
llvm::Constant*, llvm::Loop*, llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x25c59e9)
#10 0x000055898f9e8c60 (anonymous
namespace)::LoopUnswitch::UnswitchIfProfitable(llvm::Value*, llvm::Constant*,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x25c6c60)
#11 0x000055898f9e9e71 (anonymous
namespace)::LoopUnswitch::processCurrentLoop()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x25c7e71)
#12 0x000055898f9ea947 (anonymous
namespace)::LoopUnswitch::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x25c8947)
#13 0x000055898ee6c42b llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x1a4a42b)
#14 0x000055898f4d8de9 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6de9)
#15 0x000055898f4d8ee1 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6ee1)
#16 0x000055898f4d8041 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6041)
#17 0x000055898dcb174f main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x88f74f)
#18 0x00007f73f8a86b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#19 0x000055898dd2954a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x90754a)
Aborted (core dumped)
---------------------------------
int a, b, c, d;
int *e(int f) {
if (d)
g:
for (;;) {
short h;
if (f)
goto g;
{
int i;
for (; 4;)
return &b;
if (c)
continue;
}
}
return &a;
}
--
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/20190916/c084e8fe/attachment-0001.html>
More information about the llvm-bugs
mailing list