[WebAssembly] Fix selection of global calls
authorHeejin Ahn <aheejin@gmail.com>
Wed, 29 Mar 2023 19:40:30 +0000 (12:40 -0700)
committerHeejin Ahn <aheejin@gmail.com>
Wed, 5 Apr 2023 08:42:36 +0000 (01:42 -0700)
commit0e37487df8e030b9e468166fa3d088678bf7d0a1
treead99d72f215c185d8b27cc00ccd315adf9613891
parent47fc0186e6306f498f463ec1e3fd92b827be7d20
[WebAssembly] Fix selection of global calls

When selecting calls, currently we unconditionally remove `Wrapper`s of
the call target. But we are supposed to do that only when the target is
a function, an external symbol (= library function), or an alias of a
function. Otherwise we end up directly calling globals that are not
functions.

Fixes https://github.com/llvm/llvm-project/issues/60003.

Reviewed By: tlively, HerrCai0907

Differential Revision: https://reviews.llvm.org/D147397
llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
llvm/test/CodeGen/WebAssembly/call.ll