Ben Wagner [Sat, 8 Jan 2022 01:34:05 +0000 (17:34 -0800)]
[libc++] Disable coverage with sanitize-coverage=0
When building libcxx, libcxxabi, and libunwind the build environment may
specify any number of sanitizers. For some build feature tests these
sanitizers must be disabled to prevent spurious linking errors. With
-fsanitize= this is straight forward with -fno-sanitize=all. With
-fsanitize-coverage= there is no -fno-sanitize-coverage=all, but there
is the equivalent undocumented but tested -fsanitize-coverage=0.
The current build rules fail to disable 'trace-pc-guard'. By disabling
all sanitize-coverage flags, including 'trace-pc-guard', possible
spurious linker errors are prevented. In particular, this allows libcxx,
libcxxabi, and libunwind to be built with HonggFuzz.
CMAKE_REQUIRED_FLAGS is extra compile flags when running CMake build
configuration steps (like check_cxx_compiler_flag). It does not affect
the compile flags for the actual build of the project (unless of course
these flags change whether or not a given source compiles and links or
not). So libcxx, libcxxabi, and libunwind will still be built with any
specified sanitize-coverage as before. The build configuration steps
(which are mostly checking to see if certain compiler flags are
available) will not try to compile and link "int main() { return 0;}"
(or other specified source) with sanitize-coverage (which can fail to
link at this stage in building, since the final compile flags required
are yet to be determined).
The change to LIBFUZZER_CFLAGS was done to keep it consistent with the
obvious intention of disabling all sanitize-coverage. This appears to
be intentional, preventing the fuzzer driver itself from showing up in
any coverage calculations.
Reviewed By: #libunwind, #libc, #libc_abi, ldionne, phosek
Differential Revision: https://reviews.llvm.org/D116050
Kazu Hirata [Sat, 8 Jan 2022 01:45:09 +0000 (17:45 -0800)]
[llvm] Remove redundant member initialization (NFC)
Identified with readability-redundant-member-init.
Julian Lettner [Sat, 8 Jan 2022 01:35:52 +0000 (17:35 -0800)]
[Darwin][Sanitizer] Lower Python requirement for iOS simulator testing
Lower Python requirements: 3.7 -> 3.6
Workaround introduced in:
ebd8eee62a431a6744c3f187fcda58e5dea08499
Vitaly Buka [Fri, 7 Jan 2022 18:30:50 +0000 (10:30 -0800)]
Don't pass uninitialized QueryKind
Even if findImplementors does not use
uninitialized parameter it's still UB and
it's going to be detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116827
Julian Lettner [Sat, 8 Jan 2022 00:47:37 +0000 (16:47 -0800)]
[Darwin] Apply workaround to make symbolication in iOS simulators work
Specify `ASAN_SYMBOLIZER_PATH` when running simulator tests. This will
unblock simulator testing in GreenDragon (Apple's open source testing).
John Ericson [Sat, 11 Dec 2021 01:36:24 +0000 (01:36 +0000)]
[llvm] Use `GNUInstallDirs` to support custom installation dirs
This is the patch for LLVM proper in my series for adding GNUInstallDirs support in all project.
Additionally:
Create a new `CACHE STRING` variable, `LLVM_EXAMPLES_INSTALL_DIR`, to control where the examples are installed on analogy with the other variables.
---
This patch supersedes D28234, which tried to do the same thing but hand-rolled without GNUInstallDirs.
This patch nearly reverts commit 3
0fc88bf1dc15a72e2d9809d28019d386b7a7cc0, which was a revert of a prior attempt."
(I had to add a space here or else Phabricator detects a reference cycle and won't let me do the form submit.)
Reviewed By: compnerd
Differential Revision: https://reviews.llvm.org/D100810
Yuanfang Chen [Sat, 8 Jan 2022 00:34:38 +0000 (16:34 -0800)]
[CMake][WinMsvc] Fix user passed compiler/linker flags
Users could pass flags by environment variables like CFLAGS/CXXFLAGS/LDFLAGS
or by using CMAKE_<LANG>_FLAGS_INIT/CMAKE_<t>_LINKER_FLAGS_INIT. So this
toolchain file should append to INIT flags instead. Otherwise, user
flags would be discarded here by assigning to CMAKE_<LANG>_FLAGS
directly.
Reviewed By: smeenai, mstorsjo
Differential Revision: https://reviews.llvm.org/D116709
Walter Erquinigo [Fri, 17 Dec 2021 22:33:54 +0000 (14:33 -0800)]
[formatters] Improve documentation
This adds some important remarks to the data formatter documentation.
Differential Revision: https://reviews.llvm.org/D115974
Jonas Devlieghere [Fri, 7 Jan 2022 23:25:20 +0000 (15:25 -0800)]
[lldb] Remove lldbconfig module
The lldbconfig module was necessary to run the LLDB test suite against a
reproducer. Since this functionality has been removed, the module is no
longer necessary.
John Ericson [Sat, 1 Jan 2022 01:20:32 +0000 (01:20 +0000)]
Make separate config variable for `LLVM_LIBRARY_DIRS`
@beanz tells me it should in fact exists, and it would be bad to put a
list of dirs in `LLVM_LIBRARY_DIR`. I am therefore making some changes
to help avoid this an other mistakes:
- Use a separate `LLVM_CONFIG_LIBRARY_DIR` (no "S") variable so we don't
start putting a list in `LLVM_LIBRARY_DIR` by mistake.
- Define the individual dir variables first, and the define the list of
dirs variables programmatically.
Also, I rearranged the definitions of the "regular" single dirs below so
`LLVM_BINARY_DIR`, which is the unsuffixed one, comes first before the
suffixed ones.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D116497
Baoshan Pang [Fri, 7 Jan 2022 23:29:22 +0000 (15:29 -0800)]
[RISCV] Materializing constants with 'rori'
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D116574
Vitaly Buka [Fri, 7 Jan 2022 18:36:47 +0000 (10:36 -0800)]
Initialize output parameter
Or code like this have UB passing uninitialized CmpValue:
```
int64_t CmpMask, CmpValue;
if (!TII->analyzeCompare(MI, SrcReg, SrcReg2, CmpMask, CmpValue))
return false;
if (TII->optimizeCompareInstr(MI, SrcReg, SrcReg2, CmpMask, CmpValue, MRI)) {
```
Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116831
Vitaly Buka [Fri, 7 Jan 2022 18:36:01 +0000 (10:36 -0800)]
Initialize ExtAddrMode::Scale
Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116830
Vitaly Buka [Fri, 7 Jan 2022 18:35:22 +0000 (10:35 -0800)]
Initialize fields of TypeRecord subclasses
Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116829
Vitaly Buka [Fri, 7 Jan 2022 18:32:24 +0000 (10:32 -0800)]
Initialize HighlightingsBuilder::Resolver
Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116828
Vitaly Buka [Fri, 7 Jan 2022 18:22:35 +0000 (10:22 -0800)]
Initialize output parameters
If the function returns true, it should
set all output paremeters, similar to Output::preflightElement, or we
have UB on code like:
```
void *SaveInfo;
if (io.preflightFlowElement(i, SaveInfo))
io.postflightFlowElement(SaveInfo);
```
It's going to be detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116826
Sumanth Gundapaneni [Fri, 7 Jan 2022 22:42:54 +0000 (14:42 -0800)]
[Hexagon] Reconize M2_mnaci in HexagonBitTracker
Amy Huang [Thu, 23 Dec 2021 23:09:30 +0000 (15:09 -0800)]
[-fms-extensions] Make some exception specification warnings/errors compatible with what cl.exe does
Make clang-cl error when a function definition is missing 'noexcept',
and succeed without warnings when missing '__declspec(nothrow)' or 'throw'.
Fixes pr52860
Differential Revision: https://reviews.llvm.org/D116256
Nick Desaulniers [Fri, 7 Jan 2022 22:10:57 +0000 (14:10 -0800)]
[Clang][CFG] check children statements of asm goto
When performing CFG based analyses, don't forget to check the child
statements of an asm goto, such as the expressions used for
inputs+outputs.
Fixes: https://github.com/llvm/llvm-project/issues/51024
Fixes: https://github.com/ClangBuiltLinux/linux/issues/1439
Reviewed By: void, jyknight, jyu2, efriedma
Differential Revision: https://reviews.llvm.org/D116059
Philip Reames [Fri, 7 Jan 2022 21:55:32 +0000 (13:55 -0800)]
[MemoryBuiltin] Cleanup stale todo comments [NFC]
strdup/strndup are already partially implemented, move remaining comment to relevant place. Remaining named routines are copy routines and mostly handled via intrinsics already - they do not allocate new memory.
Jonas Devlieghere [Fri, 7 Jan 2022 21:34:06 +0000 (13:34 -0800)]
[lldb] Use lit_config.note to print module cache message
Groverkss [Fri, 7 Jan 2022 21:23:22 +0000 (02:53 +0530)]
[MLIR] Add IntegerPolyhedron::getUniverse
This operation already exists in FlatAffineConstraints but is added to
IntegerPolyhedron to keep consistancy in available methods.
Roman Lebedev [Fri, 7 Jan 2022 21:18:14 +0000 (00:18 +0300)]
[NFCI] `ScalarEvolution::getRangeRef()`: collapse `SCEVMinMaxExpr` handling
Arthur Eubanks [Fri, 7 Jan 2022 21:11:18 +0000 (13:11 -0800)]
Revert "[Inline] Attempt to delete any discardable if unused functions"
This reverts commit
335a3163aab4ab3a52c7c15d03bcf1ce9ba79fbb.
Causes crashes when building llvm-test-suite's kc under ReleaseLTO-g.
Krzysztof Parzyszek [Fri, 7 Jan 2022 20:45:22 +0000 (12:45 -0800)]
[Hexagon] Use map from HexagonDepArch instead of local one, NFC
Co-authored-by: Brian Cain <bcain@quicinc.com>
John Ericson [Sun, 2 Jan 2022 06:29:26 +0000 (06:29 +0000)]
[lld] Deprecate using llvm-config to detect llvm installation
This is continuing in the path of D51714, which did this for Clang.
I have rearranged the source code Clang so one can diff the top-level
CMakeLists.txt of Clang and LLD, ensuring we use the same strategy for
both.
Besides diffing the two files, `git diff --color-moved` on LLD also helps review.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D116492
Shafik Yaghmour [Fri, 7 Jan 2022 19:56:57 +0000 (11:56 -0800)]
[LLDB] Fix setting of success in Socket::Close()
Both close and closesocket should return 0 on success so using !! looks incorrect. I replaced this will a more readable == 0 check.
Differential Revision: https://reviews.llvm.org/D116768
Adrian Prantl [Fri, 7 Jan 2022 20:40:08 +0000 (12:40 -0800)]
Update DWARF fission extension attributes
This patch brings the transitional DWARF 4 + fission attributes up to date.
Patch by David Anderson!
Differential Review: https://reviews.llvm.org/D116065
Krzysztof Parzyszek [Fri, 7 Jan 2022 20:10:54 +0000 (12:10 -0800)]
[Hexagon] Extract condition into function, NFC
Co-authored-by: Brian Cain <bcain@quicinc.com>
Julian Lettner [Thu, 23 Dec 2021 06:30:46 +0000 (22:30 -0800)]
[ASan][Darwin] Avoid crash during ASan initialization
Always pass `depth=1` to `vm_region_recurse_64()`. `depth` is a in-out
parameter and gets reset to 0 after the first call, so we incorrectly
pass `depth=0` on subsequent calls.
We want to avoid the following crash:
```
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000180000000
Exception Codes: 0x0000000000000001, 0x0000000180000000
VM Region Info: 0x180000000 is not in any region. Bytes after previous region:
277577729 Bytes before following region:
384270336
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
Stack
16f64c000-
16f748000 [ 1008K] rw-/rwx SM=PRV thread 0
---> GAP OF 0x27730000 BYTES
unused shlib __TEXT
196e78000-
196eac000 [ 208K] r-x/r-x SM=COW ... this process
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [767]
```
Crashing code:
```
static mach_header *get_dyld_image_header() {
unsigned depth = 1;
vm_size_t size = 0;
vm_address_t address = 0;
kern_return_t err = KERN_SUCCESS;
mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64;
while (true) {
struct vm_region_submap_info_64 info;
err = vm_region_recurse_64(mach_task_self(), &address, &size, &depth,
(vm_region_info_t)&info, &count);
if (err != KERN_SUCCESS) return nullptr;
if (size >= sizeof(mach_header) && info.protection & kProtectionRead) {
mach_header *hdr = (mach_header *)address;
if ((hdr->magic == MH_MAGIC || hdr->magic == MH_MAGIC_64) && // << CRASH: sanitizer_procmaps_mac.cpp:176
hdr->filetype == MH_DYLINKER) {
return hdr;
}
}
address += size;
}
}
```
Radar-Id: rdar://problem/
86773501
Differential Revision: https://reviews.llvm.org/D116240
Krzysztof Parzyszek [Fri, 7 Jan 2022 20:21:02 +0000 (12:21 -0800)]
[Hexagon] Fix release build break after
547658567353d
John Ericson [Mon, 3 Jan 2022 02:25:06 +0000 (02:25 +0000)]
[CMake] Factor out config prefix finding logic
See the docs in the new function for details.
I think I found every instance of this copy pasted code. Polly could
also use it, but currently does something different, so I will save the
behavior change for a future revision.
We get the shared, non-installed CMake modules following the pattern
established in D116472.
It might be good to have LLD and Flang also use this, but that would be
a functional change and so I leave it as future work.
Reviewed By: beanz, lebedev.ri
Differential Revision: https://reviews.llvm.org/D116521
John Ericson [Mon, 3 Jan 2022 07:51:54 +0000 (07:51 +0000)]
[cmake] Add read-me for the common CMake utils
Now that I am adding more things there, I thought it prudent to document
what should and should not go there, and how it is used.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D116524
Michael Lambert [Fri, 7 Jan 2022 19:55:45 +0000 (11:55 -0800)]
[Hexagon] Duplex error: wrong branch hint
colinl [Fri, 7 Jan 2022 19:51:56 +0000 (11:51 -0800)]
[Hexagon] Consider direction hint forming dealloc_return duplex
Groverkss [Fri, 7 Jan 2022 19:52:29 +0000 (01:22 +0530)]
[MLIR][NFC] Move presburger functionality from FlatAffineConstraints to IntegerPolyhedron
This patch moves all presburger functionality from FlatAffineConstraints to
IntegerPolyhedron. This patch is purely mechanical, it only moves and renames
functionality and tests.
This patch is part of a series of patches to move presburger functionality to
Presburger/ directory.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D116681
Ben Jackson [Fri, 7 Jan 2022 19:38:47 +0000 (11:38 -0800)]
[LLDB] libcxx summary formatters for std::string_view
When printing a std::string_view, print the referenced string as the
summary. Support string_view, u32string_view, u16string_view and
wstring_view, as we do for std::string and friends.
This is based on the existing fomratter for std::string, and just
extracts the data and length members, pushing them through the existing
string formatter.
In testing this, a "FIXME" was corrected for printing of non-ASCII empty
values. Previously, the "u", 'U" etc. prefixes were not printed for
basic_string<> types that were not char. This is trivial to resolve by
printing the prefix before the "".
Differential revision: https://reviews.llvm.org/D112222
colinl [Fri, 7 Jan 2022 19:33:14 +0000 (11:33 -0800)]
[Hexagon] Improve check for subinstruction registers
Yuanxiang Ye [Fri, 7 Jan 2022 19:07:32 +0000 (11:07 -0800)]
[Hexagon] Reject accumulating on vd.tmp
Added hvx accum checker function and test cases.
Arthur Eubanks [Fri, 7 Jan 2022 17:47:55 +0000 (09:47 -0800)]
[Inline] Attempt to delete any discardable if unused functions
Previously we limited ourselves to only internal/private functions. We
can also delete linkonce_odr functions.
Minor compile time wins:
https://llvm-compile-time-tracker.com/compare.php?from=
d51e3474e060cb0e90dc2e2487f778b0d3e6a8de&to=
bccffe3f8d5dd4dda884c9ac1f93e51772519cad&stat=instructions
Major memory wins on tramp3d:
https://llvm-compile-time-tracker.com/compare.php?from=
d51e3474e060cb0e90dc2e2487f778b0d3e6a8de&to=
bccffe3f8d5dd4dda884c9ac1f93e51772519cad&stat=max-rss
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D115545
Brian Cain [Thu, 3 May 2018 16:04:26 +0000 (11:04 -0500)]
[Hexagon] Apply tiny core packet size slots limit
colinl [Fri, 7 Jan 2022 17:41:39 +0000 (09:41 -0800)]
[Hexagon] Simplify AX instruction detection
Philip Reames [Fri, 7 Jan 2022 18:30:53 +0000 (10:30 -0800)]
[instcombine] Delete duplicate object size logic
nstCombine appears to duplicate the allocation size logic used inside getObjectSize when figuring out which attributes are safe to place on the callsite. We can use the existing utility function instead.
The test change is correct. With aligned_alloc, a zero alignment is required to return nullptr. As such, deref_or_null is a correct attribute to use.
Differential Revision: https://reviews.llvm.org/D116816
Sanjay Patel [Fri, 7 Jan 2022 13:06:51 +0000 (08:06 -0500)]
[x86] make select lowering using SBB hack more flexible
select (X != 0), -1, Y --> 0 - X; or (sbb), Y
select (X != 0), Y, -1 --> X - 1; or (sbb), Y
We already had these x86 carry-flag transforms, but one was over-specified to
handle a "0" select arm only. That's just a special-case of the more general
pattern (the 'or' will be deleted if Y is zero).
This is part of solving #53006, but it misses that example because some other
combine has already converted that exact pattern into math ops.
Differential Revision: https://reviews.llvm.org/D116765
Kazu Hirata [Fri, 7 Jan 2022 18:17:29 +0000 (10:17 -0800)]
Use nullptr instead of 0 or NULL (NFC)
Identified with modernize-use-nullptr.
Arthur Eubanks [Tue, 14 Dec 2021 00:21:17 +0000 (16:21 -0800)]
[LazyCallGraph] Ignore empty RefSCCs rather than shift RefSCCs when removing dead functions
This is in preparation for D115545 which attempts to delete discardable functions if they are unused. With that change, shifting RefSCCs becomes noticeable in compile time. This change makes the LCG update negligible again.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D116776
Dmitry Vyukov [Fri, 7 Jan 2022 17:25:58 +0000 (18:25 +0100)]
scudo: fix thread-safety macro name
Missed in
765921de5b ("sanitizer_common: prefix thread-safety macros with SANITIZER_") update.
Differential Revision: https://reviews.llvm.org/D116818
Kazu Hirata [Fri, 7 Jan 2022 17:25:59 +0000 (09:25 -0800)]
[ComprehensiveBufferize] Fix a warning
This patch fixes:
mlir/lib/Dialect/Linalg/ComprehensiveBufferize/LinalgInterfaceImpl.cpp:292:12:
error: comparison of integers of different signs: 'int' and
'unsigned int' [-Werror,-Wsign-compare]
Logan Smith [Thu, 9 Dec 2021 04:02:37 +0000 (20:02 -0800)]
[Support] No longer require flushing raw_string_ostream
Since
65b13610a5226b84889b923bae884ba395ad084d, raw_string_ostream
has been unbuffered by default, making .flush() a no-op. This diff
formalizes this by no longer .flush()ing in the .str() method or
the destructor. .str() has been marked as "consider removing", since
its primary use case used to be making .flush()+access a one-liner,
and it also has issues such as preventing NRVO/implicit move when used
in return statements.
Differential Revision: https://reviews.llvm.org/D115421
Philip Reames [Fri, 7 Jan 2022 16:25:26 +0000 (08:25 -0800)]
Extract utility function for checking initial value of allocation [NFC, try 2]
This is a reoccuring pattern, we can consolidate three copies into one. The main motivation is to reduce usages of isMallocLike.
The original commit (which was quickly reverted) didn't account for the allocation function could be an invoke, test coverage for that case added in this commit.
Matthias Springer [Fri, 7 Jan 2022 16:26:14 +0000 (01:26 +0900)]
[mlir][linalg][bufferize][NFC] Add `analyzeOp` helper function
This function runs just the analysis of Comprehensive Bufferize, but does not bufferize the IR yet.
This is in preparation of fixing CallOp bufferization. Also needed for unifying Comprehensive Bufferize and core bufferization; the new partial bufferization can simply run bufferization without an analysis.
Differential Revision: https://reviews.llvm.org/D116456
Brian Cain [Thu, 26 Apr 2018 04:10:26 +0000 (23:10 -0500)]
[Hexagon] s/Fatal/ReportErrors/
Rename argument from 'Fatal' => 'ReportErrors'. HexagonShuffler refers to
this arg as 'ReportErrors' and calling it 'Fatal' in HexagonMCShuffler is
misleading and inconsistent.
colinl [Fri, 7 Jan 2022 15:45:11 +0000 (07:45 -0800)]
[Hexagon] MC testcases for verifying packetization rules
Brian Cain [Thu, 14 Nov 2019 16:17:45 +0000 (10:17 -0600)]
[Hexagon] Show slot resources for errors
For a scalar packet resource error, emit details about the slots
available for each instruction in the packet.
Krzysztof Parzyszek [Fri, 10 Jan 2020 17:30:48 +0000 (11:30 -0600)]
[Hexagon] Misc shuffling fixes
Co-authored-by: Brian Cain <bcain@quicinc.com>
Philip Reames [Fri, 7 Jan 2022 16:22:53 +0000 (08:22 -0800)]
Fix a bug in
67a3331e (cast instead of dyn_cast)
The original commit was expected to be NFC, but I didn't account for the fact that invokes could be considered allocation functions. Interestingly, only one builder caught the problem.
David Green [Fri, 7 Jan 2022 16:20:23 +0000 (16:20 +0000)]
[AArch64] Update addo and subo costs
Similar to D116732, this adds basic scalar sadd_with_overflow,
uadd_with_overflow, ssub_with_overflow and usub_with_overflow costs for
aarch64, which are usually quite efficiently lowered.
Differential Revision: https://reviews.llvm.org/D116734
Matthias Springer [Fri, 7 Jan 2022 16:10:15 +0000 (01:10 +0900)]
[mlir][linalg][bufferize][NFC] Simplify buffer API of BufferizationState
Instead of `lookupBuffer` and `getResultBuffer`, there is now a single `getBuffer` function. This simplifies the `BufferizableOpInterface` API and is less confusing to users. They could previously have called the wrong function.
Furthermore, since `getBuffer` now takes an `OpOperand &` instead of a `Value`, users can no longer accidentally use one of the previous two functions incorrectly, which would have resulted in missing buffer copies.
Differential Revision: https://reviews.llvm.org/D116455
Matthias Springer [Fri, 7 Jan 2022 15:56:13 +0000 (00:56 +0900)]
[mlir][linalg][bufferize][NFC] Analyze OpOperands instead of OpResults
With this change, the analysis takes a look at OpOperands instead of OpResults. OpOperands can bufferize out-of-place (even if they have no aliasing OpResults). The analysis does no longer care about OpResults.
Previously, only OpResults could bufferize out-of-place, so OpOperands that have no aliasing OpResults were never copied by Comprehensive Bufferize. This does not fit wwell with the new CallOp bufferization that is introduced in a subsequent change. In essence, called FuncOps can then be treated as "black boxes" that may read/write to any bbArg, even if they do not return anything.
Differential Revision: https://reviews.llvm.org/D115706
Kazu Hirata [Fri, 7 Jan 2022 15:42:35 +0000 (07:42 -0800)]
Remove redundant return statements (NFC)
Identified by readability-redundant-control-flow.
Matthias Springer [Fri, 7 Jan 2022 15:21:50 +0000 (00:21 +0900)]
[mlir][linalg][bufferize][NFC] Add explicit inplaceable attrs to test cases
This is in preparation of fixing CallOp bufferization. Add explicit linalg.inplaceable attrs to all bbArgs, except for the ones where inplaceability should be decided by the analysis.
Differential Revision: https://reviews.llvm.org/D115840
Matthias Springer [Fri, 7 Jan 2022 15:07:50 +0000 (00:07 +0900)]
[mlir][linalg][bufferize] Fix copy elision in `getResultBuffer`
A buffer copy may not be elided if the to-be-bufferized op is reading the data.
Differential Revision: https://reviews.llvm.org/D116454
Jun Zhang [Fri, 7 Jan 2022 15:11:36 +0000 (15:11 +0000)]
[Clang] Implement the rest of __builtin_elementwise_* functions.
The patch implement the rest of __builtin_elementwise_* functions
specified in D111529, including:
* __builtin_elementwise_floor
* __builtin_elementwise_roundeven
* __builtin_elementwise_trunc
Signed-off-by: Jun <jun@junz.org>
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D115429
Marek Kurdej [Fri, 7 Jan 2022 14:21:57 +0000 (15:21 +0100)]
[clang-format] Use range-for loops. NFC.
* Avoid if check on every element of the loop when printing symbols.
luxufan [Fri, 7 Jan 2022 15:01:07 +0000 (23:01 +0800)]
[RISCV] Add missing e_flag EF_RISCV_TSO
This flag was defined here https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc
Reviewed By: asb, MaskRay, jhenderson
Differential Revision: https://reviews.llvm.org/D111939
Arthur O'Dwyer [Mon, 27 Dec 2021 03:16:45 +0000 (22:16 -0500)]
[libc++] Add missing templated version of `std::lerp`.
Fixes #50806.
Differential Revision: https://reviews.llvm.org/D116295
Florian Hahn [Fri, 7 Jan 2022 14:44:03 +0000 (14:44 +0000)]
[SCEVExpand] Only create required predicate checks.
Currently generateOverflowCheck always creates code for Step being
negative and positive, followed by a select at the end depending on
Step's sign.
This patch updates the code to only create either the checks for step
being positive or negative, if the sign is known.
Follow-up to D116696.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D116747
Florian Hahn [Fri, 7 Jan 2022 14:35:13 +0000 (14:35 +0000)]
[LoopVersioning] Move loop-versioning test to correct directory.
The moved test was incorrectly placed in Analysis/LoopAccessAnalysis as
it runs loop-versioning.
Sam McCall [Wed, 5 Jan 2022 21:40:50 +0000 (22:40 +0100)]
[clangd] Polish clangd/inlayHints and expose them by default.
This means it's a "real feature" in clangd 14, albeit one that requires special
client support.
- remove "preview" from the flag description
- expose the `clangdInlayHints` capability by default
- provide `position` as well as `range`
- support `InlayHintsParams.range` to restrict the range retrieved
- inlay hint list is in document order (sorted by position)
Still to come: control feature via config rather than flag.
Fixes https://github.com/clangd/clangd/issues/313
Protocol doc is in https://github.com/llvm/clangd-www/pull/56/files
Differential Revision: https://reviews.llvm.org/D116699
Dmitry Vyukov [Wed, 5 Jan 2022 12:35:13 +0000 (13:35 +0100)]
sanitizer_common: prefix thread-safety macros with SANITIZER_
Currently we use very common names for macros like ACQUIRE/RELEASE,
which cause conflicts with system headers.
Prefix all macros with SANITIZER_ to avoid conflicts.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D116652
Luo, Yuanke [Mon, 20 Dec 2021 14:35:27 +0000 (22:35 +0800)]
[X86] Combine reduce(add (mul x, y)) to VNNI instruction.
For below C code, we can use VNNI to combine the mul and add operation.
int usdot_prod_qi(unsigned char *restrict a, char *restrict b, int c,
int n) {
int i;
for (i = 0; i < 32; i++) {
c += ((int)a[i] * (int)b[i]);
}
return c;
}
We didn't support the combine acoss basic block in this patch.
Differential Revision: https://reviews.llvm.org/D116039
Archibald Elliott [Fri, 7 Jan 2022 13:07:30 +0000 (13:07 +0000)]
Revert "Unaligned Access Warning Added"
This reverts commits:
-
2cd2600abaf3c604889b77ab408fdf89d7a21c48
-
11c67e5a4e99f51ec66c9781710f81955cfd5e24
Due to test failures on Windows.
alex-t [Sun, 26 Dec 2021 12:31:39 +0000 (15:31 +0300)]
[AMDGPU] Enable divergence-driven 'ctpop' selection
This change adds the patterns and divergence predicates for the ctpop (bitcount) nodes
to make them selected according to the divergence.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D116284
Sanjay Patel [Thu, 6 Jan 2022 19:12:02 +0000 (14:12 -0500)]
[x86] add tests for select with -1 operand; NFC
gysit [Fri, 7 Jan 2022 12:49:44 +0000 (12:49 +0000)]
[mlir][OpDSL] Separate `ReduceFn` and `ReduceFnUse`.
The revision distinguishes `ReduceFn` and `ReduceFnUse`. The latter has the reduction dimensions attached while the former specifies the arithmetic function only. This separation allows us to adapt the reduction syntax a little bit and specify the reduction dimensions using square brackets (in contrast to the round brackets used for the values to reduce). It als is a preparation to add reduction function attributes to OpDSL. A reduction function attribute shall only specify the arithmetic function and not the reduction dimensions.
Example:
```
ReduceFn.max_unsigned(D.kh, D.kw)(...)
```
changes to:
```
ReduceFn.max_unsigned[D.kh, D.kw](...)
```
Depends On D115240
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D115241
gysit [Fri, 7 Jan 2022 12:37:52 +0000 (12:37 +0000)]
[mlir][OpDSL] Rename `PrimFn` to `ArithFn`.
The revision renames `PrimFn` to `ArithFn`. The name resembles the newly introduced arith dialect that implements most of the arithmetic functions. An exception are log/exp that are part of the math dialect.
Depends On D115239
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D115240
gysit [Fri, 7 Jan 2022 12:23:11 +0000 (12:23 +0000)]
[mlir][OpDSL] Add `TypeFn` class.
This revision introduces a the `TypeFn` class that similar to the `PrimFn` class contains an extensible set of type conversion functions. Having the same mechanism for both type conversion functions and arithmetic functions improves code consistency. Additionally, having an explicit function class and function name is a prerequisite to specify a conversion or arithmetic function via attribute. In a follow up commits, we will introduce function attributes to make OpDSL operations more generic. In particular, the goal is to handle signed and unsigned computation in one operations. Today, there is a linalg.matmul and a linalg.matmul_unsigned.
The commit implements the following changes:
- Introduce the class of type conversion functions `TypeFn`
- Replace the hardwired cast and cast_unsigned ops by the `TypeFn` counterparts
- Adapt the python and C++ code generation paths to support the new cast operations
Example:
```
cast(U, A[D.m, D.k])
```
changes to
```
TypeFn.cast(U, A[D.m, D.k])
```
Depends On D115237
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D115239
Adrian Kuegel [Fri, 7 Jan 2022 12:22:32 +0000 (13:22 +0100)]
[mlir][python] Use a named object
Currently, the object would be immediately destroyed after creation.
Found by ClangTidy bugprone-unused-raii.
gysit [Fri, 7 Jan 2022 08:59:16 +0000 (08:59 +0000)]
[mlir][OpDSL] Rename `AttributeDef` to `IndexAttrDef`.
Renaming `AttributeDef` to `IndexAttrDef` prepares OpDSL to support different kinds of attributes and more closely reflects the purpose of the attribute.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D115237
Jay Foad [Fri, 7 Jan 2022 11:46:01 +0000 (11:46 +0000)]
[AMDGPU] Regenerate MIR checks for G_[SU]BFX
Jay Foad [Fri, 7 Jan 2022 11:43:15 +0000 (11:43 +0000)]
[AMDGPU] Regenerate G_[SU]BFX checks using some common prefixes
Alex Zinenko [Fri, 7 Jan 2022 11:46:01 +0000 (12:46 +0100)]
[flang] update to reflect MLIR LLVM::GEPOp changes
Jay Foad [Fri, 7 Jan 2022 11:04:25 +0000 (11:04 +0000)]
[GlobalISel] Fix typo Extact to Extract in function name. NFC.
Benjamin Kramer [Fri, 7 Jan 2022 11:04:17 +0000 (12:04 +0100)]
[mlir] Provide a home for mlir::LLVM::GEPOp::kDynamicIndex
C++14 requires this and will trigger linker errors when optimizations
are disabled.
Adrian Kuegel [Fri, 7 Jan 2022 11:00:53 +0000 (12:00 +0100)]
[mlir] Use const reference for loop iteration variable.
Archibald Elliott [Fri, 7 Jan 2022 10:45:26 +0000 (10:45 +0000)]
[clang][driver] Don't pass -Wunaligned-access to cc1as
This is to fix some failing assembler tests.
Marek Kurdej [Fri, 7 Jan 2022 10:19:53 +0000 (11:19 +0100)]
[clang-format] Use prefix increment and decrement. NFC.
Qiu Chaofan [Fri, 7 Jan 2022 10:07:26 +0000 (18:07 +0800)]
[NFC] Pre-commit case for PowerPC perfect shuffle
Roman Lebedev [Fri, 7 Jan 2022 09:40:06 +0000 (12:40 +0300)]
[NFCI][IR] MinMaxIntrinsic: add some more helper methods, and use them
Lian Wang [Fri, 7 Jan 2022 09:18:33 +0000 (17:18 +0800)]
[RISCV] Supplement PACKH instruction pattern
Optimize (rs1 & 255) | ((rs2 & 255) << 8) -> (PACKH rs1, rs2).
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D116791
Nikita Popov [Fri, 7 Jan 2022 09:55:01 +0000 (10:55 +0100)]
[CodeGen] Support opaque pointers for inline asm
This is the last part of D116531. Fetch the type of the indirect
inline asm operand from the elementtype attribute, rather than
the pointer element type.
Fixes https://github.com/llvm/llvm-project/issues/52928.
Mubashar Ahmad [Thu, 23 Dec 2021 16:37:44 +0000 (16:37 +0000)]
Unaligned Access Warning Added
Added warning for potential cases of
unaligned access when option
-mno-unaligned-access has been specified
Nikita Popov [Fri, 7 Jan 2022 09:37:26 +0000 (10:37 +0100)]
[IR] Add ConstraintInfo::hasArg() helper (NFC)
Checking whether a constraint corresponds to an argument is a
recurring pattern.
Egor Zhdan [Fri, 7 Jan 2022 09:30:25 +0000 (10:30 +0100)]
[Clang][Sema] Avoid crashing for va_arg expressions with bool argument
This change fixes a compiler crash that was introduced in https://reviews.llvm.org/D103611: `Sema::BuildVAArgExpr` attempted to retrieve a corresponding signed type for `bool` by calling `ASTContext::getCorrespondingSignedType`.
rdar://
86580370
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D116272
Jay Foad [Fri, 7 Jan 2022 09:39:01 +0000 (09:39 +0000)]
[SystemZ][z/OS] Fix test failure when SystemZ target is not built
Marek Kurdej [Fri, 7 Jan 2022 09:02:45 +0000 (10:02 +0100)]
[clang-format] Fix `BraceWrapping: AfterFunction` affecting synchronized blocks in Java.
Fixes https://github.com/llvm/llvm-project/issues/32031.
Before this change, BraceWrapping: AfterFunction would affect synchronized blocks in Java, but they should be formatted w.r.t. BraceWrapping: AfterControlStatement.
Using the config:
```
BreakBeforeBraces: Custom
BraceWrapping:
AfterControlStatement: false
AfterFunction: true
```
would result in misformatted code like:
```
class Foo {
void bar()
{
synchronized (this)
{
a();
a();
}
}
}
```
instead of:
```
class Foo {
void bar()
{
synchronized (this) {
a();
a();
}
}
}
```
Reviewed By: MyDeveloperDay, owenpan
Differential Revision: https://reviews.llvm.org/D116767
Marek Kurdej [Fri, 7 Jan 2022 08:55:04 +0000 (09:55 +0100)]
[clang-format] Use range-for loops. NFC.
Reviewed By: MyDeveloperDay, owenpan
Differential Revision: https://reviews.llvm.org/D116795
Alex Zinenko [Thu, 6 Jan 2022 22:30:15 +0000 (23:30 +0100)]
[mlir] Require struct indices in LLVM::GEPOp to be constant
Recent commits added a possibility for indices in LLVM dialect GEP operations
to be supplied directly as constant attributes to ensure they remain such until
translation to LLVM IR happens. Make this required for indexing into LLVM
struct types to match LLVM IR requirements, otherwise the translation would
assert on constructing such IR.
For better compatibility with MLIR-style operation construction interface,
allow GEP operations to be constructed programmatically using Values pointing
to known constant operations as struct indices.
Depends On D116758
Reviewed By: wsmoses
Differential Revision: https://reviews.llvm.org/D116759
Alex Zinenko [Thu, 6 Jan 2022 22:29:52 +0000 (23:29 +0100)]
[mlir] Add ConstantLike trait to LLVM::ConstantOp
This make LLVM dialect constants to work with `m_constant` matches. Implement
the folding hook for this operation as required by the trait. This in turn
allows LLVM::ConstantOp to properly participate in constant-folding.
Depends On D116757
Reviewed By: wsmoses
Differential Revision: https://reviews.llvm.org/D116758
Alex Zinenko [Thu, 6 Jan 2022 22:29:15 +0000 (23:29 +0100)]
[mlir] Make it possible to directly supply constant values to LLVM GEPOp
In LLVM IR, the GEP indices that correspond to structures are required to be
i32 constants. MLIR models constants as just values defined by special
operations, and there is no verification that it is the case for structure
indices in GEP. Furthermore, some common transformations such as control flow
simplification may lead to the operands becoming non-constant. Make it possible
to directly supply constant values to LLVM GEPOp to guarantee they remain
constant until the translation to LLVM IR. This is not yet a requirement and
the verifier is not modified, this will be introduced separately.
Reviewed By: wsmoses
Differential Revision: https://reviews.llvm.org/D116757