Jakub Kuderski [Fri, 25 Nov 2022 18:41:24 +0000 (13:41 -0500)]
[mlir][vector] Add fold for ExtractStridedSlice(non-splat ConstantOp)
This allows us to better canonicalize/clean-up code created by the Wide
Integer Emulation pass.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D138606
Jakub Kuderski [Fri, 25 Nov 2022 18:39:35 +0000 (13:39 -0500)]
[mlir][vector] Constant fold sub-vector extraction
This generalizes the existing fold for `ExtractOp(non-splat constant)`
to work with vector results. The vector case is handled by extracting
the subrange of attribute array.
My main use it to clean up code generated by the Wide Integer Emulation
pass.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D138690
Kazu Hirata [Fri, 25 Nov 2022 18:32:21 +0000 (10:32 -0800)]
[Analysis] Use std::optional in MemoryLocation.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Fri, 25 Nov 2022 18:28:54 +0000 (10:28 -0800)]
[Analysis] Use std::optional in LoopAnalysisManager.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Fri, 25 Nov 2022 18:25:36 +0000 (10:25 -0800)]
[Analysis] Use std::optional in LazyValueInfo.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Fri, 25 Nov 2022 18:22:33 +0000 (10:22 -0800)]
[Analysis] Use std::optional in InlineCost.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Fri, 25 Nov 2022 18:18:53 +0000 (10:18 -0800)]
[Analysis] Use std::optional in CGSCCPassManager.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Fri, 25 Nov 2022 18:16:32 +0000 (10:16 -0800)]
[Analysis] Use std::optional in CFLAndersAliasAnalysis.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Fri, 25 Nov 2022 18:11:42 +0000 (10:11 -0800)]
[Analysis] Use std::optional in BasicAliasAnalysis.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Fri, 25 Nov 2022 17:51:25 +0000 (09:51 -0800)]
[include-cleaner] Fix a warning
This patch fixes:
clang-tools-extra/include-cleaner/lib/HTMLReport.cpp:240:51: error:
missing field 'Locations' initializer
[-Werror,-Wmissing-field-initializers]
Craig Topper [Fri, 25 Nov 2022 16:57:34 +0000 (08:57 -0800)]
[RISCV] Add ADD to getRegAllocationHints to improve to improve use of c.add.
add can always be compressed to c.add if one of the sources is the
same as the destination.
The same is not true for c.addw where the registers need to be x8-x15.
Louis Dionne [Fri, 25 Nov 2022 15:25:57 +0000 (10:25 -0500)]
[libc++][NFC] Add missing include to ext/__hash
Note that we use <stddef.h> instead of <cstddef> because we're
using size_t (not std::size_t) and we're outside of namespace std.
Differential Revision: https://reviews.llvm.org/D138716
Craig Topper [Fri, 25 Nov 2022 16:39:44 +0000 (08:39 -0800)]
[RISCV] Use register allocation hints to improve use of compressed instructions.
Compressed instructions usually require one of the source registers
to also be the source register. The register allocator doesn't have
that bias on its own.
This patch adds register allocation hints to introduce this bias.
I've started with ADDI, ADDIW, and SLLI. These all have a 5-bit
field for the register. If the source and dest register are the
same they are guaranteed to compress as long as the immediate is
also 6 bits.
This code was inspired by similar code from the SystemZ target.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D138242
Nicolas Vasilache [Fri, 25 Nov 2022 16:13:08 +0000 (08:13 -0800)]
[mlir][Vector] Add a LowerVectorsOp to VectorTransformOps
This op significantly improves transfor dialect usage when using vector abstractions.
It also brings us closer to writing simple end-to-end unit tests that guard against subtle regressions in how patterns combine.
Differential Revision: https://reviews.llvm.org/D138723
Simon Pilgrim [Fri, 25 Nov 2022 16:24:56 +0000 (16:24 +0000)]
[X86] lowerShuffleAsDecomposedShuffleMerge - try to match unpck(permute(x),permute(y)) for v4i32/v2i64 shuffles
We're using lowerShuffleAsPermuteAndUnpack, which can probably be improved to handle 256/512-bit types pretty easily.
First step towards trying to address the poor vector-shuffle-sse4a.ll pre-SSSE3 codegen mentioned on D127115
Simon Pilgrim [Fri, 25 Nov 2022 16:13:14 +0000 (16:13 +0000)]
[X86] oddshuffles.ll - update check-prefixes
Share AVX common prefix with XOP as well as AVX1/AVX2
Alexander Kornienko [Fri, 25 Nov 2022 15:33:47 +0000 (16:33 +0100)]
Revert "[clang][modules] NFCI: Pragma diagnostic mappings: write/read FileID instead of SourceLocation"
This reverts commit
f61c135a69084e470b73c26a8134785808ee246f. The commit affects
some build setups. See https://reviews.llvm.org/D137213#3939959.
Louis Dionne [Thu, 24 Nov 2022 21:20:11 +0000 (16:20 -0500)]
[libc++][NFC] Remove unused includes from poll_with_backoff.h
Differential Revision: https://reviews.llvm.org/D138687
Florian Hahn [Fri, 25 Nov 2022 15:28:04 +0000 (15:28 +0000)]
[LV] Use separate index to access StoredValues in vectorizeInterleave.
StoredValues only has entries for members of the interleave group. If
there are gaps, then using the index i here will either access a wrong
entry or be out-of-bounds.
Instead use a dedicated index that only gets incremented for members of
the interleave group.
Fixes #59090.
Louis Dionne [Fri, 25 Nov 2022 15:25:10 +0000 (10:25 -0500)]
[libc++][NFC] Consistently use newline between license and include guard
Dmitry Preobrazhensky [Fri, 25 Nov 2022 14:37:24 +0000 (17:37 +0300)]
[AMDGPU][MC] Refactor MC Code Emitter to avoid using magic values
Differential Revision: https://reviews.llvm.org/D138594
Simon Pilgrim [Fri, 25 Nov 2022 14:56:34 +0000 (14:56 +0000)]
[X86] Move lowerShuffleAsPermuteAndUnpack earlier in the source next to similar helpers. NFC.
I'm currently investigating using this inside lowerShuffleAsDecomposedShuffleMerge
Louis Dionne [Thu, 24 Nov 2022 20:18:26 +0000 (15:18 -0500)]
[libc++] Bump AppleClang compiler requirement
Per our policy, the latest released AppleClang has been 14 for a while,
so libc++ is removing support for AppleClang 13. Our CI bots have been
moved to AppleClang 14 a few weeks ago.
Differential Revision: https://reviews.llvm.org/D138685
Jens Massberg [Fri, 25 Nov 2022 14:29:57 +0000 (15:29 +0100)]
[clang-tidy] Ignore cxxRewrittenBinaryOperator in defaulted function decls in modernize-use-nullptr
The check has produced false positives when checking the default implementation of the spaceship operator.
The default implementation should be skipped by the check.
Modified the existing test so that the check runs into the bug without this fix and add another test case.
Fixes #53961.
Patch by Jens Massberg.
Reviewed By: ilya-biryukov
Differential Revision: https://reviews.llvm.org/D138701
Manuel Klimek [Fri, 25 Nov 2022 13:28:55 +0000 (13:28 +0000)]
[NFC] Clean up printing of UnwrappedLines.
Move print functions to start of UnwarppedLineParser so they can be
used from everywhere in the file.
Pull out function that doesn't hard-code the stream.
Louis Dionne [Thu, 24 Nov 2022 19:28:48 +0000 (14:28 -0500)]
[libc++] Use builtins when redeclaring <string.h> functions
When we define the const-correct overloads of <string.h> functions in
libc++ itself, use builtins whenever possible. This avoids depending on
the presence of these functions in the C library headers.
Also, as a fly-by, improve the tests for these functions since we
basically didn't check anything but their signature. We could have
used the wrong builtin (as long as the signature matched) without ever
noticing, which was quite scary.
Differential Revision: https://reviews.llvm.org/D138684
Florian Hahn [Fri, 25 Nov 2022 14:11:56 +0000 (14:11 +0000)]
Revert "[Support] Move getHostNumPhysicalCores to Threading.h"
This reverts commit
5577207d6d3e0642ea047a8dfbfcf3ad372a7f25.
This breaks building LLVM on recent macOS. Error messages below:
llvm/lib/Support/Threading.cpp:190:3: error: use of undeclared
identifier 'sysctlbyname'
sysctlbyname("hw.physicalcpu", &count, &len, NULL, 0);
^
llvm/lib/Support/Threading.cpp:193:13: error: use of undeclared
identifier 'CTL_HW'
nm[0] = CTL_HW;
^
llvm/lib/Support/Threading.cpp:194:13: error: use of undeclared identifier 'HW_AVAILCPU'
nm[1] = HW_AVAILCPU;
^
llvm/lib/Support/Threading.cpp:195:5: error: use of undeclared identifier 'sysctl'
sysctl(nm, 2, &count, &len, NULL, 0);
^
Jamie Schmeiser [Fri, 25 Nov 2022 14:05:59 +0000 (09:05 -0500)]
[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
Manuel Klimek [Fri, 25 Nov 2022 13:53:34 +0000 (13:53 +0000)]
Fix test output regression from
ee88c0cf09969ba44307068797e12533b94768a6.
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.
Valentin Clement [Fri, 25 Nov 2022 13:41:41 +0000 (14:41 +0100)]
[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
LLVM GN Syncbot [Fri, 25 Nov 2022 13:20:54 +0000 (13:20 +0000)]
[gn build] Port
ed34590c1acb
Tiezhu Yang [Fri, 25 Nov 2022 13:18:41 +0000 (21:18 +0800)]
[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
Sam McCall [Fri, 25 Nov 2022 13:01:06 +0000 (14:01 +0100)]
Revert "[Lex] Fix suggested spelling of /usr/bin/../include/foo"
This reverts commit
8bed59c7e7da2fea41a9167e15c15a8f58a5ede7.
Breaks bots e.g. https://lab.llvm.org/buildbot/#/builders/216/builds/13282
Nicolas Vasilache [Tue, 21 Jun 2022 13:52:01 +0000 (06:52 -0700)]
[mlir][Vector] Vector transform skeleton
Differential Revision: https://reviews.llvm.org/D134722
Archibald Elliott [Fri, 25 Nov 2022 12:14:48 +0000 (12:14 +0000)]
[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
Pavel Labath [Fri, 25 Nov 2022 12:48:00 +0000 (13:48 +0100)]
[lldb][nfc] Deindent ProcessGDBRemote::SetThreadStopInfo by two levels
Valentin Clement [Fri, 25 Nov 2022 12:47:25 +0000 (13:47 +0100)]
[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
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
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)
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.
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
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
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)
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
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
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.
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.
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:
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
Benjamin Kramer [Fri, 25 Nov 2022 10:14:14 +0000 (11:14 +0100)]
[Hexagon] Apply
7f06a5824cdb297a19b7c82bb191c22539f34070 to another copy of the same code
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.
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
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
Qiu Chaofan [Fri, 25 Nov 2022 09:20:30 +0000 (17:20 +0800)]
Pre-commit PowerPC case for zero/inf fpclassify
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
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
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
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
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
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
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
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
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
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
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)
Matthias Gehre [Wed, 23 Nov 2022 09:13:15 +0000 (10:13 +0100)]
[InstCombine] Update debug intrinsics when rewriting allocas
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.
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
Max Kazantsev [Fri, 25 Nov 2022 05:49:43 +0000 (12:49 +0700)]
[SCEV][NFC] Rename constructor parameter to match its field name
chenglin.bi [Fri, 25 Nov 2022 05:46:51 +0000 (13:46 +0800)]
[LSR] precommit test for D138636; NFC
Max Kazantsev [Fri, 25 Nov 2022 05:07:16 +0000 (12:07 +0700)]
[SCEV][NFC] Get rid of redundant constructor, replace with default parameter
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
Max Kazantsev [Fri, 25 Nov 2022 04:40:54 +0000 (11:40 +0700)]
[SCEV] Fix misplaced \n in printout of max symbolic exit counts
Fangrui Song [Fri, 25 Nov 2022 04:31:13 +0000 (20:31 -0800)]
[Inliner] Move cl::opt inside llvm::
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.
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
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
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
Guillaume Chatelet [Thu, 24 Nov 2022 19:24:21 +0000 (19:24 +0000)]
[libc] Improve bcmp performance for aarch64
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
Benjamin Kramer [Thu, 24 Nov 2022 19:16:16 +0000 (20:16 +0100)]
[bazel] Add copts attribute to gentbl_cc_library macro.
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
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
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
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
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
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
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
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
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.
Arthur Eubanks [Thu, 24 Nov 2022 17:20:47 +0000 (09:20 -0800)]
[clang-fuzzer] Add missing dependency
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.
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
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
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.
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
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
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
Arthur Eubanks [Thu, 24 Nov 2022 00:59:28 +0000 (16:59 -0800)]
[clang-fuzzer] Use new pass manager for optimizing IR
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