[llvm] [Uniformity] Implement per-output machine uniformity analysis (PR #179275)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 05:49:24 PST 2026


================
@@ -2367,10 +2367,11 @@ class LLVM_ABI TargetInstrInfo : public MCInstrInfo {
     llvm_unreachable("impossible call instruction");
   }
 
-  /// Return the uniformity behavior of the given instruction.
-  virtual InstructionUniformity
-  getInstructionUniformity(const MachineInstr &MI) const {
-    return InstructionUniformity::Default;
+  /// Return the uniformity behavior of the given value (def operand).
+  /// \p DefIdx specifies which output to query (for multi-output instructions).
+  virtual ValueUniformity getValueUniformity(const MachineInstr &MI,
+                                             unsigned DefIdx = 0) const {
+    return ValueUniformity::Default;
----------------
jayfoad wrote:

This smells like bad design. WHat is the use case for calling this without a valid DefIdx? Is it to query branch divergence for terminator instructions? If so I would suggest splitting that out into a different function, or at least a different no-args overload of this function, instead of using a magic number as the default argument value.

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


More information about the llvm-commits mailing list