Update the OperationFolder to find a valid insertion point when materializing constants.
authorRiver Riddle <riverriddle@google.com>
Tue, 25 Jun 2019 16:42:52 +0000 (09:42 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Tue, 25 Jun 2019 16:43:21 +0000 (09:43 -0700)
commit66ed7d6d83e975da3cafd822d724eb8ace47475d
tree03c230525362aba1054b8d68f092bed0d897b2bc
parent2628641b23b7e5898e4d8cb2d27a061577a8e241
Update the OperationFolder to find a valid insertion point when materializing constants.

The OperationFolder currently just inserts into the entry block of a Function, but regions may be isolated above, i.e. explicit capture only, and blindly inserting constants may break the invariants of these regions.

PiperOrigin-RevId: 254987796
mlir/include/mlir/Transforms/FoldUtils.h
mlir/lib/Linalg/IR/LinalgOps.cpp
mlir/lib/Linalg/Transforms/Fusion.cpp
mlir/lib/Linalg/Transforms/LowerToLoops.cpp
mlir/lib/Linalg/Transforms/Tiling.cpp
mlir/lib/Transforms/Utils/FoldUtils.cpp
mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
mlir/test/Transforms/constant-fold.mlir
mlir/test/lib/Transforms/TestConstantFold.cpp