From 74782d217ed15dd73b58b1636c563aa51334a576 Mon Sep 17 00:00:00 2001 From: Thomas Lively <tlively123@gmail.com> Date: Mon, 2 Dec 2024 15:18:57 -0800 Subject: Do not sink blocks into ifs with unreachable conditions (#7129) RemoveUnusedBrs sinks blocks into If arms when those arms contain branches to the blocks and the other arm and condition do not. Now that we type Ifs with unreachable conditions as unreachable, it is possible for the If arms to have a different type than the block that would be sunk, so sinking the block would produce invalid IR. Fix the problem by never sinking blocks into Ifs with unreachable conditions. Fixes #7128. --- .../passes/remove-unused-brs_enable-multivalue.txt | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'test/passes/remove-unused-brs_enable-multivalue.txt') diff --git a/test/passes/remove-unused-brs_enable-multivalue.txt b/test/passes/remove-unused-brs_enable-multivalue.txt index 54780f0d9..a20f2905b 100644 --- a/test/passes/remove-unused-brs_enable-multivalue.txt +++ b/test/passes/remove-unused-brs_enable-multivalue.txt @@ -2389,12 +2389,12 @@ (loop $label$1 (br_if $label$1 (block $label$2 - (if - (block $label$4 - (unreachable) - ) - (then - (block $label$3 + (block $label$3 + (if + (block $label$4 + (unreachable) + ) + (then (br $label$3) ) ) @@ -2405,15 +2405,15 @@ ) ) (func $if-arm-unreachable - (if - (unreachable) - (then - (block $label$1 + (block $label$1 + (if + (unreachable) + (then (nop) ) - ) - (else - (unreachable) + (else + (unreachable) + ) ) ) ) -- cgit v1.2.3