sunfish added a comment. In D66983#1651981 <https://reviews.llvm.org/D66983#1651981>, @craig.topper wrote:
> DAG combine is supposed to check with TargetLowering::isShuffleMaskLegal. In @tlively's example, it is DAGCombine, and it does check isShuffleMaskLegal. However for wasm, it appears that's not enough -- in wasm, all shuffle masks are legal, because you can do any shuffle in a single wasm instruction. This makes it tricky, because the user here is aiming for an x86-like cost model, but the LLVM wasm backend doesn't have any x86-specific knowledge, so it just tells DAGCombine to form any shuffle it sees fit. I wonder if it would make sense to introduce a counterpart to isShuffleMaskLegal, which instead of returning a bool returned a cost value. And then, we could teach the wasm backend about certain shuffle patterns which are known to be fast across multiple architectures. Then we could teach DAGComine to check whether the new shuffle it wants to create is actually cheaper than the one it's replacing. Thoughts? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66983/new/ https://reviews.llvm.org/D66983 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits