[llvm] [MachineCP] Correctly handle register masks and sub-registers (PR #122734)
Oliver Stannard via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 06:50:04 PST 2025
================
@@ -117,7 +117,32 @@ class CopyTracker {
DenseMap<MCRegUnit, CopyInfo> Copies;
+ // Memoised sets of register units which are preserved by each register mask,
+ // needed to efficiently remove copies which are invalidated by call
+ // instructions.
+ DenseMap<const uint32_t *, BitVector> RegMaskToPreservedRegUnits;
+
public:
+ /// Get the set of register units which are preserved by RegMaskOp.
+ BitVector &getPreservedRegUnits(const MachineOperand &RegMaskOp,
----------------
ostannard wrote:
I agree with the general principle, but I'm not sure that would help here, because `LiveRegUnits` only tracks liveness, but this pass also needs to track other information about the `COPY` instruction which defined that unit (if any). If that is possible, I don't think I'm qualified to do that re-write, since this is the first time I've looked at this pass. Are you OK with this fix as-is, or do you think that re-write needs to happen first?
https://github.com/llvm/llvm-project/pull/122734
More information about the llvm-commits
mailing list