diff options
author | Jeffrey Byrnes <jeffrey.byrnes@amd.com> | 2025-01-24 07:23:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-24 07:23:22 -0800 |
commit | 6c11b7e689c89ff46e4472810dd555434eab1010 (patch) | |
tree | faae2c63595d7b8f478b44e9510c2356d0c09950 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | a12d7e4b611f0db2525da68f5576beaeeb6c84ac (diff) | |
download | llvm-6c11b7e689c89ff46e4472810dd555434eab1010.zip llvm-6c11b7e689c89ff46e4472810dd555434eab1010.tar.gz llvm-6c11b7e689c89ff46e4472810dd555434eab1010.tar.bz2 |
[CodeGen] NFC: Change order of checks in MachineInstr->isDead() (#124207)
[[Change-Id:
Ic349022bb99ef91f5396e462ade0366bc772ae02](https://github.com/llvm/llvm-project/pull/123531)](https://github.com/llvm/llvm-project/pull/123531)
moved isDead() from DeadMachineInstrElim to MachineInstr . In the
process of moving, I reordered the checks to improve chances of early
exit, but this has caused a slight increase in compile time.
This PR reverts back to the original order of checks.
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 0f7f525..a9f756b 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1353,18 +1353,6 @@ bool MachineInstr::wouldBeTriviallyDead() const { bool MachineInstr::isDead(const MachineRegisterInfo &MRI, LiveRegUnits *LivePhysRegs) const { - // Technically speaking inline asm without side effects and no defs can still - // be deleted. But there is so much bad inline asm code out there, we should - // let them be. - if (isInlineAsm()) - return false; - - // If we suspect this instruction may have some side-effects, then we say - // this instruction cannot be dead. - // FIXME: See issue #105950 for why LIFETIME markers are considered dead here. - if (!isLifetimeMarker() && !wouldBeTriviallyDead()) - return false; - // Instructions without side-effects are dead iff they only define dead regs. // This function is hot and this loop returns early in the common case, // so only perform additional checks before this if absolutely necessary. @@ -1385,7 +1373,19 @@ bool MachineInstr::isDead(const MachineRegisterInfo &MRI, } } - return true; + // Technically speaking inline asm without side effects and no defs can still + // be deleted. But there is so much bad inline asm code out there, we should + // let them be. + if (isInlineAsm()) + return false; + + // FIXME: See issue #105950 for why LIFETIME markers are considered dead here. + if (isLifetimeMarker()) + return true; + + // If there are no defs with uses, then we call the instruction dead so long + // as we do not suspect it may have sideeffects. + return wouldBeTriviallyDead(); } static bool MemOperandsHaveAlias(const MachineFrameInfo &MFI, |