<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - gvn-hoist crashes: Assertion `i != -1 && "Should have found the basic block in the phi"' failed."
href="https://bugs.llvm.org/show_bug.cgi?id=43654">43654</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>gvn-hoist crashes: Assertion `i != -1 && "Should have found the basic block in the phi"' failed.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>cszide@163.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=22656" name="attach_22656" title="small.bc">attachment 22656</a> <a href="attachment.cgi?id=22656&action=edit" title="small.bc">[details]</a></span>
small.bc
$clang -v
clang version 10.0.0 (trunk 373844)
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
-o small.bc
$opt -newgvn -licm -lowerswitch -gvn-hoist small.bc
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/MemorySSAUpdater.cpp:283:
void setMemoryPhiValueForBlock(llvm::MemoryPhi*, const llvm::BasicBlock*,
llvm::MemoryAccess*): Assertion `i != -1 && "Should have found the basic block
in the phi"' failed.
Stack dump:
0. Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt -newgvn -licm
-lowerswitch -gvn-hoist small.bc
1. Running pass 'Function Pass Manager' on module 'small.bc'.
2. Running pass 'Early GVN Hoisting of Expressions' on function '@b'
#0 0x00005600c818bbaa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2791baa)
#1 0x00005600c8189884 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x278f884)
#2 0x00005600c81899c2 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x278f9c2)
#3 0x00007f8b66bc4890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x00007f8b65876e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f8b65878801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007f8b6586839a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#7 0x00007f8b65868412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#8 0x00005600c7487566
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x1a8d566)
#9 0x00005600c74927a2
llvm::MemorySSAUpdater::fixupDefs(llvm::SmallVectorImpl<llvm::WeakVH> const&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x1a987a2)
#10 0x00005600c7492cfb llvm::MemorySSAUpdater::insertDef(llvm::MemoryDef*,
bool)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x1a98cfb)
#11 0x00005600c7493b1f void
llvm::MemorySSAUpdater::moveTo<llvm::MemorySSA::InsertionPlace>(llvm::MemoryUseOrDef*,
llvm::BasicBlock*, llvm::MemorySSA::InsertionPlace)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x1a99b1f)
#12 0x00005600c7f0135c
llvm::GVNHoist::hoist(llvm::SmallVector<std::pair<llvm::BasicBlock*,
llvm::SmallVector<llvm::Instruction*, 4u> >, 4u>&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x250735c)
#13 0x00005600c7f09453 llvm::GVNHoist::hoistExpressions(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x250f453)
#14 0x00005600c7f099b2 llvm::GVNHoist::run(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x250f9b2)
#15 0x00005600c7f09e9a llvm::GVNHoistLegacyPass::runOnFunction(llvm::Function&)
(.part.602)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x250fe9a)
#16 0x00005600c7ac5a49 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20cba49)
#17 0x00005600c7ac5b19 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20cbb19)
#18 0x00005600c7ac4ca1 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20caca1)
#19 0x00005600c629001f main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x89601f)
#20 0x00007f8b65859b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#21 0x00005600c630821a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x90e21a)
Aborted (core dumped)
The optimization sequence can be reduced to "-gvn-hoist" using bugpoint.
$opt bugpoint-reduced-simplified.bc -gvn-hoist
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/MemorySSAUpdater.cpp:283:
void setMemoryPhiValueForBlock(llvm::MemoryPhi*, const llvm::BasicBlock*,
llvm::MemoryAccess*): Assertion `i != -1 && "Should have found the basic block
in the phi"' failed.
Stack dump:
0. Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt
bugpoint-reduced-simplified.bc -gvn-hoist
1. Running pass 'Function Pass Manager' on module
'bugpoint-reduced-simplified.bc'.
2. Running pass 'Early GVN Hoisting of Expressions' on function '@b'
#0 0x00005636ace7bbaa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2791baa)
#1 0x00005636ace79884 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x278f884)
#2 0x00005636ace799c2 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x278f9c2)
#3 0x00007fb8bea2f890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x00007fb8bd6e1e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007fb8bd6e3801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007fb8bd6d339a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#7 0x00007fb8bd6d3412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#8 0x00005636ac177566
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x1a8d566)
#9 0x00005636ac1827a2
llvm::MemorySSAUpdater::fixupDefs(llvm::SmallVectorImpl<llvm::WeakVH> const&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x1a987a2)
#10 0x00005636ac182cfb llvm::MemorySSAUpdater::insertDef(llvm::MemoryDef*,
bool)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x1a98cfb)
#11 0x00005636ac183b1f void
llvm::MemorySSAUpdater::moveTo<llvm::MemorySSA::InsertionPlace>(llvm::MemoryUseOrDef*,
llvm::BasicBlock*, llvm::MemorySSA::InsertionPlace)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x1a99b1f)
#12 0x00005636acbf135c
llvm::GVNHoist::hoist(llvm::SmallVector<std::pair<llvm::BasicBlock*,
llvm::SmallVector<llvm::Instruction*, 4u> >, 4u>&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x250735c)
#13 0x00005636acbf9453 llvm::GVNHoist::hoistExpressions(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x250f453)
#14 0x00005636acbf99b2 llvm::GVNHoist::run(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x250f9b2)
#15 0x00005636acbf9e9a llvm::GVNHoistLegacyPass::runOnFunction(llvm::Function&)
(.part.602)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x250fe9a)
#16 0x00005636ac7b5a49 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20cba49)
#17 0x00005636ac7b5b19 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20cbb19)
#18 0x00005636ac7b4ca1 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20caca1)
#19 0x00005636aaf8001f main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x89601f)
#20 0x00007fb8bd6c4b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#21 0x00005636aaff821a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x90e21a)
Aborted (core dumped)
---------------------------------------
long a;
void b() {
if (0)
c : {
int d;
for (; 3;) {
int e;
if (a)
goto c;
}
}
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>