Skip to content

Commit ffcefc5

Browse files
authored
Fix typing in RemoveRelaxedSIMD (#8863)
When RemoveRelaxedSIMD replaced a relaxed SIMD instruction with a block ending in `(unreachable)`, it previously failed to set that block's type to `Type::unreachable`. When the block's parent was another relaxed SIMD instruction, the incorrect type caused an assertion failure.
1 parent 87be9bb commit ffcefc5

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/passes/RemoveRelaxedSIMD.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct RemoveRelaxedSIMD : WalkerPass<PostWalker<RemoveRelaxedSIMD>> {
4040
ChildLocalizer(curr, getFunction(), *getModule(), getPassOptions())
4141
.getChildrenReplacement();
4242
block->list.push_back(Builder(*getModule()).makeUnreachable());
43+
block->type = Type::unreachable;
4344
replaceCurrent(block);
4445
}
4546

test/lit/passes/remove-relaxed-simd.wast

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,21 @@
192192
)
193193
)
194194
)
195+
196+
;; CHECK: (func $nested (type $1) (result v128)
197+
;; CHECK-NEXT: (block
198+
;; CHECK-NEXT: (unreachable)
199+
;; CHECK-NEXT: )
200+
;; CHECK-NEXT: (unreachable)
201+
;; CHECK-NEXT: )
202+
(func $nested (result v128)
203+
(f32x4.relaxed_min
204+
(v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000)
205+
(f32x4.relaxed_madd
206+
(v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000)
207+
(v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000)
208+
(v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000)
209+
)
210+
)
211+
)
195212
)

0 commit comments

Comments
 (0)