platform/upstream/llvm.git
23 months ago[RISCV] Branchless lowering for (select (x < 0), TrueConstant, FalseConstant) and...
LiaoChunyu [Thu, 17 Nov 2022 09:15:27 +0000 (17:15 +0800)]
[RISCV] Branchless lowering for (select (x < 0), TrueConstant, FalseConstant) and (select (x >= 0), TrueConstant, FalseConstant)

This patch reduces the number of unpredictable branches

(select (x < 0), y, z)  -> x >> (XLEN - 1) & (y - z) + z
(select (x >= 0), y, z) -> x >> (XLEN - 1) & (z - y) + y

Reviewed By: craig.topper, reames

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

23 months ago[include-cleaner] Make HTMLReport impl simpler/safer. NFC
Sam McCall [Fri, 25 Nov 2022 12:11:15 +0000 (13:11 +0100)]
[include-cleaner] Make HTMLReport impl simpler/safer. NFC

Targets and Refs are 1:1, so merge them.

Don't sort Refs array we keep indices into. (Currently we're done using
those indices by the time we sort, but this is fragile)

23 months agoDrop redundant pipe to opt -instnamer in clang tests
Alex Richardson [Thu, 24 Nov 2022 16:10:47 +0000 (16:10 +0000)]
Drop redundant pipe to opt -instnamer in clang tests

This used to be required, but the difference between asserts/!asserts
builds no longer exists for %clang_cc1 (only for %clang), so they pass
just fine without this flag.

23 months ago[BPF] Avoid checking for intrinsics using string comparisons. NFC
Alex Richardson [Fri, 25 Nov 2022 11:27:00 +0000 (11:27 +0000)]
[BPF] Avoid checking for intrinsics using string comparisons. NFC

Use a dyn_cast<> to IntrinsicInst and an enum compare instead.
While touching this code also re-generate the test to use positive check
lines instead of negative ones and remove some unneeded metadata.

Reviewed By: yonghong-song

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

23 months ago[ARM] Move ARM::parseBranchProtection into ARMTargetParserCommon
Archibald Elliott [Fri, 18 Nov 2022 13:15:49 +0000 (13:15 +0000)]
[ARM] Move ARM::parseBranchProtection into ARMTargetParserCommon

This should live with the Arm targets, given they have target-specific
target parsers.

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

23 months ago[X86] combineScalarAndWithMaskSetcc - handle (concat_vectors (and (vYi1 setcc, vYi1...
Simon Pilgrim [Fri, 25 Nov 2022 11:05:54 +0000 (11:05 +0000)]
[X86] combineScalarAndWithMaskSetcc - handle (concat_vectors (and (vYi1 setcc, vYi1 x), undef)) patterns

If one of the AND operands is a setcc then we're implicitly zeroing the upper mask bits

Similar pattern to regressions identified in D127115 (masked comparisons)

23 months ago[X86] Add test case for (any_extend (bitcast (concat_vectors (and (vYi1 setcc, vYi1...
Simon Pilgrim [Fri, 25 Nov 2022 10:54:21 +0000 (10:54 +0000)]
[X86] Add test case for (any_extend (bitcast (concat_vectors (and (vYi1 setcc, vYi1 x), undef)))) pattern

Similar pattern to a regression identified in D127115

23 months ago[include-cleaner] HTMLReport shows headers that would be inserted
Sam McCall [Thu, 24 Nov 2022 16:33:40 +0000 (17:33 +0100)]
[include-cleaner] HTMLReport shows headers that would be inserted

Demo: https://htmlpreview.github.io/?https://gist.githubusercontent.com/sam-mccall/9730f933a2cf2e003365520b6636f731/raw/7911d8251ceab7c244e0510285105027cd0a9403/PathMapping.cpp.html

Header insertion doesn't actually work that well (not this patch's fault):
- we don't have ranking of locations/headers yet, so inserted header is pretty
  random
- on my system, we get a lot of absolute "/usr/bin/../include/..." paths.
  This is a HeaderSearch bug introduced in D60873 that I'll send a fix for

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

23 months ago[lldb/test] Remove the module cache directory in module-ownership.mm
Pavel Labath [Fri, 25 Nov 2022 10:51:10 +0000 (11:51 +0100)]
[lldb/test] Remove the module cache directory in module-ownership.mm

The stale cache directory can cause compilation to fail when ast
serialization changes.

23 months ago[lldb] Prevent an infinite loop while reading memory regions
Pavel Labath [Fri, 25 Nov 2022 10:36:28 +0000 (11:36 +0100)]
[lldb] Prevent an infinite loop  while reading memory regions

A malformed qMemoryRegionInfo response can easily trigger an infinite
loop if regions end (base + size) wraps the address space. A
particularly interesting is the case where base+size=0, which a stub
could use to say that the rest of the memory space is unmapped, even
though lldb expects 0xff... in this case.

One could argue which behavior is more correct (technically, the
current behavior does not say anything about the last byte), but unless
we stop using 0xff... to mean "invalid address", that discussion is very
academic. This patch truncates address ranges which wraps the address
space, which handles the zero case as well as other kinds of malformed
packets.

23 months agoRevert: Add version to all LLVM cmake package
Thomas Preud'homme [Fri, 25 Nov 2022 10:54:58 +0000 (10:54 +0000)]
Revert: Add version to all LLVM cmake package

Summary: This reverts commit ad485b71b51168ce13282ae159bd8feff48baf84.

Reviewers:

Subscribers:

23 months ago[TargetLowering][AArch64] Teach DemandedBits about SVE count intrinsics
Benjamin Maxwell [Fri, 25 Nov 2022 09:57:08 +0000 (09:57 +0000)]
[TargetLowering][AArch64] Teach DemandedBits about SVE count intrinsics

This allows DemandedBits to see that the SVE count intrinsics (CNTB,
CNTH, CNTW, CNTD) sans multiplier will only ever produce small
positive integers. The maximum value you could get here is 256, which
is CNTB on a machine with a 2048bit vector size (the maximum for SVE).

Using this various redundant operations (zexts, sexts, ands, ors, etc)
can be eliminated.

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

23 months ago[Hexagon] Apply 7f06a5824cdb297a19b7c82bb191c22539f34070 to another copy of the same...
Benjamin Kramer [Fri, 25 Nov 2022 10:14:14 +0000 (11:14 +0100)]
[Hexagon] Apply 7f06a5824cdb297a19b7c82bb191c22539f34070 to another copy of the same code

23 months ago[Hexagon] Put asserts in an !NDEBUG region. NFCI
Benjamin Kramer [Fri, 25 Nov 2022 10:01:49 +0000 (11:01 +0100)]
[Hexagon] Put asserts in an !NDEBUG region. NFCI

Avoids unused variables in NDEBUG builds.

23 months ago[Lex] Fix suggested spelling of /usr/bin/../include/foo
Sam McCall [Thu, 24 Nov 2022 16:50:54 +0000 (17:50 +0100)]
[Lex] Fix suggested spelling of /usr/bin/../include/foo

Since D60873 we remove dotdots from the search path entries, but not the
filenames we're matching against, so do the latter too.

Since this also removes (single) dots, drop the logic to skip over them.
(Some of this was already dead, some is newly dead).

See D138676 for motivation.

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

23 months ago[NFC] Change `dyn_cast` to `cast` to make sure no dereference on nullptr
Phoebe Wang [Fri, 25 Nov 2022 09:39:08 +0000 (17:39 +0800)]
[NFC] Change `dyn_cast` to `cast` to make sure no dereference on nullptr

23 months agoPre-commit PowerPC case for zero/inf fpclassify
Qiu Chaofan [Fri, 25 Nov 2022 09:20:30 +0000 (17:20 +0800)]
Pre-commit PowerPC case for zero/inf fpclassify

23 months ago[analyzer] Deprecate FAM analyzer-config, recommend -fstrict-flex-arrays instead
Balazs Benics [Fri, 25 Nov 2022 09:24:56 +0000 (10:24 +0100)]
[analyzer] Deprecate FAM analyzer-config, recommend -fstrict-flex-arrays instead

By default, clang assumes that all trailing array objects could be a
FAM. So, an array of undefined size, size 0, size 1, or even size 42 is
considered as FAMs for optimizations at least.

One needs to override the default behavior by supplying the
`-fstrict-flex-arrays=<N>` flag, with `N > 0` value to reduce the set of
FAM candidates. Value `3` is the most restrictive and `0` is the most
permissive on this scale.

0: all trailing arrays are FAMs
1: only incomplete, zero and one-element arrays are FAMs
2: only incomplete, zero-element arrays are FAMs
3: only incomplete arrays are FAMs

If the user is happy with consdering single-element arrays as FAMs, they
just need to remove the
`consider-single-element-arrays-as-flexible-array-members` from the
command line.
Otherwise, if they don't want to recognize such cases as FAMs, they
should specify `-fstrict-flex-arrays` anyway, which will be picked up by
CSA.

Any use of the deprecated analyzer-config value will trigger a warning
explaining what to use instead.
The `-analyzer-config-help` is updated accordingly.

Depends on D138657

Reviewed By: xazax.hun

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

23 months ago[analyzer] Consider single-elem arrays as FAMs by default
Balazs Benics [Fri, 25 Nov 2022 09:24:56 +0000 (10:24 +0100)]
[analyzer] Consider single-elem arrays as FAMs by default

According to my measurement in https://reviews.llvm.org/D108230#3933232,
it seems like there is no drawback to enabling this analyzer-config by default.

Actually, enabling this by default would make it consistent with the
codegen of clang, which according to `-fstrict-flex-arrays`, assumes
by default that all trailing arrays could be FAMs, let them be of size
undefined, zero, one, or anything else.

Speaking of `-fstrict-flex-arrays`, in the next patch I'll deprecate
the analyzer-config FAM option in favor of that flag. That way, CSA will
always be in sync with what the codegen will think of FAMs.

So, if a new codebase sets `-fstrict-flex-arrays` to some value above 0,
CSA will also make sure that only arrays of the right size will be
considered as FAMs.

Reviewed By: xazax.hun

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

23 months ago[VE] Remove unnecessary isReMaterializable flags
Kazushi (Jam) Marukawa [Wed, 23 Nov 2022 05:50:08 +0000 (14:50 +0900)]
[VE] Remove unnecessary isReMaterializable flags

This flag should be used for instructions which create constant values.
So, remove the flag from not proper instructions.  Only LEA, LEASL, and
OR instructions have the flag now.

Reviewed By: efocht

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

23 months ago[MLIR] Adopt `DenseI64ArrayAttr` in tensor, memref and linalg transform
Lorenzo Chelini [Tue, 22 Nov 2022 11:41:44 +0000 (12:41 +0100)]
[MLIR] Adopt `DenseI64ArrayAttr` in tensor, memref and linalg transform

This commit is a first step toward removing inconsistencies between dynamic
and static attributes (i64 v. index) by dropping `I64ArrayAttr` and
using `DenseI64ArrayAttr` in Tensor, Memref and Linalg Transform ops.
In Linalg Transform ops only `TileToScfForOp` and `TileOp` have been updated.

See related discussion: https://discourse.llvm.org/t/rfc-inconsistency-between-dynamic-and-static-attributes-i64-v-index/66612/1

Reviewed By: nicolasvasilache

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

23 months ago[flang] Add hlfir.concat codegen
Jean Perier [Fri, 25 Nov 2022 08:38:06 +0000 (09:38 +0100)]
[flang] Add hlfir.concat codegen

hlfir.concat codegen happens in the "bufferization" pass: the pass
that place hlfir.expr in memory and transform all operations producing
or accepting hlfir.expr arguments into operations operating on memory.
Since this pass gets rid of the hlfir.expr type, this is a full
translation pass.

So far hlfir.concat codegen re-uses the current concatenation lowering helper
and only supports concatenation of two strings at a time. This matches
what lowering to HLFIR without any optimization produces. More optimized
versions will be developed later.

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

23 months ago[flang] Lower concatenation to hlfir.concat
Jean Perier [Fri, 25 Nov 2022 08:36:25 +0000 (09:36 +0100)]
[flang] Lower concatenation to hlfir.concat

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

23 months ago[flang] Add hlfir.concat operation definition
Jean Perier [Fri, 25 Nov 2022 08:33:34 +0000 (09:33 +0100)]
[flang] Add hlfir.concat operation definition

This operation represents scalar character concatenation. This is
added as part of flang lowering update described in
https://github.com/llvm/llvm-project/blob/main/flang/docs/HighLevelFIR.md

A notable difference with Fortran concatenation is that hlfir.concat can
take two or more operands. This will be used to optimize concatenation
chains.

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

23 months ago[flang] Remove debug option
Valentin Clement [Fri, 25 Nov 2022 08:30:08 +0000 (09:30 +0100)]
[flang] Remove debug option

Remove debug option added by mistake in D138587

23 months agoUse PassGate from LLVMContext if any otherwise global one
Evgeniy Brevnov [Tue, 1 Nov 2022 06:42:07 +0000 (13:42 +0700)]
Use PassGate from LLVMContext if any otherwise global one

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

23 months ago[Debugify] Accumulate the number of variables in debugify metadata
Anton Sidorenko [Thu, 24 Nov 2022 16:14:32 +0000 (19:14 +0300)]
[Debugify] Accumulate the number of variables in debugify metadata

When a module contains more than one function, we should update debugify metadata
by increasing the number of variables in the function rather than overwritting it.

Previous revert issue is fixed: I forgot to strip all x86-related info from the
test.

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

23 months ago[Test] Add couple more tests where we can compute symbolic max exit count (fixed)
Max Kazantsev [Fri, 25 Nov 2022 06:40:41 +0000 (13:40 +0700)]
[Test] Add couple more tests where we can compute symbolic max exit count (fixed)

23 months ago[InstCombine] Update debug intrinsics when rewriting allocas
Matthias Gehre [Wed, 23 Nov 2022 09:13:15 +0000 (10:13 +0100)]
[InstCombine] Update debug intrinsics when rewriting allocas

23 months agoRevert "[Test] Add couple more tests where we can compute symbolic max exit count"
Max Kazantsev [Fri, 25 Nov 2022 06:37:24 +0000 (13:37 +0700)]
Revert "[Test] Add couple more tests where we can compute symbolic max exit count"

This reverts commit 7e3373c9e174eff6edb1214efb3e67d7b7ad447d.

Some changes that were not supposed to be commited came with it.

23 months ago[Test] Add couple more tests where we can compute symbolic max exit count
Max Kazantsev [Fri, 25 Nov 2022 06:35:16 +0000 (13:35 +0700)]
[Test] Add couple more tests where we can compute symbolic max exit count

23 months ago[SCEV][NFC] Rename constructor parameter to match its field name
Max Kazantsev [Fri, 25 Nov 2022 05:49:43 +0000 (12:49 +0700)]
[SCEV][NFC] Rename constructor parameter to match its field name

23 months ago[LSR] precommit test for D138636; NFC
chenglin.bi [Fri, 25 Nov 2022 05:46:51 +0000 (13:46 +0800)]
[LSR] precommit test for D138636; NFC

23 months ago[SCEV][NFC] Get rid of redundant constructor, replace with default parameter
Max Kazantsev [Fri, 25 Nov 2022 05:07:16 +0000 (12:07 +0700)]
[SCEV][NFC] Get rid of redundant constructor, replace with default parameter

23 months ago[Test] Add test showing that SCEV fails to evaluate symbolic max for 'and' conditions
Max Kazantsev [Fri, 25 Nov 2022 04:45:10 +0000 (11:45 +0700)]
[Test] Add test showing that SCEV fails to evaluate symbolic max for 'and' conditions

23 months ago[SCEV] Fix misplaced \n in printout of max symbolic exit counts
Max Kazantsev [Fri, 25 Nov 2022 04:40:54 +0000 (11:40 +0700)]
[SCEV] Fix misplaced \n in printout of max symbolic exit counts

23 months ago[Inliner] Move cl::opt inside llvm::
Fangrui Song [Fri, 25 Nov 2022 04:31:13 +0000 (20:31 -0800)]
[Inliner] Move cl::opt inside llvm::

23 months ago[Hexagon] Don't lower legal EXTRACT_SUBVECTOR to EXTRACT_SUBREG
Krzysztof Parzyszek [Thu, 24 Nov 2022 21:26:21 +0000 (13:26 -0800)]
[Hexagon] Don't lower legal EXTRACT_SUBVECTOR to EXTRACT_SUBREG

EXTRACT_SUBREG is a machine opcode and cannot be a part of an input
selection pattern.

23 months ago[modules] Fix marking `ObjCMethodDecl::isOverriding` when there are no overrides.
Volodymyr Sapsai [Thu, 24 Nov 2022 01:42:30 +0000 (17:42 -0800)]
[modules] Fix marking `ObjCMethodDecl::isOverriding` when there are no overrides.

Incorrect `isOverriding` flag triggers the assertion
`!Overridden.empty()` in `ObjCMethodDecl::getOverriddenMethods` when a
method is marked as overriding but we cannot find any overrides.

When a method is declared in a category and defined in implementation,
we don't treat it as an override because it is the same method with
a separate declaration and a definition. But with modules we can find
a method declaration both in a modular category and a non-modular category
with different memory addresses. Thus we erroneously conclude the method
is overriding. Fix by comparing canonical declarations that are the same
for equal entities coming from different modules.

rdar://92845511

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

23 months ago[openmp] Use z_Linux_asm.S to provide __kmp_invoke_microtask with Clang for Windows...
Martin Storsjö [Thu, 10 Nov 2022 22:21:22 +0000 (00:21 +0200)]
[openmp] Use z_Linux_asm.S to provide __kmp_invoke_microtask with Clang for Windows/aarch64

When building for Windows aarch64, and not using the actual MSVC,
we can assemble gnu assembly files just fine, and the existing
correct implementation of __kmp_invoke_microtask is fully usable.

The C implementation of __kmp_invoke_microtask in
z_Windows_NT-586_util.cpp relies on unguaranteed assumptions about
the compiler behaviour - it does work currently on MSVC, but doesn't
necessarily on other compilers. That function uses an alloca to pass
parameters on the stack to the called functions.

There's no guarantee that the buffer allocated by alloca is exactly
at the bottom of the stack when doing the call; the compiler might
have left space for extra things to save on the stack there.

Additionally, when compiled with Clang with optimization, Clang
optimizes out the alloca and memcpy entirely. On the C language
level, they don't have any visible effect outside of the function
and thus can be omitted entirely.

This fixes calling microtasks with more than 6 parameters, in
builds for Windows/aarch64 with Clang.

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

23 months ago[flang] Adapt descriptor codegen to support unlimited polymorphic entities
Valentin Clement [Thu, 24 Nov 2022 19:33:15 +0000 (20:33 +0100)]
[flang] Adapt descriptor codegen to support unlimited polymorphic entities

Code generation to create and populate the descriptor (element size and
type code) is based on the boxed result type. This does not work well with
unlimited polymorphic entities since the fir type does not represent what is
actually emboxed or reboxed.
In the case of emboxing, the input type will be used to populate
the descriptor element size and type code.
When reboxing an unlimited polymorphic to a unlimited polymorphic entities, the
element size and type code is retrieve from the input box.

Reviewed By: jeanPerier

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

23 months ago[libc] Improve bcmp performance for aarch64
Guillaume Chatelet [Thu, 24 Nov 2022 19:24:21 +0000 (19:24 +0000)]
[libc] Improve bcmp performance for aarch64

23 months ago[MemoryLocation] Support memcpy_chk in getForArgument.
Florian Hahn [Thu, 24 Nov 2022 19:17:48 +0000 (19:17 +0000)]
[MemoryLocation] Support memcpy_chk in getForArgument.

Similar to 9f9e8ba114ce, add support for memcyp_chk to
MemoryLocation::getForArgument.

The size argument for memcpy_chk is an upper bound for the size of the
pointer argument. memcpy_chk may read/write less than the specified length,
if it exceeds the specified max size and aborts.

Reviewed By: xbolva00, jdoerfert

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

23 months ago[bazel] Add copts attribute to gentbl_cc_library macro.
Benjamin Kramer [Thu, 24 Nov 2022 19:16:16 +0000 (20:16 +0100)]
[bazel] Add copts attribute to gentbl_cc_library macro.

23 months agoChange debugserver to spawn processes in their own pgrp
Jason Molenda [Thu, 24 Nov 2022 18:56:01 +0000 (10:56 -0800)]
Change debugserver to spawn processes in their own pgrp

Change debugserver's posix_spawn() to spawn an inferior process in
its own process group, so signals from the terminal like control-c
are passed to the inferior process instead of debugserer.  In lldb's
own native-host launching, there is a LaunchInfo option
LaunchInSeparateProcessGroup, and this mirrors the most common
setting of that on Darwin systems.

Patch by Alessandro Arzilli <alessandro.arzilli@gmail.com>.

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

23 months ago[InstCombine] ease restriction for extractelt (bitcast X) fold
Sanjay Patel [Thu, 24 Nov 2022 17:56:19 +0000 (12:56 -0500)]
[InstCombine] ease restriction for extractelt (bitcast X) fold

We were checking for a desirable integer type even when there
is no shift in the transform. This is unnecessary since we
are truncating directly to the destination type.

This removes an extractelt in more cases and seems to make the
canonicalization more uniform overall. There's still a potential
difference between patterns that need a shift vs. trunc-only.

I'm not sure if that is worth keeping at this point, but it can
be adjusted in another step (assuming this change does not cause
trouble).

In the most basic case where I noticed this, we missed a fold
that would have completely removed vector ops from a pattern
like:
https://alive2.llvm.org/ce/z/y4Qdte

23 months ago[AArch64][SME]: Generate streaming-compatible code for int/fp select/vselect
Hassnaa Hamdi [Tue, 22 Nov 2022 20:39:44 +0000 (20:39 +0000)]
[AArch64][SME]: Generate streaming-compatible code for int/fp select/vselect

To generate code compatible to streaming mode:
 - enable custom lowering for VSETCC, needed for (fp-vselect.ll, int-vselect.ll).

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

23 months ago[AArch64][SME]: Add precursory tests for D138519
Hassnaa Hamdi [Tue, 22 Nov 2022 20:36:54 +0000 (20:36 +0000)]
[AArch64][SME]: Add precursory tests for D138519

Add testing files:
 - fp-select.ll
 - int-select.ll
 - fp-vselect.ll
 - int-vselect.ll

23 months ago[AArch64] Add hasSVEorSME() helper and fix some incorrect checks
Benjamin Maxwell [Wed, 23 Nov 2022 15:15:02 +0000 (15:15 +0000)]
[AArch64] Add hasSVEorSME() helper and fix some incorrect checks

This adds a little hasSVEorSME() helper, and as a NFC updates existing
code to use it. The assertions get[Min|Max]SVEVectorSizeInBits() are
also now corrected to use hasSVEorSME() rather than just hasSVE().

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

23 months ago[AArch64] Add Missing System Registers
Archibald Elliott [Tue, 22 Nov 2022 17:26:52 +0000 (17:26 +0000)]
[AArch64] Add Missing System Registers

The following system registers have been missing upstream:
- ID_DFR1_EL1
- AMCG1IDR_EL0 (present when FEAT_AMUv1p1 implemented - optional from v8.6-a)
- HAFGRTR_EL2 (present when FEAT_AMUv1 and FEAT_FGT are implemented)

With regards to HAFGRTR_EL2, this is only present when you have both
extensions. As FEAT_FGT is part of a later architecture, we group it
with those registers. In all honesty, this is a good example of the
kinds of place where just enabling all system registers all the time
would be easiest.

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

23 months ago[AArch64][SME]: Generate streaming-compatible code for FP rounding operations.
Hassnaa Hamdi [Mon, 21 Nov 2022 16:17:01 +0000 (16:17 +0000)]
[AArch64][SME]: Generate streaming-compatible code for FP rounding operations.

1- To generate code compatible to streaming mode:
 - enable custom lowering for fcopysign, isd::fp_round, isd::fceil, isd::ffloor, isd::fnearbyint,
   isd::frint, isd::fround, isd::froundeven, isd::ftrunc.

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

23 months ago[AArch64][SME]: Add precursory tests for D138440
Hassnaa Hamdi [Mon, 21 Nov 2022 15:30:17 +0000 (15:30 +0000)]
[AArch64][SME]: Add precursory tests for D138440

Add testing files:
 - fcopysign.ll
 - fp-rounding.ll

23 months ago[InstCombine] avoid 'tmp' variable name in tests; NFC
Sanjay Patel [Thu, 24 Nov 2022 17:21:39 +0000 (12:21 -0500)]
[InstCombine] avoid 'tmp' variable name in tests; NFC

The auto-generation script warns on these files because
of the potential to conflict with the scripted regex names.

23 months ago[clang-fuzzer] Add missing dependency
Arthur Eubanks [Thu, 24 Nov 2022 17:20:47 +0000 (09:20 -0800)]
[clang-fuzzer] Add missing dependency

23 months agoReland [clang-fuzzer] Use new pass manager for optimizing IR
Arthur Eubanks [Thu, 24 Nov 2022 00:59:28 +0000 (16:59 -0800)]
Reland [clang-fuzzer] Use new pass manager for optimizing IR

With CMakeLists.txt fix.

23 months ago[AArch64][SME]: Generate streaming-compatible code for int-reduce, fp-reduce
Hassnaa Hamdi [Fri, 18 Nov 2022 16:56:03 +0000 (16:56 +0000)]
[AArch64][SME]: Generate streaming-compatible code for int-reduce, fp-reduce

 1- To generate code compatible to streaming mode:
  - enable custom lowering for VECREDUCE_(smin, smax, umin, umax, add, fadd).

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

23 months ago[AArch64][SME]: Add precursory tests for D138309
Hassnaa Hamdi [Fri, 18 Nov 2022 16:50:27 +0000 (16:50 +0000)]
[AArch64][SME]: Add precursory tests for D138309

Add testing files:
 - int-reduce.ll
 - fp-reduce.ll

23 months agoRevert "[clang-fuzzer] Use new pass manager for optimizing IR"
Arthur Eubanks [Thu, 24 Nov 2022 16:56:53 +0000 (08:56 -0800)]
Revert "[clang-fuzzer] Use new pass manager for optimizing IR"

This reverts commit a46a746cfa08a72f9e9188451ed5cac2f77d5237.

Breaks bots, e.g. https://lab.llvm.org/buildbot#builders/121/builds/25511.

23 months ago[llvm] [cmake] Set EXCLUDE_FROM_ALL on gtest and TestingSupport
Michał Górny [Sun, 30 Oct 2022 06:37:15 +0000 (07:37 +0100)]
[llvm] [cmake] Set EXCLUDE_FROM_ALL on gtest and TestingSupport

Exclude building googletest and LLVMTestingSupport libraries from
the `all` target.  If unittests are being built, these libraries will
be built as a dependency anyway.  If they are not being built, building
them makes little sense as they are not installed or used otherwise.

This will also make standalone builds of other projects easier, as it
makes it possible to include these directories without having to cover
them with additional conditions to prevent them from being built
unconditionally.

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

23 months ago[libc++][AIX] Add AIX buildbot owners
David Tenty [Wed, 23 Nov 2022 16:10:30 +0000 (11:10 -0500)]
[libc++][AIX] Add AIX buildbot owners

This adds the AIX (i.e. Power) buildbot owners in the format established
by https://reviews.llvm.org/D138445

Reviewed By: ldionne

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

23 months ago[lldb][NFC] Change FindDefinitionTypeForDWARFDeclContext() to take DWARFDIE
Arthur Eubanks [Wed, 23 Nov 2022 22:29:40 +0000 (14:29 -0800)]
[lldb][NFC] Change FindDefinitionTypeForDWARFDeclContext() to take DWARFDIE

This simplifies an upcoming patch.

Reviewed By: labath

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

23 months ago[clang-fuzzer] Use new pass manager for optimizing IR
Arthur Eubanks [Thu, 24 Nov 2022 00:59:28 +0000 (16:59 -0800)]
[clang-fuzzer] Use new pass manager for optimizing IR

23 months ago[X86] combineScalarAndWithMaskSetcc - optionally peek through (oneuse) any_extend...
Simon Pilgrim [Thu, 24 Nov 2022 16:26:29 +0000 (16:26 +0000)]
[X86] combineScalarAndWithMaskSetcc - optionally peek through (oneuse) any_extend node

Extend pass to handle: (and (any_extend (bitcast (vXi1 (concat_vectors (vYi1 setcc), undef,)))), C)

Fixes several regressions identified in D127115

23 months ago[AArch64] Add support for v8.9-A/v9.4-A Debug and PMU extensions
Lucas Prates [Wed, 16 Nov 2022 16:56:54 +0000 (16:56 +0000)]
[AArch64] Add support for v8.9-A/v9.4-A Debug and PMU extensions

This adds support for the 2022 Debug and PMU extensions that are part of
the v8.9-A and v9.4-A architecture versions. This includes:

* New archtecture extension for the v9.4-A Instrumentation Extension
  (FEAT_ITE), including 'trcit' instruction and system registers
* New system registers for:
  * 2022 Debug features (FEAT_Debugv8p9)
  * 2022 Performance Monitors Extension features (FEAT_PMUv3p9)
  * PMU Snapshot extension (FEAT_PMUv3_SS)
  * PMU Fixed-function instruction counter (FEAT_PMUv3_ICNTR)
  * System Performance Monitors Extension (FEAT_SPMU)
  * Synchornous-exception-based event profiling (FEAT_SEBEP)
  * Fine Grained Traps Extension (FEAT_FGT2)
  * SPE Data Source filtering (FEAT_SPE_FDS)

More information on the new extensions can be found on:
* https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-2022
* https://developer.arm.com/downloads/-/exploration-tools

Changes by Son Tuan Vu, Sam Elliott and me.

Reviewed By: tmatheson

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

23 months agoRevert "[Debugify] Accumulate the number of variables in debugify metadata"
Anton Sidorenko [Thu, 24 Nov 2022 16:08:32 +0000 (19:08 +0300)]
Revert "[Debugify] Accumulate the number of variables in debugify metadata"

This brokes some builds
This reverts commit a1bbe8a4e2e50e7100dc17d9ddd1bfc3bfe44977.

23 months ago[Alignment][NFC] Use Align in MCStreamer::emitValueToAlignment
Guillaume Chatelet [Thu, 24 Nov 2022 15:23:06 +0000 (15:23 +0000)]
[Alignment][NFC] Use Align in MCStreamer::emitValueToAlignment

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

23 months ago[Alignment][NFC] Use Align for MCStreamer::emitXCOFFLocalCommonSymbol
Guillaume Chatelet [Thu, 24 Nov 2022 14:45:37 +0000 (14:45 +0000)]
[Alignment][NFC] Use Align for MCStreamer::emitXCOFFLocalCommonSymbol

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

23 months ago[Debugify] Accumulate the number of variables in debugify metadata
Anton Sidorenko [Fri, 28 Oct 2022 13:47:44 +0000 (16:47 +0300)]
[Debugify] Accumulate the number of variables in debugify metadata

When a module contains more than one function, we should update debugify metadata
by increasing the number of variables in the function rather than overwritting it.

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

23 months ago[flang] Lowering LOC intrinsic
Kelvin Li [Tue, 15 Nov 2022 19:46:25 +0000 (14:46 -0500)]
[flang] Lowering LOC intrinsic

This patch is to implement the lowering of the LOC intrinsic.

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

23 months ago[flang][test] Adjust Driver/pass-plugin-not-found.f90 error message
Rainer Orth [Thu, 24 Nov 2022 15:20:33 +0000 (16:20 +0100)]
[flang][test] Adjust Driver/pass-plugin-not-found.f90 error message

The `Driver/pass-plugin-not-found.f90` test `FAIL`s on Solaris since part
of the error message differs from what the test expects: Solaris has

  error: unable to load plugin 'X.Y': 'Could not load library 'X.Y':
ld.so.1: flang-new: X.Y: open failed: No such file or directory'

while the test expects

  error: unable to load plugin 'X.Y': 'Could not load library 'X.Y': X.Y:
cannot open shared object file: No such file or directory'

The last part is emitted by the system `dlerror` and is thus unportable.
Hopefully the error text itself is the same everywhere.

The following patch adjusts the expected message accordingly.

Tested on `x86_64-pc-linux-gnu` and `amd64-pc-solaris2.11`.

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

23 months ago[Debugify] Precommit test for D136949
Anton Sidorenko [Mon, 21 Nov 2022 10:49:46 +0000 (13:49 +0300)]
[Debugify] Precommit test for D136949

23 months ago[InstCombine] reduce code duplication in foldBitcastExtElt(); NFC
Sanjay Patel [Thu, 24 Nov 2022 14:27:06 +0000 (09:27 -0500)]
[InstCombine] reduce code duplication in foldBitcastExtElt(); NFC

23 months ago[InstCombine] add tests for trunc+insertelt; NFC
Sanjay Patel [Tue, 22 Nov 2022 19:14:27 +0000 (14:14 -0500)]
[InstCombine] add tests for trunc+insertelt; NFC

23 months ago[OpenMP][OMPIRBuilder] Mirgrate getName from clang to OMPIRBuilder
Jan Sjodin [Wed, 9 Nov 2022 16:59:30 +0000 (11:59 -0500)]
[OpenMP][OMPIRBuilder] Mirgrate getName from clang to OMPIRBuilder

This change moves the getName function from clang and moves the separator class
members from CGOpenMPRuntime into OMPIRBuilder. Also enusre all the getters
in the config class are const.

Reviewed By: jdoerfert

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

23 months ago[Alignment][NFC] Use Align in MCStreamer::emitCodeAlignment
Guillaume Chatelet [Thu, 24 Nov 2022 14:27:38 +0000 (14:27 +0000)]
[Alignment][NFC] Use Align in MCStreamer::emitCodeAlignment

This patch makes code less readable but it will clean itself after all functions are converted.

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

23 months ago[include-cleaner] Show details for #include directives (used/unused)
Sam McCall [Thu, 24 Nov 2022 11:34:08 +0000 (12:34 +0100)]
[include-cleaner] Show details for #include directives (used/unused)

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

23 months ago[Alignment][NFC] Use Align in MCStreamer::emitBundleAlignMode
Guillaume Chatelet [Thu, 24 Nov 2022 13:43:11 +0000 (13:43 +0000)]
[Alignment][NFC] Use Align in MCStreamer::emitBundleAlignMode

Summary:

Reviewers: courbet

Subscribers:

23 months ago[SelectOpt] Don't treat LogicalAnd/LogicalOr as selects
David Green [Thu, 24 Nov 2022 14:29:57 +0000 (14:29 +0000)]
[SelectOpt] Don't treat LogicalAnd/LogicalOr as selects

A `select i1 %c, i1 true, i1 %d` is just an or and a `select i1 %c, i1 %d, i1 false`
is just an and. There are better treated as such in the logic of SelectOpt, allowing
the backend to optimize them to and/or directly.

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

23 months ago[include-cleaner] Make Symbol (and Macro) hashable.
Sam McCall [Thu, 24 Nov 2022 11:29:50 +0000 (12:29 +0100)]
[include-cleaner] Make Symbol (and Macro) hashable.

For now, we decided not to add operator< or handle other variants.
(If we do so in future we may want to extract a base class).

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

23 months ago[Format] Don't crash on mismatched brackets
Sam McCall [Thu, 24 Nov 2022 14:13:42 +0000 (15:13 +0100)]
[Format] Don't crash on mismatched brackets

23 months ago[X86] Replace InstRW instregex single matches with instrs entries
Simon Pilgrim [Thu, 24 Nov 2022 14:08:19 +0000 (14:08 +0000)]
[X86] Replace InstRW instregex single matches with instrs entries

This reduces diffs between znver1/znver2 and should marginally speed up tlbgen build time (Issue #35303)

Found by adding a temp check inside InstRegexOp::apply inside single matches

23 months agoFix MSVC "signed/unsigned mismatch" warning. NFC.
Simon Pilgrim [Thu, 24 Nov 2022 13:58:34 +0000 (13:58 +0000)]
Fix MSVC "signed/unsigned mismatch" warning. NFC.

23 months agoFix remaining build errors introduced in D90568 - 15e76eed0c7.
Nathan James [Thu, 24 Nov 2022 14:01:08 +0000 (14:01 +0000)]
Fix remaining build errors introduced in D90568 - 15e76eed0c7.

A few cases were missed in 0923628d26d

23 months ago[include-cleaner] Record macro references in #ifdef clause.
Viktoriia Bakalova [Thu, 24 Nov 2022 13:40:49 +0000 (14:40 +0100)]
[include-cleaner] Record macro references in #ifdef clause.

Records macro references in #ifdef clauses as ambiguous.

Reviewed By: hokein

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

23 months agoFix build error introduced in D90568 - 15e76eed0c7
Nathan James [Thu, 24 Nov 2022 13:42:53 +0000 (13:42 +0000)]
Fix build error introduced in D90568 - 15e76eed0c7

23 months agoRevert "[libcxxabi] Always use thread_local for cxa_exception_storage"
Louis Dionne [Thu, 24 Nov 2022 13:32:10 +0000 (08:32 -0500)]
Revert "[libcxxabi] Always use thread_local for cxa_exception_storage"

This reverts commit 8271aa5335668a1dc62168a4e90b4554bd3a0ca7 since it
broke some downstream builds. See https://reviews.llvm.org/D138461 for
details.

23 months ago[libc++] Keep char_traits<T> for arbitrary T around until LLVM 18
Louis Dionne [Wed, 23 Nov 2022 19:06:14 +0000 (14:06 -0500)]
[libc++] Keep char_traits<T> for arbitrary T around until LLVM 18

This is in response to failures seen after landing D138307.

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

23 months ago[reland][Alignment][NFC] Use the Align type in MCSection
Guillaume Chatelet [Thu, 24 Nov 2022 13:19:00 +0000 (13:19 +0000)]
[reland][Alignment][NFC] Use the Align type in MCSection

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

23 months ago[libc++] Remove P1908 from the status page
Nikolas Klauser [Wed, 16 Nov 2022 13:38:58 +0000 (14:38 +0100)]
[libc++] Remove P1908 from the status page

The paper doesn't include anything affecting the library. AFAICT there isn't even anything to do for the compiler, since it just reserved the std attribute namespace.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

23 months ago[clang] Add [is|set]Nested methods to NamespaceDecl
Nathan James [Thu, 24 Nov 2022 12:44:33 +0000 (12:44 +0000)]
[clang] Add [is|set]Nested methods to NamespaceDecl

Adds support for NamespaceDecl to inform if its part of a nested namespace.
This flag only corresponds to the inner namespaces in a nested namespace declaration.
In this example:
namespace <X>::<Y>::<Z> {}
Only <Y> and <Z> will be classified as nested.

This flag isn't meant for assisting in building the AST, more for static analysis and refactorings.

Reviewed By: aaron.ballman

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

23 months agoRevert D138653 [Alignment][NFC] Use the Align type in MCSection"
Guillaume Chatelet [Thu, 24 Nov 2022 12:42:30 +0000 (12:42 +0000)]
Revert D138653 [Alignment][NFC] Use the Align type in MCSection"

This breaks the bolt project.
This reverts commit 409f0dc4a420db1c6b259d5ae965a070c169d930.

23 months ago[Alignment][NFC] Use the Align type in MCSection
Guillaume Chatelet [Thu, 24 Nov 2022 11:46:33 +0000 (11:46 +0000)]
[Alignment][NFC] Use the Align type in MCSection

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

23 months ago[SCEV] Add printout of symbolic max backedge-taken and block exit count
Max Kazantsev [Thu, 24 Nov 2022 12:28:30 +0000 (19:28 +0700)]
[SCEV] Add printout of symbolic max backedge-taken and block exit count

We do compute it and use in optimizations, but never print it out. We need
to do it in order to be able to track improvements in its computation.

23 months ago[SCEV][NFC] Call getConstantMaxBackedgeTakenCount once in printout
Max Kazantsev [Thu, 24 Nov 2022 11:48:30 +0000 (18:48 +0700)]
[SCEV][NFC] Call getConstantMaxBackedgeTakenCount once in printout

23 months ago[SCEV] Rename max backedge-taken count -> constant max backedge taken-count in printout
Max Kazantsev [Thu, 24 Nov 2022 11:42:16 +0000 (18:42 +0700)]
[SCEV] Rename max backedge-taken count -> constant max backedge taken-count in printout

This is a preparatory step for introducing symbolic max backedge-taken count.

23 months ago[flang][NFC] move genCallOpAndResult into new ConvertCall.cpp file
Jean Perier [Thu, 24 Nov 2022 11:37:13 +0000 (12:37 +0100)]
[flang][NFC] move genCallOpAndResult into new ConvertCall.cpp file

Move genCallOpAndResult from ConvertExpr.cpp into a new file so that
it can be shared with lowering to FIR and HLFIR during the transition.
After the transition, call lowering to HLFIR will be implemented in
this new file.

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

23 months ago[AMDGPU][AsmParser] Refine parsing instruction operands.
Ivan Kosarev [Thu, 24 Nov 2022 10:50:00 +0000 (10:50 +0000)]
[AMDGPU][AsmParser] Refine parsing instruction operands.

Eliminates the need for working around optional and token operands being
mistakenly parsed as expressions.

Reviewed By: dp

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

23 months ago[AMDGPU][CodeGen] Support raw format TFE buffer loads other than byte, short and...
Ivan Kosarev [Thu, 17 Nov 2022 15:38:48 +0000 (15:38 +0000)]
[AMDGPU][CodeGen] Support raw format TFE buffer loads other than byte, short and d16 ones.

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

23 months ago[X86] combine-and.ll - add AVX2/AVX512 test coverage
Simon Pilgrim [Thu, 24 Nov 2022 10:38:05 +0000 (10:38 +0000)]
[X86] combine-and.ll - add AVX2/AVX512 test coverage

23 months ago[SCEV][NFC] Rename MaxNotTaken -> ConstantMaxNotTaken
Max Kazantsev [Thu, 24 Nov 2022 10:18:29 +0000 (17:18 +0700)]
[SCEV][NFC] Rename MaxNotTaken -> ConstantMaxNotTaken

We are going to introduce SymbolicMaxNotTaken, avoid mixing
things up.

Differential Revision: https://reviews.llvm.org/D138568
Reviewed By: lebedev.ri