[PATCH] D83017: [WebAssembly] Do not omit range checks for i64 switches
Thomas Lively via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 1 18:23:07 PDT 2020
tlively created this revision.
tlively added reviewers: aheejin, dschuff, kripken.
Herald added subscribers: llvm-commits, sunfish, hiraditya, jgravelle-google, sbc100.
Herald added a project: LLVM.
tlively edited the summary of this revision.
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 its index is the
result of a i32.wrap_i64 instruction.
Fixes PR46447.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83017
Files:
llvm/lib/Target/WebAssembly/WebAssemblyFixBrTableDefaults.cpp
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
llvm/test/CodeGen/WebAssembly/switch.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83017.274976.patch
Type: text/x-patch
Size: 5390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200702/dc1beb7d/attachment.bin>
More information about the llvm-commits
mailing list