[Mlir-commits] [mlir] [mlir][SPIR-V] Add OpExpectKHR op (PR #195842)

Jakub Kuderski llvmlistbot at llvm.org
Tue May 5 06:37:58 PDT 2026


================
@@ -56,6 +56,58 @@ def SPIRV_KHRAssumeTrueOp : SPIRV_KhrVendorOp<"AssumeTrue", []> {
 
 // -----
 
+def SPIRV_KHRExpectOp : SPIRV_KhrVendorOp<"Expect",
+    [Pure, AllTypesMatch<["value", "expectedValue", "result"]>]> {
+  let summary = "Provides a hint to the optimizer that the value is likely "
+                "to equal the expected value.";
+
+  let description = [{
+    Result Type must be a scalar or vector of integer type or Boolean type.
+
+    Value and Expected Value must be of Result Type. Result is the same as
+    Value.
+
+    <!-- End of AutoGen section -->
+
+    ```
+    integer-scalar-vector-type ::= integer-type |
+                                   `vector<` integer-literal `x` integer-type `>`
+    bool-scalar-vector-type ::= `i1` |
+                                `vector<` integer-literal `x` `i1` `>`
+    expect-op ::= ssa-id `=` `spirv.KHR.Expect` ssa-use `,` ssa-use
+                  `:` (integer-scalar-vector-type | bool-scalar-vector-type)
+    ```
----------------
kuhar wrote:

we don't need this -- the assembly format will take care of the generating the syntax overview

We can also drop it from `spirv. KHR.AssumeTrue` above

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


More information about the Mlir-commits mailing list