[all-commits] [llvm/llvm-project] 8df30d: [WebAssembly] Do not omit range checks for i64 swi...

Thomas Lively via All-commits all-commits at lists.llvm.org
Fri Jul 3 17:15:57 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8df30d988e9e595fa9883706198aec23b2e6d227
      https://github.com/llvm/llvm-project/commit/8df30d988e9e595fa9883706198aec23b2e6d227
  Author: Thomas Lively <tlively at google.com>
  Date:   2020-07-03 (Fri, 03 Jul 2020)

  Changed paths:
    M llvm/lib/Target/WebAssembly/WebAssemblyFixBrTableDefaults.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
    M llvm/test/CodeGen/WebAssembly/switch.ll

  Log Message:
  -----------
  [WebAssembly] Do not omit range checks for i64 switches

Summary:
Since the br_table instruction takes an i32, switches over i64s (and
larger integers) must use the i32.wrap_i64 instruction to truncate the
table index. This truncation makes numbers just over 2^32
indistinguishable from small numbers, so it was a miscompilation to
omit the range check preceding these br_tables. This change fixes the
problem by skipping the "fixing" of the br_table when the range check
is an i64 instruction.

Fixes PR46447.

Reviewers: aheejin, dschuff, kripken

Reviewed By: kripken

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D83017




More information about the All-commits mailing list