llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Inliner crashing with "An asserting value handle still pointed to this value!"

Open mikaelholmen opened this issue 10 years ago • 4 comments

Bugzilla Link 27112
Resolution FIXED
Resolved on Jun 20, 2017 08:29
Version trunk
OS Linux
Attachments Reproducer ll file
CC @d0k,@chandlerc,@hfinkel,@uabjean

Extended Description

Running opt -S -globals-aa -early-cse -inline ./crash.ll -debug

opt crashes in the inliner:

Args: /data/repo/llvm-patch/build-all/bin/opt -S -globals-aa -early-cse -inline ./crash.ll -debug Inliner visiting SCC: INDIRECTNODE: 0 call sites. While deleting: void ()* %foo An asserting value handle still pointed to this value! UNREACHABLE executed at ../lib/IR/Value.cpp:744! #​0 0x00000000017a6ad8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/data/repo/llvm-patch/build-all/bin/opt+0x17a6ad8) #​1 0x00000000017a52a6 llvm::sys::RunSignalHandlers() (/data/repo/llvm-patch/build-all/bin/opt+0x17a52a6) #​2 0x00000000017a760a SignalHandler(int) (/data/repo/llvm-patch/build-all/bin/opt+0x17a760a) #​3 0x00007f7fdedb7340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340) #​4 0x00007f7fddfdfcc9 gsignal /build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0 #​5 0x00007f7fddfe30d8 abort /build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0 #​6 0x0000000001761ddd llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) (/data/repo/llvm-patch/build-all/bin/opt+0x1761ddd) #​7 0x00000000013ff8ae llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*) (/data/repo/llvm-patch/build-all/bin/opt+0x13ff8ae) #​8 0x00000000013ff17b llvm::Value::~Value() (/data/repo/llvm-patch/build-all/bin/opt+0x13ff17b) #​9 0x0000000001398c2d llvm::Function::~Function() (/data/repo/llvm-patch/build-all/bin/opt+0x1398c2d) #​10 0x0000000001398e79 llvm::Function::~Function() (/data/repo/llvm-patch/build-all/bin/opt+0x1398e79) #​11 0x000000000146466c llvm::Inliner::removeDeadFunctions(llvm::CallGraph&, bool) (/data/repo/llvm-patch/build-all/bin/opt+0x146466c) #​12 0x0000000000f90f36 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) (/data/repo/llvm-patch/build-all/bin/opt+0xf90f36) #​13 0x00000000013d09e5 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/data/repo/llvm-patch/build-all/bin/opt+0x13d09e5) #​14 0x00000000006314be main (/data/repo/llvm-patch/build-all/bin/opt+0x6314be) #​15 0x00007f7fddfcaec5 __libc_start_main /build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0 #​16 0x000000000061d37c _start (/data/repo/llvm-patch/build-all/bin/opt+0x61d37c) Stack dump: 0. Program arguments: /data/repo/llvm-patch/build-all/bin/opt -S -globals-aa -early-cse -inline ./crash.ll -debug

  1.  Running pass 'CallGraph Pass Manager' on module './crash.ll'.
    

Abort

mikaelholmen avatar Mar 29 '16 09:03 mikaelholmen

This problem was fixed or went into hiding after commit 55856262329: [PH] Replace uses of AssertingVH from members of analysis results with a lazy-asserting PoisoningVH.

I think the core issue remains, but I'm closing this issue.

uabjean avatar Jun 20 '17 15:06 uabjean

pass pipeline looks like this:

Target Library Information Target Transform Information Assumption Cache Tracker ModulePass Manager CallGraph Construction Globals Alias Analysis FunctionPass Manager Dominator Tree Construction Early CSE CallGraph Construction Call Graph SCC Pass Manager Function Integration/Inlining FunctionPass Manager Module Verifier Print module to stderr

We somehow never call releaseMemory on the first CallGraph, so it still has a handle to the function that gets deleted by the inliner later. The inliner correctly removes the function from the other call graph.

d0k avatar Mar 30 '16 16:03 d0k

Note that the input program is extremely simple:

define internal void @​foo() { ret void }

mikaelholmen avatar Mar 29 '16 10:03 mikaelholmen

Very similar to https://llvm.org/bugs/show_bug.cgi?id=27050

mikaelholmen avatar Mar 29 '16 09:03 mikaelholmen