[llvm] [CodeGen] Refactor DeadMIElim isDead and GISel isTriviallyDead (PR #105956)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 04:04:44 PDT 2024


================
@@ -119,8 +106,18 @@ bool DeadMachineInstructionElimImpl::isDead(const MachineInstr *MI) const {
     }
   }
 
-  // If there are no defs with uses, the instruction is dead.
-  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 (MI->isInlineAsm())
+    return false;
+
+  // FIXME: See issue #105950 for why LIFETIME markers are considered dead here.
+  if (MI->isLifetimeMarker())
----------------
nikic wrote:

Wonder why lifetime markers are considered safe to move...

https://github.com/llvm/llvm-project/pull/105956


More information about the llvm-commits mailing list