platform/upstream/llvm.git
15 months ago[compiler-rt] Fix -Wformat in timing.h (NFC)
Jie Fu [Mon, 3 Apr 2023 23:48:33 +0000 (07:48 +0800)]
[compiler-rt] Fix -Wformat in timing.h (NFC)

/home/jiefu/llvm-project/compiler-rt/lib/scudo/standalone/timing.h:181:41: error: format specifies type 'unsigned long long' but the argument has type 'u64' (aka 'unsigned long') [-Werror,-Wformat]
    Str.append("%14llu.%llu(ns) %-11s", Integral, Fraction, " ");
                ~~~~~~                  ^~~~~~~~
                %14lu
/home/jiefu/llvm-project/compiler-rt/lib/scudo/standalone/timing.h:181:51: error: format specifies type 'unsigned long long' but the argument has type 'u64' (aka 'unsigned long') [-Werror,-Wformat]
    Str.append("%14llu.%llu(ns) %-11s", Integral, Fraction, " ");
                       ~~~~                       ^~~~~~~~
                       %lu
/home/jiefu/llvm-project/compiler-rt/lib/scudo/standalone/timing.h:185:54: error: format specifies type 'unsigned long long' but the argument has type 'u64' (aka 'unsigned long') [-Werror,-Wformat]
    Str.append("%s (%llu)\n", Timers[HandleId].Name, Occurrence);
                    ~~~~                             ^~~~~~~~~~
                    %lu
3 errors generated.

15 months ago[PowerPC][NFC] Forgot to add requires asserts to ppc-TOC-stats.ll
Stefan Pintilie [Mon, 3 Apr 2023 23:45:27 +0000 (19:45 -0400)]
[PowerPC][NFC] Forgot to add requires asserts to ppc-TOC-stats.ll

When I sumbitted the original patch I forgot to add that:
GodeGen/PowerPC/ppc-TOC-stats.ll
requires asserts.
Added that now.

15 months ago[compiler-rt] Fix -Wcast-qual after D147005 (NFC)
Jie Fu [Mon, 3 Apr 2023 23:40:34 +0000 (07:40 +0800)]
[compiler-rt] Fix -Wcast-qual after D147005 (NFC)

/home/jiefu/llvm-project/compiler-rt/lib/lsan/lsan_allocator.cpp:161:18: error: cast from 'const void *' to 'void *' drops const qualifier [-Werror,-Wcast-qual]
  return (void *)beg;
                 ^
1 error generated.

15 months ago[mlir][sparse] Using SparseTensorType in SparsePackOpConverter
wren romano [Mon, 3 Apr 2023 19:55:59 +0000 (12:55 -0700)]
[mlir][sparse] Using SparseTensorType in SparsePackOpConverter

Reviewed By: aartbik

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

15 months ago[RISCV] Add cost and lowering tests for "transpose" shuffle kinds
Philip Reames [Mon, 3 Apr 2023 22:48:44 +0000 (15:48 -0700)]
[RISCV] Add cost and lowering tests for "transpose" shuffle kinds

These just hit the generic two argument shuffle lowering right now, but that's not how their costed.

15 months agoReland "[scudo] Add a Timer class to assist performance measurement"
Chia-hung Duan [Fri, 24 Mar 2023 22:54:41 +0000 (22:54 +0000)]
Reland "[scudo] Add a Timer class to assist performance measurement"

This reverts commit 2e9bcadb7c8acaa8f6ec7d807e5666246923e468.

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

15 months ago[SelectionDAG] Use MemVT for FoldingSetNodeID in SelectionDAG::getLoadVP.
Craig Topper [Mon, 3 Apr 2023 22:15:48 +0000 (15:15 -0700)]
[SelectionDAG] Use MemVT for FoldingSetNodeID in SelectionDAG::getLoadVP.

Return types and operands are put in the ID by AddNodeIDNode. I'm
pretty sure this was supposed to be the memory VT.

15 months ago[mlir][Vector] Enable masking for ops with index semantics
Diego Caballero [Mon, 3 Apr 2023 21:36:13 +0000 (21:36 +0000)]
[mlir][Vector] Enable masking for ops with index semantics

Masking was already supported for linalg.index and n-D extract but
disabled while waiting for some n-D extract vectorization patches to
land. This patch is just enabling masking for them and adding a couple
of tests.

Reviewed By: ThomasRaoux

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

15 months ago[mlir][Vector][NFC] Small vector masking clean-up
Diego Caballero [Mon, 3 Apr 2023 21:34:38 +0000 (21:34 +0000)]
[mlir][Vector][NFC] Small vector masking clean-up

We stored static (int) and dynamic (Value) iteration space dims separately
and then merged them by creating constant ops for the static ones. This
merge happened multiple times during vectorization. This PR changes that
to perform the merge once and store in the state instead of the dynamic
values in isolation.

Reviewed By: ThomasRaoux

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

15 months ago[Clang] Fix failing test on windows and add TODO for gpu headers
Joseph Huber [Mon, 3 Apr 2023 21:53:41 +0000 (16:53 -0500)]
[Clang] Fix failing test on windows and add TODO for gpu headers

Summary:
This test failed because of the path separators on Windows. Also this
was a good excuse to add an extra TODO that @tra wanted.

15 months agoAdd __sanitizer_get_allocated_begin API and implementations
Thurston Dang [Mon, 3 Apr 2023 21:14:40 +0000 (21:14 +0000)]
Add __sanitizer_get_allocated_begin API and implementations

This function will return the start of the allocation, if given a pointer that lies within an allocation. Otherwise, it returns NULL.

It will be useful for detecting dynamic TLS allocations in glibc >=2.25, which
uses malloc (see https://github.com/google/sanitizers/issues/1409#issuecomment-1214244142).

Reviewed By: vitalybuka

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

15 months ago[SelectionDAG] Move variable declaration to its first assignment. NFC
Craig Topper [Mon, 3 Apr 2023 21:02:26 +0000 (14:02 -0700)]
[SelectionDAG] Move variable declaration to its first assignment. NFC

We declared this variable and assigned it to true, but then overwrote
it before its first use.

15 months ago[SelectionDAGBuilder] Use SmallVectorImpl& for function arguments. NFC
Craig Topper [Mon, 3 Apr 2023 20:59:55 +0000 (13:59 -0700)]
[SelectionDAGBuilder] Use SmallVectorImpl& for function arguments. NFC

Make the reference const since we aren't modifying the vectors.

15 months ago[RISCV][docs] Document which revision of the specification we implement
Philip Reames [Mon, 3 Apr 2023 20:53:22 +0000 (13:53 -0700)]
[RISCV][docs] Document which revision of the specification we implement

This is intended to document the decision made in recent discussion, and ratified at the last risc-v sync up call two weeks ago.

The wording here turned out to be a bit tricky. I ended up using the word "revision" as the specification internally defines several versioning schemes, and RVI assigns particular meaning to the words "specification version" that I really didn't want to get into. If anyone has suggestions on how to improve this, please don't hesitate to chime in.

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

15 months agoUsing global variable in xnu kernel, set # of addressable bits
Jason Molenda [Mon, 3 Apr 2023 20:49:51 +0000 (13:49 -0700)]
Using global variable in xnu kernel, set # of addressable bits

The kernel has a global variable with the TCR_EL1.T1SZ value,
from which was can calculate the number of addressable bits.
Find that symbol in DynamicLoaderDarwinKernel and set the bits
to that value for this Process.

Differential Revision: https://reviews.llvm.org/D147462
rdar://107445318

15 months ago[LLDB] Ensure LLDB symbols are exported in LLDB_EXPORT_ALL_SYMBOLS is provided.
walter erquinigo [Mon, 3 Apr 2023 16:32:53 +0000 (11:32 -0500)]
[LLDB] Ensure LLDB symbols are exported in LLDB_EXPORT_ALL_SYMBOLS is provided.

If we want to export all lldb symbols (i.e LLDB_EXPORT_ALL_SYMBOLS=ON), we need to use default visibility for all LLDB libraries even if a global CMAKE_CXX_VISIBILITY_PRESET=hidden is present. In fact, there are cases in which a global llvm configuration wants CMAKE_CXX_VISIBILITY_PRESET as hidden but simultaneously LLDB_EXPORT_ALL_SYMBOLS=ON is also needed to be able to develop out-of-tree lldb plugins.

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

15 months ago[OpenMP][5.1] Fix parallel masked is ignored #59939
Rafael A. Herrera Guaitero [Mon, 3 Apr 2023 20:29:16 +0000 (20:29 +0000)]
[OpenMP][5.1] Fix parallel masked is ignored #59939

Code generation support for 'parallel masked' directive.

The `EmitOMPParallelMaskedDirective` was implemented.
In addition, the appropiate device functions were added.

Fix #59939.

Reviewed By: jdoerfert

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

15 months ago[SmallVector] Add an explicit SmallVector(size_t Size) constructor.
Craig Topper [Mon, 3 Apr 2023 20:22:36 +0000 (13:22 -0700)]
[SmallVector] Add an explicit SmallVector(size_t Size) constructor.

Previously we used the SmallVector(size_t Size, const T& Value) constructor
with a default constructed Value. That will copy construct every element
in the vector, but not all types can be copy constructed.

Reviewed By: dblaikie

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

15 months ago[lldb][NFC] Remove outdated TODO message
Alex Langford [Mon, 3 Apr 2023 20:08:52 +0000 (13:08 -0700)]
[lldb][NFC] Remove outdated TODO message

This should have been removed in a52054cfa29d

15 months agoUpdate Clang 16 statuses
Aaron Ballman [Mon, 3 Apr 2023 19:31:20 +0000 (15:31 -0400)]
Update Clang 16 statuses

Updates the C status tracking page for the recent release.

15 months ago[C2x] Implement support for empty brace initialization (WG14 N2900 and WG14 N3011)
Aaron Ballman [Mon, 3 Apr 2023 19:19:15 +0000 (15:19 -0400)]
[C2x] Implement support for empty brace initialization (WG14 N2900 and WG14 N3011)

This implements support for allowing {} to consistently zero initialize
objects. We already supported most of this work as a GNU extension, but
the C2x feature goes beyond what the GNU extension allowed.

The changes in this patch are:

* Removed the -Wgnu-empty-initializer warning group. The extension is
  now a C2x extension warning instead. Note that use of
  `-Wno-gnu-empty-initializer seems` to be quite low in the wild
(https://sourcegraph.com/search?q=context%3Aglobal+-file%3A.*test.*+%22-Wno-gnu-empty-initializer%22&patternType=standard&sm=1&groupBy=repo
  which currently only gives 8 hits total), so this is not expected to
  be an overly disruptive change. But I'm adding the clang vendors
  review group just in case this expectation is wrong.
* Reworded the diagnostic wording to be about a C2x extension, added a
  pre-C2x compat warning.
* Allow {} to zero initialize a VLA

This functionality is exposed as an extension in all older C modes
(same as the GNU extension was), but does *not* allow the extension for
VLA initialization in C++ due to concern about handling non-trivially
constructible types.

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

15 months ago[mlir] Improve FieldParser list container detection
rkayaith [Tue, 28 Mar 2023 23:00:40 +0000 (19:00 -0400)]
[mlir] Improve FieldParser list container detection

The current detection logic will fail for containers with an overloaded
`push_back` member. This causes issues with types like `std::vector` and
`SmallVector<SomeNonTriviallyCopyableT>`, which have both
`push_back(const T&)` and `push_back(T&&)`.

Reviewed By: rriddle

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

15 months ago[RuntimeDyld] RuntimeDyldELF: Clear GOTOffsetMap when resetting GOT section.
Graham Markall [Mon, 3 Apr 2023 18:15:36 +0000 (11:15 -0700)]
[RuntimeDyld] RuntimeDyldELF: Clear GOTOffsetMap when resetting GOT section.

When the GOT section ID is reset, the GOTOffsetMap must also be cleared,
otherwise spurious matches can be located when handling GOT relocations
in subsequently-linked objects.

Fixes Issue #61402 - see https://github.com/llvm/llvm-project/issues/61402.

Reviewed By: lhames

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

15 months ago[PowerPC] Add statistics to show the number of entries in the TOC.
Stefan Pintilie [Fri, 31 Mar 2023 18:42:58 +0000 (14:42 -0400)]
[PowerPC] Add statistics to show the number of entries in the TOC.

On Power PC some data is stored in the TOC. This pass adds statistics
to show how many entries are emitted to the TOC and what types of
entries those are.

Reviewed By: amyk

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

15 months ago[JITLink][ELF] Only make sections with SHF_WRITE writable
Job Noorman [Mon, 3 Apr 2023 18:18:19 +0000 (20:18 +0200)]
[JITLink][ELF] Only make sections with SHF_WRITE writable

All non-executable sections used to be mapped as RW- causing read-only
sections such as .rodata to be writable.

Reviewed By: lhames

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

15 months ago[libc] Add strchrnul implementation
Caslyn Tonelli [Mon, 3 Apr 2023 18:04:48 +0000 (11:04 -0700)]
[libc] Add strchrnul implementation

Introduce strchrnul implementation and unit tests.

Submitting on behalf of Caslyn@

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

15 months agoRevert "[mlir] Introduce IRDL dialect"
Mehdi Amini [Mon, 3 Apr 2023 18:05:37 +0000 (11:05 -0700)]
Revert "[mlir] Introduce IRDL dialect"

This reverts commit 31229d48bbfd394b64179d9be94f74ab70c84630.

The build is broken with shared library mode.

15 months ago[LV] Remmove unused default argument to isLegalGatherOrScatter [nfc]
Philip Reames [Mon, 3 Apr 2023 18:03:14 +0000 (11:03 -0700)]
[LV] Remmove unused default argument to isLegalGatherOrScatter [nfc]

15 months ago[Clang] Implicitly include LLVM libc headers for the GPU
Joseph Huber [Mon, 27 Mar 2023 15:01:12 +0000 (10:01 -0500)]
[Clang] Implicitly include LLVM libc headers for the GPU

There is currently work to support basic `libc` functionality on the
GPU. Some basic information about the projects can be found at
https://libc.llvm.org/gpu_mode.html. Typically, including the system
headers on the GPU will result in an error. For this reason the LLVM
`libc` project will generate its own headers that can be used with the
GPU.

The problem is that these headers will use the same name as the system headers.
For that reason, D146970 places it in the `llvm-libc` subfolder. In order to
still pick these files up, this patch adds changes in clang to default to
searching this directory when targeting the GPU. This lets offloading languages
such as OpenMP use the system `string.h` when compiling for the host and then
the LLVM libc `string.h` when targeting the GPU.

Depends on D146970

Reviewed By: tra

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

15 months ago[mlir][MemRef] Add pattern to resolve strided metadata of `memref.get_global` operation.
Mahesh Ravishankar [Mon, 3 Apr 2023 17:31:36 +0000 (17:31 +0000)]
[mlir][MemRef] Add pattern to resolve strided metadata of `memref.get_global` operation.

This changes adds patterns to resolve the base pointer, offset, sizes
and strides of the result of a `memref.get_global` operation. Since
the operation can only result in static shaped memrefs, current
resolution kicks in only for non-zero offsets, and identity strides.

Also

- Add a separate `populateResolveExtractStridedMetadata` method that
  adds just the pattern to resolve `<memref op>` ->
  `memref.extract_strided_metadata` operations.
- Refactor the `SubviewFolder` pattern to allow resolving
  `memref.subview` -> `memref.extract_strided_metadata`.

This allows using these patterns for cases where there are already
existing `memref.extract_strided_metadata` operations.

Reviewed By: qcolombet

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

15 months ago[mlir] Introduce IRDL dialect
Mathieu Fehr [Mon, 3 Apr 2023 16:42:53 +0000 (09:42 -0700)]
[mlir] Introduce IRDL dialect

This patch introduces the IRDL dialect, which allow users to represent
dynamic dialect definitions as an MLIR program.

The IRDL dialect defines operations, attributes, and types, using
attribute constraints. For example:

```
module {
  irdl.dialect @cmath {
    irdl.type @complex {
      %0 = irdl.is f32
      %1 = irdl.is f64
      %2 = irdl.any_of(%0, %1)
      irdl.parameters(%2)
    }

    irdl.operation @norm {
      %0 = irdl.any
      %1 = irdl.parametric @complex<%0>
      irdl.operands(%1)
      irdl.results(%0)
    }
}
```

This program will define a new `cmath.complex` type, which expects a single
parameter, which is either an `f32` or an `f64`. It also defines an
`cmath.norm` operation, which expects a single `cmath.complex` type as operand,
and returns a value of the underlying type. Note that like PDL (which IRDL is
heavily inspired from), both uses of `%0` are expected to be of the same attribute.

IRDL handles attributes and types with the same operations, and does this by always
wrapping types in a `TypeAttr`. This is to simplify the language.

Depends on D144690

Reviewed By: rriddle, mehdi_amini

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

15 months ago[clang-tidy] ignore NRVO const variables in performance-no-automatic-move.
Logan Gnanapragasam [Mon, 3 Apr 2023 16:37:56 +0000 (16:37 +0000)]
[clang-tidy] ignore NRVO const variables in performance-no-automatic-move.

In the following code:

```cc
struct Obj {
  Obj();
  Obj(const Obj &);
  Obj(Obj &&);
  virtual ~Obj();
};

Obj ConstNrvo() {
  const Obj obj;
  return obj;
}
```

performance-no-automatic-move warns about the constness of `obj`. However, NRVO
is applied to `obj`, so the `const` should have no effect on performance.

This change modifies the matcher to exclude NRVO variables.

#clang-tidy

Reviewed By: courbet, PiotrZSL

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

15 months agoRevert "[X86] Simplify some `pternlog` intrinsics"
Noah Goldstein [Mon, 3 Apr 2023 16:59:32 +0000 (11:59 -0500)]
Revert "[X86] Simplify some `pternlog` intrinsics"

This reverts commit cacc0033b12b2e6400eedd6e449644e87ec3099b.

15 months ago[libc] Free the GPU memory allocated in the device loaders
Joseph Huber [Mon, 3 Apr 2023 16:54:48 +0000 (11:54 -0500)]
[libc] Free the GPU memory allocated in the device loaders

Summary:
This part was ignored and we just hoped that shutting down the runtime
freed these correctly. But it's best to be specific and free the memory
we've allocated.

15 months ago[X86] combineMOVMSK - merge movmsk(icmp_eq(and(x,c1),c1)) and movmsk(icmp_eq(and...
Simon Pilgrim [Mon, 3 Apr 2023 16:17:52 +0000 (17:17 +0100)]
[X86] combineMOVMSK - merge movmsk(icmp_eq(and(x,c1),c1)) and movmsk(icmp_eq(and(x,c1),0)) folds

Use the same value tracking implementation for both, removing hardcoded PCMPEQ(AND(X,C),C) pattern so to handle bitcasted logic/constants.

15 months agoFix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Mon, 3 Apr 2023 16:12:11 +0000 (17:12 +0100)]
Fix MSVC "not all control paths return a value" warning. NFC.

15 months ago[flang] Don't allow CALL RANDOM_NUMBER(assumed-size-array)
Peter Klausler [Thu, 30 Mar 2023 20:34:32 +0000 (13:34 -0700)]
[flang] Don't allow CALL RANDOM_NUMBER(assumed-size-array)

The extents, if any, of the HARVEST= actual argument must be known
at execution time for the call to be implemented.

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

15 months ago[X86] Simplify some `pternlog` intrinsics
Noah Goldstein [Mon, 3 Apr 2023 04:40:38 +0000 (23:40 -0500)]
[X86] Simplify some `pternlog` intrinsics

Currently `pternlog` intrinsics stay as a function call and are unable
to merge with other bin-ops / constant-fold.

This commit adds support for reducing all `pternlog` intrinsics to
their base logic-ops so that they can be further reduced in other
passes.

Since the x86 backend doesn't do a great job creating `vpternlog`
instructions from stray logic ops, the current logic only simplifies
in the cases were we obviously will be able to do as good or
better. As the x86 backend improves, more cases can be simplified.

Reviewed By: pengfei

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

15 months ago[X86] Add tests for simplifying pternlog intrinsics; NFC
Noah Goldstein [Fri, 3 Mar 2023 04:12:35 +0000 (22:12 -0600)]
[X86] Add tests for simplifying pternlog intrinsics; NFC

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

15 months ago[InstSimplify] Extend simplifications for `(icmp ({z|s}ext X), C)` where `C` is vector
Noah Goldstein [Mon, 3 Apr 2023 04:40:08 +0000 (23:40 -0500)]
[InstSimplify] Extend simplifications for `(icmp ({z|s}ext X), C)` where `C` is vector

Previous logic only applied for `ConstantInt` which misses all vector
cases. New code works for splat/non-splat vectors as well. No change
to the underlying simplifications.

Reviewed By: nikic

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

15 months ago[InstSimplify] Add tests for simplifying `(icmp ({z|s}ext X), C)` where `C` is vector...
Noah Goldstein [Thu, 30 Mar 2023 21:16:46 +0000 (16:16 -0500)]
[InstSimplify] Add tests for simplifying `(icmp ({z|s}ext X), C)` where `C` is vector; NFC

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

15 months ago[flang] NORM2(DIM=) argument can't be dynamically optional
Peter Klausler [Thu, 30 Mar 2023 19:43:47 +0000 (12:43 -0700)]
[flang] NORM2(DIM=) argument can't be dynamically optional

The intrinsic function table entry for NORM2 treats its DIM=
argument as if it can be dynamically optional; this is wrong,
and it should be treated in the same way as DIM= is for other
transformational intrinsic functions like SUM.

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

15 months ago[flang] Resolve USE vs IMPORT conflicts
Peter Klausler [Wed, 29 Mar 2023 15:56:31 +0000 (08:56 -0700)]
[flang] Resolve USE vs IMPORT conflicts

When the same name is pulled into a scope more than once via
USE and IMPORT, emit an error if its resolutions are ambiguous,
or (as an extension like some other compilers) emit a portability
warning when the names all resolve to the same symbol.

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

15 months ago[amdgpu][nfc] Refactor prior to D144233 to remove noise from diff
Jon Chesterfield [Mon, 3 Apr 2023 12:44:11 +0000 (13:44 +0100)]
[amdgpu][nfc] Refactor prior to D144233 to remove noise from diff

15 months ago[llvm][TextAPI] Ignore deployment version in target comparator
Cyndy Ishida [Mon, 3 Apr 2023 14:29:25 +0000 (07:29 -0700)]
[llvm][TextAPI] Ignore deployment version in target comparator

15 months ago[clang][Interp] Add missing static_assert message
Timm Bäder [Mon, 3 Apr 2023 15:11:31 +0000 (17:11 +0200)]
[clang][Interp] Add missing static_assert message

This broke builders, e.g:
https://lab.llvm.org/buildbot/#builders/139/builds/38457

15 months ago[libc] Improve copying system vectors to the GPU
Joseph Huber [Mon, 3 Apr 2023 15:08:32 +0000 (10:08 -0500)]
[libc] Improve copying system vectors to the GPU

Summary:
This implementation was buggy and inefficient. Fine-grained memory can
only be allocated on a page-level granularity. Which means that each
allocated string used about 4096 bytes. This is wasteful in general, and
also allowed for buggy behaviour. The previous copying of the
environment vector only worked because the large buffer size meant that
we would typically have a null byte after the allocated memory. However
this would break if the vector was larger than a page. This patch
allocates everything into a single buffer. It makes it easier to free,
use, and it more correct.

15 months ago[clang][Interp] Ignore StaticAssertDecls
Timm Bäder [Fri, 17 Feb 2023 15:56:47 +0000 (16:56 +0100)]
[clang][Interp] Ignore StaticAssertDecls

They have already been handled before, but we can't just return false
when we encounter one.

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

15 months ago[SLP]Reorder counters for same values, if the root node is reordered.
Alexey Bataev [Mon, 3 Apr 2023 13:50:07 +0000 (06:50 -0700)]
[SLP]Reorder counters for same values, if the root node is reordered.

The counters for the repeated scalars are ordered in the natural order,
but the original scalars might be reordered during SLP graph reordering
and this order can be dropped. Need to use the scalars after the
reordering, not the original ones, to emit correct code for same value
counters.

15 months ago[clang][Interp][NFC] Refactor VisitDeclRefExpr
Timm Bäder [Sun, 5 Feb 2023 07:39:40 +0000 (08:39 +0100)]
[clang][Interp][NFC] Refactor VisitDeclRefExpr

Make it clearer that we only need to check for variables and parameters
if we don't have the easy case. Also only do the IsReference check if
necessary.

15 months ago[Clang] Update test checks (NFC)
Nikita Popov [Mon, 3 Apr 2023 14:32:59 +0000 (16:32 +0200)]
[Clang] Update test checks (NFC)

These were affected by 9b5ff4436e446e9df97ee37b3bcf9ba029c7d9aa.

15 months ago[include-cleaner] Treat member operator calls as implicit
Kadir Cetinkaya [Mon, 3 Apr 2023 14:26:06 +0000 (16:26 +0200)]
[include-cleaner] Treat member operator calls as implicit

26ff268b80c589fd9f71c1c214af77cd972642ca treated member operator calls
as explicit, while trying to treat them the same way as regular member
expressions, which should've been implicit.

15 months ago[SLP][NFC]Add a test for reordered scalars with not reordered reuse coefficient.
Alexey Bataev [Mon, 3 Apr 2023 14:15:14 +0000 (07:15 -0700)]
[SLP][NFC]Add a test for reordered scalars with not reordered reuse coefficient.

15 months ago[X86] combineMOVMSK - fold movmsk(icmp_eq(and(x,c1),c1)) -> movmsk(shl(x,c2)) iff...
Simon Pilgrim [Mon, 3 Apr 2023 14:07:11 +0000 (15:07 +0100)]
[X86] combineMOVMSK - fold movmsk(icmp_eq(and(x,c1),c1)) -> movmsk(shl(x,c2)) iff pow2splat(c1)

We already have a similar fold for movmsk(icmp_eq(and(x,c1),0)) which we can probably merge this with, but it will involve generalizing a lot of the knownbits code

15 months ago[X86] MatchVectorAllZeroTest - handle icmp_eq(bitcast(vXi1 trunc(Y)),0) style reducti...
Simon Pilgrim [Mon, 3 Apr 2023 13:30:32 +0000 (14:30 +0100)]
[X86] MatchVectorAllZeroTest - handle icmp_eq(bitcast(vXi1 trunc(Y)),0) style reduction patterns

If we've truncated from a wider vector, then perform the all vector comparison on that with a suitable mask

There's a minor pre-SSE41 regression due to a missing movmsk(icmp_eq(and(x,c1pow2),c1pow2)) -> movmsk(shl(x,c2)) fold that will be addressed in a followup commit

15 months ago[EarlyCSE] Call combineMetadataForCSE() when CSEing loads
Nikita Popov [Mon, 3 Apr 2023 13:51:10 +0000 (15:51 +0200)]
[EarlyCSE] Call combineMetadataForCSE() when CSEing loads

We may have to adjust metadata on the replacement load if the
metadata is poison-generating.

15 months ago[Local] Preserve !invariant.load of dominating instruction
Nikita Popov [Mon, 3 Apr 2023 14:03:11 +0000 (16:03 +0200)]
[Local] Preserve !invariant.load of dominating instruction

Per LangRef:

> If a load instruction tagged with the !invariant.load metadata
> is executed, the memory location referenced by the load has to
> contain the same value at all points in the program where the
> memory location is dereferenceable; otherwise, the behavior is
> undefined.

As invariant.load violation is immediate undefined behavior, it
is sufficient for it to be present on the dominating load (for
the case where K does not move).

15 months ago[GVN] Regenerate test checks (NFC)
Nikita Popov [Mon, 3 Apr 2023 13:58:12 +0000 (15:58 +0200)]
[GVN] Regenerate test checks (NFC)

And add an additional metadata preservation test.

15 months ago[flang] Use definability tests for better PURE constraint checking
Peter Klausler [Thu, 30 Mar 2023 17:26:16 +0000 (10:26 -0700)]
[flang] Use definability tests for better PURE constraint checking

Many semantic checks for constraints related to PURE subprograms
can be implemented in terms of Semantics' "definable.h" utilities,
slightly expanded.  Replace some particular PURE constraint
checks with calls to WhyNotDefinable(), except for cases that
had better specific error messages, and start checking some
missing constraints with DEALLOCATE statements and local
variable declarations.

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

15 months ago[clang][Interp] Fix initializing fields after base class members
Timm Bäder [Sun, 12 Mar 2023 06:43:53 +0000 (07:43 +0100)]
[clang][Interp] Fix initializing fields after base class members

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

15 months ago[EarlyCSE] Regenerate test checks (NFC)
Nikita Popov [Mon, 3 Apr 2023 13:51:56 +0000 (15:51 +0200)]
[EarlyCSE] Regenerate test checks (NFC)

15 months ago[EarlyCSE] Add metadata preservation tests (NFC)
Nikita Popov [Mon, 3 Apr 2023 13:40:56 +0000 (15:40 +0200)]
[EarlyCSE] Add metadata preservation tests (NFC)

15 months ago[include-cleaner] Report references to operator calls as implicit
Kadir Cetinkaya [Wed, 29 Mar 2023 12:04:45 +0000 (14:04 +0200)]
[include-cleaner] Report references to operator calls as implicit

Missing these references can result in false negatives in the used-ness
analysis and break builds.

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

15 months agoRevert "Move "auto-init" instructions to the dominator of their users"
serge-sans-paille [Mon, 3 Apr 2023 13:45:55 +0000 (15:45 +0200)]
Revert "Move "auto-init" instructions to the dominator of their users"

This reverts commit cca01008cc31a891d0ec70aff2201b25d05d8f1b.

This change breaks memory ssa checks, see https://lab.llvm.org/buildbot#builders/109/builds/60970

15 months ago[clang][Interp] Fix diagnostics for calling non-constexpr constructors
Timm Bäder [Sat, 11 Mar 2023 08:55:22 +0000 (09:55 +0100)]
[clang][Interp] Fix diagnostics for calling non-constexpr constructors

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

15 months ago[Orc] Add AutoRegisterCode option for DebugObjectManagerPlugin
Stefan Gränitz [Mon, 3 Apr 2023 09:41:37 +0000 (11:41 +0200)]
[Orc] Add AutoRegisterCode option for DebugObjectManagerPlugin

Configure the plugin to automatically call the debugger rendezvous breakpoint `__jit_debug_register_code()` for every translation unit (enabled) or never at all (disabled). Default API and behavior remain unchanged.

If AutoRegisterCode is turned off, it's the client's own responsibility to call the rendezvous breakpoint function at an appropriate time.
Depending on the complexity of the debugger's rendezvous breakpoint implementation, this can provide significant performance improvements in cases where many debug objects are added in sequence.

Reviewed By: lhames

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

15 months ago[Local] Use combineMetadataForCSE() in patchReplacementInstruction()
Nikita Popov [Mon, 3 Apr 2023 13:30:21 +0000 (15:30 +0200)]
[Local] Use combineMetadataForCSE() in patchReplacementInstruction()

patchReplacementInstruction() is used for CSE-style transforms.
Avoid the need to maintain two separate lists of known metadata IDs,
which can and do go out of sync.

15 months ago[Local] Add MD_fpmath to combineMetadataForCSE()
Nikita Popov [Mon, 3 Apr 2023 13:26:51 +0000 (15:26 +0200)]
[Local] Add MD_fpmath to combineMetadataForCSE()

This was present in patchReplacementInstruction() but not
combineMetadataForCSE(). combineMetadata() already knows how to
merge these properly.

15 months agoMove "auto-init" instructions to the dominator of their users
serge-sans-paille [Wed, 2 Nov 2022 07:52:29 +0000 (08:52 +0100)]
Move "auto-init" instructions to the dominator of their users

As a result of -ftrivial-auto-var-init, clang generates instructions to
set alloca'd memory to a given pattern, right after the allocation site.
In some cases, this (somehow costly) operation could be delayed, leading
to conditional execution in some cases.

This is not an uncommon situation: it happens ~500 times on the cPython
code base, and much more on the LLVM codebase. The benefit greatly
varies on the execution path, but it should not regress on performance.

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

15 months ago[ConstraintElimination] Add function arguments to constraint system before solving
Zain Jaffal [Mon, 3 Apr 2023 13:16:46 +0000 (14:16 +0100)]
[ConstraintElimination] Add function arguments to constraint system before solving

If there is an optimisation opportunity and the function argument hasn’t been added to constraint
system through previous facts we fail to optimise it.

It might be a good idea to start the constraint system with all the function arguments added to the system

Reviewed By: fhahn

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

15 months ago[NFC][LoopVectorize] Add zext/sext cost tests when there is type shrinkage
David Sherwood [Wed, 29 Mar 2023 10:57:40 +0000 (10:57 +0000)]
[NFC][LoopVectorize] Add zext/sext cost tests when there is type shrinkage

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

15 months ago[re-reland][libc] Adds string and TestLogger classes, use them in LibcTest
Guillaume Chatelet [Mon, 3 Apr 2023 13:09:39 +0000 (13:09 +0000)]
[re-reland][libc] Adds string and TestLogger classes, use them in LibcTest

This is an implementation of https://discourse.llvm.org/t/rfc-running-libc-unit-tests-as-integration-tests/69461.

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

15 months ago[clang-format] Don't allow variable decls to have trailing return arrows
Emilia Dreamer [Mon, 3 Apr 2023 12:54:17 +0000 (15:54 +0300)]
[clang-format] Don't allow variable decls to have trailing return arrows

The heuristic for determining if an arrow is a trailing return arrow
looks for the auto keyword, along with parentheses. This isn't
sufficient, since it also triggers on variable declarations with an auto
type, and with an arrow operator.

This patch makes sure a function declaration is being parsed, instead of
any other declaration.

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

15 months ago[LICM] Don't promote store to global even in single-thread mode
Nikita Popov [Thu, 16 Mar 2023 15:59:19 +0000 (16:59 +0100)]
[LICM] Don't promote store to global even in single-thread mode

Even if there are no thread-safety concerns, we should not promote
(not guaranteed-to-execute) stores to globals without further
analysis: While the global may be writable, we may not have
provenance to perform the write. The @promote_global_noalias test
case illustrates a miscompile in the presence of a noalias pointer
to the global.

Worth noting that the load-only promotion may also not be well-defined
depending on precise semantics (we don't specify whether load
violating noalias is poison or UB -- though I believe the general
inclination is to make it poison, and only stores UB), but that's
a more general issue.

This is inspired by https://github.com/llvm/llvm-project/issues/60860,
which is a related issue with TBAA metadata.

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

15 months ago[X86] Test coverage for icmp_eq(bitcast(vXi1 trunc(Y)),0) style reduction patterns
Simon Pilgrim [Mon, 3 Apr 2023 11:37:53 +0000 (12:37 +0100)]
[X86] Test coverage for icmp_eq(bitcast(vXi1 trunc(Y)),0) style reduction patterns

Add SSE41 test coverage as well

15 months ago[Pass Builder] Allow Module Inliner for full LTO
ibricchi [Mon, 3 Apr 2023 12:13:46 +0000 (14:13 +0200)]
[Pass Builder] Allow Module Inliner for full LTO

Currently there is no way to enable the module inliner when
linking with full lto. This patch enables that option.

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

15 months ago[clang][Interp] Fix initializing base class members
Timm Bäder [Tue, 7 Feb 2023 07:20:59 +0000 (08:20 +0100)]
[clang][Interp] Fix initializing base class members

For the given test case, we were trying to initialize a member of C,
which doesn't have any. Get the proper base pointer instead and
initialize the members there.

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

15 months ago[Matrix] Fix shapes in dot product tests.
Florian Hahn [Mon, 3 Apr 2023 11:50:01 +0000 (12:50 +0100)]
[Matrix] Fix shapes in dot product tests.

The shape arguments for the @llvm.matrix.column.major.load where
incorrect. Flip them so they are in sync with the shape of the
multiplications.

15 months ago[bazel][libc] Add a missing string_view dependency
Dmitri Gribenko [Mon, 3 Apr 2023 11:04:17 +0000 (13:04 +0200)]
[bazel][libc] Add a missing string_view dependency

The dependency was introduced in
https://github.com/llvm/llvm-project/commit/9a99afb455601aaa3a28d307c7bbcfdaad3fa4fc

15 months ago[bazel] Run an autoformatter on libc/BUILD.bazel
Dmitri Gribenko [Mon, 3 Apr 2023 11:03:14 +0000 (13:03 +0200)]
[bazel] Run an autoformatter on libc/BUILD.bazel

15 months ago[clang-tidy] support unscoped enumerations in readability-static-accessed-through...
Congcong Cai [Mon, 3 Apr 2023 10:41:29 +0000 (12:41 +0200)]
[clang-tidy] support unscoped enumerations in readability-static-accessed-through-instance

fixed [60810](https://github.com/llvm/llvm-project/issues/60810)
unscoped enumerations in class can also be checked by `readability-static-accessed-through-instance`
add matcher for `enumConstantDecl` to match format
```
struct {
    enum { E1 };
};
```
The filter of member expression and the fix hint should be same as other condition.

Reviewed By: PiotrZSL

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

15 months ago[mlir][spirv-cpu-runner] Add missing call to registerPassManagerCLOptions().
Adrian Kuegel [Mon, 3 Apr 2023 10:52:49 +0000 (12:52 +0200)]
[mlir][spirv-cpu-runner] Add missing call to registerPassManagerCLOptions().

Also fix tests, they were not calling FileCheck.

15 months ago[GuardWidening] Fix the crash while replacing the users of poison.
Serguei Katkov [Mon, 3 Apr 2023 09:29:39 +0000 (16:29 +0700)]
[GuardWidening] Fix the crash while replacing the users of poison.

When we replace poison with freeze poison it might appear
that user of poison is a constant (for example vector constant).

In this case we will get that constant will get non-constant operand.

Moreover replacing poison and GlobalValue everywhere in module seems
to be overkill. So the solution will be just make a replacement
only in instructions we visited (contributing to hoisted condition).
Moreover if user of posion is constant, this constant also should need
a freeze and it does not make sense to replace poison with frozen version,
just freeze another constant.

Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D147429

15 months agoRevert "Reland "[compiler-rt] Drop -Werror in compiler flag checks""
Nikita Popov [Mon, 3 Apr 2023 10:06:01 +0000 (12:06 +0200)]
Revert "Reland "[compiler-rt] Drop -Werror in compiler flag checks""

This reverts commit cc90ca6f0fb8e29c8a12d15c93abb9e3839a23ca.

This still breaks the GCC build in the same way as the previous
version.

15 months ago[LICM] Extract helper for getClobberingMemoryAccess()
Nikita Popov [Mon, 3 Apr 2023 10:01:53 +0000 (12:01 +0200)]
[LICM] Extract helper for getClobberingMemoryAccess()

Extract a helper that does the clobber walk while taking into
account the cap. Slightly reflow things to check this first in
the store case, before we start walking over all accesses in the
loop.

15 months ago[AArch64] Remove redundant `mov 0` instruction for high 64-bits
Jingu Kang [Mon, 3 Apr 2023 08:25:09 +0000 (09:25 +0100)]
[AArch64] Remove redundant `mov 0` instruction for high 64-bits

If MI sets zero for high 64-bits implicitly, remove `mov 0` for high 64-bits.
For example,

 %1:fpr64 = nofpexcept FCVTNv4i16 %0:fpr128, implicit $fpcr
 %2:fpr64 = MOVID 0
 %4:fpr128 = IMPLICIT_DEF
 %3:fpr128 = INSERT_SUBREG %4:fpr128(tied-def 0), killed %2:fpr64, %subreg.dsub
 %6:fpr128 = IMPLICIT_DEF
 %5:fpr128 = INSERT_SUBREG %6:fpr128(tied-def 0), killed %1:fpr64, %subreg.dsub
 %7:fpr128 = INSvi64lane %5:fpr128(tied-def 0), 1, killed %3:fpr128, 0
 ==>
 %1:fpr64 = nofpexcept FCVTNv4i16 %0:fpr128, implicit $fpcr
 %6:fpr128 = IMPLICIT_DEF
 %7:fpr128 = INSERT_SUBREG %6:fpr128(tied-def 0), killed %1:fpr64, %subreg.dsub

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

15 months ago[Orc] Print section load-addresses for debug objects as hex again
Stefan Gränitz [Fri, 31 Mar 2023 12:27:55 +0000 (14:27 +0200)]
[Orc] Print section load-addresses for debug objects as hex again

Apparently, the refactor in 8b1771bd9f304be39d4dcbdcccedb6d3bcd18200 broke the logic behind formatv here:
```
  140736272011264 .rodata
  140736272015360 .text
  140736272011424 .eh_frame
```

15 months ago[clang][Interp] Fix derived-to-base casts for >1 levels
Timm Bäder [Tue, 7 Feb 2023 09:56:53 +0000 (10:56 +0100)]
[clang][Interp] Fix derived-to-base casts for >1 levels

The GetPtrBasePop op we were using only works for direct base classes.

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

15 months ago[MLIR][LLVM] Put byval static allocas in the entry block.
Johannes de Fine Licht [Mon, 3 Apr 2023 09:07:55 +0000 (09:07 +0000)]
[MLIR][LLVM] Put byval static allocas in the entry block.

Reviewed By: gysit

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

15 months agoReland "[compiler-rt] Drop -Werror in compiler flag checks"
Sergei Barannikov [Sat, 1 Apr 2023 15:40:47 +0000 (18:40 +0300)]
Reland "[compiler-rt] Drop -Werror in compiler flag checks"

-Werror is redundant because CMake not only checks the
exit status, but also parses the output of try_compile.
-Wformat-security is a special case, because specifying it
without -Wformat causes gcc to emit a warning in a format
not recognized by CMake, which makes the check pass.

15 months ago[DAGCombiner] Fold avg(x, x) --> x
Jun Zhang [Mon, 3 Apr 2023 08:22:38 +0000 (16:22 +0800)]
[DAGCombiner] Fold avg(x, x) --> x

Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D147404

15 months agoAdd baseline tests for D147404
Jun Zhang [Sun, 2 Apr 2023 09:34:20 +0000 (17:34 +0800)]
Add baseline tests for D147404

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

Signed-off-by: Jun Zhang <jun@junz.org>
15 months ago[mlir][llvm] Drop `ResumeOp::verify()` function
Victor Perez [Fri, 31 Mar 2023 17:01:06 +0000 (18:01 +0100)]
[mlir][llvm] Drop `ResumeOp::verify()` function

In patch https://reviews.llvm.org/rG478bd0735fc094d3af37e9791df5118a402ae7a7,
this function was changed so that it always returns `success()`. Drop this
and explicitly state it won't be generated in the `.td` file and explain
`llvm.resume` restrictions will be checked in `LLVMFuncOp::verify()`.

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

15 months ago[clang][dataflow][NFC] Share code between Environment ctor and pushCallInternal().
Martin Braenne [Mon, 3 Apr 2023 07:02:48 +0000 (07:02 +0000)]
[clang][dataflow][NFC] Share code between Environment ctor and pushCallInternal().

The deduplicated code is moved into initVars().

As an added bonus, pushCallInternal() now also gets the "Add all fields
mentioned in default member initializers" behavior, which apparently had been
added to the Environment ctor but not pushCallInternal().

Reviewed By: xazax.hun, ymandel

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

15 months agoRevert "[compiler-rt] Quote multiple warning flags in check_cxx_compiler_flag invocation"
Nikita Popov [Mon, 3 Apr 2023 08:17:38 +0000 (10:17 +0200)]
Revert "[compiler-rt] Quote multiple warning flags in check_cxx_compiler_flag invocation"

This reverts commit 88c744e7dfaa9ce67dc2b30dea7713e054399d17.

This breaks the GCC build and is already discussed on the revision.

15 months agoRevert D147231 "[reland][libc] Adds string and TestLogger classes, use them in LibcTest"
Guillaume Chatelet [Mon, 3 Apr 2023 07:47:15 +0000 (07:47 +0000)]
Revert D147231 "[reland][libc] Adds string and TestLogger classes, use them in LibcTest"

Build bot detected a memory leak.
This reverts commit b82d04ea4b4f26037be369f101ae7011975df486.

15 months ago[reland][libc] Adds string and TestLogger classes, use them in LibcTest
Guillaume Chatelet [Mon, 3 Apr 2023 07:34:35 +0000 (07:34 +0000)]
[reland][libc] Adds string and TestLogger classes, use them in LibcTest

This is an implementation of https://discourse.llvm.org/t/rfc-running-libc-unit-tests-as-integration-tests/69461.

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

15 months ago[JITLink][NFC] Make Block const in alignToBlock
Job Noorman [Mon, 3 Apr 2023 07:30:32 +0000 (09:30 +0200)]
[JITLink][NFC] Make Block const in alignToBlock

Block is not mutated so can be made const.

Reviewed By: lhames

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

15 months ago[flang] Add TODO for creation of polymorphic temporary
Jean Perier [Mon, 3 Apr 2023 07:21:01 +0000 (09:21 +0200)]
[flang] Add TODO for creation of polymorphic temporary

The current code is wrong: it is doing an alloca with the declared
type instead of the dynamic type, leading to undefined behavior
when the dynamic type and declared type differ and the temporary
is later used.
This also introduces some `fir.alloca none` for unlimited polymorphic that
are not allocating the right thing at all.

Add TODOs for now, the correct thing to do will probably be to use the
runtime (like AssignTemporary), but since this happens in code doing
"mold" temp allocation, I first need to check if there is a need for "mold"
temporary creation not followed by an assign, or if this can be combined
with the assign instead (for HLFIR, it is pretty easy combine this from as_expr
codegen, not sure for the current lowering).

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

15 months ago[flang] preserve pointer rank in polymorphic_pointer => NULL()
Jean Perier [Mon, 3 Apr 2023 07:18:41 +0000 (09:18 +0200)]
[flang] preserve pointer rank in polymorphic_pointer => NULL()

The current lowering for polymorphic pointer association was not
dealing with NULL in a "context aware" fashion: it was calling the
`PointerAssociate` runtime entry point with a fir.box<none> target.
But the fir.box<none> is a descriptor for a scalar, this lead the
runtime to set the pointer rank to zero, regardless of its actual
rank.

I do not think there is a way to expose this problem with the Fortran
code currently supported by flang, because most further manipulation of
the pointer would either set the rank correctly, or do not rely on the
rank in the runtime descriptor.

However, this is incorrect, and when assumed rank are supported, the
following would have failed:

```
subroutine check_rank(p)
  class(*), pointer :: p(..)
  p => null()
  select rank(p)
  rank (1)
   print *, "OK"
  rank default
   print *, "FAILED"
  end select
end subroutine
  class(*), pointer :: p(:)
  p => null()
  call check_rank(p)
end
```

Instead, detect NULL() in polymorphic pointer lowering and trigger the
deallocation of the pointer.

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