[llvm] [X86][GlobalISel] Enable G_BUILD_VECTOR and G_CONSTANT_POOL (PR #92844)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon May 20 22:41:42 PDT 2024
================
@@ -576,11 +576,32 @@ bool X86InstructionSelector::selectLoadStoreOp(MachineInstr &I,
if (NewOpc == Opc)
return false;
- X86AddressMode AM;
- X86SelectAddress(*MRI.getVRegDef(I.getOperand(1).getReg()), MRI, AM);
-
I.setDesc(TII.get(NewOpc));
MachineInstrBuilder MIB(MF, I);
+ const MachineInstr *Ptr = MRI.getVRegDef(I.getOperand(1).getReg());
+
+ if (Ptr->getOpcode() == TargetOpcode::G_CONSTANT_POOL) {
+ assert(Opc == TargetOpcode::G_LOAD &&
+ "Only G_LOAD from constant pool is expected");
+ // TODO: Need a separate move for Large model
+ if (TM.getCodeModel() == CodeModel::Large)
+ return false;
+
+ unsigned char OpFlag = STI.classifyLocalReference(nullptr);
+ unsigned PICBase = 0;
+ if (OpFlag == X86II::MO_GOTOFF)
+ PICBase = STI.getInstrInfo()->getGlobalBaseReg(&MF);
----------------
arsenm wrote:
TII is already a member
https://github.com/llvm/llvm-project/pull/92844
More information about the llvm-commits
mailing list