Commit Graph

442996 Commits

Author SHA1 Message Date
Jamie Schmeiser be1ff1fe58 [NFC] Refactor loop peeling code for calculating phi invariance.
Summary:
Refactor loop peeling code by moving code for calculating phi invariance
into a separate class that does the calculation.  Redescribe and rework
the algorithm in preparation for adding increased functionality.  Add
test case that does not exhibit peeling that will be subsequently supported.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: mkazantsev (Max Kazantsev)
Differential Revision: https://reviews.llvm.org/D138232
2022-11-25 09:07:14 -05:00
Manuel Klimek ca8c6156f2 Fix test output regression from ee88c0cf09.
The unused variable fix also remove the test output of the tokens
that do not match, making debugging tests harder. Undo the semantic
changes of the build fix.
2022-11-25 13:53:34 +00:00
Valentin Clement e1eb81f470
[flang] Allow fir.rebox to unlimited polymorphic box
This patch relaxes the verifier for the fir.rebox operation
to allow reboxing to unlimited polymoprhic box.

Reviewed By: jeanPerier, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D138695
2022-11-25 14:42:51 +01:00
LLVM GN Syncbot eddcc01f35 [gn build] Port ed34590c1a 2022-11-25 13:20:54 +00:00
Tiezhu Yang ed34590c1a [LLDB] Add LoongArch register definitions and operations
Use the same register layout as Linux kernel, implement the
related read and write operations.

Reviewed By: SixWeining, xen0n, DavidSpickett

Differential Revision: https://reviews.llvm.org/D138407
2022-11-25 21:19:36 +08:00
Sam McCall 1dc0a1e5d2 Revert "[Lex] Fix suggested spelling of /usr/bin/../include/foo"
This reverts commit 8bed59c7e7.

Breaks bots e.g. https://lab.llvm.org/buildbot/#/builders/216/builds/13282
2022-11-25 14:01:39 +01:00
Nicolas Vasilache c4ce8a40fa [mlir][Vector] Vector transform skeleton
Differential Revision: https://reviews.llvm.org/D134722
2022-11-25 04:51:50 -08:00
Archibald Elliott 5577207d6d [Support] Move getHostNumPhysicalCores to Threading.h
This change is focussed on simplifying `Support/Host.h` to only do
target detection. In this case, this function is close in usage to
existing functions in `Support/Threading.h`, so I moved it into there.
The function is also renamed to `llvm::get_physical_cores()` to match
the style of threading's functions.

Differential Revision: https://reviews.llvm.org/D137836
2022-11-25 12:51:36 +00:00
Pavel Labath b32931c5b3 [lldb][nfc] Deindent ProcessGDBRemote::SetThreadStopInfo by two levels 2022-11-25 13:51:13 +01:00
Valentin Clement 8d692b4b8d
[flang] Avoid crash in lowering for unlimited polymorphic function return
The dynamic type of an unlimited polymorphic entity has the
derived category but does not have derived type spec. This leads
to a crash for a nullptr dereference. This patch avoids this crash
by checking if that the dynamic type is not unlimited polymorphic
before dereferencing the derived type spec.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D138691
2022-11-25 13:47:50 +01:00
LiaoChunyu aa14f002d5 [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
2022-11-25 20:18:30 +08:00
Sam McCall 9d5e82e75c [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)
2022-11-25 13:12:20 +01:00
Alex Richardson 54ad4d2dd1 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.
2022-11-25 11:34:55 +00:00
Alex Richardson d77b7cac27 [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
2022-11-25 11:34:55 +00:00
Archibald Elliott 3e9b6adfc7 [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
2022-11-25 11:33:53 +00:00
Simon Pilgrim 6fd0ae39be [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)
2022-11-25 11:16:24 +00:00
Simon Pilgrim b883e9f392 [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
2022-11-25 11:16:24 +00:00
Sam McCall 6a95e67323 [include-cleaner] HTMLReport shows headers that would be inserted
Demo: 7911d8251c/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
2022-11-25 11:57:35 +01:00
Pavel Labath c699a81bc9 [lldb/test] Remove the module cache directory in module-ownership.mm
The stale cache directory can cause compilation to fail when ast
serialization changes.
2022-11-25 11:55:42 +01:00
Pavel Labath 3427cb5b3a [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.
2022-11-25 11:55:41 +01:00
Thomas Preud'homme b62c8d396f Revert: Add version to all LLVM cmake package
Summary: This reverts commit ad485b71b5.

Reviewers:

Subscribers:
2022-11-25 10:54:58 +00:00
Benjamin Maxwell 79b5829a15 [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
2022-11-25 10:15:14 +00:00
Benjamin Kramer b89e0acb5e [Hexagon] Apply 7f06a5824c to another copy of the same code 2022-11-25 11:14:14 +01:00
Benjamin Kramer 7f06a5824c [Hexagon] Put asserts in an !NDEBUG region. NFCI
Avoids unused variables in NDEBUG builds.
2022-11-25 11:02:16 +01:00
Sam McCall 8bed59c7e7 [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
2022-11-25 11:01:22 +01:00
Phoebe Wang 2e5366ac2e [NFC] Change `dyn_cast` to `cast` to make sure no dereference on nullptr 2022-11-25 17:40:37 +08:00
Qiu Chaofan b9be5a6823 Pre-commit PowerPC case for zero/inf fpclassify 2022-11-25 17:37:41 +08:00
Balazs Benics 097ce76165 [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
2022-11-25 10:24:56 +01:00
Balazs Benics 3648175839 [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
2022-11-25 10:24:56 +01:00
Kazushi (Jam) Marukawa a89c9bafe6 [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
2022-11-25 17:52:20 +09:00
Lorenzo Chelini a9733b8a5e [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
2022-11-25 09:43:30 +01:00
Jean Perier 36f61d14fb [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
2022-11-25 09:39:39 +01:00
Jean Perier 94b9fbabe8 [flang] Lower concatenation to hlfir.concat
Differential Revision: https://reviews.llvm.org/D138664
2022-11-25 09:36:58 +01:00
Jean Perier 8dea00f4e7 [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
2022-11-25 09:34:15 +01:00
Valentin Clement fa3587d63e
[flang] Remove debug option
Remove debug option added by mistake in D138587
2022-11-25 09:30:17 +01:00
Evgeniy Brevnov 721f975d35 Use PassGate from LLVMContext if any otherwise global one
Differential Revision: https://reviews.llvm.org/D137149
2022-11-25 15:13:04 +07:00
Anton Sidorenko 8e3545a64e [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
2022-11-25 10:53:55 +03:00
Max Kazantsev 06c4103d41 [Test] Add couple more tests where we can compute symbolic max exit count (fixed) 2022-11-25 14:40:32 +07:00
Matthias Gehre 5a1d92fa3e [InstCombine] Update debug intrinsics when rewriting allocas 2022-11-25 08:20:54 +01:00
Max Kazantsev eb95ab5745 Revert "[Test] Add couple more tests where we can compute symbolic max exit count"
This reverts commit 7e3373c9e1.

Some changes that were not supposed to be commited came with it.
2022-11-25 13:37:24 +07:00
Max Kazantsev 7e3373c9e1 [Test] Add couple more tests where we can compute symbolic max exit count 2022-11-25 13:35:16 +07:00
Max Kazantsev 98307381d4 [SCEV][NFC] Rename constructor parameter to match its field name 2022-11-25 12:59:05 +07:00
chenglin.bi 15e41467f0 [LSR] precommit test for D138636; NFC 2022-11-25 13:46:51 +08:00
Max Kazantsev 04b9a70fec [SCEV][NFC] Get rid of redundant constructor, replace with default parameter 2022-11-25 12:07:41 +07:00
Max Kazantsev b9c1d73725 [Test] Add test showing that SCEV fails to evaluate symbolic max for 'and' conditions 2022-11-25 11:45:10 +07:00
Max Kazantsev 4496d553bd [SCEV] Fix misplaced \n in printout of max symbolic exit counts 2022-11-25 11:41:36 +07:00
Fangrui Song fa71c16455 [Inliner] Move cl::opt inside llvm:: 2022-11-24 20:31:13 -08:00
Krzysztof Parzyszek d9ed93da86 [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.
2022-11-24 18:10:42 -08:00
Volodymyr Sapsai 0314ba3acb [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
2022-11-24 14:26:02 -08:00
Martin Storsjö fb947c3586 [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
2022-11-24 23:06:21 +02:00