From ce6f57c659b159aaef2c84d8cf5a1d7106019293 Mon Sep 17 00:00:00 2001 From: Shubham Sandeep Rastogi Date: Thu, 23 Jan 2025 22:07:27 -0800 Subject: [PATCH] [InstrRef] Fix mismatch between LiveDebugValues and salvageCopySSA The LiveDebugValues pass and the instruction selector (which calls) salvageCopySSA need to be consistent on what they consider a copy instruction. With https://github.com/llvm/llvm-project/pull/75184, the definition of what a copy instruction is was narrowed for AArch64 to exclude a w->x ORR and treat it as a zero-extend rather than a copy However, to make sure LiveDebugValues still treats a w->x ORR as a copy, the new function, isCopyLikeInstr was created. We need to make sure that salvageCopySSA also calls that function. This patch addresses this mismatch. --- llvm/lib/CodeGen/MachineFunction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index b8dbe834a4d51..229b9adf4049f 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -1053,7 +1053,7 @@ auto MachineFunction::salvageCopySSA( // Check whether this copy-like instruction has already been salvaged into // an operand pair. Register Dest; - if (auto CopyDstSrc = TII.isCopyInstr(MI)) { + if (auto CopyDstSrc = TII.isCopyLikeInstr(MI)) { Dest = CopyDstSrc->Destination->getReg(); } else { assert(MI.isSubregToReg()); @@ -1137,7 +1137,7 @@ auto MachineFunction::salvageCopySSAImpl(MachineInstr &MI) CurInst = Inst.getIterator(); // Any non-copy instruction is the defining instruction we're seeking. - if (!Inst.isCopyLike() && !TII.isCopyInstr(Inst)) + if (!Inst.isCopyLike() && !TII.isCopyLikeInstr(Inst)) break; State = GetRegAndSubreg(Inst); };