SuccessChanges

Summary

  1. [sanitizer] Set default rtlib to libgcc (details)
  2. [sanitizer] Update x86 ABILIST filtering for x86_64 devices (details)
  3. [sanitizer] Pass -e dotbytes=10m to wget (details)
Commit 1e7891e19f509fd068eb74adf05c56c8cae71613 by rprichard
[sanitizer] Set default rtlib to libgcc

The default --rtlib for Android is about to change from libgcc to
compiler-rt (D96404), which will require a more substantial change to
this script to build the builtins and libunwind. For now, keep using
libgcc.

Differential Revision: https://reviews.llvm.org/D97354
The file was modifiedzorg/buildbot/builders/sanitizers/buildbot_android_functions.sh (diff)
Commit 0477d926afac3c9b4ab2e992421c887fc46d6cab by rprichard
[sanitizer] Update x86 ABILIST filtering for x86_64 devices

An x86_64 device (e.g. Android emulator or Cuttlefish VM) might have an
ro.product.cpu.abilist like:

    x86_64,x86,arm64-v8a,armeabi-v7a,armeabi
    x86_64,arm64-v8a,x86,armeabi-v7a,armeabi

When the first arch starts with x86, filter out the remaining archs
that don't start with x86.

Differential Revision: https://reviews.llvm.org/D97355
The file was modifiedzorg/buildbot/builders/sanitizers/buildbot_android_functions.sh (diff)
Commit 1a9f4798fee21e8a33af813f37b4d9b316f2bf6c by rprichard
[sanitizer] Pass -e dotbytes=10m to wget

When wget writes to a log file, it defaults to 1KiB per dot, which
produces ~20000 lines of log output for the NDK. This "-e dotbytes"
syntax has existed since 1999 in wget.

Differential Revision: https://reviews.llvm.org/D97356
The file was modifiedzorg/buildbot/builders/sanitizers/buildbot_android_functions.sh (diff)

Summary

  1. [X86] Remove custom lowering of vXi1 ADD/SUB now that they are canonicalized to XOR in getNode. (details)
  2. Support `#pragma clang section` directives on MachO targets (details)
  3. Option to ignore assume like intrinsic uses in hasAddressTaken() (details)
  4. [DAG] Move simplification of SADDSAT/SSUBSAT/UADDSAT/USUBSAT of vXi1 to getNode() (details)
  5. Option to ignore llvm[.compiler].used uses in hasAddressTaken() (details)
  6. [lld-macho] Basic support for linkage and visibility attributes in LTO (details)
  7. [OpenMP] Fix accidental addition of use omp_lib_kinds (details)
  8. [test] Improve SanitizerCoverage tests (details)
  9. adds more checks to -Wfree-nonheap-object (details)
  10. [mlir] Mark OpState::getAttrs() deprecated. (details)
  11. [libc++] Fix incorrect forwarding in tuple's assignment operator (details)
  12. [SanitizerCoverage] Drop !associated on metadata sections (details)
  13. Add a nullptr check. (details)
  14. [Clang][ASan] Introduce `-fsanitize-address-destructor-kind=` driver & frontend option. (details)
  15. [Clang][ASan] Teach Clang to not emit ASan module destructors when compiling with `-mkernel` or `-fapple-kext`. (details)
Commit ceaedfb5fc3a94adf9e67616d65414ddfee71e24 by craig.topper
[X86] Remove custom lowering of vXi1 ADD/SUB now that they are canonicalized to XOR in getNode.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D97478
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
Commit 7f6e3316456f939a062aad0eeaac983251a1747c by jonathan_roelofs
Support `#pragma clang section` directives on MachO targets

rdar://59560986

Differential Revision: https://reviews.llvm.org/D97233
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/include/clang/Basic/TargetInfo.h
The file was addedllvm/test/CodeGen/AArch64/clang-section-macho.ll
The file was modifiedclang/lib/Sema/SemaAttr.cpp
The file was modifiedllvm/lib/MC/MCSectionMachO.cpp
The file was modifiedclang/test/CodeGenCXX/clang-sections.cpp
The file was addedclang/test/Sema/pragma-clang-section-macho.c
The file was modifiedllvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
The file was modifiedclang/lib/Basic/Targets/OSTargets.h
The file was modifiedllvm/include/llvm/MC/MCSectionMachO.h
The file was modifiedclang/lib/Sema/SemaDeclAttr.cpp
The file was modifiedllvm/lib/MC/MCParser/DarwinAsmParser.cpp
The file was modifiedllvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Commit 29e2d9461a91b76665139002a5b323fbb1b19d82 by Stanislav.Mekhanoshin
Option to ignore assume like intrinsic uses in hasAddressTaken()

Differential Revision: https://reviews.llvm.org/D96081
The file was modifiedllvm/include/llvm/IR/Function.h
The file was modifiedllvm/lib/IR/Function.cpp
The file was modifiedllvm/lib/Analysis/CallGraph.cpp
The file was addedllvm/test/Analysis/CallGraph/ignore-assumelike-calls.ll
Commit 9490b9f14b899ff07f3cfab7ad64e5fed8f48746 by llvm-dev
[DAG] Move simplification of SADDSAT/SSUBSAT/UADDSAT/USUBSAT of vXi1 to getNode()

As discussed on D97276 we should be able to always do this in node creation, we don't need a combine.
The file was modifiedllvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
The file was modifiedllvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Commit d9c99043bdde5637bf32edaad10d1b8f8cd10b38 by Stanislav.Mekhanoshin
Option to ignore llvm[.compiler].used uses in hasAddressTaken()

Differential Revision: https://reviews.llvm.org/D96087
The file was modifiedllvm/lib/Analysis/CallGraph.cpp
The file was modifiedllvm/include/llvm/IR/Function.h
The file was addedllvm/test/Analysis/CallGraph/ignore-llvm-used.ll
The file was modifiedllvm/lib/IR/Function.cpp
Commit 84579fc24f03c8ca778e70325dad2166f1deaee3 by jezng
[lld-macho] Basic support for linkage and visibility attributes in LTO

When parsing bitcode, convert LTO Symbols to LLD Symbols in order to perform
resolution. The "winning" symbol will then be marked as Prevailing at LTO
compilation time. This is similar to what the other LLD ports do.

This change allows us to handle `linkonce` symbols correctly, and to deal with
duplicate bitcode symbols gracefully. Previously, both scenarios would result in
an assertion failure inside the LTO code, complaining that multiple Prevailing
definitions are not allowed.

While at it, I also added basic logic around visibility. We don't do anything
useful with it yet, but we do check that its value is valid. LLD-ELF appears to
use it only to set FinalDefinitionInLinkageUnit for LTO, which I think is just a
performance optimization.

From my local experimentation, the linker itself doesn't seem to do anything
differently when encountering linkonce / linkonce_odr / weak / weak_odr. So I've
only written a test for one of them. LLD-ELF has more, but they seem to mostly
be testing the intermediate bitcode output of their LTO backend...? I'm far from
an expert here though, so I might very well be missing things.

Reviewed By: #lld-macho, MaskRay, smeenai

Differential Revision: https://reviews.llvm.org/D94342
The file was modifiedlld/MachO/InputFiles.cpp
The file was addedlld/test/MachO/invalid/protected.ll
The file was addedlld/test/MachO/invalid/duplicate-symbol.ll
The file was modifiedlld/MachO/LTO.cpp
The file was addedlld/test/MachO/linkonce.ll
Commit d12ae7db9973d1aeb21849fadba1c612c0fd0590 by jonathan.l.peyton
[OpenMP] Fix accidental addition of use omp_lib_kinds

Fortran header accidentally had use omp_lib_kinds added inside a
subroutine and function. This patch removes the lines.
The file was modifiedopenmp/runtime/src/include/omp_lib.h.var
Commit 5bcb199a4317d30f6ada805c824e0e4be6db07bf by i
[test] Improve SanitizerCoverage tests
The file was modifiedllvm/test/Instrumentation/SanitizerCoverage/inline-bool-flag.ll
The file was addedllvm/test/Instrumentation/SanitizerCoverage/trace-pc-guard.ll
The file was removedllvm/test/Instrumentation/SanitizerCoverage/trace-pc-guard-nocomdat.ll
The file was removedllvm/test/Instrumentation/SanitizerCoverage/trace-pc-guard-comdat.ll
Commit 4f395db86b5cc11bb56853323d3cb1d4b6db5a0b by cjdb
adds more checks to -Wfree-nonheap-object

This commit adds checks for the following:

* labels
* block expressions
* random integers cast to `void*`
* function pointers cast to `void*`

Differential Revision: https://reviews.llvm.org/D94640
The file was modifiedclang/lib/Sema/SemaChecking.cpp
The file was addedclang/test/Analysis/free.cpp
The file was modifiedclang/test/Analysis/free.c
The file was modifiedclang/test/Analysis/weak-functions.c
The file was modifiedclang/test/Analysis/malloc-fnptr-plist.c
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/test/Analysis/malloc.c
Commit 8c074cb0b74e14ab1135d09cb53daf1a09602f73 by csigg
[mlir] Mark OpState::getAttrs() deprecated.

Fix call sites.

The method will be removed 2 weeks later.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D97464
The file was modifiedmlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
The file was modifiedmlir/include/mlir/IR/OpDefinition.h
The file was modifiedmlir/lib/Dialect/Affine/IR/AffineOps.cpp
The file was modifiedmlir/lib/Dialect/SPIRV/Transforms/DecorateCompositeTypeLayoutPass.cpp
The file was modifiedmlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp
The file was modifiedmlir/examples/toy/Ch2/mlir/Dialect.cpp
The file was modifiedmlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
The file was modifiedmlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
The file was modifiedmlir/lib/Dialect/Shape/IR/Shape.cpp
The file was modifiedmlir/lib/Dialect/Async/IR/Async.cpp
The file was modifiedmlir/lib/Dialect/GPU/IR/GPUDialect.cpp
The file was modifiedmlir/lib/IR/BuiltinDialect.cpp
The file was modifiedflang/include/flang/Optimizer/Dialect/FIROps.td
The file was modifiedmlir/lib/Dialect/PDL/IR/PDL.cpp
The file was modifiedmlir/lib/Dialect/Vector/VectorOps.cpp
The file was modifiedmlir/lib/Dialect/StandardOps/IR/Ops.cpp
The file was modifiedmlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
The file was modifiedmlir/examples/toy/Ch7/mlir/Dialect.cpp
The file was modifiedmlir/lib/Dialect/SCF/SCF.cpp
Commit 618862e89a022b2e8f73a62bed7c91654060dbab by Louis Dionne
[libc++] Fix incorrect forwarding in tuple's assignment operator

Also, add a bunch of tests for tuple and pair's assignment operators
involving reference types.

Differential Revision: https://reviews.llvm.org/D97419
The file was modifiedlibcxx/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
The file was modifiedlibcxx/include/tuple
The file was modifiedlibcxx/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp
The file was modifiedlibcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
The file was modifiedlibcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp
The file was modifiedlibcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp
The file was modifiedlibcxx/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp
The file was modifiedlibcxx/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp
Commit 4d63892acb17ba8ee5b146e83d38f244d8d92222 by i
[SanitizerCoverage] Drop !associated on metadata sections

In SanitizerCoverage, the metadata sections (`__sancov_guards`,
`__sancov_cntrs`, `__sancov_bools`) are referenced by functions.  After
inlining, such a `__sancov_*` section can be referenced by more than one
functions, but its sh_link still refers to the original function's section.
(Note: a SHF_LINK_ORDER section referenced by a section other than its linked-to
section violates the invariant.)

If the original function's section is discarded (e.g. LTO internalization +
`ld.lld --gc-sections`), ld.lld may report a `sh_link points to discarded section` error.

This above reasoning means that `!associated` is not appropriate to be called by
an inlinable function. Non-interposable functions are inline candidates, so we
have to drop `!associated`. A `__sancov_pcs` is not referenced by other sections
but is expected to parallel a metadata section, so we have to make sure the two
sections are retained or discarded at the same time. A section group does the
trick.  (Note: we have a module ctor, so `getUniqueModuleId` guarantees to
return a non-empty string, and `GetOrCreateFunctionComdat` guarantees to return
non-null.)

For interposable functions, we could keep using `!associated`, but
LTO can change the linkage to `internal` and allow such functions to be inlinable,
so we have to drop `!associated`, too. To not interfere with section
group resolution, we need to use the `noduplicates` variant (section group flag 0).
(This allows us to get rid of the ModuleID parameter.)
In -fno-pie and -fpie code (mostly dso_local), instrumented interposable
functions have WeakAny/LinkOnceAny linkages, which are rare. So the
section group header overload should be low.

This patch does not change the object file output for COFF (where `!associated` is ignored).

Reviewed By: morehouse, rnk, vitalybuka

Differential Revision: https://reviews.llvm.org/D97430
The file was addedllvm/test/Instrumentation/SanitizerCoverage/interposable-symbol.ll
The file was modifiedllvm/test/Instrumentation/SanitizerCoverage/trace-pc-guard.ll
The file was modifiedllvm/lib/Transforms/Instrumentation/Instrumentation.cpp
The file was modifiedllvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
The file was modifiedllvm/test/Instrumentation/SanitizerCoverage/inline-bool-flag.ll
The file was modifiedllvm/include/llvm/Transforms/Instrumentation.h
The file was modifiedllvm/lib/Transforms/IPO/SampleProfileProbe.cpp
The file was removedllvm/test/Instrumentation/SanitizerCoverage/interposable-symbol-nocomdat.ll
Commit 169318088406510ce6816e6b022502a532b86d4b by Adrian Prantl
Add a nullptr check.

This doesn't actually reproduce with a dbg.declare(i8* null, ...)
which produces a non-null null Value, but I have seen this show up in
crash logs. I'm suspecting that there may be another pass forcibly
setting the operand to a nullptr.
The file was modifiedllvm/test/Transforms/Coroutines/coro-debug.ll
The file was modifiedllvm/lib/Transforms/Coroutines/CoroFrame.cpp
Commit 5d64dd8e3c22e12e4f7b3d08ffe88fc41e727117 by Dan Liew
[Clang][ASan] Introduce `-fsanitize-address-destructor-kind=` driver & frontend option.

The new `-fsanitize-address-destructor-kind=` option allows control over how module
destructors are emitted by ASan.

The new option is consumed by both the driver and the frontend and is propagated into
codegen options by the frontend.

Both the legacy and new pass manager code have been updated to consume the new option
from the codegen options.

It would be nice if the new utility functions (`AsanDtorKindToString` and
`AsanDtorKindFromString`) could live in LLVM instead of Clang so they could be
consumed by other language frontends. Unfortunately that doesn't work because
the clang driver doesn't link against the LLVM instrumentation library.

rdar://71609176

Differential Revision: https://reviews.llvm.org/D96572
The file was modifiedclang/include/clang/Driver/Options.td
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was addedclang/test/CodeGen/asan-destructor-kind.cpp
The file was modifiedclang/lib/Driver/SanitizerArgs.cpp
The file was modifiedclang/docs/ClangCommandLineReference.rst
The file was modifiedclang/lib/CodeGen/BackendUtil.cpp
The file was addedclang/test/Driver/fsanitize-address-destructor-kind.c
The file was modifiedclang/include/clang/Basic/Sanitizers.h
The file was modifiedclang/lib/Basic/Sanitizers.cpp
The file was modifiedclang/include/clang/Basic/CodeGenOptions.def
The file was modifiedclang/include/clang/Driver/SanitizerArgs.h
The file was modifiedclang/include/clang/Basic/CodeGenOptions.h
Commit fdce098b49cb038996441741a7b2ab3652502aec by Dan Liew
[Clang][ASan] Teach Clang to not emit ASan module destructors when compiling with `-mkernel` or `-fapple-kext`.

rdar://71609176

Differential Revision: https://reviews.llvm.org/D96573
The file was modifiedclang/lib/Driver/SanitizerArgs.cpp
The file was addedclang/test/Driver/darwin-asan-mkernel-kext.c