LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 39539 - Inline asm with SSE: Assertion failed: (isVector() && "Invalid vector type!"), function getVectorNumElements, file include/llvm/CodeGen/ValueTypes.h, line 274.
Summary: Inline asm with SSE: Assertion failed: (isVector() && "Invalid vector type!")...
Status: RESOLVED DUPLICATE of bug 45806
Alias: None
Product: clang
Classification: Unclassified
Component: C++ (show other bugs)
Version: 7.0
Hardware: PC FreeBSD
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-02 09:12 PDT by Yuri
Modified: 2020-10-05 04:36 PDT (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments
testcase.cpp (3.97 KB, text/x-c++src)
2018-11-02 09:12 PDT, Yuri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri 2018-11-02 09:12:19 PDT
Created attachment 21072 [details]
testcase.cpp
Comment 1 Yuri 2018-11-02 09:13:45 PDT
See the FreeBSD downstream report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232911
Comment 2 Yuri 2018-11-02 09:17:00 PDT
Originally this testcase was provided by the lsp-plugins project author on github: https://github.com/sadko4u/lsp-plugins/issues/10
Comment 3 Francis Visoiu Mistrih 2018-11-02 10:24:31 PDT
Reproduces with:

define void @fill(float %v) {
entry:
  call float asm "", "=^Yz,0,~{dirflag},~{fpsr},~{flags}"(float %v)
  ret void
}

llc -o - -mtriple=x86_64-- iasm.ll

on trunk.
Comment 4 Francis Visoiu Mistrih 2018-11-02 10:26:44 PDT
Assertion failed: (isVector() && "Invalid vector type!"), function getVectorNumElements, file llvm/build/../include/llvm/CodeGen/ValueTypes.h, line 274.
Stack dump:
0.	Program arguments: ./build/bin/llc iasm.ll -o - -mtriple=x86_64--
1.	Running pass 'Function Pass Manager' on module 'iasm.ll'.
2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@fill'
0  llc                      0x000000010642ebcc llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
1  llc                      0x000000010642f169 PrintStackTraceSignalHandler(void*) + 25
2  llc                      0x000000010642b86e llvm::sys::RunSignalHandlers() + 990
3  llc                      0x000000010642fe09 SignalHandler(int) + 505
4  libsystem_platform.dylib 0x00007fff6bf12b3d _sigtramp + 29
5  llc                      0x00000001080b64f8 llvm::DenseMapInfo<llvm::codeview::GloballyHashedType>::Tombstone + 1596440
6  libsystem_c.dylib        0x00007fff6bdd11c9 abort + 127
7  libsystem_c.dylib        0x00007fff6bd99868 basename_r + 0
8  llc                      0x0000000103e48a08 llvm::EVT::getVectorNumElements() const + 104
9  llc                      0x00000001060eb0c2 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::SDValue, llvm::SDNodeFlags) + 7474
10 llc                      0x000000010604c2a6 getCopyToParts(llvm::SelectionDAG&, llvm::SDLoc const&, llvm::SDValue, llvm::SDValue*, unsigned int, llvm::MVT, llvm::Value const*, llvm::Optional<unsigned int>, llvm::ISD::NodeType) + 1190
11 llc                      0x000000010604b65c llvm::RegsForValue::getCopyToRegs(llvm::SDValue, llvm::SelectionDAG&, llvm::SDLoc const&, llvm::SDValue&, llvm::SDValue*, llvm::Value const*, llvm::ISD::NodeType) const + 1644
12 llc                      0x0000000106076921 llvm::SelectionDAGBuilder::visitInlineAsm(llvm::ImmutableCallSite) + 12273
13 llc                      0x000000010605d491 llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) + 97
14 llc                      0x0000000106050fb7 llvm::SelectionDAGBuilder::visit(unsigned int, llvm::User const&) + 1223
15 llc                      0x000000010604ff8d llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) + 141
16 llc                      0x0000000106177f6e 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&) + 206
17 llc                      0x00000001061768e0 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 10480
18 llc                      0x0000000106172436 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 2630
19 llc                      0x0000000104443dad (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 205
20 llc                      0x000000010504c591 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 545
21 llc                      0x00000001056f5237 llvm::FPPassManager::runOnFunction(llvm::Function&) + 503
22 llc                      0x00000001056f5905 llvm::FPPassManager::runOnModule(llvm::Module&) + 117
23 llc                      0x00000001056f646a (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) + 1546
24 llc                      0x00000001056f5bde llvm::legacy::PassManagerImpl::run(llvm::Module&) + 366
25 llc                      0x00000001056f6f81 llvm::legacy::PassManager::run(llvm::Module&) + 33
26 llc                      0x0000000102bb9cf9 compileModule(char**, llvm::LLVMContext&) + 24169
27 llc                      0x0000000102bb3168 main + 5464
28 libdyld.dylib            0x00007fff6bd28ef9 start + 1
29 libdyld.dylib            0x0000000000000005 start + 2486006029
Comment 5 Yuri 2020-10-03 09:42:57 PDT
iasm.ll doesn't crash with llvm 8 and 9 currently on FreeBSD 12.2.

Has this been fixed?

llvm-10 doesn't install llc for some reason.
Comment 6 Dimitry Andric 2020-10-05 04:34:11 PDT
Fixed for bug 45806 via https://reviews.llvm.org/D79448 / https://reviews.llvm.org/rG0fac1c191281 ("[X86] Allow Yz inline assembly constraint to choose ymm0 or zmm0 when avx/avx512 are enabled and type is 256 or 512 bits").

*** This bug has been marked as a duplicate of bug 45806 ***
Comment 7 Dimitry Andric 2020-10-05 04:36:26 PDT
(In reply to Yuri from comment #5)
> iasm.ll doesn't crash with llvm 8 and 9 currently on FreeBSD 12.2.

Most likely it doesn't assert because the llvm ports have assertions disabled. The actual problem seems to have been fixed between clang 10 and 11, and the fix will end up in 11.0.0.