[PATCH] D80863: [WebAssembly] Eliminate range checks on br_tables

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 30 10:35:24 PDT 2020


sbc100 added inline comments.


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyFixBrTableDefaults.cpp:119
+INITIALIZE_PASS(WebAssemblyFixBrTableDefaults, DEBUG_TYPE,
+                "Removes irreducible control flow", false, false);
+
----------------
Lies!


================
Comment at: llvm/test/CodeGen/WebAssembly/cfg-stackify.ll:652
 ; CHECK-NEXT:  block   {{$}}
-; CHECK:       br_if     0, {{[^,]+}}{{$}}
-; CHECK:       br        3{{$}}
-; CHECK-NEXT:  .LBB{{[0-9]+}}_7:
-; CHECK-NEXT:  end_block{{$}}
-; CHECK:       block   {{$}}
-; CHECK-NEXT:  br_table   $0, 0, 3, 1, 2, 0
-; CHECK-NEXT:  .LBB{{[0-9]+}}_8:
+; CHECK:       br_table   $pop{{[^,]+}}, 0, 3, 1, 2, 3
+; CHECK-NEXT:  .LBB{{[0-9]+}}_6:
----------------
Can this be CHECK-NEXT too now?  So we know the br_if is not there?


================
Comment at: llvm/test/CodeGen/WebAssembly/switch-unreachable-default.ll:7
+; Test that switches are lowered correctly in the presence of an
+; unreachable default branch target.
+
----------------
So if the default label contains unreachable then we end up in some special case where that target doesn't actually exist in the final output, and we instead just arbitrarily jump to any other the labels?

Is this standard llvm behaviour?  Is is that default target in this case eliminated by some earlier pass?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80863/new/

https://reviews.llvm.org/D80863





More information about the llvm-commits mailing list