Teresa Johnson [Tue, 29 Sep 2020 22:53:41 +0000 (15:53 -0700)]
[MemProf] Pass down memory profile name with optional path from clang
Similar to -fprofile-generate=, add -fmemory-profile= which takes a
directory path. This is passed down to LLVM via a new module flag
metadata. LLVM in turn provides this name to the runtime via the new
__memprof_profile_filename variable.
Additionally, always pass a default filename (in $cwd if a directory
name is not specified vi the = form of the option). This is also
consistent with the behavior of the PGO instrumentation. Since the
memory profiles will generally be fairly large, it doesn't make sense to
dump them to stderr. Also, importantly, the memory profiles will
eventually be dumped in a compact binary format, which is another reason
why it does not make sense to send these to stderr by default.
Change the existing memprof tests to specify log_path=stderr when that
was being relied on.
Depends on D89086.
Differential Revision: https://reviews.llvm.org/D89087
Nikita Popov [Sun, 1 Nov 2020 12:42:39 +0000 (13:42 +0100)]
[SCEV] Delay strengthening of nowrap flags
Strengthening nowrap flags is relatively expensive. Make sure we
only do it if we're actually going to use the flags -- we don't
use them for many recursive invocations. Additionally, if we're
reusing an existing SCEV node, there's no point in trying to
strengthen the flags if we don't have any new baseline facts.
This change falls slightly short of being NFC, because the way
flags during add+addrec / mul+addrec folding are handled may be
more precise (as less operands are included in the calculation).
Craig Topper [Sun, 1 Nov 2020 20:10:47 +0000 (12:10 -0800)]
[RISCV] Add tests to show missed opportunities to use rori for fshr intrinsic with same inputs. NFC
The fshr intrinsic with same inputs produces rotr ISD node. The
fshl intrinsic produces rotl ISD node.
There were only test cases and isel patterns for the fshl/rotl case.
This patch adds fshr/rotr test cases.
Craig Topper [Sun, 1 Nov 2020 18:31:59 +0000 (10:31 -0800)]
Recommit "[RISCV] Remove include of RISCVRegisterInfo.h from RISCVBaseInfo.h. NFCI"
This reverts
781917254dba17df7fb357a5f621ada2ac1b36e3 and recommits
781917254dba17df7fb357a5f621ada2ac1b36e3.
I've changed getRegForInlineAsmConstraint to not use a std::pair
of Register in a previous commit. Hopefully that fixes the reported
issue with expensive checks on Windows. I'm still not sure exactly
why this commit removing an include affected a different file.
Original message:
RISCVRegisterInfo.h is part of the CodeGen layer. The Utils library
is intended to be shared with the MC layer so shouldn't use files
from the CodeGen layer.
The register enum names are already available from
RISCVMCTargetDesc.h. It appears what was coming from this include
was a transitive include of the Register class which I've replaced
with MCRegister. Register has a constructor from MCRegister so it
should be convertible.
Craig Topper [Sun, 1 Nov 2020 18:16:50 +0000 (10:16 -0800)]
[RISCV] Use 'unsigned' instead of Register in getRegForInlineAsmConstraint. NFC
The return value of this interface still uses an 'unsigned' on all
targets. So we convert Register back to unsigned at the end.
I'm hoping this will prevent the issue that caused the revert of
D90322.
Nikita Popov [Sun, 1 Nov 2020 17:34:01 +0000 (18:34 +0100)]
[SCEV] Construct GEP expression more efficiently (NFCI)
Instead of performing a sequence of pairwise additions, directly
construct a multi-operand add expression.
This should be NFC modulo any SCEV canonicalization deficiencies.
Florian Hahn [Sat, 3 Oct 2020 20:05:39 +0000 (21:05 +0100)]
[VPlan] Assert no users remaining when deleting a VPValue.
When deleting a VPValue, all users must already by deleted. Add an
assertion to make sure and catch violations.
David Green [Sun, 1 Nov 2020 16:24:23 +0000 (16:24 +0000)]
[ARM] Add extra MVE tests for various patches. NFC
Qiu Chaofan [Sun, 1 Nov 2020 15:22:47 +0000 (23:22 +0800)]
[PowerPC] Avoid unnecessary fadd for unsigned to ppcf128
Unsigned 32-bit or shorter integer to ppcf128 conversion are currently
expanded as signed-to-double with an extra fadd to 'complement'. But on
PowerPC we have native instruction to directly convert unsigned to
double since ISA v2.06. This patch exploits it.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D89786
Nathan James [Sun, 1 Nov 2020 14:37:06 +0000 (14:37 +0000)]
[NFC][lldb] Silence unused variable warning
Ilya Bukonkin [Sun, 1 Nov 2020 10:53:06 +0000 (13:53 +0300)]
[lldb] TestTypeGetModule.py review improvements
Christudasan Devadasan [Sun, 1 Nov 2020 07:41:14 +0000 (13:11 +0530)]
[AMDGPU] Some refactoring after D90404. NFC.
Christudasan Devadasan [Thu, 29 Oct 2020 15:06:14 +0000 (20:36 +0530)]
[AMDGPU] Add alignment check for v3 to v4 load type promotion
It should be enabled only when the load alignment is at least 8-byte.
Fixes: SWDEV-256824
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D90404
Fangrui Song [Sun, 1 Nov 2020 06:29:57 +0000 (22:29 -0800)]
[test] Fix some unused check prefixes in test/Analysis/CostModel/X86
Fangrui Song [Sun, 1 Nov 2020 04:46:45 +0000 (20:46 -0800)]
[test] Fix unused check prefixes in test/AST
Fangrui Song [Sun, 1 Nov 2020 04:33:46 +0000 (20:33 -0800)]
[test] Clean up test/Frontend/gnu-mcount.c and fix unused check prefixes
Sam Clegg [Sat, 31 Oct 2020 23:39:27 +0000 (16:39 -0700)]
[lld][WebAssembly] Remove bad-reloc test
This test was checking behaviour that only exists in the debug
configuration so will fail in release builds.
Perhaps there is way to keep this test around and only run
it in debug builds but for now I'm removing so fix the
release builders.
Differential Revision: https://reviews.llvm.org/D90542
Ayke van Laethem [Sun, 23 Aug 2020 12:17:29 +0000 (14:17 +0200)]
[AVR] Improve inline rotate/shift expansions
These expansions were rather inefficient and were done with more code
than necessary. This change optimizes them to use expansions more
similar to GCC. The code size is the same (when optimizing for code
size) but somehow LLVM reorders blocks in a non-optimal way. Still, this
should be an improvement with a reduction in code size of around 0.12%
(when building compiler-rt).
Differential Revision: https://reviews.llvm.org/D86418
River Riddle [Sat, 31 Oct 2020 21:21:49 +0000 (14:21 -0700)]
[mlir][AsmPrinter] Fix crash in windows build after D89354
Switch to an index based loop instead of using enumerate.
Florian Hahn [Sat, 31 Oct 2020 19:30:19 +0000 (19:30 +0000)]
[DSE] Use same logic as legacy impl to check if free kills a location.
This patch updates DSE + MemorySSA to use the same check as the legacy
implementation to determine if a location is killed by a free call.
This changes the existing behavior so that a free does not kill
locations before the start of the freed pointer.
This should fix PR48036.
Florian Hahn [Sat, 31 Oct 2020 19:35:37 +0000 (19:35 +0000)]
[DSE] Add additional tests with free, regenerate check lines.
The new test cases are inspired by PR48036.
Reid Kleckner [Sat, 31 Oct 2020 18:19:28 +0000 (11:19 -0700)]
Fix lld/wasm test portability issue, and XFAIL the test
I don't see any warnings from lld.wasm locally. Needs more
investigation.
Reid Kleckner [Sat, 31 Oct 2020 18:08:58 +0000 (11:08 -0700)]
[COFF] Move ghash timers under the "add objects" timer
I had envisioned the ghash step as a big up front step, but as currently
written, the timers are nested, and we are notionally adding types from
objects, so we might as well arrange the timers this way.
Simon Pilgrim [Sat, 31 Oct 2020 17:32:04 +0000 (17:32 +0000)]
Add missing EOL. NFCI.
Kostya Kortchinsky [Fri, 30 Oct 2020 17:42:28 +0000 (10:42 -0700)]
[GWP-ASan] Fuchsia specific mapping & utilities functions
This CL introduces the Fuchsia versions of the existing platform
specific functions.
For Fuchsia, we need to track the VMAR (https://fuchsia.dev/fuchsia-src/reference/kernel_objects/vm_address_region)
of the Guarded Pool mapping, and for this purpose I added some platform
specific data structure that remains empty on POSIX platforms.
`getThreadID` is not super useful for Fuchsia so it's just left as a
stub for now.
While testing the changes in my Fuchsia tree, I realized that
`guarded_pool_allocator_tls.h` should have closed the namespace before
including `GWP_ASAN_PLATFORM_TLS_HEADER`, otherwise drama ensues.
This was tested in g3, upstream LLVM, and Fuchsia (with local changes).
Differential Revision: https://reviews.llvm.org/D90483
Florian Hahn [Sat, 31 Oct 2020 10:51:19 +0000 (10:51 +0000)]
Reland "[SLP] Consider alternatives for cost of select instructions."
This reverts the revert commit
a1b53db32418cb6ed6f5b2054d15a22b5aa3aeb9.
This patch includes a fix for a reported issue, caused by
matchSelectPattern returning UMIN for selects of pointers in
some cases by looking to some connected casts.
For now, ensure integer instrinsics are only returned for selects of
ints or int vectors.
Mark de Wever [Sat, 31 Oct 2020 12:07:06 +0000 (13:07 +0100)]
[Sema] Diagnose annotating `if constexpr` with a likelihood attribute
Adds a diagnostic when the user annotates an `if constexpr` with a
likelihood attribute. The `if constexpr` statement is evaluated at compile
time so the attribute has no effect. Annotating the accompanied `else`
with a likelihood attribute has the same effect as annotating a generic
statement. Since the attribute there is most likely not intended, a
diagnostic will be issued. Since the attributes can't conflict, the
"conflict" won't be diagnosed for an `if constexpr`.
Differential Revision: https://reviews.llvm.org/D90336
Mark de Wever [Sat, 31 Oct 2020 12:07:06 +0000 (13:07 +0100)]
[CodeGen] Implement [[likely]] and [[unlikely]] for while and for loop.
The attribute has no effect on a do statement since the path of execution
will always include its substatement.
It adds a diagnostic when the attribute is used on an infinite while loop
since the codegen omits the branch here. Since the likelihood attributes
have no effect on a do statement no diagnostic will be issued for
do [[unlikely]] {...} while(0);
Differential Revision: https://reviews.llvm.org/D89899
Paul C. Anagnostopoulos [Fri, 30 Oct 2020 20:09:41 +0000 (16:09 -0400)]
[TableGen] Eliminate uses of true and false in .td files.
They occurred in one NVPTX file and some test files.
Differential Revision: https://reviews.llvm.org/D90513
David Sanders [Sat, 31 Oct 2020 14:36:42 +0000 (10:36 -0400)]
Use ANSI escape codes for --use-color on Windows
On Windows the --use-color option cannot be used for its originally
intended purpose of forcing color when piping stdout, since Windows
does not use ANSI escape codes by default. This change turns on ANSI
escape codes on Windows when forcing color to a non-displayed stdout
(e.g. piped).
David Green [Sat, 31 Oct 2020 13:10:14 +0000 (13:10 +0000)]
[ARM] Fix crash for gather of pointer costs.
If the elt size is unknown due to it being a pointer, a comparison
against 0 will cause an assert. Make sure the elt size is large enough
before comparing and for the moment just return the scalar cost.
Serge Pavlov [Sat, 31 Oct 2020 12:45:56 +0000 (19:45 +0700)]
Temporarily remove test CodeGen/pragma-fp-exc
This test fails on buildbots where CPU architecture does not fully
support constrained intrinsics.
Simon Pilgrim [Sat, 31 Oct 2020 12:32:34 +0000 (12:32 +0000)]
[InstCombine] foldSelectRotate - generalize to foldSelectFunnelShift
This is the last of the rotate->funnel shift InstCombine generalizations for PR46896
We still have foldGuardedRotateToFunnelShift to deal with in AggressiveInstCombine
Differential Revision: https://reviews.llvm.org/D90382
Simon Pilgrim [Sat, 31 Oct 2020 12:16:33 +0000 (12:16 +0000)]
[X86] Make some basic VarArgsLoweringHelper helper methods const. NFCI.
Fixes a number of cppcheck remarks.
Simon Pilgrim [Sat, 31 Oct 2020 12:15:43 +0000 (12:15 +0000)]
[X86] Make the X86FrameSortingComparator operator const. NFCI.
Fixes a cppcheck remark.
Simon Pilgrim [Sat, 31 Oct 2020 12:10:21 +0000 (12:10 +0000)]
[CSE] Make some basic EarlyCSE::StackNode helper methods const. NFCI.
Fixes a number of cppcheck remarks.
Simon Pilgrim [Sat, 31 Oct 2020 12:08:58 +0000 (12:08 +0000)]
[Bitcode] Make some basic PlaceholderQueue/MetadataLoaderImpl helper methods const. NFCI.
Fixes a number of cppcheck remarks.
Andrea Di Biagio [Sat, 31 Oct 2020 11:21:05 +0000 (11:21 +0000)]
[MCA][LSUnit] Correctly update the internal group flags on store barrier execution. Fixes PR48024.
This is likely to be a regressigion introduced by my last refactoring of the
LSUnit (commit
5578ec32f9c4f). Before this patch, the
"CurrentStoreBarrierGroupID" index was not correctly reset on store barrier
executions. This was leading to unexpected crashes like the one reported as
PR48024.
Simon Pilgrim [Sat, 31 Oct 2020 11:50:00 +0000 (11:50 +0000)]
[X86] X86MCTargetDesc - ensure the declaration/definition variable names match. NFCI.
Silences cppcheck mismatch warnings.
Simon Pilgrim [Sat, 31 Oct 2020 11:46:07 +0000 (11:46 +0000)]
[X86] Reduce scope of DestReg and use specific Register type not unsigned. NFCI.
Simon Pilgrim [Sat, 31 Oct 2020 11:41:14 +0000 (11:41 +0000)]
[X86] printAsmMRegister - make the X86AsmPrinter arg a const reference. NFC.
Fixes cppcheck warning.
Simon Pilgrim [Sat, 31 Oct 2020 11:39:26 +0000 (11:39 +0000)]
[X86] assignValueToReg - fix Wshadow warning. NFCI.
X86OutgoingValueHandler already has a MIB member
Simon Pilgrim [Sat, 31 Oct 2020 11:34:28 +0000 (11:34 +0000)]
[X86] printAsmVRegister - remove unused argument. NFC.
Simon Pilgrim [Sat, 31 Oct 2020 11:31:46 +0000 (11:31 +0000)]
[X86] X86AsmPrinter - ensure the declaration/definition variable names match. NFCI.
Silences cppcheck mismatch warnings.
Simon Pilgrim [Sat, 31 Oct 2020 11:26:25 +0000 (11:26 +0000)]
[X86] No need to determine pointer when the type is already a MachineInstr*. NFCI.
Caught by cppcheck - appears to be a copy+paste typo as the other var is an iterator that does need the &* pointer operation.
Pedro Gonnet [Sat, 31 Oct 2020 11:08:55 +0000 (12:08 +0100)]
Fix gendered documentation
Changed two references to developers as "he" or "him" to the more neutral "they".
Reviewed By: JDevlieghere, sylvestre.ledru
Differential Revision: https://reviews.llvm.org/D78807
Vitaly Buka [Sat, 31 Oct 2020 10:55:09 +0000 (03:55 -0700)]
[sanitizer] Disabled 2 tests on Android
They block bot upgrade to NDK 21.
Serge Pavlov [Tue, 20 Oct 2020 17:56:39 +0000 (00:56 +0700)]
Add option 'exceptions' to pragma clang fp
Pragma 'clang fp' is extended to support a new option, 'exceptions'. It
allows to specify floating point exception behavior more flexibly.
Differential Revision: https://reviews.llvm.org/D89849
Nikita Popov [Sat, 31 Oct 2020 09:51:12 +0000 (10:51 +0100)]
[Inliner] Consistently apply callsite noalias metadata
Previously, !noalias and !alias.scope metadata on the call site was
applied as part of CloneAliasScopeMetadata(), which short-circuits
if the callee does not use any noalias metadata itself. However,
these two things have no relation to each other.
Consistently apply !noalias and !alias.scope metadata by integrating
this into an existing function that handled !llvm.access.group and
!llvm.mem.parallel_loop_access metadata. The handling for all of
these metadata kinds essentially the same.
Nikita Popov [Sat, 31 Oct 2020 09:24:22 +0000 (10:24 +0100)]
[Inliner] Add extra test for callsite noalias metadata (NFC)
Test the case where the callee does not use noalias metadata itself.
This case is currently handled inconsistently.
Petr Hosek [Sat, 31 Oct 2020 03:19:39 +0000 (20:19 -0700)]
[CMake] Avoid accidental C++ standard library dependency in sanitizers
While sanitizers don't use C++ standard library, we could still end
up accidentally including or linking it just by the virtue of using
the C++ compiler. Pass -nostdinc++ and -nostdlib++ to avoid these
accidental dependencies.
Reviewed By: smeenai, vitalybuka
Differential Revision: https://reviews.llvm.org/D88922
Arthur Eubanks [Sat, 31 Oct 2020 07:15:46 +0000 (00:15 -0700)]
Revert "Use uint64_t for branch weights instead of uint32_t"
This reverts commit
10f2a0d662d8d72eaac48d3e9b31ca8dc90df5a4.
More uint64_t overflows.
Fangrui Song [Sat, 31 Oct 2020 07:14:59 +0000 (00:14 -0700)]
[test] Fix unused check prefixes in test/Driver
Note, the deprecated AArch64 -msign-return-address= does not accept b-key. So
delete the incorrect tests.
Fangrui Song [Sat, 31 Oct 2020 06:28:31 +0000 (23:28 -0700)]
[test] Fix unused check prefixes in test/DebugInfo
Jonas Devlieghere [Sat, 31 Oct 2020 05:07:33 +0000 (22:07 -0700)]
[lldb] Fix XcodeSDKModuleTests
Update XcodeSDKModuleTests for YAMLModuleTester changes in D90393.
LLVM GN Syncbot [Sat, 31 Oct 2020 05:19:04 +0000 (05:19 +0000)]
[gn build] Port
756f5978410
Liu, Chen3 [Fri, 30 Oct 2020 04:58:05 +0000 (12:58 +0800)]
[X86] Support Intel avxvnni
This patch mainly made the following changes:
1. Support AVX-VNNI instructions;
2. Introduce ExplicitVEXPrefix flag so that vpdpbusd/vpdpbusds/vpdpbusds/vpdpbusds instructions only use vex-encoding when user explicity add {vex} prefix.
Differential Revision: https://reviews.llvm.org/D89105
Petr Hosek [Fri, 30 Oct 2020 23:16:09 +0000 (16:16 -0700)]
[NFC][CMake] Move some COMPILER_RT variables setup
Part of D88922
Petr Hosek [Fri, 30 Oct 2020 23:16:09 +0000 (16:16 -0700)]
[CMake] Add -fno-rtti into tsan unittests
And some other NFC parts of D88922
Petr Hosek [Fri, 30 Oct 2020 23:16:09 +0000 (16:16 -0700)]
[CMake] Remove cxx-headers from runtime deps
Part of D88922
Petr Hosek [Fri, 30 Oct 2020 23:16:09 +0000 (16:16 -0700)]
[CMake] Replace ctime with time.h in memprof
Part of D88922
Richard Smith [Sat, 31 Oct 2020 01:30:56 +0000 (18:30 -0700)]
PR42513: Fix handling of function definitions lazily instantiated from
friends.
When determining whether a function has a template instantiation
pattern, look for other declarations of that function that were
instantiated from a friend function definition, rather than assuming
that checking for member specialization information on whichever
declaration name lookup found will be sufficient.
Ali Tamur [Sat, 31 Oct 2020 01:27:28 +0000 (18:27 -0700)]
[lld][WebAssembly] Do not specify temporary file name in tests.
bad-reloc.yaml test introduced at
9d1409df87 uses a name (out.wasm) to specify a
temporary output file name, which causes breakage in our system.
Wouter van Oortmerssen [Sat, 31 Oct 2020 00:32:55 +0000 (17:32 -0700)]
[WebAssembly] fix paths in dwarfdump64.ll test
peter klausler [Fri, 30 Oct 2020 21:18:20 +0000 (14:18 -0700)]
[flang] Plug error recovery hole for erroneous subscripts
Avoid a crash in folding an empty vector of subscripts
that resulted from a semantic error.
Differential revision: https://reviews.llvm.org/D90499
Thomas Lively [Sat, 31 Oct 2020 00:23:30 +0000 (17:23 -0700)]
[WebAssembly] Prototype i64x2.bitmask
As proposed in https://github.com/WebAssembly/simd/pull/368.
Differential Revision: https://reviews.llvm.org/D90514
peter klausler [Fri, 30 Oct 2020 19:47:23 +0000 (12:47 -0700)]
[flang] Better error messages & more cases caught for bad forward refs
Subclause 10.1.12 in F'2018 prohibits forward references from
a specification expression to an object declared later in the
same specification part. Catch this error better and emit
specific error messages about the violation.
Differential revision: https://reviews.llvm.org/D90492
Wouter van Oortmerssen [Fri, 30 Oct 2020 21:35:43 +0000 (14:35 -0700)]
[WebAssembly] Fixed DWARF DW_AT_low_pc encoded as 64-bit in wasm64
Also added general wasm64 DWARF test
Also added asserts for unsupported reloc combinations that triggered this bug.
Differential Revision: https://reviews.llvm.org/D90503
peter klausler [Fri, 30 Oct 2020 20:30:42 +0000 (13:30 -0700)]
[flang] Add warning for FINAL pitfall
Fortran's FINAL feature is sensitive to object rank.
When an object's rank excludes it from finalization, but
the type has FINAL subroutines for other ranks, emit
a warning. This should be especially helpful in the
case of a scalar FINAL subroutine not being declared
(IMPURE) ELEMENTAL.
Differential revision: https://reviews.llvm.org/D90495
Thomas Lively [Fri, 30 Oct 2020 23:38:15 +0000 (16:38 -0700)]
[WebAssembly] Prototype i64x2.eq
As proposed in https://github.com/WebAssembly/simd/pull/381. Since it is still
in the prototyping phase, it is only accessible via a target builtin function
and a target intrinsic.
Depends on D90504.
Differential Revision: https://reviews.llvm.org/D90508
Nathan James [Fri, 30 Oct 2020 23:17:11 +0000 (23:17 +0000)]
[clang-tidy][test] Fix test failure when LLVM_ENABLE_WERROR is set.
After https://reviews.llvm.org/D80531 landed, a subtle bug was introduced where the test would fail if `LLVM_ENABLE_WERROR` was set. This just silences that error so the test case runs correctly, down the line it may be worth not enabling `-Werror` for clang-tidy tests even if the cmake flag is passed.
Tony [Fri, 30 Oct 2020 22:36:12 +0000 (22:36 +0000)]
[NFC][AMDGPU] Minor cleanup to AMDGPU memory model table
Differential Revision: https://reviews.llvm.org/D90509
peter klausler [Fri, 30 Oct 2020 19:53:42 +0000 (12:53 -0700)]
[flang] Detect and rewrite ambiguous READ(CVAR)[,item-list]
READ(CVAR)[,item-list] with a character variable CVAR
could be parsed as an unformatted READ from an internal
unit or as a formatted READ from the default external unit
with a needlessly parenthesized variable format. We parse
it as the former, but Fortran doesn't have unformatted
internal I/O.
Differential revision: https://reviews.llvm.org/D90493
Thomas Lively [Fri, 30 Oct 2020 22:44:04 +0000 (15:44 -0700)]
[WebAssembly] Prototype i64x2.widen_{low,high}_i32x4_{s,u}
As proposed in https://github.com/WebAssembly/simd/pull/290. As usual, these
instructions are available only via builtin functions and intrinsics while they
are in the prototyping stage.
Differential Revision: https://reviews.llvm.org/D90504
Mehdi Amini [Fri, 30 Oct 2020 21:25:49 +0000 (21:25 +0000)]
Use `--allow-unused-prefixes=false` by default for FileCheck in MLIR testsuite
This option catches unexpected mismatch when a prefix is given to
FileCheck on the command line but never matches a single line in the
test.
See http://lists.llvm.org/pipermail/llvm-dev/2020-October/146162.html
for more info.
Differential Revision: https://reviews.llvm.org/D90501
Florian Hahn [Fri, 30 Oct 2020 21:20:28 +0000 (21:20 +0000)]
Revert "[SLP] Consider alternatives for cost of select instructions."
This reverts commit
19225704890632cd2552f41ada41600a20db1371.
This appears to cause a crash in the following example
a, b, c;
l() {
int e = a, f = l, g, h, i, j;
float *d = c, *k = b;
for (;;)
for (; g < f; g++) {
k[h] = d[i];
k[h - 1] = d[j];
h += e << 1;
i += e;
}
}
clang -cc1 -triple i386-unknown-linux-gnu -emit-obj -target-cpu pentium-m -O1 -vectorize-loops -vectorize-slp reduced.c
llvm::Type *llvm::Type::getWithNewBitWidth(unsigned int) const: Assertion `isIntOrIntVectorTy() && "Original type expected to be a vector of integers or a scalar integer."' failed.
Florian Hahn [Fri, 30 Oct 2020 21:19:52 +0000 (21:19 +0000)]
Revert "[TTI] Add VecPred argument to getCmpSelInstrCost."
This reverts commit
73f01e3df58dca9d1596440b866b52929e3878de.
This appears to break
http://lab.llvm.org:8011/#/builders/85/builds/383.
Peter Collingbourne [Tue, 27 Oct 2020 23:26:29 +0000 (16:26 -0700)]
hwasan: Support for outlined checks in the Linux kernel.
Add support for match-all tags and GOT-free runtime calls, which
are both required for the kernel to be able to support outlined
checks. This requires extending the access info to let the backend
know when to enable these features. To make the code easier to maintain
introduce an enum with the bit field positions for the access info.
Allow outlined checks to be enabled with -mllvm
-hwasan-inline-all-checks=0. Kernels that contain runtime support for
outlined checks may pass this flag. Kernels lacking runtime support
will continue to link because they do not pass the flag. Old versions
of LLVM will ignore the flag and continue to use inline checks.
With a separate kernel patch [1] I measured the code size of defconfig
+ tag-based KASAN, as well as boot time (i.e. time to init launch)
on a DragonBoard 845c with an Android arm64 GKI kernel. The results
are below:
code size boot time
before
92824064 6.18s
after
38822400 6.65s
[1] https://linux-review.googlesource.com/id/I1a30036c70ab3c3ee78d75ed9b87ef7cdc3fdb76
Depends on D90425
Differential Revision: https://reviews.llvm.org/D90426
Mircea Trofin [Fri, 30 Oct 2020 20:52:03 +0000 (13:52 -0700)]
[FileCheck] Address unused prefixes in tests
Added -allow-unused-prefixes as necessary.
Differential Revision: https://reviews.llvm.org/D90496
Sean Silva [Fri, 23 Oct 2020 17:30:59 +0000 (10:30 -0700)]
[mlir] Add BufferResultsToOutParams pass.
This pass allows removing getResultConversionKind from
BufferizeTypeConverter. This pass replaces the AppendToArgumentsList
functionality. As far as I could tell, the only use of this functionlity
is to perform the transformation that is implemented in this pass.
Future patches will remove the getResultConversionKind machinery from
BufferizeTypeConverter, but sending this patch for individual review for
clarity.
Differential Revision: https://reviews.llvm.org/D90071
Cameron McInally [Fri, 30 Oct 2020 20:32:22 +0000 (15:32 -0500)]
[Legalize] Add legalizations for VECREDUCE_SEQ_FADD
Add Legalization support for VECREDUCE_SEQ_FADD, so that we don't need to depend on ExpandReductionsPass.
Differential Revision: https://reviews.llvm.org/D90247
ergawy [Fri, 30 Oct 2020 18:36:19 +0000 (14:36 -0400)]
[MLIR][SPIRV] Start module combiner.
This commit adds a new library that merges/combines a number of spv
modules into a combined one. The library has a single entry point:
combine(...).
To combine a number of MLIR spv modules, we move all the module-level ops
from all the input modules into one big combined module. To that end, the
combination process can proceed in 2 phases:
(1) resolving conflicts between pairs of ops from different modules
(2) deduplicate equivalent ops/sub-ops in the merged module. (TODO)
This patch implements only the first phase.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D90477
Sean Silva [Tue, 27 Oct 2020 16:59:33 +0000 (09:59 -0700)]
[mlir] Move some linalg patterns around.
The bufferization patterns are moved to the .cpp file, which is
preferred in the codebase when it makes sense.
The LinalgToStandard patterns are kept a header because they are
expected to be used individually. However, they are moved to
LinalgToStandard.h which is the file corresponding to where they are
defined.
This also removes TensorCastOpConverter, which is handled by
populateStdBufferizePatterns now. Eventually, the constant op lowering
will be handled as well, but it there are currently holdups on moving
it (see https://reviews.llvm.org/D89916).
Differential Revision: https://reviews.llvm.org/D90254
Geoffrey Martin-Noble [Fri, 30 Oct 2020 20:32:02 +0000 (13:32 -0700)]
Revert "[MLIR][SPIRV] Start module combiner."
This reverts commit
27324f28552d0c66e8b28efd9c15820e5f246619.
Shared libs build is broken linking lib/libMLIRSPIRVModuleCombiner.so:
```
ModuleCombiner.cpp:
undefined reference to `mlir::spirv::ModuleOp::addressing_model()
```
https://buildkite.com/mlir/mlir-core/builds/8988#
e3d966b9-ea43-492e-a192-
b28e71e9a15b
Keith Smiley [Thu, 29 Oct 2020 21:10:53 +0000 (14:10 -0700)]
[clang][NFC] Remove unused FileCheck prefix
This is to enable --allow-unused-duplicates=false. This prefix appears
to be outdated and intentionally unused.
Differential Revision: https://reviews.llvm.org/D90430
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 20:29:16 +0000 (16:29 -0400)]
Remove `noexcept` from
ac49500cd0484e1b2dcf37fa4c0dade6f113c2c9 to fix bots
I'm having trouble with bots today. Remove more cargo-cult from the
generic version of `OptionalStorage` that is failing on some (fewer)
bots (but not locally).
I expect this will fix:
```
FAILED: tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/FileEntryTest.cpp.o
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -DGTEST_HAS_TR1_TUPLE=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/clang/unittests/Basic -I/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic -I/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/include -Itools/clang/include -Iinclude -I/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include -I/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/utils/unittest/googletest/include -I/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/utils/unittest/googlemock/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -Wno-variadic-macros -fno-exceptions -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++14 -MD -MT tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/FileEntryTest.cpp.o -MF tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/FileEntryTest.cpp.o.d -o tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/FileEntryTest.cpp.o -c /home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp: In member function ‘virtual void {anonymous}::FileEntryTest_OptionalFileEntryRefDegradesToFileEntryPtr_Test::TestBody()’:
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp:48:46: error: use of deleted function ‘constexpr clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr()’
OptionalFileEntryRefDegradesToFileEntryPtr M0;
^~
In file included from /home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp:9:
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/include/clang/Basic/FileEntry.h:250:3: note: ‘constexpr clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr() noexcept’ is implicitly deleted because its exception-specification does not match the implicit exception-specification ‘’
OptionalFileEntryRefDegradesToFileEntryPtr() noexcept = default;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp: In member function ‘virtual void {anonymous}::FileEntryTest_equals_Test::TestBody()’:
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp:82:46: error: use of deleted function ‘constexpr clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr()’
OptionalFileEntryRefDegradesToFileEntryPtr M0;
^~
```
Peter Collingbourne [Tue, 27 Oct 2020 23:26:07 +0000 (16:26 -0700)]
hwasan: Move fixed shadow behind opaque no-op cast as well.
This is a workaround for poor heuristics in the backend where we can
end up materializing the constant multiple times. This is particularly
bad when using outlined checks because we materialize it for every call
(because the backend considers it trivial to materialize).
As a result the field containing the shadow base value will always
be set so simplify the code taking that into account.
Differential Revision: https://reviews.llvm.org/D90425
Paul C. Anagnostopoulos [Fri, 30 Oct 2020 17:31:29 +0000 (13:31 -0400)]
[TableGen] Remove spurious GISEL prefix from test.
Differential Revision: https://reviews.llvm.org/D90480
Peter Collingbourne [Tue, 27 Oct 2020 21:56:21 +0000 (14:56 -0700)]
AArch64: Use SBFX instead of UBFX to extract address granule in outlined HWASan checks.
In a kernel (or in general in environments where bit 55 of the address
is set) the shadow base needs to point to the end of the shadow region,
not the beginning. Bit 55 needs to be sign extended into bits 52-63
of the shadow base offset, otherwise we end up loading from an invalid
address. We can do this by using SBFX instead of UBFX.
Using SBFX should have no effect in the userspace case where bit 55
of the address is clear so we do so unconditionally. I don't think
we need a ABI version bump for this (but one will come anyway when
we switch to x20 for the shadow base register).
Differential Revision: https://reviews.llvm.org/D90424
Peter Collingbourne [Tue, 27 Oct 2020 19:10:08 +0000 (12:10 -0700)]
AArch64: Switch to x20 as the shadow base register for outlined HWASan checks.
From a code size perspective it turns out to be better to use a
callee-saved register to pass the shadow base. For non-leaf functions
it avoids the need to reload the shadow base into x9 after each
function call, at the cost of an additional stack slot to save the
caller's x20. But with x9 there is also a stack size cost, either
as a result of copying x9 to a callee-saved register across calls or
by spilling it to stack, so for the non-leaf functions the change to
stack usage is largely neutral.
It is also code size (and stack size) neutral for many leaf functions.
Although they now need to save/restore x20 this can typically be
combined via LDP/STP into the x30 save/restore. In the case where
the function needs callee-saved registers or stack spills we end up
needing, on average, 8 more bytes of stack and 1 more instruction
but given the improvements to other functions this seems like the
right tradeoff.
Unfortunately we cannot change the register for the v1 (non short
granules) check because the runtime assumes that the shadow base
register is stored in x9, so the v1 check still uses x9.
Aside from that there is no change to the ABI because the choice
of shadow base register is a contract between the caller and the
outlined check function, both of which are compiler generated. We do
need to rename the v2 check functions though because the functions
are deduplicated based on their names, not on their contents, and we
need to make sure that when object files from old and new compilers
are linked together we don't end up with a function that uses x9
calling an outlined check that uses x20 or vice versa.
With this change code size of /system/lib64/*.so in an Android build
with HWASan goes from
200066976 bytes to
194085912 bytes, or a 3%
decrease.
Differential Revision: https://reviews.llvm.org/D90422
Nikita Popov [Fri, 30 Oct 2020 19:26:42 +0000 (20:26 +0100)]
[PhaseOrdering] Add test for PR39282 (NFC)
While the actually incorrect transform happens in LoopUnroll, it
is based on noalias metadata inserted by the inliner, and
ultimately manifests in GVN. Add a phase ordering test that checks
this even if our representation of noalias metadata changes in
the future.
Mircea Trofin [Thu, 29 Oct 2020 00:44:13 +0000 (17:44 -0700)]
[FileCheck] Report missing prefixes when more than one is provided.
If more than a prefix is provided - e.g. --check-prefixes=CHECK,FOO - we
don't report if (say) FOO is never used. This may lead to a gap in our
test coverage.
This patch introduces a new option, --allow-unused-prefixes. It
currently is set to true, keeping today's behavior. After we explicitly
set it in tests where this behavior was actually intentional, we will
switch it to false by default.
Differential Revision: https://reviews.llvm.org/D90281
LLVM GN Syncbot [Fri, 30 Oct 2020 19:18:17 +0000 (19:18 +0000)]
[gn build] Port
ac49500cd04
Joseph Tremoulet [Fri, 30 Oct 2020 19:13:26 +0000 (15:13 -0400)]
[lldb] Report old modules from ModuleList::ReplaceEquivalent
This allows the Target to update its module list when loading a shared
module replaces an equivalent one.
A testcase is added which hits this codepath -- without the fix, the
target reports libbreakpad.so twice in its module list.
Reviewed By: jingham
Differential Revision: https://reviews.llvm.org/D89157
Joseph Tremoulet [Fri, 30 Oct 2020 19:12:10 +0000 (15:12 -0400)]
[lldb] GetSharedModule: Collect old modules in SmallVector
The various GetSharedModule methods have an optional out parameter for
the old module when a file has changed or been replaced, which the
Target uses to keep its module list current/correct. We've been using
a single ModuleSP to track "the" old module, and this change switches
to using a SmallVector of ModuleSP, which has a couple benefits:
- There are multiple codepaths which may discover an old module, and
this centralizes the code for how to handle multiples in one place,
in the Target code. With the single ModuleSP, each place that may
discover an old module is responsible for how it handles multiples,
and the current code is inconsistent (some code paths drop the first
old module, others drop the second).
- The API will be more natural for identifying old modules in routines
that work on sets, like ModuleList::ReplaceEquivalent (which I plan
on updating to report old module(s) in a subsequent change to fix a
bug).
I'm not convinced we can ever actually run into the case that multiple
old modules are found in the same GetOrCreateModule call, but I think
this change makes sense regardless, in light of the above.
When an old module is reported, Target::GetOrCreateModule calls
m_images.ReplaceModule, which doesn't allow multiple "old" modules; the
new code calls ReplaceModule for the first "old" module, and for any
subsequent old modules it logs the event and calls m_images.Remove.
Reviewed By: jingham
Differential Revision: https://reviews.llvm.org/D89156
Anna Thomas [Fri, 30 Oct 2020 16:48:18 +0000 (12:48 -0400)]
[CFG] Replace hardcoded max BBs explored as CL option. NFC.
This option was hardcoded to 32. Changing this as a CL option since we
have seen some cases downstream where increasing this limit allows us to
disprove reachability.
Reviewed-By: jdoerfert
Differential Revision: https://reviews.llvm.org/D90487
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 18:08:19 +0000 (14:08 -0400)]
Reapply "FileManager: Improve the FileEntryRef API and customize its OptionalStorage"
This reverts commit
940d0a310dca31ae97080b068cef92eadfee6367,
effectively reapplying
84e8257937ec6a332aa0b688f4dce57016516ffd, after
working around the compile errors on the bots that I wasn't seeing
locally. I removed the `constexpr` from `OptionalStorage<FileEntryRef>`
that I had cargo-culted from the generic version, since `FileEntryRef`
isn't relevant in `constexpr` contexts anyway.
The original commit message follows:
Make a few changes to the `FileEntryRef` API in preparation for
propagating it enough to remove `FileEntry::getName()`.
- Allow `FileEntryRef` to degrade implicitly to `const FileEntry*`. This
allows functions currently returning `const FileEntry *` to be updated
to return `FileEntryRef` without requiring all callers to be updated
in the same patch. This helps avoid both (a) massive patches where
many fields and locals are updated simultaneously and (b) noisy
incremental patches where the first patch adds `getFileEntry()` at
call sites and the second patch removes it. (Once `FileEntryRef` is
everywhere, we should remove this API.)
- Change `operator==` to compare the underlying `FileEntry*`, ignoring
any difference in the spelling of the filename. There were 0 users of
the existing function because it's not useful. In case comparing the
exact named reference becomes important, add/test `isSameRef`.
- Add `==` comparisons between `FileEntryRef` and `const FileEntry *`
(compares the `FileEntry*`).
- Customize `OptionalStorage<FileEntryRef>` to be pointer-sized. Add
a private constructor that initializes with `nullptr` and specialize
`OptionalStorage` to use it. This unblocks updating fields in
size-sensitive data structures that currently use `const FileEntry *`.
- Add `OptionalFileEntryRefDegradesToFileEntryPtr`, a wrapper around
`Optional<FileEntryRef>` that degrades to `const FileEntry*`. This
facilitates future incremental patches, like the same operator on
`FileEntryRef`. (Once `FileEntryRef` is everywhere, we should remove
this class.)
- Remove the unncessary `const` from the by-value return of
`FileEntryRef::getName`.
- Delete the unused function `FileEntry::isOpenForTests`.
Note that there are still `FileEntry` APIs that aren't wrapped and I
plan to deal with these separately / incrementally, as they are needed.
Differential Revision: https://reviews.llvm.org/D89834
ergawy [Fri, 30 Oct 2020 18:36:19 +0000 (14:36 -0400)]
[MLIR][SPIRV] Start module combiner.
This commit adds a new library that merges/combines a number of spv
modules into a combined one. The library has a single entry point:
combine(...).
To combine a number of MLIR spv modules, we move all the module-level ops
from all the input modules into one big combined module. To that end, the
combination process can proceed in 2 phases:
(1) resolving conflicts between pairs of ops from different modules
(2) deduplicate equivalent ops/sub-ops in the merged module. (TODO)
This patch implements only the first phase.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D90477
Scott Linder [Fri, 30 Oct 2020 18:37:28 +0000 (18:37 +0000)]
[AMDGPU] Refactor and extend elf-header-flags-mach tests
* Factor out common elements of the input YAML document and use sed to
macro replace the run line specific elements.
* Add checks for the common elements which depend on the ELF class.
* Use non-numeric suffix for temporary files to avoid merge conflicts.
* Sort tests by GFX# ascending.
* Group ELF and YAML tests by GFX#.
Reviewed By: t-tye
Differential Revision: https://reviews.llvm.org/D90245
Louis Dionne [Fri, 30 Oct 2020 18:55:37 +0000 (14:55 -0400)]
[libc++] Fix tests failing with Clang after removing GCC warnings