platform/upstream/llvm.git
14 months agoFixing conflicting macro definitions between curses.h and the standard library.
Nicole Rabjohn [Thu, 6 Jul 2023 17:12:05 +0000 (17:12 +0000)]
Fixing conflicting macro definitions between curses.h and the standard library.

POSIX allows certain macros to exist with generic names (i.e. refresh(), move(), and erase()) to exist in `curses.h` which conflict with functions found in std::filesystem, among others. This patch undefs the macros in question and adds them to LIBCPP_PUSH_MACROS and LIBCPP_POP_MACROS.

Reviewed By: #libc, philnik, ldionne

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

14 months ago[libc++][hardening][NFC] Rename the `has-debug-mode` feature to `has-legacy-debug...
varconst [Thu, 6 Jul 2023 17:17:02 +0000 (10:17 -0700)]
[libc++][hardening][NFC] Rename the `has-debug-mode` feature to `has-legacy-debug-mode`.

This will allow reusing the `has-debug-mode` feature for the new debug
mode without accidentally reenabling old debug mode tests. The
`has-legacy-debug-mode` feature is deliberately never set -- the old
tests are left checked in to have a point of reference for the level of
checking that was supported by the legacy debug mode, making it easier
to verify we've reached feature parity in the future.

14 months ago[YAML][NFC] Replace if-else with switch in createHNodes
Amir Ayupov [Thu, 6 Jul 2023 17:16:20 +0000 (10:16 -0700)]
[YAML][NFC] Replace if-else with switch in createHNodes

BOLT YAML profile reading time gets marginally faster (14.1572->13.9207 s) for
a large YAML profile (121MB/31K functions). Not claiming stat significance
though.

Reviewed By: hintonda

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

14 months agoCodeGen: Optimize lowering of is.fpclass fcZero|fcSubnormal
Matt Arsenault [Thu, 2 Feb 2023 14:28:05 +0000 (10:28 -0400)]
CodeGen: Optimize lowering of is.fpclass fcZero|fcSubnormal

Combine the two checks into a check if the exponent bits are 0. The
inverted case isn't reachable until a future change, and GlobalISel
currently doesn't attempt the inversion optimization.

https://reviews.llvm.org/D143182

14 months ago[gn] Add check-lsan target for Mac
Leonard Grey [Fri, 23 Jun 2023 17:26:32 +0000 (13:26 -0400)]
[gn] Add check-lsan target for Mac

Only supports ASAN mode right now. Standalone requires a some more plumbing so it will be a follow-up.

Mac-only but I suspect this will be fine on Linux also since it's based on the check-asan file, will follow up after testing.

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

14 months agoDAG: Check isCondCodeLegal in is_fpclass expansion to fcmp eq 0
Matt Arsenault [Sun, 4 Jun 2023 10:55:04 +0000 (06:55 -0400)]
DAG: Check isCondCodeLegal in is_fpclass expansion to fcmp eq 0

Results in some x86 codegen diffs. Some look better, some look worse.

https://reviews.llvm.org/D152094

14 months ago[mlir][sparse][gpu] fix missing dealloc
Aart Bik [Thu, 6 Jul 2023 05:17:52 +0000 (22:17 -0700)]
[mlir][sparse][gpu] fix missing dealloc

This dealloc was incorrectly removed in
https://reviews.llvm.org/D153173

Reviewed By: K-Wu

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

14 months ago[OpenMP] Remove gcc-12 warnings from libomp
Jonathan Peyton [Thu, 6 Jul 2023 16:45:58 +0000 (11:45 -0500)]
[OpenMP] Remove gcc-12 warnings from libomp

14 months ago[Libomptarget] Disable the 'mapping/prelock.cpp' test on AMDGPU
Joseph Huber [Thu, 6 Jul 2023 16:40:13 +0000 (11:40 -0500)]
[Libomptarget] Disable the 'mapping/prelock.cpp' test on AMDGPU

Summary:
This test was not functional on the new plugins, now that the old ones
have been deleted it doesn't work. Disable until we get a fix.

14 months agoReland '[msan] Intercept dladdr1, and refactor dladdr'
Thurston Dang [Wed, 5 Jul 2023 20:49:42 +0000 (20:49 +0000)]
Reland '[msan] Intercept dladdr1, and refactor dladdr'

Reland with -Wcast-qual issue fixed

Original commit message:
This patch adds an msan interceptor for dladdr1 (with support for RTLD_DL_LINKMAP and RTLD_DL_SYMENT) and an accompanying test. It also adds a helper file, msan_dl.cpp, that contains UnpoisonDllAddrInfo (refactored out of the dladdr interceptor) and UnpoisonDllAddr1ExtraInfo.

Reviewed By: vitalybuka

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

14 months agoAMDGPU: Fix not applying the correct default memcpy expansion threshold
Matt Arsenault [Thu, 6 Jul 2023 15:58:35 +0000 (11:58 -0400)]
AMDGPU: Fix not applying the correct default memcpy expansion threshold

Fixes 3c848194f28decca41b7362f9dd35d4939797724. The TTI hook name got
renamed at some point in the process and the target implementation was
left behind.

Fixes: SWDEV-407329

14 months ago[SystemZ][z/OS] Address single comment in ADA patch for EmittedBytes unused in -Asserts
Yusra Syeda [Thu, 6 Jul 2023 16:01:53 +0000 (12:01 -0400)]
[SystemZ][z/OS] Address single comment in ADA patch for EmittedBytes unused in -Asserts

14 months ago[mlir] Add support for TF32 as a Builtin FloatType
Jeremy Furtek [Thu, 6 Jul 2023 15:56:05 +0000 (08:56 -0700)]
[mlir] Add support for TF32 as a Builtin FloatType

This diff adds support for TF32 as a Builtin floating point type. This
supplements the recent addition of the TF32 semantic to the LLVM APFloat class
by extending usage to MLIR.

https://reviews.llvm.org/D151923

More information on the TF32 type can be found here:

https://blogs.nvidia.com/blog/2020/05/14/tensorfloat-32-precision-format/

Reviewed By: jpienaar

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

14 months ago[lldb][NFCI] Minor cleanups to StructuredData::GetObjectForDotSeparatedPath
Alex Langford [Wed, 5 Jul 2023 18:18:23 +0000 (11:18 -0700)]
[lldb][NFCI] Minor cleanups to StructuredData::GetObjectForDotSeparatedPath

This accomplishes a few minor things:
- Removed unnecessary uses of `this->`
- Removed an unnecessary std::string allocation.
- Removed some nesting to improve readability using early returns where
  it makes sense.
- Replaced `strtoul` with `llvm::to_integer` which avoids another
  std::string allocation.
- Removed braces from single statement conditions, removed
  else-after-returns.

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

14 months ago[lldb][NFCI] Remove use of ConstString from OptionValue
Alex Langford [Mon, 3 Jul 2023 19:55:29 +0000 (12:55 -0700)]
[lldb][NFCI] Remove use of ConstString from OptionValue

Summary: No need to create a ConstString, `GetName` already returns a StringRef.

Reviewers: JDevlieghere, mib, jasonmolenda

Subscribers:

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

14 months ago[AIX][XCOFF] print out the traceback info
zhijian [Thu, 6 Jul 2023 15:47:08 +0000 (11:47 -0400)]
[AIX][XCOFF] print out the traceback info

Summary:

  Adding a new option -traceback-table to print out the traceback info of xcoff ojbect file.

Reviewers: James Henderson, Fangrui Song, Stephen Peckham, Xing Xue

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

14 months ago[Libomptarget] Fix tests after deleting the next-gen plugins
Joseph Huber [Thu, 6 Jul 2023 15:38:18 +0000 (10:38 -0500)]
[Libomptarget] Fix tests after deleting the next-gen plugins

The next-gen plugins didn't correctly configure tests and were never
actually being run. Since deleting the old plugin we stopped getting
`libomptarget` tests. This patch fixes the issue and allows the targets
to be built

Reviewed By: JonChesterfield

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

14 months agoEnable dynamic-sized VLAs for data sharing in OpenMP offloaded target regions.
Doru Bercea [Thu, 22 Jun 2023 22:25:05 +0000 (18:25 -0400)]
Enable dynamic-sized VLAs for data sharing in OpenMP offloaded target regions.

Review: https://reviews.llvm.org/D153883

14 months ago[RISCV] Use ClangBuiltin in IntrinsicsRISCV.td to map some scalar crypto builtins...
Craig Topper [Thu, 6 Jul 2023 14:53:31 +0000 (07:53 -0700)]
[RISCV] Use ClangBuiltin in IntrinsicsRISCV.td to map some scalar crypto builtins to IR intrinsic.

This is the way most targets do it for a simple mapping.

We can't do this for all builtins due to type overloading of the IR intrinsics.

Reviewed By: asb

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

14 months ago[CaptureTracking] Don't consider comparison of inbounds GEP with nonnull non-capturing
Nikita Popov [Thu, 29 Jun 2023 08:04:46 +0000 (10:04 +0200)]
[CaptureTracking] Don't consider comparison of inbounds GEP with nonnull non-capturing

This is required to bring CaptureTracking in line with the new
semantics from D154051, as gep inbounds p, 0 is now always non-poison.

There are many ways in which the inbounds special case could be
preserved: If the index is known non-zero, or there is an inbounds
chain down to an identified object, etc. However, I have opted to
drop the special case entirely, as it appears to be low value:
In cases where we can determine such things (e.g. the affected test
cases) we would end up removing the compare via isGEPKnownNonNull()
logic anyway.

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

14 months ago[libcxx] Only add -GR- option to MSVC or clang-cl builds
David Spickett [Thu, 6 Jul 2023 08:49:33 +0000 (08:49 +0000)]
[libcxx] Only add -GR- option to MSVC or clang-cl builds

Previously we added both `-GR-` and `-fno-rtti` if RTTI was disabled.
When building with clang 16.x, that caused this error in part of the build:
```
clang-16: error: argument unused during compilation: '-G R-' [-Werror,-Wunused-command-line-argument]
```
I think the strange message is because clang is seeing `R-` as the argument
to `-G`, which is a valid clang option.

`-GR-` is an alternate syntax for the `/GR-` option for MSVC
(the dash means disable RTTI):
https://learn.microsoft.com/en-us/cpp/build/reference/gr-enable-run-time-type-information?view=msvc-170

This error is sort of fixed by cd18efb61d759405956dbd30e4b5f2720d8e1783
but not intentionally. Also, we'd have to wait for 17.x to benefit from that.

The proper fix here is to only add `-GR-` if we are building with MSVC
or the MSVC-like clang-cl, and add `-fno-rtti` if not.

Reviewed By: #libc, simon_tatham, michaelplatings, ldionne

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

14 months ago[flang] Force the use of intrinsic builtins in type_info
Leandro Lupori [Tue, 4 Jul 2023 15:50:32 +0000 (15:50 +0000)]
[flang] Force the use of intrinsic builtins in type_info

This ensures that the __Fortran_builtins module is always used
as an intrinsic module by __Fortran_type_info, which avoids issues
when, for instance, the intrinsic modules dir is present in the
include paths.

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

Reviewed By: klausler

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

14 months ago[X86] isTargetShuffleEquivalent - ensure the reference operands are vector types
Simon Pilgrim [Thu, 6 Jul 2023 14:35:52 +0000 (15:35 +0100)]
[X86] isTargetShuffleEquivalent - ensure the reference operands are vector types

Fixes #63700

14 months ago[RISCV] Use 'long' in sha512 builtin tests. NFC
Craig Topper [Thu, 6 Jul 2023 14:37:19 +0000 (07:37 -0700)]
[RISCV] Use 'long' in sha512 builtin tests. NFC

This matches the data type of the intrinsics. This case be seen
from the removal of sext and trunc instructions from the IR.

Reviewed By: asb

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

14 months ago[analyzer] Fix false negative when pass implicit cast nil to nonnull
songruiwang [Thu, 6 Jul 2023 14:34:10 +0000 (22:34 +0800)]
[analyzer] Fix false negative when pass implicit cast nil to nonnull

We should look through implicit casts before determining the type of the arguments, and only allow explicit cast to _Nonnull to suppress warning

```
void foo(NSString *_Nonnull);

foo((NSString * _Nonnull)nil); // no-warning
id obj = nil;
foo(obj); // should warning here (implicit cast id to NSString *_Nonnull)

```

Reviewed By: xazax.hun, steakhal

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

14 months ago[Mips] Replace OperandMatchResultTy with ParseStatus (NFC)
Sergei Barannikov [Mon, 3 Jul 2023 04:06:33 +0000 (07:06 +0300)]
[Mips] Replace OperandMatchResultTy with ParseStatus (NFC)

ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:
```
  return Error(L, "msg");
```
when with MatchOperandResultTy it had to be:
```
  Error(L, "msg");
  return MatchOperand_ParseFail;
```
It also has more appropriate name since parse* methods are not only for
parsing operands.

Reviewed By: MaskRay

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

14 months ago[clang][CodeGenCXX] Improve handling of itanium ABI member function alignment require...
David Tenty [Wed, 29 Mar 2023 13:25:37 +0000 (09:25 -0400)]
[clang][CodeGenCXX] Improve handling of itanium ABI member function alignment requirements

The itanium ABI for certain platforms requires a minimum alignments for
member function pointers to reserve certain bits for distinguishing
virtual and non-virtual functions.

Our implementation of this however depends on the alignment of the
function involved, which may however not reflect the true alignment of
function pointers on certain targets for which the alignment is
independent of the function (e.g. AIX). Worse, the 2-byte alignment
we use may be less than the ABI minimum for the target, and in the case
we are using explicit sections will result in invalid codegen.

This patch attempts to correct this situation by considering the target
alignment of function pointers as part of making the decision about
whether we need to adjust the function alignment to conform to the ABI.
Targets which do not provide the function ptr alignment information
will return a value of 1 when queried and will conservatively retain
the old alignment.

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

14 months ago[lld] respect LLVM_EXTERNAL_LIT
Konrad Kleine [Thu, 6 Jul 2023 12:05:02 +0000 (14:05 +0200)]
[lld] respect LLVM_EXTERNAL_LIT

Consider a setup without a system-wide installation of lit.
Instead you pass the path to lit like this:

```
cmake ...
-DLLVM_EXTERNAL_LIT=<PATH_TO_LIT_BINARY> ...
```

Then you will run into this error:

```
ninja: error: unknown target 'check-lld'
```

I have a buildbot builder that fails with this message. Here's the
passage that triggers this error:

https://github.com/llvm/llvm-zorg/blob/d3bfd5ccbceb542098c350e4d071ceceac6854cb/zorg/buildbot/builders/annotated/standalone-build.sh#L194-L239

By using `LLVM_EXTERNAL_LIT` instead of `LLVM_LIT` we fix this problem.

See
[here](https://llvm.org/docs/GettingStarted.html#stand-alone-builds) for
a description:

> Both the LLVM_ROOT and LLVM_EXTERNAL_LIT options are required to do stand-alone builds for all sub-projects. Additional required options for each sub-project can be found in the table below.

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

14 months agoAdd missing semantic highlighing for concepts.
Jens Massberg [Thu, 6 Jul 2023 08:31:57 +0000 (10:31 +0200)]
Add missing semantic highlighing for concepts.

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

14 months agoAMDGPU: Make SIFixVGPRCopies preserve everything
Matt Arsenault [Sat, 1 Jul 2023 12:34:02 +0000 (08:34 -0400)]
AMDGPU: Make SIFixVGPRCopies preserve everything

All this does is add uses of reserved registers, which
aren't tracked by anything. Saves a loop info computation.

14 months agoAMDGPU: Fold out sign bit ops on frexp_exp
Matt Arsenault [Mon, 3 Jul 2023 14:38:04 +0000 (10:38 -0400)]
AMDGPU: Fold out sign bit ops on frexp_exp

The sign bit has no impact on the exponent, so strip these away. Saves
on the source modifier encoding cost. I left the GlobalISel handling
until there's a resolution to issue #62628.

We should do this in instcombine too, but legalization should be
introducing more frexps than it currently is where this would occur.

14 months ago[SVE] Add isel for 32-bit add/sub(cntp()) -> incp/decp.
Paul Walker [Mon, 3 Jul 2023 14:00:15 +0000 (15:00 +0100)]
[SVE] Add isel for 32-bit add/sub(cntp()) -> incp/decp.

Patterns already exist for 64-bit that I've simply copied and
converted to include the necessary truncation.

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

14 months ago[mlir][linalg][transform] Add verifier to MaskedVectorizeOp
Matthias Springer [Thu, 6 Jul 2023 14:20:30 +0000 (16:20 +0200)]
[mlir][linalg][transform] Add verifier to MaskedVectorizeOp

Verify that the correct number of `scalable_sizes` was provided.

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

14 months ago[LV] Add test case for incorrect shift truncation.
Florian Hahn [Thu, 6 Jul 2023 14:23:16 +0000 (15:23 +0100)]
[LV] Add test case for incorrect shift truncation.

Test for https://github.com/llvm/llvm-project/issues/47927

14 months ago[mlir][bufferization] Fix insertion point issue in EliminateEmptyTensors
Matthias Springer [Thu, 6 Jul 2023 14:12:52 +0000 (16:12 +0200)]
[mlir][bufferization] Fix insertion point issue in EliminateEmptyTensors

The replacement op insertion point was off by one.

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

14 months ago[Driver][MSVC] Support DWARF fission when using LTO on Windows
Haohai Wen [Thu, 6 Jul 2023 14:18:35 +0000 (22:18 +0800)]
[Driver][MSVC] Support DWARF fission when using LTO on Windows

D154070 has added /dwodir to lld/COFF to tells LTO backend to create dwo
directory and files. This patch makes clang to emit /dwodir to lld when
user specify -gsplit-dwarf with LTO. This behavior is simiar to DWARF
fission with LTO for ELF.

A simple use case:
$clang-cl -c -flto -gdwarf main.c -o main.o
$clang-cl -c -flto -gdwarf a.c -o a.o
$clang-cl -flto -fuse-ld=lld -gdwarf -gsplit-dwarf main.o a.o

This'll generate a dwo file: main.exe_dwo/0.dwo

Reviewed By: mstorsjo, MaskRay, hans

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

14 months ago[gn build] Port 7aafea001282
LLVM GN Syncbot [Thu, 6 Jul 2023 14:01:11 +0000 (14:01 +0000)]
[gn build] Port 7aafea001282

14 months ago[gn build] Port 4ade8b7ed997
LLVM GN Syncbot [Thu, 6 Jul 2023 14:01:10 +0000 (14:01 +0000)]
[gn build] Port 4ade8b7ed997

14 months ago[gn build] Port 2d8cd1951202
LLVM GN Syncbot [Thu, 6 Jul 2023 14:01:10 +0000 (14:01 +0000)]
[gn build] Port 2d8cd1951202

14 months ago[gn build] Port 163aad6bcbff
LLVM GN Syncbot [Thu, 6 Jul 2023 14:01:09 +0000 (14:01 +0000)]
[gn build] Port 163aad6bcbff

14 months ago[gn] port 3003da71540b
Nico Weber [Thu, 6 Jul 2023 14:00:33 +0000 (10:00 -0400)]
[gn] port 3003da71540b

14 months ago[mlir][LLVM] Make `SplitIntegerStores` capable of splitting vectors as well
Markus Böck [Thu, 6 Jul 2023 08:59:40 +0000 (10:59 +0200)]
[mlir][LLVM] Make `SplitIntegerStores` capable of splitting vectors as well

The original plan was to turn this into its own pattern, but one of the difficulties was deeming when splitting the vector is required.
`SplitIntegerStores` essentially already did that by checking for field overlap.
Therefore, it was renamed to `SplitStores` and extended to splitting stores with values of vector and integer type.

The vector splitting is done in a simple manner by simply using `extractelement` to get each vector element. Subsequent pattern applications are responsible for further cleaning up the output and making it type-consistent.

Worst case, if the code cannot be transformed into a type-consistent form (due to e.g. the code explicitly doing partial writes to elements or similar), we might needlessly do a vector split.

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

14 months ago[mlir][LLVM] Use `undef` operand instead of removing `llvm.intr.dbg.value`
Markus Böck [Wed, 5 Jul 2023 07:15:50 +0000 (09:15 +0200)]
[mlir][LLVM] Use `undef` operand instead of removing `llvm.intr.dbg.value`

Jeremy Morse noted in D154451 that LLVM doesn't drop a `dbg.value` when its value is being removed, but rather sets the operand to `undef`. This preserves the debug info and gives allows the debugger to instead inform the user that the variable has been optimized out, rather than not displaying the variable at all.

This patch fixes that mistake done in the previous revision by mirroring that behaviour in MLIR as well.

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

14 months ago[DemandedBits] Add tests for shl.
Florian Hahn [Thu, 6 Jul 2023 13:33:11 +0000 (14:33 +0100)]
[DemandedBits] Add tests for shl.

Add test coverage for demanded bit analysis of shl.

14 months ago[IRCE][Tests] Add more tests with range checks in the form of 'iv + offset vs limit'
Aleksandr Popov [Thu, 6 Jul 2023 13:29:55 +0000 (15:29 +0200)]
[IRCE][Tests] Add more tests with range checks in the form of 'iv + offset vs limit'

Added tests on range checks with non-strick predicate:
    * N - IV > limit
    * IV - N < limit
    * IV + N < limit

Also added tests with known to be non-negative N

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

14 months ago[BPF] Undo transformation for LICM.cpp:hoistMinMax()
Eduard Zingerman [Tue, 11 Apr 2023 03:31:27 +0000 (06:31 +0300)]
[BPF] Undo transformation for LICM.cpp:hoistMinMax()

Extended BPFCheckAndAdjustIR pass with sinkMinMax() transformation
that undoes LICM hoistMinMax pass.

The undo transformation converts the following patterns:

    x < min(a, b) -> x < a && x < b
    x > min(a, b) -> x > a || x > b
    x < max(a, b) -> x < a || x < b
    x > max(a, b) -> x > a && x > b

Where 'a' or 'b' is a constant.
Also supports `sext min(...) ...` and `zext min(...) ...`.

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

14 months ago[DemandedBits] Print function name when printing analysis.
Florian Hahn [Thu, 6 Jul 2023 13:17:20 +0000 (14:17 +0100)]
[DemandedBits] Print function name when printing analysis.

Include the function name + analysis when printing the analysis for
testing.

14 months ago[docs] Update 'please file a bug' link for clang-cl
Hans Wennborg [Thu, 6 Jul 2023 13:12:42 +0000 (15:12 +0200)]
[docs] Update 'please file a bug' link for clang-cl

14 months ago[GlobalISel][X86] Regenerate add/sub legalization tests
Simon Pilgrim [Thu, 6 Jul 2023 11:24:05 +0000 (12:24 +0100)]
[GlobalISel][X86] Regenerate add/sub legalization tests

14 months ago[InstSimplify] Fold gep inbounds undef to undef instead of poison
Nikita Popov [Fri, 30 Jun 2023 13:31:47 +0000 (15:31 +0200)]
[InstSimplify] Fold gep inbounds undef to undef instead of poison

With the semantics change from D154051, it is no longer valid to
fold gep inbounds undef to poison (unless we know the index is
non-zero). Fold it to undef instead.

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

14 months ago[MLIR][Linalg] Add more arith named ops to linalg (take 2)
Renato Golin [Thu, 6 Jul 2023 11:03:16 +0000 (12:03 +0100)]
[MLIR][Linalg] Add more arith named ops to linalg (take 2)

Re-apply eda47fdd258c after implementing __truediv__ for TensorUse.

[MLIR][Linalg] Add more arith named ops to linalg

Following up the 'add' named op, here are the remaining basic arithmetic
and maths, including a 'div_unsigned' for integer unsigned values. In the
same pattern as 'matmul_unsigned', the simply named 'div' assumes signed
values and the '_unsigned' variation handles the unsigned values.

It's a bit odd, but there doesn't seem to be a easy way to restrict to
specific types to make 'div_unsigned' only work with integers in the
structured ops framework.

Same as 'add', these have strict semantics regarding casts.

Unary math ops will need some massaging, so I split these ones for now
as I continue working on them.

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

14 months ago[AIX][TLS] Generate optimized local-exec access code sequence using X-Form loads...
Amy Kwan [Fri, 30 Jun 2023 16:01:02 +0000 (11:01 -0500)]
[AIX][TLS] Generate optimized local-exec access code sequence using X-Form loads/stores

This patch is a follow up to D149722, D152669 and D153645, where a slightly more
optimized code sequence is generated for 64-bit and 32-bit local-exec accesses
when optimizations are turned on.

Handling is added PPCISelDAGToDAG.cpp in order to check if any D-form loads or
stores that follow an PPCISD::ADD_TLS can be optimized to use an X-Form load or
store. In this particular situation, this allows the ADD_TLS node to be removed
completely.

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

14 months ago[clang][Interp][NFC] Move some declarations into the if condition
Timm Bäder [Thu, 6 Jul 2023 06:19:38 +0000 (08:19 +0200)]
[clang][Interp][NFC] Move some declarations into the if condition

14 months ago[clang][Interp][NFC] Fix some doc comment confusion
Timm Bäder [Thu, 6 Jul 2023 06:57:23 +0000 (08:57 +0200)]
[clang][Interp][NFC] Fix some doc comment confusion

These are supposed to be regular comments.

14 months ago[clang][Interp][NFC] Take a const Function pointer in Context::Run()
Timm Bäder [Thu, 6 Jul 2023 07:11:17 +0000 (09:11 +0200)]
[clang][Interp][NFC] Take  a const Function pointer in Context::Run()

14 months ago[clang][Interp][NFC] Make a local variable const
Timm Bäder [Thu, 6 Jul 2023 07:24:13 +0000 (09:24 +0200)]
[clang][Interp][NFC] Make a local variable const

And add some assertions.

14 months ago[clang][Interp][NFC] Return a const Descriptor from a getter
Timm Bäder [Thu, 6 Jul 2023 07:37:45 +0000 (09:37 +0200)]
[clang][Interp][NFC] Return a const Descriptor from a getter

They are generally immutable anyway. Also fix some doc comments.

14 months ago[LangRef] Always allow getelementptr inbounds with zero offset
Nikita Popov [Thu, 29 Jun 2023 08:46:44 +0000 (10:46 +0200)]
[LangRef] Always allow getelementptr inbounds with zero offset

Currently, our GEP specification has a special case that makes
gep inbounds (null, 0) legal. This patch proposes to expand this
special case to all gep inbounds (ptr, 0), where ptr is no longer
required to point to an allocated object.

This was previously discussed in some detail at
https://discourse.llvm.org/t/question-about-getelementptr-inbounds-with-offset-0/62533.

The motivation for this change is twofold:

 * Rust relies on getelementptr inbounds with zero offset to be
   legal for arbitrary pointers to support zero-sized types. The
   current rules are unclear on whether this is legal or not
   (saying that there is a zero-size "allocated object" at every
   address may be consistent with our current rules, but more
   clarity is desired here).
 * The current semantics require us to drop the inbounds flag
   when materializing zero-index GEPs, which is done by some
   InstCombine transforms. Preserving the inbounds flag can
   substantially improve optimization quality in some cases, as
   illustrated in D154055.

As far as I know, the only analysis/transforms affected by this
semantics change are:

 * A special-case for comparisons with null in CaptureTracking,
   which is fixed by D154054. As far as I can tell, that special
   case is not particularly valuable and should be recovered by
   other transforms.
 * Folding gep inbounds undef, idx to poison. We now need to fold
   to undef instead (D154215).

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

14 months ago[libc++] Fix thread annotations on shared_mutex and shared_timed_mutex
Louis Dionne [Mon, 3 Jul 2023 15:02:47 +0000 (11:02 -0400)]
[libc++] Fix thread annotations on shared_mutex and shared_timed_mutex

Based on the comment in https://reviews.llvm.org/D54290#4418958, these
attributes need to be on the top-level functions in order to work
properly. Also, add tests.

Fixes http://llvm.org/PR57035.

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

14 months ago[RISCV][test] Add RV32I and RV64I RUN lines to llvm.frexp.ll
Alex Bradbury [Thu, 6 Jul 2023 12:34:58 +0000 (13:34 +0100)]
[RISCV][test] Add RV32I and RV64I RUN lines to llvm.frexp.ll

Thanks to D154555, these intrinsics no longer crash when used with a
soft float ABI.

14 months ago[LV] Consider if scalar epilogue is required in getMaximizedVFForTarget.
Florian Hahn [Thu, 6 Jul 2023 12:31:44 +0000 (13:31 +0100)]
[LV] Consider if scalar epilogue is required in getMaximizedVFForTarget.

When a scalar epilogue is required, at least one iteration of the scalar loop
has to execute. Adjust ConstTripCount accordingly to avoid picking a max VF
that results in a dead vector loop.

Reviewed By: Ayal

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

14 months ago[lldb][NFC] Remove code duplication in InitOSO
Felipe de Azevedo Piovezan [Wed, 5 Jul 2023 12:44:52 +0000 (08:44 -0400)]
[lldb][NFC] Remove code duplication in InitOSO

Two identical loops were iterating over different ranges, leading to code
duplication. We replace this by a loop over the concatenation of the ranges.

We also use early returns to avoid deeply nested code and explicitly check for a
condition mentioned in comments.

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

14 months agoFix compile error in UnresolvedSetTest.cpp, hopefully the last one
John Brawn [Thu, 6 Jul 2023 10:48:10 +0000 (11:48 +0100)]
Fix compile error in UnresolvedSetTest.cpp, hopefully the last one

This test is failing to compile when LLVM_ENABLE_MODULES=ON due to
NamedDecl being multiply defined. Fix this by avoiding declaring our
own NamedDecl in the test and instead cast a struct of appropriate
size and alignment to NamedDecl.

14 months agoupdate_mir_test_checks.py - separate different prefix checks
Eddie Phillips [Thu, 6 Jul 2023 10:48:56 +0000 (11:48 +0100)]
update_mir_test_checks.py - separate different prefix checks

Matches behaviour in update_llc_test_checks.py etc.

Fixes #63112

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

14 months ago[AMDGPU] Add GlobalISel test coverage for floating-point truncations.
Ivan Kosarev [Thu, 6 Jul 2023 10:22:25 +0000 (11:22 +0100)]
[AMDGPU] Add GlobalISel test coverage for floating-point truncations.

Reviewed By: arsenm

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

14 months ago[compiler-rt] Fix __sanitizer_cpuset size on newer FreeBSD
Marco Elver [Thu, 6 Jul 2023 10:25:47 +0000 (12:25 +0200)]
[compiler-rt] Fix __sanitizer_cpuset size on newer FreeBSD

Current FreeBSD has increased size of cpuset. Match it to not break the
build on newer FreeBSD.

Patch by John F. Carr

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

14 months ago[LLD][ELF] Cortex-M Security Extensions (CMSE) Support
Amilendra Kodithuwakku [Thu, 6 Jul 2023 09:45:10 +0000 (10:45 +0100)]
[LLD][ELF] Cortex-M Security Extensions (CMSE) Support

This commit provides linker support for Cortex-M Security Extensions (CMSE).
The specification for this feature can be found in ARM v8-M Security Extensions:
Requirements on Development Tools.

The linker synthesizes a security gateway veneer in a special section;
`.gnu.sgstubs`, when it finds non-local symbols `__acle_se_<entry>` and `<entry>`,
defined relative to the same text section and having the same address. The
address of `<entry>` is retargeted to the starting address of the
linker-synthesized security gateway veneer in section `.gnu.sgstubs`.

In summary, the linker translates input:

```
    .text
  entry:
  __acle_se_entry:
    [entry_code]

```
into:

```
    .section .gnu.sgstubs
  entry:
    SG
    B.W __acle_se_entry

    .text
  __acle_se_entry:
    [entry_code]
```

If addresses of `__acle_se_<entry>` and `<entry>` are not equal, the linker
considers that `<entry>` already defines a secure gateway veneer so does not
synthesize one.

If `--out-implib=<out.lib>` is specified, the linker writes the list of secure
gateway veneers into a CMSE import library `<out.lib>`. The CMSE import library
will have 3 sections: `.symtab`, `.strtab`, `.shstrtab`. For every secure gateway
veneer <entry> at address `<addr>`, `.symtab` contains a `SHN_ABS` symbol `<entry>` with
value `<addr>`.

If `--in-implib=<in.lib>` is specified, the linker reads the existing CMSE import
library `<in.lib>` and preserves the entry function addresses in the resulting
executable and new import library.

Reviewed By: MaskRay, peter.smith

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

14 months ago[llvm][Support] Deprecate llvm::writeFileAtomically API
Haojian Wu [Mon, 3 Jul 2023 09:49:13 +0000 (11:49 +0200)]
[llvm][Support] Deprecate llvm::writeFileAtomically API

We're in favor of the llvm::writeToOutput API, and all
writeFileAtomically usages have been migrated to writeToOutput.

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

14 months ago[mlir][linalg][transform] Fix Python build
Matthias Springer [Thu, 6 Jul 2023 10:20:03 +0000 (12:20 +0200)]
[mlir][linalg][transform] Fix Python build

This should have been part of D154585.

14 months ago[MLIR][Linalg] Expose `packMatmulGreedily` in `Transforms.h` (NFC)
Lorenzo Chelini [Wed, 5 Jul 2023 13:11:22 +0000 (15:11 +0200)]
[MLIR][Linalg] Expose `packMatmulGreedily` in `Transforms.h` (NFC)

Make the transformation accessible to other drivers (i.e., passes).

14 months ago[X86] Fold BITOP(PACKSS(X,Z),PACKSS(Y,W)) --> PACKSS(BITOP(X,Y),BITOP(Z,W)) (REAPPLIED)
Simon Pilgrim [Thu, 6 Jul 2023 09:55:49 +0000 (10:55 +0100)]
[X86] Fold BITOP(PACKSS(X,Z),PACKSS(Y,W)) --> PACKSS(BITOP(X,Y),BITOP(Z,W)) (REAPPLIED)

Fold allsignbits pack patterns to make better use of cheap (and commutable) logic ops

Reapplied after a32d14fd4c0a / 156913cb7764 with bitcast fix

14 months ago[X86] Add base SSE2 i686 test coverage to vector bitlogic reduction tests
Simon Pilgrim [Thu, 6 Jul 2023 09:45:41 +0000 (10:45 +0100)]
[X86] Add base SSE2 i686 test coverage to vector bitlogic reduction tests

14 months ago[X86] Add base SSE2 i686 test coverage to vector bool reduction tests
Simon Pilgrim [Thu, 6 Jul 2023 09:37:24 +0000 (10:37 +0100)]
[X86] Add base SSE2 i686 test coverage to vector bool reduction tests

14 months ago[mlir][linalg][transform] Fix TileOp builder
Matthias Springer [Thu, 6 Jul 2023 09:31:33 +0000 (11:31 +0200)]
[mlir][linalg][transform] Fix TileOp builder

The TileOp builders did not set `scalable_sizes`, which produces invalid ops. `scalable_sizes` must contain as any booleans as there are sizes.

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

14 months ago[include-cleaner] Add an IgnoreHeaders flag to the command-line tool.
Haojian Wu [Thu, 6 Jul 2023 08:56:08 +0000 (10:56 +0200)]
[include-cleaner] Add an IgnoreHeaders flag to the command-line tool.

Reviewed By: kadircet

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

14 months ago[clang-format] Fix align consecutive declarations over function pointers
Gedare Bloom [Thu, 6 Jul 2023 09:13:22 +0000 (02:13 -0700)]
[clang-format] Fix align consecutive declarations over function pointers

Fixes a bug that prevents alignment from proceeding through a function
pointer in a list of declarations.

Fixes #63451.

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

14 months ago[docs] Remove incorrect markup in a code block
Dmitri Gribenko [Wed, 5 Jul 2023 11:08:46 +0000 (13:08 +0200)]
[docs] Remove incorrect markup in a code block

14 months ago[clang-format] Fix RAS reference alignment when PAS is left or middle
Gedare Bloom [Thu, 6 Jul 2023 08:36:31 +0000 (01:36 -0700)]
[clang-format] Fix RAS reference alignment when PAS is left or middle

Fixes a bug with the handling of right aligned references with left/middle
alignment pointers.

Fixes #63452.

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

14 months ago[lldb] Fix crash when completing register names after program exit
David Spickett [Tue, 4 Jul 2023 08:10:59 +0000 (08:10 +0000)]
[lldb] Fix crash when completing register names after program exit

Previously the following would crash:
(lldb) run
Process 2594053 launched: '/tmp/test.o' (aarch64)
Process 2594053 exited with status = 0 (0x00000000)
(lldb) register read <tab>

As the completer assumed that the execution context would always
have a register context. After a program has finished, it does not.

Split out the generic parts of the test from the x86 specific tests,
and added "register info" to both.

Reviewed By: JDevlieghere

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

14 months ago[RISCV] Use 'long' in aes64 Zknd/Zkne builtin tests. NFC
Craig Topper [Thu, 6 Jul 2023 08:14:02 +0000 (01:14 -0700)]
[RISCV] Use 'long' in aes64 Zknd/Zkne builtin tests. NFC

This matches the data type of the intrinsics. This case be seen
from the removal of sext and trunc instructions from the IR.

Reviewed By: kito-cheng

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

14 months ago[RISCV] Add trunc instruction to the __builtin_riscv_ctz_64/__builtin_riscv_clz_64 IR.
Craig Topper [Thu, 6 Jul 2023 07:55:16 +0000 (00:55 -0700)]
[RISCV] Add trunc instruction to the __builtin_riscv_ctz_64/__builtin_riscv_clz_64 IR.

These builtins were recently changed to return 'int' like the
similar __builtin_clz/__builtin_ctz builtins, but the IR generation
was not updated to use a truncate.

14 months ago[JITLink][RISCV] Move relax to PostAllocationPasses
Job Noorman [Thu, 6 Jul 2023 07:28:13 +0000 (09:28 +0200)]
[JITLink][RISCV] Move relax to PostAllocationPasses

`JITLinkContext` is notified (using `notifyResolved`) of the final
symbol addresses after allocating memory and running the post-allocation
passes. However, linker relaxation, which can cause symbol addresses to
change, was run during the pre-fixup passes. This causes users of
JITLink (e.g., ORC) to pick-up wrong symbol addresses when linker
relaxation was enabled.

This patch fixes this by running relaxation during the post-allocation
passes.

Fixes #63671

Reviewed By: lhames

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

14 months ago[mlir][linalg] Vectorize 0-d tensor extract
Andrzej Warzynski [Wed, 5 Jul 2023 15:45:43 +0000 (16:45 +0100)]
[mlir][linalg] Vectorize 0-d tensor extract

This patch adds the missing logic to vectorise `tensor.extract` for 0-d
tensors.

Fixes #63688

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

14 months ago[RISCV] Use 'int' for return type for clz_64/clo_64 tests in riscv64-xtheadbb.c. NFC
Craig Topper [Thu, 6 Jul 2023 07:20:43 +0000 (00:20 -0700)]
[RISCV] Use 'int' for return type for clz_64/clo_64 tests in riscv64-xtheadbb.c. NFC

This matches the definition for the underlying builtins and what
is done in the Zbb test.

14 months ago[AIX] make integrated-as as default on AIX.
esmeyi [Thu, 6 Jul 2023 07:16:10 +0000 (03:16 -0400)]
[AIX] make integrated-as as default on AIX.

Summary: Clang uses LLVM's integrated assembler by default on most targets, however non-integrated-as mode is default on AIX. Currently integrated-as mode on AIX has passed tests of LLVM test-suite, bootstrap and Spec2017, therefore this patch sets integrated-as as the default assembler mode on AIX.

Reviewed By: DiggerLin

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

14 months ago[ModRef] Use enum class for IRMemLocation (NFC)
Nikita Popov [Thu, 6 Jul 2023 06:56:03 +0000 (08:56 +0200)]
[ModRef] Use enum class for IRMemLocation (NFC)

As reported at https://reviews.llvm.org/D153305#4475840.

14 months ago[AIX][clang][tests] XFail PCH/late-parsed-instantiations.cpp
Serge Pavlov [Thu, 6 Jul 2023 05:27:28 +0000 (12:27 +0700)]
[AIX][clang][tests] XFail PCH/late-parsed-instantiations.cpp

The issue: https://github.com/llvm/llvm-project/issues/63704

14 months ago[InstCombine] Transform (A > 0) | (A < 0) -> zext (A != 0) fold
XChy [Thu, 6 Jul 2023 05:44:56 +0000 (00:44 -0500)]
[InstCombine] Transform (A > 0) | (A < 0) -> zext (A != 0) fold

[InstCombine] Transform (A > 0) | (A < 0) -> zext (A != 0) fold

This extends **foldCastedBitwiseLogic** to handle the similar cases.

Actually, for `(A > B) | (A < B)`, when B != 0, it can be optimized to `zext( A != B )` by **foldAndOrOfICmpsUsingRanges**.
However, when B = 0, **transformZExtICmp** will transform `zext(A < 0) to i32` into `A << 31`,
which cannot be optimized by **foldAndOrOfICmpsUsingRanges**.

Because I'm new to LLVM and has no concise knowledge about how LLVM decides the order of optimization,
I choose to extend **foldCastedBitwiseLogic** to fold `( A << (X - 1) ) | ((A > 0) zext to iX) -> (A != 0) zext to iX`.

And the equivalent fold follows:
```
 A << (X - 1) ) | ((A > 0) zext to iX
  -> A < 0 | A > 0
  -> (A != 0) zext to iX
```

It's proved by [[https://alive2.llvm.org/ce/z/33HzjE|alive-tv]]

Related issue:
[[https://github.com/llvm/llvm-project/issues/62586  | (a > b) | (a < b) is not simplified only for the case b=0 ]]

Reviewed By: goldstein.w.n

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

14 months ago[InstCombine] Add tests for (A > 0) | (A < 0) -> zext (A != 0) fold (NFC)
XChy [Thu, 6 Jul 2023 05:44:56 +0000 (00:44 -0500)]
[InstCombine] Add tests for (A > 0) | (A < 0) -> zext (A != 0) fold (NFC)

Tests for an upcoming  (A > 0) | (A < 0) -> zext (A != 0) fold.
Related issue:
[[ https://github.com/llvm/llvm-project/issues/62586 | (a > b) | (a < b) is not simplified only for the case b=0 ]]

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

14 months ago[clang][dataflow] Bug fix: `BuiltinFnToFnPtr` cast does not produce a pointer.
Martin Braenne [Wed, 5 Jul 2023 07:46:52 +0000 (07:46 +0000)]
[clang][dataflow] Bug fix: `BuiltinFnToFnPtr` cast does not produce a pointer.

See comments in the code for details.

Reviewed By: xazax.hun

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

14 months ago[AMDGPU] Fix register class for a subreg in GCNRewritePartialRegUses.
Valery Pykhtin [Fri, 9 Jun 2023 11:40:37 +0000 (13:40 +0200)]
[AMDGPU] Fix register class for a subreg in GCNRewritePartialRegUses.

1. Improved code that deduces register class from instruction definitions. Previously if some instruction didn't contain a reg class for an operand it was considered as no information on register class even if other instructions specified the class.

2. Added check on required size of resulting register because in some cases classes with smaller registers had been selected (for example VReg_1).

Reviewed By: arsenm, #amdgpu

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

14 months ago[LibCallsShrinkWrap] Set IsFPConstrained is true for creating quiet floating comparis...
Jim Lin [Thu, 6 Jul 2023 02:15:22 +0000 (10:15 +0800)]
[LibCallsShrinkWrap] Set IsFPConstrained is true for creating quiet floating comparision if function has strictfp attribute

Create a quiet floating-point comparision if function has strictfp attribute.
Avoid unexpected FP exception raised during libcall domain error checking.
It raises an FP exception only in case where an input is a signaling NaN.

Reviewed By: efriedma

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

14 months ago[XRay][test] Remove unneeded REQUIRES: x86_64-target-arch
Fangrui Song [Thu, 6 Jul 2023 04:34:02 +0000 (21:34 -0700)]
[XRay][test] Remove unneeded REQUIRES: x86_64-target-arch

fdr-thread-order.cpp can be very slow when the thread contention is large.
Enable it for AArch64 and x86-64 for now.

fdr-mode.cpp fails on a ppc64le machine. Unsupport it on ppc64le for now.

The remaining modified tests pass on AArch64, ppc64le, and x86-64.

14 months ago[LTO] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D123803
Fangrui Song [Thu, 6 Jul 2023 04:08:30 +0000 (21:08 -0700)]
[LTO] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D123803

14 months ago[XRay][AArch64] Implement __xray_ArgLoggerEntry
Fangrui Song [Thu, 6 Jul 2023 03:56:00 +0000 (20:56 -0700)]
[XRay][AArch64] Implement __xray_ArgLoggerEntry

14 months ago[RISCV][NFC] Use common prefix to simlify test.
Jianjian GUAN [Wed, 5 Jul 2023 09:10:48 +0000 (17:10 +0800)]
[RISCV][NFC] Use common prefix to simlify test.

Reviewed By: craig.topper

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

14 months agoGetClangResourceDir: Fix downstream projects that bundle llvm source
Tom Stellard [Thu, 6 Jul 2023 03:09:58 +0000 (20:09 -0700)]
GetClangResourceDir: Fix downstream projects that bundle llvm source

A project that bundles the llvm source code may have their own
PACKAGE_VERSION variable, so only use this to compute the
CLANG_RESOURCE_DIR if CLANG_VERSION_MAJOR is undefined.

Reviewed By: sebastian-ne

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

14 months ago[profile] Enable loongarch64
zhanglimin [Thu, 6 Jul 2023 02:50:32 +0000 (10:50 +0800)]
[profile] Enable loongarch64

Mark loongarch64 as supported for profile. All tests passed.

Reviewed By: MaskRay

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

14 months ago[XRay][test] Replace some XFAIL with more appropriate REQUIRES
Fangrui Song [Thu, 6 Jul 2023 03:06:37 +0000 (20:06 -0700)]
[XRay][test] Replace some XFAIL with more appropriate REQUIRES

14 months agoAMDGPU: Remove add_dependencies calls from CMakeLists.txt
Tom Stellard [Thu, 6 Jul 2023 00:02:34 +0000 (17:02 -0700)]
AMDGPU: Remove add_dependencies calls from CMakeLists.txt

These are redundant.  The same dependencies are being added as part
of the add_llvm_component_library() call.  I confirmed this by diff'ing
the build.ninja files before and after the change and saw no change.

Reviewed By: arsenm

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