[llvm] [AArch64][GlobalISel] Look through COPY and G_BITCAST while selecting fcvtl2 (fpext) (PR #65463)
Vladislav Dzhidzhoev via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 7 05:01:20 PDT 2023
================
@@ -6777,10 +6777,21 @@ AArch64InstructionSelector::selectExtractHigh(MachineOperand &Root) const {
MachineRegisterInfo &MRI =
Root.getParent()->getParent()->getParent()->getRegInfo();
- MachineInstr *Extract = getDefIgnoringCopies(Root.getReg(), MRI);
- if (Extract && Extract->getOpcode() == TargetOpcode::G_UNMERGE_VALUES &&
- Root.getReg() == Extract->getOperand(1).getReg()) {
- Register ExtReg = Extract->getOperand(2).getReg();
+ auto Extract = getDefSrcRegIgnoringCopies(Root.getReg(), MRI);
+ while (Extract && Extract->MI->getOpcode() == TargetOpcode::G_BITCAST)
+ Extract =
+ getDefSrcRegIgnoringCopies(Extract->MI->getOperand(1).getReg(), MRI);
+ if (!Extract)
+ return std::nullopt;
+
+ if (Extract->MI->getOpcode() == TargetOpcode::G_UNMERGE_VALUES) {
+ if (Extract->Reg == Extract->MI->getOperand(1).getReg()) {
+ Register ExtReg = Extract->MI->getOperand(2).getReg();
+ return {{[=](MachineInstrBuilder &MIB) { MIB.addUse(ExtReg); }}};
+ }
+ }
+ if (Extract->MI->getOpcode() == TargetOpcode::G_EXTRACT_VECTOR_ELT) {
----------------
dzhidzhoev wrote:
Thank you for the catch!
https://github.com/llvm/llvm-project/pull/65463
More information about the llvm-commits
mailing list