Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/ir/metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ void copyBetweenFunctions(Expression* origin,
Function* originFunc,
Function* copyFunc) {
if (originFunc->debugLocations.empty() &&
originFunc->codeAnnotations.empty() &&
originFunc->funcAnnotations.empty()) {
originFunc->codeAnnotations.empty()) {
// Nothing to copy.
return;
}
Expand Down Expand Up @@ -75,9 +74,6 @@ void copyBetweenFunctions(Expression* origin,
}
}
}

// Also copy function-level annotations.
copyFunc->funcAnnotations = originFunc->funcAnnotations;
}

#pragma GCC diagnostic push
Expand Down
1 change: 1 addition & 0 deletions src/ir/module-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ copyFunctionWithoutAdd(Function* func,
ret->localIndices = func->localIndices;
ret->body = ExpressionManipulator::copy(func->body, out);
metadata::copyBetweenFunctions(func->body, ret->body, func, ret.get());
ret->funcAnnotations = func->funcAnnotations;
ret->prologLocation = func->prologLocation;
ret->epilogLocation = func->epilogLocation;
// Update file indices if needed
Expand Down
33 changes: 33 additions & 0 deletions test/lit/passes/inlining-optimizing-removable-if-unused.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.

;; RUN: wasm-opt %s --inlining-optimizing -S -o - | filecheck %s

(module
;; CHECK: (import "" "" (func $import (param i32)))
(import "" "" (func $import (param i32)))
;; CHECK: (export "test" (func $test))
(export "test" (func $test))
;; CHECK: (func $test
;; CHECK-NEXT: (call $import
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test
(call $main)
)
(func $main
(call $print)
)
(func $print
;; $print should not inherit the removable.if.unused attribute from the
;; inlined call to $removable. (If it did, then we would incorrectly remove
;; the call to the import.)
(call $import
(call $removable)
)
)
(@binaryen.removable.if.unused)
(func $removable (result i32)
(i32.const 0)
)
)
Loading