[llvm-bugs] [Bug 43424] New: loop-unroll crashes: Assertion `&F == cast<Instruction>(VH)->getParent()->getParent() && "Cached assumption not inside this function!"' failed.
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Sep 24 01:40:11 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43424
Bug ID: 43424
Summary: loop-unroll crashes: Assertion `&F ==
cast<Instruction>(VH)->getParent()->getParent() &&
"Cached assumption not inside this function!"' 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 22556
--> https://bugs.llvm.org/attachment.cgi?id=22556&action=edit
.bc file of the source code
$clang -v
clang version 10.0.0 (trunk 372364)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/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 -instcombine -loop-load-elim -lowerswitch -simplifycfg -licm -loop-unroll
-loop-rotate -hotcoldsplit -loop-unroll small.bc -o small-opt.bc
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/lib/Analysis/AssumptionCache.cpp:212:
void llvm::AssumptionCache::registerAssumption(llvm::CallInst*): Assertion `&F
== cast<Instruction>(VH)->getParent()->getParent() && "Cached assumption not
inside this function!"' failed.
Stack dump:
0. Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt -instcombine
-loop-load-elim -lowerswitch -simplifycfg -licm -loop-unroll -loop-rotate
-hotcoldsplit -loop-unroll 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 'Unroll loops' on basic block '%for.body5.1'
#0 0x0000559fc4762dca llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x277adca)
#1 0x0000559fc4760aa4 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2778aa4)
#2 0x0000559fc4760be2 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2778be2)
#3 0x00007f31890b6890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x00007f3187d68e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f3187d6a801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007f3187d5a39a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#7 0x00007f3187d5a412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#8 0x0000559fc39192ee
llvm::AssumptionCache::registerAssumption(llvm::CallInst*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x19312ee)
#9 0x0000559fc4801b77 llvm::UnrollLoop(llvm::Loop*, llvm::UnrollLoopOptions,
llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::DominatorTree*,
llvm::AssumptionCache*, llvm::OptimizationRemarkEmitter*, bool, llvm::Loop**)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2819b77)
#10 0x0000559fc45a71d2 tryToUnrollLoop(llvm::Loop*, llvm::DominatorTree&,
llvm::LoopInfo*, llvm::ScalarEvolution&, llvm::TargetTransformInfo const&,
llvm::AssumptionCache&, llvm::OptimizationRemarkEmitter&,
llvm::BlockFrequencyInfo*, llvm::ProfileSummaryInfo*, bool, int, bool, bool,
llvm::Optional<unsigned int>, llvm::Optional<unsigned int>,
llvm::Optional<bool>, llvm::Optional<bool>, llvm::Optional<bool>,
llvm::Optional<bool>, llvm::Optional<bool>, llvm::Optional<unsigned int>)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x25bf1d2)
#11 0x0000559fc45a76b1 (anonymous
namespace)::LoopUnroll::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x25bf6b1)
#12 0x0000559fc3a3518b llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x1a4d18b)
#13 0x0000559fc40a22e9 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20ba2e9)
#14 0x0000559fc40a23e1 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20ba3e1)
#15 0x0000559fc40a1541 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20b9541)
#16 0x0000559fc2875aef main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x88daef)
#17 0x00007f3187d4bb97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#18 0x0000559fc28ed7ca _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x9057ca)
Aborted (core dumped)
By using bugpoint, the optimization sequence can be futher reduced to
"-loop-rotate -hotcoldsplit -loop-unroll".
opt bugpoint-reduced-simplified.bc -loop-rotate -hotcoldsplit -loop-unroll
WARNING: You're attempting to print out a bitcode file.
This is inadvisable as it may cause display problems. If
you REALLY want to taste LLVM bitcode first-hand, you
can force output with the `-f' option.
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/lib/Analysis/AssumptionCache.cpp:216:
void llvm::AssumptionCache::registerAssumption(llvm::CallInst*): Assertion
`AssumptionSet.insert(VH).second && "Cache contains multiple copies of a
call!"' failed.
Stack dump:
0. Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt
bugpoint-reduced-simplified.bc -loop-rotate -hotcoldsplit -loop-unroll
1. Running pass 'Function Pass Manager' on module
'bugpoint-reduced-simplified.bc'.
2. Running pass 'Loop Pass Manager' on function '@e'
3. Running pass 'Unroll loops' on basic block '%for.body5.1'
#0 0x00005579052abdca llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x277adca)
#1 0x00005579052a9aa4 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2778aa4)
#2 0x00005579052a9be2 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2778be2)
#3 0x00007f8720ae1890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x00007f871f793e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f871f795801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007f871f78539a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#7 0x00007f871f785412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#8 0x0000557904462331
llvm::AssumptionCache::registerAssumption(llvm::CallInst*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x1931331)
#9 0x000055790534ab77 llvm::UnrollLoop(llvm::Loop*, llvm::UnrollLoopOptions,
llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::DominatorTree*,
llvm::AssumptionCache*, llvm::OptimizationRemarkEmitter*, bool, llvm::Loop**)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2819b77)
#10 0x00005579050f01d2 tryToUnrollLoop(llvm::Loop*, llvm::DominatorTree&,
llvm::LoopInfo*, llvm::ScalarEvolution&, llvm::TargetTransformInfo const&,
llvm::AssumptionCache&, llvm::OptimizationRemarkEmitter&,
llvm::BlockFrequencyInfo*, llvm::ProfileSummaryInfo*, bool, int, bool, bool,
llvm::Optional<unsigned int>, llvm::Optional<unsigned int>,
llvm::Optional<bool>, llvm::Optional<bool>, llvm::Optional<bool>,
llvm::Optional<bool>, llvm::Optional<bool>, llvm::Optional<unsigned int>)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x25bf1d2)
#11 0x00005579050f06b1 (anonymous
namespace)::LoopUnroll::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x25bf6b1)
#12 0x000055790457e18b llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x1a4d18b)
#13 0x0000557904beb2e9 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20ba2e9)
#14 0x0000557904beb3e1 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20ba3e1)
#15 0x0000557904bea541 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20b9541)
#16 0x00005579033beaef main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x88daef)
#17 0x00007f871f776b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#18 0x00005579034367ca _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x9057ca)
Aborted (core dumped)
------------------------------------------------
short a;
char b;
int c, d;
void e() {
b = 0;
for (; b <= 1; b++) {
d = 1;
for (; d >= 0; d--) {
int f;
if (a)
break;
}
}
for (;;) {
char g;
if (c)
break;
}
}
--
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/20190924/1f3aefb6/attachment-0001.html>
More information about the llvm-bugs
mailing list