SuccessChanges

Summary

  1. Add GNU attribute 'retain' (details)
  2. ELF: Create unique SHF_GNU_RETAIN sections for llvm.used global objects (details)
  3. [Polly] Refactoring IsInnermostParallel() in ISL to take the C++ wrapper object. NFC (details)
  4. [lld][WebAssembly] Rename methods/members to match ELF backend. NFC. (details)
  5. [WebAssembly] Fix reverse mapping in WasmEHFuncInfo (details)
  6. [flang][fir] Add remaining Ops. Updates to pre-existing Ops. (details)
  7. [test] Add -triple x86_64 to attr-retain.c (details)
  8. [clang][NFC] Clean up whitespace in ClangOpcodesEmitter output (details)
  9. [MLIR][TOSA] Resubmit Tosa to Standard/SCF Lowerings (const, if, while)" (details)
  10. [mlir] Simplify various pieces of code now that Identifier has access to the Context/Dialect (details)
  11. [flang][fir] Upstream utility function valueHasFirAttribute() (details)
  12. [test] Add -triple x86_64 to attr-retain.cpp (details)
  13. [NFC] Remove tab from the source (details)
Commit 8afdacba9dcd36fc838eb86fca86f7f903040030 by i
Add GNU attribute 'retain'

For ELF targets, GCC 11 will set SHF_GNU_RETAIN on the section of a
`__attribute__((retain))` function/variable to prevent linker garbage
collection. (See AttrDocs.td for the linker support).

This patch adds `retain` functions/variables to the `llvm.used` list, which has
the desired linker GC semantics. Note: `retain` does not imply `used`,
so an unused function/variable can be dropped by Sema.

Before 'retain' was introduced, previous ELF solutions require inline asm or
linker tricks, e.g.  `asm volatile(".reloc 0, R_X86_64_NONE, target");`
(architecture dependent) or define a non-local symbol in the section and use
`ld -u`. There was no elegant source-level solution.

With D97448, `__attribute__((retain))` will set `SHF_GNU_RETAIN` on ELF targets.

Differential Revision: https://reviews.llvm.org/D97447
The file was modifiedclang/lib/CodeGen/CodeGenModule.cpp
The file was modifiedclang/lib/Sema/SemaDecl.cpp
The file was modifiedclang/lib/CodeGen/CGDecl.cpp
The file was addedclang/test/CodeGenCXX/attr-retain.cpp
The file was modifiedclang/include/clang/Basic/AttrDocs.td
The file was modifiedclang/include/clang/Basic/Attr.td
The file was addedclang/test/CodeGen/attr-retain.c
The file was addedclang/test/Sema/attr-retain.c
Commit 47c5576d7d586624c38f76bd3168e05f6ef1f838 by i
ELF: Create unique SHF_GNU_RETAIN sections for llvm.used global objects

If a global object is listed in `@llvm.used`, place it in a unique section with
the `SHF_GNU_RETAIN` flag. The section is a GC root under `ld --gc-sections`
with LLD>=13 or GNU ld>=2.36.

For front ends which do not expect to see multiple sections of the same name,
consider emitting `@llvm.compiler.used` instead of `@llvm.used`.

SHF_GNU_RETAIN is restricted to ELFOSABI_GNU and ELFOSABI_FREEBSD in
binutils. We don't do the restriction - see the rationale in D95749.

The integrated assembler has supported SHF_GNU_RETAIN since D95730.
GNU as>=2.36 supports section flag 'R'.
We don't need to worry about GNU ld support because older GNU ld just ignores
the unknown SHF_GNU_RETAIN.

With this change, `__attribute__((retain))` functions/variables emitted
by clang will get the SHF_GNU_RETAIN flag.

Differential Revision: https://reviews.llvm.org/D97448
The file was modifiedllvm/test/CodeGen/PowerPC/func-addr-consts.ll
The file was modifiedllvm/test/CodeGen/PowerPC/no-dead-strip.ll
The file was modifiedllvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
The file was modifiedllvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
The file was modifiedllvm/lib/Target/RISCV/RISCVTargetObjectFile.cpp
The file was addedllvm/test/CodeGen/X86/elf-retain.ll
Commit 1ab2753d4c2fcb4221a9171b11d513cb759842ac by llvm-project
[Polly] Refactoring IsInnermostParallel() in ISL to take the C++ wrapper object. NFC

Currently, the IslAst library is a C library that would be incompatible with the rest of the LLVM because LLVM is written in C++.
I took one function, IsInnermostParallel(), and refactored it so that it would take the C++ wrapper object instead of using reference counters with the C ISL library. As well, all the references that use IsInnermostParallel() will use manage_copy() since they are still expecting the C object.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D97425
The file was modifiedpolly/lib/CodeGen/IslAst.cpp
The file was modifiedpolly/include/polly/CodeGen/IslAst.h
The file was modifiedpolly/lib/CodeGen/IslNodeBuilder.cpp
Commit 14ffbb84aa45ddc22a564074fb2e32e8cef6c586 by sbc
[lld][WebAssembly] Rename methods/members to match ELF backend. NFC.

Specifically:

- InputChunk::outputOffset -> outSecOffset
- Symbol::get/setVirtualAddress -> get/setVA
- add InputChunk::getOffset helper that takes an offset

These are mostly in preparation for adding support for
SHF_MERGE/SHF_STRINGS but its also good to align with ELF where
possible.

Differential Revision: https://reviews.llvm.org/D97595
The file was modifiedlld/wasm/InputChunks.cpp
The file was modifiedlld/wasm/InputFiles.cpp
The file was modifiedlld/wasm/SymbolTable.cpp
The file was modifiedlld/wasm/SyntheticSections.cpp
The file was modifiedlld/wasm/Symbols.h
The file was modifiedlld/wasm/MapFile.cpp
The file was modifiedlld/wasm/Symbols.cpp
The file was modifiedlld/wasm/Writer.cpp
The file was modifiedlld/wasm/OutputSections.cpp
The file was modifiedlld/wasm/InputChunks.h
Commit aa097ef8d474c925e4fbe0efcaad253266c2fd6f by aheejin
[WebAssembly] Fix reverse mapping in WasmEHFuncInfo

D97247 added the reverse mapping from unwind destination to their
source, but it had a critical bug; sources can be multiple, because
multiple BBs can have a single BB as their unwind destination.

This changes `WasmEHFuncInfo::getUnwindSrc` to `getUnwindSrcs` and makes
it return a vector rather than a single BB. It does not return the const
reference to the existing vector but creates a new vector because
`WasmEHFuncInfo` stores not `BasicBlock*` or `MachineBasicBlock*` but
`PointerUnion` of them. Also I hoped to unify those methods for
`BasicBlock` and `MachineBasicBlock` into one using templates to reduce
duplication, but failed because various usages require `BasicBlock*` to
be `const` but it's hard to make it `const` for `MachineBasicBlock`
usages.

Fixes https://github.com/emscripten-core/emscripten/issues/13514.
(More precisely, fixes
https://github.com/emscripten-core/emscripten/issues/13514#issuecomment-784708744)

Reviewed By: dschuff, tlively

Differential Revision: https://reviews.llvm.org/D97583
The file was modifiedllvm/include/llvm/CodeGen/WasmEHFuncInfo.h
The file was modifiedllvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp
The file was modifiedllvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll
Commit 0b785a46b7eecbfd24394b42814844e02e5fefe6 by eschweitz
[flang][fir] Add remaining Ops. Updates to pre-existing Ops.

  - add ops: rebox, insert_on_range, absent, is_present
  - embox, coordinate_of: replace old hand-written parser/pretty-printer with assembly format
  - remove dead floating point ops, since buitlins work for all types
  - update call op
  - update documentation
  - misc. NFC to formatting
  - add op round trip tests

Authors: Eric Schweitz, Jean Perier, Zachary Selk, Kiran Chandramohan, et.al.

Differential Revision: https://reviews.llvm.org/D97500
The file was modifiedflang/test/Fir/fir-ops.fir
The file was modifiedflang/lib/Lower/CharacterExpr.cpp
The file was modifiedflang/lib/Optimizer/Dialect/FIROps.cpp
The file was modifiedflang/lib/Optimizer/Dialect/FIRDialect.cpp
The file was modifiedflang/include/flang/Optimizer/Dialect/FIROps.td
The file was modifiedflang/lib/Lower/IO.cpp
Commit a0c1cd642da51ab8f471d2dd5ba905cf81760187 by i
[test] Add -triple x86_64 to attr-retain.c
The file was modifiedclang/test/CodeGen/attr-retain.c
Commit 9e0d55024d4ed776f209ee04e260bdd314854993 by jrtc27
[clang][NFC] Clean up whitespace in ClangOpcodesEmitter output

This should now be about as style-conforming as TableGen'ed code ever
can reasonably be.
The file was modifiedclang/utils/TableGen/ClangOpcodesEmitter.cpp
Commit 16abacaea9db653b41808fc37277b68168438059 by rob.suderman
[MLIR][TOSA] Resubmit Tosa to Standard/SCF Lowerings (const, if, while)"

Includes a lowering for tosa.const, tosa.if, and tosa.while to Standard/SCF dialects. TosaToStandard is
used for constant lowerings and TosaToSCF handles the if/while ops.

Resubmission of https://reviews.llvm.org/D97518 with ASAN fixes.

Differential Revision: https://reviews.llvm.org/D97529
The file was addedmlir/lib/Conversion/TosaToSCF/TosaToSCFPass.cpp
The file was modifiedmlir/include/mlir/Conversion/Passes.td
The file was addedmlir/lib/Conversion/TosaToSCF/CMakeLists.txt
The file was addedmlir/lib/Conversion/TosaToStandard/CMakeLists.txt
The file was addedmlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp
The file was addedmlir/lib/Conversion/TosaToSCF/TosaToSCF.cpp
The file was addedmlir/test/Conversion/TosaToStandard/tosa-to-standard.mlir
The file was modifiedmlir/lib/Conversion/CMakeLists.txt
The file was addedmlir/test/Conversion/TosaToSCF/tosa-to-scf.mlir
The file was addedmlir/include/mlir/Conversion/TosaToSCF/TosaToSCF.h
The file was addedmlir/include/mlir/Conversion/TosaToStandard/TosaToStandard.h
The file was modifiedmlir/include/mlir/Conversion/Passes.h
The file was modifiedmlir/lib/Conversion/PassDetail.h
The file was addedmlir/lib/Conversion/TosaToStandard/TosaToStandardPass.cpp
Commit e6260ad043d84c54d10e463dd82de829c1be24f7 by riddleriver
[mlir] Simplify various pieces of code now that Identifier has access to the Context/Dialect

This also exposed a bug in Dialect loading where it was not correctly identifying identifiers that had the dialect namespace as a prefix.

Differential Revision: https://reviews.llvm.org/D97431
The file was modifiedmlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
The file was modifiedmlir/lib/CAPI/IR/BuiltinAttributes.cpp
The file was modifiedmlir/lib/IR/Dialect.cpp
The file was modifiedmlir/examples/toy/Ch2/mlir/MLIRGen.cpp
The file was modifiedmlir/include/mlir/IR/BuiltinAttributes.h
The file was modifiedmlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
The file was modifiedmlir/tools/mlir-tblgen/RewriterGen.cpp
The file was modifiedmlir/include/mlir/IR/Location.h
The file was modifiedmlir/examples/toy/Ch7/mlir/MLIRGen.cpp
The file was modifiedmlir/lib/IR/MLIRContext.cpp
The file was modifiedmlir/lib/Transforms/Utils/DialectConversion.cpp
The file was modifiedmlir/include/mlir/IR/BuiltinTypes.td
The file was modifiedmlir/unittests/IR/AttributeTest.cpp
The file was modifiedmlir/examples/toy/Ch6/mlir/MLIRGen.cpp
The file was modifiedmlir/lib/IR/Verifier.cpp
The file was modifiedmlir/include/mlir/IR/OperationSupport.h
The file was modifiedmlir/lib/Transforms/LocationSnapshot.cpp
The file was modifiedmlir/examples/toy/Ch3/mlir/MLIRGen.cpp
The file was modifiedmlir/lib/IR/Location.cpp
The file was modifiedmlir/lib/Parser/DialectSymbolParser.cpp
The file was modifiedmlir/include/mlir/IR/OpBase.td
The file was modifiedmlir/examples/toy/Ch4/mlir/MLIRGen.cpp
The file was modifiedmlir/examples/toy/Ch5/mlir/MLIRGen.cpp
The file was modifiedmlir/lib/IR/Builders.cpp
The file was modifiedmlir/lib/Parser/LocationParser.cpp
The file was modifiedmlir/include/mlir/IR/Builders.h
The file was modifiedmlir/lib/IR/BuiltinAttributes.cpp
The file was modifiedmlir/lib/IR/Operation.cpp
Commit ac473bb2b2add52e51b1c18b5acc7d9bfa7619a9 by eschweitz
[flang][fir] Upstream utility function valueHasFirAttribute()

This function will be used in subsequent upstreaming merges.

Author: Jean Perier

Differential Revision: https://reviews.llvm.org/D97502
The file was modifiedflang/lib/Optimizer/Dialect/FIROps.cpp
The file was modifiedflang/include/flang/Optimizer/Dialect/FIROpsSupport.h
Commit 2e2ee4300d1f9766209d435c0d8c44c72092b974 by i
[test] Add -triple x86_64 to attr-retain.cpp
The file was modifiedclang/test/CodeGenCXX/attr-retain.cpp
Commit c88c46080a75467788b4379f49fc664061c2c6d0 by Vitaly Buka
[NFC] Remove tab from the source
The file was modifiedcompiler-rt/lib/hwasan/hwasan_flags.inc