OSDN Git Service

[WebAssembly] Do not assume br_table range checks will be gt_u
authorThomas Lively <tlively@google.com>
Sun, 5 Jul 2020 01:11:24 +0000 (18:11 -0700)
committerThomas Lively <tlively@google.com>
Sun, 5 Jul 2020 01:11:24 +0000 (18:11 -0700)
commit65330f394b2c5ede01acb97a84112c3cc0127c46
tree28af39e759c1e1f979ec2029a35b9d8cb9b107cd
parent7e2d27bc554eb607c90e55c89d2537f5d711234c
[WebAssembly] Do not assume br_table range checks will be gt_u

OSS-Fuzz and the Emscripten test suite uncovered some edge cases in
which the range check instruction seemed to be an (i32.const 0) or
other unexpected instruction, triggering an assertion. Unfortunately
the reproducers are rather complicated, so they don't make good unit
tests. This commit removes the bad assertion and conservatively
optimizes range checks only when the range check instruction is
i32.gt_u.

Differential Revision: https://reviews.llvm.org/D83169
llvm/lib/Target/WebAssembly/WebAssemblyFixBrTableDefaults.cpp