Andrew Litteken [Sun, 23 Aug 2020 05:30:10 +0000 (00:30 -0500)]
[IRSim] Adding support for isomorphic predicates
Some predicates, can be considered the same as long as the operands are
flipped. For example, a > b gives the same result as b > a. This maps
instructions in a greater than form, to their appropriate less than
form, swapping the operands in the IRInstructionData only, allowing for
more flexible matching.
Tests:
llvm/test/Transforms/IROutliner/outlining-isomorphic-predicates.ll
llvm/unittests/Analysis/IRSimilarityIdentifierTest.cpp
Reviewers: jroelofs, paquette
Recommit of commit
050392660249c70c00e909ae4a7151ba2c766235
Differential Revision: https://reviews.llvm.org/D87310
Alexandre Ganea [Thu, 24 Dec 2020 00:24:43 +0000 (19:24 -0500)]
[Clang] Reverse test to save on indentation. NFC.
Layton Kifer [Thu, 24 Dec 2020 00:13:52 +0000 (16:13 -0800)]
[DAGCombiner] Don't create sexts of deleted xors when they were in-visit replaced
Fixes a bug introduced by D91589.
When folding `(sext (not i1 x)) -> (add (zext i1 x), -1)`, we try to replace the not first when possible. If we replace the not in-visit, then the now invalidated node will be returned, and subsequently we will return an invalid sext. In cases where the not is replaced in-visit we can simply return SDValue, as the not in the current sext should have already been replaced.
Thanks @jgorbe, for finding the below reproducer.
The following reduced test case crashes clang when built with `clang -O1 -frounding-math`:
```
template <class> class a {
int b() { return c == 0.0 ? 0 : -1; }
int c;
};
template class a<long>;
```
A debug build of clang produces this "assertion failed" error:
```
clang: /home/jgorbe/code/llvm/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:264: void {anonymous}::DAGCombiner::AddToWorklist(llvm::
SDNode*): Assertion `N->getOpcode() != ISD::DELETED_NODE && "Deleted Node added to Worklist"' failed.
```
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D93274
Jacques Pienaar [Thu, 24 Dec 2020 00:13:03 +0000 (16:13 -0800)]
[mlir] Add tensor passes to passes.md
Duncan P. N. Exon Smith [Thu, 10 Dec 2020 23:27:51 +0000 (15:27 -0800)]
Basic: Add native support for stdin to SourceManager and FileManager
Add support for stdin to SourceManager and FileManager. Adds
FileManager::getSTDIN, which adds a FileEntryRef for `<stdin>` and reads
the MemoryBuffer, which is stored as `FileEntry::Content`.
Eventually the other buffers in `ContentCache` will sink to here as well
-- we probably usually want to load/save a MemoryBuffer eagerly -- but
it's happening early for stdin to get rid of
CompilerInstance::InitializeSourceManager's final call to
`SourceManager::overrideFileContents`.
clang/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/p1.cpp
relies on building a module from stdin; supporting that requires setting
ContentCache::BufferOverridden.
Differential Revision: https://reviews.llvm.org/D93148
Duncan P. N. Exon Smith [Thu, 3 Dec 2020 02:01:28 +0000 (18:01 -0800)]
Basic: Support named pipes natively in SourceManager and FileManager
Handle named pipes natively in SourceManager and FileManager, removing a
call to `SourceManager::overrideFileContents` in
`CompilerInstance::InitializeSourceManager` (removing a blocker for
sinking the content cache to FileManager (which will incidently sink
this new named pipe logic with it)).
SourceManager usually checks if the file entry's size matches the
eventually loaded buffer, but that's now skipped for named pipes since
the `stat` won't reflect the full size. Since we can't trust
`ContentsEntry->getSize()`, we also need shift the check for files that
are too large until after the buffer is loaded... and load the buffer
immediately in `createFileID` so that no client gets a bad value from
`ContentCache::getSize`. `FileManager::getBufferForFile` also needs to
treat these files as volatile when loading the buffer.
Native support in SourceManager / FileManager means that named pipes can
also be `#include`d, and clang/test/Misc/dev-fd-fs.c was expanded to
check for that.
This is a new version of
3b18a594c7717a328c33b9c1eba675e9f4bd367c, which
was reverted in
b34632201987eed369bb7ef4646f341b901c95b8 since it was
missing the `SourceManager` changes.
Differential Revision: https://reviews.llvm.org/D92531
Stanislav Mekhanoshin [Wed, 23 Dec 2020 22:15:23 +0000 (14:15 -0800)]
[AMDGPU] Fix adjustWritemask subreg handling
If we happen to extract a non-dword subreg that breaks the
logic of the function and it may shrink the dmask because
it does not recognize the use of a lane(s).
This bug is next to impossible to trigger with the current
lowering in the BE, but it breaks in one of my future patches.
Differential Revision: https://reviews.llvm.org/D93782
Jordan Rupprecht [Wed, 23 Dec 2020 22:33:04 +0000 (14:33 -0800)]
[lld][test] Relax test assertion of cmake defaults appearing in --version output.
D93491 implemented `--version` for the MachO LLD port, but asserts that the string contains something like "LLD N.N". However, this is just the cmake default for `LLD_VERSION_STRING`, and downstream users may choose a different value, e.g. a rolling distro may print "LLD trunk".
Sriraman Tallam [Wed, 23 Dec 2020 22:15:39 +0000 (14:15 -0800)]
Fix lldb test failure due to D93082.
Rename the basic block symbols in the test to reflect the new names.
Jonas Devlieghere [Wed, 23 Dec 2020 21:47:52 +0000 (13:47 -0800)]
[lldb] Simplify ObjectFile::FindPlugin (NFC)
Use early return to reduce the levels of indentation. Extract logic to
find object in container into helper function.
Sam McCall [Wed, 23 Dec 2020 21:41:46 +0000 (22:41 +0100)]
[clangd] Fix case mismatch crash on in CDB on windows after
92dd077af1ff8
See https://github.com/clangd/clangd/issues/631
Andrew Litteken [Wed, 23 Dec 2020 21:13:03 +0000 (15:13 -0600)]
Revert "[IRSim] Adding support for isomorphic predicates"
Reverting due to unit test errors between commits.
This reverts commit
050392660249c70c00e909ae4a7151ba2c766235.
Björn Schäpers [Mon, 14 Dec 2020 06:17:24 +0000 (07:17 +0100)]
[clang-format] Add SpaceBeforeCaseColon option
With which you can add a space before the colon of a case or default
statement.
Differential Revision: https://reviews.llvm.org/D93240
Björn Schäpers [Sat, 12 Dec 2020 16:37:35 +0000 (17:37 +0100)]
[clang-format] Fix handling of TextProto comments
Differential Revision: https://reviews.llvm.org/D93163
Roman Lebedev [Wed, 23 Dec 2020 21:03:01 +0000 (00:03 +0300)]
[InstCombine] canonicalizeAbsNabs(): don't propagate NSW flag for NABS patter
As Nuno is noting in post-commit review in
https://reviews.llvm.org/D87188#2467915
it is not correct to keep NSW for negated abs pattern,
so don't do that.
Andrew Litteken [Sun, 23 Aug 2020 05:30:10 +0000 (00:30 -0500)]
[IRSim] Adding support for isomorphic predicates
Some predicates, can be considered the same as long as the operands are
flipped. For example, a > b gives the same result as b > a. This maps
instructions in a greater than form, to their appropriate less than
form, swapping the operands in the IRInstructionData only, allowing for
more flexible matching.
Tests:
llvm/test/Transforms/IROutliner/outlining-isomorphic-predicates.ll
llvm/unittests/Analysis/IRSimilarityIdentifierTest.cpp
Reviewers: jroelofs, paquette
Differential Revision: https://reviews.llvm.org/D87310
Andrew Litteken [Sat, 22 Aug 2020 03:20:12 +0000 (22:20 -0500)]
[IRSim] Adding commutativity matching to structure checking
Certain instructions, such as adds and multiplies can have the operands
flipped and still be considered the same. When we are analyzing
structure, this gives slightly more flexibility to create a mapping from
one region to another. We can add both operands in a corresponding
instruction to an operand rather than just the exact match. We then try
to eliminate items from the set, until there is only one valid mapping
between the regions of code.
We do this for adds, multiplies, and equality checking. However, this is
not done for floating point instructions, since the order can still
matter in some cases.
Tests:
llvm/test/Transforms/IROutliner/outlining-commutative-fp.ll
llvm/test/Transforms/IROutliner/outlining-commutative.ll
llvm/unittests/Analysis/IRSimilarityIdentifierTest.cpp
Reviewers: jroelofs, paquette
Differential Revision: https://reviews.llvm.org/D87311
Nikita Popov [Wed, 23 Dec 2020 20:58:26 +0000 (21:58 +0100)]
[InstCombine] Handle different pointer types when folding gep of null
The source pointer type is not necessarily the same as the result
pointer type, so we can't simply return the original null pointer,
it might be a different one.
Nikita Popov [Wed, 23 Dec 2020 20:18:48 +0000 (21:18 +0100)]
[InstCombine] Fold gep inbounds of null to null
Effectively, this is what we were previously already doing when
the GEP was used in conjunction with a load or store, but this
fold can also be applied more generally:
> The only in bounds address for a null pointer in the default
> address-space is the null pointer itself.
Nikita Popov [Wed, 23 Dec 2020 20:22:36 +0000 (21:22 +0100)]
[InstCombine] Add tests for gep of null (NFC)
We were only considering the gep of null pattern in conjunction
with a load/store. Also test it independently.
Nathan James [Wed, 23 Dec 2020 20:27:43 +0000 (20:27 +0000)]
[format][NFC] Use unsigned char as the base of all enums in FormatStyle
This removes alot of unnecessary padding, trimming the size of the struct from 728->608 on 64 bit platforms.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D93758
Fraser Cormack [Tue, 15 Dec 2020 13:05:32 +0000 (13:05 +0000)]
[RISCV] Add ISel support for RVV vector/scalar forms
This patch extends the SDNode ISel support for RVV from only the
vector/vector instructions to include the vector/scalar and
vector/immediate forms.
It uses splat_vector to carry the scalar in each case, except when
XLEN<SEW (RV32 SEW=64) when a custom node `SPLAT_VECTOR_I64` is used for
type-legalization and to encode the fact that the value is sign-extended
to SEW. When the scalar is a full 64-bit value we use a sequence to
materialize the constant into the vector register.
The non-intrinsic ISel patterns have also been split into their own
file.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Fraser Cormack <fraser@codeplay.com>
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D93312
Nikita Popov [Wed, 23 Dec 2020 20:01:00 +0000 (21:01 +0100)]
[InstCombine] Check inbounds in load/store of gep null transform (PR48577)
If the GEP isn't inbounds, then accessing a GEP of null location
is generally not UB.
While this is a minimal fix, the GEP of null handling should
probably be its own fold.
Nikita Popov [Wed, 23 Dec 2020 19:56:16 +0000 (20:56 +0100)]
[InstCombine] Add tests for PR48577 (NFC)
Lei Zhang [Wed, 23 Dec 2020 19:48:17 +0000 (14:48 -0500)]
[mlir][spirv] De-template serialization
Previously for each op we generate a separate serialization
method for it. Those serialization methods duplicate the logic
of parsing operands/results/attributes and such.
This commit creates a generic method and let suitable op-specific
serialization method to call into it.
wc -l SPIRVSerialization.inc: before 8304; after: 5597 (So -2707)
Reviewed By: hanchung, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D93535
Lei Zhang [Wed, 23 Dec 2020 19:37:52 +0000 (14:37 -0500)]
[mlir][spirv] De-template deserialization
Previously for each op we generate a separate deserialization
method for it. Those deserialization methods duplicate the logic
of parsing operands/results/attributes and such.
This commit creates a generic method and let suitable op-specific
deserialization method to call into it.
wc -l SPIRVSerialization.inc: before 13290; after: 8304 (So -4986)
Reviewed By: hanchung, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D93504
Craig Topper [Wed, 23 Dec 2020 19:39:50 +0000 (11:39 -0800)]
[IROutliner] Use isa instead of dyn_cast where the casted value isn't used. NFC
Fixes unused variable warnings.
Lei Zhang [Wed, 23 Dec 2020 19:32:31 +0000 (14:32 -0500)]
[mlir][spirv] NFC: rename SPIR-V conversion files for consistency
This commit renames various SPIR-V related conversion files for
consistency. It drops the "Convert" prefix to various files and
fixes various comment headers.
Reviewed By: hanchung, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D93489
Sriraman Tallam [Wed, 23 Dec 2020 17:51:35 +0000 (09:51 -0800)]
Append ".__part." to every basic block section symbol.
Every basic block section symbol created by -fbasic-block-sections will contain
".__part." to know that this symbol corresponds to a basic block fragment of
the function.
This patch solves two problems:
a) Like D89617, we want function symbols with suffixes to be properly qualified
so that external tools like profile aggregators know exactly what this
symbol corresponds to.
b) The current basic block naming just adds a ".N" to the symbol name where N is
some integer. This collides with how clang creates __cxx_global_var_init.N.
clang creates these symbol names to call constructor functions and basic
block symbol naming should not use the same style.
Fixed all the test cases and added an extra test for __cxx_global_var_init
breakage.
Differential Revision: https://reviews.llvm.org/D93082
Lei Zhang [Wed, 23 Dec 2020 18:37:27 +0000 (13:37 -0500)]
[mlir][spirv] Create a pass for testing SCFToSPIRV patterns
Previously all SCF to SPIR-V conversion patterns were tested as
the -convert-gpu-to-spirv pass. That obscured the structure we
want. This commit fixed it.
Reviewed By: ThomasRaoux, hanchung
Differential Revision: https://reviews.llvm.org/D93488
Roman Lebedev [Wed, 23 Dec 2020 19:26:40 +0000 (22:26 +0300)]
[LoopIdiom] 'left-shift until bittest' idiom: support rewriting loop as countable, allow extra cruft
The current state of the transform is still not enough to support
my motivational pattern, because it has one more "induction variable".
I have delayed posting this patch, because originally even just rewriting
the loop as countable wasn't enough to nicely transform my motivational pattern,
because i expected that extra IV to be rewritten afterwards,
but it wasn't happening until i fixed that in D91800.
So, this patch allows the 'left-shift until bittest' loop idiom
as long as the inserted ops are cheap,
and lifts any and all extra use checks on the instructions.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D92754
Roman Lebedev [Wed, 23 Dec 2020 19:26:39 +0000 (22:26 +0300)]
[LoopIdiom] 'left-shift until bittest' idiom: support canonical sign bit mask
If the bitmask is for sign bit, instcombine would have canonicalized
the pattern into a proper sign bit check. Supporting that is still
simple, but requires a bit of a roundtrip - we first have to use
`decomposeBitTestICmp()`, and the rest again just works.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D91726
Roman Lebedev [Wed, 23 Dec 2020 19:26:34 +0000 (22:26 +0300)]
[LoopIdiom] 'left-shift until bittest' idiom: support constant bit mask
The handing of the case where the mask is a constant is trivial,
if said constant is a power of two, the bit in question is log2(mask),
rest just works.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D91725
Roman Lebedev [Wed, 23 Dec 2020 19:26:28 +0000 (22:26 +0300)]
[LoopIdiom] Introduce 'left-shift until bittest' idiom
The motivation here is the following inner loop in fp16/fp24 -> fp32 expander,
that runs as part of the floating-point DNG decompression in RawSpeed library:
https://github.com/darktable-org/rawspeed/blob/
cd380bb9a209bd2e7a0e7022b0cab04528d151e7/src/librawspeed/decompressors/DeflateDecompressor.cpp#L112-L115
```
while (!(fp32_fraction & (1 << 23))) {
fp32_exponent -= 1;
fp32_fraction <<= 1;
}
```
(https://godbolt.org/z/r13YMh)
As one might notice, that loop is currently uncountable, and that whole code stays scalar.
Yet, it is rather trivial to make that loop countable:
https://godbolt.org/z/do8WMz
and we can prove that via alive2:
https://alive2.llvm.org/ce/z/7vQnji (ha nice, isn't it?)
... and that allow for the whole fp16->fp32 code to vectorize:
https://godbolt.org/z/7hYr13
Now, while i'd love to get there, i feel like i should take it in steps.
For now, this introduces support for the most basic case,
where the bit position is known as a variable,
and the loop *will* go away (has no live-outs other than the recurrence,
no extra instructions in the loop).
I have added sufficient (i believe) test coverage,
and alive2 is happy with those transforms.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D91038
Nico Weber [Wed, 23 Dec 2020 19:25:34 +0000 (14:25 -0500)]
clang: Build and run FrontendTests with CLANG_ENABLE_STATIC_ANALYZER=OFF too
They seem to pass fine with the analyzer off, and with this I would've
noticed my last check-clang break locally.
Thomas Raoux [Fri, 11 Dec 2020 15:08:55 +0000 (07:08 -0800)]
[mlir][vector] Add more vector Ops canonicalization
Add canonicalization for BroadcastOp, ExtractStrideSlicesOp and ShapeCastOp
Differential Revision: https://reviews.llvm.org/D93120
Nico Weber [Wed, 23 Dec 2020 19:13:23 +0000 (14:13 -0500)]
Revert more changes that landed on top of
741978d727
This should've been in
7ad666798f12456d9 but wasn't.
Squashes these twoc commits:
Revert "[clang][cli] Let denormalizer decide how to render the option based on the option class"
This reverts commit
70410a264949101ced3ce3458f37dd4cc2f5af85.
Revert "[clang][cli] Implement `getAllArgValues` marshalling"
This reverts commit
63a24816f561a5d8e28ca7054892bd8602618be4.
Alan Phipps [Wed, 23 Dec 2020 19:01:46 +0000 (13:01 -0600)]
Revert "This is a test commit"
This reverts commit
b920adf3b4f16bef8dde937b67874d8e8ac1030e.
Andrew Litteken [Tue, 15 Sep 2020 23:20:09 +0000 (18:20 -0500)]
[IROutliner] Adding support for elevating constants that are not the same in each region to arguments
When there are constants that have the same structural location, but not
the same value, between different regions, we cannot simply outline the
region. Instead, we find the constants that are not the same in each
location, and promote them to arguments to be passed into the respective
functions. At each call site, we pass the constant in as an argument
regardless of type.
Added/Edited Tests:
llvm/test/Transforms/IROutliner/outlining-constants-vs-registers.ll
llvm/test/Transforms/IROutliner/outlining-different-constants.ll
llvm/test/Transforms/IROutliner/outlining-different-globals.ll
Reviewers: paquette, jroelofs
Differential Revision: https://reviews.llvm.org/D87294
AlexisPerry [Wed, 23 Dec 2020 17:57:36 +0000 (10:57 -0700)]
Updated GettingInvolved.md to reflect Flang Biweekly Call changes
- updated the link to join the meeting to reflect the new WebEx information
- Added a note about the new Google Doc for keeping track of notes, and who
to contact if you experience access issues with the document
- Left a reference to the minutes from previous meetings being available
through a search of the flang-dev mailing list
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D93770
Alan Phipps [Wed, 23 Dec 2020 18:57:27 +0000 (12:57 -0600)]
This is a test commit
Craig Topper [Wed, 23 Dec 2020 18:01:43 +0000 (10:01 -0800)]
[RISCV] Add intrinsics for vfmv.v.f
Also include a special case pattern to use vmv.v.x vd, zero when
the argument is 0.0.
Reviewed By: khchen
Differential Revision: https://reviews.llvm.org/D93672
Jonas Devlieghere [Tue, 22 Dec 2020 22:02:18 +0000 (14:02 -0800)]
[lldb] Refactor and simplify GetCommandSPExact interface
GetCommandSPExact is called exaclty once with include_aliases set to
true, so make it a default argument. Use early returns to simplify the
implementation.
Jonas Devlieghere [Tue, 22 Dec 2020 21:17:17 +0000 (13:17 -0800)]
[lldb] Don't instrument demangling.
Don't instrument demangling calls. These functions are very hot and
instrumenting them quickly results in too much data to be useful.
Lei Zhang [Wed, 23 Dec 2020 18:21:57 +0000 (13:21 -0500)]
[mlir][spirv] Convert functions returning one value
Reviewed By: hanchung, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D93468
Nico Weber [Wed, 23 Dec 2020 17:39:16 +0000 (12:39 -0500)]
Revert
741978d727 and things that landed on top of it.
741978d727 made clang produce output that's 2x as large at least in
sanitizer builds. https://reviews.llvm.org/D83892#2470185 has a
standalone repro.
This reverts the following commits:
Revert "[clang][cli] Port CodeGenOpts simple string flags to new option parsing system"
This reverts commit
95d3cc67caac04668ef808f65c30ced60ed14f5d.
Revert "[clang][cli] Port LangOpts simple string based options to new option parsing system"
This reverts commit
aec2991d083a9c5b92f94d84a7b3a7bbed405af8.
Revert "[clang][cli] Streamline MarshallingInfoFlag description"
This reverts commit
27b7d646886d499c70dec3481dfc3c82dfc43dd7.
Revert "[clang][cli] Port LangOpts option flags to new option parsing system"
This reverts commit
383778e2171b4993f555433745466e211e713548.
Revert "[clang][cli] Port CodeGen option flags to new option parsing system"
This reverts commit
741978d727a445fa279d5952a86ea634adb7dc52.
Joseph Huber [Wed, 23 Dec 2020 16:45:46 +0000 (11:45 -0500)]
[OpenMP] Fixing typo on memory size in Documenation
Jez Ng [Wed, 23 Dec 2020 16:24:02 +0000 (11:24 -0500)]
[lld-macho] Simulator & DriverKit executables should always be PIE
We didn't have support for parsing DriverKit in our `-platform`
flag, so add that too. Also remove a bunch of unnecessary namespace
prefixes.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D93741
Paul C. Anagnostopoulos [Wed, 16 Dec 2020 14:55:16 +0000 (09:55 -0500)]
[TableGen] Add the !substr() bang operator
Update the documentation and add a test.
Build failed: Change SIZE_MAX to std::numeric_limits<int64_t>::max().
Differential Revision: https://reviews.llvm.org/D93419
Evgeniy Brevnov [Thu, 18 Jun 2020 09:20:55 +0000 (16:20 +0700)]
[BPI] Improve static heuristics for "cold" paths.
Current approach doesn't work well in cases when multiple paths are predicted to be "cold". By "cold" paths I mean those containing "unreachable" instruction, call marked with 'cold' attribute and 'unwind' handler of 'invoke' instruction. The issue is that heuristics are applied one by one until the first match and essentially ignores relative hotness/coldness
of other paths.
New approach unifies processing of "cold" paths by assigning predefined absolute weight to each block estimated to be "cold". Then we propagate these weights up/down IR similarly to existing approach. And finally set up edge probabilities based on estimated block weights.
One important difference is how we propagate weight up. Existing approach propagates the same weight to all blocks that are post-dominated by a block with some "known" weight. This is useless at least because it always gives 50\50 distribution which is assumed by default anyway. Worse, it causes the algorithm to skip further heuristics and can miss setting more accurate probability. New algorithm propagates the weight up only to the blocks that dominates and post-dominated by a block with some "known" weight. In other words, those blocks that are either always executed or not executed together.
In addition new approach processes loops in an uniform way as well. Essentially loop exit edges are estimated as "cold" paths relative to back edges and should be considered uniformly with other coldness/hotness markers.
Reviewed By: yrouban
Differential Revision: https://reviews.llvm.org/D79485
Aleksandr Platonov [Wed, 23 Dec 2020 14:04:54 +0000 (17:04 +0300)]
[clangd] Do not take stale definition from the static index.
This is follow up to D93393.
Without this patch clangd takes the symbol definition from the static index if this definition was removed from the dynamic index.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D93683
ergawy [Wed, 23 Dec 2020 14:32:31 +0000 (15:32 +0100)]
[MLIR][SPIRV] Add rewrite pattern to convert select+cmp into GLSL clamp.
Adds rewrite patterns to convert select+cmp instructions into clamp
instructions whenever possible. Support is added to convert:
- FOrdLessThan, FOrdLessThanEqual to GLSLFClampOp.
- SLessThan, SLessThanEqual to GLSLSClampOp.
- ULessThan, ULessThanEqual to GLSLUClampOp.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D93618
mydeveloperday [Wed, 23 Dec 2020 14:44:31 +0000 (14:44 +0000)]
[clang-format] PR48539 ReflowComments breaks Qt translation comments
https://bugs.llvm.org/show_bug.cgi?id=48539
Add support for Qt Translator Comments to reflow
When reflown and a part of the comments are added on a new line, it should repeat these extra characters as part of the comment token.
Reviewed By: curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D93490
mydeveloperday [Wed, 23 Dec 2020 14:41:06 +0000 (14:41 +0000)]
[clang-format] PR48535 clang-format Incorrectly Removes Space After C Style Cast When Type Is Not a Pointer
https://bugs.llvm.org/show_bug.cgi?id=48535
using `SpaceAfterCStyleCast: true`
```
size_t idx = (size_t) a;
size_t idx = (size_t) (a - 1);
```
is formatted as:
```
size_t idx = (size_t) a;
size_t idx = (size_t)(a - 1);
```
This revision aims to improve that by improving the function which tries to identify a CastRParen
Reviewed By: curdeius
Differential Revision: https://reviews.llvm.org/D93626
Joseph Huber [Wed, 23 Dec 2020 14:16:55 +0000 (09:16 -0500)]
[OpenMP] Fixing Typo in Documentation
David Penry [Wed, 23 Dec 2020 14:00:59 +0000 (14:00 +0000)]
[ARM] Add bank conflict hazarding
Adds ARMBankConflictHazardRecognizer. This hazard recognizer
looks for a few situations where the same base pointer is used and
then checks whether the offsets lead to a bank conflict. Two
parameters are also added to permit overriding of the target
assumptions:
arm-data-bank-mask=<int> - Mask of bits which are to be checked for
conflicts. If all these bits are equal in the offsets, there is a
conflict.
arm-assume-itcm-bankconflict=<bool> - Assume that there will be bank
conflicts on any loads to a constant pool.
This hazard recognizer is enabled for Cortex-M7, where the Technical
Reference Manual states that there are two DTCM banks banked using bit
2 and one ITCM bank.
Differential Revision: https://reviews.llvm.org/D93054
Simon Moll [Wed, 23 Dec 2020 13:21:41 +0000 (14:21 +0100)]
[NFC] Uniquify 'const' in TargetTransformInfoImpl.h
Some member functions of class TargetTransformInfoImplBase in
TargetTransformInfoImpl.h are marked const while others are not. Yet all
of the should be marked const since they are just providing default TTI
values. This patch fixes the inconsistency.
Authored-by: Jinzheng Tu <b1f6c1c4@gmail.com>
Reviewed By: simoll
Differential revision: https://reviews.llvm.org/D93573
Simon Moll [Wed, 23 Dec 2020 12:27:55 +0000 (13:27 +0100)]
[VE] Vector 'and' isel and tests
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D93709
Alex Zinenko [Tue, 22 Dec 2020 10:22:56 +0000 (11:22 +0100)]
[mlir] Remove static constructors from LLVMType
LLVMType contains numerous static constructors that were initially introduced
for API compatibility with LLVM. Most of these merely forward to arguments to
`SpecificType::get` (MLIR defines classes for all types, unlike LLVM IR), while
some introduce subtle semantics differences due to different modeling of MLIR
types (e.g., structs are not auto-renamed in case of conflicts). Furthermore,
these constructors don't match MLIR idioms and actively prevent us from making
the LLVM dialect type system more open. Remove them and use `SpecificType::get`
instead.
Depends On D93680
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D93681
Nathan James [Wed, 23 Dec 2020 12:08:28 +0000 (12:08 +0000)]
[format] Add overload to parseConfiguration that accept llvm::MemoryBufferRef
This overload should be used for better diagnostics when parsing configurations.
Now a failure to parse will list the filename (or <command-line>) instead of just `YAML`.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D93633
Adrian Kuegel [Wed, 23 Dec 2020 11:31:52 +0000 (12:31 +0100)]
Revert "PR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of"
This reverts commit
d3bf0bb18952d830fe6df6f791a64552b271000b.
This causes compilation in certain cases to fail.
Reproducer TBD.
Christian Sigg [Wed, 23 Dec 2020 10:37:49 +0000 (11:37 +0100)]
[mlir] Rename ConvertToLLVMPattern::isSupportedMemRefType() to isConvertibleAndHasIdentityMaps().
Reviewed By: ftynse, herhut
Differential Revision: https://reviews.llvm.org/D93752
Alex Zinenko [Tue, 8 Dec 2020 15:45:19 +0000 (16:45 +0100)]
[mlir] Add translation of omp.wsloop to LLVM IR
Introduce a translation of OpenMP workshare loop construct to LLVM IR. This is
a minimalist version to enable the pipeline and currently only supports static
loop schedule (default in the specification) on non-collapsed loops. Other
features will be added on per-need basis.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D92055
Christian Sigg [Wed, 23 Dec 2020 09:51:23 +0000 (10:51 +0100)]
[mlir] NFC: Remove ConvertToLLVMPattern::getDataPtr(). All call sites use getStridedElementPtr() now.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D93751
Alex Zinenko [Wed, 23 Dec 2020 10:19:35 +0000 (11:19 +0100)]
[mlir] Modernize std-to-llvm operation conversion doc
This was long overdue. Replace the outdated type syntax with the new syntax,
and update the description of how memref load/stores are handled to reflect the
latest changes in the implementation.
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D93555
Sebastian Neubauer [Tue, 22 Dec 2020 12:53:38 +0000 (13:53 +0100)]
[AMDGPU][GlobalISel] Fold flat vgpr + constant addresses
Use getPtrBaseWithConstantOffset in selectFlatOffsetImpl to fold more
vgpr+constant addresses.
Differential Revision: https://reviews.llvm.org/D93692
ShihPo Hung [Tue, 22 Dec 2020 13:30:24 +0000 (05:30 -0800)]
[RISCV] Add intrinsics for vfwmacc, vfwnmacc, vfwmsac, vfwnmsac instructions
This patch defines vfwmacc, vfwnmacc, vfwmsc, vfwnmsac intrinsics
and lower to V instructions.
We work with @rogfer01 from BSC to come out this patch.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential Revision: https://reviews.llvm.org/D93693
Georgii Rymar [Tue, 22 Dec 2020 12:21:26 +0000 (15:21 +0300)]
[llvm-readobj] - Dump the ELF file type better.
Currently llvm-readelf might print "OS Specific/Processor Specific/<unknown>"
hint when dumping the ELF file type. The patch teaches llvm-readobj to do the same.
This fixes https://bugs.llvm.org/show_bug.cgi?id=40868
I am removing `Object/elf-unknown-type.test` test because it is not in the right place,
it is outdated and very limited.
The `readobj/ELF/file-types.test` checks the functionality much better.
Differential revision: https://reviews.llvm.org/D93689
Zakk Chen [Tue, 22 Dec 2020 04:50:58 +0000 (20:50 -0800)]
[RISCV] Define vmerge/vfmerge intrinsics.
Define vmerge/vfmerge intrinsics and lower to V instructions.
Include support for vector-vector vfmerge by vmerge.vvm.
We work with @rogfer01 from BSC to come out this patch.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D93674
Evandro Menezes [Wed, 23 Dec 2020 06:27:38 +0000 (00:27 -0600)]
[RISCV] Define the vfmin, vfmax RVV intrinsics
Define the vfmin, vfmax IR intrinsics for the respective V instructions.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Evandro Menezes <evandro.menezes@sifive.com>
Differential Revision: https://reviews.llvm.org/D93673
Arthur Eubanks [Wed, 23 Dec 2020 05:40:43 +0000 (21:40 -0800)]
[NewPM] Fix objc-arc-apelim pass typo
Kazu Hirata [Wed, 23 Dec 2020 04:13:27 +0000 (20:13 -0800)]
[NewGVN] Remove for_each_found (NFC)
The last use of the function was removed on Sep 30, 2017 in commit
9b926e90d33e0f71c16618365333fc7b330b6bb5.
Thomas Lively [Wed, 23 Dec 2020 04:06:12 +0000 (20:06 -0800)]
[WebAssembly][NFC] Refactor SIMD load/store tablegen defs
Introduce `Vec` records, each bundling all information related to a single SIMD
lane interpretation. This lets TableGen definitions take a single Vec parameter
from which they can extract information rather than taking multiple redundant
parameters. This commit refactors all of the SIMD load and store instruction
definitions to use the new `Vec`s. Subsequent commits will similarly refactor
additional instruction definitions.
Differential Revision: https://reviews.llvm.org/D93660
Kazu Hirata [Wed, 23 Dec 2020 03:58:54 +0000 (19:58 -0800)]
[MemorySSA] Use is_contained (NFC)
Matt Arsenault [Tue, 3 Nov 2020 14:50:17 +0000 (09:50 -0500)]
GlobalISel: Return APInt from getConstantVRegVal
Returning int64_t was arbitrarily limiting for wide integer types, and
the functions should handle the full generality of the IR.
Also changes the full form which returns the originally defined
vreg. Add another wrapper for the common case of just immediately
converting to int64_t (arguably this would be useful for the full
return value case as well).
One possible issue with this change is some of the existing uses did
break without conversion to getConstantVRegSExtVal, and it's possible
some without adequate test coverage are now broken.
Nico Weber [Tue, 22 Dec 2020 20:51:20 +0000 (15:51 -0500)]
[lld/mac] Add --version flag
It's an extension to ld64, but all the other ports have it, and
someone asked for it in PR43721.
While here, change the COFF help text to match the other ports.
Differential Revision: https://reviews.llvm.org/D93491
Matt Arsenault [Fri, 18 Dec 2020 15:51:17 +0000 (10:51 -0500)]
AMDGPU: Use Register
Matt Arsenault [Fri, 18 Dec 2020 16:51:59 +0000 (11:51 -0500)]
AMDGPU: Add spilled CSR SGPRs to entry block live ins
ShihPo Hung [Tue, 22 Dec 2020 12:50:19 +0000 (04:50 -0800)]
[RISCV] Add intrinsics for vf[n]macc/vf[n]msac/vf[n]madd/vf[n]msub instructions
This patch defines vfmadd/vfnmacc, vfmsac/vfnmsac, vfmadd/vfnmadd,
and vfmsub/vfnmsub lower to V instructions.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential Revision: https://reviews.llvm.org/D93691
ShihPo Hung [Tue, 22 Dec 2020 08:01:46 +0000 (00:01 -0800)]
[RISCV] Add intrinsics for vwmacc[u|su|us] instructions
This patch defines vwmacc[u|su|us] intrinsics and lower to V instructions.
We work with @rogfer01 from BSC to come out this patch.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential Revision: https://reviews.llvm.org/D93675
ShihPo Hung [Mon, 21 Dec 2020 02:07:42 +0000 (18:07 -0800)]
[RISCV] Add intrinsics for vslide1up/down, vfslide1up/down instruction
This patch adds intrinsics for vslide1up, vslide1down, vfslide1up, vfslide1down.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential Revision: https://reviews.llvm.org/D93608
Matt Arsenault [Mon, 21 Dec 2020 18:27:32 +0000 (13:27 -0500)]
AMDGPU: Fix assert when checking for implicit operand legality
Matt Arsenault [Thu, 17 Dec 2020 23:47:13 +0000 (18:47 -0500)]
VirtRegMap: Use Register
Arthur O'Dwyer [Mon, 23 Mar 2020 02:20:04 +0000 (22:20 -0400)]
Replace `T(x)` with `reinterpret_cast<T>(x)` everywhere it means reinterpret_cast. NFC.
Differential Revision: https://reviews.llvm.org/D76572
Peter Collingbourne [Tue, 22 Dec 2020 19:48:53 +0000 (11:48 -0800)]
scudo: Move the management of the UseMemoryTagging bit out of the Primary. NFCI.
The primary and secondary allocators will need to share this bit,
so move the management of the bit to the combined allocator and
make useMemoryTagging() a free function.
Differential Revision: https://reviews.llvm.org/D93730
Peter Collingbourne [Tue, 15 Dec 2020 23:32:32 +0000 (15:32 -0800)]
scudo: Replace the Cache argument on MapAllocator with a Config argument. NFCI.
This will allow the secondary allocator to access the
MaySupportMemoryTagging bool.
Differential Revision: https://reviews.llvm.org/D93729
Stanislav Mekhanoshin [Mon, 21 Dec 2020 20:31:06 +0000 (12:31 -0800)]
[AMDGPU][GlobalISel] GlobalISel for flat scratch
It does not seem to fold offsets but this is not specific
to the flat scratch as getPtrBaseWithConstantOffset() does
not return the split for these tests unlike its SDag
counterpart.
Differential Revision: https://reviews.llvm.org/D93670
Stanislav Mekhanoshin [Mon, 21 Dec 2020 23:40:46 +0000 (15:40 -0800)]
[AMDGPU] Support unaligned flat scratch in TLI
Adjust SITargetLowering::allowsMisalignedMemoryAccessesImpl for
unaligned flat scratch support. Mostly needed for global isel.
Differential Revision: https://reviews.llvm.org/D93669
Peter Collingbourne [Tue, 15 Dec 2020 22:26:10 +0000 (14:26 -0800)]
scudo: Move the configuration for the primary allocator to Config. NFCI.
This will allow the primary and secondary allocators to share
the MaySupportMemoryTagging bool.
Differential Revision: https://reviews.llvm.org/D93728
Chris Lattner [Tue, 22 Dec 2020 18:35:15 +0000 (10:35 -0800)]
[IR] Add an ImplicitLocOpBuilder helper class for building IR with the same loc.
One common situation is to create a lot of IR at a well known location,
e.g. when doing a big rewrite from one dialect to another where you're expanding
ops out into lots of other ops.
For these sorts of situations, it is annoying to pass the location into
every create call. As we discused in a few threads on the forum, a way to help
with this is to produce a new sort of builder that holds a location and provides
it to each of the create<> calls automatically.
This patch implements an ImplicitLocOpBuilder class that does this. We've had
good experience with this in the CIRCT project, and it makes sense to upstream to
MLIR.
I picked a random pass to adopt it to show the impact, but I don't think there is
any particular need to force adopt it in the codebase.
Differential Revision: https://reviews.llvm.org/D93717
Joseph Huber [Tue, 22 Dec 2020 20:14:30 +0000 (15:14 -0500)]
[OpenMP] Add OpenMP Documentation for Libomptarget environment variables
Add support to the OpenMP web pages for environment variables supported
by Libomptarget and their usage.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D93723
Alex Zinenko [Tue, 22 Dec 2020 10:22:21 +0000 (11:22 +0100)]
[mlir] Remove instance methods from LLVMType
LLVMType contains multiple instance methods that were introduced initially for
compatibility with LLVM API. These methods boil down to `cast` followed by
type-specific call. Arguably, they are mostly used in an LLVM cast-follows-isa
anti-pattern. This doesn't connect nicely to the rest of the MLIR
infrastructure and actively prevents it from making the LLVM dialect type
system more open, e.g., reusing built-in types when appropriate. Remove such
instance methods and replaces their uses with apporpriate casts and methods on
derived classes. In some cases, the result may look slightly more verbose, but
most cases should actually use a stricter subtype of LLVMType anyway and avoid
the isa/cast.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D93680
Thomas Lively [Tue, 22 Dec 2020 22:29:06 +0000 (14:29 -0800)]
[WebAssembly][SIMD] Rename shuffle, swizzle, and load_splats
These instructions previously used prefixes like v8x16 to signify that they were
agnostic between float and int interpretations. We renamed these instructions to
remove this form of prefix in https://github.com/WebAssembly/simd/issues/297 and
https://github.com/WebAssembly/simd/issues/316 and this commit brings the names
in LLVM up to date.
Differential Revision: https://reviews.llvm.org/D93722
Sam McCall [Tue, 22 Dec 2020 21:58:39 +0000 (22:58 +0100)]
[clangd] Release notes for
b8c37153d5393aad96
Christian Sigg [Tue, 22 Dec 2020 16:42:59 +0000 (17:42 +0100)]
[mlir] Lower gpu.memcpy to GPU runtime calls.
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D93204
Sam McCall [Tue, 22 Dec 2020 20:36:41 +0000 (21:36 +0100)]
[clangd] Use atomics instead of locks to track periodic memory trimming
Instead of always locking/unlocking a contended mutex, we now do one atomic read
in the common case, and one read + one exchange if the timer has expried.
Also use this for memory profiling which has similar/compatible requirements.
Differential Revision: https://reviews.llvm.org/D93726
Sanjay Patel [Tue, 22 Dec 2020 19:54:09 +0000 (14:54 -0500)]
[SLP] add reduction tests for maxnum/minnum intrinsics; NFC
Sanjay Patel [Tue, 22 Dec 2020 19:13:39 +0000 (14:13 -0500)]
[SLP] use operand index abstraction for number of operands
I think this is NFC currently, but the bug would be exposed
when we allow binary intrinsics (maxnum, etc) as candidates
for reductions.
The code in matchAssociativeReduction() is using
OperationData::getNumberOfOperands() when comparing whether
the "EdgeToVisit" iterator is in-bounds, so this code must
use the same (potentially offset) operand value to set
the "EdgeToVisit".
Nico Weber [Tue, 22 Dec 2020 16:00:57 +0000 (11:00 -0500)]
glld/mac] Don't add names of unreferenced symbols to string table
Before this, a hello world program would contain many many unnecessary
entries in its string table.
No behavior change, just makes the string table in the output smaller
and more like ld64's.
Differential Revision: https://reviews.llvm.org/D93711
Stephen Kelly [Tue, 22 Dec 2020 20:25:10 +0000 (20:25 +0000)]
Try to fix build on Windows