[llvm] [AMDGPU] Unused sdst writing to null (PR #133229)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 3 04:27:28 PDT 2025


================
@@ -973,11 +973,13 @@ bool SIShrinkInstructions::run(MachineFunction &MF) {
         continue;
       }
 
-      if (!TII->hasVALU32BitEncoding(MI.getOpcode())) {
-        // If there is no chance we will shrink it and use VCC as sdst to get
-        // a 32 bit form try to replace dead sdst with NULL.
+      // If there is no chance we will shrink it and use VCC as sdst to get
+      // a 32 bit form try to replace dead sdst with NULL.
+      if (TII->isVOP3(MI.getOpcode())) {
         tryReplaceDeadSDST(MI);
-        continue;
+        if (!TII->hasVALU32BitEncoding(MI.getOpcode())) {
+          continue;
+        }
----------------
jayfoad wrote:

I really don't see the point of adding this check here. What does it buy us? If you want to save some execution time it would be better for `tryReplaceDeadSDST` to return a bool saying whether it succeeded. If it did, you can probably `continue` here because there is no chance of shrinking it.

Also nit: don't need the braces.

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


More information about the llvm-commits mailing list