llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.35k stars 12.14k forks source link

X86_64: Assertion failure "Unknown mismatch!" in SelectionDAGBuilder #16145

Open redstar opened 11 years ago

redstar commented 11 years ago
Bugzilla Link 15773
Version trunk
OS Windows XP
Attachments .ll file crashing llc

Extended Description

The attached bug.ll creates the following failure:

Assertion failed: (PartVT.isInteger() || PartVT == MVT::x86mmx) && ValueVT.isInteger() && "Unknown mismatch!", file D:\OpenSource\LLVM\llvm-git\lib\CodeGen\SelectionDAG\SelectionDAGBuilder.cpp, line 371
Stack dump:
0.  Program arguments: llc bug.ll 
1.  Running pass 'Function Pass Manager' on module 'bug.ll'.
2.  Running pass 'X86 DAG->DAG Instruction Selection' on function '@ldexpl'
0x000007FEE8D856A2 (0x000007FE0000000A 0x0000000100000001 0x000000CB00000000 0x000007FEE8F4E6A0), exit() + 0x172 bytes(s)
0x000007FEE8EAFB44 (0x000007FEE8F4E6A0 0x000007FEE8F50BD0 0x0000000140E17590 0x0000000140E174F0), abort() + 0x24 bytes(s)
0x000007FEE8E9AB94 (0x0000000140E17590 0x0000000140E174F0 0xCCCCCCCC00000173 0xCCCCCCCCCCCCCCCC), _wassert() + 0xE74 bytes(s)
0x000000013FB9507E (0x0000000000DC1FE0 0x0000000000000000 0x0000000000BAB610 0x0000000000BAB358), getCopyToParts() + 0x3FE bytes(s), d:\opensource\llvm\llvm-git\lib\codegen\selectiondag\selectiondagbuilder.cpp, line 371 + 0x79 byte(s)
0x000000013FB96E6C (0x0000000000BAB970 0x0000000000BADEF0 0x0000000000DC1FE0 0x0000000000000000), `anonymous namespace'::RegsForValue::getCopyToRegs() + 0x2CC bytes(s), d:\opensource\llvm\llvm-git\lib\codegen\selectiondag\selectiondagbuilder.cpp, line 781
0x000000013FB87571 (0x0000000000DC2810 0x0000000000D7F38A 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::SelectionDAGBuilder::visitInlineAsm() + 0x2421 bytes(s), d:\opensource\llvm\llvm-git\lib\codegen\selectiondag\selectiondagbuilder.cpp, line 6263
0x000000013FB83928 (0x0000000000DC2810 0x0000000000D7F388 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::SelectionDAGBuilder::visitCall() + 0x88 bytes(s), d:\opensource\llvm\llvm-git\lib\codegen\selectiondag\selectiondagbuilder.cpp, line 5524
0x000000013FB6F14B (0x0000000000DC2810 0xCCCCCCCC00000030 0x0000000000D7F388 0xCCCCCCCCCCCCCCCC), llvm::SelectionDAGBuilder::visit() + 0x42B bytes(s), d:\opensource\llvm\llvm-git\include\llvm\ir\instruction.def, line 164 + 0xF byte(s)
0x000000013FB6ECCB (0x0000000000DC2810 0x0000000000D7F388 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::SelectionDAGBuilder::visit() + 0x7B bytes(s), d:\opensource\llvm\llvm-git\lib\codegen\selectiondag\selectiondagbuilder.cpp, line 958
0x000000013FA844B8 (0x0000000000DC1C20 0x0000000000D9E158 0x0000000000D9E0A8 0x0000000000BAE6F4), llvm::SelectionDAGISel::SelectBasicBlock() + 0x98 bytes(s), d:\opensource\llvm\llvm-git\lib\codegen\selectiondag\selectiondagisel.cpp, line 513 + 0x1E byte(s)
0x000000013FA8433C (0x0000000000DC1C20 0x0000000000D9EB30 0x0000000000DB0F40 0x0000000000D9CFC0), llvm::SelectionDAGISel::SelectAllBasicBlocks() + 0xBEC bytes(s), d:\opensource\llvm\llvm-git\lib\codegen\selectiondag\selectiondagisel.cpp, line 1198
0x000000013FA7D018 (0x0000000000DC1C20 0x0000000000DEF840 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::SelectionDAGISel::runOnMachineFunction() + 0x3E8 bytes(s), d:\opensource\llvm\llvm-git\lib\codegen\selectiondag\selectiondagisel.cpp, line 387
0x000000013FECA4E7 (0x0000000000DC1C20 0x0000000000D9EB30 0x0000000000D9EB30 0xCCCCCCCC00000004), llvm::MachineFunctionPass::runOnFunction() + 0x67 bytes(s), d:\opensource\llvm\llvm-git\lib\codegen\machinefunctionpass.cpp, line 34
0x000000014038A4FE (0x0000000000DA6CF0 0x0000000000D9EB30 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::FPPassManager::runOnFunction() + 0x1AE bytes(s), d:\opensource\llvm\llvm-git\lib\ir\passmanager.cpp, line 1530 + 0x37 byte(s)
0x000000014038A714 (0x0000000000DA6CF0 0x0000000000D8E790 0x0000000000D8E790 0xCCCCCCCC00000005), llvm::FPPassManager::runOnModule() + 0x94 bytes(s), d:\opensource\llvm\llvm-git\lib\ir\passmanager.cpp, line 1550 + 0x23 byte(s)
0x000000014038C121 (0x0000000000D9CDF0 0x0000000000D8E790 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::MPPassManager::runOnModule() + 0x311 bytes(s), d:\opensource\llvm\llvm-git\lib\ir\passmanager.cpp, line 1608 + 0x40 byte(s)
0x000000014038C954 (0x0000000000DB0BF0 0x0000000000D8E790 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::PassManagerImpl::run() + 0x174 bytes(s), d:\opensource\llvm\llvm-git\lib\ir\passmanager.cpp, line 1703 + 0x2A byte(s)
0x000000014038AC96 (0x0000000000BAF748 0x0000000000D8E790 0x0000000000BAF790 0x0000000000000000), llvm::PassManager::run() + 0x36 bytes(s), d:\opensource\llvm\llvm-git\lib\ir\passmanager.cpp, line 1739
0x000000013F53629E (0x0000000000D78090 0x0000000000D84F80 0x0000000140B0BC30 0xCCCCCCCCCCCCCCCC), compileModule() + 0x17AE bytes(s), d:\opensource\llvm\llvm-git\tools\llc\llc.cpp, line 378
0x000000013F536B4F (0x0000000100000002 0x0000000000D78090 0x0000000000000000 0x000000014065CFB6), main() + 0x11F bytes(s), d:\opensource\llvm\llvm-git\tools\llc\llc.cpp, line 195 + 0x12 byte(s)
0x000000014065BD0D (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __tmainCRTStartup() + 0x19D bytes(s), f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crtexe.c, line 536 + 0x19 byte(s)
0x000000014065BE3E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0xE bytes(s), f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crtexe.c, line 377
0x00000000778D652D (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0xD bytes(s)
0x0000000077B0C521 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

if compiled with llc bug.ll on Windows 7 64bit.

The code was produced by LDC based on the following source:

// Loads exponent of a floating-point number.
real ldexpl(real arg, int exp)
{
    pragma(LDC_allow_inline);
    return __asm!(real)("fscale", "={st},{st(1)},{st},~{st(1)}", exp, arg);
}

Expected instruction sequence is something like this:

        fild exp;
        fld arg;
        fscale;
        fstp arg;

I assume that the fild instruction causes the problem.

arsenm commented 1 year ago

No assert today, but an error: `error: couldn't allocate input reg for constraint '{st(1)}'

bug.ll.txt