[llvm-commits] [llvm] r61215 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
Dan Gohman
gohman at apple.com
Thu Dec 18 14:03:48 PST 2008
Author: djg
Date: Thu Dec 18 16:03:42 2008
New Revision: 61215
URL: http://llvm.org/viewvc/llvm-project?rev=61215&view=rev
Log:
When emitting instructions that define EFLAGS and the EFLAGS value isn't
used, mark the defs as dead.
Modified:
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=61215&r1=61214&r2=61215&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Dec 18 16:03:42 2008
@@ -403,6 +403,9 @@
}
}
+ // The EFLAGS implicit def is dead.
+ New->getOperand(3).setIsDead();
+
// Replace the pseudo instruction with a new instruction...
if (New) MBB.insert(I, New);
}
@@ -416,6 +419,9 @@
(Is64Bit ? X86::SUB64ri32 : X86::SUB32ri);
MachineInstr *New =
BuildMI(MF, TII.get(Opc), StackPtr).addReg(StackPtr).addImm(CalleeAmt);
+ // The EFLAGS implicit def is dead.
+ New->getOperand(3).setIsDead();
+
MBB.insert(I, New);
}
}
@@ -517,7 +523,10 @@
while (Offset) {
uint64_t ThisVal = (Offset > Chunk) ? Chunk : Offset;
- BuildMI(MBB, MBBI, TII.get(Opc), StackPtr).addReg(StackPtr).addImm(ThisVal);
+ MachineInstr *MI =
+ BuildMI(MBB, MBBI, TII.get(Opc), StackPtr).addReg(StackPtr).addImm(ThisVal);
+ // The EFLAGS implicit def is dead.
+ MI->getOperand(3).setIsDead();
Offset -= ThisVal;
}
}
@@ -713,8 +722,11 @@
// applies to tail call optimized functions where the callee argument stack
// size is bigger than the callers.
if (TailCallReturnAddrDelta < 0) {
- BuildMI(MBB, MBBI, TII.get(Is64Bit? X86::SUB64ri32 : X86::SUB32ri),
- StackPtr).addReg(StackPtr).addImm(-TailCallReturnAddrDelta);
+ MachineInstr *MI =
+ BuildMI(MBB, MBBI, TII.get(Is64Bit? X86::SUB64ri32 : X86::SUB32ri),
+ StackPtr).addReg(StackPtr).addImm(-TailCallReturnAddrDelta);
+ // The EFLAGS implicit def is dead.
+ MI->getOperand(3).setIsDead();
}
uint64_t NumBytes = 0;
@@ -751,10 +763,14 @@
I->addLiveIn(FramePtr);
// Realign stack
- if (needsStackRealignment(MF))
- BuildMI(MBB, MBBI,
- TII.get(Is64Bit ? X86::AND64ri32 : X86::AND32ri),
- StackPtr).addReg(StackPtr).addImm(-MaxAlign);
+ if (needsStackRealignment(MF)) {
+ MachineInstr *MI =
+ BuildMI(MBB, MBBI,
+ TII.get(Is64Bit ? X86::AND64ri32 : X86::AND32ri),
+ StackPtr).addReg(StackPtr).addImm(-MaxAlign);
+ // The EFLAGS implicit def is dead.
+ MI->getOperand(3).setIsDead();
+ }
} else
NumBytes = StackSize - X86FI->getCalleeSavedFrameSize();
More information about the llvm-commits
mailing list