[llvm] d41dde7 - LiveRangeEdit: Replace setIsDead with an assert (#92964)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 08:04:22 PDT 2024


Author: Matt Arsenault
Date: 2024-05-22T17:04:17+02:00
New Revision: d41dde70c44a10f9761242df73fdd288c4660c8d

URL: https://github.com/llvm/llvm-project/commit/d41dde70c44a10f9761242df73fdd288c4660c8d
DIFF: https://github.com/llvm/llvm-project/commit/d41dde70c44a10f9761242df73fdd288c4660c8d.diff

LOG: LiveRangeEdit: Replace setIsDead with an assert (#92964)

I noticed this was possibly buggy with implicit operands with the same
dest register, and should maybe be using addRegisterDead. However, this
is never called in a situation where the operand wasn't already marked
dead. This is eliminateDeadDef, implying the def was already known to be
dead.

Add an assert to detect inconsistencies in dead flags. This was
apparently added in 9a16d655c71826bef98b7d6e9590e4494ac0e1a9.

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveRangeEdit.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveRangeEdit.cpp b/llvm/lib/CodeGen/LiveRangeEdit.cpp
index 643370f0573d1..7b7b5459ad7b2 100644
--- a/llvm/lib/CodeGen/LiveRangeEdit.cpp
+++ b/llvm/lib/CodeGen/LiveRangeEdit.cpp
@@ -414,7 +414,7 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink) {
       DeadRemats->insert(MI);
       const TargetRegisterInfo &TRI = *MRI.getTargetRegisterInfo();
       MI->substituteRegister(Dest, NewLI.reg(), 0, TRI);
-      MI->getOperand(0).setIsDead(true);
+      assert(MI->registerDefIsDead(NewLI.reg(), &TRI));
     } else {
       if (TheDelegate)
         TheDelegate->LRE_WillEraseInstruction(MI);


        


More information about the llvm-commits mailing list