(original) (raw)

Thanks Mehdi. Below is an example of "dead def", it looks like unused definition as you mentioned, could you confirm? I also saw dead defs in some generated code before register allocation, like "%reg1030 = ADD8rr %reg1028, %reg1029, %EFLAGS<imp-def,dead>", does it mean similar for EFLAGS here?

// AggressiveAntiDepBreaker.cpp
void AggressiveAntiDepBreaker::PrescanInstruction(MachineInstr \*MI,
unsigned Count,
std::set& PassthruRegs) {
std::vector &DefIndices = State->GetDefIndices();
std::multimap&
RegRefs = State->GetRegRefs();

// Handle dead defs by simulating a last-use of the register just
// after the def. A dead def can occur because the def is truly
// dead, or because only a subregister is live at the def. If we
// don't do this the dead def will be incorrectly merged into the
// previous def.
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI->getOperand(i);
if (!MO.isReg() || !MO.isDef()) continue;
unsigned Reg = MO.getReg();
if (Reg == 0) continue;

HandleLastUse(Reg, Count + 1, "", "\\tDead Def: ", "\\n");
}

On Fri, Jan 2, 2015 at 4:38 AM, Mehdi Amini <mehdi.amini@apple.com> wrote:

\> On Jan 1, 2015, at 7:24 AM, Thomson <lilotom@gmail.com> wrote:
\>
\> I saw there is reference to dead def on registers in LLVM source code. I am not aware of this concept from the traditional course material. What are the properties of dead def?

Could it be a def that is never used (hence dead)?
If you mention where you saw it, it may be easier to help :)

Best,

Mehdi


\>
\> Cheers
\> Thomson
\> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\> LLVM Developers mailing list
\> LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
\> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev