mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-30 23:21:04 +00:00
[MachineInstrBundle] Improvement the recognition of dead definitions.
Now, it is possible to know that partial definitions are dead definitions and recognize that clobbered registers are also dead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267621 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5fcdfef145
commit
b62e24784c
@ -187,6 +187,10 @@ public:
|
||||
/// dead.
|
||||
bool DeadDef;
|
||||
|
||||
/// Reg is Defined and all defs of reg or an overlapping register are
|
||||
/// dead.
|
||||
bool PartialDeadDef;
|
||||
|
||||
/// There is a use operand of reg or a super-register with kill flag set.
|
||||
bool Killed;
|
||||
};
|
||||
|
@ -293,7 +293,7 @@ MachineOperandIteratorBase::PhysRegInfo
|
||||
MachineOperandIteratorBase::analyzePhysReg(unsigned Reg,
|
||||
const TargetRegisterInfo *TRI) {
|
||||
bool AllDefsDead = true;
|
||||
PhysRegInfo PRI = {false, false, false, false, false, false, false};
|
||||
PhysRegInfo PRI = {false, false, false, false, false, false, false, false};
|
||||
|
||||
assert(TargetRegisterInfo::isPhysicalRegister(Reg) &&
|
||||
"analyzePhysReg not given a physical register!");
|
||||
@ -332,8 +332,12 @@ MachineOperandIteratorBase::analyzePhysReg(unsigned Reg,
|
||||
}
|
||||
}
|
||||
|
||||
if (AllDefsDead && PRI.FullyDefined)
|
||||
PRI.DeadDef = true;
|
||||
if (AllDefsDead) {
|
||||
if (PRI.FullyDefined || PRI.Clobbered)
|
||||
PRI.DeadDef = true;
|
||||
else
|
||||
PRI.PartialDeadDef = true;
|
||||
}
|
||||
|
||||
return PRI;
|
||||
}
|
||||
|
@ -63,11 +63,10 @@ define i64 @test_intervening_call(i64* %foo, i64 %bar, i64 %baz) {
|
||||
; x8664-sahf-NEXT: popq %rax
|
||||
; x8664-sahf-NEXT: movq %rax, %rdi
|
||||
; x8664-sahf-NEXT: callq bar
|
||||
; x8664-sahf-NEXT: pushq %rax
|
||||
; RAX is dead, no need to push and pop it.
|
||||
; x8664-sahf-NEXT: movq [[FLAGS]], %rax
|
||||
; x8664-sahf-NEXT: addb $127, %al
|
||||
; x8664-sahf-NEXT: sahf
|
||||
; x8664-sahf-NEXT: popq %rax
|
||||
; x8664-sahf-NEXT: jne
|
||||
|
||||
%cx = cmpxchg i64* %foo, i64 %bar, i64 %baz seq_cst seq_cst
|
||||
|
Loading…
Reference in New Issue
Block a user