Jez Ng [Sat, 19 Sep 2020 03:51:38 +0000 (20:51 -0700)]
[lld-macho][NFC] Refactor syslibroot / library path lookup
* Move computation of systemLibraryRoots into a separate function, so we
can add more functionality to it without things becoming unwieldy
* Have `getSearchPaths` and related functions return by value instead of
by output parameter. NRVO should ensure that performance is unaffected.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D87959
Jez Ng [Fri, 18 Sep 2020 18:38:15 +0000 (11:38 -0700)]
[lld-macho] Support -weak_lx, -weak_library, -weak_framework
They cause their corresponding libraries / frameworks to be loaded via
`LC_LOAD_WEAK_DYLIB` instead of `LC_LOAD_DYLIB`.
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D87929
Jez Ng [Wed, 16 Sep 2020 23:07:21 +0000 (16:07 -0700)]
[lld-macho] Ignore `-mllvm` and its argument
Test Plan:
Reviewed By: #lld-macho, compnerd, MaskRay
Differential Revision: https://reviews.llvm.org/D87803
Jez Ng [Sat, 5 Sep 2020 01:02:07 +0000 (18:02 -0700)]
[lld-macho] Emit indirect symbol table
Makes it a little easier to read objdump's disassembly.
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D87178
Jez Ng [Tue, 1 Sep 2020 03:57:19 +0000 (20:57 -0700)]
[lld-macho] Implement and test resolution of common symbols
Handle the case where there are both common and non-common definitions
of the same symbol. Add a bunch of tests to ensure compatibility with ld64.
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D86910
Jez Ng [Fri, 28 Aug 2020 05:54:43 +0000 (22:54 -0700)]
[lld-macho] Initial support for common symbols
On Unix, it is traditionally allowed to write variable definitions without
initialization expressions (such as "int foo;") to header files. These are
called tentative definitions.
The compiler creates common symbols when it sees tentative definitions. When
linking the final binary, if there are remaining common symbols after name
resolution is complete, the linker converts them to regular defined symbols in
a `__common` section.
This diff implements most of that functionality, though we do not yet handle
the case where there are both common and non-common definitions of the same
symbol.
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D86909
Pushpinder Singh [Mon, 10 Aug 2020 09:47:50 +0000 (05:47 -0400)]
[GlobalISel][AMDGPU] Lower G_SMULH/G_UMULH
Reviewed By: arsenm, foad
Differential Revision: https://reviews.llvm.org/D85653
Arthur Eubanks [Thu, 24 Sep 2020 01:52:35 +0000 (18:52 -0700)]
[NFC] Remove unnecessary default constructors
Carl Ritson [Thu, 24 Sep 2020 01:28:46 +0000 (10:28 +0900)]
[AMDGPU] Consider all SGPR uses as unique in constant bus verify
Fix the verifier so that overlapping SGPR operands are counted
independently. We cannot assume that overlapping SGPR accesses
only count as a single constant bus use.
The exception is implicit uses which do not add to constant bus
usage (only) when overlapping.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D87748
Arthur Eubanks [Thu, 24 Sep 2020 01:43:13 +0000 (18:43 -0700)]
Revert "[NewPM] Add callbacks to PassBuilder to run before/after parsing a pass"
This reverts commit
111aa4e36614d9a056cf5040d4d7bbfddeb9ebb2.
Fangrui Song [Thu, 24 Sep 2020 01:36:50 +0000 (18:36 -0700)]
[X86] Parse data32 call in .code16 as CALLpcrel32
Used by kexec-tools (PR46942)
In GNU as, tc-i386.c:output_jump uses 4-byte immediate if a data32 prefix is present.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D88137
Freddy Ye [Thu, 24 Sep 2020 01:12:28 +0000 (09:12 +0800)]
[X86] Add TDX instructions.
For more details about these instructions, please refer to the latest TDX document: https://software.intel.com/content/www/us/en/develop/articles/intel-trust-domain-extensions.html
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D88006
Saleem Abdulrasool [Wed, 23 Sep 2020 20:57:55 +0000 (20:57 +0000)]
Utility: ignore OS version on non-Darwin targets in `ArchSpec`
The OS version field is generally not very helpful for non-Darwin
targets. On Linux, it identifies the kernel version which moves
out-of-sync with the userspace. On Windows, this field actually ends up
corresponding to the Visual Studio toolset version instead of the OS
version. Consider non-Darwin targets without an OS version to be fully
specified.
Differential Revision: https://reviews.llvm.org/D88181
Reviewed By: Jonas Devlieghere, Dave Lee
Gwen Mittertreiner [Wed, 23 Sep 2020 23:20:06 +0000 (16:20 -0700)]
Explicitly specify CMAKE_AR in WinMsvc.cmake
As of cmake 3.18, cmake changes how it searches for compilers for
Windows (see
https://gitlab.kitware.com/cmake/cmake/-/commit/
55196a1440e26917d40e6a7a3eb8d9fb323fa657)
and now finds llvm-ar instead of llvm-lib as CMAKE_AR. This explicitly
specifies CMAKE_AR as llvm-lib so the correct program is found.
Reviewed By: smeenai
Differential Revision: https://reviews.llvm.org/D88176
Zequan Wu [Wed, 23 Sep 2020 01:10:26 +0000 (18:10 -0700)]
[CGProfile] don't emit cgprofile entry if called function is dllimport
Differential Revision: https://reviews.llvm.org/D88127
Sam McCall [Wed, 23 Sep 2020 23:51:29 +0000 (01:51 +0200)]
[clangd] Improve bad-RPC-payload error messages slightly
Louis Dionne [Wed, 23 Sep 2020 23:44:03 +0000 (19:44 -0400)]
[libc++] Fix spurious test failure in -fno-exceptions
Sam McCall [Wed, 23 Sep 2020 23:30:42 +0000 (01:30 +0200)]
Sam McCall [Wed, 23 Sep 2020 23:14:12 +0000 (01:14 +0200)]
[JSON] Add error reporting to fromJSON and ObjectMapper
Translating between JSON objects and C++ strutctures is common.
From experience in clangd, fromJSON/ObjectMapper work well and save a lot of
code, but aren't adopted elsewhere at least partly due to total lack of error
reporting beyond "ok"/"bad".
The recently-added error model should be rich enough for most applications.
It requires tracking the path within the root object and reporting local
errors at appropriate places.
To do this, we exploit the fact that the call graph of recursive
parse functions mirror the structure of the JSON itself.
The current path is represented as a linked list of segments, each of which is
on the stack as a parameter. Concretely, fromJSON now looks like:
bool fromJSON(const Value&, T&, Path);
Beyond the signature change, this is reasonably unobtrusive: building
the path segments is mostly handled by ObjectMapper and the vector<T> fromJSON.
However the root caller of fromJSON must now create a Root object to
store the errors, which is a little clunky.
I've added high-level parse<T>(StringRef) -> Expected<T>, but it's not
general enough to be the primary interface I think (at least, not usable in
clangd).
All existing users (mostly just clangd) are updated in this patch,
making this change backwards-compatible is a bit hairy.
Differential Revision: https://reviews.llvm.org/D88103
Ryan Prichard [Wed, 23 Sep 2020 21:25:23 +0000 (14:25 -0700)]
[libunwind] Optimize dl_iterate_phdr's findUnwindSectionsByPhdr
Currently, findUnwindSectionsByPhdr is slightly micro-optimized for the
case where the first callback has the target address, and is otherwise
very inefficient -- it decodes .eh_frame_hdr even when no PT_LOAD
matches the PC. (If the FrameHeaderCache is enabled, then the
micro-optimization only helps the first time unwind info is looked up.)
Instead, it makes more sense to optimize for the case where the
callback *doesn't* find the target address, so search for a PT_LOAD
segment first, and only look for the unwind info section if a matching
PT_LOAD is found.
This change helps on an Android benchmark with 100 shared objects,
where the DSO at the end of the dl_iterate_phdr list throws 10000
exceptions. Assuming the frame cache is disabled, this change cuts
about 30-40% off the benchmark's runtime.
Reviewed By: compnerd, saugustine, #libunwind
Differential Revision: https://reviews.llvm.org/D87881
Ryan Prichard [Wed, 23 Sep 2020 21:25:13 +0000 (14:25 -0700)]
[libunwind] Combine dl_iterate_phdr codepaths for DWARF and EHABI
dl_iterate_phdr is used to search for unwind info provided by either
PT_GNU_EH_FRAME or PT_ARM_EXIDX. Most of the code between the two is
the same, so combine them, and factor out what's different into
checkForUnwindInfoSegment.
Details:
- The FrameHeaderCache can now be enabled for ARM EHABI.
- findUnwindSectionsByPhdr now finds the last PT_ARM_EXIDX rather than
the first. There should only be one segment.
- The dso_base and text_segment_length fields of UnwindInfoSections
are now needed for dl_iterate_phdr when using EHABI, to hold the
low and high PC values for a cache entry.
Reviewed By: compnerd, danielkiss, #libunwind, saugustine
Differential Revision: https://reviews.llvm.org/D87880
Sam McCall [Wed, 23 Sep 2020 22:28:52 +0000 (00:28 +0200)]
[JSON] Display errors associated with Paths in context
When an error occurs processing a JSON object, seeing the actual
surrounding data helps. Dumping just the node where the problem
was identified can be too much or too little information.
printErrorContext() shows the error message in its context, as a comment.
JSON values along the path to the broken place are shown in some detail,
the rest of the document is elided. For example:
```
{
"credentials": [
{
"username": /* error: expected string */ 42,
"password": "secret"
},
{ ... }
]
"backups": { ... }
}
```
Differential Revision: https://reviews.llvm.org/D88103
Arthur Eubanks [Tue, 22 Sep 2020 16:34:46 +0000 (09:34 -0700)]
[NewPM] Add callbacks to PassBuilder to run before/after parsing a pass
This is in preparation for supporting -debugify-each, which adds a debug
info pass before and after each pass.
Switch VerifyEach to use this.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D88107
Arthur Eubanks [Wed, 16 Sep 2020 20:49:31 +0000 (13:49 -0700)]
[NewPM][CGSCC] Handle newly added functions in updateCGAndAnalysisManagerForPass
This seems to fit the CGSCC updates model better than calling
addNewFunctionInto{Ref,}SCC() on newly created/outlined functions.
Now addNewFunctionInto{Ref,}SCC() are no longer necessary.
However, this doesn't work on newly outlined functions that aren't
referenced by the original function. e.g. if a() was outlined into b()
and c(), but c() is only referenced by b() and not by a(), this will
trigger an assert.
This also fixes an issue I was seeing with newly created functions not
having passes run on them.
Ran check-llvm with expensive checks.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D87798
Arthur Eubanks [Wed, 23 Sep 2020 01:33:42 +0000 (18:33 -0700)]
[NewPM][MSSA] Fix failures under NPM due to -enable-mssa-loop-dependency
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D88128
Sam McCall [Wed, 23 Sep 2020 22:01:45 +0000 (00:01 +0200)]
[JSON] Facility to track position within an object and report errors.
This error model should be rich enough for most applications. It comprises:
- a name for the root object, so the user knows what we're parsing
- a path from the root object to the JSON node most associated with the error
- a local error message
This can be presented as an llvm::Error e.g.
"expected string at ConfigFile.credentials[0].username"
It's designed to be cheap: Paths are a linked list of lightweight
objects on the stack. No heap allocations unless errors are encountered.
A subsequent commit will make use of this in the JSON-to-object
translation facilities: fromJSON and ObjectMapper.
However it's independent of these and can be used for e.g. validation alone.
Another subsequent commit will support showing the error in its context
within the parsed value.
Differential Revision: https://reviews.llvm.org/D88103
Greg McGary [Sun, 20 Sep 2020 15:37:20 +0000 (08:37 -0700)]
[lld-macho] handle options -search_paths_first, -search_dylibs_first
Differential Revision: https://reviews.llvm.org/D88054
Craig Topper [Wed, 23 Sep 2020 21:53:16 +0000 (14:53 -0700)]
[X86] Add a memory clobber to the bittest intrinsic inline asm. Get default clobbers from the target
I believe the inline asm emitted here should have a memory clobber since it writes to memory.
It was also missing the dirflag clobber that we use by default along with flags and fpsr. To avoid missing defaults in the future, get the default list from the target
Differential Revision: https://reviews.llvm.org/D88121
Greg McGary [Wed, 23 Sep 2020 15:53:37 +0000 (08:53 -0700)]
[lld-macho] cleanup unimplemented-option warnings
Remove all spurious `HelpHidden` flags from `lld/MachO/Options.td`. Add test for `HelpHidden` to `warnIfUnimplementedOption()` so that the empty `// handled elsewhere` case is unnecessary.
Reviewed By: #lld-macho, int3, smeenai
Differential Revision: https://reviews.llvm.org/D88160
Sam McCall [Wed, 23 Sep 2020 21:33:19 +0000 (23:33 +0200)]
[JSON] Allow emitting comments in json::OStream
This isn't standard JSON, but is a popular extension.
It will be used to show errors in context, rendering pseudo-json for humans.
Differential Revision: https://reviews.llvm.org/D88103
Eli Friedman [Wed, 23 Sep 2020 21:10:33 +0000 (14:10 -0700)]
[SelectionDAG][GISel] Make LegalizeDAG lower FNEG using integer ops.
Previously, if a floating-point type was legal, but FNEG wasn't legal,
we would use FSUB. Instead, we should use integer ops, to preserve the
semantics. (Alternatively, there's a compiler-rt call we could use, but
there isn't much reason to use that.)
It turns out we actually are still using this obscure codepath in a few
cases: on some targets, we have "legal" floating-point types that don't
actually support any floating-point operations. In particular, ARM and
AArch64 are using this path.
The implementation for SelectionDAG is pretty simple because we can
reuse the infrastructure from FCOPYSIGN.
See also 9a3dc3e, the corresponding change to type legalization.
Also includes a "bonus" change to STRICT_FSUB legalization, so we can
lower a STRICT_FSUB to a float libcall.
Includes the changes to both LegalizeDAG and GlobalISel so we don't have
inconsistent results in the future.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46792 .
Differential Revision: https://reviews.llvm.org/D84287
Cameron McInally [Wed, 23 Sep 2020 20:55:06 +0000 (15:55 -0500)]
[AArch64] Expand some vector of i64 reductions on NEON
With the exception of VECREDUCE_ADD, there are no NEON instructions to support vector of i64 reductions. This patch removes the Custom lowerings for those and adds some test coverage to confirm.
Differential Revision: https://reviews.llvm.org/D88161
Yaxun (Sam) Liu [Wed, 23 Sep 2020 20:16:00 +0000 (16:16 -0400)]
Recommit [NFC] Refactor DiagnosticBuilder and PartialDiagnostic
This recommits
829d14ee0a6aa79c89f7f3d9fcd9d27d3efd2b91.
The patch was reverted due to a regression in some CUDA app
which was thought to be caused by this patch. However, investigation
showed that the regression was due to some other issues, therefore
recommit this patch.
Amy Kwan [Wed, 23 Sep 2020 20:46:54 +0000 (16:46 -0400)]
[PowerPC] Implement the 128-bit vec_[all|any]_[eq | ne | lt | gt | le | ge] builtins in Clang/LLVM
This patch implements the vec_[all|any]_[eq | ne | lt | gt | le | ge] builtins for vector signed/unsigned __int128.
Differential Revision: https://reviews.llvm.org/D87910
Albion Fung [Wed, 23 Sep 2020 20:37:48 +0000 (16:37 -0400)]
[PowerPC] Implement Vector signed/unsigned __int128 overloads for the comparison builtins
This patch implements Vector signed/unsigned __int128 overloads for the comparison builtins.
Differential Revision: https://reviews.llvm.org/D87804
Krzysztof Parzyszek [Wed, 23 Sep 2020 19:59:13 +0000 (14:59 -0500)]
Clean up test file, NFC
Stefanos Baziotis [Wed, 23 Sep 2020 19:53:05 +0000 (22:53 +0300)]
[LoopTerminology][NFC] Fix formatting typo
Joseph Tremoulet [Wed, 23 Sep 2020 16:20:10 +0000 (09:20 -0700)]
[lldb] Normalize paths in new test
The minidump-sysroot test I added in commit
20f84257 compares two paths
using a string comparison. This causes the Windows buildbot to fail
because of mismatched forward slashes and backslashes. Use
os.path.normcase to normalize before comparing.
Aaron Ballman [Wed, 23 Sep 2020 19:24:52 +0000 (15:24 -0400)]
Allow init_priority values <= 100 and > 65535 within system headers.
This also adds some bare-bones documentation for the attribute rather
than leaving it undocumented.
Muhammad Asif Manzoor [Wed, 23 Sep 2020 19:22:13 +0000 (15:22 -0400)]
[AArch64][SVE] Add lowering for llvm frecpx
Add the functionality to lower frecpx for passthru variant
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D88032
Nikita Popov [Wed, 23 Sep 2020 19:08:15 +0000 (21:08 +0200)]
Revert "[lsan] On Fuchsia, don't use atexit hook for leak checks"
This reverts commit
0caad9fe441d5ee562e96d8b30b5574b492a933a.
This reverts commit
c96d0cceb684fa176b51d7df5f4f8370e2c983f4.
Causes linker errors which were not fixed by the subsequent commit
either:
/home/nikic/llvm-project/compiler-rt/lib/asan/asan_rtl.cpp:503: error: undefined reference to '__asan::InstallAtExitCheckLeaks()'
Kostya Kortchinsky [Wed, 23 Sep 2020 17:22:15 +0000 (10:22 -0700)]
[scudo][standalone] Fix tests under ASan/UBSan
Fix a potential UB in `appendSignedDecimal` (with -INT64_MIN) by making
it a special case.
Fix the terrible test cases for `isOwned`: I was pretty sloppy on those
and used some stack & static variables, but since `isOwned` accesses
memory prior to the pointer to check for the validity of the Scudo
header, it ended up being detected as some global and stack buffer out
of bounds accesses. So not I am using buffers with enough room so that
the test will not access memory prior to the variables.
With those fixes, the tests pass on the ASan+UBSan Fuchsia build.
Thanks to Roland for pointing those out!
Differential Revision: https://reviews.llvm.org/D88170
Roland McGrath [Wed, 23 Sep 2020 18:41:09 +0000 (11:41 -0700)]
asan: Use `#if` to test CAN_SANITIZE_LEAKS
The `if (0)` isn't necessarily optimized out so as not to create
a link-time reference to LSan runtime functions that might not
exist. So use explicit conditional compilation instead.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D88173
Victor Huang [Wed, 23 Sep 2020 18:43:33 +0000 (13:43 -0500)]
[PowerPC][PCRelative] Thread Local Storage Support for Local Dynamic
This patch is the initial support for the Local Dynamic Thread Local Storage
model to produce code sequence and relocation correct to the ABI for the model
when using PC relative memory operations.
Differential Revision: https://reviews.llvm.org/D87721
Andrew Litteken [Tue, 15 Sep 2020 22:30:31 +0000 (17:30 -0500)]
[IRSim] Adding IRSimilarityCandidate that contains a region of IRInstructionData.
The IRSimilarityCandidate is a container to hold a region of
IRInstructions and offer interfaces for the starting instruction, ending
instruction, parent function, length. It also assigns a global value
number for each unique instance of a value in the region.
It also contains an interface to compare two IRSimilarity as to whether
they have the same sequence of similar instructions.
Tests for whether the instructions are similar are found in
unittests/Analysis/IRSimilarityIdentifierTest.cpp.
Recommit of:
4944bb190fed8861d4d043eaf45e3c1e12aa2dc5
Differential Revision: https://reviews.llvm.org/D86970
Stanislav Mekhanoshin [Fri, 18 Sep 2020 20:20:00 +0000 (13:20 -0700)]
[AMDGPU] Make ds fp atomics overloadable
Differential Revision: https://reviews.llvm.org/D87947
Jim Ingham [Wed, 23 Sep 2020 01:05:46 +0000 (18:05 -0700)]
Add `breakpoint delete --disabled`: deletes all disabled breakpoints.
Differential Revision: https://reviews.llvm.org/D88129
Eli Friedman [Tue, 22 Sep 2020 22:05:13 +0000 (15:05 -0700)]
[AArch64][SVE] Fix frame offset calculation when d8 is saved.
If d8 is saved, the fp is not actually adjacent to the SVE
spills/allocations. Fix the offset calculation to account for this.
Differential Revision: https://reviews.llvm.org/D88117
Mike Urbach [Wed, 23 Sep 2020 18:01:39 +0000 (18:01 +0000)]
[mlir][OpFormatGen] Update "custom" directives for attributes.
This tweaks the generated code for parsing attributes with a custom
directive to call `addAttribute` on the `OperationState` directly,
and adds a newline after this call. Previously, the generated code
would call `addAttribute` on the `OperationState` field `attributes`,
which has no such method and fails to compile. Furthermore, the lack
of newline would generate code with incorrectly formatted single line
`if` statements. Added tests for parsing and printing attributes with
a custom directive.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D87860
Arthur Eubanks [Mon, 21 Sep 2020 23:28:21 +0000 (16:28 -0700)]
[gn build] Allow option to build with asan/tsan/ubsan
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D88056
Roland McGrath [Wed, 23 Sep 2020 01:02:56 +0000 (18:02 -0700)]
[lsan] On Fuchsia, don't use atexit hook for leak checks
Fuchsia's system libraries are instrumented and use the lsan
allocator for internal purposes. So leak checking needs to run
after all atexit hooks and after the system libraries' internal
exit-time hooks. The <zircon/sanitizer.h> hook API calls the
__sanitizer_process_exit_hook function at exactly the right time.
Reviewed By: vitalybuka, phosek
Differential Revision: https://reviews.llvm.org/D86171
Mehdi Amini [Wed, 23 Sep 2020 18:00:37 +0000 (18:00 +0000)]
Document the `--verbatim` flag from arc to update the description for a phabricator revision
Mehdi Amini [Wed, 23 Sep 2020 17:57:27 +0000 (17:57 +0000)]
Update Phabricator doc to remove the warning on "arc land": tags a properly handled server side now
Eric Astor [Wed, 23 Sep 2020 17:57:43 +0000 (13:57 -0400)]
Revert "[ms] [llvm-ml] Add support for .radix directive, and accept all radix specifiers"
This reverts commit
5dd1b6d612655c9006ba97a8b6487ded80719b48.
Craig Topper [Wed, 23 Sep 2020 17:25:00 +0000 (10:25 -0700)]
[SLP] Make HorizontalReduction::getOperationData take an Instruction* instead of a Value*. NFCI
All of the callers already have an Instruction *. Many of them
from a dyn_cast.
Also update the OperationData constructor to use a Instruction&
to remove a dyn_cast and make it clear that the pointer is non-null.
Differential Revision: https://reviews.llvm.org/D88132
Craig Topper [Wed, 23 Sep 2020 17:20:03 +0000 (10:20 -0700)]
[X86] Improve demanded bits for X86ISD::BEXTR.
If the control is constant we can figure out exactly which bits
of the input are demanded.
Differential Revision: https://reviews.llvm.org/D88072
Eric Astor [Wed, 23 Sep 2020 17:49:56 +0000 (13:49 -0400)]
Fix include location (accidentally committed a local variation)
Sanjay Patel [Wed, 23 Sep 2020 17:46:26 +0000 (13:46 -0400)]
[TTI] add wrapper for matching vector reduction to reduce code duplication; NFC
I'm not sure what this means, but the order in which we try
the matches makes a difference on at least 1 regression test...
Eric Astor [Wed, 23 Sep 2020 17:42:22 +0000 (13:42 -0400)]
[ms] [llvm-ml] Add support for .radix directive, and accept all radix specifiers
Add support for .radix directive, and radix specifiers [yY] (binary), [oOqQ] (octal), and [tT] (decimal).
Also, when lexing MASM integers, require radix specifier; MASM requires that all literals without a radix specifier be treated as in the default radix. (e.g., 0100 = 100)
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D87400
Paul C. Anagnostopoulos [Thu, 3 Sep 2020 13:41:09 +0000 (09:41 -0400)]
Enhance TableGen so that backends can produce better error messages.
Modify SearchableTableEmitter.cpp to take advantage.
Clean up formatting and capitalization issues.
Sriraman Tallam [Wed, 23 Sep 2020 16:26:41 +0000 (09:26 -0700)]
Re-apply https://reviews.llvm.org/D87921, was reverted to triage a PPC bot failure.
D87921 was reverted in commit
b89059a31347dd09b55a96b99b3dbe38d7749908
as it was causing an unknown llvm PPC bot failure. Reapplying the patch
after confirming that this is not responsible. Build bot failure:
https://reviews.llvm.org/D87921#2286644 which caused the revert.
The wrong placement of add pass with optimizations led to
-funique-internal-linkage-names being disabled.
Fixed the placement of the MPM.addpass for UniqueInternalLinkageNames to make it
work correctly with -O2 and new pass manager. Updated the tests to explicitly
check O0 and O1.
Differential Revision: https://reviews.llvm.org/D87921
Dmitry Antipov [Wed, 23 Sep 2020 17:21:18 +0000 (20:21 +0300)]
[Driver] Check whether Gentoo-specific configuration directory exists
Check whether /etc/env.d/gcc exists before trying to read from any
file from there. This saves a few OS calls on a non-Gentoo system.
Differential Revision: https://reviews.llvm.org/D87143
Krzysztof Parzyszek [Wed, 23 Sep 2020 17:23:54 +0000 (12:23 -0500)]
Break long line accidentally left in the previous commit
Fangrui Song [Wed, 23 Sep 2020 17:23:48 +0000 (10:23 -0700)]
Revert D87970 "[ThinLTO] Avoid temporaries when loading global decl attachment metadata"
This reverts commit
ab1b4810b55279bcf6fdd87be74a403440be3991.
It caused an issue in llvm::lto::thinBackend for a -fsanitize=cfi build.
```
AbbrevNo is 0 => "Invalid abbrev number"
0 llvm::BitstreamCursor::getAbbrev (this=0x9db4c8, AbbrevID=4) at llvm/include/llvm/Bitstream/BitstreamReader.h:528
1 0x00007f5f777a6eb4 in llvm::BitstreamCursor::readRecord (this=0x9db4c8, AbbrevID=4, Vals=llvm::SmallVector of Size 0, Capacity 64, Blob=0x7ffcd0e26558) at
usr/local/google/home/maskray/llvm/llvm/lib/Bitstream/Reader/BitstreamReader.cpp:228
2 0x00007f5f796bf633 in llvm::MetadataLoader::MetadataLoaderImpl::lazyLoadOneMetadata (this=0x9db3a0, ID=188, Placeholders=...) at /usr/local/google/home/mas
ray/llvm/llvm/lib/Bitcode/Reader/MetadataLoader.cpp:1091
3 0x00007f5f796c2527 in llvm::MetadataLoader::MetadataLoaderImpl::getMetadataFwdRefOrLoad (this=0x9db3a0, ID=188) at llvm
lib/Bitcode/Reader/MetadataLoader.cpp:668
4 0x00007f5f796bfff3 in llvm::MetadataLoader::getMetadataFwdRefOrLoad (this=0xd31580, Idx=188) at llvm/lib/Bitcode/Reader
MetadataLoader.cpp:2290
5 0x00007f5f79638265 in (anonymous namespace)::BitcodeReader::parseFunctionBody (this=0xd312e0, F=0x9de758) at llvm/lib/B
tcode/Reader/BitcodeReader.cpp:3938
6 0x00007f5f79635d32 in (anonymous namespace)::BitcodeReader::materialize (this=0xd312e0, GV=0x9de758) at llvm/lib/Bitcod
/Reader/BitcodeReader.cpp:5408
7 0x00007f5f7f8dbe3e in llvm::Module::materialize (this=0x9b92c0, GV=0x9de758) at llvm/lib/IR/Module.cpp:442
8 0x00007f5f7f7f8fbe in llvm::GlobalValue::materialize (this=0x9de758) at llvm/lib/IR/Globals.cpp:50
9 0x00007f5f83b9b5f5 in llvm::FunctionImporter::importFunctions (this=0x7ffcd0e2a730, DestModule=..., ImportList=...) at
llvm/lib/Transforms/IPO/FunctionImport.cpp:1182
```
Krzysztof Parzyszek [Wed, 23 Sep 2020 15:48:34 +0000 (10:48 -0500)]
[EarlyCSE] Fix crash with expensive checks after D87691
D87691 reordered some checks, which turned out to be unsafe. More
specifically, when examining a store instruction, the check against
getOrCreateResult should be done before attempting to call
isSameMemGeneration. Otherwise a crash in MSSA walker can occur.
This patch restores the order of these calls to what it was originally.
Mircea Trofin [Wed, 23 Sep 2020 17:12:16 +0000 (10:12 -0700)]
Add REQUIRES to embed-bitcode-noopt.ll
Vinicius Tinti [Wed, 23 Sep 2020 15:28:19 +0000 (16:28 +0100)]
[Support/Path] Add path::is_absolute_gnu
Implements IS_ABSOLUTE_PATH from GNU tools.
C++17 is_absolute behavior is different the from the behavior defined by GNU
tools.
According to cppreference.com, C++17 states: "An absolute path is a path
that unambiguously identifies the location of a file without reference
to an additional starting location."
In other words, the rules are:
1. POSIX style paths with nonempty root directory are absolute.
2. Windows style paths with nonempty root name and root directory are
absolute.
3. No other paths are absolute.
GNU rules are:
1. Paths starting with a path separator are absolute.
2. Windows style paths are also absolute if they start with a character
followed by ':'.
3. No other paths are absolute.
On Windows style the path "C:\Users\Default" has "C:" as root name and "\"
as root directory.
Hence "C:" on Windows is absolute under GNU rules and not absolute under
C++17 because it has no root directory. Likewise "/" and "\" on Windows are
absolute under GNU and are not absolute under C++17 due to empty root name.
Related to PR46368.
Differential Revision: https://reviews.llvm.org/D87667
Dmitry Antipov [Wed, 23 Sep 2020 16:37:50 +0000 (19:37 +0300)]
Add optimal thread strategy
Add an optimal thread strategy to execute specified amount of tasks.
This strategy should prevent us from creating too many threads if we
occasionaly have an unexpectedly small amount of tasks.
Differential Revision: https://reviews.llvm.org/D87765
Mircea Trofin [Tue, 22 Sep 2020 20:33:34 +0000 (13:33 -0700)]
[clang]Test ensuring -fembed-bitcode passed to cc1 captures pre-opt bitcode.
This is important to not regress because it allows us to capture pre-optimization
bitcode and options, and replay the full optimization pipeline.
Differential Revision: https://reviews.llvm.org/D88114
Guozhi Wei [Wed, 23 Sep 2020 16:27:34 +0000 (09:27 -0700)]
[MBFIWrapper] Add a new function getBlockProfileCount
MBFIWrapper keeps track of block frequencies of newly created blocks and
modified blocks, modified block frequencies should also impact block profile
count. This class doesn't provide interface getBlockProfileCount, users can only
use the underlying MBFI to query profile count, the underlying MBFI doesn't know
the modifications made in MBFIWrapper, so it either provides stale profile count
for modified block or simply crashes on new blocks.
So this patch add function getBlockProfileCount to class MBFIWrapper to handle
new blocks or modified blocks.
Differential Revision: https://reviews.llvm.org/D87802
Stella Laurenzo [Wed, 23 Sep 2020 16:30:13 +0000 (09:30 -0700)]
NFC: Remove dangling dep on MLIRStandardOps.
Was inadvertently left out of D88155.
David Greene [Wed, 23 Sep 2020 16:07:33 +0000 (11:07 -0500)]
[UpdateTestChecks] Remove bug-exposing test
Remove RISCV codegen tests for --include-generated-funcs because apparently
MachineOutliner has a bug on that target that is exposed by expensive-checks.
Stella Laurenzo [Wed, 23 Sep 2020 15:13:30 +0000 (08:13 -0700)]
Remove MLIR C-API explicit registration of standard ops.
* Added mlirRegisterAllDialects() to the python API until a more complete registration design emerges for it.
Differential Revision: https://reviews.llvm.org/D88155
Rahul Joshi [Wed, 23 Sep 2020 04:06:25 +0000 (21:06 -0700)]
[MLIR][NFC] Adopt use of BlockRange in place of ArrayRef<Block *>
- Use BlockRange in ODS generated builders as well as other places throughout the code
Differential Revision: https://reviews.llvm.org/D87955
Mehdi Amini [Wed, 23 Sep 2020 16:09:05 +0000 (16:09 +0000)]
Update the documentation for the MLIR Dialect class (NFC)
Aaron Ballman [Wed, 23 Sep 2020 16:11:07 +0000 (12:11 -0400)]
Improve dynamic AST matching diagnostics for conversion errors
Currently, when marshaling a dynamic AST matchers, we check for the type
and value validity of matcher arguments at the same time for some matchers.
For instance, when marshaling hasAttr("foo"), the argument is first type
checked to ensure it's a string and then checked to see if that string can
locate an attribute with that name. Similar happens for other enumeration
conversions like cast kinds or unary operator kinds. If the type is
correct but the value cannot be looked up, we make a best-effort attempt
to find a nearby name that the user might have meant, but if one cannot
be found, we throw our hands up and claim the types don't match.
This has an unfortunate behavior that when the user enters something of
the correct type but a best guess cannot be located, you get confusing
error messages like:
Incorrect type for arg 1. (Expected = string) != (Actual = String).
This patch splits the argument check into two parts: if the types don't
match, give a type diagnostic. If the type matches but the value cannot
be converted, give a best guess diagnostic or a value could not be
located diagnostic. This addresses PR47057.
Rahul Joshi [Wed, 23 Sep 2020 04:00:11 +0000 (21:00 -0700)]
[MLIR][NFC] Adopt use of TypeRange in build() methods.
- Use TypeRange instead of ArrayRef<Type> where possible.
- Change some of the custom builders to also use TypeRange
Differential Revision: https://reviews.llvm.org/D87944
Rahul Joshi [Wed, 23 Sep 2020 03:58:30 +0000 (20:58 -0700)]
[MLIR] Change default builders generated by TableGen to use TypeRange for result types
- Change the default builders to use TypeRange instead of ArrayRef<Type>
- Custom builders defined in LinalgStructuredOps now conflict with the default
separate param ones, but the default collective params one is still needed. Resolve
this by replicating the collective param builder as a custom builder and skipping
the generation of default builders for these ops.
Differential Revision: https://reviews.llvm.org/D87926
Yaxun (Sam) Liu [Wed, 23 Sep 2020 15:47:21 +0000 (11:47 -0400)]
Fix regressioin in test dwp-separate-debug-file.cpp
Alex Zinenko [Wed, 23 Sep 2020 13:02:47 +0000 (15:02 +0200)]
[mlir] Add insert before/after to list-like constructs in C API
Blocks in a region and operations in a block are organized in a linked list.
The C API only provides functions to append or to insert elements at the
specified numeric position in the list. The latter is expensive since it
requires to traverse the list. Add insert before/after functionality with low
cost that relies on the iplist elements being convertible to iterators.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D88148
Dave Lee [Tue, 22 Sep 2020 23:08:48 +0000 (16:08 -0700)]
[lldb] Remove lldb-perf remenant
Delete a file remaining from the deletion of lldb-perf in D64362.
Differential Revision: https://reviews.llvm.org/D88119
Yaxun (Sam) Liu [Mon, 14 Sep 2020 18:21:30 +0000 (14:21 -0400)]
recommit [HIP] Fix -gsplit-dwarf option
recommit
e50465ecefc964e5700df26fc7e02a673eed085a with fix for
regression in lldb tests.
Two issues:
1. the directory part of original .dwo file was dropped
2. if the stem of the .dwo file contains '.', the last dot
and strings after that were removed
This recommit fixes those two issues.
Andrew Wei [Wed, 23 Sep 2020 14:44:30 +0000 (22:44 +0800)]
[AArch64] Fix ldst optimization of non-immediate store offset
When matching store instruction for ldst opt, we should make sure store instr is in 'reg+imm' form as load instr,
otherwise, it will have assertion in isLdOffsetInRangeOfSt since it will use getImm() directly.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D87905
Simon Pilgrim [Wed, 23 Sep 2020 14:54:50 +0000 (15:54 +0100)]
Add missing namespace closure comments. NFCI.
Fixes some clang-tidy llvm-namespace-comment warnings.
Simon Pilgrim [Wed, 23 Sep 2020 14:53:00 +0000 (15:53 +0100)]
Add missing namespace closure comment. NFCI.
Fixes clang-tidy llvm-namespace-comment warning.
Sebastian Neubauer [Wed, 23 Sep 2020 15:16:39 +0000 (17:16 +0200)]
Revert "[AMDGPU] Insert waitcnt after returning from call"
This reverts commit
ca907bfb57d8ad3ec3bcc2cff2abab7b1b933af6.
According to michel.daenzer,
> This completely broke the Mesa radeonsi driver on Navi 14. Xorg +
> xterm come up with major corruption & psychedelic colours.
Jacques Pienaar [Wed, 23 Sep 2020 15:10:16 +0000 (08:10 -0700)]
[mlir] Remove unneeded OpBuilder params. NFC.
These are now automatically prepended.
Jacques Pienaar [Wed, 23 Sep 2020 14:50:45 +0000 (07:50 -0700)]
[mlir][ods] Custom builder with no params
Incorrect generation of custom build method without any params.
Stella Laurenzo [Wed, 23 Sep 2020 15:00:31 +0000 (08:00 -0700)]
NFC: Remove unused variable.
Stella Laurenzo [Mon, 21 Sep 2020 04:25:46 +0000 (21:25 -0700)]
Add mlir python APIs for creating operations, regions and blocks.
* The API is a bit more verbose than I feel like it needs to be. In a follow-up I'd like to abbreviate some things and look in to creating aliases for common accessors.
* There is a lingering lifetime hazard between the module and newly added operations. We have the facilities now to solve for this but I will do that in a follow-up.
* We may need to craft a more limited API for safely referencing successors when creating operations. We need more facilities to really prove that out and should defer for now.
Differential Revision: https://reviews.llvm.org/D87996
Stella Laurenzo [Sun, 20 Sep 2020 05:02:32 +0000 (22:02 -0700)]
Implement python iteration over the operation/region/block hierarchy.
* Removes the half-completed prior attempt at region/block mutation in favor of new approach to ownership.
* Will re-add mutation more correctly in a follow-on.
* Eliminates the detached state on blocks and regions, simplifying the ownership hierarchy.
* Adds both iterator and index based access at each level.
Differential Revision: https://reviews.llvm.org/D87982
Stella Laurenzo [Sat, 19 Sep 2020 01:38:21 +0000 (18:38 -0700)]
Add Operation to python bindings.
* Fixes a rather egregious bug with respect to the inability to return arbitrary objects from py::init (was causing aliasing of multiple py::object -> native instance).
* Makes Modules and Operations referencable types so that they can be reliably depended on.
* Uniques python operation instances within a context. Opens the door for further accounting.
* Next I will retrofit region and block to be dependent on the operation, and I will attempt to model the API to avoid detached regions/blocks, which will simplify things a lot (in that world, only operations can be detached).
* Added quite a bit of test coverage to check for leaks and reference issues.
* Supercedes: https://reviews.llvm.org/D87213
Differential Revision: https://reviews.llvm.org/D87958
Valentin Clement [Wed, 23 Sep 2020 14:26:09 +0000 (10:26 -0400)]
[mlir][openacc] Use OptionalParseResult in loop op parser instead of bool variables
This patch switch from using bool variables to OptionalParseResult for the parsing
inside loop operation. This is already done for parallel operation and this patch unify this
in the dialect.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D88111
SuJunda (Junda Su) [Wed, 23 Sep 2020 14:16:05 +0000 (10:16 -0400)]
[docs][llvm] Fix typos
I don't have commit access.
Please help me commit it.
Thanks : )
Reviewed By: Paul-C-Anagnostopoulos
Differential Revision: https://reviews.llvm.org/D88139
Utkarsh Saxena [Wed, 23 Sep 2020 12:37:07 +0000 (14:37 +0200)]
[clangd] Refactor code completion signal's utility properties.
Current implementation of heuristic-based scoring function also contains
computation of derived signals (e.g. whether name contains a word from
context, computing file distances, scope distances.)
This is an attempt to separate out the logic for computation of derived
signals from the scoring function.
This will allow us to have a clean API for scoring functions that will
take only concrete code completion signals as input.
Differential Revision: https://reviews.llvm.org/D88146
Cameron McInally [Wed, 23 Sep 2020 14:06:20 +0000 (09:06 -0500)]
[SVE] Lower fixed length ISD::VECREDUCE_ADD to Scalable
Differential Revision: https://reviews.llvm.org/D87796
Florian Hahn [Wed, 23 Sep 2020 13:44:31 +0000 (14:44 +0100)]
[VPlan] Disconnect VPValue and VPUser.
This refactors VPuser to not inherit from VPValue to facilitate
introducing operations that introduce multiple VPValues (e.g.
VPInterleaveRecipe).
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D84679
Alex Zinenko [Wed, 23 Sep 2020 13:37:57 +0000 (15:37 +0200)]
[mlir] Fix typos in Dialect.h. NFC.
Jonas Paulsson [Tue, 22 Sep 2020 10:11:29 +0000 (12:11 +0200)]
[SystemZ] Make sure not to call getZExtValue on a >64 bit constant.
Better use isZero() and isIntN() in SystemZTargetTransformInfo rather than
calling getZExtValue() since the immediate operand may be wider than 64 bits,
which is not allowed with getZExtValue().
Fixes https://bugs.llvm.org/show_bug.cgi?id=47600
Review: Simon Pilgrim
Sam Parker [Wed, 23 Sep 2020 13:29:03 +0000 (14:29 +0100)]
[NFC][ARM] Pre-commit tail predication test