Changes

Summary

  1. [Coroutine] Properly deal with byval and noalias parameters (details)
  2. Bring our handling of -Wframe-larger-than more in line with GCC. (details)
  3. [WebAssembly] Rename event to tag (details)
  4. [AMDGPU] Remove duplicate setOperationAction for v4i16/v4f16 (NFC) (details)
  5. [objdump][ARM] Fix evaluating the target address of a Thumb BLX(i) (details)
  6. [InstCombine][NFC] Added tests for mul with zext/sext operands (details)
Commit 3522167efd80e2fef42a865cdf7481d60d062603 by lxfind
[Coroutine] Properly deal with byval and noalias parameters

This patch is to address https://bugs.llvm.org/show_bug.cgi?id=48857.
Previous attempts can be found in D104007 and D101980.
A lot of discussions can be found in those two patches.
To summarize the bug:
When Clang emits IR for coroutines, the first thing it does is to make a copy of every argument to the local stack, so that uses of the arguments in the function will all refer to the local copies instead of the arguments directly.
However, in some cases we find that arguments are still directly used:
When Clang emits IR for a function that has pass-by-value arguments, sometimes it emits an argument with byval attribute. A byval attribute is considered to be local to the function (just like alloca) and hence it can be easily determined that it does not alias other values. If in the IR there exists a memcpy from a byval argument to a local alloca, and then from that local alloca to another alloca, MemCpyOpt will optimize out the first memcpy because byval argument's content will not change. This causes issues because after a coroutine suspension, the byval argument may die outside of the function, and latter uses will lead to memory use-after-free.
This is only a problem for arguments with either byval attribute or noalias attribute, because only these two kinds are considered local. Arguments without these two attributes will be considered to alias coro_suspend and hence we won't have this problem. So we need to be able to deal with these two attributes in coroutines properly.
For noalias arguments, since coro_suspend may potentially change the value of any argument outside of the function, we simply shouldn't mark any argument in a coroutiune as noalias. This can be taken care of in CoroEarly pass.
For byval arguments, if such an argument needs to live across suspensions, we will have to copy their value content to the frame, not just the pointer.

Differential Revision: https://reviews.llvm.org/D104184
The file was modifiedllvm/lib/Transforms/Coroutines/CoroEarly.cpp
The file was addedllvm/test/Transforms/Coroutines/coro-noalias-param.ll
The file was modifiedllvm/lib/Transforms/Coroutines/CoroFrame.cpp
The file was addedllvm/test/Transforms/Coroutines/coro-byval-param.ll
Commit 6aaf4fa2885600b0e31042071ad06f78218ab0f2 by richard
Bring our handling of -Wframe-larger-than more in line with GCC.

Support -Wno-frame-larger-than (with no =) and make it properly
interoperate with -Wframe-larger-than. Reject -Wframe-larger-than with
no argument.

We continue to support Clang's old spelling, -Wframe-larger-than=, for
compatibility with existing users of that facility.

In passing, stop the driver from accepting and ignoring
-fwarn-stack-size and make it a cc1-only flag as intended.
The file was modifiedclang/test/Misc/backend-stack-frame-diagnostics.cpp
The file was modifiedclang/include/clang/Basic/DiagnosticFrontendKinds.td
The file was modifiedclang/include/clang/Basic/DiagnosticGroups.td
The file was modifiedclang/lib/Driver/ToolChains/Clang.cpp
The file was modifiedclang/test/Frontend/backend-diagnostic.c
The file was modifiedclang/include/clang/Driver/Options.td
The file was modifiedclang/test/Driver/Wframe-larger-than.c
Commit 1d891d44f33f99c55e779acaeac4628e4ac9aaaf by aheejin
[WebAssembly] Rename event to tag

We recently decided to change 'event' to 'tag', and 'event section' to
'tag section', out of the rationale that the section contains a
generalized tag that references a type, which may be used for something
other than exceptions, and the name 'event' can be confusing in the web
context.

See
- https://github.com/WebAssembly/exception-handling/issues/159#issuecomment-857910130
- https://github.com/WebAssembly/exception-handling/pull/161

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D104423
The file was modifiedlld/wasm/InputElement.h
The file was modifiedllvm/lib/MC/WasmObjectWriter.cpp
The file was modifiedllvm/include/llvm/Object/Wasm.h
The file was addedlld/test/wasm/Inputs/tag-section2.ll
The file was modifiedlld/wasm/SyntheticSections.cpp
The file was modifiedllvm/test/ObjectYAML/wasm/event_section.yaml
The file was modifiedllvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
The file was modifiedlld/wasm/MarkLive.cpp
The file was modifiedllvm/tools/obj2yaml/wasm2yaml.cpp
The file was modifiedllvm/include/llvm/CodeGen/WasmEHFuncInfo.h
The file was modifiedllvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
The file was removedlld/test/wasm/Inputs/event-section1.ll
The file was removedlld/test/wasm/event-section.ll
The file was modifiedlld/wasm/OutputSections.cpp
The file was modifiedllvm/lib/ObjectYAML/WasmYAML.cpp
The file was modifiedlld/include/lld/Common/LLVM.h
The file was modifiedllvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
The file was modifiedlld/wasm/Symbols.cpp
The file was modifiedllvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
The file was modifiedllvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
The file was modifiedlld/wasm/SymbolTable.cpp
The file was modifiedllvm/include/llvm/MC/MCSymbolWasm.h
The file was removedllvm/test/MC/WebAssembly/event-section.ll
The file was addedllvm/test/MC/WebAssembly/tag-section.ll
The file was modifiedllvm/test/CodeGen/WebAssembly/null-streamer.ll
The file was modifiedlld/wasm/SyntheticSections.h
The file was addedlld/test/wasm/Inputs/tag-section1.ll
The file was modifiedllvm/test/MC/WebAssembly/annotations.s
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
The file was modifiedllvm/lib/BinaryFormat/Wasm.cpp
The file was modifiedllvm/include/llvm/BinaryFormat/WasmRelocs.def
The file was modifiedllvm/lib/ObjectYAML/WasmEmitter.cpp
The file was removedllvm/test/MC/WebAssembly/event-section-decoding.ll
The file was modifiedllvm/tools/llvm-readobj/WasmDumper.cpp
The file was modifiedlld/wasm/InputFiles.h
The file was modifiedllvm/test/CodeGen/WebAssembly/exception.ll
The file was modifiedlld/wasm/Writer.cpp
The file was modifiedlld/wasm/SymbolTable.h
The file was addedlld/test/wasm/tag-section.ll
The file was modifiedllvm/include/llvm/ObjectYAML/WasmYAML.h
The file was modifiedlld/wasm/WriterUtils.h
The file was modifiedlldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
The file was modifiedlld/wasm/InputFiles.cpp
The file was modifiedllvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
The file was modifiedlld/wasm/Symbols.h
The file was modifiedllvm/lib/Object/WasmObjectFile.cpp
The file was modifiedllvm/test/MC/WebAssembly/basic-assembly.s
The file was modifiedllvm/lib/Object/RelocationResolver.cpp
The file was modifiedllvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
The file was removedlld/test/wasm/Inputs/event-section2.ll
The file was modifiedllvm/include/llvm/BinaryFormat/Wasm.h
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
The file was modifiedlld/wasm/InputChunks.cpp
The file was modifiedlld/wasm/WriterUtils.cpp
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
The file was addedllvm/test/MC/WebAssembly/tag-section-decoding.ll
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
Commit a10aeb3b32b5f935528ba41d7b7ee18e8d79d9e2 by carl.ritson
[AMDGPU] Remove duplicate setOperationAction for v4i16/v4f16 (NFC)
The file was modifiedllvm/lib/Target/AMDGPU/SIISelLowering.cpp
Commit 85ec21075100049ea8b8e5f945628ae2adae628e by ikudrin
[objdump][ARM] Fix evaluating the target address of a Thumb BLX(i)

The instruction can be 16-bit aligned while targeting 32-bit aligned
code. To calculate the target address correctly, the address of the
instruction has to be adjusted.

Differential Revision: https://reviews.llvm.org/D104446
The file was addedllvm/test/tools/llvm-objdump/ELF/ARM/tblxi-target.s
The file was modifiedllvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
Commit aea67232b1ee6da9fb97e8d1750221cbf3cf5165 by vdsered
[InstCombine][NFC] Added tests for mul with zext/sext operands

Baseline tests for D104193
The file was modifiedllvm/test/Transforms/InstCombine/mul.ll