[llvm-bugs] [Bug 43514] New: AssertingVH error in BypassSlowDivisions on dead srem instruction

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 30 13:38:21 PDT 2019


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

            Bug ID: 43514
           Summary: AssertingVH error in BypassSlowDivisions on dead srem
                    instruction
           Product: libraries
           Version: 9.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: andrew at scheidecker.net
                CC: llvm-bugs at lists.llvm.org

Created attachment 22609
  --> https://bugs.llvm.org/attachment.cgi?id=22609&action=edit
crash2.ll

To reproduce (in a debug build, or with assertions enabled):

  llc crash2.ll -O2 -mcpu=sandybridge

crash2.ll:

  target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"

  define fastcc void @functionDef0(i8*, i64) {
  entry:
    %2 = load i8, i8* %0, align 1
    %3 = zext i8 %2 to i64
    %4 = srem i64 %1, %3
    ret void
  }

The essential ingredients seem to be:
  - A 64-bit div/rem that can be optimized to a narrower div/rem
  - The div/rem must be trivially dead. If I change @functionDef0 to return the
result of the srem, then there's no error.
  - Targeting a CPU that has the "slow 64-bit division" feature flag. Whatever
the default target CPU is for X86 doesn't have this problem. I tried
sandybridge, atom, and skylake-avx512, and they all triggered this error.
  - A debug build (or possibly a release build with assertions enabled, but I
haven't tested that)


The error message + call stack:

While deleting: i64 %
An asserting value handle still pointed to this value!
UNREACHABLE executed at C:\Dev\llvm9\llvm\lib\IR\Value.cpp:905!
Stack dump:
0.      Program arguments: llc C:\Build\crash2.ll -O2 -mcpu=sandybridge
1.      Running pass 'Function Pass Manager' on module 'C:\Build\crash2.ll'.
2.      Running pass 'CodeGen Prepare' on function '@functionDef0'
 #0 0x00007ff76959a23c HandleAbort
C:\Dev\llvm9\llvm\lib\Support\Windows\Signals.inc:408:0
 #1 0x00007ffa54b6c3e1 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x6c3e1)
 #2 0x00007ffa54b6e039 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x6e039)
 #3 0x00007ff769487b93 llvm::llvm_unreachable_internal(char const *,char const
*,unsigned int) C:\Dev\llvm9\llvm\lib\Support\ErrorHandling.cpp:215:0
 #4 0x00007ff76862be45 llvm::ValueHandleBase::ValueIsDeleted(class llvm::Value
*) C:\Dev\llvm9\llvm\lib\IR\Value.cpp:908:0
 #5 0x00007ff768627d37 llvm::Value::~Value(void)
C:\Dev\llvm9\llvm\lib\IR\Value.cpp:76:0
 #6 0x00007ff767c071e8 llvm::User::~User(void)
C:\Dev\llvm9\llvm\include\llvm\IR\Constant.h:185:0
 #7 0x00007ff7689091f8 llvm::Instruction::~Instruction(void)
C:\Dev\llvm9\llvm\lib\IR\Instruction.cpp:48:0
 #8 0x00007ff768632908 llvm::UnaryInstruction::~UnaryInstruction(void)
(C:\Build\llvm9\Debug\bin\llc.exe+0x1622908)
 #9 0x00007ff768631978 llvm::CastInst::~CastInst(void)
(C:\Build\llvm9\Debug\bin\llc.exe+0x1621978)
#10 0x00007ff768632a48 llvm::ZExtInst::~ZExtInst(void)
C:\Dev\llvm9\llvm\include\llvm\IR\GlobalVariable.h:78:0
#11 0x00007ff76863571c llvm::ZExtInst::`scalar deleting destructor'(unsigned
int) C:\Dev\llvm9\llvm\include\llvm\ADT\DenseMap.h:1266:0
#12 0x00007ff768629001 llvm::Value::deleteValue(void)
C:\Dev\llvm9\llvm\include\llvm\IR\Instruction.def:185:0
#13 0x00007ff768495878 llvm::ilist_alloc_traits<class
llvm::Instruction>::deleteNode(class llvm::Instruction *)
C:\Dev\llvm9\llvm\include\llvm\IR\Instruction.h:775:0
#14 0x00007ff768495a0f llvm::iplist_impl<class llvm::simple_ilist<class
llvm::Instruction>,class llvm::SymbolTableListTraits<class llvm::Instruction>
>::erase(class llvm::ilist_iterator<struct
llvm::ilist_detail::node_options<class llvm::Instruction,0,0,void>,0,0>)
C:\Dev\llvm9\llvm\include\llvm\ADT\ilist.h:267:0
#15 0x00007ff768909365 llvm::Instruction::eraseFromParent(void)
C:\Dev\llvm9\llvm\lib\IR\Instruction.cpp:68:0
#16 0x00007ff76962b0b0 llvm::RecursivelyDeleteTriviallyDeadInstructions(class
llvm::SmallVectorImpl<class llvm::Instruction *> &,class
llvm::TargetLibraryInfo const *,class llvm::MemorySSAUpdater *)
C:\Dev\llvm9\llvm\lib\Transforms\Utils\Local.cpp:480:0
#17 0x00007ff76962ae6a llvm::RecursivelyDeleteTriviallyDeadInstructions(class
llvm::Value *,class llvm::TargetLibraryInfo const *,class
llvm::MemorySSAUpdater *)
C:\Dev\llvm9\llvm\lib\Transforms\Utils\Local.cpp:444:0
#18 0x00007ff76968bb3e llvm::bypassSlowDivision(class llvm::BasicBlock *,class
llvm::DenseMap<unsigned int,unsigned int,struct llvm::DenseMapInfo<unsigned
int>,struct llvm::detail::DenseMapPair<unsigned int,unsigned int> > const &)
C:\Dev\llvm9\llvm\lib\Transforms\Utils\BypassSlowDivision.cpp:471:0
#19 0x00007ff768179e82 `anonymous namespace'::CodeGenPrepare::runOnFunction
C:\Dev\llvm9\llvm\lib\CodeGen\CodeGenPrepare.cpp:454:0
#20 0x00007ff7686f980b llvm::FPPassManager::runOnFunction(class llvm::Function
&) C:\Dev\llvm9\llvm\lib\IR\LegacyPassManager.cpp:1648:0
#21 0x00007ff7686f9c0c llvm::FPPassManager::runOnModule(class llvm::Module &)
C:\Dev\llvm9\llvm\lib\IR\LegacyPassManager.cpp:1685:0
#22 0x00007ff7686fb259 `anonymous namespace'::MPPassManager::runOnModule
C:\Dev\llvm9\llvm\lib\IR\LegacyPassManager.cpp:1750:0
#23 0x00007ff7686fbcbc llvm::legacy::PassManagerImpl::run(class llvm::Module &)
C:\Dev\llvm9\llvm\lib\IR\LegacyPassManager.cpp:1863:0
#24 0x00007ff7686f3716 llvm::legacy::PassManager::run(class llvm::Module &)
C:\Dev\llvm9\llvm\lib\IR\LegacyPassManager.cpp:1895:0
#25 0x00007ff7671bd601 compileModule C:\Dev\llvm9\llvm\tools\llc\llc.cpp:603:0
#26 0x00007ff7671be704 main C:\Dev\llvm9\llvm\tools\llc\llc.cpp:355:0
#27 0x00007ff769ef6879 invoke_main
d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:79:0
#28 0x00007ff769ef675e __scrt_common_main_seh
d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
#29 0x00007ff769ef661e __scrt_common_main
d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331:0
#30 0x00007ff769ef6909 mainCRTStartup
d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0
#31 0x00007ffacfae7bd4 (C:\WINDOWS\System32\KERNEL32.DLL+0x17bd4)
#32 0x00007ffad15aced1 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x6ced1)

-- 
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/20190930/139c0a2b/attachment.html>


More information about the llvm-bugs mailing list