[all-commits] [llvm/llvm-project] c71101: [mlir] Initialize the Region::container field to n...

ftynse via All-commits all-commits at lists.llvm.org
Sun May 10 05:23:52 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c71101d9efced2291d46992d32dc88577aef2cf6
      https://github.com/llvm/llvm-project/commit/c71101d9efced2291d46992d32dc88577aef2cf6
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-05-10 (Sun, 10 May 2020)

  Changed paths:
    M mlir/include/mlir/IR/Region.h

  Log Message:
  -----------
  [mlir] Initialize the Region::container field to nullptr by default

Region has a default constructor that is called when a region is constructed
while an operation is being created, and therefore before the region can be
attached to this operation. The `container` field is uninitialized, which makes
it impossible to check programmatically if a Region is attached to an operation
or not, leading to sly memory errors when this field is read. Initialize it to
nullptr by default and thus make sure one can check if a region is attached to
an operation or not.


  Commit: 11c4fc6c4844f9bea694b96b84ad07bde9d39e19
      https://github.com/llvm/llvm-project/commit/11c4fc6c4844f9bea694b96b84ad07bde9d39e19
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-05-10 (Sun, 10 May 2020)

  Changed paths:
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp

  Log Message:
  -----------
  [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.


Compare: https://github.com/llvm/llvm-project/compare/c28114c8ffde...11c4fc6c4844


More information about the All-commits mailing list