[mlir] Affine dim and symbol checkers: support detached regions
authorAlex Zinenko <zinenko@google.com>
Sun, 10 May 2020 12:14:10 +0000 (14:14 +0200)
committerAlex Zinenko <zinenko@google.com>
Sun, 10 May 2020 12:23:35 +0000 (14:23 +0200)
commit11c4fc6c4844f9bea694b96b84ad07bde9d39e19
tree53da524f719ee44a128a8a4dbf2d6b297f4b78d9
parentc71101d9efced2291d46992d32dc88577aef2cf6
[mlir] Affine dim and symbol checkers: support detached regions

Functions checking whether an SSA value is a valid dimension or symbol for
affine operations can be called on values defined in a detached region (a
region that is not yet attached to an operation), for example, during parsing
or operation construction. These functions will attempt to uncondtionally
dereference a pointer to the parent operation of a region, which may be null
(as fixed by the previous commit, uninitialized before that). Since one cannot
know to which operation a region will be attached, conservatively this
operation would not be a valid affine scope and act accordingly, instead of
crashing.
mlir/lib/Dialect/Affine/IR/AffineOps.cpp