Changes

Summary

  1. [WebAssembly] Treat __cxa_end_catch not longjmpable in Emscripten SjLj (details)
  2. [WebAssembly] Don't copy noreturn attr to invokes (details)
  3. [WebAssembly] Error out for setjmp within catch clause for Wasm SjLj (details)
  4. [WebAssembly] Handle cleanuppad with no parent in Wasm SjLj (details)
  5. [WebAssembly] Nullify unnecessary setjmp invokes (details)
  6. [Test] One more test for 'ne' and-reduce pattern (details)
  7. [RISCV] Split bswap-bitreverse-ctlz-cttz-ctpop.ll into two files bswap/bitreverse and ctlz/cttz/ctpop. NFC (details)
  8. Revert "clang-format: [JS] sort import aliases." (details)
  9. [RISCV] Add Zbkb RUN lines to bswap-bitreverse.ll. NFC (details)
  10. [NFC] Mark the parameter const for isSame* methods in ASTContext (details)
Commit d9517efbb3dc24e725b397031b3bffc6c5c1004e by aheejin
[WebAssembly] Treat __cxa_end_catch not longjmpable in Emscripten SjLj

In D117610 we treated `__cxa_end_catch` longjmpable even though it was
not to make unwind destination relationships correct. But we only need
to do this in Wasm SjLj, and doing this in Emscripten SjLj does not make
the code incorrect but add unnecessary invokes. This CL treats
`__cxa_end_catch` longjmpable only in Wasm SjLj.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D117943
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
The file was modifiedllvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll
Commit 786da40667dc311b07a666abe3f5ca29d871de40 by aheejin
[WebAssembly] Don't copy noreturn attr to invokes

When we create an invoke wrapper call, if the original call instruction
has a `noreturn` attribute, we shouldn't copy it, because we expect
invoke wrapper calls to return. This generated incorrect `free` call
before an invoke wrapper call that calls `__cxa_throw`, because
`__cxa_throw` has `noreturn` attribute.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D118274
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
The file was modifiedllvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll
Commit 26d587cf0f153724dd9b4307773caa2ffba08ef4 by aheejin
[WebAssembly] Error out for setjmp within catch clause for Wasm SjLj

Wasm EH, used with either of Emscripten SjLj or Wasm SjLj, does not
allow `setjmp` calls to be placed within a `catch` clause, because we
don't support jumping into a `catch` block. Emscripten EH does not have
this restriction. But I think this restriction wouldn't prevent most of
use cases. This CL errors out with a clear messsage for this case.

Reviewed By: dschuff, kripken

Differential Revision: https://reviews.llvm.org/D118286
The file was addedllvm/test/CodeGen/WebAssembly/wasm-eh-sjlj-setjmp-within-catch.ll
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
Commit 20c1d9ce5ece40ec779f3e5898a369fce9c7ba0b by aheejin
[WebAssembly] Handle cleanuppad with no parent in Wasm SjLj

Wasm SjLj converts longjmpable calls into `invoke`s that unwind to
`%catch.longjmp.dispatch` BB, from where we check if the thrown
exception is a `longjmp`. But in case a call already has a `funclet`
attribute, i.e., it is within a catch scope, we have to unwind to its
unwind destination first to preserve the scoping structure. That will
eventually unwind to `%catch.longjmp.dispatch`, because all
`catchswitch` and `cleanupret` that unwind to caller are redirected to
`%catch.dispatch.longjmp` during Wasm SjLj transformation.

But the prevous code assumed `cleanuppad`'s parent pad was always an
instruction, and didn't handle when a `cleanuppad`'s parent is `none`.
This CL handles this case, and makes the `while` loop more intuitive by
removing `FromPad` condition and explicitly inserting `break`s.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D118407
The file was modifiedllvm/test/CodeGen/WebAssembly/lower-wasm-ehsjlj.ll
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
Commit 4f1244d7ccb8a9d1c932e2a7d883d0cd1da9650d by aheejin
[WebAssembly] Nullify unnecessary setjmp invokes

This is similar to D116619, but now it handles `invoke`s. The reason we
didn't handle `invoke`s back then was we didn't support Wasm EH + Wasm
SjLj together, and the only case SjLj transformation will see `invoke`s
is when we are using Wasm EH. (In Emscripten EH, they would have been
transformed to `call`s to invoke wrappers.)

But after D117610 we support Wasm EH + Wasm SjLj together and we can
nullify `invoke`s to `setjmp` when there is no other longjmpable calls
within the function. Actually this is very unlikely to happen in
practice, because we treat destructors as longjmpable and also treat
`__cxa_end_catch` as longjmpable even if it is not.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D118408
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
The file was modifiedllvm/test/CodeGen/WebAssembly/lower-em-sjlj.ll
The file was modifiedllvm/test/CodeGen/WebAssembly/lower-wasm-ehsjlj.ll
Commit b3d2a96d6587a9a2f49d1699090a23d0e2b477b5 by mkazantsev
[Test] One more test for 'ne' and-reduce pattern
The file was modifiedllvm/test/Transforms/InstCombine/icmp-vec.ll
Commit dcd751b26ea612b57e4d74568959027cadb2b4b8 by craig.topper
[RISCV] Split bswap-bitreverse-ctlz-cttz-ctpop.ll into two files bswap/bitreverse and ctlz/cttz/ctpop. NFC

Add Zbkb command lines to the bswap/bitreverse test.
The file was removedllvm/test/CodeGen/RISCV/bswap-bitreverse-ctlz-cttz-ctpop.ll
The file was addedllvm/test/CodeGen/RISCV/bswap-bitreverse.ll
The file was addedllvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll
Commit f750c3d95a0c8bf1d21380ae753fce12010a7561 by Vitaly Buka
Revert "clang-format: [JS] sort import aliases."

Triggers MSAN report.

This reverts commit c6d5efb5d98093c4bd7578b2ea52c9032d20dea3.
The file was modifiedclang/unittests/Format/SortImportsTestJS.cpp
The file was modifiedclang/lib/Format/SortJavaScriptImports.cpp
Commit 3e98ce45b6762f61da754ba7ae62bcdb9184e515 by craig.topper
[RISCV] Add Zbkb RUN lines to bswap-bitreverse.ll. NFC
The file was modifiedllvm/test/CodeGen/RISCV/bswap-bitreverse.ll
Commit 8cc23bde264e6b19eb10784750cf1cf70bbb2475 by yedeng.yd
[NFC] Mark the parameter const for isSame* methods in ASTContext
The file was modifiedclang/lib/AST/ASTContext.cpp
The file was modifiedclang/include/clang/AST/ASTContext.h