llvm.org GIT mirror llvm / 47cdf4a
Make the NDEBUG assertion stronger and more clear what is happening. Enhance scheduling to set the DEAD flag on implicit defs more aggressively. Before, we'd set an implicit def operand to dead if it were present in the SDNode corresponding to the machineinstr but had no use. Now we do it in this case AND if the implicit def does not exist in the SDNode at all. This exposes a couple of problems: one is the FIXME, which causes a live intervals crash on CodeGen/X86/sibcall.ll. The second is that it makes machinecse and licm more aggressive (which is a good thing) but also exposes a case where licm hoists a set0 and then it doesn't get resunk. Talking to codegen folks about both these issues, but I need this patch in in the meantime. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99485 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
7 changed file(s) with 25 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
577577 const TargetInstrDesc &II = TII->get(Opc);
578578 unsigned NumResults = CountResults(Node);
579579 unsigned NodeOperands = CountOperands(Node);
580 bool HasPhysRegOuts = (NumResults > II.getNumDefs()) &&
581 II.getImplicitDefs() != 0;
580 bool HasPhysRegOuts = NumResults > II.getNumDefs() && II.getImplicitDefs()!=0;
582581 #ifndef NDEBUG
583582 unsigned NumMIOperands = NodeOperands + NumResults;
584 assert((II.getNumOperands() == NumMIOperands ||
585 HasPhysRegOuts || II.isVariadic()) &&
586 "#operands for dag node doesn't match .td file!");
583 if (II.isVariadic())
584 assert(NumMIOperands >= II.getNumOperands() &&
585 "Too few operands for a variadic node!");
586 else
587 assert(NumMIOperands >= II.getNumOperands() &&
588 NumMIOperands <= II.getNumOperands()+II.getNumImplicitDefs() &&
589 "#operands for dag node doesn't match .td file!");
587590 #endif
588591
589592 // Create the new machine instruction.
631634 MI->addRegisterDead(Reg, TRI);
632635 }
633636 }
637
638 // If the instruction has implicit defs and the node doesn't, mark the
639 // implicit def as dead. If the node has any flag outputs, we don't do this
640 // because we don't know what implicit defs are being used by flagged nodes.
641 if (Node->getValueType(Node->getNumValues()-1) != MVT::Flag &&
642 // FIXME: This is a terrible hackaround for a liveintervals bug.
643 II.getNumImplicitDefs() < 8)
644 if (const unsigned *IDList = II.getImplicitDefs()) {
645 for (unsigned i = NumResults, e = II.getNumDefs()+II.getNumImplicitDefs();
646 i != e; ++i)
647 MI->addRegisterDead(IDList[i-II.getNumDefs()], TRI);
648 }
634649 return;
635650 }
636651
0 ; RUN: llc < %s -march=x86-64 > %t
1 ; RUN: grep leaq %t
21 ; RUN: not grep {,%rsp)} %t
32 ; PR1103
43
None ; RUN: llc < %s -march=x86-64 -mattr=+sse3 -stats |& not grep {machine-licm}
0 ; RUN: llc < %s -march=x86-64 -mattr=+sse3 -stats |& grep {2 machine-licm}
11 ; rdar://6627786
22
33 target triple = "x86_64-apple-darwin10.0"
None ; RUN: llc < %s | grep {movl %esp, %eax}
0 ; RUN: llc < %s | grep {movl %esp, %ecx}
11 ; PR4572
22
33 ; Don't coalesce with %esp if it would end up putting %esp in
22 ; MachineLICM should be able to hoist the sF reference out of the loop.
33
44 ; CHECK: pushl %esi
5 ; CHECK: subl $8, %esp
5 ; CHECK: subl $4, %esp
66 ; CHECK: movl $176, %esi
77 ; CHECK: addl L___sF$non_lazy_ptr, %esi
88 ; CHECK: .align 4, 0x90
None ; RUN: llc < %s -march=x86 | grep mov | count 5
0 ; RUN: llc < %s -march=x86 | grep mov | count 6
11 ; PR2659
22
33 define i32 @binomial(i32 %n, i32 %k) nounwind {
None ; RUN: llc < %s -march=x86 -mtriple=i686-apple-darwin9.4.0 | grep movl | count 5
0 ; RUN: llc < %s -march=x86 -mtriple=i686-apple-darwin9.4.0 | grep movl | count 6
11 ; PR2659
22
33 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"