[llvm-bugs] [Bug 40626] New: "Assertion `Ty == cast<PointerType>(Ptr->getType())->getElementType()' failed." with -instcombine on "strlen(i16*)"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 6 03:54:13 PST 2019


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

            Bug ID: 40626
           Summary: "Assertion `Ty ==
                    cast<PointerType>(Ptr->getType())->getElementType()'
                    failed." with -instcombine on "strlen(i16*)"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 21439
  --> https://bugs.llvm.org/attachment.cgi?id=21439&action=edit
reproducer

Running

 opt -instcombine -S -o - call-strlen.ll

yields

opt: ../lib/IR/Instructions.cpp:1185: llvm::LoadInst::LoadInst(llvm::Type *,
llvm::Value *, const llvm::Twine &, bool, unsigned int, llvm::AtomicOrdering,
SyncScope::ID, llvm::Instruction *): Assertion `Ty ==
cast<PointerType>(Ptr->getType())->getElementType()' failed.
Stack dump:
0.      Program arguments: build-all/bin/opt -instcombine -S -o -
call-strlen.ll 
1.      Running pass 'Function Pass Manager' on module 'call-strlen.ll'.
2.      Running pass 'Combine redundant instructions' on function '@test_it'
 #0 0x00000000022ab7e4 PrintStackTraceSignalHandler(void*)
(build-all/bin/opt+0x22ab7e4)
 #1 0x00000000022a97f0 llvm::sys::RunSignalHandlers()
(build-all/bin/opt+0x22a97f0)
 #2 0x00000000022abb48 SignalHandler(int) (build-all/bin/opt+0x22abb48)
 #3 0x00007efebd1cf330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
 #4 0x00007efebbdbec37 gsignal
/build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
 #5 0x00007efebbdc2028 abort
/build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0
 #6 0x00007efebbdb7bf6 __assert_fail_base
/build/eglibc-ripdx6/eglibc-2.19/assert/assert.c:92:0
 #7 0x00007efebbdb7ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
 #8 0x0000000001c8f5eb llvm::LoadInst::LoadInst(llvm::Type*, llvm::Value*,
llvm::Twine const&, bool, unsigned int, llvm::AtomicOrdering, unsigned char,
llvm::Instruction*) (build-all/bin/opt+0x1c8f5eb)
 #9 0x0000000001c8f3a3 llvm::LoadInst::LoadInst(llvm::Type*, llvm::Value*,
llvm::Twine const&, llvm::Instruction*) (build-all/bin/opt+0x1c8f3a3)
#10 0x000000000239c053
llvm::LibCallSimplifier::optimizeStringLength(llvm::CallInst*,
llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&,
unsigned int) (build-all/bin/opt+0x239c053)
#11 0x00000000023a823c
llvm::LibCallSimplifier::optimizeStringMemoryLibCall(llvm::CallInst*,
llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&)
(build-all/bin/opt+0x23a823c)
#12 0x00000000023a91f8 llvm::LibCallSimplifier::optimizeCall(llvm::CallInst*)
(build-all/bin/opt+0x23a91f8)
#13 0x0000000001e606c6 llvm::InstCombiner::tryOptimizeCall(llvm::CallInst*)
(build-all/bin/opt+0x1e606c6)
#14 0x0000000001e5c164 llvm::InstCombiner::visitCallBase(llvm::CallBase&)
(build-all/bin/opt+0x1e5c164)
#15 0x0000000001e5a1f2 llvm::InstCombiner::visitCallInst(llvm::CallInst&)
(build-all/bin/opt+0x1e5a1f2)
#16 0x0000000001e1ad79 llvm::InstCombiner::run() (build-all/bin/opt+0x1e1ad79)
#17 0x0000000001e1ce11 combineInstructionsOverFunction(llvm::Function&,
llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::DominatorTree&,
llvm::OptimizationRemarkEmitter&, bool, llvm::LoopInfo*)
(build-all/bin/opt+0x1e1ce11)
#18 0x0000000001e1d4eb
llvm::InstructionCombiningPass::runOnFunction(llvm::Function&)
(build-all/bin/opt+0x1e1d4eb)
#19 0x0000000001caf3cd llvm::FPPassManager::runOnFunction(llvm::Function&)
(build-all/bin/opt+0x1caf3cd)
#20 0x0000000001caf688 llvm::FPPassManager::runOnModule(llvm::Module&)
(build-all/bin/opt+0x1caf688)
#21 0x0000000001cafaea llvm::legacy::PassManagerImpl::run(llvm::Module&)
(build-all/bin/opt+0x1cafaea)
#22 0x00000000007a322b main (build-all/bin/opt+0x7a322b)
#23 0x00007efebbda9f45 __libc_start_main
/build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0
#24 0x0000000000788c7d _start (build-all/bin/opt+0x788c7d)
Abort


This started happening after commit r352911 but possibly it was broken before
too, even if the reproducer above didn't trigger the assertion then.

Also see
 http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190204/624646.html
and the reply
 http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190204/624810.html

-- 
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/20190206/2b09b983/attachment-0001.html>


More information about the llvm-bugs mailing list