[llvm-bugs] [Bug 47482] New: [bdver2] Assertion failed: (Op->getNodeId() != -1 && "Node has already selected predecessor node"), function DoInstructionSelection, file llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp, line 1122.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 10 05:13:58 PDT 2020


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

            Bug ID: 47482
           Summary: [bdver2] Assertion failed: (Op->getNodeId() != -1 &&
                    "Node has already selected predecessor node"),
                    function DoInstructionSelection, file
                    llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp,
                    line 1122.
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

I got a report on a clang assertion with one source file from the
project_painter project [1], when compiled for -march=bdver[2-4], resulting in:

Assertion failed: (Op->getNodeId() != -1 && "Node has already selected
predecessor node"), function DoInstructionSelection, file
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp, line 1122.

Note that this does *not* assert with other CPU targets.

Minimized test case:

// clang -cc1 -triple x86_64-- -S -target-cpu bdver2 -O2 lzw-min.c
int a, d, f;
struct b {
  int c;
  int buf;
};
void *e;
int g() {
  struct b *h, *i = e;
  if (e) {
    int b = 1, j, c;
    h = i;
    asm("" : "=r"(d) : "r"(a));
    j = 1 << d;
    b &= j;
    h->buf |= b << 1;
    h->c = 0;
    asm("" : "=r"(d));
    c = j = (1 << d) - 1;
    f &= j;
    h->buf |= f;
  }
  return 0;
}

Stack dump:
0.      Program arguments:
/ins/llvmorg-12-init-5388-gfc49abee567-linux5-x86_64-ninja-gcc-dbg-1/bin/clang
-cc1 -triple x86_64-- -S -target-cpu bdver2 -O2 lzw-min.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'lzw-min.c'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@g'
 #0 0x0000562f94369810 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/src/llvm-project/llvm/lib/Support/Unix/Signals.inc:563:22
 #1 0x0000562f943698b8 PrintStackTraceSignalHandler(void*)
/src/llvm-project/llvm/lib/Support/Unix/Signals.inc:627:1
 #2 0x0000562f94367627 llvm::sys::RunSignalHandlers()
/src/llvm-project/llvm/lib/Support/Signals.cpp:70:20
 #3 0x0000562f9436915d SignalHandler(int)
/src/llvm-project/llvm/lib/Support/Unix/Signals.inc:405:1
 #4 0x00007f0db92913c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #5 0x00007f0db8d3118b raise
/build/glibc-YYA7BZ/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #6 0x00007f0db8d10859 abort /build/glibc-YYA7BZ/glibc-2.31/stdlib/abort.c:81:7
 #7 0x00007f0db8d10729 get_sysdep_segment_value
/build/glibc-YYA7BZ/glibc-2.31/intl/loadmsgcat.c:509:8
 #8 0x00007f0db8d10729 _nl_load_domain
/build/glibc-YYA7BZ/glibc-2.31/intl/loadmsgcat.c:970:34
 #9 0x00007f0db8d21f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
#10 0x0000562f95838653 llvm::SelectionDAGISel::DoInstructionSelection()
/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1121:13
#11 0x0000562f95837b17 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:941:61
#12 0x0000562f95836253
llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
true, false, void>, false, true>,
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true,
false, void>, false, true>, bool&)
/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:710:1
#13 0x0000562f9583af35
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1595:33
#14 0x0000562f95834dfb
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:505:7
#15 0x0000562f92a503fe (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
/src/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:190:14
#16 0x0000562f9333f97d
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/src/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:73:33
#17 0x0000562f93a03e60 llvm::FPPassManager::runOnFunction(llvm::Function&)
/src/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1519:20
#18 0x0000562f93a04129 llvm::FPPassManager::runOnModule(llvm::Module&)
/src/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1565:13
#19 0x0000562f93a0459b (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/src/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1634:20
#20 0x0000562f939ff4c4 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/src/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:615:13
#21 0x0000562f93a04e73 llvm::legacy::PassManager::run(llvm::Module&)
/src/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1762:1
#22 0x0000562f94723e52 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/src/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:988:51
#23 0x0000562f94728c03 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/src/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1711:27
#24 0x0000562f9595bd6a
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/src/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:335:24
#25 0x0000562f9757c071 clang::ParseAST(clang::Sema&, bool, bool)
/src/llvm-project/clang/lib/Parse/ParseAST.cpp:178:14
#26 0x0000562f94fd50b5 clang::ASTFrontendAction::ExecuteAction()
/src/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1057:11
#27 0x0000562f95958f5d clang::CodeGenAction::ExecuteAction()
/src/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1183:1
#28 0x0000562f94fd4a0c clang::FrontendAction::Execute()
/src/llvm-project/clang/lib/Frontend/FrontendAction.cpp:954:38
#29 0x0000562f94f661b9
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/src/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:984:42
#30 0x0000562f9516b519
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/src/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:38
#31 0x0000562f929509c6 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /src/llvm-project/clang/tools/driver/cc1_main.cpp:240:40
#32 0x0000562f92945863 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/src/llvm-project/clang/tools/driver/driver.cpp:330:20
#33 0x0000562f92946029 main
/src/llvm-project/clang/tools/driver/driver.cpp:407:26
#34 0x00007f0db8d120b3 __libc_start_main
/build/glibc-YYA7BZ/glibc-2.31/csu/../csu/libc-start.c:342:3
#35 0x0000562f92943efe _start
(/ins/llvmorg-12-init-5388-gfc49abee567-linux5-x86_64-ninja-gcc-dbg-1/bin/clang+0x25b5efe)

[1] https://wiki.ros.org/portrait_painter

-- 
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/20200910/d3d99ac8/attachment.html>


More information about the llvm-bugs mailing list