[llvm-bugs] [Bug 43489] New: instcombine crashes: Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 27 23:53:47 PDT 2019


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

            Bug ID: 43489
           Summary: instcombine crashes: Assertion `New->getType() ==
                    getType() && "replaceAllUses of value with new value
                    of different 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 22594
  --> https://bugs.llvm.org/attachment.cgi?id=22594&action=edit
sproto.bc

This bug is triggered by the program sproto.bc extracted from skynet-1.1.0. I
found that there are many bugs with the same failed assertion, such as bug
34627, but they are fixed.

$clang -v
clang version 10.0.0 (trunk 373138)
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 -sroa -load-store-vectorizer -loop-instsimplify -reg2mem -instcombine
-sroa -instcombine sproto.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/Value.cpp:403: void
llvm::Value::doRAUW(llvm::Value*, llvm::Value::ReplaceMetadataUses): Assertion
`New->getType() == getType() && "replaceAllUses of value with new value of
different type!"' failed.
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt -sroa
-load-store-vectorizer -loop-instsimplify -reg2mem -instcombine -sroa
-instcombine sproto.bc 
1.      Running pass 'Function Pass Manager' on module 'sproto.bc'.
2.      Running pass 'Combine redundant instructions' on function
'@encode_integer_array'
 #0 0x000055d25bb7d0da llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x27860da)
 #1 0x000055d25bb7adb4 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2783db4)
 #2 0x000055d25bb7aef2 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2783ef2)
 #3 0x00007efc794ec890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007efc7819ee97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007efc781a0801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007efc7819039a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007efc78190412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x000055d25b516a69 llvm::Value::doRAUW(llvm::Value*,
llvm::Value::ReplaceMetadataUses)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x211fa69)
 #9 0x000055d25b6cc348 rewriteGEPAsOffset(llvm::Value*, llvm::Value*,
llvm::DataLayout const&, llvm::SetVector<llvm::Value*,
std::vector<llvm::Value*, std::allocator<llvm::Value*> >,
llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*> > >&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x22d5348)
#10 0x000055d25b6ce019 transformToIndexedCompare(llvm::GEPOperator*,
llvm::Value*, llvm::CmpInst::Predicate, llvm::DataLayout const&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x22d7019)
#11 0x000055d25b6ce3c7 llvm::InstCombiner::foldGEPICmp(llvm::GEPOperator*,
llvm::Value*, llvm::CmpInst::Predicate, llvm::Instruction&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x22d73c7)
#12 0x000055d25b6d406e llvm::InstCombiner::visitICmpInst(llvm::ICmpInst&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x22dd06e)
#13 0x000055d25b66eba6 llvm::InstCombiner::run()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2277ba6)
#14 0x000055d25b6711ea combineInstructionsOverFunction(llvm::Function&,
llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::DominatorTree&,
llvm::OptimizationRemarkEmitter&, llvm::BlockFrequencyInfo*,
llvm::ProfileSummaryInfo*, bool, llvm::LoopInfo*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x227a1ea)
#15 0x000055d25b671801
llvm::InstructionCombiningPass::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x227a801)
#16 0x000055d25b4ba609 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20c3609)
#17 0x000055d25b4ba701 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20c3701)
#18 0x000055d25b4b9861 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20c2861)
#19 0x000055d259c88bef main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x891bef)
#20 0x00007efc78181b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#21 0x000055d259d00e8a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x909e8a)
Aborted (core dumped)

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

$opt bugpoint-reduced-simplified.bc -instcombine
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/Value.cpp:403: void
llvm::Value::doRAUW(llvm::Value*, llvm::Value::ReplaceMetadataUses): Assertion
`New->getType() == getType() && "replaceAllUses of value with new value of
different type!"' failed.
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt
bugpoint-reduced-simplified.bc -instcombine 
1.      Running pass 'Function Pass Manager' on module
'bugpoint-reduced-simplified.bc'.
2.      Running pass 'Combine redundant instructions' on function
'@encode_integer_array'
 #0 0x00005620325eb0da llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x27860da)
 #1 0x00005620325e8db4 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2783db4)
 #2 0x00005620325e8ef2 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2783ef2)
 #3 0x00007f3fac72a890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f3fab3dce97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f3fab3de801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f3fab3ce39a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007f3fab3ce412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x0000562031f84a69 llvm::Value::doRAUW(llvm::Value*,
llvm::Value::ReplaceMetadataUses)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x211fa69)
 #9 0x000056203213a348 rewriteGEPAsOffset(llvm::Value*, llvm::Value*,
llvm::DataLayout const&, llvm::SetVector<llvm::Value*,
std::vector<llvm::Value*, std::allocator<llvm::Value*> >,
llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*> > >&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x22d5348)
#10 0x000056203213c019 transformToIndexedCompare(llvm::GEPOperator*,
llvm::Value*, llvm::CmpInst::Predicate, llvm::DataLayout const&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x22d7019)
#11 0x000056203213c3c7 llvm::InstCombiner::foldGEPICmp(llvm::GEPOperator*,
llvm::Value*, llvm::CmpInst::Predicate, llvm::Instruction&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x22d73c7)
#12 0x000056203214206e llvm::InstCombiner::visitICmpInst(llvm::ICmpInst&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x22dd06e)
#13 0x00005620320dcba6 llvm::InstCombiner::run()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x2277ba6)
#14 0x00005620320df1ea combineInstructionsOverFunction(llvm::Function&,
llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::DominatorTree&,
llvm::OptimizationRemarkEmitter&, llvm::BlockFrequencyInfo*,
llvm::ProfileSummaryInfo*, bool, llvm::LoopInfo*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x227a1ea)
#15 0x00005620320df801
llvm::InstructionCombiningPass::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x227a801)
#16 0x0000562031f28609 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20c3609)
#17 0x0000562031f28701 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20c3701)
#18 0x0000562031f27861 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x20c2861)
#19 0x00005620306f6bef main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x891bef)
#20 0x00007f3fab3bfb97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#21 0x000056203076ee8a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build10/bin/opt+0x909e8a)
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/20190928/78899651/attachment-0001.html>


More information about the llvm-bugs mailing list