Skip to content

Commit

Permalink
[Reg2Mem] understands scop.ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
kumasento committed Oct 21, 2021
1 parent a83a0c8 commit aa454e9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Transforms/Reg2Mem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ class RegToMemPass
mlir::FuncOp f = getOperation();
auto builder = OpBuilder(f.getContext());

if (f->hasAttr("scop.ignored"))
return;

separateAffineIfBlocks(f, builder);
demoteRegisterToMemory(f, builder);
}
Expand Down
14 changes: 14 additions & 0 deletions test/polymer-opt/Reg2Mem/ignored.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: polymer-opt %s -reg2mem | FileCheck %s
func @foo(%A: memref<?xf32>) attributes {scop.ignored} {
%0 = affine.load %A[0] : memref<?xf32>
affine.for %i = 1 to 30 {
affine.store %0, %A[%i] : memref<?xf32>
}

return
}

// CHECK: func @foo
// CHECK-NEXT: %[[v0:.*]] = affine.load
// CHECK-NEXT: affine.for %{{.*}} = 1 to 30
// CHECK-NEXT: affine.store %[[v0]]

0 comments on commit aa454e9

Please sign in to comment.