Paula Toth [Tue, 28 Apr 2020 23:14:37 +0000 (16:14 -0700)]
[libc] Add strlen to library entrypoints.
Reviewers: sivachandra, abrachet
Reviewed By: abrachet
Subscribers: mgorny, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D79016
Sam McCall [Tue, 28 Apr 2020 22:55:13 +0000 (00:55 +0200)]
Reland "Add a facility to get system cache directory and use it in clangd"
This reverts commit
faf2dce1dd6ae25aa75d2685ac7bb27ec31e2ced.
Eric Christopher [Tue, 28 Apr 2020 22:48:56 +0000 (15:48 -0700)]
Temporarily revert "Add a facility to get system cache directory and use it in clangd"
This reverts commit
ad38f4b371bdca214e3a3cda9a76ec2213215c68.
As it broke building the unittests:
.../sources/llvm-project/llvm/unittests/Support/Path.cpp:334:5: error: use of undeclared identifier 'set'
set(Value);
^
1 error generated.
Jessica Clarke [Tue, 28 Apr 2020 22:43:48 +0000 (23:43 +0100)]
[AST] Use PrintingPolicy for format string diagnosis
Summary:
This is a small improvement for OpenCL diagnostics, but is also useful
for our CHERI fork, as our __capability qualifier is suppressed from
diagnostics when all pointers are capabilities, only being used when pointers
need to be explicitly opted-in to being capabilities.
Reviewers: rsmith, Anastasia, aaron.ballman
Reviewed By: Anastasia, aaron.ballman
Subscribers: aaron.ballman, arichardson, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78777
Stanislav Mekhanoshin [Tue, 28 Apr 2020 22:30:27 +0000 (15:30 -0700)]
[AMDGPU] Define AGPR subregs
These are only needed as VGPR counterpart.
Differential Revision: https://reviews.llvm.org/D78597
Jessica Paquette [Tue, 28 Apr 2020 22:19:17 +0000 (15:19 -0700)]
Fix buildbot after
9f31446c
Add missing ifndef to make release builds happy.
Example failure: http://lab.llvm.org:8011/builders/fuchsia-x86_64-linux/builds/4006/steps/ninja-build/logs/stdio
Craig Topper [Tue, 28 Apr 2020 22:10:51 +0000 (15:10 -0700)]
[X86] Add PACK instructions to hasUndefRegUpdate so the BreakFalseDeps pass will reassign an undef second source to match the first source
We generate PACK instructions with an undef second source when we are truncating from a 128-bit vector to something narrower and we don't care about the upper bits of the vector register. The register allocation process will always assign untied undef uses to xmm0. This creates a false dependency on xmm0.
By adding these instructions to hasUndefRegUpdate, we can get the BreakFalseDeps pass to reassign the source to match the other input. Normally this interface is used for instructions that might need an xor inserted to break the dependency. But the pass also has a heuristic that tries to use the same register as other sources. That should always be possible for these instructions so we'll never trigger the xor dependency break.
Differential Revision: https://reviews.llvm.org/D79032
Stanislav Mekhanoshin [Tue, 28 Apr 2020 20:54:14 +0000 (13:54 -0700)]
[AMDGPU] Define special SGPR subregs
These are used in SReg_32 and when we start to use SGPR_LO16
there will be compaints that not all registers in RC support
all subreg indexes. For now it is NFC.
Unused regunits are reserved so that verifier does not complain
about missing phys reg live-ins.
Differential Revision: https://reviews.llvm.org/D78591
Jessica Paquette [Tue, 28 Apr 2020 21:45:05 +0000 (14:45 -0700)]
[AArch64][GlobalISel] Generalize logic for promoting copies
Generalize the 16-bit FPR to 32-bit GPR logic to work for all cases where
destination size is bigger than source size.
Also fixed CheckCopy() always returning true instead of the result of
isValidCopy().
Differential Revision: https://reviews.llvm.org/D77530
Patch by tambre (Raul Tambre)
Casey Carter [Tue, 28 Apr 2020 21:50:52 +0000 (14:50 -0700)]
[NFC] Correct spelling of "ambiguous"
Siva Chandra Reddy [Tue, 28 Apr 2020 21:00:12 +0000 (14:00 -0700)]
[libc] Fix benchmarks build.
Reviewers: gchatelet, echristo
Subscribers: mgorny, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D79040
Vojtěch Štěpančík [Tue, 28 Apr 2020 20:03:30 +0000 (22:03 +0200)]
Add a facility to get system cache directory and use it in clangd
Summary:
This patch adds a function that is similar to `llvm::sys::path::home_directory`, but provides access to the system cache directory.
For Windows, that is %LOCALAPPDATA%, and applications should put their files under %LOCALAPPDATA%\Organization\Product\.
For *nixes, it adheres to the XDG Base Directory Specification, so it first looks at the XDG_CACHE_HOME environment variable and falls back to ~/.cache/.
Subsequently, the Clangd Index storage leverages this new API to put index files somewhere else than the users home directory.
Fixes https://github.com/clangd/clangd/issues/341
Reviewers: sammccall, chandlerc, Bigcheese
Reviewed By: sammccall
Subscribers: hiraditya, ilya-biryukov, MaskRay, jkorous, dexonsmith, arphaman, kadircet, ormris, usaxena95, cfe-commits, llvm-commits
Tags: #clang-tools-extra, #clang, #llvm
Differential Revision: https://reviews.llvm.org/D78501
Louis Dionne [Tue, 28 Apr 2020 21:12:18 +0000 (17:12 -0400)]
[libc++] Make sure temporary config files are closed
Otherwise, trying to remove the file triggers an error on Windows.
Davide Italiano [Tue, 28 Apr 2020 20:09:28 +0000 (13:09 -0700)]
[GlobalISel] Assign the correct debug location when combining G_ANYEXT/G_ZEXT
<rdar://problem/
62535712>
Vitaly Buka [Tue, 28 Apr 2020 21:04:55 +0000 (14:04 -0700)]
[tsan] Relax stack trace check
With GCC 8 stack is different.
Sean Silva [Tue, 28 Apr 2020 00:52:59 +0000 (17:52 -0700)]
Make ops with StructAttr's actually verify `isa<TheStruct>`.
Previously, they would only only verify `isa<DictionaryAttr>` on such attrs
which resulted in crashes down the line from code assuming that the
verifier was doing the more thorough check introduced in this patch.
The key change here is for StructAttr to use
`CPred<"$_self.isa<" # name # ">()">` instead of `isa<DictionaryAttr>`.
To test this, introduce struct attrs to the test dialect. Previously,
StructAttr was only being tested by unittests/, which didn't verify how
StructAttr interacted with ODS.
Differential Revision: https://reviews.llvm.org/D78975
Simon Pilgrim [Tue, 28 Apr 2020 20:25:21 +0000 (21:25 +0100)]
[InstCombine] Add PR45715 test case
Stanislav Mekhanoshin [Tue, 28 Apr 2020 20:50:36 +0000 (13:50 -0700)]
Revert "[AMDGPU] Define special SGPR subregs"
This reverts commit
1baaa080e0481fa2a7cfafc7303c264d0a305c58.
Florian Hahn [Tue, 28 Apr 2020 20:35:02 +0000 (21:35 +0100)]
[LAA] Move CheckingPtrGroup/PointerCheck outside class (NFC).
This allows forward declarations of PointerCheck, which in turn reduce
the number of times LoopAccessAnalysis needs to be included.
Ultimately this helps with moving runtime check generation to
Transforms/Utils/LoopUtils.h, without having to include it there.
Reviewers: anemet, Ayal
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D78458
Stanislav Mekhanoshin [Mon, 20 Apr 2020 23:45:25 +0000 (16:45 -0700)]
[AMDGPU] Define special SGPR subregs
These are used in SReg_32 and when we start to use SGPR_LO16
there will be compaints that not all registers in RC support
all subreg indexes. For now it is NFC.
Unused regunits are reserved so that verifier does not complain
about missing phys reg live-ins.
Differential Revision: https://reviews.llvm.org/D78591
Mircea Trofin [Tue, 28 Apr 2020 17:25:13 +0000 (10:25 -0700)]
[llvm][NFC] Refactor APIs operating on CallBase
Summary:
Refactored the parameter and return type where they are too generally
typed as Instruction.
Reviewers: dblaikie, wmi, craig.topper
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79027
Eric Christopher [Tue, 28 Apr 2020 20:11:54 +0000 (13:11 -0700)]
Add StringRef include to libc benchmark.
Saleem Abdulrasool [Tue, 28 Apr 2020 19:50:12 +0000 (19:50 +0000)]
build: update libc++ as there are some bots with integrated build
Some of the builders are building with C++ in the unified build. Merge
this without review to try to restore the builder.
Walter Erquinigo [Fri, 24 Apr 2020 23:35:57 +0000 (16:35 -0700)]
[lldb-vscode] Add an option for loading core files
Summary:
Currently loading core files on lldb-vscode is broken because there's a check in the attach workflow that asserts that the PID is valid, which of course fails for this case.
Hence, I'm adding a "coreFile" argument for the attach request, which does the work correctly.
I don't know how to test it effectively so that it runs on the buildbots and the debugger can in fact makes sense of it. Anyway, the change has been relatively simple.
Reviewers: labath, clayborg
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D78839
Christopher Tetreault [Tue, 28 Apr 2020 19:39:59 +0000 (12:39 -0700)]
[SVE] Remove invalid usage of VectorType::getNumElements in Function
Summary:
Removes usage of VectorType::getNumElements identified by test located
at CodeGen/aarch64-sve-intrinsics/acle_sve_dot.c. This code explicitly
converts a potentially fixed length vector to scalable vector by
constructing the ElementCount = {getNumElements(), true}
Reviewers: rengolin, efriedma, kmclaughlin, c-rhodes, sdesmalen
Reviewed By: efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78967
David Blaikie [Tue, 28 Apr 2020 19:26:09 +0000 (12:26 -0700)]
OpenMPOpt::RuntimeFunctionInfo::UsesMap: Use unique_ptr for values to simplify memory management
David Blaikie [Tue, 28 Apr 2020 19:17:36 +0000 (12:17 -0700)]
MustBeExecutedContextExplorer::InstructionIteratorMap: use unique_ptr for values in this map to simplify memory management
David Blaikie [Tue, 28 Apr 2020 19:06:48 +0000 (12:06 -0700)]
Attributor::ArgumentReplacementMap: Use unique_ptr to simplify memory management
Fangrui Song [Sat, 25 Apr 2020 03:50:06 +0000 (20:50 -0700)]
[Support] Simplify and optimize ThreadPool
* Merge QueueLock and CompletionLock.
* Avoid spurious CompletionCondition.notify_all() when ActiveThreads is greater than 0.
* Use default member initializers.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D78856
Fangrui Song [Sat, 18 Apr 2020 06:08:11 +0000 (23:08 -0700)]
[ELF][PPC64] Don't perform toc-indirect to toc-relative relaxation for R_PPC64_TOC16_HA not followed by R_PPC64_TOC16_LO_DS
The current implementation assumes that R_PPC64_TOC16_HA is always followed
by R_PPC64_TOC16_LO_DS. This can break with:
// Load the address of the TOC entry, instead of the value stored at that address
addis 3, 2, .LC0@tloc@ha # R_PPC64_TOC16_HA
addi 3, 3, .LC0@tloc@l # R_PPC64_TOC16_LO
blr
which is used by boringssl's util/fipstools/delocate/delocate.go
https://github.com/google/boringssl/blob/master/crypto/fipsmodule/FIPS.md has some documentation.
In short, this tool converts an assembly file to avoid any potential relocations.
The distance to an input .toc is not a constant after linking, so the assembly cannot use an `addis;ld` pair.
Instead, delocate changes the code to jump to a stub (`addis;addi`) which loads the TOC entry address.
Reviewed By: sfertile
Differential Revision: https://reviews.llvm.org/D78431
Sean Fertile [Wed, 15 Apr 2020 13:58:22 +0000 (09:58 -0400)]
[PowerPC][AIX] Pass ByVal formal args that span registers and stack.
Implement passing of ByVal formal arguments when the argument is passed
partly in the argument registers, with the remainder of the argument
passed on the stack.
Differential Revision: https://reviews.llvm.org/D78515
Reid Kleckner [Wed, 31 Jul 2019 21:52:00 +0000 (14:52 -0700)]
[Windows] Autolink with basenames and add libdir to libpath
Prior to this change, for a few compiler-rt libraries such as ubsan and
the profile library, Clang would embed "-defaultlib:path/to/rt-arch.lib"
into the .drective section of every object compiled with
-finstr-profile-generate or -fsanitize=ubsan as appropriate.
These paths assume that the link step will run from the same working
directory as the compile step. There is also evidence that sometimes the
paths become absolute, such as when clang is run from a different drive
letter from the current working directory. This is fragile, and I'd like
to get away from having paths embedded in the object if possible. Long
ago it was suggested that we use this for ASan, and apparently I felt
the same way back then:
https://reviews.llvm.org/D4428#56536
This is also consistent with how all other autolinking usage works for
PS4, Mac, and Windows: they all use basenames, not paths.
To keep things working for people using the standard GCC driver
workflow, the driver now adds the resource directory to the linker
library search path when it calls the linker. This is enough to make
check-ubsan pass, and seems like a generally good thing.
Users that invoke the linker directly (most clang-cl users) will have to
add clang's resource library directory to their linker search path in
their build system. I'm not sure where I can document this. Ideally I'd
also do it in the MSBuild files, but I can't figure out where they go.
I'd like to start with this for now.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D65543
Craig Topper [Tue, 28 Apr 2020 17:50:59 +0000 (10:50 -0700)]
[X86] Update costs for truncates from less than 128-bit vectors to vXi1 on pre-avx512 targets
vXi1 types are legalized by promoting, but the narrow vectors
are legalized by widening. This results in some truncates turning
into any_extends.
Jessica Paquette [Wed, 22 Apr 2020 23:43:31 +0000 (16:43 -0700)]
[AArch64][GlobalISel] Select immediate forms of compares by wiggling constants
Similar to code in `getAArch64Cmp` in AArch64ISelLowering.
When we get a compare against a constant, sometimes, that constant isn't valid
for selecting an immediate form.
However, sometimes, you can get a valid constant by adding 1 or subtracting 1,
and updating the condition code.
This implements the following transformations when valid:
- x slt c => x sle c - 1
- x sge c => x sgt c - 1
- x ult c => x ule c - 1
- x uge c => x ugt c - 1
- x sle c => x slt c + 1
- x sgt c => s sge c + 1
- x ule c => x ult c + 1
- x ugt c => s uge c + 1
Valid meaning the constant doesn't wrap around when we fudge it, and the result
gives us a compare which can be selected into an immediate form.
This also moves `getImmedFromMO` higher up in the file so we can use it.
Differential Revision: https://reviews.llvm.org/D78769
Shoaib Meenai [Tue, 28 Apr 2020 18:31:39 +0000 (11:31 -0700)]
Revert "[lld-macho] Add basic symbol table output"
This reverts commit
a3d95a50ee3397c89327fce6983624446cd8e9d7.
Reverting due to UBSan failures:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/40817/steps/check-lld%20ubsan/logs/stdio
Shoaib Meenai [Tue, 28 Apr 2020 18:30:57 +0000 (11:30 -0700)]
Revert "[lld-macho] Add support for emitting dylibs with a single symbol"
This reverts commit
9598778bd1910e77ccd399f2c9e979c8ecf98e55.
Reverting due to UBSan failures:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/40817/steps/check-lld%20ubsan/logs/stdio
Shoaib Meenai [Tue, 28 Apr 2020 18:29:30 +0000 (11:29 -0700)]
[MachO] Fix UB in memcpy
UBSan complains about a memcpy with a null pointer, so just skip the
memcpy call if the data is empty.
David Blaikie [Tue, 28 Apr 2020 18:30:22 +0000 (11:30 -0700)]
MustBeExecutedContextPrinter::runOnModule: Use unique_ptr to simplify/clarify ownership
Raphael Isemann [Tue, 28 Apr 2020 18:23:01 +0000 (20:23 +0200)]
Revert "Recommit [libc++] Move abs and div into stdlib.h to fix header cycle."
It seems that D74892 still hasn't fixed the issue on the bot. Currently
investigating the bot breakage and meanwhile (again) reverting this...
Christopher Tetreault [Tue, 28 Apr 2020 17:32:55 +0000 (10:32 -0700)]
[SVE] Update EmitSVEPredicateCast to take a ScalableVectorType
Summary:
Removes usage of VectorType::getNumElements identified by test located
at CodeGen/aarch64-sve-intrinsics/acle_sve_abs.c. Since the type is an
SVE predicate vector, it makes sense to specialize the code for scalable
vectors only.
Reviewers: rengolin, efriedma
Reviewed By: efriedma
Subscribers: tschuett, kristof.beyls, rkruppe, psnobl, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78958
Jan Korous [Tue, 28 Apr 2020 17:43:17 +0000 (10:43 -0700)]
[FileCollector] Lock Mutex in copyFiles
We should synchronize reading of VFSWriter's data with the rest of the methods.
Differential revision: https://reviews.llvm.org/D78956
Craig Topper [Tue, 28 Apr 2020 17:24:44 +0000 (10:24 -0700)]
[X86] Handle more cases in combineAddOrSubToADCOrSBB.
This adds support for
X + SETAE --> sbb X, -1
X - SETAE --> adc X, -1
Fixes PR45700
Differential Revision: https://reviews.llvm.org/D78984
Craig Topper [Tue, 28 Apr 2020 17:08:49 +0000 (10:08 -0700)]
[X86] Pre-commit tests for D78984. NFC
These tests show some missed opportunities to use sbb/adc.
Craig Topper [Tue, 28 Apr 2020 17:06:29 +0000 (10:06 -0700)]
[X86][CostModel] Correct the costs for truncate to a mask register with avx512
I've modified isTruncateFree to get an accurate cost for types that need to be split. I'm planning to look into fixing it for all vectors, but need more cost cleanups first.
Differential Revision: https://reviews.llvm.org/D78973
Reid Kleckner [Sat, 25 Apr 2020 00:26:17 +0000 (17:26 -0700)]
[COFF] Add a fastpath for /INCLUDE: in .drective sections
This speeds up linking chrome.dll with PGO instrumentation by 13%
(154271ms -> 134033ms).
LLVM's Option library is very slow. In particular, it allocates at least
one large-ish heap object (Arg) for every argument. When PGO
instrumentation is enabled, all the __profd_* symbols are added to the
@llvm.used list, which compiles down to these /INCLUDE: directives. This
means we have O(#symbols) directives to parse in the section, so we end
up allocating an Arg for every function symbol in the object file. This
is unnecessary.
To address the issue and speed up the link, extend the fast path that we
already have for /EXPORT:, which has similar scaling issues.
I promise that I took a hard look at optimizing the Option library, but
its data structures are very general and would need a lot of cleanup. We
have accumulated lots of optional features (option groups, aliases,
multiple values) over the years, and these are now properties of every
parsed argument, when the vast majority of arguments do not use these
features.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D78845
Louis Dionne [Tue, 28 Apr 2020 17:32:05 +0000 (13:32 -0400)]
[libc++] Avoid using distutils.util in the DSL
Some bots apparently don't have that package.
Saleem Abdulrasool [Tue, 28 Apr 2020 17:25:23 +0000 (17:25 +0000)]
build: use Python3 for compiler-rt
compiler-rt is built in a unified configuration on some of the builders
which requires that this is updated to follow the same pattern as LLVM.
Jonas Devlieghere [Tue, 28 Apr 2020 17:24:40 +0000 (10:24 -0700)]
[llvm/DebugInfo] Fix invalid verifier error for DWARF5
We unconditionally compared the DW_AT_ranges offset to the length of the
.debug_ranges section. For DWARF5 we should look at the debug_rnglists
section instead.
Differential revision: https://reviews.llvm.org/D78971
Reid Kleckner [Tue, 28 Apr 2020 17:20:30 +0000 (10:20 -0700)]
[gn build] (manually) merge c4c3883
PYTHON_EXECUTABLE changed to Python3_EXECUTABLE in the lit test suite.
Committing without review, since the gn build is currently broken. Going
forward, more gn build changes may be necessary to get gn to find Python
3 instead of Python 2.
Kirill Bobyrev [Tue, 28 Apr 2020 17:15:49 +0000 (19:15 +0200)]
[clangd] Fix remote index build without shared libs mode
Summary:
Generated Protobuf library has to be in CLANG_EXPORTS and should also be
installed appropriately. The easiest way to do that is via CMake's
add_clang_library. That unfortunately applies "one directory - one
clang_(library|tool)" policy so .proto files should be in a separate directory
and complicates the layout.
This setup works both in shared and static libs mode.
Resolves: https://github.com/clangd/clangd/issues/351
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D78885
Louis Dionne [Tue, 28 Apr 2020 17:09:21 +0000 (13:09 -0400)]
[libc++] Temporarily disable test that fails on Windows
Reid Kleckner [Sat, 25 Apr 2020 00:51:15 +0000 (17:51 -0700)]
Fix .arclint on Windows
Run "bash myscript.sh". This will work if bash is on PATH, which it
probably is, since developers have to use git.
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D78846
Erik Pilkington [Tue, 28 Apr 2020 16:24:54 +0000 (12:24 -0400)]
[AST] Fix a crash on a dependent vector_size attribute
Looks like this was just a copy & paste mistake from
getDependentSizedExtVectorType. rdar://
60092165
Differential revision: https://reviews.llvm.org/D79012
Fangrui Song [Tue, 28 Apr 2020 16:49:00 +0000 (09:49 -0700)]
[ELF] Clear lazyObjFiles in lld::elf::link after D46034
Ulrich Weigand [Tue, 28 Apr 2020 16:46:37 +0000 (18:46 +0200)]
[SystemZ] Avoid __INTPTR_TYPE__ conversions in vecintrin.h
Some intrinsics in vecintrin.h are currently implemented by
performing address arithmetic in __INTPTR_TYPE__ and converting
the result to some pointer type. While this works correctly,
it leads to suboptimal code generation since many optimizers
cannot trace the provenance of the resulting pointers.
Fixed by using "char *" pointer arithmetic instead.
Ulrich Weigand [Tue, 28 Apr 2020 16:24:19 +0000 (18:24 +0200)]
[SystemZ] Use reserved keywords in vecintrin.h
System headers should avoid using the "vector" and "bool" keywords
since those might be redefined by user code. For example, using
<stdbool.h> before <vecintrin.h> will currently lead to compiler
errors.
Fixed by using the reserved "__vector" and "__bool" keywords
instead. NFC otherwise.
Jonathan Coe [Tue, 28 Apr 2020 16:41:17 +0000 (17:41 +0100)]
Revert "[clang-format] C# property formatting can be controlled by config options"
Committed in error without approval https://reviews.llvm.org/D79000
This reverts commit
015bca3e67cbb88f74f01fb5ae4e46392bec6416.
Jonathan Coe [Tue, 28 Apr 2020 16:35:33 +0000 (17:35 +0100)]
[clang-format] C# property formatting can be controlled by config options
Summary:
Allow brace wrapping in C# property accessors to be controlled by configuration options.
Add new tests and revert old test results for MS style to their old state (as intended).
`FormatStyle.BraceWrapping.AfterFunction = true;` will change automatic property formatting from
```
Type MyType { get; set }
```
to
```
Type MyType
{ get; set }
```
Reviewers: krasimir, MyDeveloperDay
Subscribers: cfe-commits
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D79000
Jonathan Coe [Tue, 28 Apr 2020 16:26:51 +0000 (17:26 +0100)]
[clang-format] insert space after C# keyword var in var (key, value)
Reviewers: krasimir, MyDeveloperDay
Reviewed By: MyDeveloperDay
Subscribers: cfe-commits
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D79008
Martin Erhart [Tue, 28 Apr 2020 16:25:04 +0000 (18:25 +0200)]
[mlir][assemblyFormat] Fix bug when using AttrSizedOperandSegments trait with only non-buildable operand types
Summary:
When creating an operation with
* `AttrSizedOperandSegments` trait
* Variadic operands of only non-buildable types
* assemblyFormat to automatically generate the parser
the `builder` local variable is used, but never declared.
This adds a fix as well as a test for this case as existing ones use buildable types only.
Reviewers: rriddle, Kayjukh, grosser
Reviewed By: Kayjukh
Subscribers: mehdi_amini, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, llvm-commits
Tags: #mlir, #llvm
Differential Revision: https://reviews.llvm.org/D79004
Saleem Abdulrasool [Thu, 23 Apr 2020 20:46:47 +0000 (20:46 +0000)]
build: use `find_package(Python3)` if available
This is primarily motivated by the desire to move from Python2 to
Python3. `PYTHON_EXECUTABLE` is ambiguous. This explicitly identifies
the python interpreter in use. Since the LLVM build seems to be able to
completed successfully with python3, use that across the build. The old
path aliases `PYTHON_EXECUTABLE` to be treated as Python3.
Roman Lebedev [Tue, 28 Apr 2020 10:20:04 +0000 (13:20 +0300)]
[InstCombine] Negator: 'or' with no common bits set is just 'add'
In `InstCombiner::visitAdd()`, we have
```
// A+B --> A|B iff A and B have no bits set in common.
if (haveNoCommonBitsSet(LHS, RHS, DL, &AC, &I, &DT))
return BinaryOperator::CreateOr(LHS, RHS);
```
so we should handle such `or`'s here, too.
Roman Lebedev [Tue, 28 Apr 2020 10:07:39 +0000 (13:07 +0300)]
[NFC][InstCombine] Tests for negation of 'or' with no common bits set
Momchil Velikov [Tue, 28 Apr 2020 15:27:52 +0000 (16:27 +0100)]
[CMSE] Clear padding bits of struct/unions/fp16 passed by value
When passing a value of a struct/union type from secure to non-secure
state (that is returning from a CMSE entry function or passing an
argument to CMSE-non-secure call), there is a potential sensitive
information leak via the padding bits in the structure. It is not
possible in the general case to ensure those bits are cleared by using
Standard C/C++.
This patch makes the compiler emit code to clear such padding
bits. Since type information is lost in LLVM IR, the code generation
is done by Clang.
For each interesting record type, we build a bitmask, in which all the
bits, corresponding to user declared members, are set. Values of
record types are returned by coercing them to an integer. After the
coercion, the coerced value is masked (with bitwise AND) and then
returned by the function. In a similar manner, values of record types
are passed as arguments by coercing them to an array of integers, and
the coerced values themselves are masked.
For union types, we effectively clear only bits, which aren't part of
any member, since we don't know which is the currently active one.
The compiler will issue a warning, whenever a union is passed to
non-secure state.
Values of half-precision floating-point types are passed in the least
significant bits of a 32-bit register (GPR or FPR) with the most
significant bits unspecified. Since this is also a potential leak of
sensitive information, this patch also clears those unspecified bits.
Differential Revision: https://reviews.llvm.org/D76369
Francis Visoiu Mistrih [Sat, 22 Feb 2020 01:35:19 +0000 (17:35 -0800)]
[AArch64] Add support for -ffixed-x30
Add support for reserving LR in:
* the driver through `-ffixed-x30`
* cc1 through `-target-feature +reserve-x30`
* the backend through `-mattr=+reserve-x30`
* a subtarget feature `reserve-x30`
the same way we're doing for the other registers.
Nick Desaulniers [Tue, 28 Apr 2020 15:34:01 +0000 (08:34 -0700)]
[TII] remove overrides of isUnpredicatedTerminator
Summary:
They all match the base implementation in
TargetInstrInfo::isUnpredicatedTerminator.
Follow up to D62749.
Reviewers: echristo, MaskRay, hfinkel
Reviewed By: echristo
Subscribers: wuzish, nemanjai, hiraditya, kbarton, llvm-commits, srhines
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78976
Sander de Smalen [Tue, 28 Apr 2020 15:06:26 +0000 (16:06 +0100)]
[SveEmitter] Add builtins for logical and predicate operations.
This patch adds builtins for logical ops:
- svand, svbic, sveor, svorr, svcnot, svnot
and builtins for predicate operations:
- svand_b_z, svbic_b_z, sveor_b_z, svnand_b_z, svnor_b_z, svorn_b_z, svorr_b_z
- svbrka_b_z, svbrkb_b_z, svbrkpa_b_z, svbrkpb_b_z, svbrkn_b_z
- svpfirst_b
- svpnext
- svptest_any
- svptest_first
- svptest_last
David Green [Tue, 28 Apr 2020 09:10:04 +0000 (10:10 +0100)]
[ARM] Always replace FP16 bitcasts with VMOVhr or VMOVrh
This changes the logic with lowering fp16 bitcasts to always produce
either a VMOVhr or a VMOVrh, instead of only trying to do it with
certain surrounding nodes. To perform the same optimisations demand bits
and known bits information has been added for them.
Differential Revision: https://reviews.llvm.org/D78587
Krzysztof Parzyszek [Mon, 23 Mar 2020 17:47:32 +0000 (12:47 -0500)]
Handle part-word LL/SC in atomic expansion pass
Differential Revision: https://reviews.llvm.org/D77213
Louis Dionne [Tue, 28 Apr 2020 13:30:24 +0000 (09:30 -0400)]
[libc++][Take 2] Create a small DSL for defining Lit features and parameters
This allows defining Lit features that can be enabled or disabled based
on compiler support, and parameters that are passed on the command line.
The main benefits are:
- Feature detection is entirely based on the substitutions provided in
the TestingConfig object, which is simpler and decouples it from the
complicated compiler emulation infrastructure.
- The syntax is declarative, which makes it easy to see what features
and parameters are accepted by the test suite. This is significantly
less entangled than the current config.py logic.
- Since feature detection is based on substitutions, it works really
well on top of the new format, and custom Lit configurations can be
created easily without being based on `config.py`.
This commit is a reapplication of
6d58030c8c7d, which was reverted in
8f24c4b72f3e because it broke Python 3 support. This re-application
supports Python 3.
Differential Revision: https://reviews.llvm.org/D78381
Tres Popp [Mon, 27 Apr 2020 14:40:00 +0000 (16:40 +0200)]
[MLIR] Give AffineStoreOp and AffineLoadOp Memory SideEffects.
Summary:
This change results in tests also being changed to prevent dead
affine.load operations from being folded away during rewrites.
Also move AffineStoreOp and AffineLoadOp to an ODS file.
Differential Revision: https://reviews.llvm.org/D78930
Eric Fiselier [Sat, 15 Feb 2020 23:55:07 +0000 (18:55 -0500)]
Recommit [libc++] Move abs and div into stdlib.h to fix header cycle.
This relands this commit as it broke the LLDB bot the first time it landed.
See also the discussion on https://reviews.llvm.org/rG82b47b2978405f802a33b00d046e6f18ef6a47be
Since D74892 this code should now also work on macOS.
Original description:
libc++ is careful to not fracture overload sets. When one overload
is visible to a user, all of them should be. Anything less causes
subtle bugs and ODR violations.
Previously, in order to support ::abs and ::div being supplied by
both <cmath> and <cstdlib> we had to do awful things that make
<math.h> and <stdlib.h> have header cycles and be non-modular.
This really breaks with modules.
Specifically the problem was that in C++ ::abs introduces overloads
for floating point numbers, these overloads forward to ::fabs,
which are defined in math.h. Therefore ::abs needed to be in math.h
too. But this required stdlib.h to include math.h and math.h to
include stdlib.h.
To avoid these problems the definitions have been moved to stddef.h
(which math includes), and the floating point overloads of ::abs
have been changed to call __builtin_fabs, which both Clang and GCC
support.
Xing GUO [Tue, 28 Apr 2020 13:38:50 +0000 (21:38 +0800)]
[DebugInfo] Fix crash caused by unhandled error.
Summary: This patch helps fix LLVM crash caused by unhandled error.
Reviewers: clayborg, aprantl
Reviewed By: clayborg
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78924
Yaxun (Sam) Liu [Fri, 24 Apr 2020 20:41:24 +0000 (16:41 -0400)]
recommit
c77a4078e01033aa2206c31a579d217c8a07569b with fix
https://reviews.llvm.org/D77954 caused a regression about ambiguity of new operator
in file scope.
This patch recovered the previous behavior for comparison without a caller.
This is a workaround. For real fix we need D71227
https://reviews.llvm.org/D78970
Jonathan Coe [Tue, 28 Apr 2020 13:11:09 +0000 (14:11 +0100)]
[clang-format] Improved parser for C# properties
Summary:
Added some examples of properties from Microsoft documentation as test cases.
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties
Configuration support will be added in a follow up patch to address whether automatic properties are formatted as
```
Type MyType { get; set }
```
or
```
Type MyType
{ get; set }
```
Reviewers: krasimir, MyDeveloperDay
Reviewed By: krasimir
Subscribers: cfe-commits
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D78915
Sander de Smalen [Tue, 28 Apr 2020 12:56:44 +0000 (13:56 +0100)]
[SveEmitter] Add builtins for zero/sign extension and bit/byte reversal.
This patch adds builtins for predicated unary builtins
svext[bhw] and svrev[bhw] and svrbit.
Raphael Isemann [Mon, 27 Apr 2020 12:58:50 +0000 (14:58 +0200)]
[lldb][cmake] Also use local submodule visibility on Darwin
Summary:
Currently building LLVM on macOS and on other platforms with LLVM_ENABLE_MODULES is using different module flags,
which means that a passing modules build on macOS might fail on Linux and vice versa. -fmodules-local-submodule-visibility
is the mode that has clearer semantics and is closer to the actual C++ module standard, so let's make this the default everywhere.
We can still test building without local submodule visibility on an additional bot by just changing the respective CMake flag. However,
if building without local-submodule-visibility breaks we won't revert other commits and we won't loose LLDB's/Clang's test run
information.
Reviewers: aprantl, bruno, Bigcheese
Reviewed By: Bigcheese
Subscribers: abidh, dexonsmith, JDevlieghere, lldb-commits, mgorny, llvm-commits
Tags: #llvm, #lldb
Differential Revision: https://reviews.llvm.org/D74892
Simon Pilgrim [Tue, 28 Apr 2020 12:57:47 +0000 (13:57 +0100)]
Fix Wparentheses gcc warning. NFC.
Wrap the 'anyof' hasAttribute checks so that we don't get precedence warnings with the assertion message.
Sander de Smalen [Tue, 28 Apr 2020 12:48:16 +0000 (13:48 +0100)]
[SveEmitter] Add builtins for bitcount operations
This patch adds builtins for svcls, svclz and svcnt.
For merging (_m), zeroing (_z) and don't-care (_x) predication.
Dmitri Gribenko [Tue, 28 Apr 2020 12:39:46 +0000 (14:39 +0200)]
Revert "[MLIR] Introduce op trait PolyhedralScope"
This reverts commit
dd2c639c3cd397dfef941186fb85c82e4e918425. It broke a
few things -- the explanation will be posted to the review thread.
Sander de Smalen [Tue, 28 Apr 2020 12:38:41 +0000 (13:38 +0100)]
[SveEmitter] Add builtins for permutations and selection
This patch adds builtins for:
- svlasta and svlastb
- svclasta and svclastb
- svunpkhi and svunpklo
- svuzp1 and svuzp2
- svzip1 and svzip2
- svrev
- svsel
- svcompact
- svsplice
- svtbl
David Zarzycki [Tue, 28 Apr 2020 12:09:45 +0000 (08:09 -0400)]
Revert: [libc++] Create a small DSL for defining Lit features and parameters
This reverts commit
6d58030c8c7d481d08a549246fd3103aceb61c7b due to lack
of Python 3 support. As a reminder, the Python community ended their
support for 2.x at the start of 2020.
Igor Kudrin [Fri, 24 Apr 2020 03:32:49 +0000 (10:32 +0700)]
[LLD][ELF] Eliminate symbols of merged .ARM.exidx sections.
GNU tools generate mapping symbols "$d" for .ARM.exidx sections. The
symbols are added to the symbol table much earlier than the merging
takes place, and after that, they become dangling. Before the patch,
LLD output those symbols as SHN_ABS with the value of 0. The patch
removes such symbols from the symbol table.
Differential Revision: https://reviews.llvm.org/D78820
Anastasia Stulova [Tue, 28 Apr 2020 10:49:31 +0000 (11:49 +0100)]
[OpenCL] Fixed test for the cast operators.
The test had unused variable because it missed to cover
case with __constant address space. This change now
completes the testing fully.
Pavel Labath [Tue, 28 Apr 2020 11:33:52 +0000 (13:33 +0200)]
[lldb/unittest] Adjust CheckIPSupport function to avoid double-consume of llvm::Error
The problem caught by clang-tidy and reported by Tobias Bosch.
Pavel Labath [Tue, 28 Apr 2020 11:13:45 +0000 (13:13 +0200)]
[lldb-vscode] A couple of small style fixes
to make the code conform to llvm style better:
- avoid use of auto where the type is not obivous
- avoid StringRef::data where it is not needed
No functional change intended.
Rainer Orth [Tue, 28 Apr 2020 11:28:41 +0000 (13:28 +0200)]
[Flang][CMake] Add explicit libFortranCommon dependency for f18 etc.
When I tried Solaris builds with `-DBUILD_SHARED_LIBS=ON`, some commands failed
to link:
[ 94%] Linking CXX executable ../../../../bin/f18
Undefined first referenced
symbol in file
Fortran::common::IntrinsicTypeDefaultKinds::set_sizeIntegerKind(int) CMakeFiles/f18.dir/f18.cpp.o (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
Fortran::common::IntrinsicTypeDefaultKinds::set_subscriptIntegerKind(int) CMakeFiles/f18.dir/f18.cpp.o (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
Fortran::common::EnumIndexToString[abi:cxx11](int, char const*) CMakeFiles/f18.dir/f18.cpp.o (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
Fortran::common::IntrinsicTypeDefaultKinds::set_defaultIntegerKind(int) CMakeFiles/f18.dir/f18.cpp.o (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
Fortran::common::IntrinsicTypeDefaultKinds::IntrinsicTypeDefaultKinds() CMakeFiles/f18.dir/f18.cpp.o (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
Fortran::common::IntrinsicTypeDefaultKinds::set_defaultRealKind(int) CMakeFiles/f18.dir/f18.cpp.o (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
ld: fatal: symbol referencing errors
This patch fixes this by adding explicit dependencies on `libFortranCommon`
to the affected commands.
Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and
`x86-64-pc-linux-gnu`.
Differential Revision: https://reviews.llvm.org/D78761
KAWASHIMA Takahiro [Tue, 28 Apr 2020 11:16:24 +0000 (20:16 +0900)]
[gcov][test] Work around PR45673 - NFC
Work around PR45673 until the test code is fixed.
Sander de Smalen [Tue, 28 Apr 2020 09:59:38 +0000 (10:59 +0100)]
[SveEmitter] Add builtins for ternary ops (fmla, fmad, etc)
This patch adds builtins for:
- svmad, svmla, svmls, svmsb
svnmad, svnmla, svnmls, svnmsb
svmla_lane, svmls_lane
These builtins come in several flavours:
- Merge into first source vector (`_m`)
- False lanes are undef (`_x`)
- False lanes are zeroed (`_z`)
And can also have `_n` to indicate the last operand is a scalar.
For example:
svint32_t svmla[_n_s32]_z(svbool_t pg, svint32_t op1, svint32_t op2, int32_t op3)
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D78960
Chen Zheng [Tue, 28 Apr 2020 09:27:06 +0000 (05:27 -0400)]
[Powerpc] add triple for new added qpx test case - NFC
Ng Zhi An [Tue, 28 Apr 2020 09:20:10 +0000 (09:20 +0000)]
[PowerPC] Fix downcast from nullptr for target streamer
getTargetStreamer() might return null (e.g. when running inlined-strings.ll test),
downcasting to a reference will be wrong. This is detectable with -fsanitize=null.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D78686
Chen Zheng [Tue, 28 Apr 2020 08:28:23 +0000 (04:28 -0400)]
[PowerPC] add test case for reorder operands of qpx fma instr - nfc.
Alex Zinenko [Thu, 23 Apr 2020 14:02:46 +0000 (16:02 +0200)]
[mlir][flang] use OpBuilder& instead of Builder* in <Op>::build methods
As we start defining more complex Ops, we increasingly see the need for
Ops-with-regions to be able to construct Ops within their regions in
their ::build methods. However, these methods only have access to
Builder, and not OpBuilder. Creating a local instance of OpBuilder
inside ::build and using it fails to trigger the operation creation
hooks in derived builders (e.g., ConversionPatternRewriter). In this
case, we risk breaking the logic of the derived builder. At the same
time, OpBuilder::create, which is by far the largest user of ::build
already passes "this" as the first argument, so an OpBuilder instance is
already available.
Update all ::build methods in all Ops in MLIR and Flang to take
"OpBuilder &" instead of "Builder *". Note the change from pointer and
to reference to comply with the common style in MLIR, this also ensures
all other users must change their ::build methods.
Differential Revision: https://reviews.llvm.org/D78713
Ehsan Toosi [Mon, 20 Apr 2020 10:41:14 +0000 (12:41 +0200)]
Providing buffer assignment for MLIR
We have provided a generic buffer assignment transformation ported from
TensorFlow. This generic transformation pass automatically analyzes the values
and their aliases (also in other blocks) and returns the valid positions for
Alloc and Dealloc operations. To find these positions, the algorithm uses the
block Dominator and Post-Dominator analyses. In our proposed algorithm, we have
considered aliasing, liveness, nested regions, branches, conditional branches,
critical edges, and independency to custom block terminators. This
implementation doesn't support block loops. However, we have considered this in
our design. For this purpose, it is only required to have a loop analysis to
insert Alloc and Dealloc operations outside of these loops in some special
cases.
Differential Revision: https://reviews.llvm.org/D78484
Hans Wennborg [Tue, 28 Apr 2020 08:10:33 +0000 (10:10 +0200)]
Revert
f8990feb125a "[libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON"
This broke builds configured with
$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release '-DLLVM_ENABLE_PROJECTS=clang' '-DLLVM_TARGETS_TO_BUILD=X86' -DLLVM_ENABLE_PIC=OFF ../llvm
CMake Error at
/b/s/w/ir/cache/builder/src/third_party/llvm/clang/tools/libclang/CMakeLists.txt:123
(target_compile_definitions):
target_compile_definitions called with non-compilable target type
This reverts commit
f8990feb125a0f8d3f2892a589bc6fad3c430858.
Gabor Marton [Tue, 7 Apr 2020 09:44:33 +0000 (11:44 +0200)]
[analyzer] StdLibraryFunctionsChecker: Associate summaries to FunctionDecls
Summary:
Currently we map function summaries to names (i.e. strings). We can
associate more summaries with different signatures to one name, this way
we support overloading. During a call event we check whether the
signature of the summary matches the signature of the callee and we
apply the summary only in that case.
In this patch we change this mapping to associate a summary to a
FunctionDecl. We do lookup operations when the summary map is
initialized. We lookup the given name and we match the signature of the
given summary against the lookup results. If the summary matches the
FunctionDecl (got from the lookup result) then we add that to the
summary map. During a call event we compare FunctionDecl pointers.
Advantages of this new refactor:
- Cleaner mapping and structure for the checker.
- Possibly way more efficient handling of call events.
- A summary is added only if that is relevant for the given TU.
- We can get the concrete FunctionDecl by the time when we create the
summary, this opens up possibilities of further sanity checks
regarding the summary cases and argument constraints.
- Opens up to future work when we'd like to store summaries from IR to a
FunctionDecl (or from the Attributor results of the given
FunctionDecl).
Note, we cannot support old C functions without prototypes.
Reviewers: NoQ, Szelethus, balazske, jdoerfert, sstefan1, uenoku
Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, Charusso, steakhal, uenoku, ASDenysPetrov, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77641
Sam Parker [Mon, 27 Apr 2020 08:02:14 +0000 (09:02 +0100)]
[TTI] Add TargetCostKind argument to getUserCost
There are several different types of cost that TTI tries to provide
explicit information for: throughput, latency, code size along with
a vague 'intersection of code-size cost and execution cost'.
The vectorizer is a keen user of RecipThroughput and there's at least
'getInstructionThroughput' and 'getArithmeticInstrCost' designed to
help with this cost. The latency cost has a single use and a single
implementation. The intersection cost appears to cover most of the
rest of the API.
getUserCost is explicitly called from within TTI when the user has
been explicit in wanting the code size (also only one use) as well
as a few passes which are concerned with a mixture of size and/or
a relative cost. In many cases these costs are closely related, such
as when multiple instructions are required, but one evident diverging
cost in this function is for div/rem.
This patch adds an argument so that the cost required is explicit,
so that we can make the important distinction when necessary.
Differential Revision: https://reviews.llvm.org/D78635
serge-sans-paille [Sat, 18 Apr 2020 06:14:52 +0000 (08:14 +0200)]
Use components instead of libraries in Polly linkage step
As a side effect, this tests (and fix a bug) in the compiler extension handling
of components.
Differential Revision: https://reviews.llvm.org/D78358
Jonas Paulsson [Tue, 28 Apr 2020 07:37:43 +0000 (09:37 +0200)]
[SystemZ] Fix test case.
Remove bad kill flags fom load-and-test.mir as discovered by
https://reviews.llvm.org/D78586: "[MachineVerifier] Add more checks for
registers in live-in lists".
Review: Ulrich Weigand
Kazushi (Jam) Marukawa [Tue, 28 Apr 2020 07:41:01 +0000 (09:41 +0200)]
[VE] Update branch instructions
Summary:
Changing all mnemonic to match assembly instructions to simplify mnemonic
naming rules. This time update all branch instructions. This also change
to use %s10 register consistently.
Differential Revision: https://reviews.llvm.org/D78889