New user self-registration is disabled due to spam. For an account please email bugs-admin@lists.llvm.org with your e-mail address and full name.

Bug 30354 - mul i1024 crashes llc
Summary: mul i1024 crashes llc
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Paweł Bylica
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-12 12:14 PDT by Paweł Bylica
Modified: 2016-09-14 02:50 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paweł Bylica 2016-09-12 12:14:45 PDT
This test (based on test/CodeGen/X86/mul-i256.ll)

; RUN: llc < %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @test(i1024* %a, i1024* %b, i1024* %out) #0 {
entry:
  %av = load i1024, i1024* %a
  %bv = load i1024, i1024* %b
  %r = mul i1024 %av, %bv
  store i1024 %r, i1024* %out
  ret void
}

attributes #0 = { norecurse nounwind uwtable "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" }

crashes llc with

llc: /home/chfast/Projects/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1085: llvm::SDValue llvm::SelectionDAG::getConstant(uint64_t, const llvm::SDLoc&, llvm::EVT, bool, bool): Assertion `(EltVT.getSizeInBits() >= 64 || (uint64_t)((int64_t)Val >> EltVT.getSizeInBits()) + 1 < 2) && "getConstant with a uint64_t value that doesn't fit in the type!"' failed.
#0 0x000000000293425a llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/chfast/Projects/llvm/llvm/lib/Support/Unix/Signals.inc:402:0
#1 0x00000000029345f9 PrintStackTraceSignalHandler(void*) /home/chfast/Projects/llvm/llvm/lib/Support/Unix/Signals.inc:466:0
#2 0x00000000029326af llvm::sys::RunSignalHandlers() /home/chfast/Projects/llvm/llvm/lib/Support/Signals.cpp:44:0
#3 0x0000000002933aba SignalHandler(int) /home/chfast/Projects/llvm/llvm/lib/Support/Unix/Signals.inc:256:0
#4 0x00007f44a5ca83d0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113d0)
#5 0x00007f44a4a1b418 gsignal /build/glibc-GKVZIf/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#6 0x00007f44a4a1d01a abort /build/glibc-GKVZIf/glibc-2.23/stdlib/abort.c:91:0
#7 0x00007f44a4a13bd7 __assert_fail_base /build/glibc-GKVZIf/glibc-2.23/assert/assert.c:92:0
#8 0x00007f44a4a13c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#9 0x0000000002783482 llvm::SelectionDAG::getConstant(unsigned long, llvm::SDLoc const&, llvm::EVT, bool, bool) /home/chfast/Projects/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1086:0
#10 0x000000000286d092 llvm::DAGTypeLegalizer::ExpandIntRes_MUL(llvm::SDNode*, llvm::SDValue&, llvm::SDValue&) /home/chfast/Projects/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:2209:0
#11 0x0000000002864bbc llvm::DAGTypeLegalizer::ExpandIntegerResult(llvm::SDNode*, unsigned int) /home/chfast/Projects/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:1330:0
#12 0x0000000002815863 llvm::DAGTypeLegalizer::run() /home/chfast/Projects/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:238:0
#13 0x000000000281b0c8 llvm::SelectionDAG::LegalizeTypes() /home/chfast/Projects/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:1176:0
#14 0x00000000027c8749 llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/chfast/Projects/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:773:0
#15 0x00000000027c7dc8 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, true>, bool&) /home/chfast/Projects/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:684:0
#16 0x00000000027cbf86 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/chfast/Projects/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1489:0
#17 0x00000000027c6ca7 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/chfast/Projects/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:509:0
#18 0x0000000001aca8c3 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/chfast/Projects/llvm/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:176:0
#19 0x00000000020a1d73 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/chfast/Projects/llvm/llvm/lib/CodeGen/MachineFunctionPass.cpp:62:0
#20 0x0000000002433006 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/chfast/Projects/llvm/llvm/lib/IR/LegacyPassManager.cpp:1522:0
#21 0x000000000243319f llvm::FPPassManager::runOnModule(llvm::Module&) /home/chfast/Projects/llvm/llvm/lib/IR/LegacyPassManager.cpp:1543:0
#22 0x000000000243351a (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/chfast/Projects/llvm/llvm/lib/IR/LegacyPassManager.cpp:1599:0
#23 0x0000000002433c2f llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/chfast/Projects/llvm/llvm/lib/IR/LegacyPassManager.cpp:1702:0
#24 0x0000000002433e3b llvm::legacy::PassManager::run(llvm::Module&) /home/chfast/Projects/llvm/llvm/lib/IR/LegacyPassManager.cpp:1734:0
#25 0x0000000000ec757f compileModule(char**, llvm::LLVMContext&) /home/chfast/Projects/llvm/llvm/tools/llc/llc.cpp:509:0
#26 0x0000000000ec5d6e main /home/chfast/Projects/llvm/llvm/tools/llc/llc.cpp:274:0
#27 0x00007f44a4a06830 __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:325:0
#28 0x0000000000ec4059 _start (bin/llc+0xec4059)
Stack dump:
0.	Program arguments: bin/llc /home/chfast/Projects/llvm/llvm/test/CodeGen/X86/mul-i256.ll 
1.	Running pass 'Function Pass Manager' on module '/home/chfast/Projects/llvm/llvm/test/CodeGen/X86/mul-i256.ll'.
2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@test2'
Comment 1 David Majnemer 2016-09-12 12:32:53 PDT
Hal, I believe you wrote this code.  Would you mind taking a look?
Comment 2 Hal Finkel 2016-09-12 12:38:32 PDT
(In reply to comment #1)
> Hal, I believe you wrote this code.  Would you mind taking a look?

Yes, will do.
Comment 3 Paweł Bylica 2016-09-12 12:42:51 PDT
It is probably not about Hal's code. More likely an assumption in the CogeGen ignoring big integers. I can also take a look tomorrow if you are busy.
Comment 4 Hal Finkel 2016-09-12 12:48:44 PDT
(In reply to comment #3)
> It is probably not about Hal's code. More likely an assumption in the
> CogeGen ignoring big integers. I can also take a look tomorrow if you are
> busy.

Please feel free to look at it; My assumption (before looking at it), is that there is some quantity which is being computed using uint64_t which should be computed using APInt.
Comment 5 Paweł Bylica 2016-09-13 02:11:12 PDT
Fix proposal https://reviews.llvm.org/D24478
Comment 6 Paweł Bylica 2016-09-14 02:50:07 PDT
Fixed in r281403.