Yang Fan [Wed, 3 Feb 2021 02:48:39 +0000 (10:48 +0800)]
[clang-format] Fix MSVC "unsafe use of type 'bool' in operation" warning (NFC)
MSVC warning:
```
\llvm-project\clang\lib\Format\BreakableToken.cpp(1002): warning C4804: '-': unsafe use of type 'bool' in operation
```
Fangrui Song [Wed, 3 Feb 2021 02:28:37 +0000 (18:28 -0800)]
[yaml2obj][wasm] Support numeric relocation type
Differential Revision: https://reviews.llvm.org/D95661
Yang Fan [Wed, 3 Feb 2021 02:21:45 +0000 (10:21 +0800)]
[VFS] Fix Wreturn-type gcc warning (NFC)
GCC warning:
```
In file included from /llvm-project/llvm/lib/Support/VirtualFileSystem.cpp:13:
/llvm-project/llvm/include/llvm/Support/VirtualFileSystem.h: In static member function ‘static bool llvm::vfs::RedirectingFileSystem::RemapEntry::classof(const llvm::vfs::RedirectingFileSystem::Entry*)’:
/llvm-project/llvm/include/llvm/Support/VirtualFileSystem.h:681:5: warning: control reaches end of non-void function [-Wreturn-type]
681 | }
| ^
```
Chen Zheng [Wed, 3 Feb 2021 02:01:19 +0000 (21:01 -0500)]
[PowerPC] [NFC] fix wording typos
Post commit comments address for D92071.
Med Ismail Bennani [Wed, 3 Feb 2021 01:46:50 +0000 (02:46 +0100)]
[lldb/test] Stop recording fundamental return types (NFC)
It seems that recording fundamental return type is bogus.
This can trigger asserts when running a test with reproducers so this
patch updates the `SBTarget::IsLoaded` test to stop recording them.
Differential Revision: https://reviews.llvm.org/D95686
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Matt Arsenault [Tue, 2 Feb 2021 21:22:32 +0000 (16:22 -0500)]
AMDGPU: Fix adding extra operands for i128 asm constraints
We don't register i128 as a legal type with addRegisterClass, but it
appears in the list of legal register types. This inconsistency
resulted in the asm constraint lowering trying to use 2 128-bit
registers for these operands. This would leave behind a dead def that
would waste registers.
Regresses GlobalISel tests for i128 load/store, but these aren't very
important right now. Ideally these would not depend on the list of
register types.
Matt Arsenault [Sat, 30 Jan 2021 18:15:53 +0000 (13:15 -0500)]
AMDGPU: Don't consider global pressure when bundling soft clauses
This should only consider whether the pressure impact of the bundle at
the given point in the program will decrease the occupancy. High VGPR
pressure was incorrectly blocking the formation of scalar bundles, and
vice versa. This was also blocking bundling from high pressure
situations at other points in the program.
Jessica Paquette [Tue, 2 Feb 2021 22:21:33 +0000 (14:21 -0800)]
[GlobalISel] Check if branches use the same MBB in matchOptBrCondByInvertingCond
If the G_BR + G_BRCOND in this combine use the same MBB, then it will infinite
loop. Don't allow that to happen.
Differential Revision: https://reviews.llvm.org/D95895
Siva Chandra [Tue, 2 Feb 2021 07:43:05 +0000 (23:43 -0800)]
[libc] Add hardware implementations of ceil and ceilf for aarch64.
This change also introduces a new source layout for adding machine
specific and generic implementations. To keep the scope of this change
small, this new pattern is only applied for ceil, ceilf and ceill.
Follow up changes will switch all math functions in to the new pattern.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D95850
Lei Zhang [Tue, 2 Feb 2021 23:30:41 +0000 (18:30 -0500)]
[mlir] Fix scf.for single iteration canonicalization check
We should be check whether lb + step >= ub to determine
whether this is a single iteration. Previously we were
checking lb + lb >= ub.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D95440
Diego Caballero [Tue, 2 Feb 2021 22:39:41 +0000 (00:39 +0200)]
[mlir][Vector] Add lowering to LLVM for vector.bitcast
Add the conversion pattern for vector.bitcast to lower it to
the LLVM Dialect.
Reviewed By: ThomasRaoux, aartbik
Differential Revision: https://reviews.llvm.org/D95579
Fangrui Song [Tue, 2 Feb 2021 23:18:00 +0000 (15:18 -0800)]
[FileCheck] Make --allow-unused-prefixes cl::ZeroOrMore
cl::ZeroOrMore allows the option to be specified multiple times, which makes
downstream projects possible to specify a default value in lit configuration
while some tests can override the value.
peter klausler [Tue, 2 Feb 2021 22:39:05 +0000 (14:39 -0800)]
[flang] Add TypeAndShape::MeasureElementSizeInBytes()
Split up MeasureSizeInBytes() so that array element sizes can be
calculated accurately; use the new API in some places where
DynamicType::MeasureSizeInBytes() was being used but the new
API performs better due to TypeAndShape having precise CHARACTER
length information.
Differential Revision: https://reviews.llvm.org/D95897
Arthur Eubanks [Tue, 2 Feb 2021 22:45:45 +0000 (14:45 -0800)]
[test][NewPM] Pin various tests to the legacy PM
tut-simplify-cfg hasn't been ported to the new PM.
llvm-lto2's -enable-new-pm defaults to the CMake flag, so the legacy PM extension test needs to be pinned.
Reviewed By: MaskRay, ychen
Differential Revision: https://reviews.llvm.org/D95898
LLVM GN Syncbot [Tue, 2 Feb 2021 22:57:59 +0000 (22:57 +0000)]
[gn build] Port
4f58b1bd2974
Kyungwoo Lee [Tue, 2 Feb 2021 03:32:32 +0000 (22:32 -0500)]
[AArch64] Homogeneous Prolog and Epilog Size Optimization
Second land attempt. MachineVerifier DefRegState expensive check errors fixed.
Prologs and epilogs handle callee-save registers and tend to be irregular with
different immediate offsets that are not often handled by the MachineOutliner.
Commit D18619/
a5335647d5e8 (combining stack operations) stretched irregularity
further.
This patch tries to emit homogeneous stores and loads with the same offset for
prologs and epilogs respectively. We have observed that this canonicalizes
(homogenizes) prologs and epilogs significantly and results in a greatly
increased chance of outlining, resulting in a code size reduction.
Despite the above results, there are still size wins to be had that the
MachineOutliner does not provide due to the special handling X30/LR. To handle
the LR case, his patch custom-outlines prologs and epilogs in place. It does
this by doing the following:
* Injects HOM_Prolog and HOM_Epilog pseudo instructions during a Prolog and
Epilog Injection Pass.
* Lowers and optimizes said pseudos in a AArchLowerHomogneousPrologEpilog Pass.
* Outlined helpers are created on demand. Identical helpers are merged by the linker.
* An opt-in flag is introduced to enable this feature. Another threshold flag
is also introduced to control the aggressiveness of outlining for application's need.
This reduced an average of 4% of code size on LLVM-TestSuite/CTMark targeting arm64/-Oz.
Differential Revision: https://reviews.llvm.org/D76570
Mitch Phillips [Tue, 2 Feb 2021 22:46:25 +0000 (14:46 -0800)]
Revert "[GWP-ASan] Add aligned allocations."
This reverts commit
9dc06762470cb5a6cde8de5833cb75262e1bacb0.
Should not have been committed, was a bad rebase. Review still
continuing on D94830.
Mitch Phillips [Tue, 2 Feb 2021 22:32:28 +0000 (14:32 -0800)]
[GWP-ASan] Add locking around unwinder for atfork protection.
Unwinders (like libc's backtrace()) can call their own locks (like the
libdl lock). We need to let the unwinder release the locks before
forking. Wrap a new lock around the unwinder for atfork protection.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D95889
Mitch Phillips [Thu, 14 Jan 2021 23:16:56 +0000 (15:16 -0800)]
[GWP-ASan] Add aligned allocations.
Adds a new allocation API to GWP-ASan that handles size+alignment
restrictions.
Differential Revision: https://reviews.llvm.org/D94830
Richard Smith [Wed, 27 Jan 2021 07:36:01 +0000 (23:36 -0800)]
Diagnose if a SLEB128 is too large to fit in an int64_t.
Previously we'd hit UB due to an invalid left shift operand.
Also fix the WASM emitter to properly use SLEB128 encoding instead of
ULEB128 encoding for signed fields so that negative numbers don't
result in overly-large values that we can't read back any more.
In passing, don't diagnose a non-canonical ULEB128 that fits in a uint64_t but
has redundant trailing zero bytes.
Reviewed By: dblaikie, aardappel
Differential Revision: https://reviews.llvm.org/D95510
Jianzhou Zhao [Thu, 28 Jan 2021 22:36:47 +0000 (22:36 +0000)]
[dfsan] Clean TLS after sigaction callbacks
DFSan uses TLS to pass metadata of arguments and return values. When an
instrumented function accesses the TLS, if a signal callback happens, and
the callback calls other instrumented functions with updating the same TLS,
the TLS is in an inconsistent state after the callback ends. This may cause
either under-tainting or over-tainting.
This fix follows MSan's workaround.
https://github.com/llvm/llvm-project/commit/
cb22c67a21e4b5e1ade65141117a70be318be072
It simply resets TLS at restore. This prevents from over-tainting. Although
under-tainting may still happen, a taint flow can be found eventually if we
run a DFSan-instrumented program multiple times. The alternative option is
saving the entire TLS. However the TLS storage takes 2k bytes, and signal calls
could be nested. So it does not seem worth.
This diff fixes sigaction. A following diff will be fixing signal.
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D95642
Florian Hahn [Tue, 2 Feb 2021 17:01:40 +0000 (17:01 +0000)]
[ConstraintElimination] Skip pointer casts.
We should be able to look through pointer casts that do not impact the
value.
Martin Storsjö [Wed, 4 Nov 2020 21:51:12 +0000 (23:51 +0200)]
[libcxx] Implement the canonical function for windows
Differential Revision: https://reviews.llvm.org/D91170
Martin Storsjö [Wed, 4 Nov 2020 21:46:12 +0000 (23:46 +0200)]
[libcxx] Implement the current_path function for windows
Differential Revision: https://reviews.llvm.org/D91169
Louis Dionne [Tue, 2 Feb 2021 19:59:35 +0000 (14:59 -0500)]
[libc++] Add new queues for specific macOS system versions
This will allow running back-deployment testing on macOS only on systems
running the right version of macOS. For the time being, we're cheating
because we don't have actual machines running older than 10.15.
Mehdi Amini [Tue, 2 Feb 2021 20:53:59 +0000 (20:53 +0000)]
Revert "Fix namespace for MLIR Async Runtime"
This reverts commit
b7d80058ff4649d1a15ef930269458dbb17145d9.
The mlir-windows buildbot is broken.
Reid Kleckner [Mon, 1 Feb 2021 23:18:42 +0000 (15:18 -0800)]
Disable CFI in __get_elem to allow casting a pointer to uninitialized memory
Fixes usage of shared_ptr with CFI enabled, which is llvm.org/pr48993.
Differential Revision: https://reviews.llvm.org/D95827
Dave Lee [Mon, 1 Feb 2021 20:01:32 +0000 (12:01 -0800)]
[lldb] Convert assertTrue(a == b) to assertEqual(a, b)
Convert `assertTrue(a == b)` to `assertEqual(a, b)` to produce better failure messages.
These were mostly done via regex search & replace, with some manual fixes.
Differential Revision: https://reviews.llvm.org/D95813
Christopher Tetreault [Tue, 2 Feb 2021 20:09:09 +0000 (12:09 -0800)]
Revert "Ensure that InstructionCost actually implements a total ordering"
This reverts commit
b481cd519e07b3ad2bd3e81c89b0dd8efd68d6bc.
River Riddle [Tue, 2 Feb 2021 19:32:52 +0000 (11:32 -0800)]
[mlir][Pattern] Create a new IRRewriter class to enable sharing code with pattern rewrites
This revision adds two new classes, RewriterBase and IRRewriter. RewriterBase is a new shared base class between IRRewriter and PatternRewriter. PatternRewriter will continue to be the base class used to perform rewrites within a rewrite pattern. IRRewriter on the other hand, is a new class that allows for tracking IR rewrites from outside of a rewrite pattern. In this revision all of the old API from PatternRewriter is moved to RewriterBase, but the distinction between IRRewriter and PatternRewriter is kept on the chance that a necessary API divergence happens in the future.
Currently if you want to have some utility that transforms a piece of IR and share it between pattern and non-pattern code, you have to duplicate it. This revision enables the creation of utilities that can be invoked from rewrite patterns and normal transformation code:
```c++
void someSharedUtility(RewriterBase &rewriter, ...) {
// Some interesting IR mutation here.
}
// Some RewritePattern
LogicalResult MyPattern::matchAndRewrite(Operation *op, PatternRewriter &rewriter) {
...
someSharedUtility(rewriter, ...);
...
}
// Some Pass
void MyPass::runOnOperation() {
...
IRRewriter rewriter(...);
someSharedUtility(rewriter, ...);
}
```
Differential Revision: https://reviews.llvm.org/D94638
Eric Schweitz [Tue, 2 Feb 2021 18:56:50 +0000 (10:56 -0800)]
[flang][NFC] Update the CG rewrite pass.
Add description and dependencies.
Differential Revision: https://reviews.llvm.org/D95888
Hongtao Yu [Fri, 11 Dec 2020 20:18:31 +0000 (12:18 -0800)]
[CSSPGO] Introducing distribution factor for pseudo probe.
Sample re-annotation is required in LTO time to achieve a reasonable post-inline profile quality. However, we have seen that such LTO-time re-annotation degrades profile quality. This is mainly caused by preLTO code duplication that is done by passes such as loop unrolling, jump threading, indirect call promotion etc, where samples corresponding to a source location are aggregated multiple times due to the duplicates. In this change we are introducing a concept of distribution factor for pseudo probes so that samples can be distributed for duplicated probes scaled by a factor. We hope that optimizations duplicating code well-maintain the branch frequency information (BFI) based on which probe distribution factors are calculated. Distribution factors are updated at the end of preLTO pipeline to reflect an estimated portion of the real execution count.
This change also introduces a pseudo probe verifier that can be run after each IR passes to detect duplicated pseudo probes.
A saturated distribution factor stands for 1.0. A pesudo probe will carry a factor with the value ranged from 0.0 to 1.0. A 64-bit integral distribution factor field that represents [0.0, 1.0] is associated to each block probe. Unfortunately this cannot be done for callsite probes due to the size limitation of a 32-bit Dwarf discriminator. A 7-bit distribution factor is used instead.
Changes are also needed to the sample profile inliner to deal with prorated callsite counts. Call sites duplicated by PreLTO passes, when later on inlined in LTO time, should have the callees’s probe prorated based on the Prelink-computed distribution factors. The distribution factors should also be taken into account when computing hotness for inline candidates. Also, Indirect call promotion results in multiple callisites. The original samples should be distributed across them. This is fixed by adjusting the callisites' distribution factors.
Reviewed By: wmi
Differential Revision: https://reviews.llvm.org/D93264
Eric Schweitz [Tue, 2 Feb 2021 17:57:26 +0000 (09:57 -0800)]
[flang][NFC] Update #include.
Differential Revision: https://reviews.llvm.org/D95882
Christopher Tetreault [Tue, 2 Feb 2021 17:14:55 +0000 (09:14 -0800)]
Ensure that InstructionCost actually implements a total ordering
Previously, operator== would consider the actual equality of the pairs
(lhs.Value, lhs.State) == (rhs.Value, rhs.State). However, if an invalid
cost was involved in a call to operator<, only the state would be
compared. Thus, it was not the case that ({2, Invalid} < {3, Invalid} ||
{2, Invalid} > {3, Invalid} || {2, Invalid} == {3, Invalid}).
This patch implements a true total ordering, where cost state is
considered first, then value. While it's not really imporant that
{2, Invalid} be considered to be less than {3, Invalid}, it's not a
problem either. This patch also implements operator== in terms of
operator<, so the two definitions will be kept in sync.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D95803
peter klausler [Mon, 1 Feb 2021 23:23:58 +0000 (15:23 -0800)]
[flang] Implement IEEE_SUPPORT_xxx inquiry functions
Implement IEEE_SUPPORT_DATATYPE() and other inquiry intrinisic
functions from the intrinsic module IEEE_ARITHMETIC, folding all of
their results to .TRUE.
Differential Revision: https://reviews.llvm.org/D95830
peter klausler [Mon, 1 Feb 2021 23:26:48 +0000 (15:26 -0800)]
[flang] Detect UBOUND() error on assumed-size array
UBOUND() is not allowed on the last dimension of an
assumed-size array dummy argument.
Differential Revision: https://reviews.llvm.org/D95831
Fangrui Song [Tue, 2 Feb 2021 19:22:46 +0000 (11:22 -0800)]
[test] Default clang/test to FileCheck --allow-unused-prefixes=false
Matthew Parkinson [Tue, 2 Feb 2021 18:15:19 +0000 (18:15 +0000)]
Fix namespace for MLIR Async Runtime
The MLIR Async runtime uses different namespacing for the header file,
and the definitions of its C API. The header file places the extern "C"
functions inside namespace mlir::runtime, and the definitions are not
in a namespace. This causes issues in cl.exe. It treats the declaration
and definition as different, and thus does not apply dllexport to the
definition, which leads to the mlir_async_runtime.dll containing no
definitions, and the mlir_async_runtime.lib not being generated.
This patch moves the namespace to cover the definitions, and thus
generates the dll correctly on Windows with cl.exe.
This was tested with Visual Studio C++ 19.28.29336.
Differential Revision: https://reviews.llvm.org/D95386
Michał Górny [Tue, 2 Feb 2021 19:09:45 +0000 (13:09 -0600)]
[MLIR] [CMake] Support building MLIR standalone
Add the necessary bits to CMakeLists to make it possible to configure
MLIR against installed LLVM, and build it with minimal need for LLVM
source tree. The latter is only necessary to run unittests, and if it
is missing then unittests are skipped with a warning.
This change includes the necessary changes to tests, in particular
adding some missing substitutions and defining missing variables
for lit.site.cfg.py substitution.
Reviewed By: stephenneuendorffer
Differential Revision: https://reviews.llvm.org/D85464
Co-authored-by: Isuru Fernando <isuruf@gmail.com>
Christian Sigg [Tue, 2 Feb 2021 14:42:16 +0000 (15:42 +0100)]
[mlir] Delay adding the __resume function
The __resume function trips up LLVM's 'X86 DAG->DAG Instruction Selection' unless optimizations are disabled.
Only adding the __resume function when it's needed allows lowering through AsyncToLLVM and LLVM without '-O0' as long as the coroutine functionality is not used.
Reviewed By: ezhulenev
Differential Revision: https://reviews.llvm.org/D95868
Mehdi Amini [Tue, 2 Feb 2021 18:47:10 +0000 (18:47 +0000)]
Fix CMake LLVM_TARGETS_TO_BUILD "Native" option to work with JIT
LLVM_TARGETS_TO_BUILD accepts both "host" or "Native" for auto-selecting
the target from the environment. However the way "Native" was plumbed
would lead to the JIT environment being disabled. This patch is making
"Native" works just as "host".
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D95837
Fraser Cormack [Tue, 2 Feb 2021 14:40:52 +0000 (14:40 +0000)]
[RISCV] Fix incorrect RVV sdiv/udiv lowering
Due to a clerical error, the sdiv operation was mapping to vdivu and
udiv to vdiv, when the opposite mapping is the correct one.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D95869
Craig Topper [Tue, 2 Feb 2021 18:32:14 +0000 (10:32 -0800)]
[RISCV] Correct types in tablegen multiclasses found by D95874.
Vladislav Vinogradov [Tue, 2 Feb 2021 18:33:08 +0000 (18:33 +0000)]
[mlir] Return new Operation from `Rewriter::replaceOpWithNewOp`
It will allow to perform additional manipulation with the newly created Operation.
For example, custom attributes propagation/changes.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D95525
Jonas Devlieghere [Tue, 2 Feb 2021 18:28:59 +0000 (10:28 -0800)]
[debugserver] Fix -Wmissing-field-initializers warnings on arm64
Vladislav Vinogradov [Tue, 2 Feb 2021 18:27:26 +0000 (18:27 +0000)]
[mlir] Print more verbose message in case of type inference error
Include the types into the error message.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D95854
Vladislav Vinogradov [Tue, 2 Feb 2021 18:26:31 +0000 (18:26 +0000)]
[mlir] Allow to use constant lambda as callbacks for `TypeConverter`
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D95787
Vladislav Vinogradov [Tue, 2 Feb 2021 18:26:05 +0000 (18:26 +0000)]
[mlir][NFC] Add missing include guards to MlirOptMain.h
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D95533
Vladislav Vinogradov [Tue, 2 Feb 2021 18:24:06 +0000 (18:24 +0000)]
[mlir][NFC] Use explicit `mlir` namespace in generated code
This makes the generated code independent from actual namespace of its users.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D95520
Jonas Devlieghere [Tue, 2 Feb 2021 18:23:22 +0000 (10:23 -0800)]
[debugserver] Fix -Wsign-compare warnings on arm64
Fangrui Song [Tue, 2 Feb 2021 18:23:14 +0000 (10:23 -0800)]
[ConstraintElimination] Fix -Wunused-function in -DLLVM_ENABLE_ASSERTIONS=off build
Craig Topper [Tue, 2 Feb 2021 18:05:33 +0000 (10:05 -0800)]
[RISCV] Use a ComplexPattern to merge isel patterns for vector load/store with GPR and FrameIndex addresses.
This reduces the isel table size by about 3000 bytes.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D95844
Jonas Devlieghere [Tue, 2 Feb 2021 18:19:23 +0000 (10:19 -0800)]
[debugserver] Fix -Wunused-function warnings on arm64
Mike Rice [Tue, 2 Feb 2021 04:17:56 +0000 (20:17 -0800)]
[OpenMP] Fix iterations calculation for dependent counters.
The number of iterations calculation was failing in some cases with more
than two collpased loops. Now the LoopIterationSpace selected matches
InitDependOnLC and CondDependOnLC.
Differential Revision: https://reviews.llvm.org/D95834
Greg McGary [Tue, 19 Jan 2021 15:44:42 +0000 (07:44 -0800)]
[lld-macho][NFC] refactor relocation handling
Add per-reloc-type attribute bits and migrate code from per-target file into target independent code, driven by reloc attributes.
Many cleanups
Differential Revision: https://reviews.llvm.org/D95121
Martin Storsjö [Wed, 4 Nov 2020 21:32:13 +0000 (23:32 +0200)]
[libcxx] Implement the space function for windows
Differential Revision: https://reviews.llvm.org/D91168
Fangrui Song [Tue, 2 Feb 2021 17:47:06 +0000 (09:47 -0800)]
[ELF] Delete unused --warn-ifunc-textrel
The option catches incompatibility between `R_*_IRELATIVE` and DT_TEXTREL/DF_TEXTREL
before glibc 2.29. Newer glibc versions are more common nowadays and I don't
think this option has ever been used. Diagnosing this problem is also
straightforward by reading the stack trace.
Hongtao Yu [Fri, 22 Jan 2021 23:52:46 +0000 (15:52 -0800)]
[CSSPGO] Passing the clang driver switch -fpseudo-probe-for-profiling to the linker.
As titled.
Reviewed By: wmi, wenlei
Differential Revision: https://reviews.llvm.org/D95271
Jonas Devlieghere [Tue, 2 Feb 2021 17:40:08 +0000 (09:40 -0800)]
[debugserver] Fix -Winconsistent-missing-override warnings on arm64
Fangrui Song [Tue, 2 Feb 2021 17:41:05 +0000 (09:41 -0800)]
[MC] Upgrade DWARF version to 5 upon .file 0
Without `-dwarf-version`, llvm-mc uses the default `MCContext::DwarfVersion` 4.
Without `-gdwarf-N`, Clang cc1as uses `clang::driver::ToolChain::GetDefaultDwarfVersion`
which is 4 on many toolchains. Note: `clang -c` can synthesize .debug_info without -g.
There is currently a MCParser warning upon `.file 0` and MCParser errors upon
`.loc 0` if the DWARF version is less than 5. This causes friction to the
following usage:
```
clang -S -g -gdwarf-5 a.c
// MC warning due to .file 0, MC error due to .loc 0
clang -c a.s
llvm-mc -filetype=obj a.s
```
My idea is that we can just upgrade `MCContext::DwarfVersion` to 5 upon
`.file 0` to make the above commands work.
The downside is that for an explicit version `clang -c -gdwarf-4 a.s`, it can be
argued that the new behavior drops the probably intended diagnostic. I think the
downside is small because in most cases DWARF version for an assembly action
should either match the original compile action or be omitted.
Ongoing discussion taking a similar action for GNU as: https://sourceware.org/pipermail/binutils/2021-January/114980.html
Differential Revision: https://reviews.llvm.org/D94882
Florian Hahn [Tue, 2 Feb 2021 16:59:18 +0000 (16:59 +0000)]
[ConstraintElimination] Add test with pointer bitcast.
Fangrui Song [Tue, 2 Feb 2021 17:35:27 +0000 (09:35 -0800)]
[test] Add basic _Unwind_ForcedUnwind + exception tests
Forced unwinding is like a foreign exception, which can be caught by `catch (...)` and rethrown.
If not rethrown, `__cxa_end_cath` will call `_Unwind_DeleteException` to destroy the object.
The behavior going through empty `throw()` and non-empty `throw(int)` is not
clear (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98785), so I do not add such
tests.
Differential Revision: https://reviews.llvm.org/D95200
Fangrui Song [Tue, 2 Feb 2021 17:34:08 +0000 (09:34 -0800)]
[MC] Support SHF_GNU_RETAIN as section flag 'R'
On Linux target triples, GNU as sets EI_OSABI to ELFOSABI_GNU when SHF_GNU_RETAIN is used。
On `*-*-freebsd`, it usually sets EI_OSABI to ELFOSABI_FREEBSD.
GNU ld respects SHF_GNU_RETAIN only for ELFOSABI_FREEBSD/ELFOSABI_GNU.
https://sourceware.org/bugzilla/show_bug.cgi?id=27282
MC doesn't set ELFOSABI_GNU for SHF_GNU_RETAIN/STB_GNU_UNIQUE/STT_GNU_IFUNC.
MC assembled object files do not have special semantics in GNU ld.
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D95730
Fangrui Song [Tue, 2 Feb 2021 17:19:53 +0000 (09:19 -0800)]
[yaml2obj/obj2yaml/llvm-readobj] Support SHF_GNU_RETAIN
In binutils, the flag is defined for ELFOSABI_GNU and ELFOSABI_FREEBSD.
It can be used to mark a section as a GC root.
In practice, the flag has generic semantics and can be applied to many
EI_OSABI values, so we consider it generic.
Differential Revision: https://reviews.llvm.org/D95728
Sanjay Patel [Tue, 2 Feb 2021 16:02:07 +0000 (11:02 -0500)]
[ExpandReductions] add test for fmin with FMF; NFC
Jeroen Dobbelaere [Tue, 2 Feb 2021 16:55:06 +0000 (17:55 +0100)]
[InlineFunction] Only update noalias scopes once for an instruction.
Inlining sometimes maps different instructions to be inlined onto the same instruction.
We must ensure to only remap the noalias scopes once. Otherwise the scope might disappear (at best).
This patch ensures that we only replace scopes for which the mapping is known.
This approach is preferred over tracking which instructions we already handled in a SmallPtrSet,
as that one will need more memory.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D95862
David Green [Tue, 2 Feb 2021 16:55:31 +0000 (16:55 +0000)]
[ARM] Correct some tablegen operand types. NFC
Peyton, Jonathan L [Tue, 2 Feb 2021 16:38:33 +0000 (10:38 -0600)]
[OpenMP] Fix sign comparison warnings from GCC
New affinity patch introduced legitimate sign-compare warnings that
clang doesn't report but GCC-10 does. This removes the warnings by
changing two variables types to unsigned.
Differential Revision: https://reviews.llvm.org/D95818
Eric Schweitz [Mon, 1 Feb 2021 23:18:37 +0000 (15:18 -0800)]
[flang][NFC] Update #include and comment.
Differential Revision: https://reviews.llvm.org/D95828
Florian Hahn [Tue, 2 Feb 2021 15:27:58 +0000 (15:27 +0000)]
[ConstraintElimination] Add nicer way to dump constraints (NFC).
Use ConstraintSystem::dump(Names) to display the result of decomposing a
condition.
David Green [Tue, 2 Feb 2021 16:35:47 +0000 (16:35 +0000)]
[ARM] Mark MVE_VMOV_to_lane_32 as isInsertSubregLike
This allows the peephole optimizer to know that a MVE_VMOV_to_lane_32 is
the same as an insert subreg, allowing it to optimize some redundant
lane moves.
Differential Revision: https://reviews.llvm.org/D95433
Anastasia Stulova [Tue, 2 Feb 2021 16:15:28 +0000 (16:15 +0000)]
Fixed failing OpenCL test
Sebastian Neubauer [Tue, 2 Feb 2021 16:08:57 +0000 (17:08 +0100)]
[AMDGPU] Remove unused tmp register
The temporary register is only used to compute the frame pointer.
The frame pointer is overwritten and not used in between, so we
can reuse the frame pointer for the computation, saving one register.
Differential Revision: https://reviews.llvm.org/D95865
Sebastian Neubauer [Mon, 1 Feb 2021 15:38:50 +0000 (16:38 +0100)]
[AMDGPU] Save fp/bp after csr saves
Saving callee-save registers happens in whole wave mode. Exec is saved
to a free register, which can be reused to save the frame pointer.
Therefore, saving the fp needs to happen after saving csrs.
Differential Revision: https://reviews.llvm.org/D95861
Lei Zhang [Tue, 2 Feb 2021 16:13:39 +0000 (11:13 -0500)]
Revert "[mlir] Fix scf.for single iteration canonicalization check"
This reverts commit
b2b35697dc5172ab1e815e08c0a2714f2a1a9330.
It gotten accidentially landed before LGTM.
Lei Zhang [Tue, 2 Feb 2021 16:08:39 +0000 (11:08 -0500)]
[mlir][spirv] Define sp.VectorShuffle
This patch adds basic op definition, parser/printer, and verifier.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D95825
Lei Zhang [Tue, 2 Feb 2021 13:30:10 +0000 (08:30 -0500)]
[mlir] Fix scf.for single iteration canonicalization check
We should be check whether lb + step >= ub to determine
whether this is a single iteration. Previously we were
checking lb + lb >= ub.
Differential Revision: https://reviews.llvm.org/D95440
Zarko Todorovski [Tue, 2 Feb 2021 15:56:15 +0000 (10:56 -0500)]
[AIX] Improve option processing for mabi=vec-extabi and mabi=vec=defaul
Opening this revision to better address comments by @hubert.reinterpretcast in https://reviews.llvm.org/rGcaaaebcde462
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D95702
Wenlei He [Wed, 20 Jan 2021 07:29:14 +0000 (23:29 -0800)]
[CSSPGO] Factor out common part for CSSPGO inline and AFDO inline
Refactoring SampleProfileLoader::inlineHotFunctions to use helpers from CSSPGO inlining and reduce similar code in the inlining loop, plus minor cleanup for AFDO path.
This is resubmit of D95024, with build break and overtighten assertion fixed.
Test Plan:
Joseph Huber [Tue, 2 Feb 2021 15:48:36 +0000 (10:48 -0500)]
[OpenMP][NFC] Adding FAQ Entry for errors with static libraries
Stefan Pintilie [Tue, 2 Feb 2021 12:07:50 +0000 (06:07 -0600)]
[PowerPC] Materialize 34 bit constants with pli on Power 10.
NOTE: This patch was originally written by Anil Mahmud. His code has been
rebased but otherwise left mostly unchanged.
A new instructon on Power 10 allows for the materialization of 34 bit
immediate values. This patch allows the compiler to take advantage of
the new instruction in this situation.
Reviewed By: amyk
Differential Revision: https://reviews.llvm.org/D92879
David Green [Tue, 2 Feb 2021 15:15:04 +0000 (15:15 +0000)]
[ARM] Add MVE insert-of-extract pattern
A v4i32 insert of an extract can become a simple lane move, as opposed
to round-tripping via a GPR. This adds a patterns that turns an v4i32
insert-extract pair into a EXTRACT_SUBREG/INSERT_SUBREG, with the
required COPY_TO_REGCLASS. These get better optimized into a simple lane
move by the rest of the backend.
Differential Revision: https://reviews.llvm.org/D95428
Stephen Kelly [Tue, 2 Feb 2021 15:11:40 +0000 (15:11 +0000)]
Ensure that the matcher is instantiated
Fix issue diagnosed by Windows linker.
Anastasia Stulova [Tue, 2 Feb 2021 13:00:09 +0000 (13:00 +0000)]
[OpenCL] Add diagnostics for references to functions
Restrict use of references to functions as they can
result in non-conforming behavior.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D95442
Melanie Blower [Tue, 2 Feb 2021 15:06:25 +0000 (07:06 -0800)]
[clang][PATCH][NFC] Correct test case related to review D95482
Lei Zhang [Tue, 2 Feb 2021 15:03:29 +0000 (10:03 -0500)]
[mlir] Put template specialization in the same namespace
This should address GCC 5 failure due to specialization of
runStrategy in different namespace.
Roman Lebedev [Tue, 2 Feb 2021 13:59:47 +0000 (16:59 +0300)]
[InstCombine] Host inversion out of ashr's value operand (PR48995)
This is a yet another hint that we will eventually need InstCombineInverter,
which would consistently sink inversions, but but for that we'll need
to consistently hoist inversions where possible, so let's do that here.
Example of a proof: https://alive2.llvm.org/ce/z/78SbDq
See https://bugs.llvm.org/show_bug.cgi?id=48995
Roman Lebedev [Tue, 2 Feb 2021 13:54:55 +0000 (16:54 +0300)]
[NFC][InstCombine] Add tests for (~x) a>> y --> ~(x a>> y) fold (PR48995)
See https://bugs.llvm.org/show_bug.cgi?id=48995
Ben Shi [Tue, 2 Feb 2021 14:45:52 +0000 (22:45 +0800)]
[AVR][clang] Fix a bug in AVR toolchain search paths
Reviewed By: dylanmckay, MaskRay
Differential Revision: https://reviews.llvm.org/D95529
Sam McCall [Tue, 2 Feb 2021 14:20:18 +0000 (15:20 +0100)]
[clangd] Fix race in Global CDB shutdown
I believe the atomic write can be reordered after the notify, and that
seems to be happening on mac m1: http://45.33.8.238/macm1/2654/step_8.txt
In practice maybe seq_cst is enough? But no reason not to lock here.
https://bugs.llvm.org/show_bug.cgi?id=48998
Stephen Kelly [Sat, 30 Jan 2021 16:19:43 +0000 (16:19 +0000)]
[ASTMatchers] Ignore parts of BindingDecls which are not spelled in source
Differential Revision: https://reviews.llvm.org/D95740
Tom Weaver [Tue, 2 Feb 2021 14:19:31 +0000 (14:19 +0000)]
Revert "[InstrProfiling] Use !associated metadata for counters, data and values"
This reverts commit
df3e39f60b356ca9dbfc11e96e5fdda30afa7acb.
introduced failing test instrprof-gc-sections.c
causing build bot to fail:
http://lab.llvm.org:8011/#/builders/53/builds/1184
David Green [Tue, 2 Feb 2021 14:16:42 +0000 (14:16 +0000)]
[ARM] Extra shuffle tests. NFC
Kent Sommer [Tue, 2 Feb 2021 13:41:55 +0000 (14:41 +0100)]
[clang-format] Add case aware include sorting.
Adds an option to [clang-format] which sorts headers in an alphabetical manner using case only for tie-breakers. The options is off by default in favor of the current ASCIIbetical sorting style.
Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D95017
Stephen Kelly [Sat, 30 Jan 2021 15:50:44 +0000 (15:50 +0000)]
[ASTMatchers] Add matchers for decomposition decls
Differential Revision: https://reviews.llvm.org/D95739
David Green [Tue, 2 Feb 2021 13:50:02 +0000 (13:50 +0000)]
[ARM] Select VINS from vector inserts
This patch adds tablegen patterns for pairs of i16/f16 insert/extracts.
If we are inserting into two adjacent vector lanes (0 and 1 for
example), we can use either a vmov;vins or vmovx;vins to insert the pair
together, avoiding a round-trip from GRP registers. This is quite a
large patterns with a number of EXTRACT_SUBREG/INSERT_SUBREG/
COPY_TO_REGCLASS nodes, but hopefully as most of those become copies all
that will be cleaned up by further optimizations.
The VINS pattern was also adjusted to allow it to represent that it is
inserting into the top half of an existing register.
Differential Revision: https://reviews.llvm.org/D95381
Simon Pilgrim [Tue, 2 Feb 2021 12:52:10 +0000 (12:52 +0000)]
[X86][SSE] LowerINSERT_VECTOR_ELT - pull out repeated EltSizeInBits calls. NFCI.
Raphael Isemann [Tue, 2 Feb 2021 13:41:41 +0000 (14:41 +0100)]
Revert "[lldb] Use current execution context in SBDebugger"
This reverts commit
754ab803b8dc659e3645d369d1b5d6d2f97be29e.
As pointed out in https://reviews.llvm.org/D95761, this patch could lead to
having the wrong execution context in some situations (thanks Jim!).
D92164 is addressing the same issue and will replace this patch, so I'll
revert this one.
Sander de Smalen [Tue, 2 Feb 2021 12:50:18 +0000 (12:50 +0000)]
NFC: Migrate SpeculateAroundPHIs to work on InstructionCost
This patch migrates cost values and arithmetic to work on InstructionCost.
When the interfaces to TargetTransformInfo are changed, any InstructionCost
state will propagate naturally.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Reviewed By: ctetreau
Differential Revision: https://reviews.llvm.org/D95353
Sander de Smalen [Tue, 2 Feb 2021 12:28:20 +0000 (12:28 +0000)]
NFC: Migrate SimpleLoopUnswitch to work on InstructionCost
This patch migrates cost values and arithmetic to work on InstructionCost.
When the interfaces to TargetTransformInfo are changed, any InstructionCost
state will propagate naturally.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D95352