[MLIR][SPIRV] Rename `spv.undef` to `spv.Undef`.
authorKareemErgawy-TomTom <kareem.ergawy@gmail.com>
Fri, 5 Mar 2021 20:45:09 +0000 (15:45 -0500)
committerLei Zhang <antiagainst@google.com>
Fri, 5 Mar 2021 20:49:44 +0000 (15:49 -0500)
To unify the naming scheme across all ops in the SPIR-V dialect, we are
moving from spv.camelCase to spv.CamelCase everywhere. For ops that
don't have a SPIR-V spec counterpart, we use spv.mlir.snake_case.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D98016

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVMiscOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir
mlir/test/Dialect/SPIRV/IR/misc-ops.mlir
mlir/test/Dialect/SPIRV/Transforms/rewrite-inserts.mlir
mlir/test/Target/SPIRV/undef.mlir

index 7e227c1..498b28c 100644 (file)
@@ -18,7 +18,7 @@ include "mlir/Dialect/SPIRV/IR/SPIRVBase.td"
 
 // -----
 
-def SPV_UndefOp : SPV_Op<"undef", []> {
+def SPV_UndefOp : SPV_Op<"Undef", []> {
   let summary = "Make an intermediate object whose value is undefined.";
 
   let description = [{
@@ -31,14 +31,14 @@ def SPV_UndefOp : SPV_Op<"undef", []> {
     <!-- End of AutoGen section -->
 
     ```
-    undef-op ::= `spv.undef` `:` spirv-type
+    undef-op ::= `spv.Undef` `:` spirv-type
     ```
 
     #### Example:
 
     ```mlir
-    %0 = spv.undef : f32
-    %1 = spv.undef : !spv.struct<!spv.array<4 x vector<4xi32>>>
+    %0 = spv.Undef : f32
+    %1 = spv.Undef : !spv.struct<!spv.array<4 x vector<4xi32>>>
     ```
   }];
 
index 9c1375b..0d787dd 100644 (file)
@@ -622,7 +622,7 @@ def SPV_SpecConstantCompositeOp : SPV_Op<"SpecConstantComposite", [
     - A symbol referring of another spec constant.
     - The SSA ID of a non-specialization constant (i.e. defined through
       `spv.SpecConstant`).
-    - The SSA ID of a `spv.undef`.
+    - The SSA ID of a `spv.Undef`.
 
     ```
     spv-spec-constant-composite-op ::= `spv.SpecConstantComposite` symbol-ref-id ` (`
index 47263c0..9281a30 100644 (file)
@@ -113,13 +113,13 @@ spv.module Logical OpenCL {
 // CHECK-LABEL: @undef_scalar
 spv.func @undef_scalar() "None" {
   // CHECK: llvm.mlir.undef : f32
-  %0 = spv.undef : f32
+  %0 = spv.Undef : f32
   spv.Return
 }
 
 // CHECK-LABEL: @undef_vector
 spv.func @undef_vector() "None" {
   // CHECK: llvm.mlir.undef : vector<2xi32>
-  %0 = spv.undef : vector<2xi32>
+  %0 = spv.Undef : vector<2xi32>
   spv.Return
 }
index 537dcce..3a6006d 100644 (file)
@@ -1,14 +1,14 @@
 // RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s
 
 //===----------------------------------------------------------------------===//
-// spv.undef
+// spv.Undef
 //===----------------------------------------------------------------------===//
 
 func @undef() -> () {
-  // CHECK: %{{.*}} = spv.undef : f32
-  %0 = spv.undef : f32
-  // CHECK: %{{.*}} = spv.undef : vector<4xf32>
-  %1 = spv.undef : vector<4xf32>
+  // CHECK: %{{.*}} = spv.Undef : f32
+  %0 = spv.Undef : f32
+  // CHECK: %{{.*}} = spv.Undef : vector<4xf32>
+  %1 = spv.Undef : vector<4xf32>
   spv.Return
 }
 
@@ -16,7 +16,7 @@ func @undef() -> () {
 
 func @undef() -> () {
   // expected-error @+2{{expected non-function type}}
-  %0 = spv.undef :
+  %0 = spv.Undef :
   spv.Return
 }
 
@@ -24,6 +24,6 @@ func @undef() -> () {
 
 func @undef() -> () {
   // expected-error @+2{{expected ':'}}
-  %0 = spv.undef
+  %0 = spv.Undef
   spv.Return
 }
index 719f006..af6c1ce 100644 (file)
@@ -2,26 +2,26 @@
 
 spv.module Logical GLSL450 {
   spv.func @rewrite(%value0 : f32, %value1 : f32, %value2 : f32, %value3 : i32, %value4: !spv.array<3xf32>) -> vector<3xf32> "None" {
-    %0 = spv.undef : vector<3xf32>
+    %0 = spv.Undef : vector<3xf32>
     // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}} : vector<3xf32>
     %1 = spv.CompositeInsert %value0, %0[0 : i32] : f32 into vector<3xf32>
     %2 = spv.CompositeInsert %value1, %1[1 : i32] : f32 into vector<3xf32>
     %3 = spv.CompositeInsert %value2, %2[2 : i32] : f32 into vector<3xf32>
 
-    %4 = spv.undef : !spv.array<4xf32>
+    %4 = spv.Undef : !spv.array<4xf32>
     // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}} : !spv.array<4 x f32>
     %5 = spv.CompositeInsert %value0, %4[0 : i32] : f32 into !spv.array<4xf32>
     %6 = spv.CompositeInsert %value1, %5[1 : i32] : f32 into !spv.array<4xf32>
     %7 = spv.CompositeInsert %value2, %6[2 : i32] : f32 into !spv.array<4xf32>
     %8 = spv.CompositeInsert %value0, %7[3 : i32] : f32 into !spv.array<4xf32>
 
-    %9 = spv.undef : !spv.struct<(f32, i32, f32)>
+    %9 = spv.Undef : !spv.struct<(f32, i32, f32)>
     // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}} : !spv.struct<(f32, i32, f32)>
     %10 = spv.CompositeInsert %value0, %9[0 : i32] : f32 into !spv.struct<(f32, i32, f32)>
     %11 = spv.CompositeInsert %value3, %10[1 : i32] : i32 into !spv.struct<(f32, i32, f32)>
     %12 = spv.CompositeInsert %value1, %11[2 : i32] : f32 into !spv.struct<(f32, i32, f32)>
 
-    %13 = spv.undef : !spv.struct<(f32, !spv.array<3xf32>)>
+    %13 = spv.Undef : !spv.struct<(f32, !spv.array<3xf32>)>
     // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}} : !spv.struct<(f32, !spv.array<3 x f32>)>
     %14 = spv.CompositeInsert %value0, %13[0 : i32] : f32 into !spv.struct<(f32, !spv.array<3xf32>)>
     %15 = spv.CompositeInsert %value4, %14[1 : i32] : !spv.array<3xf32> into !spv.struct<(f32, !spv.array<3xf32>)>
index efea010..0fa9a94 100644 (file)
@@ -2,19 +2,19 @@
 
 spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
   spv.func @foo() -> () "None" {
-    // CHECK: {{%.*}} = spv.undef : f32
-    // CHECK-NEXT: {{%.*}} = spv.undef : f32
-    %0 = spv.undef : f32
-    %1 = spv.undef : f32
+    // CHECK: {{%.*}} = spv.Undef : f32
+    // CHECK-NEXT: {{%.*}} = spv.Undef : f32
+    %0 = spv.Undef : f32
+    %1 = spv.Undef : f32
     %2 = spv.FAdd %0, %1 : f32
-    // CHECK: {{%.*}} = spv.undef : vector<4xi32>
-    %3 = spv.undef : vector<4xi32>
+    // CHECK: {{%.*}} = spv.Undef : vector<4xi32>
+    %3 = spv.Undef : vector<4xi32>
     %4 = spv.CompositeExtract %3[1 : i32] : vector<4xi32>
-    // CHECK: {{%.*}} = spv.undef : !spv.array<4 x !spv.array<4 x i32>>
-    %5 = spv.undef : !spv.array<4x!spv.array<4xi32>>
+    // CHECK: {{%.*}} = spv.Undef : !spv.array<4 x !spv.array<4 x i32>>
+    %5 = spv.Undef : !spv.array<4x!spv.array<4xi32>>
     %6 = spv.CompositeExtract %5[1 : i32, 2 : i32] : !spv.array<4x!spv.array<4xi32>>
-    // CHECK: {{%.*}} = spv.undef : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>
-    %7 = spv.undef : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>
+    // CHECK: {{%.*}} = spv.Undef : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>
+    %7 = spv.Undef : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>
     %8 = spv.Constant 0 : i32
     %9 = spv.AccessChain %7[%8] : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>, i32
     spv.Return
@@ -27,7 +27,7 @@ spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
   // CHECK: spv.func {{@.*}}
   spv.func @ignore_unused_undef() -> () "None" {
     // CHECK-NEXT: spv.Return
-    %0 = spv.undef : f32
+    %0 = spv.Undef : f32
     spv.Return
   }
 }