@@ -571,7 +571,7 @@ bool CombinerHelper::findPostIndexCandidate(MachineInstr &MI, Register &Addr,
571571 LLVM_DEBUG (dbgs () << " Searching for post-indexing opportunity for: " << MI);
572572
573573 for (auto &Use : MRI.use_instructions (Base)) {
574- if (Use.getOpcode () != TargetOpcode::G_GEP )
574+ if (Use.getOpcode () != TargetOpcode::G_PTR_ADD )
575575 continue ;
576576
577577 Offset = Use.getOperand (2 ).getReg ();
@@ -597,8 +597,8 @@ bool CombinerHelper::findPostIndexCandidate(MachineInstr &MI, Register &Addr,
597597 // forming an indexed one.
598598
599599 bool MemOpDominatesAddrUses = true ;
600- for (auto &GEPUse : MRI.use_instructions (Use.getOperand (0 ).getReg ())) {
601- if (!dominates (MI, GEPUse )) {
600+ for (auto &PtrAddUse : MRI.use_instructions (Use.getOperand (0 ).getReg ())) {
601+ if (!dominates (MI, PtrAddUse )) {
602602 MemOpDominatesAddrUses = false ;
603603 break ;
604604 }
@@ -631,7 +631,7 @@ bool CombinerHelper::findPreIndexCandidate(MachineInstr &MI, Register &Addr,
631631#endif
632632
633633 Addr = MI.getOperand (1 ).getReg ();
634- MachineInstr *AddrDef = getOpcodeDef (TargetOpcode::G_GEP , Addr, MRI);
634+ MachineInstr *AddrDef = getOpcodeDef (TargetOpcode::G_PTR_ADD , Addr, MRI);
635635 if (!AddrDef || MRI.hasOneUse (Addr))
636636 return false ;
637637
@@ -667,8 +667,8 @@ bool CombinerHelper::findPreIndexCandidate(MachineInstr &MI, Register &Addr,
667667 }
668668 }
669669
670- // FIXME: check whether all uses of the base pointer are constant GEPs. That
671- // might allow us to end base's liveness here by adjusting the constant.
670+ // FIXME: check whether all uses of the base pointer are constant PtrAdds.
671+ // That might allow us to end base's liveness here by adjusting the constant.
672672
673673 for (auto &UseMI : MRI.use_instructions (Addr)) {
674674 if (!dominates (MI, UseMI)) {
@@ -1016,7 +1016,7 @@ bool CombinerHelper::optimizeMemset(MachineInstr &MI, Register Dst, Register Val
10161016 if (DstOff != 0 ) {
10171017 auto Offset =
10181018 MIB.buildConstant (LLT::scalar (PtrTy.getSizeInBits ()), DstOff);
1019- Ptr = MIB.buildGEP (PtrTy, Dst, Offset).getReg (0 );
1019+ Ptr = MIB.buildPtrAdd (PtrTy, Dst, Offset).getReg (0 );
10201020 }
10211021
10221022 MIB.buildStore (Value, Ptr, *StoreMMO);
@@ -1121,13 +1121,13 @@ bool CombinerHelper::optimizeMemcpy(MachineInstr &MI, Register Dst,
11211121 if (CurrOffset != 0 ) {
11221122 Offset = MIB.buildConstant (LLT::scalar (PtrTy.getSizeInBits ()), CurrOffset)
11231123 .getReg (0 );
1124- LoadPtr = MIB.buildGEP (PtrTy, Src, Offset).getReg (0 );
1124+ LoadPtr = MIB.buildPtrAdd (PtrTy, Src, Offset).getReg (0 );
11251125 }
11261126 auto LdVal = MIB.buildLoad (CopyTy, LoadPtr, *LoadMMO);
11271127
11281128 // Create the store.
11291129 Register StorePtr =
1130- CurrOffset == 0 ? Dst : MIB.buildGEP (PtrTy, Dst, Offset).getReg (0 );
1130+ CurrOffset == 0 ? Dst : MIB.buildPtrAdd (PtrTy, Dst, Offset).getReg (0 );
11311131 MIB.buildStore (LdVal, StorePtr, *StoreMMO);
11321132 CurrOffset += CopyTy.getSizeInBytes ();
11331133 Size -= CopyTy.getSizeInBytes ();
@@ -1218,7 +1218,7 @@ bool CombinerHelper::optimizeMemmove(MachineInstr &MI, Register Dst,
12181218 if (CurrOffset != 0 ) {
12191219 auto Offset =
12201220 MIB.buildConstant (LLT::scalar (PtrTy.getSizeInBits ()), CurrOffset);
1221- LoadPtr = MIB.buildGEP (PtrTy, Src, Offset).getReg (0 );
1221+ LoadPtr = MIB.buildPtrAdd (PtrTy, Src, Offset).getReg (0 );
12221222 }
12231223 LoadVals.push_back (MIB.buildLoad (CopyTy, LoadPtr, *LoadMMO).getReg (0 ));
12241224 CurrOffset += CopyTy.getSizeInBytes ();
@@ -1235,7 +1235,7 @@ bool CombinerHelper::optimizeMemmove(MachineInstr &MI, Register Dst,
12351235 if (CurrOffset != 0 ) {
12361236 auto Offset =
12371237 MIB.buildConstant (LLT::scalar (PtrTy.getSizeInBits ()), CurrOffset);
1238- StorePtr = MIB.buildGEP (PtrTy, Dst, Offset).getReg (0 );
1238+ StorePtr = MIB.buildPtrAdd (PtrTy, Dst, Offset).getReg (0 );
12391239 }
12401240 MIB.buildStore (LoadVals[I], StorePtr, *StoreMMO);
12411241 CurrOffset += CopyTy.getSizeInBytes ();
0 commit comments