[llvm-bugs] [Bug 48061] New: Code sinking pass crashes with Assertion `NodeA && "A must be in the tree"' failed.
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Nov 3 06:13:13 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=48061
Bug ID: 48061
Summary: Code sinking pass crashes with Assertion `NodeA && "A
must be in the tree"' 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 24126
--> https://bugs.llvm.org/attachment.cgi?id=24126&action=edit
small.bc
$clang -v
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
ba10c514c9712b99197935a82f0df8d285752bdf)
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/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/7.5.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 -gvn -correlated-propagation -sink small.bc -o small-opt.bc
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/llvm/include/llvm/Support/GenericDomTree.h:483:
NodeT* llvm::DominatorTreeBase<N,
IsPostDom>::findNearestCommonDominator(NodeT*, NodeT*) const [with NodeT =
llvm::BasicBlock; bool IsPostDom = false]: Assertion `NodeA && "A must be in
the tree"' failed.
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 -gvn
-correlated-propagation -sink small.bc -o small-opt.bc
1. Running pass 'Function Pass Manager' on module 'small.bc'.
2. Running pass 'Code sinking' on function '@e'
#0 0x000056246397a8ec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2c1a8ec)
#1 0x00005624639785c4 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2c185c4)
#2 0x0000562463978733 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2c18733)
#3 0x00007f50df9298a0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
#4 0x00007f50de5dbf47 raise
/build/glibc-2ORdQG/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f50de5dd8b1 abort /build/glibc-2ORdQG/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007f50de5cd42a __assert_fail_base
/build/glibc-2ORdQG/glibc-2.27/assert/assert.c:89:0
#7 0x00007f50de5cd4a2 (/lib/x86_64-linux-gnu/libc.so.6+0x304a2)
#8 0x0000562463856a07 iterativelySinkInstructions(llvm::Function&,
llvm::DominatorTree&, llvm::LoopInfo&, llvm::AAResults&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2af6a07)
#9 0x0000562463199db8 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2439db8)
#10 0x000056246319a8b9 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x243a8b9)
#11 0x0000562463199636 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2439636)
#12 0x00005624615e7df4 main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x887df4)
#13 0x00007f50de5beb97 __libc_start_main
/build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#14 0x000056246169c43a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x93c43a)
Aborted (core dumped)
$cat small.c
int a[];
short b;
int d;
void e() {
for (;;) {
if (b) {
int c = d;
if (a)
continue;
}
-d;
}
}
This bug may be introduced by "int a[]". When I compile this program using
clang, it produces the following warnings.
$clang -O3 -c -emit-llvm -femit-all-decls -mllvm -disable-llvm-optzns small.c
-o small.bc
small.c:8:11: warning: address of array 'a' will always evaluate to 'true'
[-Wpointer-bool-conversion]
if (a)
~~ ^
small.c:11:5: warning: expression result unused [-Wunused-value]
-d;
^~
small.c:1:5: warning: tentative array definition assumed to have one element
int a[];
^
3 warnings generated.
However, if I change "int a[]" as "int a = 1", this bug is gone. In this case,
the 8th line is always true, which should be the same as the case for "int
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/20201103/89a9e4de/attachment-0001.html>
More information about the llvm-bugs
mailing list