platform/upstream/llvm.git
3 years ago[test][NewPM] Fix update-scev.ll under NPM
Arthur Eubanks [Wed, 23 Sep 2020 02:26:30 +0000 (19:26 -0700)]
[test][NewPM] Fix update-scev.ll under NPM

3 years agoRevert "[IRSim] Adding IRSimilarityCandidate that contains a region of IRInstructionD...
Andrew Litteken [Wed, 23 Sep 2020 02:02:34 +0000 (21:02 -0500)]
Revert "[IRSim] Adding IRSimilarityCandidate that contains a region of IRInstructionData."

This reverts commit 4944bb190fed8861d4d043eaf45e3c1e12aa2dc5.

3 years ago[NewPM] Pin tests with -debug-pass to legacy PM
Arthur Eubanks [Fri, 18 Sep 2020 20:52:11 +0000 (13:52 -0700)]
[NewPM] Pin tests with -debug-pass to legacy PM

-debug-pass is a legacy PM only option.

Some tests checks that the pass returned that it made a change,
which is not relevant to the NPM, since passes return PreservedAnalyses.

Some tests check that passes are freed at the proper time, which is also
not relevant to the NPM.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D87945

3 years ago[DWARFYAML][test] Simplify __debug_pubnames/types tests. NFC.
Xing GUO [Wed, 23 Sep 2020 00:41:46 +0000 (08:41 +0800)]
[DWARFYAML][test] Simplify __debug_pubnames/types tests. NFC.

This patch stripped unneeded sections from the test case.

Reviewed By: grimar, MaskRay

Differential Revision: https://reviews.llvm.org/D88073

3 years agoRevert "Canonicalize declaration pointers when forming APValues."
Leonard Chan [Wed, 23 Sep 2020 00:40:53 +0000 (17:40 -0700)]
Revert "Canonicalize declaration pointers when forming APValues."

This reverts commit 905b9ca26c94fa86339451a528cedde5004fc1bb.

Reverting because this strips `weak` attributes off function
declarations, leading to the linker error we see at
https://ci.chromium.org/p/fuchsia/builders/ci/clang_toolchain.fuchsia-arm64-debug-subbuild/b8868932035091473008.

See https://reviews.llvm.org/rG905b9ca26c94 for reproducer details.

3 years ago[EHStreamer] Ensure CallSiteEntry::{BeginLabel,EndLabel} are non-null. NFC
Fangrui Song [Mon, 21 Sep 2020 16:43:23 +0000 (09:43 -0700)]
[EHStreamer] Ensure CallSiteEntry::{BeginLabel,EndLabel} are non-null. NFC

... to simplify the code a bit.

Reviewed By: rahmanl

Differential Revision: https://reviews.llvm.org/D87999

3 years ago[lld-macho] handle option -headerpad_max_install_names
Greg McGary [Mon, 21 Sep 2020 18:04:13 +0000 (11:04 -0700)]
[lld-macho] handle option -headerpad_max_install_names

Differential Revision: https://reviews.llvm.org/D88064

3 years ago[Clang] Fix a typo in implicit-int-float-conversion.c
Yuanfang Chen [Tue, 22 Sep 2020 23:51:23 +0000 (16:51 -0700)]
[Clang] Fix a typo in implicit-int-float-conversion.c

3 years ago[IRSim] Adding IRSimilarityCandidate that contains a region of IRInstructionData.
Andrew Litteken [Tue, 15 Sep 2020 22:30:31 +0000 (17:30 -0500)]
[IRSim] Adding IRSimilarityCandidate that contains a region of IRInstructionData.

The IRSimilarityCandidate is a container to hold a region of
IRInstructions and offer interfaces for the starting instruction, ending
instruction, parent function, length.  It also assigns a global value
number for each unique instance of a value in the region.

It also contains an interface to compare two IRSimilarity as to whether
they have the same sequence of similar instructions.

Tests for whether the instructions are similar are found in
unittests/Analysis/IRSimilarityIdentifierTest.cpp.

Differential Revision: https://reviews.llvm.org/D86970

3 years ago[NFC][docs] Fix link.
antonio-cortes-perez [Tue, 22 Sep 2020 23:39:50 +0000 (23:39 +0000)]
[NFC][docs] Fix link.

The rendered html was (no hyperlink was generated):

(see Getting Started <GettingStarted.html#git-pre-push-hook>)

Now, it is (with proper hyperlink):

(see Git pre-push hook)

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D88116

3 years ago[ORC][examples] Add missing library dependencies.
Lang Hames [Tue, 22 Sep 2020 23:04:37 +0000 (16:04 -0700)]
[ORC][examples] Add missing library dependencies.

3 years ago[trace] avoid using <regex>
Walter Erquinigo [Tue, 22 Sep 2020 21:49:16 +0000 (14:49 -0700)]
[trace] avoid using <regex>

Easy fix based on the feedback by maskray on
https://reviews.llvm.org/D85705.

3 years ago[InstCombine][NFC][tests] Add ninf base value case to pow-sqrt.ll
Hubert Tong [Tue, 22 Sep 2020 22:52:47 +0000 (18:52 -0400)]
[InstCombine][NFC][tests] Add ninf base value case to pow-sqrt.ll

3 years ago[InstCombine] Fix errno bug in pow expansion to sqrt
Hubert Tong [Tue, 22 Sep 2020 22:49:55 +0000 (18:49 -0400)]
[InstCombine] Fix errno bug in pow expansion to sqrt

A conversion from `pow` to `sqrt` shall not call an `errno`-setting
`sqrt` with -//infinity//: the `sqrt` will set `EDOM` where the `pow`
call need not.

This patch avoids the erroneous (pun not intended) transformation by
applying the restrictions discussed in the thread for
https://lists.llvm.org/pipermail/llvm-dev/2020-September/145051.html.

The existing tests are updated (depending on emphasis in the checks for
library calls, avoidance of overlap, and overall coverage):
  - to add `ninf`, retaining the intended library call,
  - to use the intrinsic, retaining the use of `select`, or
  - to expect the replacement to not occur.

The following is tested:
  - The pow intrinsic folds to a `select` instruction to
    handle -//infinity//.
  - The pow library call folds, with `ninf`, to `sqrt` without the
    `select` instruction associated with handling -//infinity//.
  - The pow library call does not fold to `sqrt` without `ninf`.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D87877

3 years ago[SLP]Fix coding style, NFC.
Alexey Bataev [Tue, 22 Sep 2020 20:50:21 +0000 (16:50 -0400)]
[SLP]Fix coding style, NFC.

3 years ago[libc++] NFC: Reindent the feature test macro generation script
Louis Dionne [Mon, 21 Sep 2020 14:54:16 +0000 (10:54 -0400)]
[libc++] NFC: Reindent the feature test macro generation script

Each feature-test macro is now a clear block indentation-wise.

3 years ago[libc++] NFC: Collocate C++20 removed members of std::allocator
Louis Dionne [Mon, 21 Sep 2020 14:36:37 +0000 (10:36 -0400)]
[libc++] NFC: Collocate C++20 removed members of std::allocator

3 years ago[AArch64] Teach analyzeBranch to remove branch equivelent to fallthrough
Philip Reames [Tue, 22 Sep 2020 21:23:16 +0000 (14:23 -0700)]
[AArch64] Teach analyzeBranch to remove branch equivelent to fallthrough

The motivation here is that MachineBlockPlacement relies on analyzeBranch to remove branches to fallthrough blocks when the branch is not fully analyzeable. With the introduction of the FAULTING_OP psuedo for implicit null checking (see D87861), this case becomes important. Note that it's hard to otherwise exercise this path as BranchFolding handle's any fully analyzeable branch sequence without using this interface.

p.s. For anyone who saw my comment in the original review, what I thought was an issue in BranchFolding originally turned out to simply be a bug in my patch. (Now fixed.)

Differential Revision: https://reviews.llvm.org/D88035

3 years agoFix build due to renaming in LoopInfo.
Michael Liao [Tue, 22 Sep 2020 21:33:38 +0000 (17:33 -0400)]
Fix build due to renaming in LoopInfo.

3 years ago[libc++] Implement LWG1203
Louis Dionne [Tue, 22 Sep 2020 19:46:37 +0000 (15:46 -0400)]
[libc++] Implement LWG1203

Libc++ had an issue where nonsensical code like

  decltype(std::stringstream{} << std::vector<int>{});

would compile, as long as you kept the expression inside decltype in
an unevaluated operand. This turned out to be that we didn't implement
LWG1203, which clarifies what we should do in that case.

rdar://58769296

3 years agoChange LoopInfo::empty to isInnermost after D82895
Fangrui Song [Tue, 22 Sep 2020 21:07:39 +0000 (14:07 -0700)]
Change LoopInfo::empty to isInnermost after D82895

3 years agoSmall fixes for "[LoopInfo] empty() -> isInnermost(), add isOutermost()"
Stefanos Baziotis [Tue, 22 Sep 2020 20:59:34 +0000 (23:59 +0300)]
Small fixes for "[LoopInfo] empty() -> isInnermost(), add isOutermost()"

3 years agoRevert "[CodeGen] emit CG profile for COFF object file"
Reid Kleckner [Tue, 22 Sep 2020 20:45:22 +0000 (13:45 -0700)]
Revert "[CodeGen] emit CG profile for COFF object file"

This reverts commit 91aed9bf975f1e4346cc8f4bdefc98436386ced2, it is
causing link errors.

3 years ago[LoopInfo] empty() -> isInnermost(), add isOutermost()
Stefanos Baziotis [Tue, 22 Sep 2020 20:28:00 +0000 (23:28 +0300)]
[LoopInfo] empty() -> isInnermost(), add isOutermost()

Differential Revision: https://reviews.llvm.org/D82895

3 years ago[AArch64] Avoid pairing loads with same result reg
Congzhe Cao [Tue, 22 Sep 2020 20:21:27 +0000 (16:21 -0400)]
[AArch64] Avoid pairing loads with same result reg

When pairing ldr instructions to an ldp instruction, we cannot pair two ldr
destination registers where one is a sub or super register of the other.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D86906

3 years ago[ThinLTO] Option to bypass function importing.
Mircea Trofin [Wed, 16 Sep 2020 19:08:15 +0000 (12:08 -0700)]
[ThinLTO] Option to bypass function importing.

This completes the circle, complementing -lto-embed-bitcode
(specifically, post-merge-pre-opt). Using -thinlto-assume-merged skips
function importing. The index file is still needed for the other data it
contains.

Differential Revision: https://reviews.llvm.org/D87949

3 years ago[compiler-rt][AIX] Add CMake support for 32-bit Power builds
David Tenty [Thu, 3 Sep 2020 15:40:13 +0000 (11:40 -0400)]
[compiler-rt][AIX] Add CMake support for 32-bit Power builds

This patch enables support for building compiler-rt builtins for 32-bit
Power arch on AIX. For now, we leave out the specialized ppc builtin
implementations for 128-bit long double and friends since those will
need some special handling for AIX.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D87383

3 years ago[lldb][test] Remove accidental import pdb in 783dc7dc7ed7487d0782c2feb8854df949b98e69
Fangrui Song [Tue, 22 Sep 2020 20:08:12 +0000 (13:08 -0700)]
[lldb][test] Remove accidental import pdb in 783dc7dc7ed7487d0782c2feb8854df949b98e69

3 years agoTwo patches to fix the broken build.
Paul C. Anagnostopoulos [Tue, 22 Sep 2020 19:55:51 +0000 (15:55 -0400)]
Two patches to fix the broken build.
One to fix a C++ compiler warning.
One to allow Sphinx to find a new document.

3 years agoRevert "The wrong placement of add pass with optimizations led to -funique-internal...
Sriraman Tallam [Tue, 22 Sep 2020 19:12:21 +0000 (12:12 -0700)]
Revert "The wrong placement of add pass with optimizations led to -funique-internal-linkage-names being disabled."

This reverts commit 6950db36d33d85d18e3241ab6c87494c05ebe0fb.

3 years ago[flang][msvc] Explicitly reference "this" inside closure. NFC.
Michael Kruse [Tue, 22 Sep 2020 19:20:37 +0000 (14:20 -0500)]
[flang][msvc] Explicitly reference "this" inside closure. NFC.

The Microsoft compiler seems to have difficulties to decide between a const/non-const method of a captured object context in a closure. The error message is:
```
symbol.cpp(261): error C2668: 'Fortran::semantics::Symbol::detailsIf': ambiguous call to overloaded function
symbol.h(535): note: could be 'const D *Fortran::semantics::Symbol::detailsIf<Fortran::semantics::DerivedTypeDetails>(void) const'
symbol.h(534): note: or       'D *Fortran::semantics::Symbol::detailsIf<Fortran::semantics::DerivedTypeDetails>(void)'
symbol.cpp(261): note: while trying to match the argument list '()'
```
Explicitly using the this-pointer resolves this problem.

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: DavidTruby

Differential Revision: https://reviews.llvm.org/D88052

3 years ago[flang][msvc] Add explicit function template argument to applyLamda. NFC.
Michael Kruse [Tue, 22 Sep 2020 19:19:40 +0000 (14:19 -0500)]
[flang][msvc] Add explicit function template argument to applyLamda. NFC.

Like in D87961, msvc has difficulties deducing the template argument. The error message is:
```
expr-parsers.cpp(383): error C2672: 'applyLambda': no matching overloaded function found
```
Explicitly pass the first template argument to help it.

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: DavidTruby

Differential Revision: https://reviews.llvm.org/D88001

3 years ago[flang][msvc] Add explicit function template argument to applyFunction. NFC.
Michael Kruse [Tue, 22 Sep 2020 19:17:46 +0000 (14:17 -0500)]
[flang][msvc] Add explicit function template argument to applyFunction. NFC.

Msvc has difficulties deducing the template argument here. The error message is:
```
basic-parsers.h(790,12): error C2672: 'applyFunction': no matching overloaded function found
```
Explicitly pass the first template argument to help it.

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: DavidTruby

Differential Revision: https://reviews.llvm.org/D87961

3 years agoRevert "[lldb] XFAIL TestMemoryHistory on Linux"
Raphael Isemann [Tue, 22 Sep 2020 19:13:44 +0000 (21:13 +0200)]
Revert "[lldb] XFAIL TestMemoryHistory on Linux"

This reverts commit 7518006d75accd21325747430d6bced66b2c5ada.

This test apparently works on the Swift CI ubuntu bot, so it shouldn't be
XFAIL'd on Linux.

3 years agoImplement a new kind of Pass: dynamic pass pipeline
Mehdi Amini [Tue, 22 Sep 2020 00:51:27 +0000 (00:51 +0000)]
Implement a new kind of Pass: dynamic pass pipeline

Instead of performing a transformation, such pass yields a new pass pipeline
to run on the currently visited operation.
This feature can be used for example to implement a sub-pipeline that
would run only on an operation with specific attributes. Another example
would be to compute a cost model and dynamic schedule a pipeline based
on the result of this analysis.

Discussion: https://llvm.discourse.group/t/rfc-dynamic-pass-pipeline/1637

Recommit after fixing an ASAN issue: the callback lambda needs to be
allocated to a temporary to have its lifetime extended to the end of the
current block instead of just the current call expression.

Reviewed By: silvas

Differential Revision: https://reviews.llvm.org/D86392

3 years ago[CVP] Narrow SDiv/SRem to the smallest power-of-2 that's sufficient to contain its...
Roman Lebedev [Tue, 22 Sep 2020 13:33:18 +0000 (16:33 +0300)]
[CVP] Narrow SDiv/SRem to the smallest power-of-2 that's sufficient to contain its operands

This is practically identical to what we already do for UDiv/URem:
  https://rise4fun.com/Alive/04K

Name: narrow udiv
Pre: C0 u<= 255 && C1 u<= 255
%r = udiv i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = udiv i8 %t0, %t1
%r = zext i8 %t2 to i16

Name: narrow exact udiv
Pre: C0 u<= 255 && C1 u<= 255
%r = udiv exact i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = udiv exact i8 %t0, %t1
%r = zext i8 %t2 to i16

Name: narrow urem
Pre: C0 u<= 255 && C1 u<= 255
%r = urem i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = urem i8 %t0, %t1
%r = zext i8 %t2 to i16

... only here we need to look for 'min signed bits', not 'active bits',
and there's an UB to be aware of:
  https://rise4fun.com/Alive/KG86
  https://rise4fun.com/Alive/LwR

Name: narrow sdiv
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128
%r = sdiv i16 C0, C1
  =>
%t0 = trunc i16 C0 to i9
%t1 = trunc i16 C1 to i9
%t2 = sdiv i9 %t0, %t1
%r = sext i9 %t2 to i16

Name: narrow exact sdiv
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128
%r = sdiv exact i16 C0, C1
  =>
%t0 = trunc i16 C0 to i9
%t1 = trunc i16 C1 to i9
%t2 = sdiv exact i9 %t0, %t1
%r = sext i9 %t2 to i16

Name: narrow srem
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128
%r = srem i16 C0, C1
  =>
%t0 = trunc i16 C0 to i9
%t1 = trunc i16 C1 to i9
%t2 = srem i9 %t0, %t1
%r = sext i9 %t2 to i16

Name: narrow sdiv
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128 && !(C0 == -128 && C1 == -1)
%r = sdiv i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = sdiv i8 %t0, %t1
%r = sext i8 %t2 to i16

Name: narrow exact sdiv
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128 && !(C0 == -128 && C1 == -1)
%r = sdiv exact i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = sdiv exact i8 %t0, %t1
%r = sext i8 %t2 to i16

Name: narrow srem
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128 && !(C0 == -128 && C1 == -1)
%r = srem i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = srem i8 %t0, %t1
%r = sext i8 %t2 to i16

The ConstantRangeTest.losslessSignedTruncationSignext test sanity-checks
the logic, that we can losslessly truncate ConstantRange to
`getMinSignedBits()` and signext it back, and it will be identical
to the original CR.

On vanilla llvm test-suite + RawSpeed, this fires 1262 times,
while the same fold for UDiv/URem only fires 384 times. Sic!

Additionally, this causes +606.18% (+1079) extra cases of
aggressive-instcombine.NumDAGsReduced, and +473.14% (+1145)
of aggressive-instcombine.NumInstrsReduced folds.

3 years ago[NFC][CVP] Add tests for SDiv/SRem narrowing
Roman Lebedev [Tue, 22 Sep 2020 14:33:39 +0000 (17:33 +0300)]
[NFC][CVP] Add tests for SDiv/SRem narrowing

3 years ago[NFC][CVP] Give a better name STATISTIC() counting udiv i16 -> udiv i8 xforms
Roman Lebedev [Tue, 22 Sep 2020 13:21:19 +0000 (16:21 +0300)]
[NFC][CVP] Give a better name STATISTIC() counting udiv i16 -> udiv i8 xforms

3 years ago[ConstantRange] Introduce getMinSignedBits() method
Roman Lebedev [Tue, 22 Sep 2020 12:51:25 +0000 (15:51 +0300)]
[ConstantRange] Introduce getMinSignedBits() method

Similar to the ConstantRange::getActiveBits(), and to similarly-named
methods in APInt, returns the bitwidth needed to represent
the given signed constant range

3 years ago[NFC][APInt] Refactor getMinSignedBits() in terms of getNumSignBits()
Roman Lebedev [Tue, 22 Sep 2020 18:34:31 +0000 (21:34 +0300)]
[NFC][APInt] Refactor getMinSignedBits() in terms of getNumSignBits()

This is fully identical to the old implementation, just easier to read.

3 years ago[NFC][CVP] processUDivOrURem(): refactor to use ConstantRange::getActiveBits()
Roman Lebedev [Tue, 22 Sep 2020 12:34:45 +0000 (15:34 +0300)]
[NFC][CVP] processUDivOrURem(): refactor to use ConstantRange::getActiveBits()

As an exhaustive test shows, this logic is fully identical to the old
implementation, with exception of the case where both of the operands
had empty ranges:

```
TEST_F(ConstantRangeTest, CVP_UDiv) {
  unsigned Bits = 4;
  EnumerateConstantRanges(Bits, [&](const ConstantRange &CR0) {
    if(CR0.isEmptySet())
      return;
    EnumerateConstantRanges(Bits, [&](const ConstantRange &CR1) {
      if(CR0.isEmptySet())
        return;

      unsigned MaxActiveBits = 0;
      for (const ConstantRange &CR : {CR0, CR1})
        MaxActiveBits = std::max(MaxActiveBits, CR.getActiveBits());

      ConstantRange OperandRange(Bits, /*isFullSet=*/false);
      for (const ConstantRange &CR : {CR0, CR1})
        OperandRange = OperandRange.unionWith(CR);
      unsigned NewWidth = OperandRange.getUnsignedMax().getActiveBits();

      EXPECT_EQ(MaxActiveBits, NewWidth) << CR0 << " " << CR1;
    });
  });
}
```

3 years ago[ConstantRange] Introduce getActiveBits() method
Roman Lebedev [Tue, 22 Sep 2020 12:17:24 +0000 (15:17 +0300)]
[ConstantRange] Introduce getActiveBits() method

Much like APInt::getActiveBits(), computes how many bits are needed
to be able to represent every value in this constant range,
treating the values as unsigned.

3 years ago[ConstantRange] binaryXor(): special-case binary complement case - the result is...
Roman Lebedev [Tue, 22 Sep 2020 08:50:25 +0000 (11:50 +0300)]
[ConstantRange] binaryXor(): special-case binary complement case - the result is precise

Use the fact that `~X` is equivalent to `-1 - X`, which gives us
fully-precise answer, and we only need to special-handle the wrapped case.

This fires ~16k times for vanilla llvm test-suite + RawSpeed.

3 years ago[CVP] Enhance SRem -> URem fold to work not just on non-negative operands
Roman Lebedev [Tue, 22 Sep 2020 07:37:15 +0000 (10:37 +0300)]
[CVP] Enhance SRem -> URem fold to work not just on non-negative operands

This is a continuation of 8d487668d09fb0e4e54f36207f07c1480ffabbfd,
the logic is pretty much identical for SRem:

Name: pos pos
Pre: C0 >= 0 && C1 >= 0
%r = srem i8 C0, C1
  =>
%r = urem i8 C0, C1

Name: pos neg
Pre: C0 >= 0 && C1 <= 0
%r = srem i8 C0, C1
  =>
%r = urem i8 C0, -C1

Name: neg pos
Pre: C0 <= 0 && C1 >= 0
%r = srem i8 C0, C1
  =>
%t0 = urem i8 -C0, C1
%r = sub i8 0, %t0

Name: neg neg
Pre: C0 <= 0 && C1 <= 0
%r = srem i8 C0, C1
  =>
%t0 = urem i8 -C0, -C1
%r = sub i8 0, %t0

https://rise4fun.com/Alive/Vd6

Now, this new logic does not result in any new catches
as of vanilla llvm test-suite + RawSpeed.
but it should be virtually compile-time free,
and it may be important to be consistent in their handling,
because if we had a pair of sdiv-srem, and only converted one of them,
-divrempairs will no longer see them as a pair,
and thus not "merge" them.

3 years ago[NFC][CVP] Add tests for srem with potentially different sigdness domains
Roman Lebedev [Mon, 21 Sep 2020 20:57:13 +0000 (23:57 +0300)]
[NFC][CVP] Add tests for srem with potentially different sigdness domains

3 years ago[test][NewPM] Pin do-nothing-intrinsic.ll to legacy PM
Arthur Eubanks [Tue, 22 Sep 2020 18:33:38 +0000 (11:33 -0700)]
[test][NewPM] Pin do-nothing-intrinsic.ll to legacy PM

It tests CallGraph infra around the legacy PM which isn't relevant in NPM.

3 years ago[LoopInfo][NewPM] Fix tests in Analysis/LoopInfo under NPM
Arthur Eubanks [Tue, 22 Sep 2020 18:30:05 +0000 (11:30 -0700)]
[LoopInfo][NewPM] Fix tests in Analysis/LoopInfo under NPM

3 years ago[lldb] Skip TestMiniDumpUUID with reproducers
Jonas Devlieghere [Tue, 22 Sep 2020 18:28:00 +0000 (11:28 -0700)]
[lldb] Skip TestMiniDumpUUID with reproducers

The modules not getting orphaned is wreaking havoc when the UUIDs match
between tests.

3 years ago[lldb] Skip test_common_completion_process_pid_and_name with reproducers
Jonas Devlieghere [Tue, 22 Sep 2020 18:06:09 +0000 (11:06 -0700)]
[lldb] Skip test_common_completion_process_pid_and_name with reproducers

This test launches a subprocess which will have a different PID during
capture and replay.

3 years ago[InstCombine] For pow(x, +/-0.5), stop falling into pow(x, 1.5), etc. case
Hubert Tong [Tue, 22 Sep 2020 18:04:13 +0000 (14:04 -0400)]
[InstCombine] For pow(x, +/-0.5), stop falling into pow(x, 1.5), etc. case

The current code for handling pow(x, y) where y is an integer plus 0.5
is not explicitly guarded against attempting to transform the case where
abs(y) is exactly 0.5.

The latter case is meant to be handled by `replacePowWithSqrt`. Indeed,
if the pow(x, integer+0.5) case proceeds past a certain point, it will
hit an assertion by attempting to form pow(x, 0) using `getPow`.

This patch adds an explicit check to prevent attempting the
pow(x, integer+0.5) transformation on pow(x, +/-0.5) as suggested during
the review of D87877. This has the effect of retaining the shrinking of
`pow` to `powf` when the `sqrt` libcall cannot be formed.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D88066

3 years ago[NFC] Replace tabs with spaces in PPCInstrPrefix.td
Hubert Tong [Tue, 22 Sep 2020 18:01:58 +0000 (14:01 -0400)]
[NFC] Replace tabs with spaces in PPCInstrPrefix.td

3 years ago[test][MC] Rehabilitate llvm/test/MC/COFF/bigobj.py
Hubert Tong [Tue, 22 Sep 2020 17:59:00 +0000 (13:59 -0400)]
[test][MC] Rehabilitate llvm/test/MC/COFF/bigobj.py

The subject test was not actually running. This patch adds the
relevant suffix to the list of lit case filename extensions for the
enclosing directory.

Minor adjustments are also made to deal with bit rot.

Reviewed By: daltenty

Differential Revision: https://reviews.llvm.org/D87122

3 years ago[clang] Fix a typo-correction crash
Haojian Wu [Tue, 22 Sep 2020 18:20:42 +0000 (20:20 +0200)]
[clang] Fix a typo-correction crash

We leave a dangling TypoExpr when typo-correction is performed
successfully in `checkArgsForPlaceholders`, which leads a crash in the
later TypoCorrection.

This code was added in https://github.com/llvm/llvm-project/commit/1586782767938df3a20f7abc4d8335c48b100bc4,
and it didn't seem to have enough test coverage.
The fix is to remove this part, and no failuer tests.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D87815

3 years ago[gn build] Port 8a64689e264
LLVM GN Syncbot [Tue, 22 Sep 2020 18:07:36 +0000 (18:07 +0000)]
[gn build] Port 8a64689e264

3 years ago[gn build] Port 848d66fafd2
LLVM GN Syncbot [Tue, 22 Sep 2020 18:07:35 +0000 (18:07 +0000)]
[gn build] Port 848d66fafd2

3 years ago[Analyzer][WebKit] UncountedLocalVarsChecker
Jan Korous [Thu, 6 Aug 2020 19:07:47 +0000 (11:07 -0800)]
[Analyzer][WebKit] UncountedLocalVarsChecker

Differential Review: https://reviews.llvm.org/D83259

3 years agoVersion 0.5 of the new "TableGen Backend Developer's Guide."
Paul C. Anagnostopoulos [Mon, 21 Sep 2020 17:56:06 +0000 (13:56 -0400)]
Version 0.5 of the new "TableGen Backend Developer's Guide."
Files modified to take comments into account.
MLIR documentation updated for new TableGen documentation files.

3 years ago[NFC][regalloc] Simplify/conform to style guide indvars in Greedy
Mircea Trofin [Mon, 21 Sep 2020 23:27:09 +0000 (16:27 -0700)]
[NFC][regalloc] Simplify/conform to style guide indvars in Greedy

Differential Revision: https://reviews.llvm.org/D88055

3 years ago[ASTMatchers] Avoid recursion in ancestor matching to save stack space.
Sam McCall [Tue, 1 Sep 2020 18:22:59 +0000 (20:22 +0200)]
[ASTMatchers] Avoid recursion in ancestor matching to save stack space.

A recent change increased the stack size of memoizedMatchesAncestorOfRecursively
leading to stack overflows on real code involving large fold expressions.
It's not totally unreasonable to choke on very deep ASTs, but as common
infrastructure it's be nice if ASTMatchFinder is more robust.
(It already uses data recursion for the regular "downward" traversal.)

Differential Revision: https://reviews.llvm.org/D86964

3 years ago[SyntaxTree] Test the List API
Eduardo Caldas [Thu, 17 Sep 2020 15:31:30 +0000 (15:31 +0000)]
[SyntaxTree] Test the List API

Differential Revision: https://reviews.llvm.org/D87839

3 years ago[mlir][ods] Make OpBuilder and OperationState optional
Jacques Pienaar [Tue, 22 Sep 2020 17:04:21 +0000 (10:04 -0700)]
[mlir][ods] Make OpBuilder and OperationState optional

The OpBuilder is required to start with OpBuilder and OperationState, so remove
the need for the user to specify it. To make it simpler to update callers,
retain the legacy behavior for now and skip injecting OpBuilder/OperationState
when params start with OpBuilder.

Related to bug 47442.

Differential Revision: https://reviews.llvm.org/D88050

3 years ago[mlir] NFC: fix trivial typos under include directory
Kazuaki Ishizaki [Tue, 22 Sep 2020 17:01:54 +0000 (02:01 +0900)]
[mlir] NFC: fix trivial typos under include directory

Reviewed By: mravishankar, jpienaar

Differential Revision: https://reviews.llvm.org/D88040

3 years ago[PowerPC] Implement Vector String Isolate Builtins in Clang/LLVM
Amy Kwan [Tue, 22 Sep 2020 14:41:16 +0000 (09:41 -0500)]
[PowerPC] Implement Vector String Isolate Builtins in Clang/LLVM

This patch implements the vector string isolate (predicate and non-predicate
versions) builtins. The predicate builtins are custom selected within PPCISelDAGToDAG.

Differential Revision: https://reviews.llvm.org/D87671

3 years ago[PowerPC] Implement the 128-bit Vector Divide Extended Builtins in Clang/LLVM
Amy Kwan [Tue, 22 Sep 2020 14:40:45 +0000 (09:40 -0500)]
[PowerPC] Implement the 128-bit Vector Divide Extended Builtins in Clang/LLVM

This patch implements the 128-bit vector divide extended builtins in Clang/LLVM.
These builtins map to the vdivesq and vdiveuq instructions respectively.

Differential Revision: https://reviews.llvm.org/D87729

3 years ago[DAG] Remove DAGTypeLegalizer::GenWidenVectorTruncStores (PR42046)
Simon Pilgrim [Tue, 22 Sep 2020 16:17:20 +0000 (17:17 +0100)]
[DAG] Remove DAGTypeLegalizer::GenWidenVectorTruncStores (PR42046)

Just scalarize trunc stores - GenWidenVectorTruncStores does the same thing but is flawed (PR42046) and unused.

Differential Revision: https://reviews.llvm.org/D87708

3 years agoSilence 'warning: unused variable' when compiling with Clang 10.0
Alexandre Ganea [Tue, 22 Sep 2020 16:05:11 +0000 (12:05 -0400)]
Silence 'warning: unused variable' when compiling with Clang 10.0

3 years ago[sanitizer_common] Add debug print to sysmsg.c
Matt Morehouse [Tue, 22 Sep 2020 16:08:49 +0000 (09:08 -0700)]
[sanitizer_common] Add debug print to sysmsg.c

3 years ago[lld-macho] Make lld::getInteger() tolerate leading "0x"/"0X" when base is 16
Greg McGary [Tue, 22 Sep 2020 02:02:12 +0000 (19:02 -0700)]
[lld-macho] Make lld::getInteger() tolerate leading "0x"/"0X" when base is 16

ld64 is cool with leading `0x` for hex command-line args, and we should be also.

Reviewed By: #lld-macho, int3

Differential Revision: https://reviews.llvm.org/D88065

3 years ago[OpenMPOpt] Refactored "issue" and "wait" declarations for data map runtime call.
Hamilton Tobon Mosquera [Tue, 22 Sep 2020 15:45:43 +0000 (10:45 -0500)]
[OpenMPOpt] Refactored "issue" and "wait" declarations for data map runtime call.

Refactored __tgt_target_data_begin_mapper_<issue|wait> to receive the handle as an input/output argument.
This given the compiler warning of returning the handle as copy.

Differential Revision: https://reviews.llvm.org/D88029

3 years agoSema: introduce `__attribute__((__swift_name__))`
Saleem Abdulrasool [Thu, 10 Sep 2020 21:15:37 +0000 (21:15 +0000)]
Sema: introduce `__attribute__((__swift_name__))`

This introduces the new `swift_name` attribute that allows annotating
APIs with an alternate spelling for Swift.  This is used as part of the
importing mechanism to allow interfaces to be imported with a new name
into Swift.  It takes a parameter which is the Swift function name.
This parameter is validated to check if it matches the possible
transformed signature in Swift.

This is based on the work of the original changes in
https://github.com/llvm/llvm-project-staging/commit/8afaf3aad2af43cfedca7a24cd817848c4e95c0c

Differential Revision: https://reviews.llvm.org/D87534
Reviewed By: Aaron Ballman, Dmitri Gribenko

3 years ago[DI][ASan][NewPM] Fix some DebugInfo ASan tests under NPM
Arthur Eubanks [Tue, 22 Sep 2020 15:27:46 +0000 (08:27 -0700)]
[DI][ASan][NewPM] Fix some DebugInfo ASan tests under NPM

3 years ago[ThinLTO] Re-order modules for optimal multi-threaded processing
Alexandre Ganea [Tue, 22 Sep 2020 15:24:36 +0000 (11:24 -0400)]
[ThinLTO] Re-order modules for optimal multi-threaded processing

Re-use an optimizition from the old LTO API (used by ld64).
This sorts modules in ascending order, based on bitcode size, so that larger modules are processed first. This allows for smaller modules to be process last, and better fill free threads 'slots', and thusly allow for better multi-thread load balancing.

In our case (on dual Intel Xeon Gold 6140, Windows 10 version 2004, two-stage build), this saves 15 sec when linking `clang.exe` with LLD & `-flto=thin`, `/opt:lldltojobs=all`, no ThinLTO cache, -DLLVM_INTEGRATED_CRT_ALLOC=d:\git\rpmalloc.

Before patch: 102 sec
After patch: 85 sec

Inspired by the work done by David Callahan in D60495.

Differential Revision: https://reviews.llvm.org/D87966

3 years ago[scudo][standalone] Remove the pthread key from the shared TSD
Kostya Kortchinsky [Mon, 21 Sep 2020 21:09:37 +0000 (14:09 -0700)]
[scudo][standalone] Remove the pthread key from the shared TSD

https://reviews.llvm.org/D87420 removed the uses of the pthread key,
but the key itself was left in the shared TSD registry. It is created
on registry initialization, and destroyed on registry teardown.

There is really no use for it now, so we can just remove it.

Differential Revision: https://reviews.llvm.org/D88046

3 years ago[GVNSink][NewPM] Add GVNSinkPass to PassRegistry.def
Arthur Eubanks [Tue, 22 Sep 2020 15:20:11 +0000 (08:20 -0700)]
[GVNSink][NewPM] Add GVNSinkPass to PassRegistry.def

3 years ago[libc++] Implement C++20's P0784 (More constexpr containers)
Louis Dionne [Thu, 17 Sep 2020 16:06:13 +0000 (12:06 -0400)]
[libc++] Implement C++20's P0784 (More constexpr containers)

This commit adds std::construct_at, and marks various members of
std::allocator_traits and std::allocator as constexpr. It also adds
tests and turns the existing tests into hybrid constexpr/runtime tests.

Thanks to Richard Smith for initial work on this, and to Michael Park
for D69803, D69132 and D69134, which are superseded by this patch.

Differential Revision: https://reviews.llvm.org/D68364

3 years ago[AIX][compiler-rt] Use the AR/ranlib mode flag for 32-bit and 64-bit mode
David Tenty [Thu, 2 Jan 2020 15:11:59 +0000 (10:11 -0500)]
[AIX][compiler-rt] Use the AR/ranlib mode flag for 32-bit and 64-bit mode

since we will be building both 32-bit and 64-bit compiler-rt builtins
from a single configuration.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D87113

3 years ago[lld-macho] minimally handle option -dynamic
Greg McGary [Mon, 21 Sep 2020 20:21:45 +0000 (13:21 -0700)]
[lld-macho] minimally handle option -dynamic

Stifle the warning for unimplemented option `-dyamic`, since it is already the default. Add `Config::staticLink` and skeletal support for altering the flag, but otherwise leave the option `-static` as hidden and its warning in place.

Differential Revision: https://reviews.llvm.org/D88045

3 years ago[VPlan] Add dump() helper to VPValue & VPRecipeBase.
Florian Hahn [Mon, 14 Sep 2020 16:54:17 +0000 (17:54 +0100)]
[VPlan] Add dump() helper to VPValue & VPRecipeBase.

This provides a convenient way to print VPValues and recipes in a
debugger. In particular it saves the user from instantiating
VPSlotTracker to print recipes or values.

3 years ago[PeepholeOptimizer] Enhance the redundant COPY elimination.
Michael Liao [Fri, 18 Sep 2020 19:14:32 +0000 (15:14 -0400)]
[PeepholeOptimizer] Enhance the redundant COPY elimination.

- Eliminate redundant COPYs from the same register & subregister pair.

Differential Revision: https://reviews.llvm.org/D87939

3 years ago[X86] Add missing namespace closure comments. NFCI.
Simon Pilgrim [Tue, 22 Sep 2020 13:49:16 +0000 (14:49 +0100)]
[X86] Add missing namespace closure comments. NFCI.

Fixes some clang-tidy llvm-namespace-comment warnings.

3 years ago[X86] Cleanup/add namespace closure comments. NFCI.
Simon Pilgrim [Tue, 22 Sep 2020 13:47:37 +0000 (14:47 +0100)]
[X86] Cleanup/add namespace closure comments. NFCI.

Fixes some clang-tidy llvm-namespace-comment warnings.

3 years ago[AIX][clang][driver] Make sure crti[_64].o is linked in C++ mode
David Tenty [Tue, 4 Aug 2020 15:51:28 +0000 (11:51 -0400)]
[AIX][clang][driver] Make sure crti[_64].o is linked in C++ mode

since crti is required for functional static initialization.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D87927

3 years ago[NFC][mlir] Remove llvm:: prefix from SmallVector in parallel pretty printer.
David Truby [Mon, 21 Sep 2020 15:13:54 +0000 (16:13 +0100)]
[NFC][mlir] Remove llvm:: prefix from SmallVector in parallel pretty printer.

This prefix is unnecessary as SmallVector is re-exported in the mlir namespace.

Differential Revision: https://reviews.llvm.org/D88025

3 years ago[PowerPC] Fix for compiler side issue in PCRelative Local Exec
Stefan Pintilie [Tue, 22 Sep 2020 10:50:48 +0000 (05:50 -0500)]
[PowerPC] Fix for compiler side issue in PCRelative Local Exec

Stop combining loads and stores with PPCISD::ADD_TLS before we can merge the
node with with TLS_LOCAL_EXEC_MAT_ADDR. The issue is that
TLS_LOCAL_EXEC_MAT_ADDR cannot be selected by itself and requires the previous
ADD_TLS node that goes with it. However, we sometimes try to combine ADD_TLS
with loads and stores that come after it. If this happens then the ADD_TLS is
removed and TLS_LOCAL_EXEC_MAT_ADDR cannot be selected.

While this bug fix will address the issue it my not be ideal from a performance
perspective as we may be able to add patterns to combine TLS_LOCAL_EXEC_MAT_ADDR
with ADD_TLS with the load and store that comes after it all in one. However,
this is beyond the scope of this patch.

Reviewed By: NeHuang

Differential Revision: https://reviews.llvm.org/D88030

3 years ago[SLP] reduce code duplication for checking parent block; NFC
Sanjay Patel [Mon, 21 Sep 2020 21:31:57 +0000 (17:31 -0400)]
[SLP] reduce code duplication for checking parent block; NFC

3 years ago[SLP] move misplaced code comments; NFC
Sanjay Patel [Mon, 21 Sep 2020 21:22:58 +0000 (17:22 -0400)]
[SLP] move misplaced code comments; NFC

3 years ago[SLP] clean up code in gather(); NFC
Sanjay Patel [Mon, 21 Sep 2020 20:23:31 +0000 (16:23 -0400)]
[SLP] clean up code in gather(); NFC

1. Use range for-loop to avoid repeatedly accessing end index.
2. Better variable names.

3 years ago[SyntaxTree] Add tests for the assignment of the `canModify` tag.
Eduardo Caldas [Tue, 22 Sep 2020 09:11:58 +0000 (09:11 +0000)]
[SyntaxTree] Add tests for the assignment of the `canModify` tag.

Differential Revision: https://reviews.llvm.org/D88077

3 years ago[MLIR][Standard] Add `atan` to standard dialect
Frederik Gossen [Tue, 22 Sep 2020 13:15:19 +0000 (13:15 +0000)]
[MLIR][Standard] Add `atan` to standard dialect

Differential Revision: https://reviews.llvm.org/D88091

3 years ago[SLP] Merge null and dyn_cast<> checks into dyn_cast_or_null<>. NFCI.
Simon Pilgrim [Tue, 22 Sep 2020 12:44:35 +0000 (13:44 +0100)]
[SLP] Merge null and dyn_cast<> checks into dyn_cast_or_null<>. NFCI.

3 years ago[libc++] NFC: Remove trailing whitespace from the feature test macro table
Louis Dionne [Tue, 22 Sep 2020 12:38:57 +0000 (08:38 -0400)]
[libc++] NFC: Remove trailing whitespace from the feature test macro table

3 years ago[ARM] Trying to fix asan buildbot
Sam Parker [Tue, 22 Sep 2020 12:33:09 +0000 (13:33 +0100)]
[ARM] Trying to fix asan buildbot

3 years ago[LLD][PowerPC][test] Update thunk range error report for PPC64PCRelLongBranchThunk
Victor Huang [Tue, 22 Sep 2020 12:37:54 +0000 (07:37 -0500)]
[LLD][PowerPC][test] Update thunk range error report for PPC64PCRelLongBranchThunk

Update the thunk range error report for PPC64PCRelLongBranchThunk and add a range
error test case for PPC64R12SetupStub.

Differential Revision: https://reviews.llvm.org/D87381

3 years ago[SystemZ][z/OS] Set default wchar_t type for zOS
Abhina Sreeskantharajan [Fri, 18 Sep 2020 16:47:31 +0000 (12:47 -0400)]
[SystemZ][z/OS] Set default wchar_t type for zOS

Set the default wchar_t type on z/OS, and unsigned as the default.

Reviewed By: hubert.reinterpretcast, fanbo-meng

Differential Revision: https://reviews.llvm.org/D87624

3 years ago[SCEV] Handle `less` predicates for FoundPred = NE
Max Kazantsev [Tue, 22 Sep 2020 11:44:18 +0000 (18:44 +0700)]
[SCEV] Handle `less` predicates for FoundPred = NE

Currently these predicates are ignored, yet their handling is
pretty simple. I could not find a single test where it would
actually change something, but it's only because isImpliedCondOperands
is not smart enough to prove it further on. Yet the situation when
we come there with `less` predicate is pretty common.

Differential Revision: https://reviews.llvm.org/D87890
Reviewed By: fhahn

3 years ago[ARM][TTI] Prevents constants in a min(max) or max(min) pattern from being hoisted...
Meera Nakrani [Tue, 22 Sep 2020 11:54:10 +0000 (11:54 +0000)]
[ARM][TTI] Prevents constants in a min(max) or max(min) pattern from being hoisted when in a loop

Changes TTI function getIntImmCostInst to take an additional Instruction parameter,
which enables us to be able to check it is part of a min(max())/max(min()) pattern that will match SSAT.
We can then mark the constant used as free to prevent it being hoisted so SSAT can still be generated.
Required minor changes in some non-ARM backends to allow for the optional parameter to be included.

Differential Revision: https://reviews.llvm.org/D87457

3 years ago[lldb] Ignore certain Clang type sugar when creating the type name
Raphael Isemann [Tue, 22 Sep 2020 09:16:37 +0000 (11:16 +0200)]
[lldb] Ignore certain Clang type sugar when creating the type name

Clang has some type sugar that only serves as a way to preserve the way a user
has typed a certain type in the source code. These types are currently not
unwrapped when we query the type name for a Clang type, which means that this
type sugar actually influences what formatters are picked for a certain type.
Currently if a user decides to reference a type by doing `::GlobalDecl Var = 3;`,
the type formatter for `GlobalDecl` will not be used (as the type sugar
around the type gives it the name `::GlobalDecl`. The same goes for other ways
to spell out a type such as `auto` etc.

With this patch most of this type sugar gets stripped when the full type name is
calculated. Typedefs are not getting desugared as that seems counterproductive.
I also don't desugar atomic types as that's technically not type sugar.

Reviewed By: jarin

Differential Revision: https://reviews.llvm.org/D87481

3 years agoRevert rGf835779160ec303 "[APFloat] multiplySignificand - always pass IEEEFloat as...
Simon Pilgrim [Tue, 22 Sep 2020 11:15:23 +0000 (12:15 +0100)]
Revert rGf835779160ec303 "[APFloat] multiplySignificand - always pass IEEEFloat as const reference. NFCI."

This reverts commit f835779160ec30340676918915526615a07e826e while I investigate some buildbot failures

3 years ago[PowerPC] Add support for R_PPC64_GOT_TPREL_PCREL34 used in TLS Initial Exec
Stefan Pintilie [Fri, 18 Sep 2020 18:08:46 +0000 (13:08 -0500)]
[PowerPC] Add support for R_PPC64_GOT_TPREL_PCREL34 used in TLS Initial Exec

Add Thread Local Storage Initial Exec support to LLD.

This patch adds the computation for the relocations as well as the relaxation from Initial Exec to Local Exec.

Initial Exec:
```
pld r9, x@got@tprel@pcrel
add r9, r9, x@tls@pcrel
```
or
```
pld r9, x@got@tprel@pcrel
lbzx r10, r9, x@tls@pcrel
```
Note that @tls@pcrel is actually encoded as R_PPC64_TLS with a one byte displacement.

For the above examples relaxing Intitial Exec to Local Exec:
```
paddi r9, r9, x@tprel
nop
```
or
```
paddi r9, r13, x@tprel
lbz r10, 0(r9)
```

Reviewed By: nemanjai, MaskRay, #powerpc

Differential Revision: https://reviews.llvm.org/D86893

3 years ago[APFloat] multiplySignificand - always pass IEEEFloat as const reference. NFCI.
Simon Pilgrim [Mon, 21 Sep 2020 19:11:36 +0000 (20:11 +0100)]
[APFloat] multiplySignificand - always pass IEEEFloat as const reference. NFCI.

We do this in all other cases.