@@ -5973,9 +5973,11 @@ static bool expandMOV32r1(MachineInstrBuilder &MIB, const TargetInstrInfo &TII,
59735973 MachineBasicBlock &MBB = *MIB->getParent ();
59745974 const DebugLoc &DL = MIB->getDebugLoc ();
59755975 Register Reg = MIB.getReg (0 );
5976+ MachineFunction &MF = *MBB.getParent ();
5977+ const Function &F = MF.getFunction ();
59765978
59775979 // Insert the XOR.
5978- BuildMI (MBB, MIB.getInstr (), DL, TII.get (X86::XOR32rr), Reg)
5980+ BuildMI (MBB, MIB.getInstr (), DL, TII.get ((F. hasFnAttribute (Attribute::AttrKind::XOR32rr_REV) ? X86::XOR32rr_REV : X86:: XOR32rr) ), Reg)
59795981 .addReg (Reg, RegState::Undef)
59805982 .addReg (Reg, RegState::Undef);
59815983
@@ -6075,10 +6077,11 @@ static void expandLoadStackGuard(MachineInstrBuilder &MIB,
60756077static bool expandXorFP (MachineInstrBuilder &MIB, const TargetInstrInfo &TII) {
60766078 MachineBasicBlock &MBB = *MIB->getParent ();
60776079 MachineFunction &MF = *MBB.getParent ();
6080+ const Function &F = MF.getFunction ();
60786081 const X86Subtarget &Subtarget = MF.getSubtarget <X86Subtarget>();
60796082 const X86RegisterInfo *TRI = Subtarget.getRegisterInfo ();
60806083 unsigned XorOp =
6081- MIB->getOpcode () == X86::XOR64_FP ? X86::XOR64rr : X86::XOR32rr;
6084+ MIB->getOpcode () == X86::XOR64_FP ? X86::XOR64rr : (F. hasFnAttribute (Attribute::AttrKind::XOR32rr_REV) ? X86::XOR32rr_REV : X86:: XOR32rr) ;
60826085 MIB->setDesc (TII.get (XorOp));
60836086 MIB.addReg (TRI->getFrameRegister (MF), RegState::Undef);
60846087 return true ;
@@ -6144,10 +6147,14 @@ static bool expandSHXDROT(MachineInstrBuilder &MIB, const MCInstrDesc &Desc) {
61446147
61456148bool X86InstrInfo::expandPostRAPseudo (MachineInstr &MI) const {
61466149 bool HasAVX = Subtarget.hasAVX ();
6147- MachineInstrBuilder MIB (*MI.getParent ()->getParent (), MI);
6150+
6151+ MachineBasicBlock &MBB = *MI.getParent ();
6152+ MachineFunction &MF = *MBB.getParent ();
6153+ MachineInstrBuilder MIB (MF, MI);
6154+ const Function &F = MF.getFunction ();
61486155 switch (MI.getOpcode ()) {
61496156 case X86::MOV32r0:
6150- return Expand2AddrUndef (MIB, get (X86::XOR32rr));
6157+ return Expand2AddrUndef (MIB, get (F. hasFnAttribute (Attribute::AttrKind::XOR32rr_REV) ? X86::XOR32rr_REV : X86::XOR32rr));
61516158 case X86::MOV32r1:
61526159 return expandMOV32r1 (MIB, *this , /* MinusOne=*/ false );
61536160 case X86::MOV32r_1:
0 commit comments