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

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 02:40:28 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;
----------------
ssahasra wrote:

When `DefIdx` is zero, it's impossible to know if the user called this function with an explicit zero argument, or they actually called it with no argument. Maybe the default value should be ~0u? In that case, the assertion can be safely inserted in the function body itself, making it self-contained.

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


More information about the llvm-commits mailing list