Christian Sayer
2009-Jan-09 10:50 UTC
[LLVMdev] implicit CC register Defs cause "physreg was not killed in defining block!" assert
Hello, For my backend, I define and use a CC register similiarly to the EFLAGS register in X86 (I call it CCFLAGS). But if I make all arithmetic/logic instructions affect it ('let Defs = [CCFLAGS] in...' in InstrInfo.td) I run into // The only case we should have a dead physreg here without a killing or // instruction where we know it's dead is if it is live-in to the function // and never used. assert(!CopyMI && "physreg was not killed in defining block!"); in LiveIntervals::handlePhysicalRegisterDef(). The dump() of the MBB from the debugger looks like the following: entry.ifcont267_crit_edge: 0x12bc368, LLVM BB @0x12bb900, ID#2: Predecessors according to CFG: 0x12bc290 (#0) 0x12bca70 (#1) %reg1033<def> = addC %reg1025<kill>, 0, %CCFLAGS<imp-def,dead> %reg1032<def> = addC %reg1024<kill>, 0, %CCFLAGS<imp-def,dead> %reg1095<def> = addC %reg1028, 0, %CCFLAGS<imp-def> %reg1096<def> = addC %reg1029<kill>, 0, %CCFLAGS<imp-def> %reg1097<def> = addC %reg1033<kill>, 0, %CCFLAGS<imp-def> %reg1098<def> = addC %reg1028<kill>, 0, %CCFLAGS<imp-def> %reg1099<def> = addC %reg1031<kill>, 0, %CCFLAGS<imp-def> %reg1100<def> = addC %reg1030, 0, %CCFLAGS<imp-def> %reg1101<def> = addC %reg1032<kill>, 0, %CCFLAGS<imp-def> %reg1102<def> = addC %reg1030<kill>, 0, %CCFLAGS<imp-def> br mbb<ifcont267,0x12bc518> Successors according to CFG: 0x12bc518 (#4) Do you have any idea what could be wrong, or how to further debug the problem? Thanks a lot, Christian -- sorry about that, but there is nothing I can do about it: CONFIDENTIAL NOTICE: The contents of this message, including any attachments, are confidential and are intended solely for the use of the person or entity to whom the message was addressed. If you are not the intended recipient of this message, please be advised that any dissemination, distribution, or use of the contents of this message is strictly prohibited. If you received this message in error, please notify the sender. Please also permanently delete all copies of the original message and any attached documentation. Thank you.
Evan Cheng
2009-Jan-09 20:00 UTC
[LLVMdev] implicit CC register Defs cause "physreg was not killed in defining block!" assert
A physical register cannot be live across the block. So it must have a use in the block or it must be marked dead. From your dump, it looks like the CCFLAGS defs are not being marked dead. It's unclear where things went wrong, but you can step through LiveVariables to debug this. Evan On Jan 9, 2009, at 2:50 AM, Christian Sayer wrote:> Hello, > > For my backend, I define and use a CC register similiarly to the > EFLAGS register in X86 (I call it CCFLAGS). > But if I make all arithmetic/logic instructions affect it ('let Defs > = [CCFLAGS] in...' in InstrInfo.td) I run into > > // The only case we should have a dead physreg here without a > killing or > // instruction where we know it's dead is if it is live-in to the > function > // and never used. > assert(!CopyMI && "physreg was not killed in defining block!"); > > in LiveIntervals::handlePhysicalRegisterDef(). > > The dump() of the MBB from the debugger looks like the following: > > entry.ifcont267_crit_edge: 0x12bc368, LLVM BB @0x12bb900, ID#2: > Predecessors according to CFG: 0x12bc290 (#0) 0x12bca70 (#1) > %reg1033<def> = addC %reg1025<kill>, 0, %CCFLAGS<imp-def,dead> > %reg1032<def> = addC %reg1024<kill>, 0, %CCFLAGS<imp-def,dead> > %reg1095<def> = addC %reg1028, 0, %CCFLAGS<imp-def> > %reg1096<def> = addC %reg1029<kill>, 0, %CCFLAGS<imp-def> > %reg1097<def> = addC %reg1033<kill>, 0, %CCFLAGS<imp-def> > %reg1098<def> = addC %reg1028<kill>, 0, %CCFLAGS<imp-def> > %reg1099<def> = addC %reg1031<kill>, 0, %CCFLAGS<imp-def> > %reg1100<def> = addC %reg1030, 0, %CCFLAGS<imp-def> > %reg1101<def> = addC %reg1032<kill>, 0, %CCFLAGS<imp-def> > %reg1102<def> = addC %reg1030<kill>, 0, %CCFLAGS<imp-def> > br mbb<ifcont267,0x12bc518> > Successors according to CFG: 0x12bc518 (#4) > > > > Do you have any idea what could be wrong, or how to further debug > the problem? > > Thanks a lot, > Christian > > > -- > > > > > > > > sorry about that, but there is nothing I can do about it: > > CONFIDENTIAL NOTICE: The contents of this message, including any > attachments, are confidential and are intended solely for the use of > the person or entity to whom the message was addressed. If you are > not the intended recipient of this message, please be advised that > any dissemination, distribution, or use of the contents of this > message is strictly prohibited. If you received this message in > error, please notify the sender. Please also permanently delete all > copies of the original message and any attached documentation. Thank > you. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Christian Sayer
2009-Jan-12 17:33 UTC
[LLVMdev] implicit CC register Defs cause "physreg was not killed in defining block!" assert
Evan,>A physical register cannot be live across the block. So it >must have a use in the block or it must be marked dead. From >your dump, it looks like the CCFLAGS defs are not being marked >dead. It's unclear where things went wrong, but you can step >through LiveVariables to debug this.Thanks for your response. I did quite some stepping through the llc passes, and it turned out what now looks fairly obvious: The instructions containing the CCFLAGS which are not marked dead in the dump below (line 3+) are reg-to-reg copies inserted by the PHI elimination. In my backend, a mov instruction is currently implemented as an add with constant 0 (affecting condition codes). Now LiveVariables gets executed before PHI elimination, so I am trying to figure out if there is code in PNE which is supposed to update the defs. Otherwise I might try to re-run LiveVariables after PNE, or some similiar approach combining these two passes - unless you tell me they don't get marked dead because of an implementation flaw in my backend (or something completely else : ) Thanks again, Christian>> %reg1033<def> = addC %reg1025<kill>, 0, %CCFLAGS<imp-def,dead> >> %reg1032<def> = addC %reg1024<kill>, 0, %CCFLAGS<imp-def,dead> >> %reg1095<def> = addC %reg1028, 0, %CCFLAGS<imp-def> >> %reg1096<def> = addC %reg1029<kill>, 0, %CCFLAGS<imp-def> >> %reg1097<def> = addC %reg1033<kill>, 0, %CCFLAGS<imp-def> >> %reg1098<def> = addC %reg1028<kill>, 0, %CCFLAGS<imp-def> >> %reg1099<def> = addC %reg1031<kill>, 0, %CCFLAGS<imp-def> >> %reg1100<def> = addC %reg1030, 0, %CCFLAGS<imp-def> >> %reg1101<def> = addC %reg1032<kill>, 0, %CCFLAGS<imp-def> >> %reg1102<def> = addC %reg1030<kill>, 0, %CCFLAGS<imp-def> >> br mbb<ifcont267,0x12bc518>-- sorry about that, but there is nothing I can do about it: CONFIDENTIAL NOTICE: The contents of this message, including any attachments, are confidential and are intended solely for the use of the person or entity to whom the message was addressed. If you are not the intended recipient of this message, please be advised that any dissemination, distribution, or use of the contents of this message is strictly prohibited. If you received this message in error, please notify the sender. Please also permanently delete all copies of the original message and any attached documentation. Thank you.
Possibly Parallel Threads
- [LLVMdev] implicit CC register Defs cause "physreg was not killed in defining block!" assert
- [LLVMdev] implicit CC register Defs cause "physreg was not killed in defining block!" assert
- [LLVMdev] Removing dead code
- [LLVMdev] backend problem with LiveInterval::removeRange
- [LLVMdev] Moving between registers of different classes