[llvm] [AMDGPU] Inplace FI elimination during PEI for scalar copy instruction (PR #99556)

Pankaj Dwivedi via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 12:29:26 PDT 2024


================
@@ -2555,12 +2555,33 @@ bool SIRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator MI,
                       TmpResultReg)
                   .addImm(ST.getWavefrontSizeLog2())
                   .addReg(FrameReg);
-              auto Add = BuildMI(*MBB, MI, DL, TII->get(AMDGPU::V_ADD_U32_e32),
-                                 TmpResultReg);
-              Add.addImm(Offset).addReg(TmpResultReg, RegState::Kill);
+
+              MachineInstrBuilder Add;
+              if ((Add = TII->getAddNoCarry(*MBB, MI, DL, TmpResultReg, *RS)) ==
+                  nullptr) {
----------------
PankajDwivedi-25 wrote:

there are couple of more test cases which are failing if i try to handle this, inside getAddNoCarry.
and the code above which is expecting nullptr will not be rechable.
else {
           MachineInstrBuilder MIB;
           if (!IsSALU) {
             if ((MIB = TII->getAddNoCarry(*MBB, MI, DL, ResultReg, *RS)) !=
                 nullptr) {

https://github.com/llvm/llvm-project/pull/99556


More information about the llvm-commits mailing list