[llvm] [AMDGPU] Reduce use of continue in SIWholeQuadMode. NFC. (PR #93659)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 03:37:26 PDT 2024


================
@@ -499,19 +496,16 @@ char SIWholeQuadMode::scanInstructions(MachineFunction &MF,
 
       if (TII->isWQM(Opcode)) {
         // If LOD is not supported WQM is not needed.
-        if (!ST->hasExtendedImageInsts())
-          continue;
         // Only generate implicit WQM if implicit derivatives are required.
         // This avoids inserting unintended WQM if a shader type without
         // implicit derivatives uses an image sampling instruction.
-        if (!HasImplicitDerivatives)
-          continue;
-        // Sampling instructions don't need to produce results for all pixels
-        // in a quad, they just require all inputs of a quad to have been
-        // computed for derivatives.
-        markInstructionUses(MI, StateWQM, Worklist);
-        GlobalFlags |= StateWQM;
-        continue;
+        if (ST->hasExtendedImageInsts() && HasImplicitDerivatives) {
+          // Sampling instructions don't need to produce results for all pixels
+          // in a quad, they just require all inputs of a quad to have been
+          // computed for derivatives.
+          markInstructionUses(MI, StateWQM, Worklist);
+          GlobalFlags |= StateWQM;
+        }
----------------
jayfoad wrote:

That seems like it would be tricky and confusing because not all of the cases continue. The ones that set `Flags` do not continue. Hence I removed all the continues and added `if (Flags)` around the small bit of code at the bottom of the loop.

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


More information about the llvm-commits mailing list