platform/upstream/llvm.git
19 months agoBazel build fix, second try
David Blaikie [Tue, 4 Apr 2023 17:14:13 +0000 (17:14 +0000)]
Bazel build fix, second try

19 months agoBazel build fix for X86ManualFoldTables.def
David Blaikie [Tue, 4 Apr 2023 17:09:50 +0000 (17:09 +0000)]
Bazel build fix for X86ManualFoldTables.def

19 months ago[ExtractAPI] Remove extra attributes in property declaration fragments
Usman Akinyemi [Tue, 4 Apr 2023 16:58:03 +0000 (09:58 -0700)]
[ExtractAPI] Remove extra attributes in property declaration fragments

Use `getPropertyAttributesAsWritten` instead of `getPropertyAttributes`
to get property attributes actually specified in the source code.
Resolves issue #61478.

https://reviews.llvm.org/D146759

Reviewed By: zixuw, dang

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

19 months ago[ARM] Add some tests for MVE vcmla combines. NFC
David Green [Tue, 4 Apr 2023 16:45:50 +0000 (17:45 +0100)]
[ARM] Add some tests for MVE vcmla combines. NFC

See D147200 and D147201

19 months ago[IR] Remove ConstantFP::getZeroValueForNegation.
Craig Topper [Tue, 4 Apr 2023 16:24:29 +0000 (09:24 -0700)]
[IR] Remove ConstantFP::getZeroValueForNegation.

This was mostly used for integers which was fixed in D147492.

The only FP usage was removed in D147497.

Reviewed By: nikic

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

19 months ago[CodeGen] Add machine verification to a couple of tests
Jay Foad [Tue, 4 Apr 2023 16:01:12 +0000 (17:01 +0100)]
[CodeGen] Add machine verification to a couple of tests

This helps to provoke a couple of errors when I apply D129208 that would
otherwise only show up in an LLVM_ENABLE_EXPENSIVE_CHECKS build.

19 months agoRevert "Recommit DwarfEHPrepare: insert extra unwind paths for stack protector to...
Hans Wennborg [Tue, 4 Apr 2023 16:00:11 +0000 (18:00 +0200)]
Revert "Recommit DwarfEHPrepare: insert extra unwind paths for stack protector to instrument"

This broke Objective-C autorelease / retainAutoreleasedReturnValue, see
comments on the code review.

> This is a mitigation patch for
> https://bugs.chromium.org/p/llvm/issues/detail?id=30, where existing stack
> protection is skipped if a function is returned through by an unwinder rather
> than the normal call/return path. The recent patch D139254 added the ability to
> instrument a visible unwind path, at least in the IR case (I'm working on the
> SelectionDAG instrumentation too) but there are still invisible unwinds it
> can't reach.
>
> So this patch adds logic to DwarfEHPrepare that goes through a function,
> converting any call that might throw into an invoke to a simple resume cleanup,
> and adding cleanup clauses to existing landingpads that lack them. Obviously we
> don't really want to do this if it's wasted effort, so I also exposed
> requiresStackProtector from the actual StackProtector code to skip the extra
> paths if they won't be used.
>
> Changes:
>   * Move test to AArch64 directory as it relies on target presence.
>   * Re-add Dominator-tree maintenance. Accidentally cherry-picked wrong patch.
>   * Skip adding paths on Windows EH functions.
>
> https://reviews.llvm.org/D143637

This reverts commit 2d690684f66fabc9ac6a2c70fcff3b31c9520794.

19 months ago[Flang] Change fir.divc to perform library call rather than generate inline operations.
Sacha Ballantyne [Fri, 10 Mar 2023 16:53:01 +0000 (16:53 +0000)]
[Flang] Change fir.divc to perform library call rather than generate inline operations.

Currently `fir.divc` is always lowered to a sequence of llvm operations to perform complex division, however this causes issues for extreme values when the calculations overflow. While this behaviour would be fine at -Ofast, this is currently the default at all levels.

This patch changes `fir.divc` to lower to a library call instead, except for when KIND=3 as there is no appropriate library call for this case.

Reviewed By: vzakhari

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

19 months ago[AArch64] Use fneg instead of fsub -0.0, X Cin IR expansion of __builtin_neon_vfmsh_f16.
Craig Topper [Tue, 4 Apr 2023 16:00:45 +0000 (09:00 -0700)]
[AArch64] Use fneg instead of fsub -0.0, X Cin IR expansion of __builtin_neon_vfmsh_f16.

Addresses the FIXME and removes the only in tree use of
llvm::ConstantFP::getZeroValueForNegation for an FP type.

Reviewed By: dmgreen, SjoerdMeijer

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

19 months ago[IR] Remove uses of the oddly named ConstantFP::getZeroValueForNegation in integer...
Craig Topper [Tue, 4 Apr 2023 16:00:37 +0000 (09:00 -0700)]
[IR] Remove uses of the oddly named ConstantFP::getZeroValueForNegation in integer code.

Confusingly ConstantFP's getZeroValueForNegation intentionally
handles non-FP constants. It calls getNullValue in Constant.

Nearly all uses in tree are for integers rather than FP. Maybe due
to replacing FSub -0.0, X idiom with an FNeg instructions a few
years ago.

This patch replaces all the integer uses in tree with ConstantInt::get(0, Ty).

The one remaining use is in clang with a FIXME that it should use fneg.
I'll fix that next and then delete ConstantFP::getZeroValueForNegation.

Reviewed By: nikic

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

19 months ago[OpenMP][libomptarget] Do not rely on AsyncInfoWrapperTy's destructor
Kevin Sala [Sun, 29 Jan 2023 22:29:22 +0000 (23:29 +0100)]
[OpenMP][libomptarget] Do not rely on AsyncInfoWrapperTy's destructor

19 months ago[RISCV] Add FIXME comment about expensive vector mem op costs
Luke Lau [Tue, 4 Apr 2023 15:45:07 +0000 (16:45 +0100)]
[RISCV] Add FIXME comment about expensive vector mem op costs

19 months ago[ARM] Fix VMOVSR pattern requirements
Mikhail Maltsev [Tue, 4 Apr 2023 15:45:14 +0000 (16:45 +0100)]
[ARM] Fix VMOVSR pattern requirements

The required target features for VMOVSR instruction (integer -> MVE
FP register copy) are HasFPRegs and UseVMOVSR (see
https://reviews.llvm.org/D60694).

The instruction selection pattern must use the same set of
requirements (i.e., HasFPRegs instead of HasVFP2). The discrepancy
can cause instruction selection failure when compiling code for
execute-only position-independence mode.

Reviewed By: dmgreen

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

19 months ago[flang] Correctly lower optional assumed type dummy
Valentin Clement [Tue, 4 Apr 2023 15:39:37 +0000 (08:39 -0700)]
[flang] Correctly lower optional assumed type dummy

Assumed type are represented differently in the ActualArgument
class. Correctly handle them in intrinsic arg lowering.

Reviewed By: PeteSteinfeld

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

19 months ago[X86] Prefer `vpternlog` instead of `blendv` for `vselect` on masks.
Noah Goldstein [Tue, 4 Apr 2023 05:14:02 +0000 (00:14 -0500)]
[X86] Prefer `vpternlog` instead of `blendv` for `vselect` on masks.

This rarely comes up because most `vselect` are lowered with actually
avx512 mask instructions, but is an improvement in the rare cases.

Reviewed By: RKSimon

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

19 months agoRecommit "[X86] Simplify some `pternlog` intrinsics" (2nd Try)
Noah Goldstein [Tue, 4 Apr 2023 05:13:43 +0000 (00:13 -0500)]
Recommit "[X86] Simplify some `pternlog` intrinsics" (2nd Try)

Original location of the unittests was Transforms/InstCombine/X86
which caused an issue as non-x86 targets ended up with a dependency on
X86 which isn't right.

Moved the unit tests to Target/X86 so should be good now.

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

19 months ago[WebAssembly] Add libcall signatures for roundeven
Thomas Lively [Tue, 4 Apr 2023 15:32:25 +0000 (08:32 -0700)]
[WebAssembly] Add libcall signatures for roundeven

Since clang started emitting roundeven intrinsics in a7d6593a0a17, they would
cause a crash in the WebAssembly backend because it did not know the roundeven
library function signatures. Fix the crash by adding the signatures.

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

19 months ago[clang][modules] Handle explicit modules when checking for .Private -> _Private
Ben Langmuir [Mon, 3 Apr 2023 22:22:20 +0000 (15:22 -0700)]
[clang][modules] Handle explicit modules when checking for .Private -> _Private

While we eventually want to remove the mapping from .Private to _Private
modules, until we do, ensure that it behaves the same for explicit
modules.

rdar://107449872

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

19 months ago[bazel] -lrt is not available on Android.
Byungchul Kim [Tue, 4 Apr 2023 15:08:08 +0000 (08:08 -0700)]
[bazel] -lrt is not available on Android.

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

19 months ago[flang] Fix -Wsign-compare in check-call.cpp (NFC)
Jie Fu [Tue, 4 Apr 2023 14:50:55 +0000 (22:50 +0800)]
[flang] Fix -Wsign-compare in check-call.cpp (NFC)

/data/llvm-project/flang/lib/Semantics/check-call.cpp:1234:29: error: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
  CHECK(index >= 0 && index < actuals.size());
                      ~~~~~ ^ ~~~~~~~~~~~~~~
/data/llvm-project/flang/include/flang/Common/idioms.h:89:20: note: expanded from macro 'CHECK'
                   ^
1 error generated.

19 months ago[clang-format] Add option for having one port per line in Verilog
sstwcw [Tue, 4 Apr 2023 14:42:21 +0000 (14:42 +0000)]
[clang-format] Add option for having one port per line in Verilog

We added the option `VerilogBreakBetweenInstancePorts` to put ports on
separate lines in module instantiations.  We made it default to true
because style guides mostly recommend it that way for example:

https://github.com/lowRISC/style-guides/blob/master/VerilogCodingStyle.md#module-instantiation

Reviewed By: HazardyKnusperkeks

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

19 months ago[X86] combineBitcastvxi1 - peek through bitcast(concat(X,undef,undef,undef)) -> aext...
Simon Pilgrim [Tue, 4 Apr 2023 14:38:44 +0000 (15:38 +0100)]
[X86] combineBitcastvxi1 - peek through bitcast(concat(X,undef,undef,undef)) -> aext(bitcast(X))

Improves fix for #61683 to handle cases where the legalization concatenation isn't just 2 subops.

19 months ago[MachineVerifier] Try harder to verify SlotIndexes
Jay Foad [Wed, 6 Jul 2022 13:26:16 +0000 (14:26 +0100)]
[MachineVerifier] Try harder to verify SlotIndexes

Verify the SlotIndexes analysis after a pass that claims to preserve it,
even if there are no further passes (apart from the verifier itself)
that would use the analysis.

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

19 months ago[RISCV] Model vlseg/vsseg in interleaved memory ops
Luke Lau [Tue, 21 Mar 2023 13:02:16 +0000 (13:02 +0000)]
[RISCV] Model vlseg/vsseg in interleaved memory ops

If the legalized type is a legal interleaved access type (i.e. there's a
supported vlseg/vsseg instruction for it), the interleaved access pass
will pick any interleaved memory op (wide load + shuffles) and lower it
into a vlseg/vsseg intrinsic.

Reviewed By: reames

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

19 months ago[NFC][LoopVectorize] Simplify preferPredicateOverEpilogue interface
David Sherwood [Tue, 4 Apr 2023 13:58:58 +0000 (13:58 +0000)]
[NFC][LoopVectorize] Simplify preferPredicateOverEpilogue interface

Given just how many arguments we pass to
preferPredicateOverEpilogue and considering this list may
grow over time I've decided to pass in a pointer to a new
TailFoldingInfo structure instead, similar to what we do
with IntrinsicCostAttributes, etc. In addition, many of the
arguments we pass in are actually available in the
LoopVectorizationLegality class so I've managed to
reduce the set of pointers that we need to pass in the
TailFoldingInfo struct.

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

19 months agoRevert "[mlir][arith] Add expansion pattern for ext/trunc of bf16"
Benjamin Kramer [Tue, 4 Apr 2023 13:53:04 +0000 (15:53 +0200)]
Revert "[mlir][arith] Add expansion pattern for ext/trunc of bf16"

This reverts commit 5bff523793ee8c30c260cc77b23c61dcbb606486. The
bf16->f32 conversion is incorrect. This can't be on by default, if you
want this behavior make it a separate pass.

19 months ago[X86] LowerVectorAllEqual - generalize mask type generation. NFC.
Simon Pilgrim [Tue, 4 Apr 2023 13:48:20 +0000 (14:48 +0100)]
[X86] LowerVectorAllEqual - generalize mask type generation. NFC.

This will be necessary once we merge with combineVectorSizedSetCCEquality and we need to support KORTEST handling for 128/256-bit comparisons

19 months ago[Flang][PowerPC] Implement PPC mtfsf/mtfsfi intrinsics
Paul Scoropan [Tue, 21 Mar 2023 18:32:35 +0000 (18:32 +0000)]
[Flang][PowerPC] Implement PPC mtfsf/mtfsfi intrinsics

Implements the PowerPC mtfsf and mtfsfi intrinsics as well as introduces semantic error checking code for PowerPC intrinsics

Reviewed By: klausler

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

19 months ago[X86] Add additional test coverage for Issue #61683
Simon Pilgrim [Tue, 4 Apr 2023 13:39:58 +0000 (14:39 +0100)]
[X86] Add additional test coverage for Issue #61683

Show failure for other vector size concatenations

19 months ago[lld-macho] Check if DWARF offset is too large for compact unwind
Jez Ng [Tue, 4 Apr 2023 13:26:03 +0000 (09:26 -0400)]
[lld-macho] Check if DWARF offset is too large for compact unwind

For functions that use DWARF encodings, their compact unwind entry will
contain a hint about the offset of their DWARF entry from the start of
the `__eh_frame` section. The encoding only has 3 bytes to encode this
hint.

Previously, I neglected to check for overflow (and didn't realize that
the value was merely a hint without needing to be exact.) So for large
`__eh_frame` sections, the hint would overflow and cause the compact
unwind MODE flag to be corrupted, leading to uncaught exceptions at
runtime.

This diff fixes things by encoding zero as the hint for offsets that are
too large. The unwinder will start a linear search at the hint location
for the matching CFI record. The only requirement is that the hint
points to a valid CFI record start, and the start of the section is
always the start of a CFI record (in well-formed programs).

I'm not adding a test for this because generating the test inputs takes
a bit too much time. However, I have been testing locally with this lit
file, which takes about 15s to run on my machine:

```
# RUN: rm -rf %t; mkdir %t
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 %s -o %t/test.o
# RUN: %lld -dylib -lSystem %t/test.o -o %t/test

.subsections_via_symbols
.text
.p2align 2

_f:
  .cfi_startproc
.rept 0x7fffff
  .cfi_escape 0x2e, 0x10
.endr
  ret
  .cfi_endproc

_g:
  .cfi_startproc
  .cfi_escape 0x2e, 0x10
  ret
  .cfi_endproc
```

Reviewed By: #lld-macho, smeenai

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

19 months ago[X86] Remove unused variable
Simon Pilgrim [Tue, 4 Apr 2023 13:26:46 +0000 (14:26 +0100)]
[X86] Remove unused variable

Leftover from eb435b7ff569b35ae603886b881f51ac8600bd60

19 months ago[Headers] Add some intrinsic function descriptions to immintrin.h.
Paul Robinson [Mon, 3 Apr 2023 18:19:35 +0000 (11:19 -0700)]
[Headers] Add some intrinsic function descriptions to immintrin.h.

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

19 months ago[X86] combineBitcastvxi1 - peek through bitcast(concat(X,undef)) -> aext(bitcast(X))
Simon Pilgrim [Tue, 4 Apr 2023 13:24:52 +0000 (14:24 +0100)]
[X86] combineBitcastvxi1 - peek through bitcast(concat(X,undef)) -> aext(bitcast(X))

Fixes #61683

19 months ago[python] Expose clang_Location_isInSystemHeader
Artur Ryt [Tue, 4 Apr 2023 13:21:04 +0000 (09:21 -0400)]
[python] Expose clang_Location_isInSystemHeader

Add is_in_system_header property for Location class.

Corresponding unit test was also added.

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

19 months ago[X86] Add test coverage for Issue #61683
Simon Pilgrim [Tue, 4 Apr 2023 13:08:33 +0000 (14:08 +0100)]
[X86] Add test coverage for Issue #61683

19 months agoDrop U6Imm-related definitions
Ilya Leoshkevich [Tue, 4 Apr 2023 12:50:00 +0000 (14:50 +0200)]
Drop U6Imm-related definitions

They are no longer used, which leads to the -Wunused-function warning.

Reviewed By: uweigand

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

19 months ago[RISCV] Move shuffle-reverse test to rvv directory. NFC
Luke Lau [Sun, 2 Apr 2023 14:14:44 +0000 (15:14 +0100)]
[RISCV] Move shuffle-reverse test to rvv directory. NFC

Test is related to vectors so probably belongs in the rvv directory

Reviewed By: craig.topper

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

19 months agoRevert "[test] Remove occurences of br undef in CodeGen/AMDGPU tests"
Nuno Lopes [Tue, 4 Apr 2023 12:45:56 +0000 (13:45 +0100)]
Revert "[test] Remove occurences of br undef in CodeGen/AMDGPU tests"

This reverts commit 18c594c176036b7ffcd8439ed9c4b08d2085a244.
Build bots broke

19 months ago[X86][mem-fold] Refine code, NFCI
Shengchen Kan [Tue, 4 Apr 2023 12:39:59 +0000 (20:39 +0800)]
[X86][mem-fold] Refine code, NFCI

1. Remove redundant definition of constructor
2. Move the array in .inc to .def file
3. Add a licence for the .def file

19 months agoMachO use generic code to detect atomic support.
Tim Northover [Tue, 4 Apr 2023 10:55:19 +0000 (11:55 +0100)]
MachO use generic code to detect atomic support.

The default code can detect what width of atomic instructions are supported
based on the targeted architecture profile, version etc so there's no need to
hard-code 64 on Darwin targets (especially as it's wrong in most M-class
cases).

19 months ago[SystemZ] Remove unused function 'decodeU6ImmOperand' in SystemZDisassembler.cpp...
Jie Fu [Tue, 4 Apr 2023 12:20:54 +0000 (20:20 +0800)]
[SystemZ] Remove unused function 'decodeU6ImmOperand' in SystemZDisassembler.cpp (NFC)

/data/llvm-project/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp:209:21: error: unused function 'decodeU6ImmOperand' [-Werror,-Wunused-function]
static DecodeStatus decodeU6ImmOperand(MCInst &Inst, uint64_t Imm,
                    ^
1 error generated.

19 months ago[test] Remove occurences of br undef in CodeGen/AMDGPU tests
Kriti Gupta [Tue, 4 Apr 2023 12:14:30 +0000 (13:14 +0100)]
[test] Remove occurences of br undef in CodeGen/AMDGPU tests

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

19 months ago[X86] Convert some tests to opaque pointers (NFC)
Nikita Popov [Tue, 4 Apr 2023 12:07:22 +0000 (14:07 +0200)]
[X86] Convert some tests to opaque pointers (NFC)

19 months ago[compiler-rt] Fix scudo build on ARM
Leandro Lupori [Fri, 27 Jan 2023 18:34:00 +0000 (18:34 +0000)]
[compiler-rt] Fix scudo build on ARM

The build of scudo was failing on armv7l, with undefined references
to unwinder symbols, such as __aeabi_unwind_cpp_pr0. These are
needed by RTGwpAsan and thus, on ARM, scudo must also be linked
against an unwind library.

The cmake command that caused the build failure was:

cmake --fresh -S "$PWD/llvm/" -B "$PWD/build/" -G Ninja \
  -DCMAKE_INSTALL_PREFIX="$PWD/install" \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_ENABLE_PROJECTS="clang;lld;lldb;clang-tools-extra;polly" \
  -DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
  -DLLVM_TOOLCHAIN_TOOLS="llvm-ar;llvm-ranlib;llvm-objdump;\
llvm-rc;llvm-cvtres;llvm-nm;llvm-strings;llvm-readobj;\
llvm-dlltool;llvm-pdbutil;llvm-objcopy;llvm-strip;llvm-cov;\
llvm-profdata;llvm-addr2line;llvm-symbolizer;llvm-windres;llvm-ml;\
llvm-readelf;llvm-size" \
  -DLLVM_INSTALL_BINUTILS_SYMLINKS=OFF -DLLVM_PARALLEL_LINK_JOBS=1

Fixes #60115

Reviewed By: hctim

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

19 months ago[DebugInfo] don't make an MDTuple just to leak it
Jameson Nash [Tue, 4 Apr 2023 11:42:25 +0000 (07:42 -0400)]
[DebugInfo] don't make an MDTuple just to leak it

There does not seem to be any purpose to allocating this object, which
is Metadata, so LLVM will simply leak it until the context is destroyed
(the subprogram metadata it contains are distinct, so there is little
chance of it being reused later). This should not have a functional
change.

This seems to be left over from an earlier design, when it used to call
```
CUNode->replaceSubprograms(SPs.get());
```
here also. (removed in http://reviews.llvm.org/D19034)

Reviewed By: aprantl

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

19 months ago[SystemZ] Allow any I5 in RotateSelect*
Ilya Leoshkevich [Tue, 4 Apr 2023 10:11:50 +0000 (12:11 +0200)]
[SystemZ] Allow any I5 in RotateSelect*

For all RotateSelect* instructions, PoP says:

    Bits 0-1 of the I5 field (bits 32-33 of the instruction) are
    ignored.

LLVM, however, completely prohibits using them, e.g.:

    error: invalid operand for instruction
    asm("rxsbg %[r1],%[r2],177,43,228\n"

Lift this unnecessary restriction.

Reviewed By: uweigand

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

19 months ago[X86] Convert test to opaque pointers (NFC)
Nikita Popov [Tue, 4 Apr 2023 11:48:49 +0000 (13:48 +0200)]
[X86] Convert test to opaque pointers (NFC)

Retaining bitcasts to keep test intent.

addrsig_sym is no longer emitted for metedata_f1, but this
improvement is ultimately inconsequential, as it will get dropped
at a later stage anyway.

19 months ago[lit] Implement -I option for builtin "diff" command to ignore changes where all...
Bing1 Yu [Tue, 4 Apr 2023 11:47:23 +0000 (19:47 +0800)]
[lit] Implement -I option for builtin "diff" command to ignore changes where all lines match RE

Reviewed By: pengfei

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

19 months ago[Verifier] Rename matrix-intrinsics-opaque-ptrs.ll->matrix-intrinsics.ll
Florian Hahn [Tue, 4 Apr 2023 11:47:15 +0000 (12:47 +0100)]
[Verifier] Rename matrix-intrinsics-opaque-ptrs.ll->matrix-intrinsics.ll

The original typed pointer version of the tests (matrix-intrinsics.ll)
is now obsolete. Replace matrix-intrinsics.ll with
matrix-intrinsics-opaque-ptrs.ll.

19 months ago[X86][NFC] Remove redundant flags used in x86-auto-memfold.td
Shengchen Kan [Tue, 4 Apr 2023 11:36:05 +0000 (19:36 +0800)]
[X86][NFC] Remove redundant flags used in x86-auto-memfold.td

19 months ago[include-cleaner] Only ignore builtins without a header
Kadir Cetinkaya [Mon, 3 Apr 2023 15:38:54 +0000 (17:38 +0200)]
[include-cleaner] Only ignore builtins without a header

Certain standard library functions (e.g. std::move) are also implemented
as builtins. This patch moves filtering logic to the symbol->header
mapping phase to rather generate these references without any providers
only when we don't have a mapping.
That way we can also map them to header names mentioned in the builtin
mappings.

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

19 months ago[X86] Convert test to opaque pointers (NFC)
Nikita Popov [Tue, 4 Apr 2023 10:53:49 +0000 (12:53 +0200)]
[X86] Convert test to opaque pointers (NFC)

19 months ago[X86] Regenerate test checks (NFC)
Nikita Popov [Tue, 4 Apr 2023 10:52:59 +0000 (12:52 +0200)]
[X86] Regenerate test checks (NFC)

19 months ago[NFC][AArch64] Late 2022 A-Profile Extension Release Notes
Archibald Elliott [Tue, 4 Apr 2023 10:39:41 +0000 (11:39 +0100)]
[NFC][AArch64] Late 2022 A-Profile Extension Release Notes

19 months ago[Thumb2] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 4 Apr 2023 10:25:30 +0000 (12:25 +0200)]
[Thumb2] Convert tests to opaque pointers (NFC)

19 months ago[Thumb2] Name instructions in tests (NFC)
Nikita Popov [Tue, 4 Apr 2023 10:24:52 +0000 (12:24 +0200)]
[Thumb2] Name instructions in tests (NFC)

19 months ago[CodeGen] ExpandReductions - add reduce_and/or(<X x i1> V) -> icmp(iX bitcast(<X...
Simon Pilgrim [Tue, 4 Apr 2023 10:19:30 +0000 (11:19 +0100)]
[CodeGen] ExpandReductions - add reduce_and/or(<X x i1> V) -> icmp(iX bitcast(<X x i1> V)) canonicalization

This already exists in InstCombine but was missing from the late stage ExpandReductions pass

Fixes #53419
Fixes #61923

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

19 months ago[WebAssembly] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 4 Apr 2023 10:16:50 +0000 (12:16 +0200)]
[WebAssembly] Convert tests to opaque pointers (NFC)

19 months ago[WinEH] Convert test to opaque pointers (NFC)
Nikita Popov [Tue, 4 Apr 2023 10:13:26 +0000 (12:13 +0200)]
[WinEH] Convert test to opaque pointers (NFC)

19 months ago[PowerPC] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 4 Apr 2023 10:04:40 +0000 (12:04 +0200)]
[PowerPC] Convert tests to opaque pointers (NFC)

19 months ago[InstCombine] Pre-land tests for maximum(a,b) +* minimum(a,b) => a +* b
Serguei Katkov [Tue, 4 Apr 2023 09:49:59 +0000 (16:49 +0700)]
[InstCombine] Pre-land tests for maximum(a,b) +* minimum(a,b) => a +* b

19 months ago[PowerPC] Name instructions in tests (NFC)
Nikita Popov [Tue, 4 Apr 2023 10:03:33 +0000 (12:03 +0200)]
[PowerPC] Name instructions in tests (NFC)

19 months ago[Hexagon] Convert some tests to opaque pointers (NFC)
Nikita Popov [Tue, 4 Apr 2023 09:34:02 +0000 (11:34 +0200)]
[Hexagon] Convert some tests to opaque pointers (NFC)

19 months ago[InstCombine][NFC] Update generated variable names in signed-truncation-check.ll
John McIver [Tue, 4 Apr 2023 09:47:42 +0000 (10:47 +0100)]
[InstCombine][NFC] Update generated variable names in signed-truncation-check.ll

Update signed-truncation-check.ll using latest version of update_test_checks.py.

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

19 months ago[X86] LowerVectorAllEqual - remove repeated VT.getScalarSizeInBits() call. NFC.
Simon Pilgrim [Tue, 4 Apr 2023 09:45:43 +0000 (10:45 +0100)]
[X86] LowerVectorAllEqual - remove repeated VT.getScalarSizeInBits() call. NFC.

19 months ago[mlir][Linalg] NFC - Refactor hoist padding transform and separate packing creation...
Nicolas Vasilache [Mon, 3 Apr 2023 15:17:24 +0000 (08:17 -0700)]
[mlir][Linalg] NFC - Refactor hoist padding transform and separate packing creation functionality in a separate transform

This revision is in prevision for upcoming improvements.

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

19 months ago[mlir] add readonly/consume annotations to transform named sequences
Alex Zinenko [Thu, 30 Mar 2023 12:31:48 +0000 (12:31 +0000)]
[mlir] add readonly/consume annotations to transform named sequences

Use the argument attribute mechanism for function-like operations to
annotate the arguments of named transform sequences as consuming or only
reading the handles passed as arguments. This makes it possible to
correctly specify handle invalidation for external named sequences by
requiring their declarations to always provide such annotations.
Additionally, these annotations remove the need to analyze the body of
a named sequence to understand its effects on the arguments. Make them
required for named sequences that are called from the same file, in
addition to external sequences.

Provide a convenience pass that infers annotations by analyzing bodies
of named sequences provided they are not called from the same file.

Reviewed By: springerm

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

19 months ago[ARM] Regenerate test checks (NFC)
Nikita Popov [Tue, 4 Apr 2023 09:25:13 +0000 (11:25 +0200)]
[ARM] Regenerate test checks (NFC)

19 months ago[ARM] Convert some tests to opaque pointers (NFC)
Nikita Popov [Tue, 4 Apr 2023 09:15:38 +0000 (11:15 +0200)]
[ARM] Convert some tests to opaque pointers (NFC)

19 months ago[ARM] Regenerate test checks (NFC)
Nikita Popov [Tue, 4 Apr 2023 09:15:22 +0000 (11:15 +0200)]
[ARM] Regenerate test checks (NFC)

19 months ago[ARM] Name instructions in test (NFC)
Nikita Popov [Tue, 4 Apr 2023 09:10:24 +0000 (11:10 +0200)]
[ARM] Name instructions in test (NFC)

19 months ago[clang][Interp][NFC] Remove Integral.h include from PrimType.h
Timm Bäder [Thu, 16 Feb 2023 08:01:52 +0000 (09:01 +0100)]
[clang][Interp][NFC] Remove Integral.h include from PrimType.h

19 months ago[clang][Interp] Ignore more non-VarDecl declarations
Timm Bäder [Sun, 12 Mar 2023 07:32:07 +0000 (08:32 +0100)]
[clang][Interp] Ignore more non-VarDecl declarations

They are harmless and handled by other means, but we used to return
false from visitDeclStmt.

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

19 months ago[Test] Commit test for PR61923
Max Kazantsev [Tue, 4 Apr 2023 08:08:36 +0000 (15:08 +0700)]
[Test] Commit test for PR61923

We see increased number of assembly instructions after patch
24780e13e5be1501e34330148137a10fa9965166 for this test. See details
at https://github.com/llvm/llvm-project/issues/61923.

19 months ago[clang][dataflow] Fix -Wdeprecated-declarations after D147302 (NFC)
Jie Fu [Tue, 4 Apr 2023 08:17:25 +0000 (16:17 +0800)]
[clang][dataflow] Fix -Wdeprecated-declarations after D147302 (NFC)

Replace:
 1. createAtomicBoolValue() --> create<AtomicBoolValue>()
 2. createTopBoolValue()    --> create<TopBoolValue>()

/Users/jiefu/llvm-project/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:386:19: error: 'createAtomicBoolValue' is deprecated: use create<AtomicBoolValue> instead [-Werror,-Wdeprecated-declarations]
    return DACtx->createAtomicBoolValue();
                  ^~~~~~~~~~~~~~~~~~~~~
                  create<AtomicBoolValue>
/Users/jiefu/llvm-project/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:215:3: note: 'createAtomicBoolValue' has been explicitly marked deprecated here
  LLVM_DEPRECATED("use create<AtomicBoolValue> instead",
  ^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/Compiler.h:143:50: note: expanded from macro 'LLVM_DEPRECATED'
                                                 ^
In file included from /Users/jiefu/llvm-project/clang/lib/Analysis/FlowSensitive/Transfer.cpp:14:
In file included from /Users/jiefu/llvm-project/clang/include/clang/Analysis/FlowSensitive/Transfer.h:19:
/Users/jiefu/llvm-project/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:391:19: error: 'createTopBoolValue' is deprecated: use create<TopBoolValue> instead [-Werror,-Wdeprecated-declarations]
    return DACtx->createTopBoolValue();
                  ^~~~~~~~~~~~~~~~~~
                  create<TopBoolValue>
/Users/jiefu/llvm-project/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:227:3: note: 'createTopBoolValue' has been explicitly marked deprecated here
  LLVM_DEPRECATED("use create<TopBoolValue> instead", "create<TopBoolValue>")
  ^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/Compiler.h:143:50: note: expanded from macro 'LLVM_DEPRECATED'
                                                 ^
2 errors generated.

19 months ago[SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating
Nikita Popov [Wed, 22 Mar 2023 10:53:01 +0000 (11:53 +0100)]
[SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating

After D141386, violation of nonnull, range and align metadata
results in poison rather than immediate undefined behavior,
which means that these are now safe to retain when speculating.
We only need to remove UB-implying metadata like noundef.

This is done by adding a dropUBImplyingAttrsAndMetadata() helper,
which lists the metadata which is known safe to retain on speculation.

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

19 months ago[X86] Disable masked UNPCKLPD/UNPCKHPD -> SHUFPS transformation
Phoebe Wang [Tue, 4 Apr 2023 07:51:09 +0000 (15:51 +0800)]
[X86] Disable masked UNPCKLPD/UNPCKHPD -> SHUFPS transformation

UNPCKLPD/UNPCKHPD is a 64-bit element operation. The masked version
doesn't match SHUFPS in lanes.
This reverts part of D144763.

Reviewed By: RKSimon

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

19 months ago[clang-tidy] Small refactor for ExceptionAnalyzer
AMS21 [Tue, 4 Apr 2023 06:39:15 +0000 (06:39 +0000)]
[clang-tidy] Small refactor for ExceptionAnalyzer

- Use llvm::DenseMap<> with pre-allocation instead of std::map<> for FunctionCache
- Avoid double lookup for FunctionCache
- Use try_emplace instead of insert
- Simplify definition of State enum

Reviewed By: PiotrZSL

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

19 months ago[clang-tidy] Allow bugprone-unchecked-optional-access to handle calls to `std::forward`
AMS21 [Tue, 4 Apr 2023 06:38:40 +0000 (06:38 +0000)]
[clang-tidy] Allow bugprone-unchecked-optional-access to handle calls to `std::forward`

The check now understands that calling `std::forward`
will not modify the underlying optional value.

This fixes llvm#59705

Reviewed By: PiotrZSL

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

19 months ago[clang-tidy] Fix readability-static-accessed-through-instance check for anonymous...
AMS21 [Tue, 4 Apr 2023 06:35:08 +0000 (06:35 +0000)]
[clang-tidy] Fix readability-static-accessed-through-instance check for anonymous structs

Previously we would provide a fixit which looked like
this `unnamed struct at ...::f()` but which is obviously
not valid C/C++.

Since there is no real nice way to accesses a static function
from an anonymous struct anyways we simply ignore all
anonymous structs.

Fixes llvm#61736

Reviewed By: PiotrZSL

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

19 months ago[clang][dataflow] Add `create<T>()` methods to `Environment` and `DataflowAnalysisCon...
Martin Braenne [Mon, 3 Apr 2023 14:45:13 +0000 (14:45 +0000)]
[clang][dataflow] Add `create<T>()` methods to `Environment` and `DataflowAnalysisContext`.

These methods provide a less verbose way of allocating `StorageLocation`s and
`Value`s than the existing `takeOwnership(make_unique(...))` pattern.

In addition, because allocation of `StorageLocation`s and `Value`s now happens
within the `DataflowAnalysisContext`, the `create<T>()` open up the possibility
of using `BumpPtrAllocator` to allocate these objects if it turns out this
helps performance.

Reviewed By: ymandel, xazax.hun, gribozavr2

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

19 months ago[gn build] Port 39fc67b8af70
LLVM GN Syncbot [Tue, 4 Apr 2023 06:25:30 +0000 (06:25 +0000)]
[gn build] Port 39fc67b8af70

19 months ago[X86][NFC] Compress CD8_Scale from 7 bits to 3 bits
Shengchen Kan [Tue, 4 Apr 2023 05:00:14 +0000 (13:00 +0800)]
[X86][NFC] Compress CD8_Scale from 7 bits to 3 bits

Post: https://discourse.llvm.org/t/save-some-bits-in-tsflags-for-x86/69025

Reviewed By: craig.topper

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

19 months ago[llvm-exegesis] Factor out DisassemblerHelper from the Analysis class
Pavel Kosov [Tue, 4 Apr 2023 06:17:50 +0000 (09:17 +0300)]
[llvm-exegesis] Factor out DisassemblerHelper from the Analysis class

As part of preparing the reports, the Analysis class needs to print
machine instructions in a disassembled form. For this purpose, the class
has four fields (namely Context_, AsmInfo_, InstPrinter_ and Disasm_).
All the constructor of the Analysis class does is conditionally
initializing these four fields.

This commit factors out the logic for decoding machine code and printing
it in an assembler form into a separate DisassemblerHelper class.

~~

Huawei RRI, OS Lab

Reviewed By: courbet

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

19 months ago[IR] Replace calls to ConstantFP::getNullValue with ConstantFP::getZero. NFC
Craig Topper [Tue, 4 Apr 2023 06:14:02 +0000 (23:14 -0700)]
[IR] Replace calls to ConstantFP::getNullValue with ConstantFP::getZero. NFC

There is no getNullValue in ConstantFP. Due to inheritance, we're calling
Constant::getNullValue which handles any type including FP.
Since we already know we want an FP constant we can use ConstantFP::getZero
which might be faster and is a more readable name for an FP zero.

19 months agoRevert "asan_memory_profile: Fix for deadlock in memory profiler code."
Vitaly Buka [Tue, 4 Apr 2023 03:42:16 +0000 (20:42 -0700)]
Revert "asan_memory_profile: Fix for deadlock in memory profiler code."

Deadlocks with internal symbolizer.
https://lab.llvm.org/buildbot/#/builders/37/builds/21181

This reverts commit 129394ff50ed28a0b85d742c8ae315758bb22582.

19 months ago[gn build] Port 50b2a113db19
LLVM GN Syncbot [Tue, 4 Apr 2023 05:30:21 +0000 (05:30 +0000)]
[gn build] Port 50b2a113db19

19 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.

This is a recommit of cca01008cc31a891d0ec70aff2201b25d05d8f1b with
MemorySSA update fixes.

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

19 months ago[X86] Remove stale comment. NFC
Craig Topper [Tue, 4 Apr 2023 05:13:36 +0000 (22:13 -0700)]
[X86] Remove stale comment. NFC

19 months agoPR58819: Correct linkage and mangling of lambdas in inline static member initializers
David Blaikie [Fri, 18 Nov 2022 00:26:40 +0000 (00:26 +0000)]
PR58819: Correct linkage and mangling of lambdas in inline static member initializers

https://llvm.org/pr58819 - clang is giving an externally visible lambda in a static data member internal linkage and the wrong linkage name.

Looks like we should be classifying this case the same as a non-static data member, so far as I can tell from the ABI docs and template examples (seems like the non-template inline-defined case should be the same).

This is a change in ABI, but not sure it qualifies as an ABI break as far as Apple and Sony are concerned - do you folks want this change? (it should fix the example in the bug where a static member in such a lambda ends up bifurcated, and I don't /think/ it'll break existing code since the symbol was previously internal anyway)

Looks like GCC has got this mangling slightly wrong (so we'd still end up with GCC+Clang bifurcation of the local static in the lambda, function address inequality, etc) in that they miss the variable name in the mangling in the non-template case. GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107741

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

19 months ago[AArch64][GlobalISel] Move the localizer to run before the legalizer, and always...
Amara Emerson [Mon, 3 Apr 2023 23:12:58 +0000 (16:12 -0700)]
[AArch64][GlobalISel] Move the localizer to run before the legalizer, and always localize globals.

Our strategy for localizing globals in the entry block breaks down when we have
large functions with high register pressure, using lots of globals. When this
happens, our heuristics say that globals with many uses should not be localized,
leading us to cause excessive spills and stack usage. These situations are also
exacerbated by LTO which tends to generate large functions.

For now, moving to a strategy that's simpler and more akin to SelectionDAG
fixes these issues and makes our codegen more similar. This has an overall
neutral effect on size on CTMark, while showing slight improvements with -Os -flto
on benchmarks. For low level firmware software though we see big improvements.

The reason this is neutral, and not an improvement, is because we give up the
gains from CSE'ing globals in cases where we low register pressure. I think
this can be addressed in future with some better heuristics.

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

19 months ago[hwasan] Record allocation thread id in HeapAllocationRecord
Enna1 [Tue, 4 Apr 2023 03:24:46 +0000 (11:24 +0800)]
[hwasan] Record allocation thread id in HeapAllocationRecord

Extend HeapAllocationRecord to record allocation thread id, print thread id in memory allocation stack trace.

Reviewed By: vitalybuka

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

19 months ago[lsan] Fix Asan/Hwasan testing conditions
Vitaly Buka [Tue, 4 Apr 2023 03:01:24 +0000 (20:01 -0700)]
[lsan] Fix Asan/Hwasan testing conditions

19 months ago[sanitizer] Add new symbolizer symbol
Vitaly Buka [Tue, 4 Apr 2023 03:00:38 +0000 (20:00 -0700)]
[sanitizer] Add new symbolizer symbol

19 months ago[Clang][Sema] Fix comparison of constraint expressions
Alexander Shaposhnikov [Tue, 4 Apr 2023 02:22:08 +0000 (02:22 +0000)]
[Clang][Sema] Fix comparison of constraint expressions

This diff switches the approach to comparison of constraint expressions
to the new one based on template args substitution.
It continues the effort to fix our handling of out-of-line definitions
of constrained templates.

The associated GitHub issue: https://github.com/llvm/llvm-project/issues/61414

Test plan:
1/ ninja check-all
2/ bootstrapped Clang passes tests

Differential revision: https://reviews.llvm.org/D146178

19 months ago[X86][NFC] Combine HasVEX_W with hasREX_W to save 1 bit of TSFlags
Shengchen Kan [Mon, 3 Apr 2023 14:15:47 +0000 (22:15 +0800)]
[X86][NFC] Combine HasVEX_W with hasREX_W to save 1 bit of TSFlags

Post: https://discourse.llvm.org/t/save-some-bits-in-tsflags-for-x86/69025

Reviewed By: craig.topper

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

19 months ago[gn build] Port 038b7e6b761c
LLVM GN Syncbot [Tue, 4 Apr 2023 01:55:14 +0000 (01:55 +0000)]
[gn build] Port 038b7e6b761c

19 months ago[X86] Support AMX Complex instructions
Xiang1 Zhang [Fri, 31 Mar 2023 08:56:06 +0000 (16:56 +0800)]
[X86] Support AMX Complex instructions

Reviewed By: Wang Pengfei

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

19 months ago[scudo] Temporarily disable the build of Timer.
Chia-hung Duan [Tue, 4 Apr 2023 00:58:40 +0000 (00:58 +0000)]
[scudo] Temporarily disable the build of Timer.

The placeholder was %llu while merged but it may cause problem on some
platforms that enable -Wformat. It was incorrect changed to %lu which
cause the test failure because string_utils doesn't support %lu. Will
bring this back after we fix the placeholder.

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

19 months ago[SmallVector] Fix unit test to eliminate failure with -Werror
Nemanja Ivanovic [Tue, 4 Apr 2023 00:59:30 +0000 (19:59 -0500)]
[SmallVector] Fix unit test to eliminate failure with -Werror

Commit 475dd6f626ee2679578ed570e9fb78f7e957a36d added
a unit test that compares SmallVector::size() (a size_t
value) against 42 (an int value). That causes failures with
-Werror. This patch just adds the cast to silence the warning.