Zequan Wu [Mon, 30 Nov 2020 22:09:00 +0000 (14:09 -0800)]
[libcxx] remove checks for __STDCPP_THREADS__ as it is defined by compiler
Differential Revision: https://reviews.llvm.org/D92349
Reid Kleckner [Mon, 30 Nov 2020 23:43:48 +0000 (15:43 -0800)]
Fix GCC 5.3 compile error in ASTImporter code
Try to simplify this code a different way: use less Expected, more
outparams.
Nick Desaulniers [Tue, 1 Dec 2020 00:02:28 +0000 (16:02 -0800)]
[InlineCost] prefer range-for. NFC
Prefer range-for over iterators when such methods exist. Precommitted
from https://reviews.llvm.org/D91816.
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D92350
Leonard Chan [Tue, 14 Jul 2020 21:56:38 +0000 (14:56 -0700)]
[clang][RelativeVTablesABI] Use dso_local_equivalent rather than emitting stubs
Thanks to D77248, we can bypass the use of stubs altogether and use PLT
relocations if they are available for the target. LLVM and LLD support the
R_AARCH64_PLT32 relocation, so we can also guarantee a static PLT relocation on AArch64.
Not emitting these stubs saves a lot of extra binary size.
Differential Revision: https://reviews.llvm.org/D83812
Amy Huang [Mon, 30 Nov 2020 23:08:00 +0000 (15:08 -0800)]
[llvm-symbolizer] Fix typo in llvm-symbolizer test from a previous commit.
(Commit was
00bbef2bb20cf212722de282e4eb9afd09ab50db)
Duncan P. N. Exon Smith [Mon, 30 Nov 2020 22:12:28 +0000 (14:12 -0800)]
Remove dead code added in
ac49500cd0484e1b2dcf37fa4c0dade6f113c2c9, NFC
This was a copy/paste bug; `M0` is never referenced later.
Duncan P. N. Exon Smith [Thu, 29 Oct 2020 22:00:31 +0000 (18:00 -0400)]
FileManager: Add FileEntryRef::getDir, returning DirectoryEntryRef
Add `FileEntryRef::getDir`, which returns a `DirectoryEntryRef`. This
includes a few changes:
- Customize `OptionalStorage` so that `Optional<DirectoryEntryRef>` is
pointer-sized (like the change made to `Optional<FileEntryRef>`).
Factored out a common class, `FileMgr::MapEntryOptionalStorage`, to
reduce the code duplication.
- Store an `Optional<DirectoryEntryRef>` in `FileEntryRef::MapValue`.
This is set if and only if `MapValue` has a real `FileEntry`.
- Change `FileManager::getFileRef` and `getVirtualFileRef` to use
`getDirectoryRef` and store it in the `StringMap` for `FileEntryRef`.
Differential Revision: https://reviews.llvm.org/D90484
Jonas Devlieghere [Mon, 30 Nov 2020 22:41:33 +0000 (14:41 -0800)]
[lldb] Give TestDefaultTemplateArgs a unique class name
Multiple tests cannot share the same test class name.
Amy Huang [Wed, 25 Nov 2020 17:22:17 +0000 (09:22 -0800)]
[llvm-symbolizer] Fix native symbolization on windows for inline sites.
The existing code handles this correctly and I checked that the code
in NativeInlineSiteSymbol also handles this correctly, but it was
wrong in the NativeFunctionSymbol code.
Differential Revision: https://reviews.llvm.org/D92134
Joachim Protze [Mon, 30 Nov 2020 22:16:56 +0000 (23:16 +0100)]
[OpenMP][Tests][NFC] Use FileCheck from cmake config
Duncan P. N. Exon Smith [Thu, 22 Oct 2020 03:38:12 +0000 (23:38 -0400)]
Serialization: Change InputFile to use FileEntryRef and add getVirtualFileRef, NFC
Change the `InputFile` class to store `Optional<FileEntryRef>` instead
of `FileEntry*`. This paged in a few API changes:
- Added `FileManager::getVirtualFileRef`, and converted `getVirtualFile`
to a wrapper of it.
- Updated `SourceManager::bypassFileContentsOverride` to take
`FileEntryRef` and return `Optional<FileEntryRef>`
(`ASTReader::getInputFile` is the only caller).
Differential Revision: https://reviews.llvm.org/D90053
Todd Erdner [Mon, 30 Nov 2020 21:39:52 +0000 (00:39 +0300)]
[OpenMP] libomp: change shm name to include UID, call unregister_lib on SIGTERM
With the change to using shared memory, there were a few problems that need to be fixed.
- The previous filename that was used for SHM only used process id. Given that process is
usually based on 16bit number, this was causing some conflicts on machines. Thus we add
UID to the name to prevent this.
- It appears under some conditions (SIGTERM, etc) the shared memory files were not getting
cleaned up. Added a call to clean up the shm files under those conditions. For this user
needs to set envirable KMP_HANDLE_SIGNALS to true.
Patch by Erdner, Todd <todd.erdner@intel.com>
Differential Revision: https://reviews.llvm.org/D91869
AndreyChurbanov [Mon, 30 Nov 2020 21:13:31 +0000 (00:13 +0300)]
[OpenMP] libomp: fix mutexinoutset dependence for proxy tasks
Once __kmp_task_finish is not executed for proxy tasks,
move mutexinoutset dependency code to __kmp_release_deps
which is executed for all task kinds.
Differential Revision: https://reviews.llvm.org/D92326
Nico Weber [Mon, 23 Nov 2020 15:59:38 +0000 (10:59 -0500)]
[lld/mac] Don't warn on -bundle and -execute flags
They've been implemented since D87856 but since they still were
HelpHidden, the driver still warned claiming they were implemented.
Remove HelpHidden.
Use -fatal_warnings to test that the flags now don't warn. The
test depends on D91894 and D91891 to pass.
Differential Revision: https://reviews.llvm.org/D91971
Nico Weber [Fri, 20 Nov 2020 21:05:33 +0000 (16:05 -0500)]
[lld-macho] Don't warn on non-existent system libraries
Now, new mach-o lld no longer warns if the isysroot has just
usr/lib and System/Library/Frameworks but is missing usr/local/lib
and System/Frameworks.
This matches ld64 and old mach-o lld and fixes a regression from D85992.
It also fixes the only test failure in `check-lld` when running it
on an M1 Mac.
Differential Revision: https://reviews.llvm.org/D91891
Aaron En Ye Shi [Mon, 30 Nov 2020 20:53:17 +0000 (20:53 +0000)]
[HIP] Fix HIP test on windows due to lld suffix
On Windows, lld is instead named lld.exe, therefore
a few HIP tests are failing. Instead the wildcard should
be modified to .*lld.* to handle .exe. This fixes the
bug: https://bugs.llvm.org/show_bug.cgi?id=48289.
Differential Revision: https://reviews.llvm.org/D92342
Fangrui Song [Mon, 30 Nov 2020 20:44:35 +0000 (12:44 -0800)]
[CodeGen] -fno-delete-null-pointer-checks: change dereferenceable to dereferenceable_or_null
After D17993, with -fno-delete-null-pointer-checks we add the dereferenceable attribute to the `this` pointer.
We have observed that one internal target which worked before fails even with -fno-delete-null-pointer-checks.
Switching to dereferenceable_or_null fixes the problem.
dereferenceable currently does not always respect NullPointerIsValid and may
imply nonnull and lead to aggressive optimization. The optimization may be
related to `CallBase::isReturnNonNull`, `Argument::hasNonNullAttr`, or
`Value::getPointerDereferenceableBytes`. See D66664 and D66618 for some discussions.
Reviewed By: bkramer, rsmith
Differential Revision: https://reviews.llvm.org/D92297
Florian Hahn [Mon, 30 Nov 2020 16:47:28 +0000 (16:47 +0000)]
[ConstraintElimination] Expand GEP decomposition tests.
This adjusts the tests to cover more scenarios.
Paul Robinson [Mon, 30 Nov 2020 19:42:08 +0000 (11:42 -0800)]
[FastISel] NFC: Clean up unnecessary bookkeeping
Now that we flush the local value map for every instruction, we don't
need any extra flushes for specific cases. Also, LastFlushPoint is
not used for anything. Follow-ups to #dc35368 (D91734).
Differential Revision: https://reviews.llvm.org/D92338
Tom Stellard [Mon, 30 Nov 2020 20:25:43 +0000 (12:25 -0800)]
github actions: Use correct credentials for pushing
Yitzhak Mandelbaum [Mon, 30 Nov 2020 19:55:15 +0000 (19:55 +0000)]
[libTooling] Remove deprecated Clang Transformer declarations
A number of declarations were leftover after the move from `clang::tooling` to
`clang::transformer`. This patch removes those declarations and upgrades the
handful of references to the deprecated declarations.
Differential Revision: https://reviews.llvm.org/D92340
Eric Astor [Mon, 30 Nov 2020 19:35:46 +0000 (14:35 -0500)]
[ms] [llvm-ml] Test macro function invocations in arbitrary positions
Differential Revision: https://reviews.llvm.org/D89741
Matt Arsenault [Mon, 30 Nov 2020 19:59:21 +0000 (14:59 -0500)]
SplitKit: Use Register
Mircea Trofin [Mon, 16 Nov 2020 22:01:53 +0000 (14:01 -0800)]
[llvm][inliner] Reuse the inliner pass to implement 'always inliner'
Enable performing mandatory inlinings upfront, by reusing the same logic
as the full inliner, instead of the AlwaysInliner. This has the
following benefits:
- reduce code duplication - one inliner codebase
- open the opportunity to help the full inliner by performing additional
function passes after the mandatory inlinings, but before th full
inliner. Performing the mandatory inlinings first simplifies the problem
the full inliner needs to solve: less call sites, more contextualization, and,
depending on the additional function optimization passes run between the
2 inliners, higher accuracy of cost models / decision policies.
Note that this patch does not yet enable much in terms of post-always
inline function optimization.
Differential Revision: https://reviews.llvm.org/D91567
Nikita Popov [Mon, 30 Nov 2020 17:33:07 +0000 (18:33 +0100)]
[DL] Inline getAlignmentInfo() implementation (NFC)
Apart from getting the entry in the table (which is already a
separate function), the remaining logic is different for all
alignment types and is better combined with getAlignment().
This is a minor efficiency improvement, and should make further
improvements like using separate storage for different alignment
types simpler.
Nick Lewycky [Mon, 30 Nov 2020 19:34:12 +0000 (11:34 -0800)]
Creating a named struct requires only a Context and a name, but looking up a struct by name requires a Module. The method on Module merely accesses the LLVMContextImpl and no data from the module itself, so this patch moves getTypeByName to a static method on StructType that takes a Context and a name.
There's a small number of users of this function, they are all updated.
This updates the C API adding a new method LLVMGetTypeByName2 that takes a context and a name.
Differential Revision: https://reviews.llvm.org/D78793
Eric Astor [Mon, 30 Nov 2020 16:35:24 +0000 (11:35 -0500)]
[ms] [llvm-ml] Implement the statement expansion operator
If prefaced with a %, expand text macros and macro functions in any statement.
Also, prevent expanding text macros in the message of an ECHO directive unless expanded explicitly by the statement expansion operator.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D89740
Sanjay Patel [Mon, 30 Nov 2020 18:56:08 +0000 (13:56 -0500)]
[x86] add tests for maxnum/minnum with nnan; NFC
Sjoerd Meijer [Mon, 30 Nov 2020 17:37:41 +0000 (17:37 +0000)]
[AArch64] Enable Cortex-A55 schedmodel
The model was committed in
4b8ade837e36b7f0181ce86fc23f33851d0fdd35
but not yet enabled to allow for a few fix ups. This adds a few
of these fixes, and also a LLVM MCA test to check most instructions.
While I do have plans to look into some more tuning, it's time to
enable this as it better than using the A53 schedule.
Differential Revision: https://reviews.llvm.org/D88017
Hongtao Yu [Mon, 30 Nov 2020 19:18:34 +0000 (11:18 -0800)]
[CSSPGO] Disabling a pseudo probe test on non-x86 platforms.
Disabling a pseudo probe test on non-x86 platforms since it's not fully tested there.
Paul Robinson [Mon, 30 Nov 2020 18:24:08 +0000 (10:24 -0800)]
[FastISel] NFC: Remove obsolete -fast-isel-sink-local-values option
This option is not used for anything after #dc35368 (D91734).
Harald van Dijk [Mon, 30 Nov 2020 18:51:23 +0000 (18:51 +0000)]
[X86] Zero-extend pointers to i64 for x86_64
For LP64 mode, this has no effect as pointers are already 64 bits.
For ILP32 mode (x32), this extension is specified by the ABI.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D91338
Leonard Chan [Mon, 6 Apr 2020 23:08:58 +0000 (16:08 -0700)]
[libcxxabi] Add macro for changing functions to support the relative vtables ABI
Under the relative vtables ABI, __dynamic_cast will not work since it assumes
the vtable pointer is 2 ptrdiff_ts away from the start of the vtable (8-byte
offset to top + 8-byte pointer to typeinfo) when it is actually 8 bytes away
(4-byte offset to top + 4-byte offset to typeinfo). This adjusts the logic under
__dynamic_cast and other areas vtable calculations are done to support this ABI
when it's used.
Differential Revision: https://reviews.llvm.org/D77606
Simon Pilgrim [Mon, 30 Nov 2020 18:39:00 +0000 (18:39 +0000)]
[InstCombine][X86] Add basic addsub intrinsic SimplifyDemandedVectorElts support (PR46277)
Pass through the demanded elts mask to the source operands.
The next step will be to add support for folding to add/sub if we only demand odd/even elements.
LLVM GN Syncbot [Mon, 30 Nov 2020 18:20:24 +0000 (18:20 +0000)]
[gn build] Port
64fa8cce225
Hongtao Yu [Tue, 18 Aug 2020 23:28:47 +0000 (16:28 -0700)]
[CSSPGO] A Clang switch -fpseudo-probe-for-profiling for pseudo-probe instrumentation.
This change introduces a new clang switch `-fpseudo-probe-for-profiling` to enable AutoFDO with pseudo instrumentation. Please refer to https://reviews.llvm.org/D86193 for the whole story.
One implication from pseudo-probe instrumentation is that the profile is now sensitive to CFG changes. We perform the pseudo instrumentation very early in the pre-LTO pipeline, before any CFG transformation. This ensures that the CFG instrumented and annotated is stable and optimization-resilient.
The early instrumentation also allows the inliner to duplicate probes for inlined instances. When a probe along with the other instructions of a callee function are inlined into its caller function, the GUID of the callee function goes with the probe. This allows samples collected on inlined probes to be reported for the original callee function.
Reviewed By: wmi
Differential Revision: https://reviews.llvm.org/D86502
Hongtao Yu [Tue, 25 Aug 2020 00:52:47 +0000 (17:52 -0700)]
[CSSPGO] Pseudo probe instrumentation pass
This change introduces a pseudo probe instrumentation pass for block instrumentation. Please refer to https://reviews.llvm.org/D86193 for the whole story.
Given the following LLVM IR:
```
define internal void @foo2(i32 %x, void (i32)* %f) !dbg !4 {
bb0:
%cmp = icmp eq i32 %x, 0
br i1 %cmp, label %bb1, label %bb2
bb1:
br label %bb3
bb2:
br label %bb3
bb3:
ret void
}
```
The instrumented IR will look like below. Note that each llvm.pseudoprobe intrinsic call represents a pseudo probe at a block, of which the first parameter is the GUID of the probe’s owner function and the second parameter is the probe’s ID.
```
define internal void @foo2(i32 %x, void (i32)* %f) !dbg !4 {
bb0:
%cmp = icmp eq i32 %x, 0
call void @llvm.pseudoprobe(i64
837061429793323041, i64 1)
br i1 %cmp, label %bb1, label %bb2
bb1:
call void @llvm.pseudoprobe(i64
837061429793323041, i64 2)
br label %bb3
bb2:
call void @llvm.pseudoprobe(i64
837061429793323041, i64 3)
br label %bb3
bb3:
call void @llvm.pseudoprobe(i64
837061429793323041, i64 4)
ret void
}
```
Reviewed By: wmi
Differential Revision: https://reviews.llvm.org/D86499
Fangrui Song [Mon, 30 Nov 2020 18:16:19 +0000 (10:16 -0800)]
[PowerPC] Delete remnant Darwin code in PPCAsmParser
Continue the work started at D50989.
The code has been long dead since the triple has been removed (D75494).
Reviewed By: nickdesaulniers, void
Differential Revision: https://reviews.llvm.org/D91836
Simon Pilgrim [Mon, 30 Nov 2020 18:10:52 +0000 (18:10 +0000)]
[InstCombine][X86] Add addsub PR46277 test case
Also fix a copy+paste typo in the elts_addsub_v4f32 demanded elts test from the godbolt reference
Kazushi (Jam) Marukawa [Mon, 30 Nov 2020 17:53:28 +0000 (02:53 +0900)]
[VE][NFC] Update comments
Update comments. I forgot to update it previously when I modified code.
Francesco Petrogalli [Mon, 30 Nov 2020 17:30:11 +0000 (17:30 +0000)]
[SelectionDAGBuilder] Update signature of `getRegsAndSizes()`.
The mapping between registers and relative size has been updated to
use TypeSize to account for the size of scalable EVTs.
The patch is a NFCI, if not for the fact that with this change the
function `getUnderlyingArgRegs` does not raise a warning for implicit
conversion of `TypeSize` to `unsigned` when generating machine code
from the test added to the patch.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D92096
Kazushi (Jam) Marukawa [Mon, 23 Nov 2020 07:12:39 +0000 (16:12 +0900)]
[VE] Optimize prologue/epilogue instructions about GOT
Optimize prologue/epilogue instructions if a given function use GOT but
do not call other functions by eliminating FP. Previously, we had wrong
implementations taken from other architectures. Update regression tests
also.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92313
Kazushi (Jam) Marukawa [Sat, 28 Nov 2020 02:26:52 +0000 (11:26 +0900)]
[VE] Clean check routines of branch types
Previously, these check routines accepted non-generatble instructions.
This time, I clean them and add assert for those non-generatable
instructions.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92254
Zarko Todorovski [Mon, 30 Nov 2020 17:15:25 +0000 (12:15 -0500)]
Add -fintegrated-as to second invocation of clang in test case.
Balazs Benics [Mon, 30 Nov 2020 17:06:28 +0000 (18:06 +0100)]
[analyzer][StdLibraryFunctionsChecker] Fix typos in summaries of mmap and mmap64
The fd parameter of
```
void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)
```
should be constrained to the range [0, IntMax] as that is of type int.
Constraining to the range [0, Off_tMax] would result in a crash as that is
of a signed type with the value of 0xff..f (-1).
The crash would happen when we try to apply the arg constraints.
At line 583: assert(Min <= Max), as 0 <= -1 is not satisfied
The mmap64 is fixed for the same reason.
Reviewed By: martong, vsavchenko
Differential Revision: https://reviews.llvm.org/D92307
Kevin P. Neal [Mon, 30 Nov 2020 16:56:38 +0000 (11:56 -0500)]
[FPEnv] clang should get from the AST the metadata for constrained FP builtins
Currently clang is not correctly retrieving from the AST the metadata for
constrained FP builtins. This patch fixes that for the non-target specific
builtins.
Differential Revision: https://reviews.llvm.org/D92122
Gabor Marton [Wed, 25 Nov 2020 17:32:30 +0000 (18:32 +0100)]
[ASTImporter] Support import of CXXDeductionGuideDecl
CXXDeductionGuideDecl is a FunctionDecl, but its constructor should be called
appropriately, at least to set the kind variable properly.
Differential Revision: https://reviews.llvm.org/D92109
Praveen G [Mon, 30 Nov 2020 16:35:35 +0000 (11:35 -0500)]
[Flang][OpenMP] Add semantic checks for OpenMP Private clause.
Add the semantic checks for the OpenMP 4.5 - 2.15.3.3 Private clause.
1. Pointers with the INTENT(IN) attribute may not appear in a private clause.
2. Variables that appear in namelist statements may not appear in a private clause.
A flag 'InNamelist' is added to the Symbol::Flag to identify the symbols
in Namelist statemnts.
Test cases : omp-private01.f90, omp-private02.f90
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D90210
Vy Nguyen [Sun, 29 Nov 2020 02:09:21 +0000 (21:09 -0500)]
[sanitizer] Disable use_tls_dynamic on on-Android x86 Linux.
https://bugs.chromium.org/p/chromium/issues/detail?id=1153421
Differential Revision: https://reviews.llvm.org/D92273
Craig Topper [Mon, 30 Nov 2020 16:33:10 +0000 (08:33 -0800)]
[RISCV] Combine (GORCI (GORCI x, C2), C1) -> (GORCI x, C1|C2).
Unlike GREVI, GORCI stages can't be undone, but they are
redundant if done more than once.
Differential Revision: https://reviews.llvm.org/D92295
Sanjay Patel [Mon, 30 Nov 2020 16:25:07 +0000 (11:25 -0500)]
[IR][LoopRotate] remove assertion that phi must have at least one operand
This was suggested in D92247 - I initially committed an alternate
fix (
bfd2c216ea ) to avoid the crash/assert shown in
https://llvm.org/PR48296 ,
but that was reverted because it caused msan failures on other
tests. We can try to revive that patch using the test included
here, but I do not have an immediate plan to isolate that problem.
Craig Topper [Mon, 30 Nov 2020 16:14:30 +0000 (08:14 -0800)]
[RISCV] Custom legalize bswap/bitreverse to GREVI with Zbp extension to enable them to combine with other GREVI instructions
This enables bswap/bitreverse to combine with other GREVI patterns or each other without needing to add more special cases to the DAG combine or new DAG combines.
I've also enabled the existing GREVI combine for GREVIW so that it can pick up the i32 bswap/bitreverse on RV64 after they've been type legalized to GREVIW.
Differential Revision: https://reviews.llvm.org/D92253
Fangrui Song [Mon, 30 Nov 2020 16:30:19 +0000 (08:30 -0800)]
[ELF] Don't relax R_X86_64_GOTPCRELX if addend != -4
clang may produce `movl x@GOTPCREL+4(%rip), %eax` when loading the high 32 bits
of the address of a global variable in -fpic/-fpie mode.
If assembled by GNU as, the fixup emits an R_X86_64_GOTPCRELX with an
addend != -4. The instruction loads from the GOT entry with an offset
and thus it is incorrect to relax the instruction.
If assembled by the integrated assembler, we emit R_X86_64_GOTPCREL for
relocations that definitely cannot be relaxed (D92114), so this patch is not
needed.
This patch disables the relaxation, which is compatible with the implementation in GNU ld
("Add R_X86_64_[REX_]GOTPCRELX support to gas and ld").
Reviewed By: grimar, jhenderson
Differential Revision: https://reviews.llvm.org/D91993
Fangrui Song [Mon, 30 Nov 2020 16:27:30 +0000 (08:27 -0800)]
[X86] Don't emit R_X86_64_[REX_]GOTPCRELX for a GOT load with an offset
clang may produce `movl x@GOTPCREL+4(%rip), %eax` when loading the high
32 bits of the address of a global variable in -fpic/-fpie mode.
If assembled by GNU as, the fixup emits R_X86_64_GOTPCRELX with an addend != -4.
The instruction loads from the GOT entry with an offset and thus it is incorrect
to relax the instruction.
This patch does not emit a relaxable relocation for a GOT load with an offset
because R_X86_64_[REX_]GOTPCRELX do not make sense for instructions which cannot
be relaxed. The result is good enough for LLD to work. GNU ld relaxes
mov+GOTPCREL as well, but it suppresses the relaxation if addend != -4.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D92114
Craig Topper [Mon, 30 Nov 2020 15:06:32 +0000 (07:06 -0800)]
[RISCV] Only combine (or (GREVI x, shamt), x) -> GORCI if shamt is a power of 2.
GORCI performs an OR between each stage. So we need to ensure only
one stage is active before doing this combine.
Initial attempts at finding a test case for this failed due to
the order things get combined. It's most likely that we'll form
one stage of GREVI then combine to GORCI before the two stages of
GREVI are able to be formed and combined with each other to form
a multi stage GREVI.
Differential Revision: https://reviews.llvm.org/D92289
Florian Hahn [Mon, 30 Nov 2020 15:47:43 +0000 (15:47 +0000)]
[ConstraintElimination] Add additional GEP decomposition tests.
Simon Pilgrim [Mon, 30 Nov 2020 15:59:46 +0000 (15:59 +0000)]
[X86] Add vbmi2 test coverage for vector rotations
We should be using the funnel shift instructions for vXi16 types.
Sanjay Patel [Mon, 30 Nov 2020 15:49:40 +0000 (10:49 -0500)]
[IR] improve code comment/logic in removePredecessor(); NFC
This was suggested in the post-commit review of
ce134da4b1.
Raphael Isemann [Mon, 30 Nov 2020 15:14:30 +0000 (16:14 +0100)]
[lldb] Always include template arguments that have their default value in the internal type name
Our type formatters/summaries match on the internal type name we generate in LLDB for Clang types.
These names were generated using Clang's default printing policy. However Clang's
default printing policy got tweaked over the last month to make the generated type
names more readable (by for example excluding inline/anonymous namespaces and
removing template arguments that have their default value). This broke the formatter
system where LLDB's matching logic now no longer can format certain types as
the new type names generated by Clang's default printing policy no longer match
the type names that LLDB/the user specified.
I already introduced LLDB's own type printing policy and fixed the inline/anonymous
namespaces in
da121fff1184267a405f81a87f7314df2d474e1c (just to get the
test suite passing again).
This patch is restoring the old type printing behaviour where always include the template
arguments in the internal type name (even if they match the default args). This should get
template type formatters/summaries working again in the rare situation where we do
know template default arguments within LLDB. This can only happen when either having
a template that was parsed in the expression parser or when we get type information from a C++ module.
The Clang change that removed defaulted template arguments from Clang's printing policy was
e7f3e2103cdb567dda4fd52f81bf4bc07179f5a8
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D92311
Sanjay Patel [Mon, 30 Nov 2020 15:13:38 +0000 (10:13 -0500)]
Revert "[IR][LoopRotate] avoid leaving phi with no operands (PR48296)"
This reverts commit
bfd2c216ea8ef09f8fb1f755ca2b89f86f74acbb.
This appears to be causing stage2 msan failures on buildbots:
FAIL: LLVM :: Transforms/SimplifyCFG/X86/bug-25299.ll (65872 of 71835)
******************** TEST 'LLVM :: Transforms/SimplifyCFG/X86/bug-25299.ll' FAILED ********************
Script:
--
: 'RUN: at line 1'; /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/opt < /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SimplifyCFG/X86/bug-25299.ll -simplifycfg -S | /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SimplifyCFG/X86/bug-25299.ll
--
Exit Code: 2
Command Output (stderr):
--
==87374==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x9de47b6 in getBasicBlockIndex /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/IR/Instructions.h:2749:5
#1 0x9de47b6 in simplifyCommonResume /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:4112:23
#2 0x9de47b6 in simplifyResume /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:4039:12
#3 0x9de47b6 in (anonymous namespace)::SimplifyCFGOpt::simplifyOnce(llvm::BasicBlock*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6330:16
#4 0x9dcca13 in run /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6358:16
#5 0x9dcca13 in llvm::simplifyCFG(llvm::BasicBlock*, llvm::TargetTransformInfo const&, llvm::SimplifyCFGOptions const&, llvm::SmallPtrSetImpl<llvm::BasicBlock*>*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6369:8
#6 0x974643d in iterativelySimplifyCFG(
Nicolas Vasilache [Mon, 30 Nov 2020 15:11:34 +0000 (15:11 +0000)]
[mlir] Make mlir-cpu-runner depend on native instead of X86
Ben Dunbobbin [Mon, 30 Nov 2020 11:50:45 +0000 (11:50 +0000)]
[windows-itanium] handle dllimport/export code paths separately and share with PS4
Similar to Windows Itanium, PS4 is also an Itanium C++ ABI variant
which shares the goal of semantic compatibility with Microsoft C++
code that uses dllimport/export.
This change introduces a new function to determine from the triple
if an environment aims for compatibility with MS C++ code w.r.t to
these attributes and guards the relevant code paths using that
function.
Differential Revision: https://reviews.llvm.org/D90299
Nico Weber [Fri, 20 Nov 2020 21:44:55 +0000 (16:44 -0500)]
[lld-macho] Implement -fatal_warnings
Differential Revision: https://reviews.llvm.org/D91894
Sanjay Patel [Mon, 30 Nov 2020 13:59:40 +0000 (08:59 -0500)]
[IR][LoopRotate] avoid leaving phi with no operands (PR48296)
https://llvm.org/PR48296 shows an example where we delete all of the operands
of a phi without actually deleting the phi, and that is currently considered
invalid IR. The reduced test included here would crash for that reason.
A suggested follow-up is to loosen the assert to allow 0-operand phis
in unreachable blocks.
Differential Revision: https://reviews.llvm.org/D92247
Dmitri Gribenko [Mon, 30 Nov 2020 14:19:27 +0000 (15:19 +0100)]
Add 'asserts' requiremnt to test/CodeGen/ARM/cortex-a57-misched-mla.mir
'-debug-only=machine-scheduler' only works when asserts are enabled.
Pedro Tammela [Sun, 15 Nov 2020 19:39:16 +0000 (19:39 +0000)]
[LLDB/Lua] add support for one-liner breakpoint callback
These callbacks are set using the following:
breakpoint command add -s lua -o "print('hello world!')"
The user supplied script is executed as:
function (frame, bp_loc, ...)
<body>
end
So the local variables 'frame', 'bp_loc' and vararg are all accessible.
Any global variables declared will persist in the Lua interpreter.
A user should never hold 'frame' and 'bp_loc' in a global variable as
these userdatas are context dependent.
Differential Revision: https://reviews.llvm.org/D91508
Juneyoung Lee [Mon, 30 Nov 2020 14:09:36 +0000 (23:09 +0900)]
[LangRef] missing link, minor fix
Juneyoung Lee [Mon, 30 Nov 2020 13:48:43 +0000 (22:48 +0900)]
[ConstantFold] Don't fold and/or i1 poison to poison (NFC)
.. because it causes miscompilation when combined with select i1 -> and/or.
It is the select fold which is incorrect; but it is costly to disable the fold, so hack this one.
D92270
David Spickett [Mon, 30 Nov 2020 13:46:16 +0000 (13:46 +0000)]
[llvm-objdump] Require x86 target for mcpu/attr test
This fixes test failure on clang-cmake-armv7-quick bot
with change
c2ead57ccf74900901fdda1cd0fbe9a7a0d1297a.
This bot only builds Arm/AArch64 targets.
Simon Pilgrim [Mon, 30 Nov 2020 13:37:04 +0000 (13:37 +0000)]
[InstCombine][X86] Add addsub tests showing failure to simplify demandedelts (PR46277)
Nico Weber [Sun, 29 Nov 2020 03:38:27 +0000 (22:38 -0500)]
[lld/mac] Add --reproduce option
This adds support for ld.lld's --reproduce / lld-link's /reproduce:
flag to the MachO port. This flag can be added to a link command
to make the link write a tar file containing all inputs to the link
and a response file containing the link command. This can be used
to reproduce the link on another machine, which is useful for sharing
bug report inputs or performance test loads.
Since the linker is usually called through the clang driver and
adding linker flags can be a bit cumbersome, setting the env var
`LLD_REPRODUCE=foo.tar` triggers the feature as well.
The file response.txt in the archive can be used with
`ld64.lld.darwinnew $(cat response.txt)` as long as the contents are
smaller than the command-line limit, or with `ld64.lld.darwinnew
@response.txt` once D92149 is in.
The support in this patch is sufficient to create a tar file for
Chromium's base_unittests that can link after unpacking on a different
machine.
Differential Revision: https://reviews.llvm.org/D92274
Hans Wennborg [Mon, 30 Nov 2020 13:30:44 +0000 (14:30 +0100)]
Try harder to get rid off cortex-a57-misched-mla.s
Nico Weber [Thu, 26 Nov 2020 02:48:27 +0000 (21:48 -0500)]
[mac/lld] Add support for response files
ld64 learned about them in Xcode 12, so we should too.
Differential Revision: https://reviews.llvm.org/D92149
Kazushi (Jam) Marukawa [Thu, 26 Nov 2020 13:37:34 +0000 (22:37 +0900)]
[VE] Optimize prologue/epilogue instructions
Optimize eliminate FP mechanism. This time optimize a function which has
no call but fixed stack objects. LLVM eliminates FP on such functions now.
Also, optimize GOT/PLT registers save/restore instructions if a given
function doesn't uses them. In addition, remove generating mechanism of
`.cfi` instructions since those are taken from other architectures and not
inspected yet. Update regression tests, also.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92251
Hans Wennborg [Mon, 30 Nov 2020 13:15:41 +0000 (14:15 +0100)]
Try to fix bots after 112b3cb by removing cortex-a57-misched-mla.s
Kazushi (Jam) Marukawa [Fri, 27 Nov 2020 14:02:29 +0000 (23:02 +0900)]
[VE] Change the behaviour of truncate
Change the way to truncate i64 to i32 in I64 registers. VE assumed
sext values previously. Change it to zext values this time to make
it match to the LLVM behaviour.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92226
Florian Hahn [Sat, 28 Nov 2020 13:33:38 +0000 (13:33 +0000)]
[VPlan] Use VPUser to manage VPPredInstPHIRecipe operand (NFC).
VPPredInstPHIRecipe is one of the recipes that was missed during the
initial conversion. This patch adjusts the recipe to also manage its
operand using VPUser.
Kazushi (Jam) Marukawa [Sat, 28 Nov 2020 02:58:44 +0000 (11:58 +0900)]
[VE] Specify vector alignments
Specify alignments for all vector types. Update a regression test also.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92256
David Spickett [Mon, 30 Nov 2020 10:39:07 +0000 (10:39 +0000)]
[llvm-objdump] Document --mattr=help in --help output
This does the same as `--mcpu=help` but was only
documented in the user guide.
* Added a test for both options.
* Corrected the single dash in `-mcpu=help` text.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D92305
Hans Wennborg [Mon, 30 Nov 2020 12:36:36 +0000 (13:36 +0100)]
[gn build] Manually sync 8da7efb and cac5be4
This adds the clang-tidy concurrency module to the gn build.
Muhammad Omair Javaid [Thu, 26 Nov 2020 07:55:29 +0000 (12:55 +0500)]
Send SVE vg register in custom expedited registerset
This patch ovverides GetExpeditedRegisterSet for
NativeRegisterContextLinux_arm64 to send vector granule register in
expedited register set if SVE mode is selected.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D82855
Muhammad Omair Javaid [Thu, 26 Nov 2020 07:55:28 +0000 (12:55 +0500)]
Support custom expedited register set in gdb-remote
This patch adds capability to introduce a custom expedited register set
in gdb remote. Currently we send register set 0 as expedited register set
but for the case of AArch64 SVE we intend to send additional information
about SVE registers size/offset configuration which can be calculated
from vg register. Therefore we will expedited Vg register in case of
AArch64 is in SVE mode to speedup register configuration calculations.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D82853
Sjoerd Meijer [Mon, 30 Nov 2020 11:16:10 +0000 (11:16 +0000)]
[AArch64][CostModel] Fix cost for mul <2 x i64>
This was modeled to have a cost of 1, but since we do not have a MUL.2d this is
scalarized into vector inserts/extracts and scalar muls.
Motivating precommitted test is test/Transforms/SLPVectorizer/AArch64/mul.ll,
which we don't want to SLP vectorize.
Test Transforms/LoopVectorize/AArch64/extractvalue-no-scalarization-required.ll
unfortunately needed changing, but the reason is documented in
LoopVectorize.cpp:6855:
// The cost of executing VF copies of the scalar instruction. This opcode
// is unknown. Assume that it is the same as 'mul'.
which I will address next as a follow up of this.
Differential Revision: https://reviews.llvm.org/D92208
David Spickett [Tue, 24 Nov 2020 14:01:29 +0000 (14:01 +0000)]
[lldb] Use llvm::Optional for port in LaunchGDBServer
Previously we used UINT16_MAX to mean no port/no specifc
port. This leads to confusion because 65535 is a valid
port number.
Instead use an optional. If you want a specific port call
LaunchGDBServer as normal, otherwise pass an empty optional
and it will be set to the port that gets chosen.
(or left empty in the case where we fail to find a port)
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D92035
Simon Pilgrim [Mon, 30 Nov 2020 10:38:25 +0000 (10:38 +0000)]
[X86][AVX512] Only lower to VPALIGNR if we have BWI (PR48322)
Christian Sigg [Mon, 30 Nov 2020 10:32:53 +0000 (11:32 +0100)]
Add `using ConvertToLLVMPattern::match/matchAndRewrite` to avoid 'hiding overload' warning.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D92303
Jay Foad [Fri, 27 Nov 2020 17:34:35 +0000 (17:34 +0000)]
[LegacyPM] Simplify PMTopLevelManager::collectLastUses. NFC.
Roman Lebedev [Mon, 30 Nov 2020 10:33:42 +0000 (13:33 +0300)]
[NFC][clang-tidy] Do link FrontendOpenMP into concurrency module after all
It seems that while clangASTMatchers does add FrontendOpenMP into
it's LLVM_LINK_COMPONENTS, it's still not being propagated transitively.
David Spickett [Tue, 17 Nov 2020 15:41:04 +0000 (15:41 +0000)]
[lldb] Error when there are no ports to launch a gdbserver on
Previously if you did:
$ lldb-server platform --server <...> --min-gdbserver-port 12346
--max-gdbserver-port 12347
(meaning only use port 12346 for gdbservers)
Then tried to launch two gdbservers on the same connection,
the second one would return port 65535. Which is a real port
number but it actually means lldb-server didn't find one it was
allowed to use.
send packet: $qLaunchGDBServer;<...>
read packet: $pid:1919;port:12346;#c0
<...>
send packet: $qLaunchGDBServer;<...>
read packet: $pid:1927;port:65535;#c7
This situation should be an error even if port 65535 does happen
to be available on the current machine.
To fix this make PortMap it's own class within
GDBRemoteCommunicationServerPlatform.
This almost the same as the old typedef but for
GetNextAvailablePort() returning an llvm::Expected.
This means we have to handle not finding a port,
by returning an error packet.
Also add unit tests for this new PortMap class.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D91634
David Spickett [Thu, 19 Nov 2020 16:06:02 +0000 (16:06 +0000)]
[clang-format] State where clang-format-diff.py should be run from
At least with git, file paths in a diff will be relative
to the repo root. So if you are in "llvm-project/lldb"
and the diff shows "clang/foo" modified you get:
No such file or directory
From clang-format-diff.py, since clang-format was
asked to read:
llvm-project/lldb/clang/foo
Add a note to the docs to explain this.
(there is `git diff --relative` but that excludes
changes outside of the current dir)
Reviewed By: sylvestre.ledru
Differential Revision: https://reviews.llvm.org/D91799
Evgeny Leviant [Mon, 30 Nov 2020 09:35:28 +0000 (12:35 +0300)]
Fix test case
Vasily Kulikov [Mon, 30 Nov 2020 09:20:08 +0000 (12:20 +0300)]
[clang-tidy] implement concurrency-mt-unsafe
Checks for some thread-unsafe functions against a black list
of known-to-be-unsafe functions. Usually they access static variables
without synchronization (e.g. gmtime(3)) or utilize signals
in a racy way (e.g. sleep(3)).
The patch adds a check instead of auto-fix as thread-safe alternatives
usually have API with an additional argument
(e.g. gmtime(3) v.s. gmtime_r(3)) or have a different semantics
(e.g. exit(3) v.s. __exit(3)), so it is a rather tricky
or non-expected fix.
An option specifies which functions in libc should be considered
thread-safe, possible values are `posix`, `glibc`,
or `any` (the most strict check). It defaults to 'any' as it is
unknown what target libc type is - clang-tidy may be run
on linux but check sources compiled for other *NIX.
The check is used in Yandex Taxi backend and has caught
many unpleasant bugs. A similar patch for coroutine-unsafe API
is coming next.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D90944
Vasily Kulikov [Mon, 30 Nov 2020 09:15:01 +0000 (12:15 +0300)]
[clang-tidy] add concurrency module
The module will contain checks related to concurrent programming (including threads, fibers, coroutines, etc.).
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D91656
Roman Lebedev [Fri, 27 Nov 2020 13:59:46 +0000 (16:59 +0300)]
[NFC][SimplifyCFG] Add STATISTIC() to the FoldValueComparisonIntoPredecessors() fold
David Green [Mon, 30 Nov 2020 09:18:25 +0000 (09:18 +0000)]
[ARM] Constant predicate tests. NFC
Evgeny Leviant [Mon, 30 Nov 2020 08:55:55 +0000 (11:55 +0300)]
[TableGen][SchedModels] Fix read/write variant substitution
Patch fixes multiple issues related to expansion of variant sched reads and
writes.
Differential revision: https://reviews.llvm.org/D90844
Nicolas Vasilache [Fri, 27 Nov 2020 22:02:23 +0000 (22:02 +0000)]
[mlir][LLVMIR] Add support for InlineAsmOp
The InlineAsmOp mirrors the underlying LLVM semantics with a notable
exception: the embedded `asm_string` is not allowed to define or reference
any symbol or any global variable: only the operands of the op may be read,
written, or referenced.
Attempting to define or reference any symbol or any global behavior is
considered undefined behavior at this time.
The asm dialect syntax is currently specified with an integer (0 [default] for the "att dialect", 1 for the intel dialect) to circumvent the ODS limitation on string enums.
Translation to LLVM is provided and raises the fact that the asm constraints string must be well-formed with respect to in/out operands. No check is performed on the asm_string.
An InlineAsm instruction in LLVM is a special call operation to a function that is constructed on the fly.
It does not fit the current model of MLIR calls with symbols.
As a consequence, the current implementation constructs the function type in ModuleTranslation.cpp.
This should be refactored in the future.
The mlir-cpu-runner is augmented with the global initialization of the X86 asm parser to allow proper execution in JIT mode. Previously, only the X86 asm printer was initialized.
Differential revision: https://reviews.llvm.org/D92166
Haojian Wu [Mon, 30 Nov 2020 08:25:51 +0000 (09:25 +0100)]
[AST][RecoveryAST] Preseve more invalid return stmt.
suppress the diagnostics for missing return stmt in constexpr func.
Differential Revision: https://reviews.llvm.org/D82284
Guillaume Chatelet [Mon, 23 Nov 2020 17:30:39 +0000 (17:30 +0000)]
[libc] Improve memcpy copy loop
Rewriting loop so the terminating condition does not depend on the loop body
Differential Revision: https://reviews.llvm.org/D91976
Haojian Wu [Mon, 30 Nov 2020 08:18:42 +0000 (09:18 +0100)]
[clang] Improve diagnostics for auto-return-type function if the return expr had an error.
Given the following case:
```
auto k() {
return undef();
return 1;
}
```
Prior to the patch, clang emits an `cannot initialize return object of type
'auto' with an rvalue of type 'int'` diagnostic on the second return
(because the return type of the function cannot be deduced from the first contain-errors return).
This patch suppresses this error.
Differential Revision: https://reviews.llvm.org/D92211