[llvm-bugs] [Bug 43581] New: nary-reassociate crashes: Assertion `S1->getType() == S2->getType() && "Cannot create binary operator with two operands of differing type!"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 6 19:06:04 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43581

            Bug ID: 43581
           Summary: nary-reassociate crashes: Assertion `S1->getType() ==
                    S2->getType() && "Cannot create binary operator with
                    two operands of differing type!"' 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 22635
  --> https://bugs.llvm.org/attachment.cgi?id=22635&action=edit
cat.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

$opt -instcombine -partial-inliner -globalopt -mem2reg -jump-threading
-callsite-splitting -inline -licm -nary-reassociate cat.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/IR/Instructions.cpp:2344:
static llvm::BinaryOperator*
llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value*,
llvm::Value*, const llvm::Twine&, llvm::Instruction*): Assertion `S1->getType()
== S2->getType() && "Cannot create binary operator with two operands of
differing type!"' failed.
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt -instcombine
-partial-inliner -globalopt -mem2reg -jump-threading -callsite-splitting
-inline -licm -nary-reassociate cat.bc 
1.      Running pass 'CallGraph Pass Manager' on module 'cat.bc'.
2.      Running pass 'Nary reassociation' on function '@main'
 #0 0x00005579be2b7baa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2791baa)
 #1 0x00005579be2b5884 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x278f884)
 #2 0x00005579be2b59c2 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x278f9c2)
 #3 0x00007f71ebc0c890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f71ea8bee97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f71ea8c0801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f71ea8b039a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007f71ea8b0412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x00005579bdbc9a9c
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20a3a9c)
 #9 0x00005579be125812
llvm::NaryReassociatePass::tryReassociatedBinaryOp(llvm::SCEV const*,
llvm::Value*, llvm::BinaryOperator*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x25ff812)
#10 0x00005579be12596c
llvm::NaryReassociatePass::tryReassociateBinaryOp(llvm::Value*, llvm::Value*,
llvm::BinaryOperator*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x25ff96c)
#11 0x00005579be1259be
llvm::NaryReassociatePass::tryReassociateBinaryOp(llvm::BinaryOperator*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x25ff9be)
#12 0x00005579be127e12
llvm::NaryReassociatePass::doOneIteration(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2601e12)
#13 0x00005579be129ae6 llvm::NaryReassociatePass::runImpl(llvm::Function&,
llvm::AssumptionCache*, llvm::DominatorTree*, llvm::ScalarEvolution*,
llvm::TargetLibraryInfo*, llvm::TargetTransformInfo*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2603ae6)
#14 0x00005579be129daf (anonymous
namespace)::NaryReassociateLegacyPass::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2603daf)
#15 0x00005579bdbf1a49 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20cba49)
#16 0x00005579bd4b53da (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x198f3da)
#17 0x00005579bdbf0ca1 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20caca1)
#18 0x00005579bc3bc01f main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x89601f)
#19 0x00007f71ea8a1b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#20 0x00005579bc43421a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x90e21a)
Aborted (core dumped)

The optimization sequence can be reduced to "-nary-reassociate" using bugpoint.

$opt bugpoint-reduced-simplified.bc -nary-reassociate
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/IR/Instructions.cpp:2344:
static llvm::BinaryOperator*
llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value*,
llvm::Value*, const llvm::Twine&, llvm::Instruction*): Assertion `S1->getType()
== S2->getType() && "Cannot create binary operator with two operands of
differing type!"' failed.
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt
bugpoint-reduced-simplified.bc -nary-reassociate 
1.      Running pass 'Function Pass Manager' on module
'bugpoint-reduced-simplified.bc'.
2.      Running pass 'Nary reassociation' on function '@main'
 #0 0x00005621cdb93baa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2791baa)
 #1 0x00005621cdb91884 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x278f884)
 #2 0x00005621cdb919c2 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x278f9c2)
 #3 0x00007f2a01068890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f29ffd1ae97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f29ffd1c801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f29ffd0c39a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007f29ffd0c412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x00005621cd4a5a9c
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20a3a9c)
 #9 0x00005621cda01812
llvm::NaryReassociatePass::tryReassociatedBinaryOp(llvm::SCEV const*,
llvm::Value*, llvm::BinaryOperator*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x25ff812)
#10 0x00005621cda01919
llvm::NaryReassociatePass::tryReassociateBinaryOp(llvm::Value*, llvm::Value*,
llvm::BinaryOperator*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x25ff919)
#11 0x00005621cda019be
llvm::NaryReassociatePass::tryReassociateBinaryOp(llvm::BinaryOperator*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x25ff9be)
#12 0x00005621cda03e12
llvm::NaryReassociatePass::doOneIteration(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2601e12)
#13 0x00005621cda05ae6 llvm::NaryReassociatePass::runImpl(llvm::Function&,
llvm::AssumptionCache*, llvm::DominatorTree*, llvm::ScalarEvolution*,
llvm::TargetLibraryInfo*, llvm::TargetTransformInfo*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2603ae6)
#14 0x00005621cda05daf (anonymous
namespace)::NaryReassociateLegacyPass::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2603daf)
#15 0x00005621cd4cda49 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20cba49)
#16 0x00005621cd4cdb19 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20cbb19)
#17 0x00005621cd4ccca1 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20caca1)
#18 0x00005621cbc9801f main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x89601f)
#19 0x00007f29ffcfdb97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#20 0x00005621cbd1021a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x90e21a)
Aborted (core dumped)

-- 
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/20191007/b6bb7f94/attachment-0001.html>


More information about the llvm-bugs mailing list