[llvm] [AMDGPU][CodeGen] Do not rematerialize registers with convergent users (PR #222322)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 05:59:23 PDT 2026


================
@@ -1593,6 +1593,15 @@ bool PreRARematStage::initGCNSchedStage() {
                [](const MachineInstr *DefMI) { return DefMI->isConvergent(); }))
       continue;
 
+    // A convergent user (e.g., V_READLANE*) may observe the definition's lanes
+    // whose contents depend on the EXEC mask in effect at the def. Moving the
+    // def into the use's region can change EXEC across the def and thus alter
+    // those lanes, so prevent rematerialization in that case.
+    if (any_of(Users, [](const MachineInstr *UserMI) {
----------------
arsenm wrote:

This would only apply to VALU defs, but something also feels off about checking the users 

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


More information about the llvm-commits mailing list