Lei Zhang [Mon, 4 Apr 2022 21:19:44 +0000 (17:19 -0400)]
[mlir][spirv] Check nullptr before usage to fix crash
Reviewed By: mravishankar, hanchung
Differential Revision: https://reviews.llvm.org/D123035
Jason Molenda [Mon, 4 Apr 2022 21:11:21 +0000 (14:11 -0700)]
Add DumpBinaryEscaped method to JSONGenerator, avoid extra copy
All uses of JSONGenerator in debugserver would create a JSON text
dump of the object collection, then copy that string into a
binary-escaped string, then send it up to the lldb side or
make a compressed version and send that.
This adds a DumpBinaryEscaped method to JSONGenerator which
does the gdb remote serial protocol binary escaping directly,
and removes the need to pass over the string and have an
additional copy in memory.
Differential Revision: https://reviews.llvm.org/D122882
rdar://
91117456
Amir Ayupov [Mon, 4 Apr 2022 21:04:39 +0000 (14:04 -0700)]
[BOLT][NFC] Use X86 mnemonic checks
Remove switches in X86MCPlusBuilder.cpp, use mnemonic checks instead
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D122853
River Riddle [Thu, 31 Mar 2022 00:00:37 +0000 (17:00 -0700)]
[mlir] Rework the implementation of TypeID
This commit restructures how TypeID is implemented to ideally avoid
the current problems related to shared libraries. This is done by changing
the "implicit" fallback path to use the name of the type, instead of using
a static template variable (which breaks shared libraries). The major downside to this
is that it adds some additional initialization costs for the implicit path. Given the
use of type names for uniqueness in the fallback, we also no longer allow types
defined in anonymous namespaces to have an implicit TypeID. To simplify defining
an ID for these classes, a new `MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID` macro
was added to allow for explicitly defining a TypeID directly on an internal class.
To help identify when types are using the fallback, `-debug-only=typeid` can be
used to log which types are using implicit ids.
This change generally only requires changes to the test passes, which are all defined
in anonymous namespaces, and thus can't use the fallback any longer.
Differential Revision: https://reviews.llvm.org/D122775
Martin Storsjö [Wed, 23 Mar 2022 13:47:49 +0000 (15:47 +0200)]
[libcxx] Stop recommending setting LIBCXX_HAS_WIN32_THREAD_API in the MinGW builds
Since
a8d15a926689c126c4d316788786e0160cfc1d5d / D110975, this is
the default, even if winpthread headers are available, so we don't
need to cargo cult setting this option in all builds.
Differential Revision: https://reviews.llvm.org/D122717
Aaron Ballman [Mon, 4 Apr 2022 19:57:25 +0000 (15:57 -0400)]
Require C99 for more tests; NFC intended
This augments
5d90004874c7b040cd43597826aabb34757d25ab which got all of
the -verify lines, but accidentally missed all of the -verify= ones.
wren romano [Fri, 1 Apr 2022 19:51:39 +0000 (12:51 -0700)]
[mlir][sparse] Simplifying code in expInsert
Just some minor cleanup
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D122934
Rob Suderman [Mon, 4 Apr 2022 19:22:09 +0000 (12:22 -0700)]
[tosa] Add option to disable tosa.apply_scale lowering in TosaToStandard
Apply scale should be optionally disabled when lowering via TosaToStandard.
In most cases it should persist until the lowering to specific backend.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D122948
Sam McCall [Mon, 4 Apr 2022 18:52:46 +0000 (20:52 +0200)]
[clangd] Remove trivial uses of FileEntry::getName
It's deprecated; migrate to FileEntryRef::getName where it doesn't matter.
Also change one subtle case of implicit FileEntry::getName to be explicit.
After this patch, all the remaining FileEntry::getName calls are subtle
cases where we may be relying on exactly which filename variant is returned
(for indexing, IWYU directive handling, etc).
Simon Pilgrim [Mon, 4 Apr 2022 18:47:06 +0000 (19:47 +0100)]
[X86] Add XOR(X, MIN_SIGNED_VALUE) -> ADD(X, MIN_SIGNED_VALUE) isel patterns (PR52267)
Improve chances of folding to LEA patterns
Differential Revision: https://reviews.llvm.org/D123043
Daniel Resnick [Mon, 4 Apr 2022 18:26:13 +0000 (12:26 -0600)]
[mlir][capi] Fix leak in test
Mehdi Amini [Sun, 3 Apr 2022 22:16:53 +0000 (22:16 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in FuncToLLVM.cpp (NFC)
Mitch Phillips [Wed, 9 Feb 2022 23:43:37 +0000 (15:43 -0800)]
[ELF][MTE] Add --android-memtag-* options to synthesize ELF notes
This ELF note is aarch64 and Android-specific. It specifies to the
dynamic loader that specific work should be scheduled to enable MTE
protection of stack and heap regions.
Current synthesis of the ".note.android.memtag" ELF note is done in the
Android build system. We'd like to move that to the compiler. This patch
adds the --memtag-stack, --memtag-heap, and --memtag-mode={async, sync,
none} flags to the linker, which synthesises the note for us.
Future changes will add -fsanitize=memtag* flags to clang which will
pass these through to lld.
Depends on D119381.
Differential Revision: https://reviews.llvm.org/D119384
Vang Thao [Mon, 4 Apr 2022 16:53:48 +0000 (09:53 -0700)]
[AMDGPU] Ignore debug use during PreRARematerialize stage in scheduling pass
Ignore all debug uses when collecting trivially rematerializable defs. This fixes an issue with difference in codegen when enabling debug info.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D123048
Siva Chandra Reddy [Sat, 2 Apr 2022 00:05:05 +0000 (00:05 +0000)]
[libc] Add pthread_mutexattr_t type and its setters and getters.
A simple implementation of the getters and setters has been added. More
logic can be added to them in future as required.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D122969
Daniel Grumberg [Thu, 31 Mar 2022 10:36:53 +0000 (11:36 +0100)]
[clang][extract-api][NFC] Add documentation
Add struct level documentation for MacroDefinitionRecord.
Differential Revision: https://reviews.llvm.org/D122798
Louis Dionne [Thu, 31 Mar 2022 13:25:31 +0000 (09:25 -0400)]
[libc++] Fix std::is_array<T[0]> and add tests
Differential Revision: https://reviews.llvm.org/D122810
Aaron Ballman [Mon, 4 Apr 2022 17:41:10 +0000 (13:41 -0400)]
Require C99 for these tests; NFC intended
The tests are doing -verify and testing a diagnostic behavior, but that
behavior is changing. This ensures the tests continue to run and check
the diagnostic.
The behavior of the tests is expected to remain identical as before.
Johannes Doerfert [Fri, 25 Feb 2022 17:36:24 +0000 (11:36 -0600)]
[Attributor] Allow to reproduce instructions for simplification
When simplify values we might end up with an instruction from a
different scope or just one that does not dominate the use. If the
instruction can be reproduced without side-effect (incl. UB) we can
now do that. For now this is mostly used for speculatable (intrinsic)
calls but as we learn to make things like arguments or loads available
this will become more powerful.
This will also allow us to remove dead stores more easily in a follow
up.
antonio-cortes-perez [Mon, 4 Apr 2022 16:10:27 +0000 (09:10 -0700)]
[MLIR][NFC] Remove unnecessary cast.
I was reading this post:
https://www.fluentcpp.com/2017/05/19/crtp-helper/
And I noticed that most likely this cast is not needed.
Unless it is needed by some compiler versions.
I tested it with:
cmake --build . --target check-mlir
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D121555
Florian Hahn [Mon, 4 Apr 2022 16:58:48 +0000 (17:58 +0100)]
[LV] Add addiitonal tests for pointer difference memory checks.
Additional tests for D119078.
Benjamin Kramer [Mon, 4 Apr 2022 16:51:35 +0000 (18:51 +0200)]
[mlir][capi] Unbreak Interfaces CAPI after
2387fadea3
No idea why check-mlir doesn't build this.
Luboš Luňák [Sat, 2 Apr 2022 15:06:24 +0000 (17:06 +0200)]
[lldb] make ConstStringTable use DenseMap rather than std::map
The ordering is not needed, and DenseMap is faster. I can measure
time spent in the SaveToCache() calls reduced to ~40% during LLDB
startup (and the total startup cost reduced to ~70%).
Differential Revision: https://reviews.llvm.org/D122980
David Green [Mon, 4 Apr 2022 16:42:20 +0000 (17:42 +0100)]
[AArch64] Increase cost of v2i64 multiplies
The cost of a v2i64 multiply was special cased in D92208 as scalarized
into 4*extract + 2*insert + 2*mul. Scalarizing to/from gpr registers are
expensive though, and the cost wasn't high enough to prevent vectorizing
in places where it can be detrimental for performance. This increases it
so that the costs of copying to/from GPRs is increased to 2 each, with
the total cost increasing to 14. So long as umull/smull are handled
correctly (as in D123006) this seems to lead to better vectorization
factors and better performance.
Differential Revision: https://reviews.llvm.org/D123007
Siddharth Bhat [Mon, 4 Apr 2022 16:35:33 +0000 (22:05 +0530)]
[MLIR] Add nested symbols into LangRef
Add documentation into the LangRef for parsing nested symbols.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D122977
Alex Brachet [Mon, 4 Apr 2022 16:33:33 +0000 (16:33 +0000)]
Revert "Reland "[lit] Use sharding for GoogleTest format""
This reverts commit
948f3deca91a66caf4a618f826ff6de8277bed9c.
Groverkss [Mon, 4 Apr 2022 16:31:06 +0000 (22:01 +0530)]
Revert "[MLIR] Add nested symbols into LangRef"
Reverted because commit pushed with wrong author information
This reverts commit
b4865dd67f05a4c4680eaa6d257553a48bc704e0.
Siddharth Bhat [Mon, 4 Apr 2022 16:24:17 +0000 (21:54 +0530)]
[MLIR] Add booleans to dense element list in LangRef
Add boolean values as a dense element, as tested in the MLIR parser:
```
// CHECK: "splatBoolTensor"() {bar = dense<false> : tensor<i1>} : () -> ()
"splatBoolTensor"(){bar = dense<false> : tensor<i1>} : () -> ()
```
https://github.com/llvm/llvm-project/blob/
43d758b142bbdf94a1c55dc0950637ae74f825b9/mlir/test/IR/parser.mlir#L630-L631
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D122978
Groverkss [Mon, 4 Apr 2022 16:23:08 +0000 (21:53 +0530)]
[MLIR] Add nested symbols into LangRef
Add documentation into the LangRef for parsing nested symbols.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D122977
Daniel Resnick [Wed, 16 Mar 2022 22:31:08 +0000 (16:31 -0600)]
[mlir][capi] Add external pass creation to MLIR C-API
Adds the ability to create external passes using the C-API. This allows passes
to be written in C or languages that use the C-bindings.
Differential Revision: https://reviews.llvm.org/D121866
Jonas Devlieghere [Mon, 4 Apr 2022 16:17:01 +0000 (09:17 -0700)]
[lldb] Prevent object file plugins from changing the data buffer
The current design allows that the object file contents could be mapped
by one object file plugin and then used by another. Presumably the idea
here was to avoid mapping the same file twice.
This becomes an issue when one object file plugin wants to map the file
differently from the others. For example, ObjectFileELF needs to map its
memory as writable while others likeObjectFileMachO needs it to be
mapped read-only.
This patch prevents plugins from changing the buffer by passing them is
by value rather than by reference.
Differential revision: https://reviews.llvm.org/D122944
Sergei Grechanik [Mon, 4 Apr 2022 15:48:08 +0000 (08:48 -0700)]
[MLIR] Fix MLIR vim syntax file
This commit fixes several things in the MLIR vim syntax file:
- Spell checking is now on by default only in comments.
- '#' now starts an identifier instead of starting an outline attribute
declaration, which fixes coloring the rest of the line as a
preprocessor directive when there is a '#' in the middle.
- '!' and '^' -prefixed identifiers are now colored as types
and labels.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D122626
Jeremy Morse [Mon, 4 Apr 2022 16:14:58 +0000 (17:14 +0100)]
Revert "[DebugInfo] Correctly recognize bitfields when emitting dwarf"
This reverts commit
059d1f84d2d59093300a81c246de81b1c1da767b.
Some tests on green dragon failed as a result of this -- see notes on D96334.
Ilia Diachkov [Mon, 4 Apr 2022 16:05:06 +0000 (09:05 -0700)]
Fix nulltpr typo in comment. NFC
The patch fixes the typo "nulltpr", accidentally found in comments.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D122993
Adrian Prantl [Mon, 4 Apr 2022 15:54:59 +0000 (08:54 -0700)]
Prevent GetAugmentedArchSpec() from attaching "unknown" environments
Environments are optional and a missing environment is distinct from
the default "unknown" environment enumerator. The test is negative,
because the function uses the host triple and is unpredictable.
rdar://
91007207
https://reviews.llvm.org/D122946
Differential Revision: https://reviews.llvm.org/D122946
Priyansh Singh [Mon, 4 Apr 2022 15:32:05 +0000 (11:32 -0400)]
Correct a typo in a RUN line
gbreynoo [Mon, 4 Apr 2022 15:18:17 +0000 (16:18 +0100)]
[llvm-objcopy][docs] Update --update-section description
I noticed that when --update-section was added to llvm-objcopy it was
not added to the command guide, see
25bcd94234530955c58c6530a9271c813827637c. This change adds it to the
docs and updates the help text.
Differential Revision: https://reviews.llvm.org/D122907
PeixinQiao [Mon, 4 Apr 2022 15:16:30 +0000 (23:16 +0800)]
[flang] Add one semantic check for allocatable/pointer argument association
The actual argument shall have deferred the same type parameters as
the dummy argument if the argument is allocatable or pointer variable.
Currently programs not following this get one crash during execution.
Reviewed By: Jean Perier
Differential Revision: https://reviews.llvm.org/D122779
Thomas Preud'homme [Mon, 4 Apr 2022 15:09:07 +0000 (16:09 +0100)]
[Pipeliner] Fix comment typo
Erich Keane [Mon, 4 Apr 2022 14:28:29 +0000 (07:28 -0700)]
Attempt to re-enable demangle test in mangle-nttp-anon-union
@thakis believes the problem was the lack of -n on my llvm-cxxfilt call,
so hopefully this is the only problem. Committing to see if this makes
all the buildbots happy.
Hirochika Matsumoto [Wed, 30 Mar 2022 18:53:11 +0000 (03:53 +0900)]
[InstSimplify] Fold (ctpop(X) == N) || (X != 0) into X != 0 where N > 0
(ctpop(X) == N) || (X != 0) --> (X != 0) https://alive2.llvm.org/ce/z/udgUVV
(ctpop(X) != N) && (X == 0) --> (X == 0) https://alive2.llvm.org/ce/z/9dq-cR
Differential Revision: https://reviews.llvm.org/D122757
Nico Weber [Mon, 4 Apr 2022 14:18:08 +0000 (10:18 -0400)]
fix comment typos to cycle bots
Nico Weber [Mon, 4 Apr 2022 13:23:15 +0000 (09:23 -0400)]
[gn build] Always make symlinks target explicitly depend on base binary
This is a no-op in these files since the symlinks array is never empty
and the dependency to the base binary is added through the loop in these
cases.
But adding them doesn't hurt either, and it:
1. Makes all symlinks targets look the same, independent of symlinks
are created always or just conditionally based on gn args
2. Makes it less likely that bugs like the one fixed by
b0abada8fe7e
are introduced by copy-pasting an existing symlink target and then
not being careful enough when tweaking it.
No behavior change.
LLVM GN Syncbot [Mon, 4 Apr 2022 13:48:25 +0000 (13:48 +0000)]
[gn build] Port
980c3e6dd223
Erich Keane [Mon, 4 Apr 2022 13:25:07 +0000 (06:25 -0700)]
Reapply"[GH54588]Fix ItaniumMangler for NTTP unnamed unions w/ unnamed structs"
AND the followups that fixed builds.
I attempted to get 'cute' and use llvm-cxxfilt to make the test look
nicer, but apparently some of the bots have a version of llvm-cxxfilt
that is not the in-tree one, so it fails to properly demangle the stuff.
I've disabled this "RUN" line.
This reverts commit
50186b63d1807d389f31c515377d94185795ab44.
Momchil Velikov [Mon, 4 Apr 2022 09:01:30 +0000 (10:01 +0100)]
[CodeGen] Async unwind - add a pass to fix CFI information
This pass inserts the necessary CFI instructions to compensate for the
inconsistency of the call-frame information caused by linear (non-CFG
aware) nature of the unwind tables.
Unlike the `CFIInstrInserer` pass, this one almost always emits only
`.cfi_remember_state`/`.cfi_restore_state`, which results in smaller
unwind tables and also transparently handles custom unwind info
extensions like CFA offset adjustement and save locations of SVE
registers.
This pass takes advantage of the constraints that LLVM imposes on the
placement of save/restore points (cf. `ShrinkWrap.cpp`):
* there is a single basic block, containing the function prologue
* possibly multiple epilogue blocks, where each epilogue block is
complete and self-contained, i.e. CSR restore instructions (and the
corresponding CFI instructions are not split across two or more
blocks.
* prologue and epilogue blocks are outside of any loops
Thus, during execution, at the beginning and at the end of each basic
block the function can be in one of two states:
- "has a call frame", if the function has executed the prologue, or
has not executed any epilogue
- "does not have a call frame", if the function has not executed the
prologue, or has executed an epilogue
These properties can be computed for each basic block by a single RPO
traversal.
In order to accommodate backends which do not generate unwind info in
epilogues we compute an additional property "strong no call frame on
entry" which is set for the entry point of the function and for every
block reachable from the entry along a path that does not execute the
prologue. If this property holds, it takes precedence over the "has a
call frame" property.
From the point of view of the unwind tables, the "has/does not have
call frame" state at beginning of each block is determined by the
state at the end of the previous block, in layout order.
Where these states differ, we insert compensating CFI instructions,
which come in two flavours:
- CFI instructions, which reset the unwind table state to the
initial one. This is done by a target specific hook and is
expected to be trivial to implement, for example it could be:
```
.cfi_def_cfa <sp>, 0
.cfi_same_value <rN>
.cfi_same_value <rN-1>
...
```
where `<rN>` are the callee-saved registers.
- CFI instructions, which reset the unwind table state to the one
created by the function prologue. These are the sequence:
```
.cfi_restore_state
.cfi_remember_state
```
In this case we also insert a `.cfi_remember_state` after the
last CFI instruction in the function prologue.
Reviewed By: MaskRay, danielkiss, chill
Differential Revision: https://reviews.llvm.org/D114545
Nathan Sidwell [Fri, 25 Mar 2022 11:34:19 +0000 (04:34 -0700)]
[demangler] Parenthesize >> inside template args
Both > and >> expressions need to be parenthesized inside template
argument lists.
Reviewed By: dblaikie, rjmccall
Differential Revision: https://reviews.llvm.org/D122474
Sam McCall [Mon, 4 Apr 2022 13:30:11 +0000 (15:30 +0200)]
[pseudo] respect CLANG_INCLUDE_TESTS
Nico Weber [Mon, 4 Apr 2022 13:18:24 +0000 (09:18 -0400)]
[gn build] llvm-lipo, llvm-libtool-darwin symlink targets now dep on binary
This fixes a regression from
69cde915e923d: If llvm_install_cctools_symlinks
is false, depending llvm-lipo:symlinks didn't actually depend on llvm-lipo
and the binary didn't get built as dependency of `check-lld` (because the
`symlinks` array ended up empty).
Louis Dionne [Mon, 4 Apr 2022 13:10:52 +0000 (09:10 -0400)]
[libc++][NFC] Rename generate_assertion_tests.py to generate_header_tests.py
Louis Dionne [Fri, 25 Mar 2022 21:06:46 +0000 (17:06 -0400)]
[libc++] Implement all public header tests using the new generator
Note that `generate_assertion_tests.py` will be renamed to
`generate_header_tests.py` separately to facilitate change tracking.
Differential Revision: https://reviews.llvm.org/D123000
Nico Weber [Mon, 4 Apr 2022 12:56:07 +0000 (08:56 -0400)]
fix comment typos to cycle bots
Simon Pilgrim [Mon, 4 Apr 2022 12:30:04 +0000 (13:30 +0100)]
[DAG] SimplifySetCC - clang-format add/xor/sub with constant handling. NFC.
Yitzhak Mandelbaum [Fri, 1 Apr 2022 12:51:23 +0000 (12:51 +0000)]
[clang][dataflow] Add support for clang's `__builtin_expect`.
This patch adds basic modeling of `__builtin_expect`, just to propagate the
(first) argument, making the call transparent.
Driveby: adds tests for proper handling of other builtins.
Differential Revision: https://reviews.llvm.org/D122908
Pavel Samolysov [Mon, 4 Apr 2022 08:23:24 +0000 (11:23 +0300)]
[clang][NFC] Extract the EmitAssemblyHelper::TargetTriple member
Few times in different methods of the EmitAssemblyHelper class the following
code snippet is used to get the TargetTriple and then use it's single method
to check some conditions:
TargetTriple(TheModule->getTargetTriple())
The parsing of a target triple string is not a trivial operation and it takes
time to repeat the parsing many times in different methods of the class and
even numerous times in one method just to call a getter
(llvm::Triple(TheModule->getTargetTriple()).getVendor()), for example.
The patch extracts the TargetTriple member of the EmitAssemblyHelper class to
parse the triple only once in the class' constructor.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D122587
Simon Pilgrim [Mon, 4 Apr 2022 11:48:20 +0000 (12:48 +0100)]
[Thumb2] Regenerate thumb2-teq2 tests
PeixinQiao [Mon, 4 Apr 2022 11:46:16 +0000 (19:46 +0800)]
[mlir] Fix the build error in OpenMPToLLVMIRTranslation.cpp
Fix the build error with "-Werror,-Wcovered-switch-default".
Reviewed By: hpmorgan
Differential Revision: https://reviews.llvm.org/D123018
David Green [Mon, 4 Apr 2022 11:45:04 +0000 (12:45 +0100)]
[AArch64] Teach the costmodel about widening muls
A vector mul(sext, sext) or mul(zext, zext) will be code generated as a
single smull or umull instruction. This most notably effects v2i64
multiplies, which are otherwise not legal and need to be expanded.
The oneuse check has also been slightly changed, as it is already
checked from the use of isWideningInstruction in getCastInstrCost.
Differential Revision: https://reviews.llvm.org/D123006
Simon Pilgrim [Mon, 4 Apr 2022 11:24:30 +0000 (12:24 +0100)]
[Thumb2] Regenerate thumb2-teq tests
David Spickett [Fri, 18 Mar 2022 11:48:54 +0000 (11:48 +0000)]
[lldb][AArch64] Update disassembler feature list and add tests for all extensions
This updates the disassembler to enable every optional extension.
Previously we had added things that we added "support" for in lldb.
(where support means significant work like new registers, fault types, etc.)
Something like TME (transactional memory) wasn't added because
there are no new lldb features for it. However we should still be
disassembling the instructions.
So I went through the AArch64 extensions and added all the missing
ones. The new test won't prevent us missing a new extension but it
does at least document our current settings.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D121999
Simon Pilgrim [Mon, 4 Apr 2022 11:19:31 +0000 (12:19 +0100)]
[MIPS] Regenerate countleading tests with common check prefixes
David Green [Mon, 4 Apr 2022 11:19:45 +0000 (12:19 +0100)]
[AArch64] Add widening arithmetic cost tests. NFC
Nikita Popov [Mon, 4 Apr 2022 10:59:17 +0000 (12:59 +0200)]
[ConstantFold] Fold zero-index GEPs with opaque pointers
With opaque pointers, we can eliminate zero-index GEPs even if
they have multiple indices, as this no longer impacts the result
type of the GEP.
This optimization is already done for instructions in InstSimplify,
but we were missing the corresponding constant expression handling.
The constexpr transform is a bit more powerful, because it can
produce a vector splat constant and also handles undef values --
it is an extension of an existing single-index transform.
Nikita Popov [Mon, 4 Apr 2022 11:00:00 +0000 (13:00 +0200)]
[InstSimplify] Add tests for zero-offset opaque ptr constexpr GEP (NFC)
Simon Pilgrim [Mon, 4 Apr 2022 11:02:23 +0000 (12:02 +0100)]
[X86] Regenerate peep tests checks
Muhammad Omair Javaid [Mon, 4 Apr 2022 10:30:57 +0000 (15:30 +0500)]
Revert "[NFCI] Regenerate PhaseOrdering test checks"
This reverts commit
e91fe08999d5f5d7e7777837c529bac692d06c1b.
Breaks following buildbots: https://lab.llvm.org/buildbot/#/builders/171
Andrzej Warzynski [Mon, 28 Mar 2022 16:13:59 +0000 (16:13 +0000)]
[flang] Update the conversion code for fir.coordinate_of
These are mostly small changes to make the code a bit clearer and more
consistent. Summary of changes:
* add missing namespace qualifiers (that's the preference in Flang)
* replace const member methods with static methods (to avoid passing
the *this pointer unnecessarily)
* rename `currentObjTy` (current object type) as `cpnTy` (component
type) - the latter feels more fitting
* remove redundant `return failure();` calls (` return
mlir::emitError` gives the same result)
* updated a few comments
Differential Revision: https://reviews.llvm.org/D122799
Jeremy Morse [Mon, 4 Apr 2022 10:11:24 +0000 (11:11 +0100)]
[DebugInfo] Correctly recognize bitfields when emitting dwarf
Use the "isBitfield" flag for debug types to determine whether something is
a bitfield, rather than trying to guess from it's layout. Fixes
https://bugs.llvm.org/show_bug.cgi?id=44601
Patch by: mahkoh
Differential Revision: https://reviews.llvm.org/D96334
Simon Pilgrim [Mon, 4 Apr 2022 09:51:26 +0000 (10:51 +0100)]
[X86] Support optional NOT stages in the AND(SRL(X,Y),1) -> SETCC(BT(X,Y)) fold
Extension to D122891, peek through NOT() ops, adjusting the condcode as we go.
Simon Pilgrim [Mon, 4 Apr 2022 09:29:20 +0000 (10:29 +0100)]
[X86] Add additional test cases for NOT(AND(SRL(X,Y),1))/AND(SRL(NOT(X(,Y),1) -> SETCC(BT(X,Y))
As suggested in post review on D122891
Florian Hahn [Mon, 4 Apr 2022 09:26:01 +0000 (10:26 +0100)]
[VPlan] Update VPInterleavedAccessInfo to use getVectorLoopRegion.
Update VPInterleavedAccessInfo to use the generic getVectorLoopRegion
helper instead of relying on the entry block being the top-most vector
loop region.
Martin Sebor [Mon, 4 Apr 2022 08:31:03 +0000 (10:31 +0200)]
[SimplifyLibCalls] Optimize memchr() with known char+str and unknown length
If both the character and string are known, but the length
potentially isn't, we can optimize the memchr() call to a select
of either the known position of the character or null.
Split off from https://reviews.llvm.org/D122836.
Martin Sebor [Mon, 4 Apr 2022 08:47:59 +0000 (10:47 +0200)]
[SimplifyLibCalls] Move handling of constant char earlier (NFC)
Handle the simple constant char case before the bitmask optimization.
This will allow extending the code to handle a non-constant size
argument in a followup change.
Split out from https://reviews.llvm.org/D122836.
Valentin Clement [Mon, 4 Apr 2022 08:44:21 +0000 (10:44 +0200)]
[flang][NFC] Add tests for array-value-copy pass with array with pointers
This patch adds tests for the array-value-copy pass with array assignment
involving Fortran pointers.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D122878
Martin Sebor [Mon, 4 Apr 2022 08:36:57 +0000 (10:36 +0200)]
[SimplifyLibCalls] Fold memchr() with size 1
If the memchr() size is 1, then we can convert the call into a
single-byte comparison. This works even if both the string and the
character are unknown.
Split off from https://reviews.llvm.org/D122836.
Martin Sebor [Mon, 4 Apr 2022 08:32:40 +0000 (10:32 +0200)]
[InstCombine] Add additional memchr test (NFC)
And fix some test names / comments.
Florian Hahn [Mon, 4 Apr 2022 08:27:15 +0000 (09:27 +0100)]
[VPlan] Remember previous loop and reset vector loop.
At the moment this is NFC, but will be needed once nested loops are also
modeled as regions. Preparation for D123005.
Nikita Popov [Fri, 1 Apr 2022 14:33:35 +0000 (16:33 +0200)]
[MemCpyOpt] Work around PR54682
As discussed on https://github.com/llvm/llvm-project/issues/54682,
MemorySSA currently has a bug when computing the clobber of calls
that access loop-varying locations. I think a "proper" fix for this
on the MemorySSA side might be non-trivial, but we can easily work
around this in MemCpyOpt:
Currently, MemCpyOpt uses a location-less getClobberingMemoryAccess()
call to find a clobber on either the src or dest location, and then
refines it for the src and dest clobber. This was intended as an
optimization, as the location-less API is cached, while the
location-affected APIs are not.
However, I don't think this really makes a difference in practice,
because I don't think anything will use the cached clobbers on
those calls later anyway. On CTMark, this patch seems to be very
mildly positive actually.
So I think this is a reasonable way to avoid the problem for now,
though MemorySSA should also get a fix.
Differential Revision: https://reviews.llvm.org/D122911
Nikita Popov [Fri, 1 Apr 2022 10:28:21 +0000 (12:28 +0200)]
[Float2Int] Make sure dependent ranges are calculated first (PR54669)
The range calculation in walkForwards() assumes that the ranges of
the operands have already been calculated. With the used visit
order, this is not necessarily the case when there are multiple
roots. (There is nothing guaranteeing that instructions are visited
in topological order.)
Fix this by queuing instructions for reprocessing if the operand
ranges haven't been calculated yet.
Fixes https://github.com/llvm/llvm-project/issues/54669.
Differential Revision: https://reviews.llvm.org/D122817
Jean Perier [Mon, 4 Apr 2022 07:47:03 +0000 (09:47 +0200)]
[flang] Fold instantiated PDT character component length when needed
In case a character component PDT length only depends on kind parameters,
fold it while instantiating the PDT. This is especially important if the
component has an initializer because later semantic phases (offset
computation or runtime type info generation) might get confused and
generate offset/type info that will lead to crashes in lowering.
Differential Revision: https://reviews.llvm.org/D122938
Valentin Clement [Mon, 4 Apr 2022 07:25:28 +0000 (09:25 +0200)]
[flang][NFC] Add tests for fir.address_of
This patch adds FIR to LLVM test for fir.address_of.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D122889
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Fangrui Song [Mon, 4 Apr 2022 06:57:31 +0000 (23:57 -0700)]
[ELF][test] Fix RUN lines in lto/sample-profile.ll
Reported at https://github.com/llvm/llvm-project/issues/54679#issuecomment-
1086862116
Min-Yih Hsu [Fri, 17 Dec 2021 03:34:36 +0000 (11:34 +0800)]
[M68k] Adopt VarLenCodeEmitter for shift / rotate instructions
This patch is covered by existing MC tests.
Min-Yih Hsu [Mon, 4 Apr 2022 05:39:20 +0000 (22:39 -0700)]
[M68k][test] Remove redundant CHECK-LABEL directive
The associated test had a redundant CHECK-LABEL directive that might fail
the test since the inception, but this issue was "burried" by a missing
colon, which was addressed in
fb65aaf0be09936e657d339f3dc8e62666a41956.
Thus, the test finally failed after the said commit.
This patch remove that CHECK-LABEL directive.
Yuanfang Chen [Mon, 4 Apr 2022 03:14:26 +0000 (20:14 -0700)]
Reland "[lit] Use sharding for GoogleTest format"
This relands commit
a87ba5c86d5d72defdbcdb278baad6515ec99463.
Adjust llvm/utils/lit/tests/googletest-timeout.py for new test output.
Argyrios Kyrtzidis [Mon, 4 Apr 2022 04:02:02 +0000 (21:02 -0700)]
[Support/BLAKE3] CMake: Remove the workaround that checks for "CC=ccache /path/to/clang"
The LLVM builders that were doing that have been updated to use "-DLLVM_CCACHE_BUILD=ON" instead.
Augie Fackler [Thu, 31 Mar 2022 18:46:51 +0000 (14:46 -0400)]
AttributorAttributes: guard against TLI being nullptr
I didn't dig into this very much because it appears to be totally valid
(especially once these properties can come from attributes instead
of only from hard-coded library functions) for TLI to not be defined,
and nothing broke when I added this check, including with all my other
patches applied.
Differential Revision: https://reviews.llvm.org/D122917
Augie Fackler [Thu, 31 Mar 2022 14:30:26 +0000 (10:30 -0400)]
CallBase: fix getFnAttr so it also checks the function
Prior to this change, CallBase::hasFnAttr checked the called function to
see if it had an attribute if it wasn't set on the CallBase, but
getFnAttr didn't do the same delegation, which led to very confusing
behavior. This patch fixes the issue by making CallBase::getFnAttr also
check the function under the same circumstances.
Test changes look (to me) like they're cleaning up redundant attributes
which no longer get specified both on the callee and call. We also clean
up the one ad-hoc implementation of this getter over in InlineCost.cpp.
Differential Revision: https://reviews.llvm.org/D122821
Philip Reames [Mon, 4 Apr 2022 03:09:03 +0000 (20:09 -0700)]
[LV] Handle non-integral types when considering interleave widening legality
In general, anywhere we might need to insert a blind bitcast, we need to make sure the types are losslessly convertible.
This fixes pr54634.
Philip Reames [Tue, 29 Mar 2022 03:29:41 +0000 (20:29 -0700)]
[memcpyopt] Restructure store(load src, dest) form of callslotopt for compile time
The search for the clobbering call is fairly expensive if uses are not optimized at construction. Defer the clobber walk to the point in the implementation we need it; there are a bunch of bailouts before that point. (e.g. If the source pointer is not an alloca, we can't do callslotopt.)
On a test case which involves a bunch of copies from argument pointers, this switches memcpyopt from > 1/2 second to < 10ms.
Yuanfang Chen [Mon, 4 Apr 2022 03:04:55 +0000 (20:04 -0700)]
Revert "[lit] Use sharding for GoogleTest format"
This reverts commit
a87ba5c86d5d72defdbcdb278baad6515ec99463.
Breaks bots:
https://lab.llvm.org/buildbot/#/builders/196/builds/10454
Yuanfang Chen [Sat, 2 Apr 2022 19:28:23 +0000 (12:28 -0700)]
[lit] Use sharding for GoogleTest format
This helps lit unit test performance by a lot, especially on windows. The performance gain comes from launching one gtest executable for many subtests instead of one (this is the current situation).
The shards are executed by the test runner and the results are stored in the
json format supported by the GoogleTest. Later in the test reporting stage,
all test results in the json file are retrieved to continue the test results
summary etc.
On my Win10 desktop, before this patch: `check-clang-unit`: 177s, `check-llvm-unit`: 38s; after this patch: `check-clang-unit`: 37s, `check-llvm-unit`: 11s.
On my Linux machine, before this patch: `check-clang-unit`: 46s, `check-llvm-unit`: 8s; after this patch: `check-clang-unit`: 7s, `check-llvm-unit`: 4s.
Reviewed By: yln, rnk
Differential Revision: https://reviews.llvm.org/D122251
Xiang1 Zhang [Mon, 4 Apr 2022 00:27:28 +0000 (08:27 +0800)]
Correct spelling error in TLS-Load-Hoist
Dávid Bolvanský [Sun, 3 Apr 2022 23:14:34 +0000 (01:14 +0200)]
Revert "[NFCI] Regenerate SROA/LoopVectorize test checks"
This reverts commit
14e3450fb57305aa9ff3e9e60687b458e43835c9.
Dávid Bolvanský [Sun, 3 Apr 2022 22:55:54 +0000 (00:55 +0200)]
[NFCI] Regenerate SROA test checks
Dávid Bolvanský [Sun, 3 Apr 2022 22:28:57 +0000 (00:28 +0200)]
[NFCI] Regenerate PhaseOrdering test checks
Dávid Bolvanský [Sun, 3 Apr 2022 22:21:00 +0000 (00:21 +0200)]
[NFCI] Regenerate LoopIdiomRecognize test checks
Nico Weber [Sun, 3 Apr 2022 21:21:06 +0000 (17:21 -0400)]
Revert "[GH54588]Fix ItaniumMangler for NTTP unnamed unions w/ unnamed structs"
This reverts commit
4cf98f973a13c5049322abff43f0dff3c214311b.
The test fails on mac bots, see comments on https://reviews.llvm.org/D122820
Also reverts follow-ups
eb920989865d992093993143ba3c6e71126cbb89 and
861c189d2a5203ba8c8e983e8d2e109c0de153a5.
David Green [Sun, 3 Apr 2022 21:16:39 +0000 (22:16 +0100)]
[AArch64] Remove unsued WideningBaseCost. NFC
The WideningBaseCost is always 0. This removes it to clean up the code.
Louis Dionne [Sun, 3 Apr 2022 16:40:39 +0000 (12:40 -0400)]
[libc++] Remove unused <iosfwd> include from <__debug>
Differential Revision: https://reviews.llvm.org/D122999