[llvm] [CodeGen] Ensure clearRegisterKills clears inside bundles. (PR #149177)
Ricardo Jesus via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 5 09:38:13 PDT 2025
================
@@ -2174,16 +2174,25 @@ bool MachineInstr::addRegisterKilled(Register IncomingReg,
}
void MachineInstr::clearRegisterKills(Register Reg,
- const TargetRegisterInfo *RegInfo) {
+ const TargetRegisterInfo *RegInfo,
+ QueryType Type) {
if (!Reg.isPhysical())
RegInfo = nullptr;
- for (MachineOperand &MO : operands()) {
- if (!MO.isReg() || !MO.isUse() || !MO.isKill())
- continue;
- Register OpReg = MO.getReg();
- if ((RegInfo && RegInfo->regsOverlap(Reg, OpReg)) || Reg == OpReg)
- MO.setIsKill(false);
- }
+
+ auto clearKills = [&](auto Operands) {
+ for (MachineOperand &MO : Operands) {
+ if (!MO.isReg() || !MO.isUse() || !MO.isKill())
+ continue;
+ Register OpReg = MO.getReg();
+ if ((RegInfo && RegInfo->regsOverlap(Reg, OpReg)) || Reg == OpReg)
+ MO.setIsKill(false);
+ }
+ };
+
+ if (Type != AllInBundle || !isBundled() || isBundledWithPred())
----------------
rj-jesus wrote:
I'm not sure either (my initial thinking was to treat it as `IgnoreBundle`), but I've now changed this to use `Type == IgnoreBundle`.
https://github.com/llvm/llvm-project/pull/149177
More information about the llvm-commits
mailing list