Justas Janickas [Tue, 24 Aug 2021 10:59:42 +0000 (11:59 +0100)]
[OpenCL] Defines helper function for kernel language compatible OpenCL version
This change defines a helper function getOpenCLCompatibleVersion()
inside LangOptions class. The function contains mapping between
C++ for OpenCL versions and their corresponding compatible OpenCL
versions. This mapping function should be updated each time a new
C++ for OpenCL language version is introduced. The helper function
is expected to simplify conditions on OpenCL C and C++ for OpenCL
versions inside compiler code.
Code refactoring performed.
Differential Revision: https://reviews.llvm.org/D108693
Jason Molenda [Tue, 31 Aug 2021 08:32:52 +0000 (01:32 -0700)]
Use dSYM's file addr for Sections when it doesn't match binary
When adding a dSYM to a Module and it has different file addresses
from the already-present ObjectFile binary, change the Sections to
use the dSYM's file addresses so the symbol table and DWARF are
properly contained in the Sections. Previously this was only done
for IsInMemory ObjectFiles, but it's more common than that.
Differential Revision: https://reviews.llvm.org/D108889
rdar://
81504400
Shivam Gupta [Tue, 31 Aug 2021 07:31:51 +0000 (13:01 +0530)]
[NFC] Correct typo in CodeGenMapTable.cpp, patch by Jordi
CodeGenMapTable.cpp refers to TableGen as TabelGen in the comments. This appears to be a typo. This patch fixes the typo.
Differential Revision: https://reviews.llvm.org/D76343
Simon Wallis [Tue, 31 Aug 2021 07:16:26 +0000 (08:16 +0100)]
[Arm] Add assert in T2 Imm7s code emitter
Add assert to provoke failure in object file output, not just in disassembly output.
Reviewed By: yroux
Differential Revision: https://reviews.llvm.org/D107259
Shivam Gupta [Tue, 31 Aug 2021 07:01:24 +0000 (12:31 +0530)]
Fix typo in two files in Clang, patch by FusionBolt
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D98254
Shivam Gupta [Tue, 31 Aug 2021 06:36:00 +0000 (12:06 +0530)]
[clang] Fix Typo in AST Matcher Reference
In [[ https://clang.llvm.org/docs/LibASTMatchersReference.html | AST Matcher Reference]], the example of matcher `hasDeclContext` contained a typo.
`cxxRcordDecl` was changed to `cxxRecordDecl`.
Differential Revision: https://reviews.llvm.org/D102836
Kai Luo [Tue, 31 Aug 2021 06:46:15 +0000 (06:46 +0000)]
[AIX] Rename shared_libraries_to_archive -> objects_to_archive. NFC.
Doug Beck [Tue, 31 Aug 2021 06:30:00 +0000 (12:00 +0530)]
Fix typo s/beloinging/belonging
Differential Revision: https://reviews.llvm.org/D107099
Alexander Pivovarov [Tue, 31 Aug 2021 06:20:37 +0000 (11:50 +0530)]
Fix typo in comments
Reviewed By: MaskRay, jsji
Differential Revision: https://reviews.llvm.org/D108857
Shivam Gupta [Tue, 31 Aug 2021 06:15:00 +0000 (11:45 +0530)]
[LLDB][Docs] Move best-practices.txt contain to resources/test.rst
This file contain some old reference to files those are now either renamed or replaced.
Also this .txt file didn't generate to html during the sphnix documentation build so I send its contents to resources/test.rst file.
Signed-off-by: Shivam Gupta <shivam98.tkg@gmail.com>
Reviewed By: teemperor, mgorny, JDevlieghere
Differential Revision: https://reviews.llvm.org/D108812
Shivam Gupta [Fri, 27 Aug 2021 07:44:57 +0000 (13:14 +0530)]
[LLDB][Docs] Convert some .txt files to .rst
Upadate some .txt files to .rst for consistency as most
of the documentation is written in reStructuredText format.
Signed-off-by: Shivam Gupta <shivam98.tkg@gmail.com>
Differential Revision: https://reviews.llvm.org/D108807
Shivam Gupta [Tue, 31 Aug 2021 06:08:23 +0000 (11:38 +0530)]
[Docs][Phabricator] Mention how to create a draft revision
https://llvm.org/docs/Phabricator.html have two links to Arcnist guide but
none of them mention how to create a draft revision. It would create some less noise if
developers create draft revisoin in this(--draft) way instead of [WIP] tag way.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D108970
Shivam Gupta [Tue, 31 Aug 2021 06:03:30 +0000 (11:33 +0530)]
[Docs] Remove subversion reference from MyFirstTypoFix.rst
David Blaikie [Tue, 31 Aug 2021 05:38:40 +0000 (22:38 -0700)]
DebugInfo: Refactor/deduplicate various template argument list emission
Streamline template arguments across types, variables, and functions -
for convenient reuse in experiments related to template argument list
reconstitution (not including template argument lists in the "name" of
those entities, and leaving it to debug info consumers to rebuild the
full template name from the semantic descriptions of the argument lists)
But the change seems like a good refactoring/cleanup anyway.
I'd certainly be open to suggestions about how this might be more
streamlined - like is there no generic way to query template argument
lists across the 3 kinds of entities, rather than needing special case
code?
Stella Laurenzo [Tue, 24 Aug 2021 03:01:07 +0000 (20:01 -0700)]
[mlir][python] Apply py::module_local() to all classes.
* This allows multiple MLIR-API embedding downstreams to co-exist in the same process.
* I believe this is the last thing needed to enable isolated embedding.
Differential Revision: https://reviews.llvm.org/D108605
Heejin Ahn [Mon, 30 Aug 2021 21:48:33 +0000 (14:48 -0700)]
[WebAssembly] Free setjmpTable before exiting calls in EmSjLj
This is an improvement over D107852. We don't need to enumerate specific
function names; we can just check for `noreturn` attribute. This also
requires us to make sure `__resumeExeption` and `emscripten_longjmp`
have `noreturn` attribute too; one of them is a JS function and the
other calls a JS function so Clang does not have a way to deduce they
don't return.
This is effectively NFC, because I'm not sure if there is an additional
case this case covers; if we add a custom function call that has
`noreturn` attribute, it will be processed within the SjLj handling and
turned into `__invoke` call. So this really applies to some special
functions like `emscripten_longjmp`.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D108955
Heejin Ahn [Sat, 28 Aug 2021 05:14:49 +0000 (22:14 -0700)]
[WebAssembly] Share rethrowing BBs in LowerEmscriptenEHSjLj
There are three kinds of "rethrowing" BBs in this pass:
1. In Emscripten SjLj, after a possibly longjmping function call, we
check if the thrown longjmp corresponds to one of setjmps within the
current function. If not, we rethrow the longjmp by calling
`emscripten_longjmp`.
2. In Emscripten EH, after a possibly throwing function call, we check
if the thrown exception corresponds to the current `catch` clauses.
If not, we rethrow the exception by calling `__resumeException`.
3. When both Emscripten EH and SjLj are used, when we check for an
exception after a possibly throwing function call, it is possible
that we get not an exception but a longjmp. In this case, we
shouldn't swallow it; we should rethrow the longjmp by calling
`emscripten_longjmp`.
4. When both Emscripten EH and SjLj are used, when we check for a
longjmp after a possibly longjmping function call, it is possible
that we get not a longjmp but an exception. In this case, we
shouldn't swallot it; we should rethrow the exception by calling
`__resumeException`.
Case 1 is in Emscripten SjLj, 2 is in Emscripten EH, and 3 and 4 are
relevant when both Emscripten EH and SjLj are used. 3 and 4 were first
implemented in D106525.
We create BBs for 1, 3, and 4 in this pass. We create those BBs for
every throwing/longjmping function call, along with other BBs that
contain condition checks. What this CL does is to create a single BB
within a function for each of 1, 3, and 4 cases. These BBs are exiting
BBs in the function and thus don't have successors, so easy to be shared
between calls.
The names of BBs created are:
Case 1: `call.em.longjmp`
Case 3: `rethrow.exn`
Case 4: `rethrow.longjmp`
For the case 2 we don't currently create BBs; we only replace the
existing `resume` instruction with `call @__resumeException`. And Clang
already creates only a single `resume` BB per function and reuses it,
so we don't need to optimize this case.
Not sure what are good benchmarks for EH/SjLj, but this decreases the
size of the object file for `grfmt_jpeg.bc` (presumably from opencv) we
got from one of our users by 8.9%. Even after running `wasm-opt -O4` on
them, there is still 4.8% improvement.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D108945
Hongtao Yu [Wed, 25 Aug 2021 18:40:34 +0000 (11:40 -0700)]
[CSSPGO] Split context string to deduplicate function name used in the context.
Currently context strings contain a lot of duplicated function names and that significantly increase the profile size. This change split the context into a series of {name, offset, discriminator} tuples so function names used in the context can be replaced by the index into the name table and that significantly reduce the size consumed by context.
A follow-up improvement made in the compiler and profiling tools is to avoid reconstructing full context strings which is time- and memory- consuming. Instead a context vector of `StringRef` is adopted to represent the full context in all scenarios. As a result, the previous prevalent profile map which was implemented as a `StringRef` is now engineered as an unordered map keyed by `SampleContext`. `SampleContext` is reshaped to using an `ArrayRef` to represent a full context for CS profile. For non-CS profile, it falls back to use `StringRef` to represent a contextless function name. Both the `ArrayRef` and `StringRef` objects are underpinned by real array and string objects that are stored in producer buffers. For compiler, they are maintained by the sample reader. For llvm-profgen, they are maintained in `ProfiledBinary` and `ProfileGenerator`. Full context strings can be generated only in those cases of debugging and printing.
When it comes to profile format, nothing has changed to the text format, though internally CS context is implemented as a vector. Extbinary format is only changed for CS profile, with an additional `SecCSNameTable` section which stores all full contexts logically in the form of `vector<int>`, which each element as an offset points to `SecNameTable`. All occurrences of contexts elsewhere are redirected to using the offset of `SecCSNameTable`.
Testing
This is no-diff change in terms of code quality and profile content (for text profile).
For our internal large service (aka ads), the profile generation is cut to half, with a 20x smaller string-based extbinary format generated.
The compile time of ads is dropped by 25%.
Differential Revision: https://reviews.llvm.org/D107299
MaheshRavishankar [Tue, 31 Aug 2021 02:29:34 +0000 (19:29 -0700)]
Fix unused variable in release build.
Differential Revision: https://reviews.llvm.org/D108963
Xu Mingjie [Tue, 31 Aug 2021 02:15:57 +0000 (10:15 +0800)]
[tsan] Add environment variable TSAN_SYMBOLIZER_PATH as we do in other sanitizers
ASan, LSan, MSan and UBSan all allow to use environment variable `*SAN_SYMBOLIZER_PATH` to pass the symbolizer path, this patch add `TSAN_SYMBOLIZER_PATH` to TSan.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D108911
Nico Weber [Mon, 30 Aug 2021 18:32:29 +0000 (14:32 -0400)]
[lld/mac] Leave more room for thunks in thunk placement code
Fixes PR51578 in practice.
Currently there's only enough room for a single thunk, which for real-life code
isn't enough. The error case only happens when there are many branch statements
very close to each other (0 or 1 instructions apart), with the function at the
finalization barrier small.
There's a FIXME on what to do if we hit this case, but that suggestion sounds
complicated to me (see end of PR51578 comment 5 for why).
Instead, just leave more room for thunks. Chromium's unit_tests links fine with
room for 3 thunks. Leave room for 100, which should fix this for most cases in
practice.
There's little cost for leaving lots of room: This slop value only determines
when we finalize sections, and we insert thunks for forward jumps into
unfinalized sections. So leaving room means we'll need a few more thunks, but
the thunk jump range is 128 MiB while a single thunk is just 12 bytes.
For Chromium's unit_tests:
With a slop of 3: thunk calls = 355418, thunks = 10903
With a slop of 100: thunk calls = 355426, thunks = 10904
Chances are 100 is enough for all use cases we'll hit in practice, but even
bumping it to 1000 would probably be fine.
Differential Revision: https://reviews.llvm.org/D108930
Volodymyr Sapsai [Wed, 28 Jul 2021 16:33:44 +0000 (09:33 -0700)]
[modules] Fix miscompilation when using two RecordDecl definitions with the same name.
When deserializing a RecordDecl we don't enforce that redeclaration
chain contains only a single definition. So if the canonical decl is not
a definition itself, `RecordType::getDecl` can return different objects
before and after an include. It means we can build CGRecordLayout for
one RecordDecl with its set of FieldDecl but try to use it with
FieldDecl belonging to a different RecordDecl. With assertions enabled
it results in
> Assertion failed: (FieldInfo.count(FD) && "Invalid field for record!"),
> function getLLVMFieldNo, file llvm-project/clang/lib/CodeGen/CGRecordLayout.h, line 199.
and with assertions disabled a bunch of fields are treated as their
memory is located at offset 0.
Fix by keeping the first encountered RecordDecl definition and marking
the subsequent ones as non-definitions. Also need to merge FieldDecl
properly, so that `getPrimaryMergedDecl` works correctly and during name
lookup we don't treat fields from same-name RecordDecl as ambiguous.
rdar://
80184238
Differential Revision: https://reviews.llvm.org/D106994
Keith Smiley [Fri, 27 Aug 2021 06:36:49 +0000 (23:36 -0700)]
[llvm-cov][NFC] Add test for coverage-prefix-map remappings
This test covers acts as a regression test for these fixes:
c75a0a1e9dc29be4e00d37d0d00288afc1a6153f
dd388ba3e0b0a5f06565d0bcb6e1aebb5daac065
Differential Revision: https://reviews.llvm.org/D108805
MaheshRavishankar [Mon, 30 Aug 2021 22:55:30 +0000 (15:55 -0700)]
[mlir] Add an interface to allow operations to specify how they can be tiled.
An interface to allow for tiling of operations is introduced. The
tiling of the linalg.pad_tensor operation is modified to use this
interface.
Differential Revision: https://reviews.llvm.org/D108611
peter klausler [Tue, 24 Aug 2021 23:51:44 +0000 (16:51 -0700)]
[flang] Fold EOSHIFT
Implement constant folding for the transformational intrinsic
function EOSHIFT.
Differential Revision: https://reviews.llvm.org/D108941
Chris Lattner [Mon, 30 Aug 2021 16:31:48 +0000 (09:31 -0700)]
[Builder] Eliminate the StringRef/StringAttr forms of getSymbolRefAttr.
The StringAttr version doesn't need a context, so we can just use the
existing `SymbolRefAttr::get` form. The StringRef version isn't preferred
so we want to encourage people to use StringAttr.
There is an additional form of getSymbolRefAttr that takes a (SymbolTrait
implementing) operation. This should also be moved, but I'll do that as
a separate patch.
Differential Revision: https://reviews.llvm.org/D108922
Michael Jones [Mon, 30 Aug 2021 22:17:50 +0000 (22:17 +0000)]
[libc][nfc][obvious] fix typos in FPUtil
Fix minor typos in FPUtil comments.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D108952
Keno Fischer [Thu, 19 Aug 2021 18:31:39 +0000 (14:31 -0400)]
[COFF] Force Symbols containing '.' to be quoted
In D87099, the mangler learned to quote export directives that contain
special characters. Only alhpanumerical characters as well as
'_', '$', '.' and '@' were exmpt from this quoting. However, at least
binutils considers an unquoted '.' to be syntax and object files
containing such symbols will cause errors during linking. Fix that
by removing '.' from the list of allowed exemptions.
Differential Revision: https://reviews.llvm.org/D100359
Artem Belevich [Mon, 30 Aug 2021 20:33:24 +0000 (13:33 -0700)]
[MemCpyOpt] Allow specifying --enable-memcpyopt-without-libcalls more than once
so we can override it via clang's CLI if necessary.
Siva Chandra Reddy [Mon, 30 Aug 2021 20:42:45 +0000 (20:42 +0000)]
[libc] Add mtx_destroy which does nothing.
There is not cleanup to be done for the mutex type so mtx_destroy does
nothing.
Andrew Litteken [Wed, 25 Aug 2021 19:45:04 +0000 (12:45 -0700)]
[IROutliner] Changing outliner to prioritize reductions on assembly rather than IR instruction
Currently, the IROutliner uses a simple metric to outline the largest amount
of IR possible to outline first if it fits the cost model. This is model
loses out on smaller blocks of code that have higher reductions in cost that
are contained within larger blocks of IR.
This reverses the order, where we calculate all of the costs first, and then
reorder and extract items based on the calculated results.
Reviewers: paquette
Differential Revision: https://reviews.llvm.org/D106440
Nikita Popov [Mon, 30 Aug 2021 20:28:14 +0000 (22:28 +0200)]
[TTI] Sink IVDescriptors.h include (NFC)
Forward declare RecurrenceDescriptor and include IVDescritor.h
only in implementation code that actually needs it.
natashaknk [Mon, 30 Aug 2021 20:18:39 +0000 (13:18 -0700)]
[mlir][tosa] Small refactor to the functionality of Conv2D and Fully_connected to add the bias at the end of the convolution
Made to adjust for a modification to the tiling algorithm
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D108746
Craig Topper [Mon, 30 Aug 2021 18:53:18 +0000 (11:53 -0700)]
[LegalizeTypes][X86] Improve ExpandIntRes_FP_TO_SINT/ExpandIntRes_FP_TO_UINT when input is SoftPromoteHalf.
Instead of splitting off the fp16 to float conversion and generating
a libcall, we should split the operation into fp16 to float and float
to integer operations. This will allow the float to integer conversion
to go through any custom handling the target has. If the target doesn't
have custom handling then we should come back to ExpandIntRes_FP_TO_SINT/
ExpandIntRes_FP_TO_UINT automatically to create the libcall.
This avoids generating libcalls on 32-bit X86. These library functions may
not exist in 32-bit libgcc. At least for LLVM, we never generate them when
hardware floating point instructions are available.
Differential Revision: https://reviews.llvm.org/D108933
Bjorn Pettersson [Mon, 30 Aug 2021 19:07:17 +0000 (21:07 +0200)]
[SelectionDAG] Fix miscompile bugs related to smul.fix.sat with scale zero
When expanding a SMULFIXSAT ISD node (usually originating from
a smul.fix.sat intrinsic) we've applied some optimizations for
the special case when the scale is zero. The idea has been that
it would be cheaper to use an SMULO instruction (if legal) to
perform the multiplication and at the same time detect any overflow.
And in case of overflow we could use some SELECT:s to replace the
result with the saturated min/max value. The only tricky part
is to know if we overflowed on the min or max value, i.e. if the
product is positive or negative. Unfortunately the implementation
has been incorrect as it has looked at the product returned by the
SMULO to determine the sign of the product. In case of overflow that
product is truncated and won't give us the correct sign bit.
This patch is adding an extra XOR of the multiplication operands,
which is used to determine the sign of the non truncated product.
This patch fixes PR51677.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D108938
peter klausler [Wed, 7 Jul 2021 17:52:09 +0000 (10:52 -0700)]
[flang] Fold CSHIFT
Implement folding of the transformational intrinsic function
CSHIFT for all types.
Differential Revision: https://reviews.llvm.org/D108931
Owen Anderson [Thu, 26 Aug 2021 22:50:33 +0000 (22:50 +0000)]
Teach the AArch64 backend patterns to generate the EOR3 instruction.
Adds patterns to match the EOR3 instruction.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D108793
Fangrui Song [Mon, 30 Aug 2021 19:59:07 +0000 (12:59 -0700)]
[libc++] Support -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on in CI
This fixes -isystem/-L/-Wl,-rpath paths when -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on
is used (https://reviews.llvm.org/D107799#2969650).
* `-isystem path/to/build/generic-cxx17/include/c++/v1`. `build/generic-cxx17/include/x86_64-unknown-linux-gnu/c++/v1 (__config_site)` is missing.
* `-L path/to/build/generic-cxx17/lib`. Should be `build/generic-cxx17/lib/x86_64-unknown-linux-gnu` instead
Reviewed By: ldionne, phosek, #libc
Differential Revision: https://reviews.llvm.org/D108836
Chih-Ping Chen [Mon, 30 Aug 2021 19:05:24 +0000 (15:05 -0400)]
[DebugInfo] Remove the restriction on the size of DIStringType
in DebugHandlerBase::isUnsignedDIType.
Differential Revision: https://reviews.llvm.org/D108559
Ellis Hoag [Mon, 30 Aug 2021 19:32:57 +0000 (12:32 -0700)]
[DIBuilder] Do not replace empty enum types
It looks like this array was missed in
4276d4a8d08b7640eb57cabf6988a5cf65b228b6
Fixed tests that expected `elements` to be empty or depeneded on the order of the empty DINode.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D107024
pooja2299 [Thu, 5 Aug 2021 18:24:56 +0000 (23:54 +0530)]
[docs][GlobalISel]Adding info for G_JUMP_TABLE generic opcode
Added description of jump table and G_JUMP_TABLE opcode.
Differential Revision: https://reviews.llvm.org/D107630
David Green [Mon, 30 Aug 2021 18:19:51 +0000 (19:19 +0100)]
[ARM] Workaround tailpredication min/max costmodel
The min/max intrinsics are not yet canonical, but when they are the tail
predications analysis will change from treating them like icmp to
treating them like intrinsics. Unfortunately, they can currently produce
better code by not being tail predicated thanks to the vectorizer picking
higher VF's and the backend folding to better instructions (especially
for saturate patterns). In the long run we will need to improve the
vectorizers cost modelling, recognizing the instruction directly, but in
the meantime this treats min/max as before to prevent performance
regressions.
Nico Weber [Sat, 28 Aug 2021 03:27:03 +0000 (23:27 -0400)]
[lld/mac] Tweak estimateStubsInRangeVA a bit
- Move a few variables closer to their uses, remove some completely
(no behavior change)
- Add some comments
- Make maxPotentialThunks include calls to stubs. It's possible that
an earlier call to a stub late in the stub table will need a thunk,
and that inserted thunk could push a stub earlier in the stub table
out of range. This is unlikely to happen, but usually there are
way fewer stub calls than non-stub calls, so if we're doing a
conservative approximation here we might as well do it correctly.
(For chromium's unit_tests target, 134421/242639 stub calls are
direct calls without this change, compared to 134408/242639 with
this change)
No real, meaningful behavior difference.
Differential Revision: https://reviews.llvm.org/D108924
Nikita Popov [Sat, 28 Aug 2021 19:29:31 +0000 (21:29 +0200)]
[InstrInfo] Use 64-bit immediates for analyzeCompare() (NFCI)
The backend generally uses 64-bit immediates (e.g. what
MachineOperand::getImm() returns), so use that for analyzeCompare()
and optimizeCompareInst() as well. This avoids truncation for
targets that support immediates larger 32-bit. In particular, we
can avoid the bugprone value normalization hack in the AArch64
target.
This is a followup to D108076.
Differential Revision: https://reviews.llvm.org/D108875
Xiang Xiao [Mon, 30 Aug 2021 17:34:20 +0000 (13:34 -0400)]
[libc++abi] Avoid the warning: "__EXCEPTIONS" is not defined, evaluates to 0 [-Werror=undef]
Differential Revision: https://reviews.llvm.org/D108896
David Blaikie [Mon, 30 Aug 2021 17:06:00 +0000 (10:06 -0700)]
DebugInfo: Correct printing empty template parameter packs
Empty packs in the non-final position would result in an extra ", ".
Empty packs in the final position would result in missing the space
between trailing >>.
Mikhail Goncharov [Mon, 30 Aug 2021 17:16:44 +0000 (19:16 +0200)]
Revert "[SLP]Improve graph reordering."
This reverts commit
84cbd71c95923f9912512f3051c6ab548a99e016.
This commit breaks one of the internal tests. As agreed with Alexey I
will provide the reproducer later.
Hongtao Yu [Wed, 25 Aug 2021 18:57:48 +0000 (11:57 -0700)]
[CSSPGO] Avoid repeatedly computing md5 hash code for pseudo probe inline contexts.
Md5 hashing is expansive. Using a hash map to look up already computed GUID for dwarf names. Saw a 2% build time improvement on an internal large application.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D108722
Nikita Popov [Sat, 28 Aug 2021 20:26:45 +0000 (22:26 +0200)]
[AsmParser] Support %ty* in force-opaque-pointers mode
Only enforce that ptr* is illegal if the base type is a simple type,
not when it is something like %ty, where %ty may resolve to an
opaque pointer in force-opaque-pointers mode.
Differential Revision: https://reviews.llvm.org/D108876
Joe Loser [Mon, 30 Aug 2021 17:03:33 +0000 (13:03 -0400)]
[libcxx][docs] Mark LWG3348 as complete
Mark LWG3348 as complete. The `__cpp_lib_unwrap_ref` feature test macro
was placed in `<functional>` in
466df1718e41fe2fca6ce6bd98c01b18f42c05e4
Differential Revision: https://reviews.llvm.org/D108920
Philip Reames [Mon, 30 Aug 2021 16:47:45 +0000 (09:47 -0700)]
[SCEV] Clarify the overflow precondition of computeMaxBECountForLT [NFC]
And add a test case to illustrate that we do in fact produce the right result for the multiple exit case. I have gotten myself confused at least three times when reading this code, so clarify to prevent future confusion.
Andrei Elovikov [Mon, 30 Aug 2021 16:24:41 +0000 (09:24 -0700)]
[NFC][clang] Move IR-independent parts of target MV support to X86TargetParser.cpp
...that is located under llvm/lib/Support/.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D108423
Louis Dionne [Fri, 27 Aug 2021 16:04:12 +0000 (12:04 -0400)]
[libc++] Various cleanups in the ranges tests
- Rename test files to follow conventions better
- Split constructor tests that were in a single file
- Add missing tests for take_view and transform_view's default constructors
- Add missing tests for transform_view's view/function constructor
- Fix include guards
- Mark some tests as being specific to libc++
Differential Revision: https://reviews.llvm.org/D108829
Nico Weber [Sun, 29 Aug 2021 19:19:19 +0000 (15:19 -0400)]
[lld/mac] Set branchRange a bit more carefully
- Don't subtract thunkSize from branchRange. Most places care about
the actual maximal branch range. Subtract thunkSize in the one place
that wants to leave room for a thunk.
- Set it to 0x800_0000 instead of 0xFF_FFFF
- Subtract 4 for the positive branch direction since it's a
two's complement 24bit number sign-extended mutiplied by 4,
so its range is -0x800_0000..+0x7FF_FFFC
- Make boundary checks include the boundary values
This doesn't make a huge difference in practice. It's preparation
for a "real" fix for PR51578 -- but it also lets the repro in comment 0
in that bug place one more thunk before hitting the TODO.
Differential Revision: https://reviews.llvm.org/D108897
Andrew Litteken [Fri, 11 Jun 2021 17:00:22 +0000 (12:00 -0500)]
[IROutliner] Ensure instructions at end of candidate are excluded
Occasionally instructions are between the last instruction in a region,
and the following instruction as identified by the Candidate. This
adds an extra check right before splitting a candidate that excludes the region from being split/checked for outlining to remove errors.
Tests Added:
Tranforms/IROuutliner/outlining-extra-bitcasts.ll
Reviewer: paquette, jroelofs
Differential Revision: https://reviews.llvm.org/D104142
Daniil Fukalov [Mon, 30 Aug 2021 16:05:55 +0000 (19:05 +0300)]
[AMDGPU][CostModel] Update shuffle instruction tests. NFC.
New tests ported over from test/Analysis/CostModel/AArch64/shuffle-other.ll.
Kazu Hirata [Mon, 30 Aug 2021 16:05:05 +0000 (09:05 -0700)]
[llvm] Remove redundant calls to str() and c_str() (NFC)
Identified with readability-redundant-string-cstr.
Craig Topper [Mon, 30 Aug 2021 15:47:43 +0000 (08:47 -0700)]
[RISCV] Enable CONCAT_VECTORS for fixed FP vectors.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D108487
Craig Topper [Mon, 30 Aug 2021 15:40:00 +0000 (08:40 -0700)]
[DAGCombiner][RISCV] Don't use vector types in DAGCombiner::tryStoreMergeOfLoads if we need a rotate.
The check for whether a rotate is possible occurs before the
memory legality checks for the integer type. So it's possible we
decide we can use a rotate, but then fail the legality checks. If
that happens we should not fall back to a vector type. This triggers
an assertion in the rotate handling when it finds a vector type
instead of an integer type.
In theory we could use a shufflevector in place of the rotate, but
right now I'd just like to fix the crash.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D108839
Danila Malyutin [Mon, 30 Aug 2021 15:45:25 +0000 (18:45 +0300)]
[LSR][NFC] Add test case for pr42770
Andrew Litteken [Mon, 30 Aug 2021 15:34:25 +0000 (08:34 -0700)]
[IRSim] Adding missing comments canonical relation commit
Adding missing comments to IRSimilarityIdentifier.cpp since
they were not properly added in commit
063af63b9664151b3a9206feefa9a6a36a471e80.
Joachim Protze [Mon, 30 Aug 2021 14:50:21 +0000 (16:50 +0200)]
[libomptarget][amdcgn] Only add opt/llvm-link dependency if TARGET is available
In some build configurations, the target we depend on is not available for declaring the build dependency.
We only need to declare the build dependency, if the build target is available in the same build.
Fixes the issue raised in https://reviews.llvm.org/D107156#2969862
This patch should go into release/13 together with D108404
Differential Revision: https://reviews.llvm.org/D108868
Stella Laurenzo [Sun, 29 Aug 2021 03:15:51 +0000 (20:15 -0700)]
[mlir][python] Extend C/Python API to be usable for CFG construction.
* It is pretty clear that no one has tried this yet since it was both incomplete and broken.
* Fixes a symbol hiding issues keeping even the generic builder from constructing an operation with successors.
* Adds ODS support for successors.
* Adds CAPI `mlirBlockGetParentRegion`, `mlirRegionEqual` + tests (and missing test for `mlirBlockGetParentOperation`).
* Adds Python property: `Block.region`.
* Adds Python methods: `Block.create_before` and `Block.create_after`.
* Adds Python property: `InsertionPoint.block`.
* Adds new blocks.py test to verify a plausible CFG construction case.
Differential Revision: https://reviews.llvm.org/D108898
Jake Egan [Mon, 30 Aug 2021 14:42:59 +0000 (10:42 -0400)]
[AIX] Suppress -Waix-compat warning with SmallVector class
When building LLVM with Open XL and -Werror is specified, the -Waix-compat warning becomes an error. This patch updates the SmallVector class to suppress the -Waix-compat warning/error on AIX.
Reviewed By: daltenty
Differential Revision: https://reviews.llvm.org/D108577
Victor Huang [Mon, 30 Aug 2021 14:32:48 +0000 (09:32 -0500)]
[PowerPC][NFC] Rename P10 builtins vec_clrl, vec_clrr to vec_clr_first and vec_clr_last
This patch renames the vector clear left/right builtins vec_clrl, vec_clrr to
vec_clr_first and vec_clr_last to avoid the ambiguities when dealing with endianness.
Reviewed By: amyk, lei
Differential revision: https://reviews.llvm.org/D108702
Raphael Isemann [Mon, 30 Aug 2021 13:16:18 +0000 (15:16 +0200)]
[lldb][NFC] Add size tests for empty records with alignment and with empty members
This came up during the Windows bot failure discussing after D105471 . See
also
3d9a9fa6911a5228ce799a7c639e94d322678934 .
Hiroki [Mon, 30 Aug 2021 12:12:29 +0000 (14:12 +0200)]
[LLDB] Fix 'std::out_of_range' crashing bug when file name completion using file path.
When I run a lldb command that uses filename completion, if I enter a string
that is not only a filename but also a string with a non-file name string added,
such as "./" that is relative path string , it will crash as soon as I press the
[Tab] key. For example, debugging an executable file named "hello" that is
compiled from a file named "hello.c" , and I’ll put a breakpoint on line 3 of
hello.c.
```
$ lldb ./hello
(lldb) breakpoint set --file hello.c --line 3
```
This is not a problem, but if I set "--file ./hello." and then press [Tab] key
to complete file name, lldb crashes.
```
$ lldb ./hello
(lldb) breakpoint set --file ./hello.terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::substr: __pos (which is 8) > this->size() (which is 7)
```
The crash was caused because substr() (in lldb/source/Host/common/Editline.cpp)
cut out string which size is user's input string from the completion string.
I modified the code that erase the user's intput string from current line and
then add the completion string.
Differential Revision: https://reviews.llvm.org/D108817
Aaron Ballman [Mon, 30 Aug 2021 12:51:08 +0000 (08:51 -0400)]
Silence a signed/unsigned mismatch warning; NFC
Kim-Anh Tran [Mon, 30 Aug 2021 12:19:34 +0000 (14:19 +0200)]
[lldb] Return all line entries matchign a line if no column is specified
Previously, if no column was specified, ResolveSymbolContext would take
the first match returned by FindLineEntryIndexByFileIndex, and reuse it
to find subsequent exact matches. With the introduction of columns, columns
are now considered when matching the line entries.
This leads to a problem if one wants to get all existing line entries
that match that line, since now the column is also used for the exact match.
This way, all line entries are filtered out that have a different
column number, but the same line number.
This patch changes that by ignoring the column information of the first match
if the original request of ResolveSymbolContext was also ignoring it.
Reviewed By: mib
Differential Revision: https://reviews.llvm.org/D108816
Djordje Todorovic [Mon, 30 Aug 2021 12:00:36 +0000 (14:00 +0200)]
[LiveDebugValues] Cleanup Transfers when removing Entry Value
If we encounter a new debug value, describing the same parameter,
we should stop tracking the parameter's Entry Value. At that point,
in some cases, the Transfer which uses the parameter's Entry Value,
is already emitted. Thanks to the RemoveRedundantDebugValues pass,
many problems with incorrect instruction order and number of DBG_VALUEs
are fixed. However, we still cannot rely on the rule that each new
debug value is set by the previous non-debug instruction in Machine
Basic Block.
When new parameter debug value triggers removal of Backup Entry Value
for the same parameter, do the cleanup of Transfers emitted from Backup
Entry Values. Get the Transfer Instruction which created the new debug
value and search for debug values already emitted from the to-be-deleted
Backup Entry Value and attached to the Transfer Instruction. If found,
delete the Transfer and remove "primary" Entry Value Var Loc from
OpenRanges.
This patch fixes PR47628.
Patch by Nikola Tesic.
Differential revision: https://reviews.llvm.org/D106856
Jean Perier [Mon, 30 Aug 2021 11:46:04 +0000 (04:46 -0700)]
[flang][mlir] Fix FIR after D108899
After
41d4aa7de68ed551010f27ff04ffc54e7616292a, some builder.getStringAttr
calls in FIR were wrong.
Simon Moll [Mon, 30 Aug 2021 11:30:52 +0000 (13:30 +0200)]
[clang] Add gcc-toolset-10 support (RHEL/CentOS 8)
Clang only adds GCC paths for RHEL <= 7 'devtoolset-<N>' Software
Collections (SCL). This generalizes this support to also include the
'gcc-toolset-10' SCL in RHEL/CentOS 8.
Reviewed By: stephan.dollberg
Differential Revision: https://reviews.llvm.org/D108908
Simon Pilgrim [Mon, 30 Aug 2021 11:24:59 +0000 (12:24 +0100)]
[TTI][X86] getArithmeticInstrCost - move opcode canonicalization before all target-specific costs. NFCI.
The GLM/SLM special cases still get tested first but after the the MUL/DIV/REM pattern detection - this will be necessary for when we make the SLM vXi32 MUL canonicalization generic to improve PMULLW/PMULHW/PMADDDW cost support etc.
Simon Pilgrim [Mon, 30 Aug 2021 11:10:58 +0000 (12:10 +0100)]
Fix MSVC "signed/unsigned mismatch" comparison warning. NFCI.
Raphael Isemann [Thu, 26 Aug 2021 10:29:01 +0000 (12:29 +0200)]
[lldb][NFC] Remove TypeSystemClang::CreateFunctionType overload
This can just be a default argument.
Anton Afanasyev [Mon, 30 Aug 2021 09:32:20 +0000 (12:32 +0300)]
[CMake][NFC] Add comment about new `--gdb-index` option used with `-gsplit-dwarf`
Follow-up of https://reviews.llvm.org/D108776
Dmitry Vyukov [Mon, 30 Aug 2021 08:58:46 +0000 (10:58 +0200)]
tsan: add a comment to CallUserSignalHandler
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D108907
Roman Lebedev [Mon, 30 Aug 2021 09:27:41 +0000 (12:27 +0300)]
[NFCI][IndVars] rewriteLoopExitValues(): don't expand SCEV's until needed
Previously, we'd expand *ALL* the SCEV's eagerly, because we needed to
check with `isValidRewrite()`, and discard bad rewrite candidates,
but now that we do not do that, we also don't need to always expand.
In particular, this avoids expanding potentially-huge SCEV's that we
would discard anyways because they are high-cost and we aren't
rewriting aggressively.
Anton Afanasyev [Wed, 25 Aug 2021 22:25:27 +0000 (01:25 +0300)]
[CMake] Add `--gdb-index` option to linker if split dwarf compiling
The option `--gdb-index` should be passed to linker if compiler is invoked
with `-gsplit-dwarf` option. This allows debugger to locate the appropriate
units quickly. See "Invocation" section here: https://gcc.gnu.org/wiki/DebugFission
Suggested by @dblaikie here: https://reviews.llvm.org/D68556#1698442
Differential Revision: https://reviews.llvm.org/D108776
Alex Zinenko [Mon, 30 Aug 2021 09:13:19 +0000 (11:13 +0200)]
Fix interface trait declaration in SymbolInterfaces.td
41d4aa7de68ed551010f27ff04ffc54e7616292a introduced incorrect code in
extraTraitClassDeclaration: `this` refers to the trait class and not the
operation class so `->getContext()` is not valid. Use `$_op` instead.
Roman Lebedev [Mon, 30 Aug 2021 09:00:26 +0000 (12:00 +0300)]
[IndVars] Drop check for the validity of rewrite
`isValidRewrite()` checks that the both the original SCEV,
and the rewrite SCEV have the same base pointer.
I //believe//, after all the recent SCEV improvements,
this invariant is already enforced by SCEV itself.
I originally tried changing it into an assert in D108043,
but that showed that it triggers on e.g. https://reviews.llvm.org/D108043#2946621,
where SCEV manages to forward the store to load,
test added.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D108655
Roman Lebedev [Mon, 30 Aug 2021 09:00:08 +0000 (12:00 +0300)]
[NFC][IndVars] Add test that caused D108043 to be reverted
We currently don't simplify anything here, but we can.
Michał Górny [Fri, 9 Apr 2021 14:18:50 +0000 (16:18 +0200)]
[lldb] [gdb-remote client] Support minimal fork/vfork handling
Add a support for handling fork/vfork stops in LLGS client. At this
point, it only sends a detach packet for the newly forked child
(and implicitly resumes the parent).
Differential Revision: https://reviews.llvm.org/D100206
“bhkumarn” [Mon, 23 Aug 2021 12:43:11 +0000 (18:13 +0530)]
[DebugInfo] Emit DW_TAG_namelist and DW_TAG_namelist_item
This patch emits DW_TAG_namelist and DW_TAG_namelist_item for fortran
namelist variables. DICompositeType is extended to support this fortran
feature.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D108553
Diana Picus [Wed, 25 Aug 2021 05:57:25 +0000 (05:57 +0000)]
[flang] Add runtime interface for GET_COMMAND_ARGUMENT
GET_COMMAND_ARGUMENT takes a lot of optional arguments: VALUE, LENGTH,
STATUS and ERRMSG. This patch breaks up the interface into 2 different
functions:
* One for getting the LENGTH of an argument.
* One for getting the VALUE and the ERRMSG of an argument. This returns
the STATUS, which can be easily ignored by lowering if it is missing in
the invocation.
Differential Revision: https://reviews.llvm.org/D108688
Diana Picus [Wed, 25 Aug 2021 03:16:30 +0000 (03:16 +0000)]
[flang] Add runtime interface for COMMAND_ARGUMENT_COUNT
Differential Revision: https://reviews.llvm.org/D108687
Florian Hahn [Mon, 30 Aug 2021 06:50:17 +0000 (08:50 +0200)]
[VPlan] Introduce code to limit querying VPValues using IR references.
After applying VPlan-to-VPlan transformations, using IR references to
query VPlan values may be incorrect, as the IR is not in sync with the
VPlan any longer.
To better detect such mis-matches, this patch introduces a new flag to
VPlans to indicate whether it is safe to query VPValues using IR values.
getVPValue is updated to assert if it is called when the flag indicates
it is not safe any longer.
There is an escape hatch via an extra argument, because there are 3
places that need to be fixed first. Those are
1. truncateToMinimalBitwidths
2. clearReductionWrapFlags
3. fixLCSSAPHIs
As a first step, this flag will help preventing new code from violating
this property.
Any suggestions with respect to naming very welcome!
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D108573
Shivam Gupta [Mon, 30 Aug 2021 06:55:29 +0000 (06:55 +0000)]
[docs] Add a new tutorial that talk about how to make a change to llvm
This tutorial will guide you through the process of making a change to LLVM, and contributing it back to the LLVM project.
We'll be making a change to Clang, but the steps for other parts of LLVM are the same. Even though the change we'll be making is simple,
we're going to cover steps like building LLVM, running the tests, and code review. This is good practice, and you'll be prepared for making larger changes.
Authors: @meikeb , @gribozavr
Commit: Zhiqian Xia
PS - This is a duplicate revision of https://reviews.llvm.org/D100714 which was actually used for patch review.
Reviewed By: kuhnel
Differential Revision: https://reviews.llvm.org/D108267
Jean Perier [Mon, 30 Aug 2021 06:58:53 +0000 (08:58 +0200)]
[flang] Apply double precision KindCode in specific proc interface
The double precision KindCode was ignored when building the interface
of specific intrinsic procedures leading to bad semantics checks.
Differential Revision: https://reviews.llvm.org/D108828
Wang, Pengfei [Mon, 30 Aug 2021 04:07:18 +0000 (12:07 +0800)]
[X86] AVX512FP16 instructions enabling 6/6
Enable FP16 complex FMA instructions.
Ref.: https://software.intel.com/content/www/us/en/develop/download/intel-avx512-fp16-architecture-specification.html
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D105269
Chris Lattner [Sun, 29 Aug 2021 21:22:24 +0000 (14:22 -0700)]
[SymbolRefAttr] Revise SymbolRefAttr to hold a StringAttr.
SymbolRefAttr is fundamentally a base string plus a sequence
of nested references. Instead of storing the string data as
a copies StringRef, store it as an already-uniqued StringAttr.
This makes a lot of things simpler and more efficient because:
1) references to the symbol are already stored as StringAttr's:
there is no need to copy the string data into MLIRContext
multiple times.
2) This allows pointer comparisons instead of string
comparisons (or redundant uniquing) within SymbolTable.cpp.
3) This allows SymbolTable to hold a DenseMap instead of a
StringMap (which again copies the string data and slows
lookup).
This is a moderately invasive patch, so I kept a lot of
compatibility APIs around. It would be nice to explore changing
getName() to return a StringAttr for example (right now you have
to use getNameAttr()), and eliminate things like the StringRef
version of getSymbol.
Differential Revision: https://reviews.llvm.org/D108899
Siva Chandra Reddy [Mon, 30 Aug 2021 04:31:30 +0000 (04:31 +0000)]
[libc] Ensure the result of the clone syscall is not on stack in thrd_create.
Also, added a call to munmap on error in thrd_create.
Qiu Chaofan [Mon, 30 Aug 2021 04:18:57 +0000 (12:18 +0800)]
[PowerPC] Set branch/call instructions as no hasSideEffects
PowerPC can model these instructions, so we don't need this flag set.
Reviewed By: shchenz, jsji
Differential Revision: https://reviews.llvm.org/D71983
Siva Chandra Reddy [Mon, 30 Aug 2021 04:08:35 +0000 (04:08 +0000)]
[libc][NFC] Add a check to catch mismatch in internal and public mutex types.
Xiang1 Zhang [Mon, 30 Aug 2021 01:55:19 +0000 (09:55 +0800)]
[X86] Support __SSC_MARK(const int id)
Differential Revision: https://reviews.llvm.org/D108682
Xiang1 Zhang [Mon, 30 Aug 2021 01:50:00 +0000 (09:50 +0800)]
Revert "[X86] Support __SSC_MARK(const int id)"
This reverts commit
78fbde57794e50f5629979f5d69592caf64067e3.
Matthias Springer [Mon, 30 Aug 2021 01:12:14 +0000 (01:12 +0000)]
[mlir][SCF] Canonicalize dim(x) where x is an iter_arg
* Add `DimOfIterArgFolder`.
* Move existing cross-dialect canonicalization patterns to `LoopCanonicalization.cpp`.
* Rename `SCFAffineOpCanonicalization` pass to `SCFForLoopCanonicalization`.
* Expand documentaton of scf.for: The type of loop-carried variables may not change with iterations. (Not even the dynamic type.)
Differential Revision: https://reviews.llvm.org/D108806
Steven Wan [Mon, 30 Aug 2021 01:32:54 +0000 (21:32 -0400)]
[AIX] "aligned" attribute does not decrease alignment
The "aligned" attribute can only increase the alignment of a struct, or struct member, unless it's used together with the "packed" attribute, or used as a part of a typedef, in which case, the "aligned" attribute can both increase and decrease alignment.
That said, we expect:
1. "aligned" attribute alone: does not interfere with the alignment upgrade instrumented by the AIX "power" alignment rule,
2. "aligned" attribute + typedef: overrides any computed alignment,
3. "aligned" attribute + "packed" attribute: overrides any computed alignment.
The old implementation achieved 2 and 3, but didn't get 1 right, in that any field marked attribute "aligned" would not go through the alignment upgrade.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D107394
Xiang1 Zhang [Mon, 30 Aug 2021 01:21:14 +0000 (09:21 +0800)]
[X86] Support __SSC_MARK(const int id)
Differential Revision: https://reviews.llvm.org/D108682
Xiang1 Zhang [Mon, 30 Aug 2021 01:17:42 +0000 (09:17 +0800)]
Revert "[X86] Support __SSC_MARK(const int id)"
This reverts commit
83e82ff767530158fd5590ffea617f50a07534b5.