Commit Graph

352810 Commits

Author SHA1 Message Date
Stanislav Mekhanoshin 46a75436f8 [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
2020-04-28 14:57:46 -07:00
Jessica Paquette 9f31446c99 [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)
2020-04-28 14:56:08 -07:00
Casey Carter 68b30bc02b [NFC] Correct spelling of "ambiguous" 2020-04-28 14:51:37 -07:00
Siva Chandra Reddy 1852af16a1 [libc] Fix benchmarks build.
Reviewers: gchatelet, echristo

Subscribers: mgorny, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D79040
2020-04-28 14:30:48 -07:00
Vojtěch Štěpančík ad38f4b371 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
2020-04-28 23:18:31 +02:00
Louis Dionne 178a0c80ba [libc++] Make sure temporary config files are closed
Otherwise, trying to remove the file triggers an error on Windows.
2020-04-28 17:13:03 -04:00
Davide Italiano 0ed276bb08 [GlobalISel] Assign the correct debug location when combining G_ANYEXT/G_ZEXT
<rdar://problem/62535712>
2020-04-28 14:12:33 -07:00
Vitaly Buka a3b942edc8 [tsan] Relax stack trace check
With GCC 8 stack is different.
2020-04-28 14:06:00 -07:00
Sean Silva 9c9f479a7d 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
2020-04-28 14:00:18 -07:00
Simon Pilgrim 751a554f25 [InstCombine] Add PR45715 test case 2020-04-28 21:53:59 +01:00
Stanislav Mekhanoshin 395d93358e Revert "[AMDGPU] Define special SGPR subregs"
This reverts commit 1baaa080e0.
2020-04-28 13:53:15 -07:00
Florian Hahn 616657b39c [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
2020-04-28 21:47:31 +01:00
Stanislav Mekhanoshin 1baaa080e0 [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
2020-04-28 13:34:24 -07:00
Mircea Trofin 8a7cf11f92 [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
2020-04-28 13:23:47 -07:00
Eric Christopher f1ecf560bf Add StringRef include to libc benchmark. 2020-04-28 13:12:26 -07:00
Saleem Abdulrasool 88af3ddb1e 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.
2020-04-28 20:07:28 +00:00
Walter Erquinigo 83725822c5 [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
2020-04-28 13:03:02 -07:00
Christopher Tetreault 2e214baed9 [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
2020-04-28 12:59:26 -07:00
David Blaikie 95e570725a OpenMPOpt::RuntimeFunctionInfo::UsesMap: Use unique_ptr for values to simplify memory management 2020-04-28 12:26:53 -07:00
David Blaikie 89e2fe3210 MustBeExecutedContextExplorer::InstructionIteratorMap: use unique_ptr for values in this map to simplify memory management 2020-04-28 12:26:53 -07:00
David Blaikie 3c89256d71 Attributor::ArgumentReplacementMap: Use unique_ptr to simplify memory management 2020-04-28 12:26:52 -07:00
Fangrui Song 6f23049119 [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
2020-04-28 12:20:42 -07:00
Fangrui Song 03ffe58605 [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
2020-04-28 12:13:27 -07:00
Sean Fertile 2a3cf5e583 [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
2020-04-28 14:57:14 -04:00
Reid Kleckner b8000c0ce8 [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
2020-04-28 11:36:21 -07:00
Craig Topper 59b9e6fe76 [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.
2020-04-28 11:35:41 -07:00
Jessica Paquette 2af31b3b65 [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
2020-04-28 11:35:01 -07:00
Shoaib Meenai fbae153ca5 Revert "[lld-macho] Add basic symbol table output"
This reverts commit a3d95a50ee.

Reverting due to UBSan failures:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/40817/steps/check-lld%20ubsan/logs/stdio
2020-04-28 11:34:03 -07:00
Shoaib Meenai b52bc2653b Revert "[lld-macho] Add support for emitting dylibs with a single symbol"
This reverts commit 9598778bd1.

Reverting due to UBSan failures:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/40817/steps/check-lld%20ubsan/logs/stdio
2020-04-28 11:34:03 -07:00
Shoaib Meenai af40bff32d [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.
2020-04-28 11:33:54 -07:00
David Blaikie 1b56980845 MustBeExecutedContextPrinter::runOnModule: Use unique_ptr to simplify/clarify ownership 2020-04-28 11:30:53 -07:00
Raphael Isemann bd2965c9db 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...
2020-04-28 20:23:22 +02:00
Christopher Tetreault ef3678cfee [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
2020-04-28 11:22:20 -07:00
Jan Korous 1e43cab3c6 [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
2020-04-28 11:08:04 -07:00
Craig Topper 0de7ddbfb0 [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
2020-04-28 10:39:39 -07:00
Craig Topper c480dc6b47 [X86] Pre-commit tests for D78984. NFC
These tests show some missed opportunities to use sbb/adc.
2020-04-28 10:39:37 -07:00
Craig Topper d42192c50f [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
2020-04-28 10:39:36 -07:00
Reid Kleckner 01b5f52140 [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
2020-04-28 10:35:57 -07:00
Louis Dionne 14f07bcab0 [libc++] Avoid using distutils.util in the DSL
Some bots apparently don't have that package.
2020-04-28 13:33:04 -04:00
Saleem Abdulrasool a5d79e5fa1 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.
2020-04-28 17:29:04 +00:00
Jonas Devlieghere 3e4a16d2cb [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
2020-04-28 10:25:34 -07:00
Reid Kleckner cbaa74a098 [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.
2020-04-28 10:24:11 -07:00
Kirill Bobyrev 9ff3f339e8
[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
2020-04-28 19:16:37 +02:00
Louis Dionne 707df4acdc [libc++] Temporarily disable test that fails on Windows 2020-04-28 13:10:12 -04:00
Reid Kleckner efd1f17cd9 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
2020-04-28 09:55:48 -07:00
Erik Pilkington 2bb686b4b6 [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
2020-04-28 12:54:49 -04:00
Fangrui Song d9786b566b [ELF] Clear lazyObjFiles in lld:🧝:link after D46034 2020-04-28 09:54:20 -07:00
Ulrich Weigand 095ccf4455 [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.
2020-04-28 18:49:49 +02:00
Ulrich Weigand c90e09b13c [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.
2020-04-28 18:49:48 +02:00
Jonathan Coe 85ee97fd89 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 015bca3e67.
2020-04-28 17:41:17 +01:00