Skip to content

Commit

Permalink
Rename memory-copy-fill-lowering pass (#7082)
Browse files Browse the repository at this point in the history
Since the resulting code has the same undefined behavior as LLVM, make
the pass name reflect that.
  • Loading branch information
dschuff authored Nov 16, 2024
1 parent f6f898b commit 69591de
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/passes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ set(passes_SOURCES
JSPI.cpp
LegalizeJSInterface.cpp
LimitSegments.cpp
LLVMMemoryCopyFillLowering.cpp
LocalCSE.cpp
LocalSubtyping.cpp
LogExecution.cpp
LoopInvariantCodeMotion.cpp
Memory64Lowering.cpp
MemoryCopyFillLowering.cpp
MemoryPacking.cpp
MergeBlocks.cpp
MergeSimilarFunctions.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
// particular, pointer overflow is UB and not handled here).

namespace wasm {
struct MemoryCopyFillLowering
: public WalkerPass<PostWalker<MemoryCopyFillLowering>> {
struct LLVMMemoryCopyFillLowering
: public WalkerPass<PostWalker<LLVMMemoryCopyFillLowering>> {
bool needsMemoryCopy = false;
bool needsMemoryFill = false;
Name memCopyFuncName;
Expand Down Expand Up @@ -253,8 +253,8 @@ struct MemoryCopyFillLowering
}
};

Pass* createMemoryCopyFillLoweringPass() {
return new MemoryCopyFillLowering();
Pass* createLLVMMemoryCopyFillLoweringPass() {
return new LLVMMemoryCopyFillLowering();
}

} // namespace wasm
4 changes: 2 additions & 2 deletions src/passes/pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,10 @@ void PassRegistry::registerPasses() {
registerPass("table64-lowering",
"lower 64-bit tables 32-bit ones",
createTable64LoweringPass);
registerPass("memory-copy-fill-lowering",
registerPass("llvm-memory-copy-fill-lowering",
"Lower memory.copy and memory.fill to wasm mvp and disable "
"the bulk-memory feature.",
createMemoryCopyFillLoweringPass);
createLLVMMemoryCopyFillLoweringPass);
registerPass("memory-packing",
"packs memory into separate segments, skipping zeros",
createMemoryPackingPass);
Expand Down
2 changes: 1 addition & 1 deletion src/passes/passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Pass* createIntrinsicLoweringPass();
Pass* createTraceCallsPass();
Pass* createInstrumentLocalsPass();
Pass* createInstrumentMemoryPass();
Pass* createLLVMMemoryCopyFillLoweringPass();
Pass* createLoopInvariantCodeMotionPass();
Pass* createMemory64LoweringPass();
Pass* createMemoryPackingPass();
Expand Down Expand Up @@ -116,7 +117,6 @@ Pass* createOptimizeForJSPass();
Pass* createOutliningPass();
#endif
Pass* createPickLoadSignsPass();
Pass* createMemoryCopyFillLoweringPass();
Pass* createModAsyncifyAlwaysOnlyUnwindPass();
Pass* createModAsyncifyNeverUnwindPass();
Pass* createPoppifyPass();
Expand Down
2 changes: 1 addition & 1 deletion test/lit/exec/memory-copy.wat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited.

;; RUN: wasm-opt %s --enable-bulk-memory --memory-copy-fill-lowering --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s
;; RUN: wasm-opt %s --enable-bulk-memory --llvm-memory-copy-fill-lowering --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s

;; Tests derived from bulk-memory.wast spec tests

Expand Down
2 changes: 1 addition & 1 deletion test/lit/exec/memory-fill.wat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited.

;; RUN: wasm-opt %s --enable-bulk-memory --memory-copy-fill-lowering --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s
;; RUN: wasm-opt %s --enable-bulk-memory --llvm-memory-copy-fill-lowering --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s

;; Tests derived from bulk-memory.wast spec tests

Expand Down
8 changes: 4 additions & 4 deletions test/lit/help/wasm-metadce.test
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@
;; CHECK-NEXT: --limit-segments attempt to merge segments to fit
;; CHECK-NEXT: within web limits
;; CHECK-NEXT:
;; CHECK-NEXT: --llvm-memory-copy-fill-lowering Lower memory.copy and
;; CHECK-NEXT: memory.fill to wasm mvp and
;; CHECK-NEXT: disable the bulk-memory feature.
;; CHECK-NEXT:
;; CHECK-NEXT: --local-cse common subexpression elimination
;; CHECK-NEXT: inside basic blocks
;; CHECK-NEXT:
Expand All @@ -239,10 +243,6 @@
;; CHECK-NEXT: --log-execution instrument the build with
;; CHECK-NEXT: logging of where execution goes
;; CHECK-NEXT:
;; CHECK-NEXT: --memory-copy-fill-lowering Lower memory.copy and
;; CHECK-NEXT: memory.fill to wasm mvp and
;; CHECK-NEXT: disable the bulk-memory feature.
;; CHECK-NEXT:
;; CHECK-NEXT: --memory-packing packs memory into separate
;; CHECK-NEXT: segments, skipping zeros
;; CHECK-NEXT:
Expand Down
8 changes: 4 additions & 4 deletions test/lit/help/wasm-opt.test
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@
;; CHECK-NEXT: --limit-segments attempt to merge segments to fit
;; CHECK-NEXT: within web limits
;; CHECK-NEXT:
;; CHECK-NEXT: --llvm-memory-copy-fill-lowering Lower memory.copy and
;; CHECK-NEXT: memory.fill to wasm mvp and
;; CHECK-NEXT: disable the bulk-memory feature.
;; CHECK-NEXT:
;; CHECK-NEXT: --local-cse common subexpression elimination
;; CHECK-NEXT: inside basic blocks
;; CHECK-NEXT:
Expand All @@ -248,10 +252,6 @@
;; CHECK-NEXT: --log-execution instrument the build with
;; CHECK-NEXT: logging of where execution goes
;; CHECK-NEXT:
;; CHECK-NEXT: --memory-copy-fill-lowering Lower memory.copy and
;; CHECK-NEXT: memory.fill to wasm mvp and
;; CHECK-NEXT: disable the bulk-memory feature.
;; CHECK-NEXT:
;; CHECK-NEXT: --memory-packing packs memory into separate
;; CHECK-NEXT: segments, skipping zeros
;; CHECK-NEXT:
Expand Down
8 changes: 4 additions & 4 deletions test/lit/help/wasm2js.test
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@
;; CHECK-NEXT: --limit-segments attempt to merge segments to fit
;; CHECK-NEXT: within web limits
;; CHECK-NEXT:
;; CHECK-NEXT: --llvm-memory-copy-fill-lowering Lower memory.copy and
;; CHECK-NEXT: memory.fill to wasm mvp and
;; CHECK-NEXT: disable the bulk-memory feature.
;; CHECK-NEXT:
;; CHECK-NEXT: --local-cse common subexpression elimination
;; CHECK-NEXT: inside basic blocks
;; CHECK-NEXT:
Expand All @@ -202,10 +206,6 @@
;; CHECK-NEXT: --log-execution instrument the build with
;; CHECK-NEXT: logging of where execution goes
;; CHECK-NEXT:
;; CHECK-NEXT: --memory-copy-fill-lowering Lower memory.copy and
;; CHECK-NEXT: memory.fill to wasm mvp and
;; CHECK-NEXT: disable the bulk-memory feature.
;; CHECK-NEXT:
;; CHECK-NEXT: --memory-packing packs memory into separate
;; CHECK-NEXT: segments, skipping zeros
;; CHECK-NEXT:
Expand Down
2 changes: 1 addition & 1 deletion test/lit/passes/memory-copy-fill-lowering.wast
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.

;; RUN: wasm-opt --enable-bulk-memory %s --memory-copy-fill-lowering -S -o - | filecheck %s
;; RUN: wasm-opt --enable-bulk-memory %s --llvm-memory-copy-fill-lowering -S -o - | filecheck %s

(module
(memory 0)
Expand Down

0 comments on commit 69591de

Please sign in to comment.