[spirv] Allow return ops to be in control flow ops
authorLei Zhang <antiagainst@google.com>
Sat, 5 Oct 2019 03:08:05 +0000 (20:08 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Sat, 5 Oct 2019 03:08:52 +0000 (20:08 -0700)
commitc020480fc61c9c414203e3e4d18942474ccc0809
tree673e4012a9fcb6e1dec7160a4262e01999f94815
parent58e2ead31489aef4b3972a1af1e1e7d9a5ab4f1a
[spirv] Allow return ops to be in control flow ops

Use `getParentOfType<FunctionOp>()` instead of `cast<FuncOp>(getParentOp())`
to avoid crash when return ops are used inside spv.selection/spv.loop.

PiperOrigin-RevId: 273006041
mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
mlir/test/Dialect/SPIRV/control-flow-ops.mlir