Skip to content

Commit 6d58145

Browse files
whitneywhtsangetiotto
authored andcommitted
Update polygeist for llvm commit 221f9c8 (part 1) (#6)
Signed-off-by: Tsang, Whitney <[email protected]>
1 parent c0e5628 commit 6d58145

27 files changed

+120
-120
lines changed

polygeist/include/polygeist/BarrierUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "mlir/Dialect/Func/IR/FuncOps.h"
1414
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
1515
#include "mlir/Dialect/MemRef/IR/MemRef.h"
16-
#include "mlir/Dialect/SCF/SCF.h"
16+
#include "mlir/Dialect/SCF/IR/SCF.h"
1717
#include "mlir/IR/Block.h"
1818
#include "polygeist/Ops.h"
1919
#include "llvm/ADT/SetVector.h"

polygeist/include/polygeist/Ops.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include "mlir/Dialect/Affine/IR/AffineOps.h"
1313
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
14-
#include "mlir/Dialect/SCF/SCF.h"
14+
#include "mlir/Dialect/SCF/IR/SCF.h"
1515
#include "mlir/IR/BuiltinTypes.h"
1616
#include "mlir/IR/Dialect.h"
1717
#include "mlir/IR/Matchers.h"
@@ -25,7 +25,7 @@
2525
#include "polygeist/PolygeistOps.h.inc"
2626

2727
#include "mlir/Dialect/Affine/IR/AffineOps.h"
28-
#include "mlir/Dialect/SCF/SCF.h"
28+
#include "mlir/Dialect/SCF/IR/SCF.h"
2929
#include "mlir/IR/Matchers.h"
3030
#include "mlir/IR/PatternMatch.h"
3131
#include "llvm/Support/CommandLine.h"

polygeist/include/polygeist/Passes/Utils.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#include "mlir/Dialect/Affine/IR/AffineOps.h"
4-
#include "mlir/Dialect/SCF/SCF.h"
4+
#include "mlir/Dialect/SCF/IR/SCF.h"
55
#include "mlir/IR/BlockAndValueMapping.h"
66
#include "mlir/IR/IntegerSet.h"
77

@@ -66,13 +66,13 @@ static inline mlir::Region &getThenRegion(mlir::scf::IfOp op) {
6666
return op.getThenRegion();
6767
}
6868
static inline mlir::Region &getThenRegion(mlir::AffineIfOp op) {
69-
return op.thenRegion();
69+
return op.getThenRegion();
7070
}
7171
static inline mlir::Region &getElseRegion(mlir::scf::IfOp op) {
7272
return op.getElseRegion();
7373
}
7474
static inline mlir::Region &getElseRegion(mlir::AffineIfOp op) {
75-
return op.elseRegion();
75+
return op.getElseRegion();
7676
}
7777

7878
static inline mlir::scf::YieldOp getThenYield(mlir::scf::IfOp op) {
@@ -105,5 +105,5 @@ static inline bool hasElse(mlir::scf::IfOp op) {
105105
return op.getElseRegion().getBlocks().size() > 0;
106106
}
107107
static inline bool hasElse(mlir::AffineIfOp op) {
108-
return op.elseRegion().getBlocks().size() > 0;
108+
return op.getElseRegion().getBlocks().size() > 0;
109109
}

polygeist/lib/polygeist/Ops.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "mlir/Dialect/Func/IR/FuncOps.h"
2727
#include "mlir/Dialect/MemRef/IR/MemRef.h"
2828
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
29-
#include "mlir/Dialect/SCF/SCF.h"
29+
#include "mlir/Dialect/SCF/IR/SCF.h"
3030
#include "mlir/IR/BlockAndValueMapping.h"
3131

3232
using namespace mlir;
@@ -277,7 +277,7 @@ bool isCaptured(Value v, Operation *potentialUser = nullptr,
277277
continue;
278278
}
279279
if (auto s = dyn_cast<AffineStoreOp>(u)) {
280-
if (s.value() == v)
280+
if (s.getValue() == v)
281281
return true;
282282
continue;
283283
}
@@ -659,7 +659,7 @@ struct SimplifySubIndexUsers : public OpRewritePattern<SubIndexOp> {
659659
rewriter.replaceOpWithNewOp<memref::DeallocOp>(dealloc,
660660
subindex.source());
661661
} else if (auto loadOp = dyn_cast<memref::LoadOp>(use.getOwner())) {
662-
if (loadOp.memref() == subindex) {
662+
if (loadOp.getMemref() == subindex) {
663663
SmallVector<Value, 4> indices = loadOp.indices();
664664
if (subindex.getType().cast<MemRefType>().getShape().size() ==
665665
subindex.source()
@@ -691,7 +691,7 @@ struct SimplifySubIndexUsers : public OpRewritePattern<SubIndexOp> {
691691
changed = true;
692692
}
693693
} else if (auto storeOp = dyn_cast<memref::StoreOp>(use.getOwner())) {
694-
if (storeOp.memref() == subindex) {
694+
if (storeOp.getMemref() == subindex) {
695695
SmallVector<Value, 4> indices = storeOp.indices();
696696
if (subindex.getType().cast<MemRefType>().getShape().size() ==
697697
subindex.source()
@@ -722,7 +722,7 @@ struct SimplifySubIndexUsers : public OpRewritePattern<SubIndexOp> {
722722
changed = true;
723723
}
724724
} else if (auto storeOp = dyn_cast<memref::AtomicRMWOp>(use.getOwner())) {
725-
if (storeOp.memref() == subindex) {
725+
if (storeOp.getMemref() == subindex) {
726726
SmallVector<Value, 4> indices = storeOp.indices();
727727
if (subindex.getType().cast<MemRefType>().getShape().size() ==
728728
subindex.source()
@@ -754,7 +754,7 @@ struct SimplifySubIndexUsers : public OpRewritePattern<SubIndexOp> {
754754
changed = true;
755755
}
756756
} else if (auto storeOp = dyn_cast<AffineStoreOp>(use.getOwner())) {
757-
if (storeOp.memref() == subindex) {
757+
if (storeOp.getMemref() == subindex) {
758758
if (subindex.getType().cast<MemRefType>().getShape().size() + 1 ==
759759
subindex.source()
760760
.getType()
@@ -778,12 +778,12 @@ struct SimplifySubIndexUsers : public OpRewritePattern<SubIndexOp> {
778778
.getShape()
779779
.size() == indices.size());
780780
rewriter.replaceOpWithNewOp<memref::StoreOp>(
781-
storeOp, storeOp.value(), subindex.source(), indices);
781+
storeOp, storeOp.getValue(), subindex.source(), indices);
782782
changed = true;
783783
}
784784
}
785785
} else if (auto storeOp = dyn_cast<AffineLoadOp>(use.getOwner())) {
786-
if (storeOp.memref() == subindex) {
786+
if (storeOp.getMemref() == subindex) {
787787
if (subindex.getType().cast<MemRefType>().getShape().size() + 1 ==
788788
subindex.source()
789789
.getType()
@@ -858,7 +858,7 @@ struct SimplifySubViewUsers : public OpRewritePattern<memref::SubViewOp> {
858858
rewriter.replaceOpWithNewOp<memref::DeallocOp>(dealloc,
859859
subindex.source());
860860
} else if (auto loadOp = dyn_cast<memref::LoadOp>(use.getOwner())) {
861-
if (loadOp.memref() == subindex) {
861+
if (loadOp.getMemref() == subindex) {
862862
SmallVector<Value, 4> indices = loadOp.indices();
863863
if (subindex.getType().cast<MemRefType>().getShape().size() ==
864864
subindex.source()
@@ -893,7 +893,7 @@ struct SimplifySubViewUsers : public OpRewritePattern<memref::SubViewOp> {
893893
changed = true;
894894
}
895895
} else if (auto storeOp = dyn_cast<memref::StoreOp>(use.getOwner())) {
896-
if (storeOp.memref() == subindex) {
896+
if (storeOp.getMemref() == subindex) {
897897
SmallVector<Value, 4> indices = storeOp.indices();
898898
if (subindex.getType().cast<MemRefType>().getShape().size() ==
899899
subindex.source()
@@ -940,7 +940,7 @@ struct SimplifySubViewUsers : public OpRewritePattern<memref::SubViewOp> {
940940
changed = true;
941941
}
942942
} else if (auto storeOp = dyn_cast<AffineStoreOp>(use.getOwner())) {
943-
if (storeOp.memref() == subindex) {
943+
if (storeOp.getMemref() == subindex) {
944944
if (subindex.getType().cast<MemRefType>().getShape().size() + 1 ==
945945
subindex.source()
946946
.getType()
@@ -964,12 +964,12 @@ struct SimplifySubViewUsers : public OpRewritePattern<memref::SubViewOp> {
964964
.getShape()
965965
.size() == indices.size());
966966
rewriter.replaceOpWithNewOp<memref::StoreOp>(
967-
storeOp, storeOp.value(), subindex.source(), indices);
967+
storeOp, storeOp.getValue(), subindex.source(), indices);
968968
changed = true;
969969
}
970970
}
971971
} else if (auto storeOp = dyn_cast<AffineLoadOp>(use.getOwner())) {
972-
if (storeOp.memref() == subindex) {
972+
if (storeOp.getMemref() == subindex) {
973973
if (subindex.getType().cast<MemRefType>().getShape().size() + 1 ==
974974
subindex.source()
975975
.getType()
@@ -1090,18 +1090,18 @@ template <typename T> struct LoadSelect : public OpRewritePattern<T> {
10901090
};
10911091

10921092
template <> Value LoadSelect<memref::LoadOp>::ptr(memref::LoadOp op) {
1093-
return op.memref();
1093+
return op.getMemref();
10941094
}
10951095
template <>
10961096
MutableOperandRange LoadSelect<memref::LoadOp>::ptrMutable(memref::LoadOp op) {
1097-
return op.memrefMutable();
1097+
return op.getMemrefMutable();
10981098
}
10991099
template <> Value LoadSelect<AffineLoadOp>::ptr(AffineLoadOp op) {
1100-
return op.memref();
1100+
return op.getMemref();
11011101
}
11021102
template <>
11031103
MutableOperandRange LoadSelect<AffineLoadOp>::ptrMutable(AffineLoadOp op) {
1104-
return op.memrefMutable();
1104+
return op.getMemrefMutable();
11051105
}
11061106
template <> Value LoadSelect<LLVM::LoadOp>::ptr(LLVM::LoadOp op) {
11071107
return op.getAddr();
@@ -1469,7 +1469,7 @@ class MetaPointer2Memref final : public OpRewritePattern<Op> {
14691469

14701470
LogicalResult matchAndRewrite(Op op,
14711471
PatternRewriter &rewriter) const override {
1472-
Value opPtr = op.memref();
1472+
Value opPtr = op.getMemref();
14731473
Pointer2MemrefOp src = opPtr.getDefiningOp<polygeist::Pointer2MemrefOp>();
14741474
if (!src)
14751475
return failure();
@@ -1493,7 +1493,7 @@ class MetaPointer2Memref final : public OpRewritePattern<Op> {
14931493
}
14941494
}
14951495
if (eq) {
1496-
op.memrefMutable().assign(before.source());
1496+
op.getMemrefMutable().assign(before.source());
14971497
return success();
14981498
}
14991499
}
@@ -1592,7 +1592,7 @@ Value MetaPointer2Memref<AffineStoreOp>::computeIndex(
15921592
template <>
15931593
void MetaPointer2Memref<AffineStoreOp>::rewrite(
15941594
AffineStoreOp op, Value ptr, PatternRewriter &rewriter) const {
1595-
rewriter.replaceOpWithNewOp<LLVM::StoreOp>(op, op.value(), ptr);
1595+
rewriter.replaceOpWithNewOp<LLVM::StoreOp>(op, op.getValue(), ptr);
15961596
}
15971597

15981598
// Below is actually wrong as and(40, 1) != 0 !=== and(40 != 0, 1 != 0) =
@@ -1624,7 +1624,7 @@ class CmpAnd final : public OpRewritePattern<arith::CmpIOp> {
16241624
};
16251625
*/
16261626

1627-
#include "mlir/Dialect/SCF/SCF.h"
1627+
#include "mlir/Dialect/SCF/IR/SCF.h"
16281628
struct IfAndLazy : public OpRewritePattern<scf::IfOp> {
16291629
using OpRewritePattern<scf::IfOp>::OpRewritePattern;
16301630

@@ -1827,7 +1827,7 @@ struct MoveIntoIfs : public OpRewritePattern<scf::IfOp> {
18271827
storeOp.getMapOperands());
18281828
indices.push_back(apply->getResult(0));
18291829
}
1830-
rewriter.replaceOpWithNewOp<memref::LoadOp>(storeOp, storeOp.memref(),
1830+
rewriter.replaceOpWithNewOp<memref::LoadOp>(storeOp, storeOp.getMemref(),
18311831
indices);
18321832
} else if (auto storeOp = dyn_cast<AffineStoreOp>(use.getOwner())) {
18331833
std::vector<Value> indices;
@@ -1838,8 +1838,8 @@ struct MoveIntoIfs : public OpRewritePattern<scf::IfOp> {
18381838
storeOp.getMapOperands());
18391839
indices.push_back(apply->getResult(0));
18401840
}
1841-
rewriter.replaceOpWithNewOp<memref::StoreOp>(storeOp, storeOp.value(),
1842-
storeOp.memref(), indices);
1841+
rewriter.replaceOpWithNewOp<memref::StoreOp>(storeOp, storeOp.getValue(),
1842+
storeOp.getMemref(), indices);
18431843
}
18441844
}
18451845
rewriter.finalizeRootUpdate(prevOp);

polygeist/lib/polygeist/Passes/AffineCFG.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "mlir/Dialect/Affine/IR/AffineOps.h"
44
#include "mlir/Dialect/Affine/Passes.h"
55
#include "mlir/Dialect/MemRef/IR/MemRef.h"
6-
#include "mlir/Dialect/SCF/SCF.h"
6+
#include "mlir/Dialect/SCF/IR/SCF.h"
77
#include "mlir/IR/BlockAndValueMapping.h"
88
#include "mlir/IR/Dominance.h"
99
#include "mlir/IR/FunctionInterfaces.h"
@@ -824,8 +824,8 @@ struct CanonicalizeAffineApply : public OpRewritePattern<AffineApplyOp> {
824824
LogicalResult matchAndRewrite(AffineApplyOp affineOp,
825825
PatternRewriter &rewriter) const override {
826826

827-
SmallVector<Value, 4> mapOperands(affineOp.mapOperands());
828-
auto map = affineOp.map();
827+
SmallVector<Value, 4> mapOperands(affineOp.getMapOperands());
828+
auto map = affineOp.getMap();
829829
auto prevMap = map;
830830

831831
auto *scope = getAffineScope(affineOp)->getParentOp();
@@ -1255,8 +1255,8 @@ void AffineFixup<AffinePrefetchOp>::replaceAffineOp(
12551255
PatternRewriter &rewriter, AffinePrefetchOp prefetch, AffineMap map,
12561256
ArrayRef<Value> mapOperands) const {
12571257
rewriter.replaceOpWithNewOp<AffinePrefetchOp>(
1258-
prefetch, prefetch.memref(), map, mapOperands, prefetch.localityHint(),
1259-
prefetch.isWrite(), prefetch.isDataCache());
1258+
prefetch, prefetch.getMemref(), map, mapOperands, prefetch.getLocalityHint(),
1259+
prefetch.getIsWrite(), prefetch.getIsDataCache());
12601260
}
12611261
template <>
12621262
void AffineFixup<AffineStoreOp>::replaceAffineOp(
@@ -1431,10 +1431,10 @@ struct MoveIfToAffine : public OpRewritePattern<scf::IfOp> {
14311431
ifOp.elseYield(), ifOp.elseYield().getOperands());
14321432
}
14331433

1434-
rewriter.inlineRegionBefore(ifOp.getThenRegion(), affineIfOp.thenRegion(),
1435-
affineIfOp.thenRegion().begin());
1436-
rewriter.inlineRegionBefore(ifOp.getElseRegion(), affineIfOp.elseRegion(),
1437-
affineIfOp.elseRegion().begin());
1434+
rewriter.inlineRegionBefore(ifOp.getThenRegion(), affineIfOp.getThenRegion(),
1435+
affineIfOp.getThenRegion().begin());
1436+
rewriter.inlineRegionBefore(ifOp.getElseRegion(), affineIfOp.getElseRegion(),
1437+
affineIfOp.getElseRegion().begin());
14381438

14391439
rewriter.replaceOp(ifOp, affineIfOp.getResults());
14401440
return success();

polygeist/lib/polygeist/Passes/AffineReduction.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ struct AffineForReductionIter : public OpRewritePattern<AffineForOp> {
4040
bool haveSameIndices(AffineLoadOp load, T storeOrLoad) const {
4141
static_assert(llvm::is_one_of<T, AffineLoadOp, AffineStoreOp>::value,
4242
"applies to only AffineLoadOp or AffineStoreOp");
43-
SmallVector<Value, 4> loadIndices(load.indices());
44-
SmallVector<Value, 4> storeOrLoadIndices = storeOrLoad.indices();
43+
SmallVector<Value, 4> loadIndices(load.getIndices());
44+
SmallVector<Value, 4> storeOrLoadIndices = storeOrLoad.getIndices();
4545
if (loadIndices.size() != storeOrLoadIndices.size())
4646
return false;
4747
return std::equal(loadIndices.begin(), loadIndices.end(),
@@ -97,7 +97,7 @@ struct AffineForReductionIter : public OpRewritePattern<AffineForOp> {
9797
SmallVector<SmallVector<Operation *>> loadsInFor;
9898
block->walk([&](Operation *operation) {
9999
if (auto load = dyn_cast<AffineLoadOp>(operation)) {
100-
SmallVector<Value, 4> indices(load.indices());
100+
SmallVector<Value, 4> indices(load.getIndices());
101101
// skip load if all dimensions are not reduced.
102102
if (!hasAllDimsReduced(indices, forOp.getInductionVar()))
103103
return WalkResult::advance();
@@ -242,7 +242,7 @@ struct AffineForReductionIter : public OpRewritePattern<AffineForOp> {
242242
rewriter.create<AffineStoreOp>(
243243
newForOp.getLoc(),
244244
newForOp.getResults()[forOp.getResults().size() + i],
245-
store.getMemRef(), store.getAffineMap(), store.indices());
245+
store.getMemRef(), store.getAffineMap(), store.getIndices());
246246
rewriter.eraseOp(std::get<1>(pair));
247247
++i;
248248
}

polygeist/lib/polygeist/Passes/BarrierRemovalContinuation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
1919
#include "mlir/Dialect/Func/IR/FuncOps.h"
2020
#include "mlir/Dialect/MemRef/IR/MemRef.h"
21-
#include "mlir/Dialect/SCF/Passes.h"
22-
#include "mlir/Dialect/SCF/SCF.h"
21+
#include "mlir/Dialect/SCF/Transforms/Passes.h"
22+
#include "mlir/Dialect/SCF/IR/SCF.h"
2323
#include "mlir/IR/BlockAndValueMapping.h"
2424
#include "mlir/IR/BuiltinOps.h"
2525
#include "mlir/IR/Dominance.h"

polygeist/lib/polygeist/Passes/CanonicalizeFor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include "PassDetails.h"
22

33
#include "mlir/Dialect/Func/IR/FuncOps.h"
4-
#include "mlir/Dialect/SCF/Passes.h"
5-
#include "mlir/Dialect/SCF/SCF.h"
4+
#include "mlir/Dialect/SCF/Transforms/Passes.h"
5+
#include "mlir/Dialect/SCF/IR/SCF.h"
66
#include "mlir/IR/BlockAndValueMapping.h"
77
#include "mlir/IR/Dominance.h"
88
#include "mlir/IR/Matchers.h"

polygeist/lib/polygeist/Passes/ConvertPolygeistToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
2828
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
2929
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
30-
#include "mlir/Dialect/SCF/SCF.h"
30+
#include "mlir/Dialect/SCF/IR/SCF.h"
3131
#include "mlir/IR/BlockAndValueMapping.h"
3232
#include "mlir/IR/ImplicitLocOpBuilder.h"
3333
#include "mlir/Transforms/RegionUtils.h"

polygeist/lib/polygeist/Passes/InnerSerialization.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include "mlir/Dialect/Func/IR/FuncOps.h"
44
#include "mlir/Dialect/MemRef/IR/MemRef.h"
55
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
6-
#include "mlir/Dialect/SCF/Passes.h"
7-
#include "mlir/Dialect/SCF/SCF.h"
6+
#include "mlir/Dialect/SCF/Transforms/Passes.h"
7+
#include "mlir/Dialect/SCF/IR/SCF.h"
88
#include "mlir/IR/BlockAndValueMapping.h"
99
#include "mlir/IR/Dominance.h"
1010
#include "mlir/IR/Matchers.h"

polygeist/lib/polygeist/Passes/LoopRestructure.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
1313
#include "mlir/Dialect/Func/IR/FuncOps.h"
1414
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
15-
#include "mlir/Dialect/SCF/SCF.h"
15+
#include "mlir/Dialect/SCF/IR/SCF.h"
1616
#include "mlir/IR/Builders.h"
1717
#include "mlir/IR/Dominance.h"
1818
#include "mlir/IR/PatternMatch.h"

0 commit comments

Comments
 (0)