[llvm] [AMDGPU] SIFixSGPRCopies avoid placing V_READFIRSTLANE inside the loop. (PR #186400)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 02:35:20 PDT 2026


================
@@ -1009,6 +1026,22 @@ void SIFixSGPRCopies::analyzeVGPRToSGPRCopy(MachineInstr* MI) {
     for (auto *U : Users) {
       if (TII->isSALU(*U))
         Info.SChain.insert(U);
+
+      if (TII->needsReadlaneOnVALUConversion(*U)) {
----------------
alex-t wrote:

> As a possible tidy up, if `needsReadlaneOnVALUConversion` returned the operand index instead of just true/false, then it would avoid any need for test the Opcode in this code and legalizer. It would also allow adding new instructions with unique operand indexes in a single location.

Good catch! Thanks.

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


More information about the llvm-commits mailing list