[llvm] 10f0158 - [MachineLateInstrsCleanup] Bugfix for handling of kill flags.

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 08:15:27 PDT 2023


Author: Jonas Paulsson
Date: 2023-05-08T17:12:43+02:00
New Revision: 10f0158f005c5405058118ae9a810e2019382cb7

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

LOG: [MachineLateInstrsCleanup] Bugfix for handling of kill flags.

With cb57b7a7, the kill flags are now tracked during the forward search over
the instructions and the call to findRegisterUseOperandIdx() should therefore
only check for killing uses.

As shown with the failing test CodeGen/Hexagon/vector-sint-to-fp.ll, it could
otherwise be the case that an undef use after the instruction that killed the
register will be inserted into MBBKills, and the kill flag will not be
cleared.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp b/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
index 12276372c624b..e9840290c95d9 100644
--- a/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
+++ b/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
@@ -236,8 +236,8 @@ bool MachineLateInstrsCleanup::processBlock(MachineBasicBlock *MBB) {
       if (MI.modifiesRegister(Reg, TRI)) {
         MBBDefs.erase(Reg);
         MBBKills.erase(Reg);
-      } else if (MI.findRegisterUseOperandIdx(Reg, false /*isKill*/, TRI) != -1)
-        // Keep track of the last use seen so far.
+      } else if (MI.findRegisterUseOperandIdx(Reg, true /*isKill*/, TRI) != -1)
+        // Keep track of register kills.
         MBBKills[Reg] = &MI;
     }
 


        


More information about the llvm-commits mailing list