[mlir][spirv] Check GlobalVariableOp result to be of pointer types
authorLei Zhang <antiagainst@google.com>
Thu, 1 Dec 2022 00:07:19 +0000 (19:07 -0500)
committerLei Zhang <antiagainst@google.com>
Thu, 1 Dec 2022 00:07:30 +0000 (19:07 -0500)
commitb948a9f40ffec7d8128a44d304cfe7305b9f051c
tree41e7d107228882c16d33973c2794a49cc67bfc2e
parent1ee3bb17c39579de21ea0bd526e79bb932b8b1c3
[mlir][spirv] Check GlobalVariableOp result to be of pointer types

Querying the storage class in the verifier will assume the result
type is of pointer types. We need to check that's true first to
make sure it won't crash.

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D139053
mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
mlir/test/Dialect/SPIRV/IR/structure-ops.mlir