Reid Kleckner [Wed, 2 Dec 2020 23:21:04 +0000 (15:21 -0800)]
Bump MSVC required version to 19.14
LLVM passes overaligned objects by value, which MSVC 19.1 didn't support on
x86_32. MSVC added this support somewhere between 19.1 and 19.14, but godbolt
doesn't have 19.11, 19.12, or 19.13 so I can't test before 19.14:
https://gcc.godbolt.org/z/75YoEz
Even if users are using the Visual Studio 2017 series of Visual C++ toolchains,
they should've already updated to 19.14 or newer at this point, or they
wouldn't be able to build LLVM. This just raises the CMake required minimum
version so the build fails earlier.
Differential Revision: https://reviews.llvm.org/D92515
Craig Topper [Thu, 3 Dec 2020 17:30:33 +0000 (09:30 -0800)]
[RISCV] Remove RISCVMergeBaseOffsetOpt from the -O0 pass pipeline.
Internally the pass skips any function with the optnone attribute. But that still requires checking each function. If the opt level is set to None we might as well just skip putting in the pipeline at all. This what is already done for many of the passes added by TargetPassConfig.
Differential Revision: https://reviews.llvm.org/D92511
Max Kudryavtsev [Thu, 3 Dec 2020 17:51:47 +0000 (09:51 -0800)]
[MLIR] Fix vector::TransferWriteOp builder losing permutation map
Supervectorizer pass uses this builder and loses the permutation map.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D92145
modimo [Thu, 3 Dec 2020 17:23:37 +0000 (09:23 -0800)]
[MemCpyOpt] Correctly merge alias scopes during call slot optimization
When MemCpyOpt performs call slot optimization it will concatenate the `alias.scope` metadata between the function call and the memcpy. However, scoped AA relies on the domains in metadata to be maintained in a caller-callee relationship. Naive concatenation breaks this assumption leading to bad AA results.
The fix is to take the intersection of domains then union the scopes within those domains.
The original bug came from a case of rust bad codegen which uses this bad aliasing to perform additional memcpy optimizations. As show in the added test case `%src` got forwarded past its lifetime leading to a dereference of garbage data.
Testing
ninja check-llvm
Reviewed By: jeroen.dobbelaere
Differential Revision: https://reviews.llvm.org/D91576
Fangrui Song [Thu, 3 Dec 2020 17:15:40 +0000 (09:15 -0800)]
Switch to std::is_trivially_move_constructible and std::is_trivially_copy_constructible
Differential Revision: https://reviews.llvm.org/D92543
Kazu Hirata [Thu, 3 Dec 2020 17:12:02 +0000 (09:12 -0800)]
[X86] Remove DecodeVPERMVMask and DecodeVPERMV3Mask
This patch removes the variants of DecodeVPERMVMask and
DecodeVPERMV3Mask that take "const Constant *C" as they are not used
anymore.
They were introduced on Sep 8, 2015 in commit
e88038f23517ffc741acfd307ff92e2b1af136d8.
The last use of DecodeVPERMVMask(const Constant *C, ...) was removed
on Feb 7, 2016 in commit
73fc26b44a8591b15f13eaffef17e67161c69388.
The last use of DecodeVPERMV3Mask(const Constant *C, ...) was removed
on May 28, 2018 in commit
dcfcfdb0d166fff8388bdd2edc5a2948054c9da1.
Differential Revision: https://reviews.llvm.org/D91926
Jameson Nash [Thu, 3 Dec 2020 15:37:18 +0000 (10:37 -0500)]
repair cygwin build
This is needed for cross-compiling LLVM from Cygwin, but it had gotten
deleted in rG2724d9e12960cc1d93eeabbfc9aa1bffffa041cc
Reviewed By: compnerd
Differential Revision: https://reviews.llvm.org/D92336
Anna Thomas [Thu, 3 Dec 2020 16:43:30 +0000 (11:43 -0500)]
[ScalarizeMaskedMemIntrin] NFC: Convert member functions to static
This will make it easier to add new PM support once the pass is moved
into transforms (D92407).
Valentin Clement [Thu, 3 Dec 2020 16:26:46 +0000 (11:26 -0500)]
[LLVMFrontend][openacc] Add basic unit tests for functions in LLVMFrontendOpenACC
Add unit tests for functions in LLVMFrontendOpenACC. As notice in D91470 these functions were not tested
as well as the ones for OpenMP (D91643). This patch add tests for the OpenACC part.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D91653
Tue Ly [Fri, 18 Sep 2020 03:22:18 +0000 (23:22 -0400)]
[libc] Add implementation of hypot.
Refactor src/math/hypotf.cpp and test/src/math/hypotf_test.cpp and reuse them for hypot and hypot_test
Differential Revision: https://reviews.llvm.org/D91831
Nico Weber [Thu, 3 Dec 2020 15:54:52 +0000 (10:54 -0500)]
Try to fix tests on Windows after
0cbf61be8be
Ahmed Bougacha [Thu, 3 Sep 2020 15:43:21 +0000 (08:43 -0700)]
[Triple][MachO] Define "arm64e", an AArch64 subarch for Pointer Auth.
This also teaches MachO writers/readers about the MachO cpu subtype,
beyond the minimal subtype reader support present at the moment.
This also defines a preprocessor macro to allow users to distinguish
__arm64__ from __arm64e__.
arm64e defaults to an "apple-a12" CPU, which supports v8.3a, allowing
pointer-authentication codegen.
It also currently defaults to ios14 and macos11.
Differential Revision: https://reviews.llvm.org/D87095
Baptiste Saleil [Thu, 3 Dec 2020 15:49:38 +0000 (09:49 -0600)]
[PowerPC] Fix for excessive ACC copies due to PHI nodes
When using accumulators in loops, they are passed around in PHI nodes of unprimed
accumulators, causing the generation of additional prime/unprime instructions.
This patch detects these cases and changes these PHI nodes to primed accumulator
PHI nodes. We also add IR and MIR test cases for several PHI node cases.
Differential Revision: https://reviews.llvm.org/D91391
Nathan James [Thu, 3 Dec 2020 15:47:54 +0000 (15:47 +0000)]
[ASTMatchers][NFC] Made variadic operator funcs static
Fix naming style while were here too.
Yonghong Song [Fri, 3 Jan 2020 20:06:08 +0000 (12:06 -0800)]
[BPF] support atomic instructions
Implement fetch_<op>/fetch_and_<op>/exchange/compare-and-exchange
instructions for BPF. Specially, the following gcc intrinsics
are implemented.
__sync_fetch_and_add (32, 64)
__sync_fetch_and_sub (32, 64)
__sync_fetch_and_and (32, 64)
__sync_fetch_and_or (32, 64)
__sync_fetch_and_xor (32, 64)
__sync_lock_test_and_set (32, 64)
__sync_val_compare_and_swap (32, 64)
For __sync_fetch_and_sub, internally, it is implemented as
a negation followed by __sync_fetch_and_add.
For __sync_lock_test_and_set, despite its name, it actually
does an atomic exchange and return the old content.
https://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html
For intrinsics like __sync_{add,sub}_and_fetch and
__sync_bool_compare_and_swap, the compiler is able to generate
codes using __sync_fetch_and_{add,sub} and __sync_val_compare_and_swap.
Similar to xadd, atomic xadd, xor and xxor (atomic_<op>)
instructions are added for atomic operations which do not
have return values. LLVM will check the return value for
__sync_fetch_and_{add,and,or,xor}.
If the return value is used, instructions atomic_fetch_<op>
will be used. Otherwise, atomic_<op> instructions will be used.
All new instructions only support 64bit and 32bit with alu32 mode.
old xadd instruction still supports 32bit without alu32 mode.
For encoding, please take a look at test atomics_2.ll.
Differential Revision: https://reviews.llvm.org/D72184
Adam Czachorowski [Wed, 2 Dec 2020 17:55:32 +0000 (18:55 +0100)]
[clangd] Bundle code completion items when the include paths differ, but resolve to the same file.
This can happen when, for example, merging results from an external
index that generates IncludeHeaders with full URI rather than just
literal include.
Differential Revision: https://reviews.llvm.org/D92494
dfukalov [Wed, 2 Dec 2020 16:53:17 +0000 (19:53 +0300)]
[NFC] Reduce include files dependency.
1. Removed #include "...AliasAnalysis.h" in other headers and modules.
2. Cleaned up includes in AliasAnalysis.h.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D92489
Paul C. Anagnostopoulos [Tue, 24 Nov 2020 18:09:02 +0000 (13:09 -0500)]
[TableGen] Eliminate the 'code' type
Update the documentation.
Rework various backends that relied on the code type.
Differential Revision: https://reviews.llvm.org/D92269
Kazushi (Jam) Marukawa [Thu, 3 Dec 2020 03:22:59 +0000 (12:22 +0900)]
[VE] Add vsll, vsrl, vsla, vsra, and vsfa intrinsic instructions
Add vsll, vsrl, vsla, vsra, and vsfa intrinsic instructions and
regression tests.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92550
Nico Weber [Thu, 3 Dec 2020 14:11:03 +0000 (09:11 -0500)]
[mac/arm] Fix rtti codegen tests when running on an arm mac
shouldRTTIBeUnique() returns false for iOS64CXXABI, which causes
RTTI objects to be emitted hidden. Update two tests that didn't
expect this to happen for the default triple.
Also rename iOS64CXXABI to AppleARM64CXXABI, since it's used for
arm64-apple-macos triples too.
Part of PR46644.
Differential Revision: https://reviews.llvm.org/D91904
Haruki Imai [Thu, 3 Dec 2020 13:52:00 +0000 (19:22 +0530)]
[MLIR] Normalize the results of normalizable operations
Memrefs with affine_map in the results of normalizable operation were
not normalized by `--normalize-memrefs` option. This patch normalizes
them.
Differential Revision: https://reviews.llvm.org/D88719
Nico Weber [Tue, 1 Dec 2020 01:10:30 +0000 (20:10 -0500)]
clang/darwin: Don't use response files with ld64
This morally reverts D82777 -- turns out that ld64 crashes with many
response files, so we must stop passing them to it until the crash is
fixed.
Differential Revision: https://reviews.llvm.org/D92357
Ilya Golovenko [Thu, 3 Dec 2020 13:55:11 +0000 (16:55 +0300)]
[clangd] Relation slabs should not be accounted when computing backing storage size
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D92484
Jay Foad [Wed, 2 Dec 2020 12:32:35 +0000 (12:32 +0000)]
[TableGen] Remove unused class RecordValResolver. NFC.
Differential Revision: https://reviews.llvm.org/D92477
Nico Weber [Wed, 2 Dec 2020 23:59:00 +0000 (18:59 -0500)]
Reland "[mac/lld] Implement -why_load".
The problem was that `sym` became replaced in the call
to make<ObjFile> and referring to it afer that read memory that now
stored a different kind of symbol (a Defined instead of a LazySymbol).
Since this happens only once per archive, just copy the symbol to the
stack before make<ObjFile> and read the copy instead.
Originally reviewed at https://reviews.llvm.org/D92496
Martin Storsjö [Thu, 3 Dec 2020 08:31:31 +0000 (10:31 +0200)]
[compiler-rt] Fix building the aarch64 out-of-line atomics assembly for non-ELF platforms
Move the two different definitions of FUNC_ALIGN out of the ELF
specific block. Add the missing CFI_END in
END_COMPILERRT_OUTLINE_FUNCTION, to go with the corresponding CFI_START
in DEFINE_COMPILERRT_OUTLINE_FUNCTION_UNMANGLED.
Differential Revision: https://reviews.llvm.org/D92549
Kazushi (Jam) Marukawa [Mon, 30 Nov 2020 18:41:12 +0000 (03:41 +0900)]
[VE] Add standard include path and library path for C++
We have a plan to add libcxx and libcxxabi for VE. In order to do so,
we need to compile cxx source code with bootstarapped header files.
This patch adds such expected path to make clang++ work, at least
not crash at the startup. Add regression test for that, also.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92386
Joe Ellis [Wed, 2 Dec 2020 14:02:47 +0000 (14:02 +0000)]
[DAGCombine] Fix TypeSize warning in DAGCombine::visitLIFETIME_END
Bail out early if we encounter a scalable store.
Reviewed By: peterwaller-arm
Differential Revision: https://reviews.llvm.org/D92392
Evgeniy Brevnov [Thu, 3 Dec 2020 12:02:32 +0000 (19:02 +0700)]
[NFC][Tests] Added one additional test case for NaryRessociation pass.
New tes cases added. Change var names to avoid the following warning from update_test_checks.py:
WARNING: Change IR value name 'tmp5' to prevent possible conflict with scripted FileCheck name.
Reviewed By: ebrevnov
Differential Revision: https://reviews.llvm.org/D92566
Haojian Wu [Thu, 3 Dec 2020 11:57:41 +0000 (12:57 +0100)]
[clangd] Fix a nullptr-access crash in canonicalRenameDecl.
Evgeniy Brevnov [Thu, 3 Dec 2020 10:51:40 +0000 (17:51 +0700)]
[NFC][Tests] Auto generate checks for llvm/test/Transforms/NaryReassociate/pr24301.ll using update_test_checks.py
Generate checks with update_test_checks.py in order to simplify upcoming updates.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D92561
Georgii Rymar [Thu, 3 Dec 2020 09:16:58 +0000 (12:16 +0300)]
[llvm-readelf/obj] - Report unique warnings in getSymbolForReloc() helper.
Use `reportUniqueWarning` instead of `reportWarning` and refine the
interface of the helper.
Differential revision: https://reviews.llvm.org/D92556
Tim Northover [Tue, 10 Nov 2020 11:15:08 +0000 (11:15 +0000)]
arm64: count Triple::aarch64_32 as an aarch64 target and enable leaf frame pointers
Jon Chesterfield [Thu, 3 Dec 2020 10:36:20 +0000 (10:36 +0000)]
[libomptarget][amdgpu] Address compiler warnings, drive by fixes
[libomptarget][amdgpu] Address compiler warnings, drive by fixes
Initialize some variables, remove unused ones.
Changes the debug printing condition to align with the aomp test suite.
Differential Revision: https://reviews.llvm.org/D92559
Georgii Rymar [Thu, 3 Dec 2020 08:42:17 +0000 (11:42 +0300)]
[llvm-readelf] - Report unique warnings when dumping hash symbols/histogram.
This converts 2 more places to use `reportUniqueWarning` and adds tests.
Differential revision: https://reviews.llvm.org/D92551
Max Kazantsev [Thu, 3 Dec 2020 10:08:35 +0000 (17:08 +0700)]
Revert "[IndVars] ICmpInst should not prevent IV widening"
This reverts commit
0c9c6ddf17bb01ae350a899b3395bb078aa0c62e.
We are seeing some failures with this patch locally. Not clear
if it's causing them or just triggering a problem in another
place. Reverting while investigating.
Julian Gross [Mon, 23 Nov 2020 15:03:27 +0000 (16:03 +0100)]
[MLIR] Added support for dynamic shaped allocas to promote-buffers-to-stack pass.
Extended promote buffers to stack pass to support dynamically shaped allocas.
The conversion is limited by the rank of the underlying tensor.
An option is added to the pass to adjust the given rank.
Differential Revision: https://reviews.llvm.org/D91969
Gabor Marton [Wed, 25 Nov 2020 15:29:28 +0000 (16:29 +0100)]
[Clang][Sema] Attempt to fix CTAD faulty copy of non-local typedefs
http://lists.llvm.org/pipermail/cfe-dev/2020-November/067252.html
Differential Revision: https://reviews.llvm.org/D92101
Sven van Haastregt [Thu, 3 Dec 2020 10:21:29 +0000 (10:21 +0000)]
[OpenCL] Add some more kernel argument tests
Differential Revision: https://reviews.llvm.org/D92406
Marek Kurdej [Thu, 3 Dec 2020 09:38:37 +0000 (10:38 +0100)]
[clang-format] De-duplicate includes with leading or trailing whitespace.
This fixes PR46555 (https://bugs.llvm.org/show_bug.cgi?id=46555).
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D88296
Marek Kurdej [Thu, 3 Dec 2020 09:27:09 +0000 (10:27 +0100)]
[c++2b] Add option -std=c++2b to enable support for potential C++2b features.
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D92547
Christian Sigg [Thu, 3 Dec 2020 09:08:08 +0000 (10:08 +0100)]
Fix forward for rGd9adde5ae216: adding missing dependency.
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D92552
Kazushi (Jam) Marukawa [Thu, 3 Dec 2020 01:18:10 +0000 (10:18 +0900)]
[VE] Add veqv and vseq intrinsic instructions
Add veqv and vseq intrinsic instructions and regression tests.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92527
Marek Kurdej [Thu, 3 Dec 2020 08:17:14 +0000 (09:17 +0100)]
[libc++] [docs] Add C++2b (to be C++23) status page.
Also:
* Fix header line in all status tables.
* Use C++20 instead of C++2a.
Reviewed By: ldionne, #libc, miscco
Differential Revision: https://reviews.llvm.org/D92306
Christian Sigg [Wed, 2 Dec 2020 08:48:59 +0000 (09:48 +0100)]
[mlir][gpu] Move gpu.wait ops from async.execute regions to its dependencies.
This can prevent unnecessary host synchronization.
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D90346
Yuanfang Chen [Thu, 3 Dec 2020 07:31:06 +0000 (23:31 -0800)]
[NFC] Add proper triple for arc.ll test
Yonghong Song [Wed, 2 Dec 2020 03:26:39 +0000 (19:26 -0800)]
BPF: add a test for selectiondag alias analysis w.r.t. lifetime
This adds a test for the bug
https://bugs.llvm.org/show_bug.cgi?id=47591
Previously, selection dag has a bug which may incorrectly
assume no alias when crossing a lifetime boundary and this
may generate incorrect code as demonstrated in the above bug.
It looks the bug is fixed by https://reviews.llvm.org/D91833.
Basically, when comparing two potential memory access dag nodes,
a store and a lifetime.start,
with the same frame index.
Previously, it may be decided no alias. With the above fix,
these two will be considered aliasing which will prevent
incorrect code scheduling.
Differential Revision: https://reviews.llvm.org/D92451
modimo [Thu, 3 Dec 2020 06:23:57 +0000 (22:23 -0800)]
[NFC] Fix typo
Fangrui Song [Thu, 3 Dec 2020 06:02:48 +0000 (22:02 -0800)]
Switch from llvm::is_trivially_copyable to std::is_trivially_copyable
GCC<5 did not support std::is_trivially_copyable. Now LLVM builds require 5.1
we can migrate to std::is_trivially_copyable.
The Optional.h change made MSVC choke
(https://buildkite.com/llvm-project/premerge-checks/builds/18587#
cd1bb616-ffdc-4581-9795-
b42c284196de)
so I leave it out for now.
Differential Revision: https://reviews.llvm.org/D92514
Jianzhou Zhao [Wed, 2 Dec 2020 05:58:09 +0000 (05:58 +0000)]
[dfsan] Rename ShadowTy/ZeroShadow with prefix Primitive
This is a child diff of D92261.
After supporting field/index-level shadow, the existing shadow with type
i16 works for only primitive types.
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D92459
Pushpinder Singh [Wed, 2 Dec 2020 06:34:38 +0000 (01:34 -0500)]
[libomptarget][AMDGPU] Remove MaxParallelLevel
Removes MaxParallelLevel references from rtl.cpp and drops
resulting dead code.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D92463
Craig Topper [Thu, 3 Dec 2020 05:03:05 +0000 (21:03 -0800)]
[RISCV] Add additional half precision fnmadd/fnmsub tests with an fneg on the second operand instead of the first.
This matches the float/double tests added in
defe11866a326491ee9767f84bb3f70cfc4f4bcb
Craig Topper [Thu, 3 Dec 2020 04:20:38 +0000 (20:20 -0800)]
[RISCV] Add f16 to isFMAFasterThanFMulAndFAdd now that the Zfh extension is supported
QingShan Zhang [Thu, 3 Dec 2020 03:09:25 +0000 (03:09 +0000)]
[PowerPC] Add the hw sqrt test for vector type v4f32/v2f64
PowerPC ISA support the input test for vector type v4f32 and v2f64.
Replace the software compare with hw test will improve the perf.
Reviewed By: ChenZheng
Differential Revision: https://reviews.llvm.org/D90914
Kazu Hirata [Thu, 3 Dec 2020 03:09:45 +0000 (19:09 -0800)]
[SelectionDAG] Use is_contained (NFC)
Qiu Chaofan [Thu, 3 Dec 2020 02:50:42 +0000 (10:50 +0800)]
[NFC] [Clang] Move ppc64le f128 vaargs OpenMP test
This case for long-double semantics mismatch on OpenMP references
%clang, which should be located in Driver directory.
Vitaly Buka [Thu, 3 Dec 2020 02:36:02 +0000 (18:36 -0800)]
[NFC][sanitizer] Another attempt to fix test on arm
Craig Topper [Thu, 3 Dec 2020 01:28:20 +0000 (17:28 -0800)]
[RISCV] Initialize MergeBaseOffsetOptPass so it will work with print-before/after-all.
If its not in the PassRegistry it's not recognized as
a pass when we print before/after. Happened to notice while
I was working on a new pass.
Richard Smith [Thu, 3 Dec 2020 01:46:28 +0000 (17:46 -0800)]
PR48339: Improve diagnostics for invalid dependent unqualified function calls.
Fix bogus diagnostics that would get confused and think a "no viable
fuctions" case was an "undeclared identifiers" case, resulting in an
incorrect diagnostic preceding the correct one. Use overload resolution
to determine which function we should select when we can find call
candidates from a dependent base class. Make the diagnostics for a call
that could call a function from a dependent base class more specific,
and use a different diagnostic message for the case where the call
target is instead declared later in the same class. Plus some minor
diagnostic wording improvements.
Kazu Hirata [Thu, 3 Dec 2020 01:40:19 +0000 (17:40 -0800)]
[MemorySSA] Remove unused declaration findDominatingDef (NFC)
The function definition was removed on Feb 22, 2017 in commit
17e8d0eae24ffa41cf7641d984c05e00d59b93a4. The declaration has
remained since.
Duncan P. N. Exon Smith [Thu, 3 Dec 2020 01:34:38 +0000 (17:34 -0800)]
Revert "Frontend: Sink named pipe logic from CompilerInstance down to FileManager"
This reverts commit
3b18a594c7717a328c33b9c1eba675e9f4bd367c, since
apparently this doesn't work everywhere. E.g.,
clang-x86_64-debian-fast/3889
(http://lab.llvm.org:8011/#/builders/109/builds/3889) gives me:
```
+ : 'RUN: at line 8'
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/clang -x c /dev/fd/0 -E
+ cat /b/1/clang-x86_64-debian-fast/llvm.src/clang/test/Misc/dev-fd-fs.c
fatal error: file '/dev/fd/0' modified since it was first processed
1 error generated.
```
Sergey Dmitriev [Thu, 3 Dec 2020 00:19:31 +0000 (16:19 -0800)]
[llvm-link] use file magic when deciding if input should be loaded as archive
llvm-link should not rely on the '.a' file extension when deciding if input file
should be loaded as archive. Archives may have other extensions (f.e. .lib) or no
extensions at all. This patch changes llvm-link to use llvm::file_magic to check
if input file is an archive.
Reviewed By: RaviNarayanaswamy
Differential Revision: https://reviews.llvm.org/D92376
Hsiangkai Wang [Thu, 12 Nov 2020 02:00:33 +0000 (10:00 +0800)]
[RISCV] Handle zfh in the arch string.
Differential Revision: https://reviews.llvm.org/D91315
Hsiangkai Wang [Fri, 3 Jul 2020 14:57:59 +0000 (22:57 +0800)]
[RISCV] Support Zfh half-precision floating-point extension.
Support "Zfh" extension according to
https://github.com/riscv/riscv-isa-manual/blob/zfh/src/zfh.tex
Differential Revision: https://reviews.llvm.org/D90738
Duncan P. N. Exon Smith [Tue, 3 Nov 2020 13:33:06 +0000 (08:33 -0500)]
Frontend: Sink named pipe logic from CompilerInstance down to FileManager
Remove compilicated logic from CompilerInstance::InitializeSourceManager
to deal with named pipes, updating FileManager::getBufferForFile to
handle it in a more straightforward way. The existing test at
clang/test/Misc/dev-fd-fs.c covers the new behaviour (just like it did
the old behaviour).
Differential Revision: https://reviews.llvm.org/D90733
Jonas Devlieghere [Thu, 3 Dec 2020 00:26:11 +0000 (16:26 -0800)]
[lldb] Treat remote macOS debugging like any other remote darwin platform
Extract remote debugging logic from PlatformMacOSX and move it into
PlatformRemoteMacOSX so it can benefit from all the logic necessary for
remote debugging.
Until now, remote macOS debugging was treated almost identical to local
macOS debugging. By moving in into its own class, we can have it inherit
from PlatformRemoteDarwinDevice and all the functionality it provides,
such as looking at the correct DeviceSupport directory.
rdar://
68167374
Differential revision: https://reviews.llvm.org/D92452
Sergey Dmitriev [Thu, 3 Dec 2020 00:52:48 +0000 (16:52 -0800)]
Revert "[llvm-link] use file magic when deciding if input should be loaded as archive"
This reverts commit
55f8c2fdfbc5eda1be946e97ecffa2dea44a883e.
Xun Li [Thu, 3 Dec 2020 00:49:12 +0000 (16:49 -0800)]
Small improvements to Intrinsic::getName
While I was adding a new intrinsic instruction (not overloaded), I accidentally used CreateUnaryIntrinsic to create the intrinsics, which turns out to be passing the type list to getName, and ended up naming the intrinsics function with type suffix, which leads to wierd bugs latter on. It took me a long time to debug.
It seems a good idea to add an assertion in getName so that it fails if types are passed but it's not a overloaded function.
Also, the overloade version of getName is less efficient because it creates an std::string. We should avoid calling it if we know that there are no types provided.
Differential Revision: https://reviews.llvm.org/D92523
Sergey Dmitriev [Thu, 3 Dec 2020 00:19:31 +0000 (16:19 -0800)]
[llvm-link] use file magic when deciding if input should be loaded as archive
llvm-link should not rely on the '.a' file extension when deciding if input file
should be loaded as archive. Archives may have other extensions (f.e. .lib) or no
extensions at all. This patch changes llvm-link to use llvm::file_magic to check
if input file is an archive.
Reviewed By: RaviNarayanaswamy
Differential Revision: https://reviews.llvm.org/D92376
Duncan P. N. Exon Smith [Wed, 4 Nov 2020 20:51:56 +0000 (15:51 -0500)]
ARCMigrate: Stop abusing PreprocessorOptions for passing back file remappings, NFC
As part of reducing use of PreprocessorOptions::RemappedFileBuffers,
stop abusing it to pass information around remapped files in
`ARCMigrate`. This simplifies an eventual follow-up to switch to using
an `InMemoryFileSystem` for this.
Differential Revision: https://reviews.llvm.org/D90887
Kostya Kortchinsky [Wed, 2 Dec 2020 23:19:42 +0000 (15:19 -0800)]
[scudo][standalone] Add missing va_end() in ScopedString::append
In ScopedString::append va_list ArgsCopy is created but never cleanuped
which can lead to undefined behaviour, like stack corruption.
Reviewed By: cryptoad
Differential Revision: https://reviews.llvm.org/D92383
Yaxun (Sam) Liu [Wed, 2 Dec 2020 23:35:52 +0000 (18:35 -0500)]
Fix assertion in tryEmitAsConstant
due to
cd95338ee3022bffd658e52cd3eb9419b4c218ca
Need to check if result is LValue before getLValueBase.
Jonas Devlieghere [Thu, 3 Dec 2020 00:00:21 +0000 (16:00 -0800)]
[lldb] Return the original path when tilde expansion fails.
Differential revision: https://reviews.llvm.org/D92513
Nico Weber [Wed, 2 Dec 2020 23:57:46 +0000 (18:57 -0500)]
Revert "[mac/lld] Implement -why_load"
This reverts commit
542d3b609dbe99a30759942271398890fc7770dc.
Seems to break check-lld. Reverting while I take a look.
Duncan P. N. Exon Smith [Wed, 2 Dec 2020 19:43:15 +0000 (11:43 -0800)]
ADT: Rely on std::aligned_union_t for math in AlignedCharArrayUnion, NFC
Instead of computing the alignment and size of the `char` buffer in
`AlignedCharArrayUnion`, rely on the math in `std::aligned_union_t`.
Because some users of this rely on the `buffer` field existing with a
type convertible to `char *`, we can't change the field type, but we can
still avoid duplicating the logic.
A potential follow up would be to delete `AlignedCharArrayUnion` after
updating its users to use `std::aligned_union_t` directly; or if we like
our template parameters better, could update users to stop peeking
inside and then replace the definition with:
```
template <class T, class... Ts>
using AlignedCharArrayUnion = std::aligned_union_t<1, T, Ts...>;
```
Differential Revision: https://reviews.llvm.org/D92500
Mircea Trofin [Thu, 19 Nov 2020 15:43:56 +0000 (07:43 -0800)]
[NFC][MC] TargetRegisterInfo::getSubReg is a MCRegister.
Typing the API appropriately.
Differential Revision: https://reviews.llvm.org/D92341
Raphael Isemann [Wed, 2 Dec 2020 23:37:19 +0000 (00:37 +0100)]
[lldb] X-FAIL class template parameter pack tests on Windows
Both seem to fail to read values from the non-running target.
Nico Weber [Wed, 2 Dec 2020 18:17:55 +0000 (13:17 -0500)]
[mac/lld] Implement -why_load
This is useful for debugging why lld loads .o files it shouldn't load.
It's also useful for users of lld -- I've used ld64's version of this a
few times.
Differential Revision: https://reviews.llvm.org/D92496
Tim Keith [Wed, 2 Dec 2020 23:13:49 +0000 (15:13 -0800)]
[flang] Fix bugs related to merging generics during USE
When the same generic name is use-associated from two modules, the
generics are merged into a single one in the current scope. This change
fixes some bugs in that process.
When a generic is merged, it can have two specific procedures with the
same name as the generic (c.f. module m7c in modfile07.f90). We were
disallowing that by checking for duplicate names in the generic rather
than duplicate symbols. Changing `namesSeen` to `symbolsSeen` in
`ResolveSpecificsInGeneric` fixes that.
We weren't including each USE of those generics in the .mod file so in
some cases they were incorrect. Extend GenericDetails to specify all
use-associated symbols that are merged into the generic. This is used to
write out .mod files correctly.
The distinguishability check for specific procedures of a generic
sometimes have to refer to procedures from a use-associated generic in
error messages. In that case we don't have the source location of the
procedure so adapt the message to say where is was use-associated from.
This requires passing the scope through the checks to make that
determination.
Differential Revision: https://reviews.llvm.org/D92492
Raphael Isemann [Wed, 2 Dec 2020 23:08:19 +0000 (00:08 +0100)]
[lldb][NFC] Make DeclOrigin::Valid() const
Duncan P. N. Exon Smith [Wed, 2 Dec 2020 21:48:40 +0000 (13:48 -0800)]
ADT: Remove redundant `alignas` from IntervalMap, NFC
`AlignedArrayCharUnion` is now using `alignas`, which is properly
supported now by all the host toolchains we support. As a result, the
extra `alignas` on `IntervalMap` isn't needed anymore.
This is effectively a revert of
379daa29744cd96b0a87ed0d4a010fa4bc47ce73.
Differential Revision: https://reviews.llvm.org/D92509
Reid Kleckner [Wed, 2 Dec 2020 21:48:05 +0000 (13:48 -0800)]
Revert "Use std::is_trivially_copyable", breaks MSVC build
Revert "Delete llvm::is_trivially_copyable and CMake variable HAVE_STD_IS_TRIVIALLY_COPYABLE"
This reverts commit
4d4bd40b578d77b8c5bc349ded405fb58c333c78.
This reverts commit
557b00e0afb2dc1776f50948094ca8cc62d97be4.
Florian Hahn [Wed, 2 Dec 2020 22:22:17 +0000 (22:22 +0000)]
[ConstraintElimination] Make sure arguments of std:pow match.
This should fix a build failure on some systems, e.g. solaris11-sparcv9
http://lab.llvm.org:8014/#/builders/22
Harald van Dijk [Wed, 2 Dec 2020 22:20:36 +0000 (22:20 +0000)]
[X86] Add TLS_(base_)addrX32 for X32 mode
LLVM has TLS_(base_)addr32 for 32-bit TLS addresses in 32-bit mode, and
TLS_(base_)addr64 for 64-bit TLS addresses in 64-bit mode. x32 mode wants 32-bit
TLS addresses in 64-bit mode, which were not yet handled. This adds
TLS_(base_)addrX32 as copies of TLS_(base_)addr64, except that they use
tls32(base)addr rather than tls64(base)addr, and then restricts
TLS_(base_)addr64 to 64-bit LP64 mode, TLS_(base_)addrX32 to 64-bit ILP32 mode.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D92346
H.J. Lu [Tue, 3 Jun 2014 20:22:28 +0000 (13:22 -0700)]
Use PC-relative address for x32 TLS address
Since x32 supports PC-relative address, it shouldn't use EBX for TLS
address. Instead of checking N.getValueType(), we should check
Subtarget->is32Bit(). This fixes PR 22676.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D16474
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 20:10:10 +0000 (16:10 -0400)]
Module: Use FileEntryRef and DirectoryEntryRef in Umbrella, Header, and DirectoryName, NFC
Push `FileEntryRef` and `DirectoryEntryRef` further, using it them
`Module::Umbrella`, `Module::Header::Entry`, and
`Module::DirectoryName::Entry`.
- Add `DirectoryEntryRef::operator const DirectoryEntry *` and
`OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr`, to get the
same "degrades to `DirectoryEntry*` behaviour `FileEntryRef` enjoys
(this avoids a bunch of churn in various clang tools).
- Fix the `DirectoryEntryRef` constructor from `MapEntry` to take it by
`const&`.
Note that we cannot get rid of the `...AsWritten` names leveraging the
new classes, since these need to be as written in the `ModuleMap` file
and the module directory path is preprended for the lookup in the
`FileManager`.
Differential Revision: https://reviews.llvm.org/D90497
LLVM GN Syncbot [Wed, 2 Dec 2020 21:52:41 +0000 (21:52 +0000)]
[gn build] Port
24d4291ca70
Louis Dionne [Wed, 2 Dec 2020 21:35:08 +0000 (16:35 -0500)]
[libc++] Install missing packages to cross-compile to 32 bits during CI
Hongtao Yu [Wed, 2 Dec 2020 05:44:06 +0000 (21:44 -0800)]
[CSSPGO] Pseudo probes for function calls.
An indirect call site needs to be probed for its potential call targets. With CSSPGO a direct call also needs a probe so that a calling context can be represented by a stack of callsite probes. Unlike pseudo probes for basic blocks that are in form of standalone intrinsic call instructions, pseudo probes for callsites have to be attached to the call instruction, thus a separate instruction would not work.
One possible way of attaching a probe to a call instruction is to use a special metadata that carries information about the probe. The special metadata will have to make its way through the optimization pipeline down to object emission. This requires additional efforts to maintain the metadata in various places. Given that the `!dbg` metadata is a first-class metadata and has all essential support in place , leveraging the `!dbg` metadata as a channel to encode pseudo probe information is probably the easiest solution.
With the requirement of not inflating `!dbg` metadata that is allocated for almost every instruction, we found that the 32-bit DWARF discriminator field which mainly serves AutoFDO can be reused for pseudo probes. DWARF discriminators distinguish identical source locations between instructions and with pseudo probes such support is not required. In this change we are using the discriminator field to encode the ID and type of a callsite probe and the encoded value will be unpacked and consumed right before object emission. When a callsite is inlined, the callsite discriminator field will go with the inlined instructions. The `!dbg` metadata of an inlined instruction is in form of a scope stack. The top of the stack is the instruction's original `!dbg` metadata and the bottom of the stack is for the original callsite of the top-level inliner. Except for the top of the stack, all other elements of the stack actually refer to the nested inlined callsites whose discriminator field (which actually represents a calliste probe) can be used together to represent the inline context of an inlined PseudoProbeInst or CallInst.
To avoid collision with the baseline AutoFDO in various places that handles dwarf discriminators where a check against the `-pseudo-probe-for-profiling` switch is not available, a special encoding scheme is used to tell apart a pseudo probe discriminator from a regular discriminator. For the regular discriminator, if all lowest 3 bits are non-zero, it means the discriminator is basically empty and all higher 29 bits can be reversed for pseudo probe use.
Callsite pseudo probes are inserted in `SampleProfileProbePass` and a target-independent MIR pass `PseudoProbeInserter` is added to unpack the probe ID/type from `!dbg`.
Note that with this work the switch -debug-info-for-profiling will not work with -pseudo-probe-for-profiling anymore. They cannot be used at the same time.
Reviewed By: wmi
Differential Revision: https://reviews.llvm.org/D91756
Jianzhou Zhao [Wed, 2 Dec 2020 05:48:16 +0000 (05:48 +0000)]
[dfsan] Rename CachedCombinedShadow to be CachedShadow
At D92261, this type will be used to cache both combined shadow and
converted shadow values.
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D92458
Jianzhou Zhao [Wed, 2 Dec 2020 06:03:12 +0000 (06:03 +0000)]
[dfsan] Test loading global ptrs
This covers a branch in the loadShadow method.
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D92460
Yaxun (Sam) Liu [Wed, 25 Nov 2020 15:33:18 +0000 (10:33 -0500)]
[CUDA][HIP] Fix overloading resolution
This patch implements correct hostness based overloading resolution
in isBetterOverloadCandidate.
Based on hostness, if one candidate is emittable whereas the other
candidate is not emittable, the emittable candidate is better.
If both candidates are emittable, or neither is emittable based on hostness, then
other rules should be used to determine which is better. This is because
hostness based overloading resolution is mostly for determining
viability of a function. If two functions are both viable, other factors
should take precedence in preference.
If other rules cannot determine which is better, CUDA preference will be
used again to determine which is better.
However, correct hostness based overloading resolution
requires overloading resolution diagnostics to be deferred,
which is not on by default. The rationale is that deferring
overloading resolution diagnostics may hide overloading reslolutions
issues in header files.
An option -fgpu-exclude-wrong-side-overloads is added, which is off by
default.
When -fgpu-exclude-wrong-side-overloads is off, keep the original behavior,
that is, exclude wrong side overloads only if there are same side overloads.
This may result in incorrect overloading resolution when there are no
same side candates, but is sufficient for most CUDA/HIP applications.
When -fgpu-exclude-wrong-side-overloads is on, enable deferring
overloading resolution diagnostics and enable correct hostness
based overloading resolution, i.e., always exclude wrong side overloads.
Differential Revision: https://reviews.llvm.org/D80450
Jianzhou Zhao [Wed, 2 Dec 2020 06:08:59 +0000 (06:08 +0000)]
[dfsan] Add a test case for phi
Dan Albert [Tue, 17 Nov 2020 23:17:17 +0000 (15:17 -0800)]
Add a less ambiguous macro for Android version.
Android has a handful of API levels relevant to developers described
here: https://developer.android.com/studio/build#module-level.
`__ANDROID_API__` is too vague and confuses a lot of people. Introduce
a new macro name that is explicit about which one it represents. Keep
the old name around because code has been using it for a decade.
Jianzhou Zhao [Wed, 2 Dec 2020 05:44:03 +0000 (05:44 +0000)]
[dfsan] Add test cases for struct/pair
This is a child diff of D92261.
This locks down the behavior before the change.
Fangrui Song [Wed, 2 Dec 2020 21:13:58 +0000 (13:13 -0800)]
[ThinLTO][test] Fix X86/nossp.ll after D91816
Uday Bondhugula [Wed, 2 Dec 2020 20:42:01 +0000 (02:12 +0530)]
[MLIR][NFC] Fix mix up between dialect attribute values and names
Clear up documentation on dialect attribute values. Fix/improve
ModuleOp verifier error message on dialect prefixed attribute names.
Additional discussion is here:
https://llvm.discourse.group/t/moduleop-attributes/2325
Differential Revision: https://reviews.llvm.org/D92502
Richard Smith [Wed, 2 Dec 2020 19:36:11 +0000 (11:36 -0800)]
Update MS ABI mangling for union constants based on new information from
Jon Caves.
Pavel Iliin [Fri, 20 Nov 2020 15:02:57 +0000 (15:02 +0000)]
[AArch64] Compiler-rt interface for out-of-line atomics.
Out-of-line helper functions to support LSE deployment added.
This is a port of libgcc implementation:
https://gcc.gnu.org/git/?p=gcc.git;h=
33befddcb849235353dc263db1c7d07dc15c9faa
Differential Revision: https://reviews.llvm.org/D91156
jasonliu [Wed, 2 Dec 2020 18:46:58 +0000 (18:46 +0000)]
[XCOFF][AIX] Alternative path in EHStreamer for platforms do not have uleb128 support
Summary:
Not all system assembler supports `.uleb128 label2 - label1` form.
When the target do not support this form, we have to take
alternative manual calculation to get the offsets from them.
Reviewed By: hubert.reinterpretcast
Diffierential Revision: https://reviews.llvm.org/D92058