Marco Vanotti [Fri, 28 Aug 2020 22:42:09 +0000 (15:42 -0700)]
[clang] Enable -fsanitize=thread on Fuchsia.
This CL modifies clang enabling using -fsanitize=thread on fuchsia. The
change doesn't build the runtime for fuchsia, it just enables the
instrumentation to be used.
pair-programmed-with: mdempsky@google.com
Change-Id: I816c4d240d1f15e9eae2803fb8ba3a7bf667ed51
Reviewed By: mcgrathr, phosek
Differential Revision: https://reviews.llvm.org/D86822
Pete Couperus [Tue, 25 Aug 2020 18:17:06 +0000 (11:17 -0700)]
[ARC] Update brcc test.
Owen Anderson [Fri, 28 Aug 2020 23:32:25 +0000 (23:32 +0000)]
Revert "[InstSimplify][EarlyCSE] Try to CSE PHI nodes in the same basic block"
This reverts commit
6102310d814ad73eab60a88b21dd70874f7a056f. It
appears to cause compilation non-determinism and caused stage3
mismatches.
Fangrui Song [Fri, 28 Aug 2020 23:32:35 +0000 (16:32 -0700)]
[gcov] Increment counters with atomicrmw if -fsanitize=thread
Without this patch, `clang --coverage -fsanitize=thread` may fail spuriously
because non-atomic counter increments can be detected as data races.
Jonas Devlieghere [Fri, 28 Aug 2020 22:43:35 +0000 (15:43 -0700)]
[lldb] Get rid of LLDB_LIB_DIR and LLDB_IMPLIB_DIR in dotest
This patch removes the rather confusing LLDB_LIB_DIR and LLDB_IMPLIB_DIR
environment variables. They are confusing because LLDB_LIB_DIR would
point to the bin subdirectory in the build root while LLDB_IMPLIB_DIR
would point to the lib subdirectory. The reason far this was
LLDB.framework, which gets build under bin.
This patch replaces their uses with configuration.lldb_framework_path
and configuration.lldb_libs_dir respectively.
Differential revision: https://reviews.llvm.org/D86817
Jonas Devlieghere [Fri, 28 Aug 2020 22:42:43 +0000 (15:42 -0700)]
[lldb] Dervice dotest.py path from config.lldb_src_root (NFC)
Stella Laurenzo [Thu, 27 Aug 2020 06:48:42 +0000 (23:48 -0700)]
Add Location, Region and Block to MLIR Python bindings.
* This is just enough to create regions/blocks and iterate over them.
* Does not yet implement the preferred iteration strategy (python pseudo containers).
* Refinements need to come after doing basic mappings of operations and values so that the whole hierarchy can be used.
Differential Revision: https://reviews.llvm.org/D86683
Matt Arsenault [Fri, 28 Aug 2020 14:43:17 +0000 (10:43 -0400)]
GlobalISel: Combine out redundant sext_inreg
The scalar tests don't work yet, since computeNumSignBits apparently
doesn't handle sextload yet, and sext folds into the load first.
Jon Roelofs [Fri, 28 Aug 2020 21:22:32 +0000 (15:22 -0600)]
[early-ifcvt] Add OptRemarks
Matt Arsenault [Fri, 28 Aug 2020 18:58:33 +0000 (14:58 -0400)]
AMDGPU: Fix incorrectly deleting copies after spilling SGPR tuples
The implicit def of the super register would appear to kill any live
uses of components before the spill, and would be deleted by
MachineCopyPropagation. We need to add implicit uses of the super
register, similarly to what copyPhysReg does. VGPR tuples appear to be
correctly handled already. I need to double check the SGPR->memory
path.
sstefan1 [Fri, 28 Aug 2020 08:19:04 +0000 (10:19 +0200)]
[UpdateTestChecks] include { in function signature check line
After D85099, if we have attribute group in the function signature that hasn't
been seen before, and later a callsite with the same attribute group, filecheck will evaluate
the first attribute group to for example '#0 {'. We now include { in the args_and_sig group to avoid this.
Differential Revision: https://reviews.llvm.org/D86769
Jordan Rupprecht [Fri, 28 Aug 2020 21:27:37 +0000 (14:27 -0700)]
Reland "[test] Exit with an error if no tests are run."
This reverts commit
a06c28df3e8c85ceb665d3d9a1ebc2853dfd87a9 (reland
adb5c23f8c0d60eeec41dcbe21d1b26184e1c97d).
The issue with PExpect tests on Windows should be fixed with
e5e05ecf65aba836802154279efbc8cbce6fe2ea.
Arthur Eubanks [Fri, 28 Aug 2020 21:05:10 +0000 (14:05 -0700)]
[test] Pin some RUNs in potential.ll to legacy PM
There are corresponding NPM RUNs.
Mehdi Amini [Fri, 28 Aug 2020 20:17:38 +0000 (20:17 +0000)]
Rename AnalysisManager::slice in AnalysisManager::nest (NFC)
The naming wasn't reflecting the intent of this API, "nest" is aligning
it with the pass manager API.
Richard Smith [Thu, 27 Aug 2020 23:08:11 +0000 (16:08 -0700)]
Add new warning for compound punctuation tokens that are split across macro expansions or split by whitespace.
For example:
#define FOO(x) (x)
FOO({});
... forms a statement-expression after macro expansion. This warning
applies to '({' and '})' delimiting statement-expressions, '[[' and ']]'
delimiting attributes, and '::*' introducing a pointer-to-member.
The warning for forming these compound tokens across macro expansions
(or across files!) is enabled by default; the warning for whitespace
within the tokens is not, but is included in -Wall.
Differential Revision: https://reviews.llvm.org/D86751
Craig Topper [Fri, 28 Aug 2020 20:02:42 +0000 (13:02 -0700)]
[Attributes] Add a method to check if an Attribute has AttrKind None. Use instead of hasAttribute(Attribute::None)
There's a special case in hasAttribute for None when pImpl is null. If pImpl is not null we dispatch to pImpl->hasAttribute which will always return false for Attribute::None.
So if we just want to check for None its sufficient to just check that pImpl is null. Which can even be done inline.
This patch adds a helper for that case which I hope will speed up our getSubtargetImpl implementations.
Differential Revision: https://reviews.llvm.org/D86744
Victor Huang [Fri, 28 Aug 2020 20:09:17 +0000 (15:09 -0500)]
[LLD][PowerPC] Remove redundant file write out in the test cases
Fix the time out test failure on lld-x86_64-freebsd build bot.
Peer reviewed by: stefanp, nemanjai
Arthur Eubanks [Wed, 15 Jul 2020 16:33:48 +0000 (09:33 -0700)]
[ObjCARCOpt] Port objc-arc to NPM
Since doInitialization() in the legacy pass modifies the module, the NPM
pass is a Module pass.
Reviewed By: ahatanak, ychen
Differential Revision: https://reviews.llvm.org/D86178
Tyker [Fri, 28 Aug 2020 19:46:16 +0000 (21:46 +0200)]
[SROA] Improve handleling of assumes bundles by SROA
This patch fixes this crash https://gcc.godbolt.org/z/Ps8d1e
And gives SROA the ability to remove assumes if it allows promoting an alloca to register
Without removing assumes when it can't promote to register.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86570
Nikita Popov [Wed, 26 Aug 2020 20:27:52 +0000 (22:27 +0200)]
[InstCombine] usub.sat(a, b) + b => umax(a, b) (PR42178)
Fixes https://bugs.llvm.org/show_bug.cgi?id=42178 by folding
usub.sat(a, b) + b to umax(a, b). The backend will expand umax
back to usubsat if that is profitable.
We may also want to handle uadd.sat(a, b) - b in the future.
Differential Revision: https://reviews.llvm.org/D63060
Alexey Bataev [Fri, 28 Aug 2020 12:53:42 +0000 (08:53 -0400)]
[LIBOMPTARGET]Do not try to optimize bases for the next parameters.
PrivateArgumentManager shall immediately allocate firstprivates if they
are bases for the next parameters and the next paramaters rely on the
fact that the base musst be allocated already.
Differential Revision: https://reviews.llvm.org/D86781
serge-sans-paille [Fri, 28 Aug 2020 08:24:48 +0000 (10:24 +0200)]
Skip analysis re-computation when no changes are reported
This is a follow-up to https://reviews.llvm.org/D80707, generalized to
CallGraphSCC, Loop and Region
Differential Revision: https://reviews.llvm.org/D86442
Sjoerd Meijer [Fri, 28 Aug 2020 13:51:52 +0000 (14:51 +0100)]
[ARM] Skip combining base updates for vld1x NEON intrinsics
Skip this for now, to avoid a backend crash in:
UNREACHABLE executed at llvm/lib/Target/ARM/ARMISelLowering.cpp:13412
This should fix PR45824.
Differential Revision: https://reviews.llvm.org/D86784
Benjamin Kramer [Fri, 28 Aug 2020 19:14:20 +0000 (21:14 +0200)]
Strength-reduce SmallVectors to arrays. NFCI.
Benjamin Kramer [Fri, 28 Aug 2020 17:31:36 +0000 (19:31 +0200)]
[CodeGenPrepare] Zap the argument of llvm.assume when deleting it
We know that the argument is mostly likely dead, so we can purge it
early. Otherwise it would make it to codegen, and can block further
optimizations.
Jordan Rupprecht [Fri, 28 Aug 2020 18:49:50 +0000 (11:49 -0700)]
[lldb/test] Use shorter test case names in TestStandardUnwind
TestStandardUnwind uses the full absolute path to a set of C/C++ files as the test case name, which in turn is used in the name of a log file. When the source file is long, and the directory where log files are stored is also long, this causes an OSError because the log filename is too long.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D86752
Jonas Devlieghere [Fri, 28 Aug 2020 18:41:47 +0000 (11:41 -0700)]
[lldb] Fix typo in disassemble_options_line description
Jordan Rupprecht [Fri, 28 Aug 2020 18:41:07 +0000 (11:41 -0700)]
[lldb/test] Use @skipIfWindows for PExpectTest
Annotating `PExpectTest` with `@skipIfWindows` instead of marking it as an empty class will make the test runner recognize it as a test class, which should allow me to reland
adb5c23f8c0d60eeec41dcbe21d1b26184e1c97d.
I don't have a windows machine to verify this works, but I did some tests using `@skipIfLinux` and they all worked as expected. In case the `pexpect` import is not at all available on windows, I moved it to within the method where it's used.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D86745
LLVM GN Syncbot [Fri, 28 Aug 2020 18:14:11 +0000 (18:14 +0000)]
[gn build] Port
94faadaca4e
Snehasish Kumar [Wed, 5 Aug 2020 22:34:31 +0000 (15:34 -0700)]
[llvm][CodeGen] Machine Function Splitter
We introduce a codegen optimization pass which splits functions into hot and cold
parts. This pass leverages the basic block sections feature recently
introduced in LLVM from the Propeller project. The pass targets
functions with profile coverage, identifies cold blocks and moves them
to a separate section. The linker groups all cold blocks across
functions together, decreasing fragmentation and improving icache and
itlb utilization.
We evaluated the Machine Function Splitter pass on clang bootstrap and
SPECInt 2017.
For clang bootstrap we observe a mean 2.33% runtime improvement with a
~32% reduction in itlb and stlb misses. Additionally, L1 icache misses
reduced by 9.5% while L2 instruction misses reduced by 20%.
For SPECInt we report the change in IntRate the C/C++
benchmarks. All benchmarks apart from mcf and x264 improve, on average
by 0.6% with the max for deepsjeng at 1.6%.
Benchmark % Change
500.perlbench_r 0.78
502.gcc_r 0.82
505.mcf_r -0.30
520.omnetpp_r 0.18
523.xalancbmk_r 0.37
525.x264_r -0.46
531.deepsjeng_r 1.61
541.leela_r 0.83
557.xz_r 0.15
Differential Revision: https://reviews.llvm.org/D85368
Anna Welker [Fri, 28 Aug 2020 15:27:23 +0000 (16:27 +0100)]
[ARM][MVE] Enable MVE gathers and scatters by default
Enable MVE gather/scatters by default, which requires some
minor adaptations in some tests.
Differential revision: https://reviews.llvm.org/D86776
Tim Keith [Fri, 28 Aug 2020 17:30:23 +0000 (10:30 -0700)]
[flang][NFC] Change how error symbols are recorded
When an error is associated with a symbol, it was marked with a flag
from Symbol::Flag. The problem with that is that you need a mutable
symbol to do that. Instead, store the set of error symbols in the
SemanticsContext. This allows for some const_casts to be eliminated.
Also, improve the internal error that occurs if SetError is called
but no fatal error has been reported.
Differential Revision: https://reviews.llvm.org/D86740
Louis Dionne [Fri, 28 Aug 2020 16:31:16 +0000 (12:31 -0400)]
[libc++] Un-deprecate and un-remove some members of std::allocator
This implements the part of P0619R4 related to the default allocator.
This is incredibly important, since otherwise there is an ABI break
between C++17 and C++20 w.r.t. the default allocator's size_type on
platforms where std::size_t is not the same as std::make_unsigned<std::ptrdiff_t>.
David Green [Fri, 28 Aug 2020 16:48:15 +0000 (17:48 +0100)]
[ARM] Correct predicate operand for offset gather/scatter
These arm_mve_vldr_gather_offset_predicated and
arm_mve_vstr_scatter_offset_predicated have some extra parameters
meaning the predicate is at a later operand. If a loop contains _only_
those masked instructions, we would miss transforming the active lane
mask.
Differential Revision: https://reviews.llvm.org/D86791
David Green [Fri, 28 Aug 2020 16:14:40 +0000 (17:14 +0100)]
[ARM] Extra gather scatter tailpred test. NFC
Albion Fung [Fri, 28 Aug 2020 16:27:07 +0000 (11:27 -0500)]
[PowerPC] Implemented Vector Load with Zero and Signed Extend Builtins
This patch implements the builtins for Vector Load with Zero and Signed Extend Builtins (lxvr_x for b, h, w, d), and adds the appropriate test cases for these builtins. The builtins utilize the vector load instructions itnroduced with ISA 3.1.
Differential Revision: https://reviews.llvm.org/D82502#inline-797941
Denis Antrushin [Thu, 27 Aug 2020 12:51:30 +0000 (19:51 +0700)]
[Statepoint] Always spill base pointer.
There is a subtle problem with new statepoint lowering scheme
when base and pointers are the same (see PR46917 for more context):
%1 = STATEPOINT ... %0, %0(tied-def 0)...
if, for some reason, register allocator desides to put two instances
of %0 into two different objects (registers or spill slots), we may
end up with
$reg3 = STATEPOINT ... $reg2, $reg1(tied-def 0)...
and nothing will prevent later passes to sink uses of $reg2 below
statepoint, which is incorrect.
As a short term solution, always put base pointers on stack during
lowering.
A longer term solution may be to rework MIR statepoint format to
avoid GC pointer duplication in statepoint argument list.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D86712
Shilei Tian [Fri, 28 Aug 2020 16:19:35 +0000 (12:19 -0400)]
[OpenMP] Fixed wrong test command in the test private_mapping.c
The test command in `private_mapping.c` was set to expect failure by mistake. It is fixed in this patch.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D86758
Yonghong Song [Fri, 28 Aug 2020 16:07:20 +0000 (09:07 -0700)]
[GlobalISel] fix a compilation error with gcc 6.3.0
With gcc 6.3.0, I hit the following compilation error:
../lib/CodeGen/GlobalISel/Combiner.cpp: In member function
‘bool llvm::Combiner::combineMachineInstrs(llvm::MachineFunction&,
llvm::GISelCSEInfo*)’:
../lib/CodeGen/GlobalISel/Combiner.cpp:156:54: error: suggest parentheses
around ‘&&’ within ‘||’ [-Werror=parentheses]
assert(!CSEInfo || !errorToBool(CSEInfo->verify()) &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
"CSEInfo is not consistent. Likely missing calls to "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"observer on mutations");
Fix the code as suggested by the compiler.
QingShan Zhang [Fri, 28 Aug 2020 15:21:47 +0000 (15:21 +0000)]
[DAGCombine] Don't delete the node if it has uses immediately
This is the follow up patch for https://reviews.llvm.org/D86183 as we miss to delete the node if NegX == NegY, which has use after we create the node.
```
if (NegX && (CostX <= CostY)) {
Cost = std::min(CostX, CostZ);
RemoveDeadNode(NegY);
return DAG.getNode(Opcode, DL, VT, NegX, Y, NegZ, Flags); #<-- NegY is used here if NegY == NegX.
}
```
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D86689
Cullen Rhodes [Tue, 11 Aug 2020 14:30:02 +0000 (14:30 +0000)]
Reland "[CodeGen][AArch64] Support arm_sve_vector_bits attribute"
This relands D85743 with a fix for test
CodeGen/attr-arm-sve-vector-bits-call.c that disables the new pass
manager with '-fno-experimental-new-pass-manager'. Test was failing due
to IR differences with the new pass manager which broke the Fuchsia
builder [1]. Reverted in 2e7041f.
[1] http://lab.llvm.org:8011/builders/fuchsia-x86_64-linux/builds/10375
Original summary:
This patch implements codegen for the 'arm_sve_vector_bits' type
attribute, defined by the Arm C Language Extensions (ACLE) for SVE [1].
The purpose of this attribute is to define vector-length-specific (VLS)
versions of existing vector-length-agnostic (VLA) types.
VLSTs are represented as VectorType in the AST and fixed-length vectors
in the IR everywhere except in function args/return. Implemented in this
patch is codegen support for the following:
* Implicit casting between VLA <-> VLS types.
* Coercion of VLS types in function args/return.
* Mangling of VLS types.
Casting is handled by the CK_BitCast operation, which has been extended
to support the two new vector kinds for fixed-length SVE predicate and
data vectors, where the cast is implemented through memory rather than a
bitcast which is unsupported. Implementing this as a normal bitcast
would require relaxing checks in LLVM to allow bitcasting between
scalable and fixed types. Another option was adding target-specific
intrinsics, although codegen support would need to be added for these
intrinsics. Given this, casting through memory seemed like the best
approach as it's supported today and existing optimisations may remove
unnecessary loads/stores, although there is room for improvement here.
Coercion of VLSTs in function args/return from fixed to scalable is
implemented through the AArch64 ABI in TargetInfo.
The VLA and VLS types are defined by the ACLE to map to the same
machine-level SVE vectors. VLS types are mangled in the same way as:
__SVE_VLS<typename, unsigned>
where the first argument is the underlying variable-length type and the
second argument is the SVE vector length in bits. For example:
#if __ARM_FEATURE_SVE_BITS==512
// Mangled as 9__SVE_VLSIu11__SVInt32_tLj512EE
typedef svint32_t vec __attribute__((arm_sve_vector_bits(512)));
// Mangled as 9__SVE_VLSIu10__SVBool_tLj512EE
typedef svbool_t pred __attribute__((arm_sve_vector_bits(512)));
#endif
The latest ACLE specification (00bet5) does not contain details of this
mangling scheme, it will be specified in the next revision. The
mangling scheme is otherwise defined in the appendices to the Procedure
Call Standard for the Arm Architecture, see [2] for more information.
[1] https://developer.arm.com/documentation/100987/latest
[2] https://github.com/ARM-software/abi-aa/blob/master/aapcs64/aapcs64.rst#appendix-c-mangling
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D85743
Victor Huang [Fri, 28 Aug 2020 15:40:48 +0000 (10:40 -0500)]
[LLD][PowerPC] Add a pc-rel based long branch thunk
In this patch, a pc-rel based long branch thunk is added for the local
call protocol that caller and callee does not use TOC.
Reviewed By: sfertile, nemanjai
Differential Revision: https://reviews.llvm.org/D86706
Alexandre Ganea [Fri, 28 Aug 2020 14:53:20 +0000 (10:53 -0400)]
David Sherwood [Fri, 28 Aug 2020 14:08:46 +0000 (15:08 +0100)]
Fix more build failures caused by
f4257c5832aa51e960e7351929ca3d37031985b7
MLIR build failed after ElementCount refactoring - updated code to
call isScalable() and getKnownMinValue().
David Sherwood [Fri, 28 Aug 2020 13:56:01 +0000 (14:56 +0100)]
David Sherwood [Fri, 14 Aug 2020 11:15:59 +0000 (12:15 +0100)]
[SVE] Make ElementCount members private
This patch changes ElementCount so that the Min and Scalable
members are now private and can only be accessed via the get
functions getKnownMinValue() and isScalable(). In addition I've
added some other member functions for more commonly used operations.
Hopefully this makes the class more useful and will reduce the
need for calling getKnownMinValue().
Differential Revision: https://reviews.llvm.org/D86065
Xing GUO [Fri, 28 Aug 2020 10:42:19 +0000 (18:42 +0800)]
[DWARFYAML] Abbrev codes in a new abbrev table should start from 1 (by default).
The abbrev codes in a new abbrev table should start from 1 (by default),
rather than inherit the value from the code in the previous table.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D86545
Denis Antrushin [Thu, 27 Aug 2020 14:20:25 +0000 (21:20 +0700)]
[Statepoint] Turn assert into check in foldPatchpoint.
Original D81646 had check for tied regs in foldPatchpoint().
Due to unfortunate miscommunication with review comments and
adressing some comments post commit, it turned into assertion.
We had an offline talk and agreed that with current implementation
this path is possible, so I'm changing it back to check.
Note that this is workaround until ussues described in PR46917 are
resolved.
Sam Parker [Fri, 28 Aug 2020 12:56:16 +0000 (13:56 +0100)]
[ARM][LowOverheadLoops] Liveouts and reductions
Remove the code that tried to look for reduction patterns, since the
vectorizer and isel can now produce predicated arithmetic instructios
within the loop body. This has required some reorganisation and fixes
around live-out and predication checks, as well as looking for cases
where an input/output is initialised to zero.
Differential Revision: https://reviews.llvm.org/D86613
Sam Parker [Fri, 28 Aug 2020 12:45:30 +0000 (13:45 +0100)]
[NFC][ARM] Add tail predication test
Benjamin Kramer [Fri, 28 Aug 2020 11:40:06 +0000 (13:40 +0200)]
[SCCP] Use bulk-remove API to bulk-remove attributes. NFCI.
Eduardo Caldas [Fri, 28 Aug 2020 09:23:13 +0000 (09:23 +0000)]
[SyntaxTree] Add coverage for declarators and init-declarators
Eduardo Caldas [Thu, 27 Aug 2020 15:37:04 +0000 (15:37 +0000)]
[SyntaxTree][NFC] Refactor function templates into functions taking base class
The refactored functions were
* `isReponsibleForCreatingDeclaration`
* `getQualifiedNameStart`
Differential Revision: https://reviews.llvm.org/D86719
Benjamin Kramer [Fri, 28 Aug 2020 10:55:42 +0000 (12:55 +0200)]
[FunctionAttrs] Bulk remove attributes. NFC.
Ties Stuij [Fri, 28 Aug 2020 08:31:11 +0000 (09:31 +0100)]
[AArch64][CodeGen] Restrict bfloat vector operations to what's actually supported
Previously in addTypeForNeon, we would set the operations for bfloat vectors
like other generic types. But as bfloat is a storage-only type a number of
operations shouldn't be set. This patch fixes that.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D85101
Alex Richardson [Fri, 28 Aug 2020 10:03:10 +0000 (11:03 +0100)]
[clang-format] Detect pointer qualifiers in cast expressions
When guessing whether a closing paren is then end of a cast expression also
skip over pointer qualifiers while looking for TT_PointerOrReference.
This prevents some address-of and dereference operators from being parsed
as a binary operator.
Before:
x = (foo *const) * v;
x = (foo *const volatile restrict __attribute__((foo)) _Nonnull _Null_unspecified _Nonnull) & v;
After:
x = (foo *const)*v;
x = (foo *const volatile restrict __attribute__((foo)) _Nonnull _Null_unspecified _Nonnull)&v;
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D86716
Alex Richardson [Fri, 28 Aug 2020 10:03:03 +0000 (11:03 +0100)]
[clang-format] Parse nullability attributes as a pointer qualifier
Before:
void f() { MACRO(A * _Nonnull a); }
void f() { MACRO(A * _Nullable a); }
void f() { MACRO(A * _Null_unspecified a); }
After:
void f() { MACRO(A *_Nonnull a); }
void f() { MACRO(A *_Nullable a); }
void f() { MACRO(A *_Null_unspecified a); }
Reviewed By: JakeMerdichAMD
Differential Revision: https://reviews.llvm.org/D86713
Alex Richardson [Fri, 28 Aug 2020 10:03:00 +0000 (11:03 +0100)]
[clang-format] Parse __attribute((foo)) as a pointer qualifier
Before: void f() { MACRO(A * __attribute((foo)) a); }
After: void f() { MACRO(A *__attribute((foo)) a); }
Also check that the __attribute__ alias is handled.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D86711
Alex Richardson [Fri, 28 Aug 2020 10:02:56 +0000 (11:02 +0100)]
[clang-format] Parse restrict as a pointer qualifier
Before: void f() { MACRO(A * restrict a); }
After: void f() { MACRO(A *restrict a); }
Also check that the __restrict and __restrict__ aliases are handled.
Reviewed By: JakeMerdichAMD
Differential Revision: https://reviews.llvm.org/D86710
Alex Richardson [Fri, 28 Aug 2020 10:02:51 +0000 (11:02 +0100)]
[clang-format] Parse volatile as a pointer qualifier
Before: void f() { MACRO(A * volatile a); }
After: void f() { MACRO(A *volatile a); }
Also check that the __volatile and __volatile__ aliases are handled.
Reviewed By: JakeMerdichAMD
Differential Revision: https://reviews.llvm.org/D86708
Florian Hahn [Fri, 28 Aug 2020 09:31:30 +0000 (10:31 +0100)]
[DSE,MemorySSA] Check if Current is valid for elimination first.
This changes getDomMemoryDef to check if a Current is a valid
candidate for elimination before checking for reads. Before the change,
we were spending a lot of compile-time in checking for read accesses for
Current that might not even be removable.
This patch flips the logic, so we skip Current if they cannot be
removed before checking all their uses. This is much more efficient in
practice.
It also adds a more aggressive limit for checking partially overlapping
stores. The main problem with overlapping stores is that we do not know
if they will lead to elimination until seeing all of them. This patch
limits adds a new limit for overlapping store candidates, which keeps
the number of modified overlapping stores roughly the same.
This is another substantial compile-time improvement (while also
increasing the number of stores eliminated). Geomean -O3 -0.67%,
ReleaseThinLTO -0.97%.
http://llvm-compile-time-tracker.com/compare.php?from=
0a929b6978a068af8ddb02d0d4714a2843dd8ba9&to=
2e630629b43f64b60b282e90f0d96082fde2dacc&stat=instructions
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D86487
Pavel Labath [Mon, 24 Aug 2020 12:20:09 +0000 (14:20 +0200)]
[lldb/Utility] Polish the Scalar class
This patch is mostly about removing the "Category" enum, which was
very useful when the Type enum contained a large number of types, but
now the two are completely identical.
It also removes some other artifacts like unused typedefs and macros.
Pavel Labath [Thu, 27 Aug 2020 13:30:12 +0000 (15:30 +0200)]
[lldb] Reduce intentation in SymbolFileDWARF::ParseVariableDIE
using early exits. NFC.
Ella Ma [Fri, 28 Aug 2020 09:37:55 +0000 (12:37 +0300)]
[doxygen] Fix bad doxygen results for BugReporterVisitors.h
`{@code xxxxx}` triggers a Doxygen bug. The bug may be matching the
close brace with the open brace of the namespace
declaration (`namespace clang {` or `namespace ento {`).
Differential Revision: https://reviews.llvm.org/D85105
Rainer Orth [Fri, 28 Aug 2020 09:40:34 +0000 (11:40 +0200)]
[cmake] Don't build with -O3 -fPIC on Solaris/sparcv9
Tests on Solaris/sparcv9 currently show about 250 failures when building
with gcc, most of them like the following:
FAIL: LLVM-Unit :: Support/./SupportTests/TaskQueueTest.UnOrderedFutures (4269 of 67884)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/TaskQueueTest.UnOrderedFutures' FAILED ********************
Note: Google Test filter = TaskQueueTest.UnOrderedFutures
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from TaskQueueTest
[ RUN ] TaskQueueTest.UnOrderedFutures
0 SupportTests 0x0000000100753b20 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 32
1 SupportTests 0x0000000100752974 llvm::sys::RunSignalHandlers() + 68
2 SupportTests 0x0000000100752b18 SignalHandler(int) + 372
3 libc.so.1 0xffffffff7eedc800 __sighndlr + 12
4 libc.so.1 0xffffffff7eecf23c call_user_handler + 852
5 libc.so.1 0xffffffff7eecf594 sigacthandler + 84
6 SupportTests 0x00000001006f8cb8 std::thread::_State_impl<std::thread::_Invoker<std::tuple<llvm::ThreadPool::ThreadPool(llvm::ThreadPoolStrategy)::'lambda'()> > >::_M_run() + 512
7 libstdc++.so.6.0.28 0xfffffffc628117cc execute_native_thread_routine + 16
8 libc.so.1 0xffffffff7eedc6a0 _lwp_start + 0
Since it's effectively impossible to debug such a `SEGV` in a `Release`
build, I tried a `Debug` build instead, only to find that the failures had
gone away.
Further investigation revealed that most of the issue centers around
`llvm/lib/Support/ThreadPool.cpp`. That file is built with `-O3 -fPIC` in
a `Release` build. The failure vanishes if
- compiling without `-fPIC`
- compiling with `-O -fPIC`
- linking with GNU `ld` instead of Solaris `ld`
It has meanwhile been determined that `gcc` doesn't correctly heed some TLS
code sequences. To make things worse, Solaris `ld` doesn't properly
validate its assumptions against the input, generating wrong code.
`gld` like `gcc` is more liberal here and correctly deals with the code it
gets fed from `gcc`.
There's PR target/96607: GCC feeds SPARC/Solaris linker with unrecognized
TLS sequences <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96607> now.
An attempt to build with `-DLLVM_ENABLE_PIC=Off` initially failed since
neither `libRemarks.so` (D85626 <https://reviews.llvm.org/D85626>) nor
`LLVMPolly.so` (D85627 <https://reviews.llvm.org/D85627>) heed that option.
Even with that fixed, a few codegen failures remain.
Next I tried to build just `ThreadPool.cpp` with `-O -fPIC`. While that
fixed the vast majority of the failures, 16 `LLVM :: CodeGen/X86` failures
remained.
Given that that solution was both incomplete and fragile, I went for
building the whole tree with `-O -fPIC` for `Release` and `RelWithDebInfo`
builds.
As detailed in Bug 47304, 2-stage builds also show large numbers of
failures when building with `-O3` or `-O2`, which are likewise worked
around by building with `-O` until they are sufficiently analyzed and
fixed.
This way, all failures relative to a `Debug` build go away.
Tested on `sparcv9-sun-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D85630
Florian Hahn [Fri, 28 Aug 2020 09:07:56 +0000 (10:07 +0100)]
[MemLoc] Support memcmp in MemoryLocation::getForArgument.
This patch adds support for memcmp in MemoryLocation::getForArgument.
memcmp reads from the first 2 arguments up to the number of bytes of the
third argument.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D86725
Florian Hahn [Thu, 27 Aug 2020 16:27:32 +0000 (17:27 +0100)]
[BasicAA] Add first libfunc tests with memcmp.
Florian Hahn [Thu, 27 Aug 2020 16:27:07 +0000 (17:27 +0100)]
[DSE,MemorySSA] Add memcmp test case.
Vitaly Buka [Fri, 28 Aug 2020 08:59:27 +0000 (01:59 -0700)]
[NFC][asan] Don't unwind stack before pool check
Hanhan Wang [Fri, 28 Aug 2020 08:53:59 +0000 (01:53 -0700)]
[mlir][Linalg] Enhance Linalg fusion on generic op and tensor_reshape op.
The tensor_reshape op was only fusible only if it is a collapsing case. Now we
propagate the op to all the operands so there is a further chance to fuse it
with generic op. The pre-conditions are:
1) The producer is not an indexed_generic op.
2) All the shapes of the operands are the same.
3) All the indexing maps are identity.
4) All the loops are parallel loops.
5) The producer has a single user.
It is possible to fuse the ops if the producer is an indexed_generic op. We
still can compute the original indices. E.g., if the reshape op collapses the d0
and d1, we can use DimOp to get the width of d1, and calculate the index
`d0 * width + d1`. Then replace all the uses with it. However, this pattern is
not implemented in the patch.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D86314
Florian Hahn [Fri, 28 Aug 2020 08:37:01 +0000 (09:37 +0100)]
[BuildLibCalls] Add argmemonly to more lib calls.
strspn, strncmp, strcspn, strcasecmp, strncasecmp, memcmp, memchr,
memrchr, memcpy, memmove, memcpy, mempcpy, strchr, strrchr, bcmp
should all only access memory through their arguments.
I broke out strcoll, strcasecmp, strncasecmp because the result
depends on the locale, which might get accessed through memory.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86724
Georgii Rymar [Thu, 27 Aug 2020 15:20:13 +0000 (18:20 +0300)]
[llvm-readobj] - Simplify the code that creates dumpers. NFCI.
We have a few helper functions like the following:
```
std::error_code create*Dumper(...)
```
In fact we do not need or want to use `std::error_code` and the code
can be simpler if we just return `std::unique_ptr<ObjDumper>`.
This patch does this change and refines the signature of `createDumper`
as well.
Differential revision: https://reviews.llvm.org/D86718
Georgii Rymar [Fri, 21 Aug 2020 14:08:25 +0000 (17:08 +0300)]
[llvm-readobj][test] - Test "Format" values.
This adds testing for the "Format" field printed with `--file-headers`.
llvm-readelf doesn't use them, so only llvm-readobj needs to be tested.
All possible values are defined and tested in `ELFObjectFile<ELFT>::getFileFormatName()`.
Here we test just a few arbitrary ones.
Differential revision: https://reviews.llvm.org/D86350
Georgii Rymar [Wed, 26 Aug 2020 14:48:23 +0000 (17:48 +0300)]
[unittests/Object] - Add testing for missing ELF formats.
This adds all missing format values that are defined in
ELFObjectFile<ELFT>::getFileFormatName().
Differential revision: https://reviews.llvm.org/D86625
Florian Hahn [Fri, 28 Aug 2020 07:40:40 +0000 (08:40 +0100)]
[llvm-reduce] Skip chunks that lead to broken modules.
Some reduction passes may create invalid IR. I am not aware of any use
case where we would like to proceed reducing invalid IR. Various utils
used here, including CloneModule, assume the module to clone is valid
and crash otherwise.
Ideally, no reduction pass would create invalid IR, but some currently
do. ReduceInstructions can be fixed relatively easily (D86210), but
others are harder. For example, ReduceBasicBlocks may remove result in
invalid PHI nodes.
For now, skip the chunks. If we get to the point where all reduction
passes result in valid IR, we may want to turn this into an assertion.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D86212
Martin Storsjö [Fri, 28 Aug 2020 06:23:57 +0000 (09:23 +0300)]
[ValueTracking] Remove a stray semicolon. NFC.
This silences warnings when built with GCC at least.
Martin Storsjö [Thu, 20 Aug 2020 07:38:17 +0000 (10:38 +0300)]
[MC] [Win64EH] Avoid producing malformed xdata records
If there's no unwinding opcodes, omit writing the xdata/pdata records.
Previously, this generated truncated xdata records, and llvm-readobj
would error out when trying to print them.
If writing of an xdata record is forced via the .seh_handlerdata
directive, skip it if there's no info to make a sensible unwind
info structure out of, and clearly error out if such info appeared
later in the process.
Differential Revision: https://reviews.llvm.org/D86527
LLVM GN Syncbot [Fri, 28 Aug 2020 05:56:49 +0000 (05:56 +0000)]
[gn build] Port
b1f4e5979b7
serge-sans-paille [Thu, 27 Aug 2020 15:31:54 +0000 (17:31 +0200)]
(Expensive) Check for Loop, SCC and Region pass return status
This generalizes the logic introduced in https://reviews.llvm.org/D80916 to
other passes.
It's needed by https://reviews.llvm.org/D86442 to assert passes correctly report
their status.
Differential Revision: https://reviews.llvm.org/D86589
Mehdi Amini [Fri, 28 Aug 2020 02:26:27 +0000 (02:26 +0000)]
Add a global flag to disable the global dialect registry "process wise"
This is intended to ease the transition for client with a lot of
dependencies. It'll be removed in the coming weeks.
Differential Revision: https://reviews.llvm.org/D86755
JF Bastien [Fri, 14 Aug 2020 21:05:57 +0000 (14:05 -0700)]
Add an unsigned shift base sanitizer
It's not undefined behavior for an unsigned left shift to overflow (i.e. to
shift bits out), but it has been the source of bugs and exploits in certain
codebases in the past. As we do in other parts of UBSan, this patch adds a
dynamic checker which acts beyond UBSan and checks other sources of errors. The
option is enabled as part of -fsanitize=integer.
The flag is named: -fsanitize=unsigned-shift-base
This matches shift-base and shift-exponent flags.
<rdar://problem/
46129047>
Differential Revision: https://reviews.llvm.org/D86000
Valentin Clement [Fri, 28 Aug 2020 02:32:29 +0000 (22:32 -0400)]
[flang][openacc] Fix gang-argument parsing and add validity tests for !$acc loop
This patch fix the prasing for the gang-arg values for the gang clause. It also adds
some clause validity tests for the loop construct.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D86584
Justin Cady [Fri, 28 Aug 2020 02:21:59 +0000 (19:21 -0700)]
[MSAN] Add fiber switching APIs
Add functions exposed via the MSAN interface to enable MSAN within
binaries that perform manual stack switching (e.g. through using fibers
or coroutines).
This functionality is analogous to the fiber APIs available for ASAN and TSAN.
Fixes google/sanitizers#1232
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D86471
Valentin Clement [Fri, 28 Aug 2020 02:13:29 +0000 (22:13 -0400)]
[flang][openacc] Add check for tile clause restriction
The tile clause in OpenACC 3.0 imposes some restriction. Element in the tile size list are either * or a
constant positive integer expression. If there are n tile sizes in the list, the loop construct must be immediately
followed by n tightly-nested loops.
This patch implement these restrictions and add some tests.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D86655
Kai Luo [Fri, 28 Aug 2020 01:56:12 +0000 (01:56 +0000)]
[PowerPC] PPCBoolRetToInt: Don't translate Constant's operands
When collecting `i1` values via `findAllDefs`, ignore Constant's
operands, since Constant's operands might not be `i1`.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46923 which causes ICE
```
llvm-project/llvm/lib/IR/Constants.cpp:1924: static llvm::Constant *llvm::ConstantExpr::getZExt(llvm::Constant *, llvm::Type *, bool): Assertion `C->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits()&& "SrcTy must be smaller than DestTy for ZExt!"' failed.
```
Differential Revision: https://reviews.llvm.org/D85007
Alina Sbirlea [Thu, 27 Aug 2020 23:39:53 +0000 (16:39 -0700)]
[MemorySSA] Assert defining access is not a MemoryUse.
Harmen Stoppels [Fri, 28 Aug 2020 00:57:26 +0000 (17:57 -0700)]
Revert "Use find_library for ncurses"
The introduction of find_library for ncurses caused more issues than it solved problems. The current open issue is it makes the static build of LLVM fail. It is better to revert for now, and get back to it later.
Revert "[CMake] Fix an issue where get_system_libname creates an empty regex capture on windows"
This reverts commit
1ed1e16ab83f55d85c90ae43a05cbe08a00c20e0.
Revert "Fix msan build"
This reverts commit
34fe9613dda3c7d8665b609136a8c12deb122382.
Revert "[CMake] Always mark terminfo as unavailable on Windows"
This reverts commit
76bf26236f6fd453343666c3cd91de8f74ffd89d.
Revert "[CMake] Fix OCaml build failure because of absolute path in system libs"
This reverts commit
8e4acb82f71ad4effec8895b8fc957189ce95933.
Revert "[CMake] Don't look for terminfo libs when LLVM_ENABLE_TERMINFO=OFF"
This reverts commit
495f91fd33d492941c39424a32cf24bcfe192f35.
Revert "Use find_library for ncurses"
This reverts commit
a52173a3e56553d7b795bcf3cdadcf6433117107.
Differential revision: https://reviews.llvm.org/D86521
Jez Ng [Fri, 28 Aug 2020 00:43:19 +0000 (17:43 -0700)]
[lld-macho][NFC] Define isHidden() in LinkEditSection
Since it's always true
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86749
Jez Ng [Fri, 28 Aug 2020 00:43:16 +0000 (17:43 -0700)]
[lld-macho] Weak locals should be relaxed too
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86746
Jez Ng [Thu, 27 Aug 2020 22:59:48 +0000 (15:59 -0700)]
[lld-macho] Support GOT relocations to __dso_handle
Found such a relocation while testing some real world programs.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86642
Jez Ng [Thu, 27 Aug 2020 22:59:45 +0000 (15:59 -0700)]
[lld-macho] Implement GOT_LOAD relaxation
We can have GOT_LOAD relocations that reference `__dso_handle`.
However, our binding opcode encoder doesn't support binding to the DSOHandle
symbol. Instead of adding support for that, I decided it would be cleaner to
implement GOT_LOAD relaxation since `__dso_handle`'s location is always
statically known.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86641
Jez Ng [Thu, 27 Aug 2020 22:59:30 +0000 (15:59 -0700)]
[lld-macho] Emit binding opcodes for defined symbols that override weak dysyms
These opcodes tell dyld to coalesce the overridden weak dysyms to this
particular symbol definition.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86575
Jez Ng [Thu, 27 Aug 2020 22:59:15 +0000 (15:59 -0700)]
[lld-macho] Emit the right header flags for weak bindings/symbols
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86574
Jez Ng [Thu, 27 Aug 2020 22:54:42 +0000 (15:54 -0700)]
[lld-macho] Implement weak binding for branch relocations
Since there is no "weak lazy" lookup, function calls to weak symbols are
always non-lazily bound. We emit both regular non-lazy bindings as well
as weak bindings, in order that the weak bindings may overwrite the
non-lazy bindings if an appropriate symbol is found at runtime. However,
the bound addresses will still be written (non-lazily) into the
LazyPointerSection.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86573
Jonas Devlieghere [Fri, 28 Aug 2020 00:20:50 +0000 (17:20 -0700)]
[lldb] Fix "no matching std::pair constructor" on Ubuntu 16.04 (NFC)
Fixes error: no matching constructor for initialization of
'std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
with older toolchain (clang/libcxx) on Ubuntu 16.04. The issue is the
StringRef-to-std::string conversion.
Nathan James [Fri, 28 Aug 2020 00:06:46 +0000 (01:06 +0100)]
[clang-query][NFC] Silence a few lint warnings
Matt Arsenault [Thu, 27 Aug 2020 18:58:39 +0000 (14:58 -0400)]
GlobalISel: Implement computeNumSignBits for G_SEXT_INREG
Matt Arsenault [Thu, 27 Aug 2020 21:21:41 +0000 (17:21 -0400)]
AMDGPU/GlobalISel: Implement computeKnownBits for groupstaticsize
Matt Arsenault [Thu, 27 Aug 2020 21:17:50 +0000 (17:17 -0400)]
AMDGPU: Fix broken switch braces
Matt Arsenault [Thu, 27 Aug 2020 23:02:34 +0000 (19:02 -0400)]
Correctly revert "GlobalISel: Use & operator on KnownBits"
I mis-resolved the revert through moving the code to another function.