[llvm-bugs] [Bug 46054] New: LLVM Assertion Error/Segfault in GVN

via llvm-bugs llvm-bugs at lists.llvm.org
Sat May 23 21:12:39 PDT 2020


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

            Bug ID: 46054
           Summary: LLVM Assertion Error/Segfault in GVN
           Product: tools
           Version: 7.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: wmoses at mit.edu
                CC: llvm-bugs at lists.llvm.org

LLVM 7 has an internal error when running GVN on the following minimal test
case. This does not occur on LLVM 8, but results in major issues for a system
using LLVM 7.

$ opt -gvn fft-raw.ll

; ModuleID = 'fft-raw.ll'
source_filename = "fft.cpp"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @llvmerr(double* %data) {
entry:
  %luc = tail call noalias nonnull i64* @data()
  store i64 1, i64* %luc, !invariant.group !0
  %QQ = load i64, i64* %luc, !invariant.group !0
  call void @fn(i64 %QQ)
  br i1 true, label %A, label %B

A:                                                ; preds = %loop
  br label %B

B:                                                ; preds = %A, %loop
  %QQ.1 = load i64, i64* %luc, !invariant.group !0
  call void @fn(i64 %QQ.1)
  ret void
}

declare void @fn(i64)

declare noalias i64* @data()

!0 = distinct !{}


While deleting: i64 %QQ.1
An asserting value handle still pointed to this value!
UNREACHABLE executed at /home/wmoses/git/Enzyme/llvm/lib/IR/Value.cpp:887!
Stack dump:
0.      Program arguments: /home/wmoses/git/Enzyme/build/bin/opt -gvn -S
fft-raw.ll 
1.      Running pass 'Function Pass Manager' on module 'fft-raw.ll'.
2.      Running pass 'Global Value Numbering' on function '@llvmerr'
#0 0x0000559152e7e515 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/wmoses/git/Enzyme/llvm/lib/Support/Unix/Signals.inc:490:0
#1 0x0000559152e7e5a8 PrintStackTraceSignalHandler(void*)
/home/wmoses/git/Enzyme/llvm/lib/Support/Unix/Signals.inc:554:0
#2 0x0000559152e7c2e4 llvm::sys::RunSignalHandlers()
/home/wmoses/git/Enzyme/llvm/lib/Support/Signals.cpp:67:0
#3 0x0000559152e7df38 SignalHandler(int)
/home/wmoses/git/Enzyme/llvm/lib/Support/Unix/Signals.inc:353:0
#4 0x00007f24b35c6890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#5 0x00007f24b2277e97 gsignal
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#6 0x00007f24b2279801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#7 0x0000559152de4ff4 bindingsErrorHandler(void*,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, bool) /home/wmoses/git/Enzyme/llvm/lib/Support/ErrorHandling.cpp:231:0
#8 0x000055915269b8fc llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*)
/home/wmoses/git/Enzyme/llvm/lib/IR/Value.cpp:890:0
#9 0x0000559152697dd1 llvm::Value::~Value()
/home/wmoses/git/Enzyme/llvm/lib/IR/Value.cpp:77:0
#10 0x0000559151de67fc llvm::User::~User()
/home/wmoses/git/Enzyme/llvm/include/llvm/IR/User.h:95:0
#11 0x00005591525c96da llvm::Instruction::~Instruction()
/home/wmoses/git/Enzyme/llvm/lib/IR/Instruction.cpp:49:0
#12 0x000055915269cbcc llvm::UnaryInstruction::~UnaryInstruction()
/home/wmoses/git/Enzyme/llvm/include/llvm/IR/InstrTypes.h:280:0
#13 0x000055915269cbe8 llvm::LoadInst::~LoadInst()
/home/wmoses/git/Enzyme/llvm/include/llvm/IR/Instructions.h:168:0
#14 0x00005591526987df llvm::Value::deleteValue()
/home/wmoses/git/Enzyme/llvm/include/llvm/IR/Instruction.def:153:0
#15 0x00005591521e12d0
llvm::ilist_alloc_traits<llvm::Instruction>::deleteNode(llvm::Instruction*)
/home/wmoses/git/Enzyme/llvm/include/llvm/IR/Instruction.h:711:0
#16 0x00005591521e1d3f llvm::iplist_impl<llvm::simple_ilist<llvm::Instruction>,
llvm::SymbolTableListTraits<llvm::Instruction>
>::erase(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
true, false, void>, false, false>)
/home/wmoses/git/Enzyme/llvm/include/llvm/ADT/ilist.h:269:0
#17 0x00005591525c97ef llvm::Instruction::eraseFromParent()
/home/wmoses/git/Enzyme/llvm/lib/IR/Instruction.cpp:70:0
#18 0x0000559152b29862 llvm::GVN::processBlock(llvm::BasicBlock*)
/home/wmoses/git/Enzyme/llvm/lib/Transforms/Scalar/GVN.cpp:2109:0
#19 0x0000559152b2ad67 llvm::GVN::iterateOnFunction(llvm::Function&)
/home/wmoses/git/Enzyme/llvm/lib/Transforms/Scalar/GVN.cpp:2416:0
#20 0x0000559152b29406 llvm::GVN::runImpl(llvm::Function&,
llvm::AssumptionCache&, llvm::DominatorTree&, llvm::TargetLibraryInfo const&,
llvm::AAResults&, llvm::MemoryDependenceResults*, llvm::LoopInfo*,
llvm::OptimizationRemarkEmitter*)
/home/wmoses/git/Enzyme/llvm/lib/Transforms/Scalar/GVN.cpp:2046:0
#21 0x0000559152b2d898 llvm::gvn::GVNLegacyPass::runOnFunction(llvm::Function&)
/home/wmoses/git/Enzyme/llvm/lib/Transforms/Scalar/GVN.cpp:2635:0
#22 0x000055915260c74a llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/wmoses/git/Enzyme/llvm/lib/IR/LegacyPassManager.cpp:1586:0
#23 0x000055915260c90f llvm::FPPassManager::runOnModule(llvm::Module&)
/home/wmoses/git/Enzyme/llvm/lib/IR/LegacyPassManager.cpp:1609:0
#24 0x000055915260cce2 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/wmoses/git/Enzyme/llvm/lib/IR/LegacyPassManager.cpp:1669:0
#25 0x000055915260d46c llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/wmoses/git/Enzyme/llvm/lib/IR/LegacyPassManager.cpp:1774:0
#26 0x000055915260d69b llvm::legacy::PassManager::run(llvm::Module&)
/home/wmoses/git/Enzyme/llvm/lib/IR/LegacyPassManager.cpp:1806:0
#27 0x00005591517cad7b main
/home/wmoses/git/Enzyme/llvm/tools/opt/opt.cpp:827:0
#28 0x00007f24b225ab97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#29 0x000055915178ee8a _start (/home/wmoses/git/Enzyme/build/bin/opt+0xe9be8a)

-- 
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/20200524/993eafef/attachment-0001.html>


More information about the llvm-bugs mailing list