platform/upstream/llvm.git
2 years ago[FunctionAttrs] Regenerate test checks (NFC)
Nikita Popov [Thu, 13 Oct 2022 08:31:07 +0000 (10:31 +0200)]
[FunctionAttrs] Regenerate test checks (NFC)

2 years ago[FunctionAttrs] Account for memory effects of inalloca/preallocated
Nikita Popov [Wed, 12 Oct 2022 15:22:11 +0000 (17:22 +0200)]
[FunctionAttrs] Account for memory effects of inalloca/preallocated

The code for inferring memory attributes on arguments claims that
inalloca/preallocated arguments are always clobbered:
https://github.com/llvm/llvm-project/blob/d71ad4108056d685f48407447095d8d92fd7685d/llvm/lib/Transforms/IPO/FunctionAttrs.cpp#L640-L642

However, we would still infer memory attributes for the whole
function without taking this into account, so we could still end
up inferring readnone for the function. This adds an argument
clobber if there are any inalloca/preallocated arguments.

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

2 years ago[mlir] MemRefToLLVM: Save / restore stack when lowering memref.copy
Andi Drebes [Thu, 13 Oct 2022 08:11:43 +0000 (10:11 +0200)]
[mlir] MemRefToLLVM: Save / restore stack when lowering memref.copy

The MemRef to LLVM conversion pass emits `llvm.alloca` operations to promote MemRef descriptors to the stack when lowering `memref.copy` operations for operands which do not have a contiguous layout in memory. The original stack position is never restored after the allocations, which creates an issue when the copy operation is embedded into a loop with a high trip count, ultimately resulting in a segmentation fault due to the stack growing too large.

Below is as a minimal example illustrating the issue:

```
module {
  func.func @main() {
    %arg0 = memref.alloc() : memref<32x64xi64>
    %arg1 = memref.alloc() : memref<16x32xi64>
    %lb = arith.constant 0 : index
    %ub = arith.constant 100000 : index
    %step = arith.constant 1 : index
    %slice = memref.subview %arg0[16,32][16,32][1,1] :
       memref<32x64xi64> to memref<16x32xi64, #map>

    scf.for %i = %lb to %ub step %step {
       memref.copy %slice, %arg1 :
         memref<16x32xi64, #map> to memref<16x32xi64>
    }

    return
  }
}
```

When running the code above, e.g., with mlir-cpu-runner, the execution crashes with a segmentation fault:

```
$ mlir-opt \
    --convert-scf-to-cf \
    --convert-memref-to-llvm \
    --convert-func-to-llvm
    --convert-cf-to-llvm \
    --reconcile-unrealized-casts <file> | \
  mlir-cpu-runner \
    -e main -entry-point-result=void \
    --shared-libs=$PWD/build/lib/libmlir_c_runner_utils.so
[...]
Segmentation fault
```

This patch causes the code lowering a `memref.copy` operation in the MemRefToLLVM pass to emit a pair of matching `llvm.intr.stacksave` and `llvm.intr.stackrestore` operations around the promotion of memory descriptors and the subsequent call to `memrefCopy` in order to restore the stack to its original position after the call.

Reviewed By: ftynse

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

2 years ago[mlir] Remove iterator_types() method from LinalgStructuredInterface.
Oleg Shyshkov [Thu, 13 Oct 2022 07:28:46 +0000 (07:28 +0000)]
[mlir] Remove iterator_types() method from LinalgStructuredInterface.

`getIteratorTypesArray` should be used instead. It's a better substitute for all the current usages of the interface.

The current `ArrayAttr iterator_types()` has a few problems:
* It creates an assumption operation has iterators types as an attribute, but it's not always the case. Sometime iterator types can be inferred from other attribute, or they're just static.
* ArrayAttr is an obscure contained and required extracting values in the client code.
* Makes it hard to migrate iterator types from strings to enums ([RFC](https://discourse.llvm.org/t/rfc-enumattr-for-iterator-types-in-linalg/64535/9)).

Concrete ops, like `linalg.generic` will still have iterator types as an attribute if needed.

As a side effect, this change helps a bit with migration to prefixed accessors.

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

2 years ago[HLSL] Simplify code and fix unused variable warnings. NFC.
Benjamin Kramer [Thu, 13 Oct 2022 07:46:32 +0000 (09:46 +0200)]
[HLSL] Simplify code and fix unused variable warnings. NFC.

2 years agoPrecommit for SWDEV-353076: Add check directives to existing tests.
Leon Clark [Thu, 13 Oct 2022 07:02:24 +0000 (08:02 +0100)]
Precommit for SWDEV-353076: Add check directives to existing tests.

Add FileCheck directives to existing tests in preparation for new tests.

Reviewed By: arsenm

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

2 years ago[MC] [Win64EH] Check that ARM64 prologs and epilogs have the right matching number...
Martin Storsjö [Mon, 8 Aug 2022 09:55:57 +0000 (12:55 +0300)]
[MC] [Win64EH] Check that ARM64 prologs and epilogs have the right matching number of instructions

This matches what was done for the ARM implementation (where getting
the instruction sizes right is even more tricky, and hence needed
tighter testing).

This will allow catching any future cases where prologs and epilogs
don't match the instructions within them.

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

2 years ago[AArch64] Use encodeLogicalImmediate for forming the immediate to an AND. NFC.
Martin Storsjö [Wed, 12 Oct 2022 21:30:33 +0000 (00:30 +0300)]
[AArch64] Use encodeLogicalImmediate for forming the immediate to an AND. NFC.

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

2 years ago[AArch64] Remove dead code for inserting SEH opcodes for realignment. NFC.
Martin Storsjö [Wed, 12 Oct 2022 12:03:16 +0000 (15:03 +0300)]
[AArch64] Remove dead code for inserting SEH opcodes for realignment. NFC.

If the stack is realigned, we've emitted a frame pointer and
already terminated the SEH prologue, making this dead code since
a07787c9a50c046e45921dd665f5a53a752bbc31.

The immediate to this SEH opcode was entirely bogus - we don't
know how many bytes the AND operation adjusts the SP, and by
doing "NumBytes & andMaskEncoded" (where andMaskEncoded was the
immediate bitpattern for the AND instruction), the immediate to the
opcode was total gibberish.

This hasn't had any practical effect, since the original stack
pointer always was restored from the frame pointer afterwards anyway.

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

2 years ago[AArch64] Fix aligning the stack after calling __chkstk
Martin Storsjö [Tue, 11 Oct 2022 12:20:59 +0000 (15:20 +0300)]
[AArch64] Fix aligning the stack after calling __chkstk

Whenever a call to __chkstk was made, the frame lowering previously
omitted the aligning (as NumBytes was reset to zero before doing
alignment).

This fixes https://github.com/llvm/llvm-project/issues/56182.

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

2 years ago[analyzer] Workaround crash on encountering Class non-type template parameters
Balazs Benics [Thu, 13 Oct 2022 06:41:31 +0000 (08:41 +0200)]
[analyzer] Workaround crash on encountering Class non-type template parameters

The Clang Static Analyzer will crash on this code:
```lang=C++
struct Box {
  int value;
};
template <Box V> int get() {
  return V.value;
}
template int get<Box{-1}>();
```
https://godbolt.org/z/5Yb1sMMMb

The problem is that we don't account for encountering `TemplateParamObjectDecl`s
within the `DeclRefExpr` handler in the `ExprEngine`.

IMO we should create a new memregion for representing such template
param objects, to model their language semantics.
Such as:
 - it should have global static storage
 - for two identical values, their addresses should be identical as well
http://eel.is/c%2B%2Bdraft/temp.param#8

I was thinking of introducing a `TemplateParamObjectRegion` under `DeclRegion`
for this purpose. It could have `TemplateParamObjectDecl` as a field.

The `TemplateParamObjectDecl::getValue()` returns `APValue`, which might
represent multiple levels of structures, unions and other goodies -
making the transformation from `APValue` to `SVal` a bit complicated.

That being said, for now, I think having `Unknowns` for such cases is
definitely an improvement to crashing, hence I'm proposing this patch.

Reviewed By: xazax.hun

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

2 years ago[HLSL] CodeGen hlsl cbuffer/tbuffer.
Xiang Li [Thu, 13 Oct 2022 00:02:56 +0000 (17:02 -0700)]
[HLSL] CodeGen hlsl cbuffer/tbuffer.

cbuffer A {
  float a;
  float b;
}

will be translated to a global variable.

Something like

struct CB_Ty {
  float a;
  float b;
};

CB_Ty A;

And all use of a and b will be replaced with A.a and A.b.

Only support none-legacy cbuffer layout now.
CodeGen for Resource binding will be in separate patch.
In the separate patch, resource binding will map the resource information to the global variable.

Reviewed By: efriedma

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

2 years ago[clang][Module][AIX] Mark test unsupported since objc doesn't have xcoff support
Kai Luo [Thu, 13 Oct 2022 03:51:50 +0000 (11:51 +0800)]
[clang][Module][AIX] Mark test unsupported since objc doesn't have xcoff support

Fixed error
```
Command Output (stderr):
--
fatal error: error in backend: Objective-C support is unimplemented for object file format
```
Source code in `clang/lib/CodeGen/CGObjCMac.cpp:5080`

```
  case llvm::Triple::Wasm:
  case llvm::Triple::GOFF:
  case llvm::Triple::SPIRV:
  case llvm::Triple::XCOFF:
  case llvm::Triple::DXContainer:
    llvm::report_fatal_error(
        "Objective-C support is unimplemented for object file format");
  }

```

Reviewed By: hubert.reinterpretcast

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

2 years ago[test] Fix a test that wasn't running
Jordan Rupprecht [Thu, 13 Oct 2022 03:43:45 +0000 (20:43 -0700)]
[test] Fix a test that wasn't running

The functionality is fine (we don't run the breakpoint command twice), but this test forgot to call `FileCheck` and isn't checking the same value isn't there twice..

2 years ago[HIP] Detect HIP for Debian/Fedora
Yaxun (Sam) Liu [Tue, 11 Oct 2022 22:53:59 +0000 (18:53 -0400)]
[HIP] Detect HIP for Debian/Fedora

HIP is installed at /usr or /usr/local on Debin/Fedora,
and the version file is at {root}/share/hip/version.

Reviewed by: Artem Belevich

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

2 years agoApply clang-tidy fixes for llvm-qualified-auto in SparseTensorCodegen.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 19:24:31 +0000 (19:24 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in SparseTensorCodegen.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-identifier-naming in SparseBufferRewriting...
Mehdi Amini [Thu, 6 Oct 2022 19:23:43 +0000 (19:23 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in SparseBufferRewriting.cpp (NFC)

2 years ago[clang] Use std::underlying_type_t (NFC)
Kazu Hirata [Thu, 13 Oct 2022 02:20:38 +0000 (19:20 -0700)]
[clang] Use std::underlying_type_t (NFC)

2 years ago[clang][deps] Respect VFS overlays in canonical preprocessing mode
Jan Svoboda [Tue, 11 Oct 2022 23:06:08 +0000 (16:06 -0700)]
[clang][deps] Respect VFS overlays in canonical preprocessing mode

The `-ivfsoverlay` flag was only being respected when the scanner was instructed to minimize the inputs. This patch respects that flag even in canonical preprocessing mode.

Depends on D135414.

Reviewed By: Bigcheese

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

2 years ago[clang][deps] Don't share in-memory VFS across scans
Jan Svoboda [Tue, 11 Oct 2022 23:02:10 +0000 (16:02 -0700)]
[clang][deps] Don't share in-memory VFS across scans

The dependency scanning worker may create an in-memory VFS and inject that into its `FileManager`. (Implemented in D109485.) This VFS currently persists between scans, which is not correct: in-memory files created in one scan could affect subsequent scans. This patch changes things so that the in-memory VFS is local to `DependencyScanningWorker::computeDependencies()`.

To test this, one would first scan for dependencies of a named module and then run second scan (on the same worker) for something unrelated, which would pick up the in-memory file created in the first scan. This set up is impossible to achieve with `clang-scan-deps`. We could set this up in `ToolingTests`, but the scanner needs to access the physical filesystem to store `.pcm` files. AFAIK we don't have a good way to propagate something like `%t` into unit tests to make that feasible. (This could be achieved with something like the virtualized `OutputManager`.)

Reviewed By: Bigcheese

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

2 years ago[BOLT] Add pass to fix ambiguous memory references
Rafael Auler [Sat, 27 Aug 2022 01:39:36 +0000 (18:39 -0700)]
[BOLT] Add pass to fix ambiguous memory references

This adds a round of checks to memory references, looking for
incorrect references to jump table objects. Fix them by replacing the
jump table reference with another object reference + offset.

This solves bugs related to regular data references in code
accidentally being bound to a jump table, and this reference being
updated to a new (incorrect) location because we moved this jump
table.

Fixes #55004

Reviewed By: #bolt, maksfb

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

2 years ago[BOLT][NFC] Refactor creation of symbol+addend references
Rafael Auler [Fri, 16 Sep 2022 23:20:00 +0000 (16:20 -0700)]
[BOLT][NFC] Refactor creation of symbol+addend references

Put code that creates references to symbol+addend behind MCPlusBuilder.
Will use this later in validate memory references pass.

Reviewed By: #bolt, maksfb, yota9

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

2 years ago[mlir][transforms] TopologicalSort: Support ops from different blocks
Matthias Springer [Thu, 13 Oct 2022 01:26:25 +0000 (10:26 +0900)]
[mlir][transforms] TopologicalSort: Support ops from different blocks

This change allows analyzing ops from different block, in particular when used in programs that have `cf` branches.

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

2 years ago[mlir][scf] Match any constants instead of arith.constant
Jeff Niu [Sat, 8 Oct 2022 02:28:41 +0000 (19:28 -0700)]
[mlir][scf] Match any constants instead of arith.constant

By matching `arith.constant` specifically, SCF canonicalizers/folders
are incompatible with other kinds of constants. Use the generic
matchers instead.

Reviewed By: rriddle

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

2 years agollvm-reduce: Color output of child processes
Matt Arsenault [Tue, 11 Oct 2022 01:03:46 +0000 (18:03 -0700)]
llvm-reduce: Color output of child processes

When reducing llvm-reduce with llvm-reduce, it can be confusing
to figure out what lines are printed by the child or parent. Not
sure this is the most reliable way to set and restore this.

2 years ago[mlir][ods] Assert on static getAttrName methods
Jeff Niu [Tue, 11 Oct 2022 17:40:23 +0000 (10:40 -0700)]
[mlir][ods] Assert on static getAttrName methods

This patch makes ODS insert an assert when calling static `get*AttrName`
methods with a `OperationName` that the name is the same as the op's.
This prevents accidentally passing the wrong kind of name and getting an
erroneous attribute name.

Reviewed By: rriddle

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

2 years ago[mlir][ods] Allow custom directives in optional groups
Jeff Niu [Sat, 1 Oct 2022 00:02:05 +0000 (17:02 -0700)]
[mlir][ods] Allow custom directives in optional groups

Attributes and types only (so far). Since `struct` and `params` are
allowed, it makes sense to allow custom directives as long as their
arguments contain at least one bound argument.

Reviewed By: rriddle

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

2 years ago[gn build] Port 573a5de7551c
LLVM GN Syncbot [Thu, 13 Oct 2022 00:34:23 +0000 (00:34 +0000)]
[gn build] Port 573a5de7551c

2 years agollvm-reduce: Add opcode reduction pass
Matt Arsenault [Tue, 11 Oct 2022 02:42:17 +0000 (19:42 -0700)]
llvm-reduce: Add opcode reduction pass

Try some dumb strength reductions to "simpler" opcodes.
Make some opcode substitutions I typically try to get smaller
MIR out of codegen. This is a bit target specific and I have a
lot of increasingly target specific modifications I try
during manual reduction.

2 years agoCorrectly model undefined behavior in {tensor|memref}.dim
Sanjoy Das [Wed, 12 Oct 2022 05:33:45 +0000 (22:33 -0700)]
Correctly model undefined behavior in {tensor|memref}.dim

These operations have undefined behavior if the index is not less than the rank of the source tensor / memref, so they cannot be freely speculated like they were before this patch.  After this patch we speculate them only if we can prove that they don't have UB.

Depends on D135505.

Reviewed By: mravishankar

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

2 years agoSummary: This documentation patch adds information to allow remote users to also...
Henrique Bucher [Mon, 10 Oct 2022 16:31:06 +0000 (11:31 -0500)]
Summary: This documentation patch adds information to allow remote users to also use the plugin as it will be invisible to them using the current instructions. It solves issue #58252.

This documentation patch adds information to allow remote users to also use the plugin as it will be invisible to them using the current instructions. It solves issue #58252.

Reviewed By: JDevlieghere

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

2 years agoAMDGPU: Fix assertion on <1 x i16> vectors
Matt Arsenault [Wed, 12 Oct 2022 22:27:28 +0000 (15:27 -0700)]
AMDGPU: Fix assertion on <1 x i16> vectors

Fixes issue 58331.

2 years agoAMDGPU: Fix hazard with v_accvgpr_write_b32 and inline asm VGPR defs
Matt Arsenault [Tue, 11 Oct 2022 17:41:09 +0000 (10:41 -0700)]
AMDGPU: Fix hazard with v_accvgpr_write_b32 and inline asm VGPR defs

If inline asm has a VGPR def, it must have come from a VGPR write
somewhere inside the asm. This should be further extended to all
read after write hazards.

2 years agollvm-reduce: Don't write out IR to score IR complexity
Matt Arsenault [Sat, 8 Oct 2022 17:21:33 +0000 (10:21 -0700)]
llvm-reduce: Don't write out IR to score IR complexity

In a testcase I'm working on, the old write out and count IR lines
was taking about 200-300ms per iteration. This drops it out of the
profile.

This doesn't account for everything, but it doesn't seem to matter.
We should probably try to account for metadata and constantexpr tree
depths.

2 years agollvm-reduce: Improve delta pass flag handling
Matt Arsenault [Mon, 10 Oct 2022 18:02:47 +0000 (11:02 -0700)]
llvm-reduce: Improve delta pass flag handling

Verify all the requested passes exist before trying to run any.
For long reductions, it was really annoying for it to get halfway through
and then I come back later to an incomplete reduction.

Also add a new skip-delta-passes flag. Most of the time I want to opt out
of specific reductions, rather than run a select few.

2 years ago[Flang] Add -fconvert option to swap endianness for unformatted files.
Jonathon Penix [Tue, 19 Jul 2022 18:47:25 +0000 (11:47 -0700)]
[Flang] Add -fconvert option to swap endianness for unformatted files.

To accomplish this, this patch creates an optional list of environment
variable default values to be set by the runtime to allow directly using
the existing runtime implementation of FORT_CONVERT for I/O conversions.

2 years ago[test][openmp] Relax check for tsan reports count
Vitaly Buka [Wed, 12 Oct 2022 23:45:07 +0000 (16:45 -0700)]
[test][openmp] Relax check for tsan reports count

I see 2 reports time to time.

2 years ago[LeakSanitizer] Capture calling thread SP early to avoid false negatives.
Wiktor Garbacz [Wed, 12 Oct 2022 23:36:37 +0000 (16:36 -0700)]
[LeakSanitizer] Capture calling thread SP early to avoid false negatives.

As shown in https://github.com/llvm/llvm-project/issues/42932 dead
pointers might be overlapped by a new stack frame inside CheckForLeaks,
which does not use bytes with pointers. This leads to false negatives.

It's not a full solution for the problem as it does not solve
"overlapping" new/old frames for frames below the CheckForLeaks and in
other threads. It should improve leaks found in direct callers of
__lsan_do_leak_check.

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

2 years ago[clang][test] NFC, check in darwin-ld-platform-version-macos-requires-darwin.c should...
Alex Lorenz [Wed, 12 Oct 2022 22:56:44 +0000 (15:56 -0700)]
[clang][test] NFC, check in darwin-ld-platform-version-macos-requires-darwin.c should be more permissive

some Darwin CI uses older SDK that reports different SDK version here
https://green.lab.llvm.org/green/job/clang-stage1-RA/

2 years ago[MC] only run ELF/AArch64 if supported
Florian Mayer [Wed, 12 Oct 2022 22:52:27 +0000 (15:52 -0700)]
[MC] only run ELF/AArch64 if supported

2 years ago[CMake] Fix FindGRPC cmake module to allow different layering
Steven Wu [Wed, 12 Oct 2022 22:25:43 +0000 (15:25 -0700)]
[CMake] Fix FindGRPC cmake module to allow different layering

Take the library target out of `generate_protos` function so the caller
can decide where to layer the library using the source generated from
the function.

Fixes: https://github.com/llvm/llvm-project/issues/58075

Reviewed By: sammccall

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

2 years ago[flang] Write semantics test for atomic_cas
Katherine Rasmussen [Tue, 20 Sep 2022 22:35:48 +0000 (15:35 -0700)]
[flang] Write semantics test for atomic_cas

Write a semantics test for the atomic intrinsic subroutine,
atomic_cas.

Reviewed By: rouson

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

2 years ago[Hexagon] Switch vunpackub->op->vpackeb pattern to vzb/vshuffeb
Krzysztof Parzyszek [Mon, 10 Oct 2022 22:52:38 +0000 (15:52 -0700)]
[Hexagon] Switch vunpackub->op->vpackeb pattern to vzb/vshuffeb

V6_vzb and V6_vshuffeb can use any 2 resources in a packet, while
V6_vunpackub/V6_vpackeb both need a shift resource.

Also, add patterns for shifting vectors of i8.

2 years ago[mlir] Fix a warning
Kazu Hirata [Wed, 12 Oct 2022 22:25:17 +0000 (15:25 -0700)]
[mlir] Fix a warning

This patch fixes:

  mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp:587:27:
  error: comparison of integers of different signs: 'int64_t' (aka
  'long') and 'uint64_t' (aka 'unsigned long')
  [-Werror,-Wsign-compare]

2 years ago[SCUDO] add cmake options for custom sysroot
Michael Jones [Mon, 10 Oct 2022 22:07:06 +0000 (15:07 -0700)]
[SCUDO] add cmake options for custom sysroot

These options will allow the SCUDO standalone to be built with custom
headers. Specifically, this patch will enable building with the
LLVM-libc headers.

Reviewed By: abrachet

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

2 years ago[mlir][sparse] Replace pass-by-value with pass-by-memref for C interface routines...
bixia1 [Wed, 12 Oct 2022 20:56:29 +0000 (13:56 -0700)]
[mlir][sparse] Replace pass-by-value with pass-by-memref for C interface routines to fix Windows build.

Reviewed By: aartbik, wrengr

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

2 years ago[MC] Consider IsMTETaggedFrame in CIEKey
Florian Mayer [Tue, 11 Oct 2022 01:17:55 +0000 (18:17 -0700)]
[MC] Consider IsMTETaggedFrame in CIEKey

Before this, we would incorrectly coalesce CIE for frames with and
without stack MTE.

Reviewed By: eugenis

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

2 years ago[MC] Also sort on IsBKeyFrame
Florian Mayer [Tue, 11 Oct 2022 01:27:18 +0000 (18:27 -0700)]
[MC] Also sort on IsBKeyFrame

Reviewed By: eugenis

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

2 years ago[libc++][NFC] Add missing SHA in ABI changelog
Louis Dionne [Wed, 12 Oct 2022 21:46:01 +0000 (17:46 -0400)]
[libc++][NFC] Add missing SHA in ABI changelog

2 years ago[mlir] Cleanup DialectDocGen to check for the dialect early
River Riddle [Wed, 12 Oct 2022 20:41:00 +0000 (13:41 -0700)]
[mlir] Cleanup DialectDocGen to check for the dialect early

We only ever generate documentation for one dialect, so there
isn't a good reason to collect every possible dialect entity.

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

2 years ago[HLSL] Add utility to convert environment to stage
Chris Bieneman [Wed, 12 Oct 2022 20:40:13 +0000 (15:40 -0500)]
[HLSL] Add utility to convert environment to stage

We had a bunch of places in the code where we were translating triple
environment enum cases to shader stage enum cases. The order of these
enums needs to be kept in sync for the translation to be simple, but we
were not properly handling out-of-bounds cases.

In normal compilation out-of-bounds cases shouldn't be possible because
the driver errors if you don't have a valid shader environment set, but
in clang tooling that error doesn't get treated as fatal and parsing
continues. This can result in crashes in clang tooling for out-of-range
shader stages.

To address this, this patch adds a constexpr method to handle the
conversion which handles out-of-range values by converting them to
`Invalid`.

Since this new method is a constexpr, the tests for this are a group of
static_asserts in the implementation file that verifies the correct
conversion for each valid enum case and validates that other cases are
converted to `Invalid`.

Reviewed By: bogner

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

2 years ago[compiler-rt] Bump deployment target in tests
Louis Dionne [Wed, 12 Oct 2022 21:28:09 +0000 (17:28 -0400)]
[compiler-rt] Bump deployment target in tests

On Darwin, libc++ is the default C++ stdlib now, and that requires
a deployment target of at least 10.7.

2 years ago[RISCV] Use branchless form for selects with 0 in either arm
Philip Reames [Wed, 12 Oct 2022 20:44:12 +0000 (13:44 -0700)]
[RISCV] Use branchless form for selects with 0 in either arm

Continuing the theme of adding branchless lowerings for simple selects, this time handle the 0 arm case. This is very common for various umin idioms, etc..

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

2 years ago[libc++] Add missing UNSUPPORTED annotations for std::pmr tests that use RTTI
Louis Dionne [Wed, 12 Oct 2022 20:39:26 +0000 (16:39 -0400)]
[libc++] Add missing UNSUPPORTED annotations for std::pmr tests that use RTTI

This is the equivalent of 340b48b267b9 applied to the non-experimental
std::pmr.

2 years ago[libc++][NFC] Fix incorrect main signatures in tests
Louis Dionne [Wed, 12 Oct 2022 20:24:30 +0000 (16:24 -0400)]
[libc++][NFC] Fix incorrect main signatures in tests

2 years ago [libc++] Replace some _LIBCPP_HIDDEN with _LIBCPP_HIDE_FROM_ABI
David Tenty [Wed, 12 Oct 2022 20:45:58 +0000 (16:45 -0400)]
 [libc++] Replace some _LIBCPP_HIDDEN with _LIBCPP_HIDE_FROM_ABI

These "implementation detail" function templates were already
hidden and have no specializations in the dylib, so they seem like they can safely
use _LIBCPP_HIDE_FROM_ABI instead and have the abi tags applied as well.

Seems some of these got over looked (e.g. D129823) in various places, and they
won't be flagged by the new checks added in D129968, as they were
already hidden.

Reviewed by: ldionne

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

2 years ago[HIP] Fix unbundling archive
Yaxun (Sam) Liu [Tue, 11 Oct 2022 22:53:59 +0000 (18:53 -0400)]
[HIP] Fix unbundling archive

When -lxxx is specified, if there happens to have a directory or
file with name xxx, clang will not look up libxxx.a, but will
try to unbundle xxx instead.

Reviewed by: Saiyedul Islam, Artem Belevich

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

2 years ago[libc] add headers sys/auxv sys/prctl and sys/time
Michael Jones [Tue, 11 Oct 2022 22:30:07 +0000 (15:30 -0700)]
[libc] add headers sys/auxv sys/prctl and sys/time

These headers are uncommonly used, and from extensions, but some basic
support is needed. Macros have been added where available.

Reviewed By: sivachandra

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

2 years ago[libc++][NFC] Fix typo in comment
Louis Dionne [Wed, 12 Oct 2022 20:06:17 +0000 (16:06 -0400)]
[libc++][NFC] Fix typo in comment

2 years ago[Hexagon] Handle packing of even/odd 32-bit words
Krzysztof Parzyszek [Wed, 12 Oct 2022 18:39:17 +0000 (11:39 -0700)]
[Hexagon] Handle packing of even/odd 32-bit words

This is a workaround until perfect shuffle generation is improved.

2 years ago[LTO][clang] Teaching Clang to Pass Plugin Options to the AIX Linker
Qiongsi Wu [Wed, 12 Oct 2022 19:16:07 +0000 (15:16 -0400)]
[LTO][clang] Teaching Clang to Pass Plugin Options to the AIX Linker

This patch teaches `clang` to use the prefix `-bplugin_opt:` (instead of `-plugin-opt`) on AIX, when passing plugin options to the linker. This patch follows https://reviews.llvm.org/D134668.

We put the code that decides what plugin option prefix to use at the top of the function `tools::addLTOOptions`. The plugin option prefix, the mcpu prefix, and the opt level prefix are different on AIX. We thought about choosing the strings in a function that reads the linker name and the target triple, or we could push the logic into different derived `ToolChain` classes. But this logic would not be used anywhere else, so these alternatives looked too complicated for what they did. Therefore we are doing it the current way. That said, I am all ears for suggestions to improve this code!

Subsequent code uses the `PluginOptPrefix` variable consistently instead of the hardcoded `-plugin-opt`.

Reviewed By: MaskRay

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

2 years ago[AMDGPU] Add GFX11 tests for fcmp and ballot. NFC
Joe Nash [Wed, 12 Oct 2022 14:53:10 +0000 (10:53 -0400)]
[AMDGPU] Add GFX11 tests for fcmp and ballot. NFC

Reviewed By: foad

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

2 years agoRevert "[runtimes] Always define cxx_shared, cxx_static & other targets"
Haowei Wu [Wed, 12 Oct 2022 19:54:48 +0000 (12:54 -0700)]
Revert "[runtimes] Always define cxx_shared, cxx_static & other targets"

This reverts commit 79ee0342dbf025bc70f237bdfe9ccb4e10a592ce which
breaks the LLVM TSan bots.

2 years agoMove interpreter check before modifying the allocation type.
Jacob Hegna [Wed, 12 Oct 2022 04:36:34 +0000 (04:36 +0000)]
Move interpreter check before modifying the allocation type.

2 years ago[MLGO] Force persistency in tflite buffers.
Jacob Hegna [Wed, 12 Oct 2022 02:05:19 +0000 (02:05 +0000)]
[MLGO] Force persistency in tflite buffers.

When training large models, we encounter use-after-free bugs when
writing to the input tensors for various MLGO models. This patch fixes the
issue by marking the tensors as "persistent".

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

2 years ago[Hexagon] Implement TLI::isExtractSubvectorCheap hook
Krzysztof Parzyszek [Wed, 12 Oct 2022 18:35:59 +0000 (11:35 -0700)]
[Hexagon] Implement TLI::isExtractSubvectorCheap hook

2 years ago[ConstraintElim] Move GEP decomposition code to separate fn (NFC).
Florian Hahn [Wed, 12 Oct 2022 19:38:30 +0000 (20:38 +0100)]
[ConstraintElim] Move GEP decomposition code to separate fn (NFC).

Breaks up a large function and allows for the use to early exits.

2 years ago[LLD] Enable --no-undefined-version by default.
Dan Albert [Thu, 6 Oct 2022 22:22:55 +0000 (15:22 -0700)]
[LLD] Enable --no-undefined-version by default.

Allowing incorrect version scripts is not a helpful default. Flip that
to help users find their bugs at build time rather than at run time.

Reviewed By: MaskRay

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

2 years ago[AArch64] Generate SEH info for PAC instructions
Martin Storsjö [Sat, 1 Oct 2022 15:49:32 +0000 (18:49 +0300)]
[AArch64] Generate SEH info for PAC instructions

Without this, unwinding through functions that does use PAC
would fail, if PAC actually was active.

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

2 years ago[AArch64] [SEH] Rename pac_sign_return_address to pac_sign_lr
Martin Storsjö [Wed, 12 Oct 2022 11:27:22 +0000 (14:27 +0300)]
[AArch64] [SEH] Rename pac_sign_return_address to pac_sign_lr

This new opcode was initially documented as "pac_sign_return_address"
in https://github.com/MicrosoftDocs/cpp-docs/pull/4202, but was
soon afterwards renamed into "pac_sign_lr" in
https://github.com/MicrosoftDocs/cpp-docs/pull/4209, as the other
name was unwieldy, and there were no other external references to
that name anywhere.

Rename our external .seh assembler directive - it hasn't been merged
for very long yet, so there's probably no external use to account for.

Rename all other internal references to the opcode similarly.

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

2 years ago[flang] Fix after introduction of ConditionallySpeculatable
Valentin Clement [Wed, 12 Oct 2022 19:14:46 +0000 (12:14 -0700)]
[flang] Fix after introduction of ConditionallySpeculatable

86771d0b65ee introduced some fialure for flang

https://buildkite.com/llvm-project/premerge-checks/builds/116406#0183ca8c-bc14-4314-9b1d-c764cf47e0aa

Update FIROps.td to fix the issues.

2 years ago[Clang] Do not crash when an invalid offload architecture is set
Joseph Huber [Wed, 12 Oct 2022 16:31:46 +0000 (11:31 -0500)]
[Clang] Do not crash when an invalid offload architecture is set

If an invalid architecture is set we currently return an empty string.
This will cause the offloading toolchain to continue to be built and
hit an assertion elsewhere due to the invalid architecture. This patch
fixes that so we now correctly exit.

Reviewed By: tra

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

2 years ago[libc++] Add test for bug that had been introduced in D98573 and fixed in D119633
Louis Dionne [Wed, 5 Oct 2022 18:03:31 +0000 (14:03 -0400)]
[libc++] Add test for bug that had been introduced in D98573 and fixed in D119633

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

2 years ago[gn build] Set _LIBCPP_ABI_NAMESPACE to __$libcxx_abi_version
Arthur Eubanks [Wed, 12 Oct 2022 18:58:01 +0000 (11:58 -0700)]
[gn build] Set _LIBCPP_ABI_NAMESPACE to __$libcxx_abi_version

Matches CMake build.
Otherwise currently everything is literally std::_LIBCPP_ABI_NAMESPACE::foo.

2 years ago[Frontend] Recognize environment variable SOURCE_DATE_EPOCH
Fangrui Song [Wed, 12 Oct 2022 18:55:26 +0000 (11:55 -0700)]
[Frontend] Recognize environment variable SOURCE_DATE_EPOCH

See https://reproducible-builds.org/docs/source-date-epoch/ . The environment
variable ``SOURCE_DATE_EPOCH`` been recognized by many compilers.

In GCC, if `SOURCE_DATE_EPOCH` is set, it specifies a UNIX timestamp to be used
in replacement of the current date and time in the `__DATE__` and `__TIME__`
macros. Note: GCC as of today does not update `__TIMESTAMP__` (the modification
time of the current source file) but
https://wiki.debian.org/ReproducibleBuilds/TimestampsFromCPPMacros expresses the
intention to update it.

This patches parses SOURCE_DATE_EPOCH and changes all the three macros.

In addition, in case gmtime/localtime returns null (e.g. on 64-bit Windows
gmtime returns null when the timestamp is larger than 32536850399
(3001-01-19T21:59:59Z)), use `??? ?? ????` as used by GCC.

Reviewed By: ychen

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

2 years ago[llvm-objcopy] Support --decompress-debug-sections when zlib is disabled
Fangrui Song [Wed, 12 Oct 2022 18:52:05 +0000 (11:52 -0700)]
[llvm-objcopy] Support --decompress-debug-sections when zlib is disabled

When zlib is disabled at build time, the diagnostic `LLVM was not compiled with
LLVM_ENABLE_ZLIB: cannot decompress` for --decompress-debug-sections may be
inaccurate: if zstd is enabled, we should still support zstd decompression.

It's not useful to test zlib and zstd. Just remove the diagnostic and add a new
one before `compression::decompress`.

This fixes compress-debug-sections-zstd.test

Reviewed By: mariusz-sikora-at-amd, jhenderson, phosek

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

2 years ago[ConstraintElimination] Add tests with 128 bit pointers.
Florian Hahn [Wed, 12 Oct 2022 18:49:29 +0000 (19:49 +0100)]
[ConstraintElimination] Add tests with 128 bit pointers.

2 years ago[libc++][NFC] Remove __lcpp prefix in math.h
Nikolas Klauser [Wed, 12 Oct 2022 13:45:09 +0000 (15:45 +0200)]
[libc++][NFC] Remove __lcpp prefix in math.h

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years ago[NFC][libc++] Moves transitive includes location.
Mark de Wever [Sun, 2 Oct 2022 17:42:46 +0000 (19:42 +0200)]
[NFC][libc++] Moves transitive includes location.

This moves some includes missed in D133212.

Reviewed By: ldionne, #libc, philnik

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

2 years ago[libc++][NFC] Replace _LIBCPP_INLINE_VISIBILITY in math.h
Nikolas Klauser [Wed, 12 Oct 2022 13:41:22 +0000 (15:41 +0200)]
[libc++][NFC] Replace _LIBCPP_INLINE_VISIBILITY in math.h

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years ago[PowerPC] Pre-commit unit test change for D132978
Peter Rong [Wed, 12 Oct 2022 18:26:57 +0000 (11:26 -0700)]
[PowerPC] Pre-commit unit test change for D132978

2 years ago[modules] Allow to validate system headers less often with `-fmodules-validate-once...
Volodymyr Sapsai [Wed, 5 Oct 2022 00:25:03 +0000 (17:25 -0700)]
[modules] Allow to validate system headers less often with `-fmodules-validate-once-per-build-session`.

Make flags `-fmodules-validate-system-headers` and
`-fmodules-validate-once-per-build-session` orthogonal, so they have
their own independent responsibilities - if system headers should be
validated and how often.

rdar://87988889

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

2 years agoIntroduce a ConditionallySpeculatable op interface
Sanjoy Das [Thu, 6 Oct 2022 22:57:25 +0000 (15:57 -0700)]
Introduce a ConditionallySpeculatable op interface

This patch takes the first step towards a more principled modeling of undefined behavior in MLIR as discussed in the following discourse threads:

 1. https://discourse.llvm.org/t/semantics-modeling-undefined-behavior-and-side-effects/4812
 2. https://discourse.llvm.org/t/rfc-mark-tensor-dim-and-memref-dim-as-side-effecting/65729

This patch in particular does the following:

 1. Introduces a ConditionallySpeculatable OpInterface that dynamically determines whether an Operation can be speculated.
 2. Re-defines `NoSideEffect` to allow undefined behavior, making it necessary but not sufficient for speculation.  Also renames it to `NoMemoryEffect`.
 3. Makes LICM respect the above semantics.
 4. Changes all ops tagged with `NoSideEffect` today to additionally implement ConditionallySpeculatable and mark themselves as always speculatable.  This combined trait is named `Pure`.  This makes this change NFC.

For out of tree dialects:

 1. Replace `NoSideEffect` with `Pure` if the operation does not have any memory effects, undefined behavior or infinite loops.
 2. Replace `NoSideEffect` with `NoSideEffect` otherwise.

The next steps in this process are (I'm proposing to do these in upcoming patches):

 1. Update operations like `tensor.dim`, `memref.dim`, `scf.for`, `affine.for` to implement a correct hook for `ConditionallySpeculatable`.  I'm also happy to update ops in other dialects if the respective dialect owners would like to and can give me some pointers.
 2. Update other passes that speculate operations to consult `ConditionallySpeculatable` in addition to `NoMemoryEffect`.  I could not find any other than LICM on a quick skim, but I could have missed some.
 3. Add some documentation / FAQs detailing the differences between side effects, undefined behavior, speculatabilty.

Reviewed By: rriddle, mehdi_amini

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

2 years ago[AST] Preserve more structure in UsingEnumDecl node.
Sam McCall [Tue, 20 Sep 2022 19:39:47 +0000 (21:39 +0200)]
[AST] Preserve more structure in UsingEnumDecl node.

- store NestedNameSpecifier & Loc for the qualifiers
  This information was entirely missing from the AST.
- expose the location information for qualifier/identifier/typedefs as typeloc
  This allows many traversals/astmatchers etc to handle these generically along
  with other references. The decl vs type split can help preserve typedef
  sugar when https://github.com/llvm/llvm-project/issues/57659 is resolved.
- fix the SourceRange of UsingEnumDecl to include 'using'.

Fixes https://github.com/clangd/clangd/issues/1283

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

2 years ago[X86] Pre-commit more unit tests for D134477
Han Zhu [Wed, 12 Oct 2022 06:58:27 +0000 (23:58 -0700)]
[X86] Pre-commit more unit tests for D134477

2 years agoAdd test to show missed optimization for masked load/stores
Benjamin Maxwell [Wed, 12 Oct 2022 11:25:51 +0000 (11:25 +0000)]
Add test to show missed optimization for masked load/stores

This test shows instcombine failing to remove a alloca and memcpy for
for a constant array that is read with a masked load.

This will be addressed in a subsequent commit.

2 years ago[AArch64] Pre-commit test case to show sub-optimal codegen for Github issue #57502
Mingming Liu [Mon, 5 Sep 2022 02:30:28 +0000 (19:30 -0700)]
[AArch64] Pre-commit test case to show sub-optimal codegen for Github issue #57502

Pre-commit test cases to show cases when UZP1 (TRUNC, TRUNC) could be
combined into TRUNC (UZP1) (with some proper bit conversions in the middle) to generate more efficient code.

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

2 years ago[libcxxabi]: Resync llvm & libcxxabi's demangler
Nathan Sidwell [Fri, 7 Oct 2022 14:03:32 +0000 (07:03 -0700)]
[libcxxabi]: Resync llvm & libcxxabi's demangler

Sadly the demangler copies have diverged.  This resyncs them by
a) pulling the meaningful llvm changes into libcxxabi's gold copy.
b) rerunning the sync script.

I notice uses of placement new, which assume the allocator succeeds --
that's incorrect in general, but an orthogonal problem.

Reviewed By: bader

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

2 years ago[PrintPipeline] Handle CoroConditionalWrapper and add more verification
Arthur Eubanks [Tue, 11 Oct 2022 18:14:53 +0000 (11:14 -0700)]
[PrintPipeline] Handle CoroConditionalWrapper and add more verification

Add a check (can be disabled via a flag) that the pipeline we generate is actually parsable.
Can be disabled because we don't expect to handle every pass in -print-pipeline-passes.

Fixes #58280.

Reviewed By: ChuanqiXu

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

2 years agoApply clang-tidy fixes for modernize-use-using in SparseBufferRewriting.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 19:23:10 +0000 (19:23 +0000)]
Apply clang-tidy fixes for modernize-use-using in SparseBufferRewriting.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-unnecessary-copy-initialization in CodegenUtil...
Mehdi Amini [Thu, 6 Oct 2022 19:22:18 +0000 (19:22 +0000)]
Apply clang-tidy fixes for performance-unnecessary-copy-initialization in CodegenUtils.cpp (NFC)

2 years ago[InstCombine] add test for udiv with shl divisor; NFC
Sanjay Patel [Wed, 12 Oct 2022 15:36:27 +0000 (11:36 -0400)]
[InstCombine] add test for udiv with shl divisor; NFC

This would solve an example from issue #58137 more
generally, but it may require adding a canonicalization
for shift + shift to shift + add.

2 years ago[libc++] Implements constexpr <charconv>.
Mark de Wever [Sat, 6 Aug 2022 08:47:53 +0000 (10:47 +0200)]
[libc++] Implements constexpr <charconv>.

Implements:
- P2291R3 Add Constexpr Modifiers to Functions to_chars and from_chars for
  Integral Types in <charconv> Header

Reviewed By: #libc, ldionne

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

2 years ago[libc++][format] Improves CTAD.
Mark de Wever [Wed, 5 Oct 2022 17:54:44 +0000 (19:54 +0200)]
[libc++][format] Improves CTAD.

This partly reverts D133535 and enables CTAD for more parts in format.

Reviewed By: ldionne, #libc

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

2 years ago[mlir][Linalg] Quarantine usage of LinalgTransformationFilter to TestTilingInterface.
Nicolas Vasilache [Wed, 12 Oct 2022 12:52:30 +0000 (05:52 -0700)]
[mlir][Linalg] Quarantine usage of LinalgTransformationFilter to TestTilingInterface.

This revision also retires code that has now become dead.

Context: https://discourse.llvm.org/t/psa-retire-linalg-filter-based-patterns/63785

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

2 years agoRevert "[libc] New version of the mem* framework"
Guillaume Chatelet [Wed, 12 Oct 2022 15:35:18 +0000 (15:35 +0000)]
Revert "[libc] New version of the mem* framework"

This reverts commit 4c19439d249256db720e323a446e39d05496732f.

2 years ago[SelectionDAG] Use consistent type sizes for opcode
Mirko Brkusanin [Wed, 12 Oct 2022 15:20:46 +0000 (17:20 +0200)]
[SelectionDAG] Use consistent type sizes for opcode

2 years ago[InstCombine] fold sdiv with common shl amount in operands
Sanjay Patel [Wed, 12 Oct 2022 15:18:55 +0000 (11:18 -0400)]
[InstCombine] fold sdiv with common shl amount in operands

(X << Z) / (Y << Z) --> X / Y

https://alive2.llvm.org/ce/z/CLKzqT

This requires a surprising "nuw" constraint because we have
to guard against immediate UB via signed-div overflow with
-1 divisor.

This extends 008a89037a49ca0d9 and is another transform
derived from issue #58137.

2 years ago[libc] New version of the mem* framework
Guillaume Chatelet [Tue, 4 Oct 2022 08:49:02 +0000 (08:49 +0000)]
[libc] New version of the mem* framework

This version is more composable and also simpler at the expense of being more explicit and more verbose.
This patch is not meant to be submitted but gives an idea of the change.
Codegen can be checked in https://godbolt.org/z/6z1dEoWbs by removing the "static inline" before individual functions.

Unittests are coming.

Suggested review order:
 - utils
 - op_base
 - op_builtin
 - op_generic
 - op_x86 / op_aarch64
 - *_implementations.h

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

2 years ago[SLP]Fix insertpoint of the extractellements instructions to avoid reshuffle crash.
Alexey Bataev [Mon, 10 Oct 2022 14:40:35 +0000 (07:40 -0700)]
[SLP]Fix insertpoint of the extractellements instructions to avoid reshuffle crash.

Need to set the insertpoint for extractelement to point to the first
instruction in the node to avoid possible crash during external uses
combine  process. Without it we may endup with the incorrect
transformation.

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