SuccessChanges

Summary

  1. [flang] CheckConformance: tristate-ify result (details)
  2. [SampleFDO] New hierarchical discriminator for FS SampleFDO (llvm-profdata part) (details)
  3. [IndVars] Don't forget value when inferring nowrap flags (details)
  4. [mailmap] Add the canonical spelling of my name (details)
  5. [scudo] Remove disableMemoryTagChecksTestOnly (details)
  6. [scudo] Add memtag_test (details)
  7. [scudo] Untag pointer in iterateOverChunks (details)
  8. Fix a diagnoses-valid bug with using declarations (details)
  9. [InstrProfiling] If no value profiling, make data variable private and (for Windows) use one comdat (details)
  10. Regenerate a few tests related to SCEV. (details)
  11. Add memref.dim canonicalization patterns to TilingCanonicalizationPatterns (details)
  12. [gn build] (semi-manually) port 07c92b2e9581 (details)
  13. [scudo] Fix String DCHECK (details)
Commit dfecbcae0d6434fa1daafe66ba5d90f816d4268b by pklausler
[flang] CheckConformance: tristate-ify result

To ensure that errors are emitted by CheckConformance and
its callers in all situations, it's necessary for the returned result
of that function to distinguish between three possible
outcomes: the arrays are known to conform at compilation time,
the arrays are known to not conform (and a message has been
produced), and an indeterminate result in which is not possible
to determine conformance.  So convert CheckConformance's
result into an optional<bool>, and convert its confusing
Boolean flag arguments into a bit-set of named flags too.

Differential Revision: https://reviews.llvm.org/D103654
The file was modifiedflang/lib/Evaluate/shape.cpp
The file was modifiedflang/lib/Semantics/check-call.cpp
The file was modifiedflang/include/flang/Evaluate/characteristics.h
The file was modifiedflang/lib/Evaluate/check-expression.cpp
The file was modifiedflang/lib/Semantics/expression.cpp
The file was modifiedflang/lib/Semantics/pointer-assignment.cpp
The file was modifiedflang/lib/Evaluate/characteristics.cpp
The file was modifiedflang/lib/Evaluate/fold-implementation.h
The file was modifiedflang/include/flang/Evaluate/shape.h
Commit 8d581857d77129b5a63515ca6794bba88418e0fd by xur
[SampleFDO] New hierarchical discriminator for FS SampleFDO (llvm-profdata part)

This patch was split from https://reviews.llvm.org/D102246
[SampleFDO] New hierarchical discriminator for Flow Sensitive SampleFDO
This is for llvm-profdata part of change. It sets the bit masks for the
profile reader in llvm-profdata. Also add an internal option
"-fs-discriminator-pass" for show and merge command to process the profile
offline.

This patch also moved setDiscriminatorMaskedBitFrom() to
SampleProfileReader::create() to simplify the interface.

Differential Revision: https://reviews.llvm.org/D103550
The file was modifiedllvm/include/llvm/Support/Discriminator.h
The file was modifiedllvm/tools/llvm-profdata/llvm-profdata.cpp
The file was addedllvm/test/tools/llvm-profdata/Inputs/sample-fs.proftext
The file was modifiedllvm/unittests/ProfileData/SampleProfTest.cpp
The file was modifiedllvm/include/llvm/ProfileData/SampleProfReader.h
The file was modifiedllvm/lib/ProfileData/SampleProfReader.cpp
The file was addedllvm/test/tools/llvm-profdata/sample-fs.test
The file was modifiedllvm/lib/Target/X86/X86InsertPrefetch.cpp
The file was modifiedllvm/lib/Transforms/IPO/SampleProfile.cpp
Commit 14f350daf290e9d7f3eef700acf930d8b0887007 by nikita.ppv
[IndVars] Don't forget value when inferring nowrap flags

When SimplifyIndVars infers IR nowrap flags from SCEV, this may
happen in two ways: Either nowrap flags were already present in
SCEV and just get transferred to IR. Or zero/sign extension of
addrecs infers additional nowrap flags, and those get transferred
to IR. In the latter case, calling forgetValue() ensures that the
newly inferred nowrap flags get propagated to any other SCEV
expressions based on the addrec. However, the invalidation can
also have a major compile-time effect in some cases. For
https://bugs.llvm.org/show_bug.cgi?id=50384 with n=512 compile-
time drops from 7.1s to 0.8s without this invalidation. At the
same time, removing the invalidation doesn't affect any codegen
in test-suite.

Differential Revision: https://reviews.llvm.org/D103424
The file was modifiedllvm/lib/Transforms/Utils/SimplifyIndVar.cpp
Commit 72177e9fa53637efad063168d3b4888adac78d4d by martin
[mailmap] Add the canonical spelling of my name
The file was modified.mailmap
Commit 39f928ed01fde8604515421c5438c3ecb537fbf2 by Vitaly Buka
[scudo] Remove disableMemoryTagChecksTestOnly

And replace with ScopedDisableMemoryTagChecks.

Differential Revision: https://reviews.llvm.org/D103708
The file was modifiedcompiler-rt/lib/scudo/standalone/memtag.h
The file was modifiedcompiler-rt/lib/scudo/standalone/tests/combined_test.cpp
Commit 07c92b2e958191a43464a5ca08933be56d72f2df by Vitaly Buka
[scudo] Add memtag_test

Differential Revision: https://reviews.llvm.org/D103074
The file was modifiedcompiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
The file was addedcompiler-rt/lib/scudo/standalone/tests/memtag_test.cpp
The file was modifiedcompiler-rt/lib/scudo/standalone/memtag.h
The file was modifiedcompiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
Commit 1e6d135325357d8c32fd0b0d7f668cad91d478bc by Vitaly Buka
[scudo] Untag pointer in iterateOverChunks

Pointer comparison in Lambda will not work on tagged pointers.

Reviewed By: pcc

Differential Revision: https://reviews.llvm.org/D103496
The file was modifiedcompiler-rt/lib/scudo/standalone/combined.h
The file was modifiedcompiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
Commit ca68f3bc48e48f839142de1461e95d87ae48e9df by aaron
Fix a diagnoses-valid bug with using declarations

The following was found by a customer and is accepted by the other primary
C++ compilers, but fails to compile in Clang:

namespace sss {
double foo(int, double);
template <class T>
T foo(T); // note: target of using declaration
}  // namespace sss

namespace oad {
void foo();
}

namespace oad {
using ::sss::foo;
}

namespace sss {
using oad::foo; // note: using declaration
}

namespace sss {
double foo(int, double) { return 0; }
template <class T>
T foo(T t) { // error: declaration conflicts with target of using
  return t;
}
}  // namespace sss

I believe the issue is that MergeFunctionDecl() was calling
checkUsingShadowRedecl() but only considering a FunctionDecl as a
possible shadow and not FunctionTemplateDecl. The changes in this patch
largely mirror how variable declarations were being handled by also
catching FunctionTemplateDecl.
The file was modifiedclang/test/CXX/modules-ts/basic/basic.def.odr/p6/module-vs-global.cpp
The file was modifiedclang/lib/Sema/SemaDecl.cpp
The file was modifiedclang/test/CXX/modules-ts/basic/basic.def.odr/p6/global-vs-module.cpp
The file was modifiedclang/test/CXX/modules-ts/basic/basic.def.odr/p6/module-vs-module.cpp
The file was modifiedclang/test/SemaCXX/using-decl-templates.cpp
Commit 9e51d1f348b95affe6a8345ce3906997a49f0297 by i
[InstrProfiling] If no value profiling, make data variable private and (for Windows) use one comdat

`__profd_*` variables are referenced by code only when value profiling is
enabled. If disabled (e.g. default -fprofile-instr-generate), the symbols just
waste space on ELF/Mach-O. We change the comdat symbol from `__profd_*` to
`__profc_*` because an internal symbol does not provide deduplication features
on COFF. The choice doesn't matter on ELF.

(In -DLLVM_BUILD_INSTRUMENTED_COVERAGE=on build, there is now no `__profd_*` symbols.)

On Windows this enables further optimization. We are no longer affected by the
link.exe limitation: an external symbol in IMAGE_COMDAT_SELECT_ASSOCIATIVE can
cause duplicate definition error.
https://lists.llvm.org/pipermail/llvm-dev/2021-May/150758.html
We can thus use llvm.compiler.used instead of llvm.used like ELF (D97585).
This avoids many `/INCLUDE:` directives in `.drectve`.

Here is rnk's measurement for Chrome:
```
This reduced object file size of base_unittests.exe, compiled with coverage, optimizations, and gmlt debug info by 10%:

#BEFORE

$ find . -iname '*.obj' | xargs du -b | awk '{ sum += $1 } END { print sum}'
1047758867

$ du -cksh base_unittests.exe
82M     base_unittests.exe
82M     total

# AFTER

$ find . -iname '*.obj' | xargs du -b | awk '{ sum += $1 } END { print sum}'
937886499

$ du -cksh base_unittests.exe
78M     base_unittests.exe
78M     total
```

The change is NFC for Mach-O.

Reviewed By: davidxl, rnk

Differential Revision: https://reviews.llvm.org/D103372
The file was modifiedllvm/test/Instrumentation/InstrProfiling/icall.ll
The file was modifiedllvm/test/Instrumentation/InstrProfiling/comdat.ll
The file was modifiedllvm/test/Instrumentation/InstrProfiling/linkage.ll
The file was modifiedllvm/test/Transforms/PGOProfile/comdat_internal.ll
The file was modifiedllvm/test/Instrumentation/InstrProfiling/platform.ll
The file was modifiedllvm/test/Instrumentation/InstrProfiling/profiling.ll
The file was modifiedllvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
Commit 925cd6b46780901ab2f9c0e737600ed0a500cd9b by efriedma
Regenerate a few tests related to SCEV.

In preparation for https://reviews.llvm.org/D103656
The file was modifiedllvm/test/Transforms/LoopVectorize/X86/cost-model-assert.ll
The file was modifiedllvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
The file was modifiedllvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll
The file was modifiedllvm/test/Transforms/LoopVectorize/pointer-induction.ll
Commit a52959401d9544ac7037405aaf714bd08f071ea9 by ataei
Add memref.dim canonicalization patterns to TilingCanonicalizationPatterns

Otherwise tiled and padded linalg op will be alive (after distribution).

Differential Revision: https://reviews.llvm.org/D103715
The file was modifiedmlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
Commit efea1b17824377c274abe5600d7d973087553e23 by thakis
[gn build] (semi-manually) port 07c92b2e9581
The file was modifiedllvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/tests/BUILD.gn
Commit 5019b0a56588fc13e6a37c49e22a812afe6c4416 by kostyak
[scudo] Fix String DCHECK

This resolves an issue tripping a `DCHECK`, as I was checking for the
capacity and not the size. We don't need to 0-init the Vector as it's
done already, and make sure we only 0-out the string on clear if it's
not empty.

Differential Revision: https://reviews.llvm.org/D103716
The file was modifiedcompiler-rt/lib/scudo/standalone/string_utils.h