[llvm] [AMDGPU] Refactor setreg handling in the VGPR MSB lowering (PR #186491)

Stanislav Mekhanoshin via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 15:03:30 PDT 2026


================
@@ -545,13 +536,7 @@ bool AMDGPULowerVGPREncoding::handleSetregMode(MachineInstr &MI) {
                     << " SetregModeValue=0x"
                     << Twine::utohexstr(SetregModeValue) << '\n');
   if (ImmBits12To19 == SetregModeValue) {
-    // Already correct, but we must invalidate MostRecentModeSet because this
-    // instruction will overwrite mode[12:19]. We can't update this instruction
-    // via piggybacking (bits[12:19] are meaningful), so if CurrentMode changes,
-    // a new s_set_vgpr_msb will be inserted after this instruction.
-    MostRecentModeSet = nullptr;
-    LLVM_DEBUG(dbgs() << "    -> bits[12:19] already correct, "
-                         "invalidated MostRecentModeSet\n");
+    LLVM_DEBUG(dbgs() << "    -> bits[12:19] already correct\n");
----------------
rampitec wrote:

Also added some tests.

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


More information about the llvm-commits mailing list