[llvm] [CodeGen] Correctly handle non-standard cases in RemoveLoadsIntoFakeUses (PR #111551)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 8 09:12:33 PDT 2024
================
@@ -94,11 +94,13 @@ bool RemoveLoadsIntoFakeUses::runOnMachineFunction(MachineFunction &MF) {
for (MachineInstr &MI : make_early_inc_range(reverse(*MBB))) {
if (MI.isFakeUse()) {
- for (const MachineOperand &MO : MI.operands()) {
- // Track the Fake Uses that use this register so that we can delete
- // them if we delete the corresponding load.
- if (MO.isReg())
- RegFakeUses[MO.getReg()].push_back(&MI);
+ const MachineOperand &FakeUseOp = MI.getOperand(0);
+ // Track the Fake Uses that use this register so that we can delete
+ // them if we delete the corresponding load.
+ if (FakeUseOp.isReg()) {
----------------
SLTozer wrote:
Yes - although there's no real meaning to non-register fake uses, at some points (that I don't recall off the top of my head) the operands can get replaced; it'd be equally valid to also just delete fake uses that have non-reg operands (and at any other point where we're examining fake uses).
https://github.com/llvm/llvm-project/pull/111551
More information about the llvm-commits
mailing list