Pavel Labath [Wed, 7 Oct 2020 14:36:32 +0000 (16:36 +0200)]
[lldb] Add a cmake warning about the python/swig incompatibility
Raise awareness of the fact that some versions of swig and python (and
build types) just don't mix.
One day this will be a reason to require swig>=4.0, but this version is
too hot off the press right now..
Differential Revision: https://reviews.llvm.org/D88967
Petr Hosek [Thu, 8 Oct 2020 16:12:57 +0000 (09:12 -0700)]
[libcxx] Fix the thousands_sep test failure
This fixes the issue introduced in
80ef4126b.
Joseph Huber [Wed, 7 Oct 2020 20:40:47 +0000 (16:40 -0400)]
[OpenMP] Change CMake Configuration to Build for Highest CUDA Architecture by Default
Summary:
This patch changes the CMake files for Clang and Libomptarget to query the
system for its supported CUDA architecture. This makes it much easier for the
user to build optimal code without needing to set the flags manually. This
relies on the now deprecated FindCUDA method in CMake, but full support for
architecture detection is only availible in CMake >3.18
Reviewers: jdoerfert ye-luo
Subscribers: cfe-commits guansong mgorny openmp-commits sstefan1 yaxunl
Tags: #clang #OpenMP
Differential Revision: https://reviews.llvm.org/D87946
Alexandre Ganea [Thu, 8 Oct 2020 15:46:04 +0000 (11:46 -0400)]
[LLDB] On Windows, fix tests
This patch fixes a few issues seen when running `ninja check-lldb` in a Release build with VS2017:
- Some binaries couldn't be found (such as lldb-vscode.exe), because .exe wasn't appended to the file name.
- Many tests used to fail since our installed locale is in French - the OS error messages are not emitted in English.
- Our codepage being Windows-1252, python failed to decode some error messages with accentuations.
Differential Revision: https://reviews.llvm.org/D88975
Geoff Levner [Thu, 8 Oct 2020 14:59:30 +0000 (10:59 -0400)]
DeferredDiagnosticsEmitter crashes
Patch VisitCXXDeleteExpr() in clang::UsedDeclVisitor to avoid it crashing
when the expression's destroyed type is null. According to the comments
in CXXDeleteExpr::getDestroyedType(), this can happen when the type to
delete is a dependent type.
Patch by Geoff Levner.
Differential Revision: https://reviews.llvm.org/D88949
Fangrui Song [Wed, 7 Oct 2020 15:45:24 +0000 (08:45 -0700)]
[ELF] Don't change binding to STB_WEAK for an undefined specified by -u
Similar to D66992.
In GNU ld, a -u specified symbol is a STB_DEFAULT undefined.
It cannot be changed to STB_WEAK by a later STB_WEAK undefined in a regular object file.
The behavior is consistent with our model because -u means "we need to fetch a lazy definition".
It should not be altered just because there is also a STB_WEAK undefined.
Note, our -u semantics are still different from GNU ld (https://github.com/ClangBuiltLinux/linux/issues/515):
we don't force the specified symbol to appear in .symtab This is a deliberate decision.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D88945
Sanjay Patel [Thu, 8 Oct 2020 14:45:42 +0000 (10:45 -0400)]
[InstCombine] allow vector splats for add+xor with signmask
Sanjay Patel [Thu, 8 Oct 2020 13:35:25 +0000 (09:35 -0400)]
[InstCombine] add vector splat tests for add of signmask; NFC
Jay Foad [Tue, 6 Oct 2020 08:03:53 +0000 (09:03 +0100)]
[AMDGPU] Add patterns for mad/mac legacy f32 instructions
Note that all subtargets up to GFX10.1 have v_mad_legacy_f32, but GFX8/9
lack v_mac_legacy_f32. GFX10.3 has no mad/mac f32 instructions at all.
Differential Revision: https://reviews.llvm.org/D88890
Nico Weber [Thu, 8 Oct 2020 14:13:54 +0000 (10:13 -0400)]
[gn build] (manually) port
9b58b0c06e6 better
Nico Weber [Thu, 8 Oct 2020 14:08:38 +0000 (10:08 -0400)]
[gn build] (manually) port
9b58b0c06e6
Michał Górny [Thu, 10 Sep 2020 06:24:15 +0000 (08:24 +0200)]
[lldb] Initial version of FreeBSD remote process plugin
Add a new FreeBSD Process plugin using client/server model. This plugin
is based on the one used by NetBSD. It currently supports a subset
of functionality for amd64. It is automatically used when spawning
lldb-server. It can also be used by lldb client by setting
FREEBSD_REMOTE_PLUGIN environment variable (to any value).
The code is capable of debugging simple single-threaded programs. It
supports general purpose, debug and FPU registers (up to XMM) of amd64,
basic signalling, software breakpoints.
Adding the support for the plugin involves removing some dead code
from FreeBSDPlatform plugin (that was not ever used because
CanDebugProcess() returned false), and replacing it with appropriate
code from NetBSD platform support.
Differential Revision: https://reviews.llvm.org/D88796
Jakub Lichman [Thu, 8 Oct 2020 13:28:55 +0000 (13:28 +0000)]
[mlir] Rank reducing subview conversion to LLVM
This commit adjusts SubViewOp lowering to take rank reduction into account.
Differential Revision: https://reviews.llvm.org/D88883
diggerlin [Thu, 8 Oct 2020 13:34:58 +0000 (09:34 -0400)]
[AIX] add new option -mignore-xcoff-visibility
SUMMARY:
In IBM compiler xlclang , there is an option -fnovisibility which suppresses visibility. For more details see: https://www.ibm.com/support/knowledgecenter/SSGH3R_16.1.0/com.ibm.xlcpp161.aix.doc/compiler_ref/opt_visibility.html.
We need to add the option -mignore-xcoff-visibility for compatibility with the IBM AIX OS (as the option is enabled by default in AIX). With this option llvm does not emit any visibility attribute to ASM or XCOFF object file.
The option only work on the AIX OS, for other non-AIX OS using the option will report an unsupported options error.
In AIX OS:
1.1 the option -mignore-xcoff-visibility is enabled by default , if there is not -fvisibility=* and -mignore-xcoff-visibility explicitly in the clang command .
1.2 if there is -fvisibility=* explicitly but not -mignore-xcoff-visibility explicitly in the clang command. it will generate visibility attributes.
1.3 if there are both -fvisibility=* and -mignore-xcoff-visibility explicitly in the clang command. The option "-mignore-xcoff-visibility" wins , it do not emit the visibility attribute.
The option -mignore-xcoff-visibility has no effect on visibility attribute when compile with -emit-llvm option to generated LLVM IR.
Reviewer: daltenty,Jason Liu
Differential Revision: https://reviews.llvm.org/D87451
Utkarsh Saxena [Thu, 8 Oct 2020 11:13:40 +0000 (13:13 +0200)]
[clangd] New CC Ranking Model to fix bad inference due to overflow.
Unreachable file distances are represented as
`std::numeric_limits<unsigned>::max()`.
The previous dataset recorded the signals as `signed int` capturing this default
value as `-1`.
A new dataset was regenerated and a new model is trained that
interprets this unreachable as the intended value.
Distribution of `SymbolScopeDistance`:
Value Normalised Frequency
0 46.6184
4294967295 29.5342
6 14.5666
4 6.4433
2 1.4534
8 0.5760
10 0.3581
....
Distribution of `FileProximityDistance`:
Value Normalised Frequency
4294967295 39.9378
12 5.1997
14 4.9828
15 4.4221
16 4.3820
13 4.2765
17 3.8957
11 3.6387
19 3.4799
18 3.4076
....
Differential Revision: https://reviews.llvm.org/D89035
Georgii Rymar [Wed, 30 Sep 2020 12:12:41 +0000 (15:12 +0300)]
[llvm-readobj] - Fix possible crashes related to dumping gnu hash symbols.
It fixes possible scenarios when we crash/assert with `--hash-symbols` when
dumping an invalid GNU hash table which has a broken value in the buckets array.
This fixes a crash reported in comments for
https://bugs.llvm.org/show_bug.cgi?id=47681
Differential revision: https://reviews.llvm.org/D88561
Nicolas Vasilache [Thu, 8 Oct 2020 12:47:41 +0000 (12:47 +0000)]
[mlir][Linalg] Add TensorsToBuffers support for Constant ops.
This revision also inserts an end-to-end test that lowers tensors to buffers all the way to executable code on CPU.
Differential revision: https://reviews.llvm.org/D88998
Konrad Dobros [Thu, 1 Oct 2020 00:28:13 +0000 (02:28 +0200)]
[mlir][spirv] Add OpenCL extended ops: exp, fabs, s_abs
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D88966
Sebastian Neubauer [Wed, 7 Oct 2020 12:47:36 +0000 (14:47 +0200)]
[AMDGPU] Use isLegalMUBUFImmOffset more
Instead of hardcoding isUInt<12>.
Differential Revision: https://reviews.llvm.org/D88961
Joseph Huber [Wed, 7 Oct 2020 18:13:14 +0000 (14:13 -0400)]
[OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload
Summary:
This patch adds an error to Clang that detects if OpenMP offloading is used
between two architectures with incompatible pointer sizes. This ensures that
the data mapping can be done correctly and solves an issue in code generation
generating the wrong size pointer.
Reviewer: jdoerfert
Subscribers: cfe-commits delcypher guansong llvm-commits sstefan1 yaxunl
Tags: #OpenMP #Clang
Differential Revision: https://reviews.llvm.org/D88594
Simon Pilgrim [Thu, 8 Oct 2020 11:56:27 +0000 (12:56 +0100)]
[InstCombine] matchFunnelShift - support non-uniform constant vector shift amounts (PR46895)
Complete basic PR46895 fixes by refactoring D87452/D88402 to allow us to match non-uniform constant values.
We still don't handle non-uniform vectors that contain undef elements, but that can wait until we have a decent generic mechanism for this.
Differential Revision: https://reviews.llvm.org/D88420
Haojian Wu [Thu, 8 Oct 2020 11:33:07 +0000 (13:33 +0200)]
[clangd] Add a missing include-fixer test for incomplete_type, NFC.
Also sort the list to make it easier to verify with the implementation
code.
Differential Revision: https://reviews.llvm.org/D88964
Serge Pavlov [Thu, 23 Apr 2020 17:27:14 +0000 (00:27 +0700)]
[Driver] Add output file to properties of Command
Object of class `Command` contains various properties of a command to
execute, but output file was missed from them. This change adds this
property. It is required for reporting consumed time and memory implemented
in D78903 and may be used in other cases too.
Differential Revision: https://reviews.llvm.org/D78902
Markus Lavin [Thu, 8 Oct 2020 10:49:51 +0000 (12:49 +0200)]
[DebugInfo] Improve dbg preservation in LSR.
Use SCEV to salvage additional @llvm.dbg.value that have turned into
referencing undef after transformation (and traditional
salvageDebugInfo). Before transformation compute SCEV for each
@llvm.dbg.value in the loop body and store it (along side its current
DIExpression). After transformation update those @llvm.dbg.value now
referencing undef by comparing its stored SCEV to the SCEV of the
current loop-header PHI-nodes. Allow match with offset by inserting
compensation code in the DIExpression.
Includes fix for the nullptr deref that caused the original commit
to be reverted in
9d63029770.
Fixes : PR38815
Differential Revision: https://reviews.llvm.org/D87494
Dmitry Preobrazhensky [Thu, 8 Oct 2020 10:34:52 +0000 (13:34 +0300)]
[AMDGPU][MC][GFX1030] Disabled v_mac_f32
See bug 47741 <https://bugs.llvm.org/show_bug.cgi?id=47741>
Reviewers: nhaehnle, rampitec
Differential Revision: https://reviews.llvm.org/D89000
Tim Northover [Tue, 22 Sep 2020 10:42:37 +0000 (11:42 +0100)]
AArch64: treat MC expressions as 2s complement arithmetic.
We had a couple of over-zealous diagnostics that meant IR with a reasonable and
valid interpretation was rejected.
Simon Pilgrim [Thu, 8 Oct 2020 10:43:34 +0000 (11:43 +0100)]
[llvm-objdump] Ensure we consistently use the llvm::stable_sort wrappers.
We use this everywhere else in this file, these were just missed.
Simon Pilgrim [Thu, 8 Oct 2020 10:04:54 +0000 (11:04 +0100)]
[InstCombine] matchRotate - add support for matching general funnel shifts with constant shift amounts (PR46896)
First step towards extending the existing rotation support to full funnel shift handling now that the backend legalization support has improved.
This enables us to match the shift by constant cases, which are pretty trivial to expand again if necessary.
D88420 will add non-uniform support for funnel shifts as well once its been finalized.
Differential Revision: https://reviews.llvm.org/D88834
Alexander Belyaev [Thu, 8 Oct 2020 09:07:36 +0000 (11:07 +0200)]
[mlir] Add basic support for dynamic tensor results in TensorToBuffers.cpp.
The simplest case is when the indexing maps are DimIds in every component. This covers cwise ops.
Also:
* Expose populateConvertLinalgOnTensorsToBuffersPatterns in Transforms.h
* Expose emitLoopRanges in Transforms.h
Differential Revision: https://reviews.llvm.org/D88781
Simon Pilgrim [Thu, 8 Oct 2020 09:53:32 +0000 (10:53 +0100)]
[InstCombine] canNarrowShiftAmt - replace custom Constant matching with m_SpecificInt_ICMP
The existing code ignores undef values which matches m_SpecificInt_ICMP, although m_SpecificInt_ICMP returns false for an all-undef constant, I've added test coverage at rGfe0197e194a64f9 to show that undef folding should already have dealt with that case.
Christian Sigg [Wed, 7 Oct 2020 14:17:35 +0000 (16:17 +0200)]
Import llvm::StringSwitch into mlir namespace.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D88971
Georgii Rymar [Mon, 5 Oct 2020 09:29:18 +0000 (12:29 +0300)]
[llvm-readobj][test] - Improve testing in hash-table.test
This makes tests stricter and adds cases to verify what
we do when:
1) there is no `DT_HASH` tag (but there is a `SHT_HASH` section in sections header)
2) the sh_entsize of the `SHT_HASH` section is not equal to 4.
Differential revision: https://reviews.llvm.org/D88812
Max Kazantsev [Thu, 8 Oct 2020 09:26:14 +0000 (16:26 +0700)]
[Test] Add test showing that we fail to eliminate implied exit conditions
Luqman Aden [Thu, 8 Oct 2020 08:43:50 +0000 (01:43 -0700)]
[llvm-readobj] Add --coff-tls-directory flag to print TLS Directory & test.
Akin to dumpbin's /TLS option, this will print out the TLS directory, if
present, in the image.
Example output:
```
> llvm-readobj --coff-tls-directory test.exe
File: test.exe
Format: COFF-x86-64
Arch: x86_64
AddressSize: 64bit
TLSDirectory {
StartAddressOfRawData: 0x140004000
EndAddressOfRawData: 0x140004040
AddressOfIndex: 0x140002000
AddressOfCallBacks: 0x0
SizeOfZeroFill: 0x0
Characteristics [ (0x0)
]
}
```
Reviewed By: jhenderson, grimar
Differential Revision: https://reviews.llvm.org/D88635
Pierre Gousseau [Thu, 8 Oct 2020 08:45:59 +0000 (09:45 +0100)]
[cmake] Fix cmake warning in standalone compiler-rt builds.
```
cd compiler-rt/build
cmake -G Ninja ../ -DCOMPILER_RT_STANDALONE_BUILD=ON
-DLLVM_CONFIG_PATH=<...>llvm-project/build/bin/llvm-config
-DCOMPILER_RT_INCLUDE_TESTS=ON
```
```
-- check-shadowcallstack does nothing.
Traceback (most recent call last):
File "<string>", line 22, in <module>
IndexError: list index out of range
-- Configuring done
-- Generating done
```
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D88957
Jakub Lichman [Thu, 8 Oct 2020 07:38:41 +0000 (07:38 +0000)]
[mlir] Added strides check to rank reducing subview verification
Added missing strides check to verification method of rank reducing subview
which enforces strides specification for the resulting type.
Differential Revision: https://reviews.llvm.org/D88879
Mirko Brkusanin [Tue, 6 Oct 2020 13:20:29 +0000 (15:20 +0200)]
[AMDGPU] Prefer SplitVectorLoad/Store over expandUnalignedLoad/Store
ExpandUnalignedLoad/Store can sometimes produce unnecessary copies to
temporary stack slot. We should prefer splitting vectors if possible.
Differential Revision: https://reviews.llvm.org/D88882
Mirko Brkusanin [Tue, 6 Oct 2020 13:16:31 +0000 (15:16 +0200)]
[AMDGPU] Add test with redundant copies to temporary stack slot produced by expandUnalignedLoad
Differential Revision: https://reviews.llvm.org/D88895
Haojian Wu [Thu, 8 Oct 2020 08:00:29 +0000 (10:00 +0200)]
[AST][RecoveryExpr] Support dependent cast-expr in C for error-recovery.
Suppress spurious "typecheck_cond_expect_scalar_operand" diagnostic.
See whole context: https://reviews.llvm.org/D85025
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D84387
Haojian Wu [Thu, 8 Oct 2020 07:35:49 +0000 (09:35 +0200)]
[clangd] Fix a typo, NFC.
David Green [Thu, 8 Oct 2020 07:28:58 +0000 (08:28 +0100)]
[LV] Collect dead induction truncates
We currently collect the ICmp and Add from an induction variable,
marking them as dead so that vplan values are not created for them. This
extends that to include any single use trunk from the ICmp, which allows
the Add to more readily be removed too.
This can help with costing vplan nodes, as the ICmp and Add are more
reliably removed and are not double-counted.
Differential Revision: https://reviews.llvm.org/D88873
David Green [Thu, 8 Oct 2020 07:05:48 +0000 (08:05 +0100)]
[ARM] Replace llvm.experimental.vector.reduce.smax with llvm.vector.reduce.smax. NFC
This fixes up some newer tests after D88787.
Mateusz Mikuła [Thu, 8 Oct 2020 06:34:18 +0000 (09:34 +0300)]
[LLD] Ignore ELF tests when ld.lld defaults to MinGW
Follow-up to D87418.
Differential Revision: https://reviews.llvm.org/D88991
Martin Storsjö [Tue, 6 Oct 2020 10:23:57 +0000 (13:23 +0300)]
[LLD] [ELF] Fix up a comment regarding the --wrap option. NFC.
Add missing leading underscores to the __wrap_<symbol> and
__real_<symbol> names.
Differential Revision: https://reviews.llvm.org/D89008
Serge Guelton [Wed, 7 Oct 2020 17:43:55 +0000 (13:43 -0400)]
Update documentation and implementation of stage3 build
Have the build work out of the box by forcing an LLD build.
That way, we don't require an external LTO-aware linker,
as we build one.
Also remove reference to the seemingly dead builder.
Differential Revision: https://reviews.llvm.org/D88990
Max Kazantsev [Thu, 8 Oct 2020 03:50:44 +0000 (10:50 +0700)]
Return "[SCEV] Prove implicaitons via AddRec start"
The initial version of the patch was reverted because it missed the check that
the predicate being proved is actually guarded by this check on 1st iteration.
If it was not executed on 1st iteration (but possibly executes after that), then
it is incorrect to use reasoning about IV start to prove it.
Added the test where the miscompile was seen. Unfortunately, my attempts
to reduce it with bugpoint did not succeed; it can further be reduced when
we understand how to do it without losing the initial bug's notion.
Returning assuming the miscompiles are now gone.
Differential Revision: https://reviews.llvm.org/D88208
Arthur Eubanks [Tue, 22 Sep 2020 16:34:46 +0000 (09:34 -0700)]
[NewPM] Use PassInstrumentation for -verify-each
This removes "VerifyEachPass" parameters from a lot of functions which is nice.
Don't verify after special passes or VerifierPass.
This introduces verification on loop and cgscc passes, verifying the corresponding function/module.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D88764
Nico Weber [Thu, 8 Oct 2020 02:23:08 +0000 (22:23 -0400)]
Revert "[Support][unittests] Enforce alignment in ConvertUTFTest"
This reverts commit
53b3873cf428fd78f1d92504cc20adf11181ead7.
Seems to break SupportTests.exe's
ConvertUTFTest.UTF16WrappersForConvertUTF16ToUTF8String
on Windows.
Yonghong Song [Wed, 7 Oct 2020 23:24:33 +0000 (16:24 -0700)]
BPF: fix incorrect DAG2DAG load optimization
Currently, bpf backend Instruction section DAG2DAG phase has
an optimization to replace loading constant struct memeber
or array element with direct values. The reason is that these
locally defined struct or array variables may have their
initial values stored in a readonly section and early bpf
ecosystem is not able to handle such cases.
Bpf ecosystem now can not only handle readonly sections,
but also global variables. global variable can also have
initialized data and global variable may or may not be constant,
i.e., global variable data can be put in .data section or .rodata
section. This exposed a bug in DAG2DAG Load optimization
as it did not check whether the global variable is constant
or not.
This patch fixed the bug by checking whether global variable,
representing the initial data, is constant or not and will not
do optimization if it is not a constant.
Another bug is also fixed in this patch to check whether
the load is simple (not volatile/atomic) or not. If it is
not simple, we will not do optimization. To summary for
globals:
- struct t var = { ... } ; // no load optimization
- const struct t var = { ... }; // load optimization is possible
- volatile const struct t var = { ... }; // no load optimization
Differential Revision: https://reviews.llvm.org/D89021
Scott Constable [Thu, 8 Oct 2020 01:32:45 +0000 (18:32 -0700)]
[X86] Fix bug in -mlvi-cfi that may clobber a live register
Fix for this bug: https://bugs.llvm.org/show_bug.cgi?id=47740
The fix uses the existing findDeadCallerSavedReg() function instead of a hacky heuristic to find a scratch register to clobber.
Differential Revision: https://reviews.llvm.org/D88925
Scott Constable [Thu, 8 Oct 2020 01:30:37 +0000 (18:30 -0700)]
[X86] Move findDeadCallerSavedReg() into X86RegisterInfo
The findDeadCallerSavedReg() function has utility outside of X86FrameLowering.cpp
Differential Revision: https://reviews.llvm.org/D88924
Geoffrey Martin-Noble [Thu, 8 Oct 2020 01:24:24 +0000 (18:24 -0700)]
Remove unused variables
These are unused since
https://reviews.llvm.org/rG35cb45c533fb76dcfc9f44b4e8bbd5d8a855ed2a
causing `-Wunused` warnings.
Differential Revision: https://reviews.llvm.org/D89022
Yuanfang Chen [Thu, 8 Oct 2020 01:13:26 +0000 (18:13 -0700)]
[IRMover] Avoid materializing global value that belongs to not-yet-linked module
We saw the same assertion failure mentioned here
https://bugs.llvm.org/show_bug.cgi?id=42063 in our internal tests.
The failure happens in the same circumstance as D47898 and D66814 where
uniqueing of DICompositeTypes causes `Mapper::mapValue` to be called on
GlobalValues(`G`) from a not-yet-linked module(`M`). The following type-mapping for
`G` may not complete correctly (fail to unique types etc. depending on the
the complexity of the types) because IRLinker::computeTypeMapping is not done for `M`
in this path.
D47898 and D66814 fixed some type-mapping issue after Mapper::mapValue
is called on `G`. However, it seems it did not handle some complex cases. I
think we should delay linking globals like `G` until its owing module is
linked. In this way, we could save unnecessary type mapping and prune
these corner cases. It is also supposed to reduce the total number of structs
ending up in the combined module.
D47898 is reverted (its test is kept) because it regresses the test case here.
D66814 could also be reverted (the `check-all` looks good). But it looks reasonable
anyway, so I thought I should keep it.
Also tested the patch with clang self-host regularLTO/ThinLTO build, things look
good as well.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D87001
Petr Hosek [Wed, 23 Sep 2020 22:53:45 +0000 (15:53 -0700)]
[libcxx] Use runtime rather then compile-time glibc version check
glibc supports versioning, so it's possible to build against older
version and run against newer version. This is sometimes relied on
in practice, e.g. in Fuchsia build we build against older sysroot
(equivalent to Ubuntu Trusty) to cover the broadest possible range
of host systems, but that doesn't necessarily match the system that
binary is going to run on which may have newer version, in which case
the compile test used in curr_symbol is going to fail. Using runtime
check is more reliable. This is a follow up to D56702 which addressed
one instance, this patch addresses all of the remaining ones.
Differential Revision: https://reviews.llvm.org/D88188
Anna Thomas [Thu, 24 Sep 2020 15:00:46 +0000 (11:00 -0400)]
[ImplicitNullChecks] Support complex addressing mode
The pass is updated to handle loads through complex addressing mode,
specifically, when we have a scaled register and a scale.
It requires two API updates in TII which have been implemented for X86.
See added IR and MIR testcases.
Tests-Run: make check
Reviewed-By: reames, danstrushin
Differential Revision: https://reviews.llvm.org/D87148
Craig Topper [Wed, 7 Oct 2020 21:20:18 +0000 (14:20 -0700)]
[X86] Defer the creation of LCMPXCHG16B_SAVE_RBX until finalize-isel
We need to use LCMPXCHG16B_SAVE_RBX if RBX/EBX is being used as
the frame pointer. We previously checked for this during type
legalization, but that's too early to know for sure if the base
pointer is needed.
This patch adds a new pseudo instruction to emit from isel that
uses a virtual register for the RBX input. Then we use the custom
inserter hook to emit LCMPXCHG16B if RBX isn't needed as a base
pointer or LCMPXCHG16B_SAVE_RBX if it is.
Fixes PR42064.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D88808
Dominic Chen [Sat, 26 Sep 2020 01:46:49 +0000 (21:46 -0400)]
Add test for disabling Dead Virtual Function Elimination
Differential Revision: https://reviews.llvm.org/D88349
Teresa Johnson [Sat, 26 Sep 2020 06:03:06 +0000 (23:03 -0700)]
[sanitizer] Skip stack symbolization when not required for print format
Adds a check to avoid symbolization when printing stack traces if the
stack_trace_format flag does not need it. While there is a symbolize
flag that can be turned off to skip some of the symbolization,
SymbolizePC() still unconditionally looks up the module name and offset.
Avoid invoking SymbolizePC() at all if not needed.
This is an efficiency improvement when dumping all stack traces as part
of the memory profiler in D87120, for large stripped apps where we want
to symbolize as a post pass.
Differential Revision: https://reviews.llvm.org/D88361
peter klausler [Fri, 2 Oct 2020 19:39:05 +0000 (12:39 -0700)]
[flang][msvc] Avoid dependence on long double
MSVC does not support a distinct 80-bit extended precision
"long double" type. Rework the I/O runtime to avoid using
native C/C++ type names. Centralize the mappings between
the KIND= type parameters of REAL and their binary precisions
in the common real.h header file, and use KIND type parameter
values rather than binary precisions for clarity where
appropriate.
This patch, if successful, should obviate the need for
Differential review D88511.
(This patch anticipates a successful review of D88688, which
fixes the function that maps each kind of real to its maximum
number of significant decimal digits.)
Differential revision: https://reviews.llvm.org/D88752
Louis Dionne [Wed, 7 Oct 2020 22:03:09 +0000 (18:03 -0400)]
[libc++] Remove unused includes of Availability.h
Since
ebaf1d5e2b, the macros defined in <Availability.h> are not used
anymore.
Jim Ingham [Wed, 7 Oct 2020 22:00:08 +0000 (15:00 -0700)]
Fix a macOS build break caused by
3dfb94986170.
Min-Yih Hsu [Tue, 6 Oct 2020 03:24:33 +0000 (20:24 -0700)]
[M680x0] Add google/benchmark's CycleTimer support for M68K
This is a cherrypick of the upstream fix commit ffe1342 onto
`llvm/utils/benchmark` and `libcxx/utils/google-benchmark`.
This adds CycleTimer implementation for M680x0, which simply
uses `gettimeofday` same as MIPS.
Differential Review: https://reviews.llvm.org/D88868
Mircea Trofin [Tue, 6 Oct 2020 21:38:41 +0000 (14:38 -0700)]
[NFC][regalloc] Use MCRegister instead of unsigned in InterferenceCache
Also changed users of APIs.
Differential Revision: https://reviews.llvm.org/D88930
peter klausler [Thu, 1 Oct 2020 19:08:04 +0000 (12:08 -0700)]
[flang] Semantic checks for bad usage of whole assumed-size arrays
The semantics pass currently checks for several constraints
that apply to the use of whole assumed-size arrays in various
contexts, but C1002 wasn't really implemented. This patch
implements C1002 by disallowing the use of whole assumed-size
arrays in expressions and variables unless specifically
allowed by the context. This centralizes the error reporting,
which has been improved with a link to the array's declaration.
Differential revision: https://reviews.llvm.org/D88691
Reid Kleckner [Fri, 2 Oct 2020 23:31:57 +0000 (16:31 -0700)]
Port StripGCRelocates pass to NPM
Fixes one test under NPM
Differential Revision: https://reviews.llvm.org/D88766
Reid Kleckner [Fri, 2 Oct 2020 23:18:47 +0000 (16:18 -0700)]
[NPM] Port strip nonlinetable debuginfo pass to the new pass manager
Fixes a few tests in llvm/test/Transforms/Utils.
Differential Revision: https://reviews.llvm.org/D88762
Greg Clayton [Wed, 7 Oct 2020 01:54:20 +0000 (18:54 -0700)]
Add regular expressions to and DWARF Call Frame Information tests in case the architecture specific target is not compiled into LLVM.
This should fix any build bots that avoid compiling some architectures into llvm after https://reviews.llvm.org/D88767.
Differential Revision: https://reviews.llvm.org/D88940
Aart Bik [Wed, 7 Oct 2020 21:13:46 +0000 (14:13 -0700)]
[mlir] [sparse] Rename getSparseMatrix to getMatrix
Rationale:
More consistent with the other names. Also forward looking to reading
in other kinds of matrices. Also fixes lint issue on hard-coded %llu.
Reviewed By: penpornk
Differential Revision: https://reviews.llvm.org/D89005
Philip Reames [Wed, 7 Oct 2020 21:02:10 +0000 (14:02 -0700)]
Add validity assert on entry to CastInst::isNoopCast [NFC]
This required some minor code reorganization to have a version of castIsValid which worked purely in terms of types.
Mircea Trofin [Wed, 7 Oct 2020 20:53:14 +0000 (13:53 -0700)]
[NFC][MLInliner] Getters should return by reference
Rahman Lavaee [Wed, 7 Oct 2020 20:21:20 +0000 (13:21 -0700)]
[BasicBlockSections] Make sure that the labels for address-taken blocks are emitted after switching the seciton.
Currently, AsmPrinter code is organized in a way in which the labels of address-taken blocks are emitted in the previous section, which makes the relocation incorrect.
This patch reorganizes the code to switch to the basic block section before handling address-taken blocks.
Reviewed By: snehasish, MaskRay
Differential Revision: https://reviews.llvm.org/D88517
Cameron McInally [Wed, 7 Oct 2020 19:36:00 +0000 (14:36 -0500)]
[SVE] Add legalisation tests to sve-fixed-length-fp-reduce.ll
Simon Pilgrim [Wed, 7 Oct 2020 19:59:31 +0000 (20:59 +0100)]
[InstCombine] Add checks for and(logicalshift(zext(x),undef),y) cases
Prep work before some cleanup in narrowMaskedBinOp
Ronak Chauhan [Wed, 7 Oct 2020 19:30:10 +0000 (01:00 +0530)]
Remove D80713.diff added in
528057c19755ad842052fba3a42dcbf7deafc6de
The diff file was added by mistake.
Douglas Yung [Wed, 7 Oct 2020 19:23:51 +0000 (12:23 -0700)]
Add REQUIRES: x86-registered-target to test as it was failing on build bots without x86.
This should fix the failure on http://lab.llvm.org:8011/#/builders/91/builds/30
Haojian Wu [Wed, 7 Oct 2020 19:16:45 +0000 (21:16 +0200)]
[clangd] Add a NewName optional parameter to clangdServer::prepareRename.
If the NewName is provided, prepareRename would perform a name
validation.
The motivation is to allow our internal embeder implement the customized
"canRenameInto" functionality on top of prepareRename.
Differential Revision: https://reviews.llvm.org/D88881
Philip Reames [Wed, 7 Oct 2020 19:15:16 +0000 (12:15 -0700)]
Add a clarifying a comment on CastInst::isNoopCast
I made exactly the mistake described, so document the precondition. It would be better to have an assert, but there is (currently) no "castIsValid" with purely type arguments.
Simon Pilgrim [Wed, 7 Oct 2020 18:53:39 +0000 (19:53 +0100)]
Fix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Wed, 7 Oct 2020 18:01:04 +0000 (19:01 +0100)]
Fix Wdocumentation warnings due to case mismatch. NFCI.
Simon Pilgrim [Wed, 7 Oct 2020 16:27:32 +0000 (17:27 +0100)]
[CodeGen][X86] Cleanup labels on some sse/avx intrinsics tests. NFCI.
Add some missing CHECK-LABEL lines.
Remove leading '@' so it'll be possible to match against c and c++ builds in a future patch.
Amara Emerson [Wed, 7 Oct 2020 18:19:54 +0000 (11:19 -0700)]
[mlir] Fix build after
322d0afd875df66b36e4810a2b95c20a8f22ab9b due to change in intrinsic overloads.
I'd forgottent to run the mlir tests after removing the scalar input overload
on the fadd/fmul reductions. This is a quick fix for the mlir bot.
Stanislav Mekhanoshin [Tue, 6 Oct 2020 21:07:44 +0000 (14:07 -0700)]
[AMDGPU] Add tied operand to d16 scratch loads
This is still no-op because there is no selection for these
opcodes.
Differential Revision: https://reviews.llvm.org/D88927
Edd Dawson [Wed, 7 Oct 2020 17:58:12 +0000 (13:58 -0400)]
[test][MC] Use %python in llvm/test/MC/COFF/bigobj.py
... instead of the one on the $PATH.
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D88986
Florian Hahn [Wed, 7 Oct 2020 17:50:17 +0000 (18:50 +0100)]
[LAA] Use DL to get element size for bound computation.
Currently LAA uses getScalarSizeInBits to compute the size of an element
when computing the end bound of an access.
This does not work as expected for pointers to pointers, because
getScalarSizeInBits will return 0 for pointer types.
By using DataLayout to get the size of the element we can also correctly
handle pointer element types.
Note the changes to the existing test, which seems to also use the wrong
offset for the end.
Fixes PR47751.
Reviewed By: anemet
Differential Revision: https://reviews.llvm.org/D88953
Stanislav Mekhanoshin [Tue, 6 Oct 2020 20:04:11 +0000 (13:04 -0700)]
[AMDGPU] Use default zero flag operands in flat scratch
This is no-op so far because we do not select these yet.
Differential Revision: https://reviews.llvm.org/D88920
Amara Emerson [Sun, 4 Oct 2020 05:06:54 +0000 (22:06 -0700)]
Rename the VECREDUCE_STRICT_{FADD,FMUL} SDNodes to VECREDUCE_SEQ_{FADD,FMUL}.
The STRICT was causing unnecessary confusion. I think SEQ is a more accurate
name for what they actually do, and the other obvious option of "ORDERED"
has the issue of already having a meaning in FP contexts.
Differential Revision: https://reviews.llvm.org/D88791
Sam McCall [Tue, 6 Oct 2020 10:51:01 +0000 (12:51 +0200)]
[clangd] Disambiguate overloads of std::move for header insertion.
Up until now, we relied on matching the filename.
This depends on unstable details of libstdc++ and doesn't work well on other
stdlibs. Also we'd like to remove it (see D88204).
Differential Revision: https://reviews.llvm.org/D88885
Amara Emerson [Sat, 3 Oct 2020 01:30:53 +0000 (18:30 -0700)]
[llvm][mlir] Promote the experimental reduction intrinsics to be first class intrinsics.
This change renames the intrinsics to not have "experimental" in the name.
The autoupgrader will handle legacy intrinsics.
Relevant ML thread: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140729.html
Differential Revision: https://reviews.llvm.org/D88787
Fanbo Meng [Wed, 7 Oct 2020 17:22:55 +0000 (13:22 -0400)]
[NFC] Add contributors names to CREDITS.TXT
Stella Laurenzo [Wed, 7 Oct 2020 06:01:20 +0000 (23:01 -0700)]
[mlir][CAPI] Attribute set/remove on operations.
* New functions: mlirOperationSetAttributeByName, mlirOperationRemoveAttributeByName
* Also adds some *IsNull checks and standardizes the rest to use "static inline" form, which makes them all non-opaque and not part of the ABI (which is desirable).
* Changes needed to resolve TODOs in npcomp PyTorch capture.
Differential Revision: https://reviews.llvm.org/D88946
Heejin Ahn [Mon, 28 Sep 2020 10:57:37 +0000 (03:57 -0700)]
[WebAssembly] Rename Emscripten EH functions
Renaming for some Emscripten EH functions has so far been done in
wasm-emscripten-finalize tool in Binaryen. But recently we decided to
make a compilation/linking path that does not rely on
wasm-emscripten-finalize for modifications, so here we move that
functionality to LLVM.
Invoke wrappers are generated in LowerEmscriptenEHSjLj pass, but final
wasm types are not available in the IR pass, we need to rename them at
the end of the pipeline.
This patch also removes uses of `emscripten_longjmp_jmpbuf` in
LowerEmscriptenEHSjLj pass, replacing that with `emscripten_longjmp`.
`emscripten_longjmp_jmpbuf` is lowered to `emscripten_longjmp`, but
previously we generated calls to `emscripten_longjmp_jmpbuf` in
LowerEmscriptenEHSjLj pass because it takes `jmp_buf*` instead of `i32`.
But we were able use `ptrtoint` to make it use `emscripten_longjmp`
directly here.
Addresses:
https://github.com/WebAssembly/binaryen/issues/3043
https://github.com/WebAssembly/binaryen/issues/3081
Companions:
https://github.com/WebAssembly/binaryen/pull/3191
https://github.com/emscripten-core/emscripten/pull/12399
Reviewed By: dschuff, tlively, sbc100
Differential Revision: https://reviews.llvm.org/D88697
Daniel Sanders [Tue, 6 Oct 2020 11:50:41 +0000 (13:50 +0200)]
[json] Provide a means to delegate writing a value to another API
(Based on D87170 by dsanders)
I recently had need to call out to an external API to emit a JSON object as part
of one an LLVM tool was emitting. However, our JSON support didn't provide a way
to delegate part of the JSON output to that API.
Add rawValueBegin() and rawValueEnd() to maintain and check the internal state
while something else is writing to the stream. It's the users responsibility to
ensure that the resulting JSON output is still valid.
Differential Revision: https://reviews.llvm.org/D88902
Sam McCall [Wed, 7 Oct 2020 14:37:53 +0000 (16:37 +0200)]
Reapply [ADT] function_ref's constructor is unavailable if the argument is not callable.
This reverts commit
281703e67ffaee8e26efef86e0df3e145477f4cb.
GCC 5.4 bugs are worked around by avoiding use of variable templates.
Differential Revision: https://reviews.llvm.org/D88977
Alex Richardson [Wed, 7 Oct 2020 15:29:22 +0000 (16:29 +0100)]
[clang-format][tests] Fix MacroExpander lexer not parsing C++ keywords
While debugging a different clang-format failure, I tried to reuse the
MacroExpander lexer, but was surprised to see that it marks all C++
keywords (e.g. const, decltype) as being of type identifier. After stepping
through the ::format() code, I noticed that the difference between these
two is that the identifier table was not being initialized based on the
FormatStyle, so only basic tokens such as tok::semi, tok::plus, etc. were
being handled.
Reviewed By: klimek
Differential Revision: https://reviews.llvm.org/D88952
Alex Richardson [Wed, 7 Oct 2020 15:29:10 +0000 (16:29 +0100)]
[clang-format][NFC] Store FormatToken::Type as an enum instead of bitfield
This improves the debugging experience since LLDB will print the enumerator
name instead of a decimal number. This changes TokenType to have uint8_t
as the underlying type and moves it after the remaining bitfields to avoid
increasing the size of FormatToken.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D87006
Nikita Popov [Tue, 6 Oct 2020 20:10:10 +0000 (22:10 +0200)]
[MemCpyOpt] Add additional callslot test cases (NFC)
For cases where the destination is captured.
Roman Lebedev [Wed, 7 Oct 2020 15:59:40 +0000 (18:59 +0300)]
[NFC][InstCombine] Autogenerate a few tests being affected by upcoming patch
Philip Reames [Wed, 7 Oct 2020 15:56:13 +0000 (08:56 -0700)]
[Tests] Precommit test showing gap around load forwarding of vectors in instcombine
LLVM GN Syncbot [Wed, 7 Oct 2020 15:50:43 +0000 (15:50 +0000)]
[gn build] Port
ddf1864ace4
Yonghong Song [Thu, 6 Aug 2020 16:06:43 +0000 (09:06 -0700)]
BPF: add AdjustOpt IR pass to generate verifier friendly codes
Add an IR phase right before main module optimization.
This is to modify IR to restrict certain downward optimizations
in order to generate verifier friendly code.
> prevent certain instcombine optimizations, handling both
in-block/cross-block instcombines.
> avoid speculative code motion if the variable used in
condition is also used in the later blocks.
Internally, a bpf IR builtin
result = __builtin_bpf_passthrough(seq_num, result)
is used to enforce ordering. This builtin is only used
during target independent IR optimizations and it will
be removed at the beginning of target dependent IR
optimizations.
For example, removing the following workaround,
--- a/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c
+++ b/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c
@@ -47,7 +47,7 @@ int sysctl_tcp_mem(struct bpf_sysctl *ctx)
/* a workaround to prevent compiler from generating
* codes verifier cannot handle yet.
*/
- volatile int ret;
+ int ret;
this patch is able to generate code which passed the verifier.
To disable optimization, users need to use "opt" command like below:
clang -target bpf -O2 -S -emit-llvm -Xclang -disable-llvm-passes test.c
// disable icmp serialization
opt -O2 -bpf-disable-serialize-icmp test.ll | llvm-dis > t.ll
// disable avoid-speculation
opt -O2 -bpf-disable-avoid-speculation test.ll | llvm-dis > t.ll
llc t.ll
Differential Revision: https://reviews.llvm.org/D85570