[llvm] [PowerPC] Fix ppc-reduce-cr-ops mishandling of subregister uses (PR #144405)
Nemanja Ivanovic via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 17 21:07:20 PDT 2025
================
@@ -535,26 +542,17 @@ PPCReduceCRLogicals::createCRLogicalOpInfo(MachineInstr &MIParam) {
MachineInstr *PPCReduceCRLogicals::lookThroughCRCopy(unsigned Reg,
unsigned &Subreg,
MachineInstr *&CpDef) {
- Subreg = -1;
if (!Register::isVirtualRegister(Reg))
return nullptr;
MachineInstr *Copy = MRI->getVRegDef(Reg);
CpDef = Copy;
if (!Copy->isCopy())
return Copy;
Register CopySrc = Copy->getOperand(1).getReg();
- Subreg = Copy->getOperand(1).getSubReg();
+ // If the copy defines a register with a subreg, set that as the Subreg.
+ Subreg = Copy->getOperand(0).getSubReg();
----------------
nemanjai wrote:
Ah, yes. OK, I think the `Subreg` handling should completely be removed from this function.
https://github.com/llvm/llvm-project/pull/144405
More information about the llvm-commits
mailing list