Alexey Baturo [Sun, 4 Oct 2020 09:38:06 +0000 (12:38 +0300)]
[RISCV][ASAN] support code for architecture-specific parts of asan
[9/11] patch series to port ASAN for riscv64
Depends On D87579
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D87580
Roman Lebedev [Sun, 4 Oct 2020 08:27:07 +0000 (11:27 +0300)]
[OldPM] Pass manager: run SROA after (simple) loop unrolling
I have stumbled into this pretty accidentally, when rewriting
some spaghetti-like code into something more structured,
which involved using some `std::array<>`s. And to my surprise,
the `alloca`s remained, causing about `+160%` perf regression.
https://llvm-compile-time-tracker.com/compare.php?from=
bb6f4d32aac3eecb51909f4facc625219307ee68&to=
d563e66f40f9d4d145cb2050e41cb961e2b37785&stat=instructions
suggests that this has geomean compile-time cost of `+0.08%`.
Note that D68593 /
cecc0d27ad58c0aed8ef9ed99bbf691e137a0f26
already did this chage for NewPM, but left OldPM in a pessimized state.
This fixes [[ https://bugs.llvm.org/show_bug.cgi?id=40011 | PR40011 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=42794 | PR42794 ]] and probably some other reports.
Reviewed By: nikic, xbolva00
Differential Revision: https://reviews.llvm.org/D87972
Alexey Baturo [Sun, 4 Oct 2020 07:31:30 +0000 (10:31 +0300)]
[RISCV][ASAN] unwind fixup
[8/11] patch series to port ASAN for riscv64
Depends On D87577
Reviewed By: eugenis, vitalybuka
Differential Revision: https://reviews.llvm.org/D87579
Jonas Devlieghere [Sun, 4 Oct 2020 05:36:28 +0000 (22:36 -0700)]
[lldb] [test/Register] Mark new FP reg tests XFAIL on Darwin
This is failing on GreenDragon:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/24066/
Craig Topper [Sun, 4 Oct 2020 04:54:59 +0000 (21:54 -0700)]
[X86] LOADIWKEY, ENCODEKEY128 and ENCODEKEY256 clobber EFLAGS.
Craig Topper [Sun, 4 Oct 2020 04:42:06 +0000 (21:42 -0700)]
[X86] Add memory operand to AESENC/AESDEC Key Locker instructions.
This removes FIXMEs from selectAddr.
Craig Topper [Sun, 4 Oct 2020 00:47:52 +0000 (17:47 -0700)]
[X86] Move ENCODEKEY128/256 handling from lowering to selection.
We should avoid emitting MachineSDNodes from lowering.
We can use the the implicit def handling in InstrEmitter to avoid
manually copying from each xmm result register. We only need to
manually emit the copies for the implicit uses.
Craig Topper [Sun, 4 Oct 2020 00:12:23 +0000 (17:12 -0700)]
[X86] Remove X86ISD::MWAITX_DAG. Just match the intrinsic to the custom inserter pseudo instruction during isel.
Stephen Neuendorffer [Mon, 3 Aug 2020 18:24:15 +0000 (11:24 -0700)]
[RFC] Factor out repetitive cmake patterns for llvm-style projects
New projects (particularly out of tree) have a tendency to hijack the existing
llvm configuration options and build targets (add_llvm_library,
add_llvm_tool). This can lead to some confusion.
1) When querying a configuration variable, do we care about how LLVM was
configured, or how these options were configured for the out of tree project?
2) LLVM has lots of defaults, which are easy to miss
(e.g. LLVM_BUILD_TOOLS=ON). These options all need to be duplicated in the
CMakeLists.txt for the project.
In addition, with LLVM Incubators coming online, we need better ways for these
incubators to do things the "LLVM way" without alot of futzing. Ideally, this
would happen in a way that eases importing into the LLVM monorepo when
projects mature.
This patch creates some generic infrastructure in llvm/cmake/modules and
refactors MLIR to use this infrastructure. This should expand to include
add_xxx_library, which is by far the most complicated bit of building a
project correctly, since it has to deal with lots of shared library
configuration bits. (MLIR currently hijacks the LLVM infrastructure for
building libMLIR.so, so this needs to get refactored anyway.)
Differential Revision: https://reviews.llvm.org/D85140
Craig Topper [Sat, 3 Oct 2020 23:55:18 +0000 (16:55 -0700)]
[X86] Add X86ISD opcodes for the Key Locker AESENC*KL and AESDEC*KL instructions
Instead of emitting MachineSDNodes during lowering, emit X86ISD
opcodes. These opcodes will either be selected by tablegen
patterns or custom selection code.
Emitting MachineSDNodes during lowering is uncommon so this makes
things more consistent. It also allows selectAddr to be called to
perform address matching during instruction selection.
I had trouble getting tablegen to accept XMM0-XMM7 as results in
an isel pattern for the WIDE instructions so I had to use custom
instruction selection.
Jacques Pienaar [Sat, 3 Oct 2020 22:17:38 +0000 (15:17 -0700)]
Add indented raw_ostream class
Class simplifies keeping track of the indentation while emitting. For every new line the current indentation is simply prefixed (if not at start of line, then it just emits as normal). Add a simple Region helper that makes it easy to have the C++ scope match the emitted scope.
Use this in op doc generator and rewrite generator.
This reverts revert commit
be185b6a7355fdfeb1c31df2e1272366fe58b01f addresses shared lib failure by fixing up cmake files.
Differential Revision: https://reviews.llvm.org/D84107
Alexander Shaposhnikov [Sat, 3 Oct 2020 21:18:38 +0000 (14:18 -0700)]
[Object][MachO] Refactor MachOUniversalWriter
This diff refactors writeUniversalBinary and adds writeUniversalBinaryToBuffer.
This is a preparation for adding support for universal binaries to llvm-objcopy.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D88372
Mircea Trofin [Thu, 1 Oct 2020 21:35:11 +0000 (14:35 -0700)]
[MC] Assert that MCRegUnitIterator operates over MCRegisters
The signature of the ctor expects a MCRegister, but currently any
unsigned value can be converted to a MCRegister.
This patch checks that indeed the provided value is a physical register
only. We want to eventually stop implicitly converting unsigned or
Register to MCRegister (which is incorrect). The next step after this
patch is changing uses of MCRegUnitIterator to explicitly cast Register
or unsigned values to MCRegister. To that end, this patch also
introduces 2 APIs that make that conversion checked and explicit.
Differential Revision: https://reviews.llvm.org/D88705
Michał Górny [Sat, 3 Oct 2020 20:16:29 +0000 (22:16 +0200)]
[lldb] [test/Register] Mark new FP reg tests XFAIL on Windows
Florian Hahn [Sat, 3 Oct 2020 15:31:49 +0000 (16:31 +0100)]
[VPlan] Properly update users when updating operands.
When updating operands of a VPUser, we also have to adjust the list of
users for the new and old VPValues. This is required once we start
transitioning recipes to become VPValues.
Roman Lebedev [Sat, 3 Oct 2020 19:46:50 +0000 (22:46 +0300)]
[NFC][InstCombine] Autogenerate a few tests being affected by an upcoming patch
Roman Lebedev [Sat, 3 Oct 2020 19:32:46 +0000 (22:32 +0300)]
[NFC][PhaseOrdering] Add a test showing new inttoptr casts after SROA due to InstCombine (PR47592)
We could either try to make SROA more picky to the new type
and/or prevent InstCombine from creating the original problem (converting load-stores to operate on ints),
and/or make InstCombine recover the situation by cleaning up all that cruft.
Florian Hahn [Sat, 3 Oct 2020 19:41:41 +0000 (20:41 +0100)]
[LV] Add another test case with unsinkable first-order recurrences.
Martin Storsjö [Wed, 23 Sep 2020 12:00:53 +0000 (15:00 +0300)]
[AArch64] Prefer prologues with sp adjustments merged into stp/ldp for WinCFI, if optimizing for size
This makes the prologue match the windows canonical layout, for
cases without a frame pointer.
This can potentially be a slower (a longer dependency chain of the
sp register, and potentially one arithmetic operation more on some
cores), but gives notable size improvements.
The previous two commits shrinks a 166 KB xdata section by 49 KB,
and if the change from this commit is enabled, it shrinks the xdata
section by another 25 KB.
In total, since the start of the recent arm64 unwind info cleanups
and optimizations (since before commit
37ef743cbf3), the xdata+pdata
sections of the same test DLL has shrunk from 407 KB in total
originally, to 163 KB now.
Differential Revision: https://reviews.llvm.org/D88701
Martin Storsjö [Wed, 23 Sep 2020 11:26:45 +0000 (14:26 +0300)]
[AArch64] Allow pairing lr with other GPRs for WinCFI
This saves one instruction per prologue/epilogue for any function with
an odd number of callee-saved GPRs, but more importantly, allows such
functions to match the packed unwind format.
Differential Revision: https://reviews.llvm.org/D88699
Martin Storsjö [Wed, 23 Sep 2020 11:14:05 +0000 (14:14 +0300)]
[AArch64] Match the windows canonical callee saved register order
On windows, the callee saved registers in a canonical prologue are
ordered starting from a lower register number at a lower stack
address (with the possible gap for aligning the stack at the top);
this is the opposite order that llvm normally produces.
To achieve this, reverse the order of the registers in the
assignCalleeSavedSpillSlots callback, to get the stack objects
laid out by PrologEpilogInserter in the right order, and adjust
computeCalleeSaveRegisterPairs to lay them out from the bottom up.
This allows generated prologs more often to match the format that
allows the unwind info to be written as packed info.
Differential Revision: https://reviews.llvm.org/D88677
Nico Weber [Sat, 3 Oct 2020 18:22:53 +0000 (14:22 -0400)]
Revert "[Driver] Move detectLibcxxIncludePath to ToolChain"
This reverts commit
e25bf2592060e7751f8b14522c97081ce2047175.
Breaks tests on Windows, see comments on https://reviews.llvm.org/D88452
Nathan Lanza [Sat, 3 Oct 2020 17:38:00 +0000 (13:38 -0400)]
[clang][NFC] Change a mention of `objc_static_protocol` to `non_runtime`
Michał Górny [Wed, 30 Sep 2020 13:33:01 +0000 (15:33 +0200)]
[lldb] [test/Register] Add read/write tests for x87 regs
Add a partial read/write tests for x87 FPU registers. This includes
reading and writing ST registers, control registers and floating-point
exception data registers (fop, fip, fdp).
The tests assume the current (roughly incorrect) behavior of reporting
the 'abridged' 8-bit ftag state as 16-bit ftag. They also assume Linux
plugin behavior of reporting fip/fdp split into halves as (fiseg, fioff)
and (foseg, fooff).
Differential Revision: https://reviews.llvm.org/D88583
Michał Górny [Thu, 1 Oct 2020 17:38:49 +0000 (19:38 +0200)]
[lldb] [Process/NetBSD] Fix crash on unsupported i386 regs
Multiple fixes related to bugs discovered while debugging a crash
when reading all registers on i386.
The underlying problem was that GetSetForNativeRegNum() did not account
for MPX registers on i386, and since it only compared against upper
bounds of each known register set, the MPX registers were classified
into the wrong set and therefore considered supported. However, they
were not expected in RegNumX86ToX86_64() and caused the assertion
to fail.
This includes:
- adding (unused) i386 → x86_64 translations for MPX registers
- fixing GetSetForNativeRegNum() to check both lower and upper bound
for register sets, to avoid wrongly classifying unhandled register
sets
- adding missing range check for MPX registers on i386
- renaming k_last_mpxr to k_last_mpxr_i386 for consistency
- replacing return-assertions with llvm_unreachable() and adding more
checks for unexpected parameters
Differential Revision: https://reviews.llvm.org/D88682
Michał Górny [Thu, 1 Oct 2020 17:31:59 +0000 (19:31 +0200)]
[lldb] [Process/NetBSD] Fix reading FIP/FDP registers
Fix reading FIP/FDP registers to correctly return segment and offset
parts. On amd64, this roughly matches the Linux behavior of splitting
the 64-bit FIP/FDP into two halves, and putting the higher 32 bits
into f*seg and lower into f*off. Well, actually we use only 16 bits
of higher half but the CPUs do not seem to handle more than that anyway.
Differential Revision: https://reviews.llvm.org/D88681
Michał Górny [Sat, 3 Oct 2020 14:38:09 +0000 (16:38 +0200)]
[asan] Stop instrumenting user-defined ELF sections
Do not instrument user-defined ELF sections (whose names resemble valid
C identifiers). They may have special use semantics and modifying them
may break programs. This is e.g. the case with NetBSD __link_set API
that expects these sections to store consecutive array elements.
Differential Revision: https://reviews.llvm.org/D76665
Simon Pilgrim [Sat, 3 Oct 2020 17:32:47 +0000 (18:32 +0100)]
[InstCombine] Add tests for or(shl(x,c1),lshr(y,c2)) patterns that could fold to funnel shifts
Some initial test coverage toward fixing PR46896 - these are just copied from rotate.ll
Simon Pilgrim [Sat, 3 Oct 2020 16:51:40 +0000 (17:51 +0100)]
[Analysis] resolveAllCalls - fix use after std::move warning. NFCI.
We can't use Use.Calls after its std::move()'d to TmpCalls as it will be in an undefined state. Instead, swap with the known empty map in TmpCalls so we can then safely emplace_back into the now empty Use.Calls.
Fixes clang static analyzer warning.
Jacques Pienaar [Sat, 3 Oct 2020 16:41:35 +0000 (09:41 -0700)]
Revert "Add indented raw_ostream class"
This reverts commit
78530ce65375fa02bc96019e5cc9d73db8adaca4.
Fails on shared_lib build.
Simon Pilgrim [Sat, 3 Oct 2020 16:10:44 +0000 (17:10 +0100)]
[InstCombine] Add or(shl(v,and(x,bw-1)),lshr(v,bw-and(x,bw-1))) rotate tests
If we know the shift amount is less than the bitwidth we should be able to convert this to a rotate/funnel shift
Jacques Pienaar [Sat, 3 Oct 2020 15:53:43 +0000 (08:53 -0700)]
Add indented raw_ostream class
Class simplifies keeping track of the indentation while emitting. For every new line the current indentation is simply prefixed (if not at start of line, then it just emits as normal). Add a simple Region helper that makes it easy to have the C++ scope match the emitted scope.
Use this in op doc generator and rewrite generator.
Differential Revision: https://reviews.llvm.org/D84107
David Green [Sat, 3 Oct 2020 15:47:50 +0000 (16:47 +0100)]
[ARM] Fix pointer offset when splitting stores from VMOVDRR
We were not accounting for the pointer offset when splitting a store from
a VMOVDRR node, which could lead to incorrect aliasing info. In this
case it is the fneg via integer arithmetic that gives us a store->load
pair that we started getting wrong.
Differential Revision: https://reviews.llvm.org/D88653
Simon Pilgrim [Sat, 3 Oct 2020 15:26:29 +0000 (16:26 +0100)]
[InstCombine] recognizeBSwapOrBitReverseIdiom - add vector support
Add basic vector handling to recognizeBSwapOrBitReverseIdiom/collectBitParts - this works at the element level, all vector element operations must match (splat constants etc.) and there is no cross-element support (insert/extract/shuffle etc.).
Aaron Ballman [Sat, 3 Oct 2020 15:10:26 +0000 (11:10 -0400)]
Add a break statement to appease the build bots; NFC
Simon Pilgrim [Sat, 3 Oct 2020 14:29:05 +0000 (15:29 +0100)]
[InstCombine] recognizeBSwapOrBitReverseIdiom - use generic CreateIntegerCast
Try to appease buildbots breakages due to D88578
Andrzej Warzynski [Fri, 2 Oct 2020 08:53:35 +0000 (09:53 +0100)]
[flang][NFC] Fix build errors for clang-10
This patch fixes one worning. Since Flang sets `-Werror`, that's
sufficient for a build to fail. As per flang/README.md, Clang-10 is one
of the officially supported compilers.
Differential Revision: https://reviews.llvm.org/D88723
Bernhard Manfred Gruber [Sat, 3 Oct 2020 14:08:44 +0000 (10:08 -0400)]
modernize-use-trailing-return-type fix for PR44206
Prevent rewrite when an unqualified id in a typedef type collides
with a function argument name. Fixes PR44206.
Simon Pilgrim [Sat, 3 Oct 2020 13:52:25 +0000 (14:52 +0100)]
[InstCombine] recognizeBSwapOrBitReverseIdiom - support for 'partial' bswap patterns (PR47191) (Reapplied)
If we're bswap'ing some bytes and zero'ing the remainder we can perform this as a bswap+mask which helps us match 'partial' bswaps as a first step towards folding into a more complex bswap pattern.
Reapplied with early-out if recognizeBSwapOrBitReverseIdiom collects a source wider than the result type.
Differential Revision: https://reviews.llvm.org/D88578
Roman Lebedev [Sat, 3 Oct 2020 13:01:48 +0000 (16:01 +0300)]
[NFCI][clang-tidy] FunctionCognitiveComplexityCheck::check(): try to fix windows arm build bots
http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/1482/steps/build-llvm-project/logs/stdio
http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/3285/steps/build-llvm-project/logs/stdio
Mark de Wever [Sat, 3 Oct 2020 12:31:46 +0000 (14:31 +0200)]
[Sema] List conversion validate character array.
The function `TryListConversion` didn't properly validate the following
part of the standard:
Otherwise, if the parameter type is a character array [... ]
and the initializer list has a single element that is an
appropriately-typed string literal (8.5.2 [dcl.init.string]), the
implicit conversion sequence is the identity conversion.
This caused the following call to `f()` to be ambiguous.
void f(int(&&)[1]);
void f(unsigned(&&)[1]);
void g(unsigned i) {
f({i});
}
This issue only occurs when the initializer list had one element.
Differential Revision: https://reviews.llvm.org/D87561
David Green [Sat, 3 Oct 2020 11:25:34 +0000 (12:25 +0100)]
[ARM] Test to show incorrect pointer info. NFC
Nikita Popov [Sat, 3 Oct 2020 09:27:33 +0000 (11:27 +0200)]
[MemCpyOpt] Make moveUp() a member method (NFC)
So we don't have to pass through more parameters in the future.
Nikita Popov [Sat, 3 Oct 2020 08:37:36 +0000 (10:37 +0200)]
[MemCpyOpt] Remove unnecessary -dse from test (NFC)
This one doesn't even have any dead stores to eliminate...
Craig Topper [Sat, 3 Oct 2020 02:10:29 +0000 (19:10 -0700)]
[X86] Key Locker instructions should use VR128 regclass not VR128X.
Evandro Menezes [Fri, 2 Oct 2020 21:30:39 +0000 (16:30 -0500)]
[PATCH] Fix typo (NFC)
Petr Hosek [Tue, 22 Sep 2020 08:01:16 +0000 (01:01 -0700)]
[Driver] Move detectLibcxxIncludePath to ToolChain
This helper method is useful even outside of Gnu toolchains, so move
it to ToolChain so it can be reused in other toolchains such as Fuchsia.
Differential Revision: https://reviews.llvm.org/D88452
Craig Topper [Sat, 3 Oct 2020 01:19:51 +0000 (18:19 -0700)]
[X86] Move MWAITX_DAG ISD opcode so it is not in the strict FP range.
Add a comment to hopefully prevent anyone else from making the
same mistake.
Craig Topper [Sat, 3 Oct 2020 00:06:05 +0000 (17:06 -0700)]
[X86] Add missing intrinsic test for aesdecwide128kl and aesdecwide256kl. Capture all output values in keylocker tests. NFC
The aesdec/enc instructions produce a flag output and one or eight
xmm regsiter outputs. The test were not capturing the xmm outputs.
Also add nounwind to tests to remove .cfi directives
Roland McGrath [Sat, 3 Oct 2020 01:12:57 +0000 (18:12 -0700)]
Revert "[lsan] Share platform allocator settings between ASan and LSan"
This reverts commit
1c897e9d72979730f7555e77dd54fe892a461637.
It broke builds for 32-bit targets.
Differential Revision: https://reviews.llvm.org/D88768
Roland McGrath [Wed, 23 Sep 2020 01:27:03 +0000 (18:27 -0700)]
[lsan] Share platform allocator settings between ASan and LSan
This moves the platform-specific parameter logic from asan into
lsan_common.h to lsan can share it.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D87795
Jianzhou Zhao [Sat, 3 Oct 2020 00:21:58 +0000 (00:21 +0000)]
Fix the test case in D88686
Adjusted when to check RSS.
Brad Smith [Sat, 3 Oct 2020 00:05:09 +0000 (20:05 -0400)]
[Sparc] Remove cast that truncates immediate operands to 32 bits.
Patch by: Mark Kettenis
Test provided by Jessica Clarke.
Differential Revision: https://reviews.llvm.org/D87210
Petr Hosek [Fri, 2 Oct 2020 21:16:27 +0000 (14:16 -0700)]
[CMake] Don't use CMakePushCheckState
When we call cmake_pop_check_state, we undo any changes to REQUIRED
variables performed by HandleLLVMOptions which is undesirable. Rather
use replacement which is what we've used prior to
8d26760a.
Differential Revision: https://reviews.llvm.org/D88756
LLVM GN Syncbot [Fri, 2 Oct 2020 23:59:59 +0000 (23:59 +0000)]
[gn build] Port
ace644030e6
Petr Hosek [Fri, 2 Oct 2020 23:59:28 +0000 (16:59 -0700)]
Revert "[Driver] Move detectLibcxxIncludePath to ToolChain"
This reverts commit
a594fd28e373cb7cd348cf01f6a90e055bf6cf6d which
is failign on some bots.
Yaxun (Sam) Liu [Wed, 30 Sep 2020 00:23:03 +0000 (20:23 -0400)]
Diagnose invalid target ID for AMDGPU toolchain for assembler
AMDGPU toolchain currently only diagnose invalid target ID for OpenCL
source compilation. Invalid target ID is not diagnosed for assembler.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D88377
Julian Lettner [Fri, 2 Oct 2020 23:18:15 +0000 (16:18 -0700)]
[fuzzer] Remove unused variable
`TempAutoDictionary` is never used. Maybe a leftover of a previous
experiment?
Differential Revision: https://reviews.llvm.org/D88763
Yaxun (Sam) Liu [Wed, 30 Sep 2020 00:16:32 +0000 (20:16 -0400)]
[CUDA][HIP] Fix bound arch for offload action for fat binary
Currently CUDA/HIP toolchain uses "unknown" as bound arch
for offload action for fat binary. This causes -mcpu or -march
with "unknown" added in HIPToolChain::TranslateArgs or
CUDAToolChain::TranslateArgs.
This causes issue for https://reviews.llvm.org/D88377 since
HIP toolchain needs to check -mcpu in HIPToolChain::TranslateArgs.
The bound arch of offload action for fat binary is not really
used, therefore set it to CudaArch::UNUSED.
Differential Revision: https://reviews.llvm.org/D88524
Jianzhou Zhao [Fri, 2 Oct 2020 22:58:30 +0000 (22:58 +0000)]
Fix the test case from D88686
It seems that one buildnot RSS value is much higher after munmap than
local run.
Arthur Eubanks [Thu, 1 Oct 2020 18:49:45 +0000 (11:49 -0700)]
[MetaRenamer][NewPM] Port metarenamer to NPM
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D88690
Arthur Eubanks [Fri, 2 Oct 2020 22:39:15 +0000 (15:39 -0700)]
[test][Coro][NewPM] Fix coro-elide.ll under NPM
Richard Smith [Fri, 2 Oct 2020 20:34:46 +0000 (13:34 -0700)]
Don't reject calls to MinGW's unusual _setjmp declaration.
We now recognize this function as a builtin despite it having an
unexpected number of parameters; make sure we don't enforce that it has
only 1 argument for its 2 parameters.
Yaxun (Sam) Liu [Fri, 25 Sep 2020 16:34:38 +0000 (12:34 -0400)]
[HIP] Align device binary
To facilitate faster loading of device binaries and share them among processes,
HIP runtime favors their alignment being 4096 bytes. HIP runtime can load
unaligned device binaries, however, aligning them at 4096 bytes results in
faster loading and less shared memory usage.
This patch adds an option -bundle-align to clang-offload-bundler which allows
bundles to be aligned at specified alignment. By default it is 1, which is NFC
compared to existing format.
This patch then aligns embedded fat binary and device binary inside fat binary
at 4096 bytes.
It has been verified this change does not cause significant overall file size increase
for typical HIP applications (less than 1%).
Differential Revision: https://reviews.llvm.org/D88734
Louis Dionne [Fri, 2 Oct 2020 21:30:42 +0000 (17:30 -0400)]
[libc++] Fix the build with GCC < 10
For now, we still need to support older GCCs, so work around the lack of
__is_constructible on older GCCs.
Vitaly Buka [Tue, 29 Sep 2020 21:55:46 +0000 (14:55 -0700)]
[NFC][MSAN] Extract llvm.abs handling into a function
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D88519
Nathan Lanza [Thu, 27 Feb 2020 23:57:44 +0000 (15:57 -0800)]
[clang] Implement objc_non_runtime_protocol to remove protocol metadata
Summary:
Motivated by the new objc_direct attribute, this change adds a new
attribute that remotes metadata from Protocols that the programmer knows
isn't going to be used at runtime. We simply have the frontend skip
generating any protocol metadata entries (e.g. OBJC_CLASS_NAME,
_OBJC_$_PROTOCOL_INSTANCE_METHDOS, _OBJC_PROTOCOL, etc) for a protocol
marked with `__attribute__((objc_non_runtime_protocol))`.
There are a few APIs used to retrieve a protocol at runtime.
`@protocol(SomeProtocol)` will now error out of the requested protocol
is marked with attribute. `objc_getProtocol` will return `NULL` which
is consistent with the behavior of a non-existing protocol.
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75574
Roman Lebedev [Thu, 17 Aug 2017 15:57:00 +0000 (18:57 +0300)]
[clang-tidy] Implement readability-function-cognitive-complexity check
Currently, there is basically just one clang-tidy check to impose
some sanity limits on functions - `clang-tidy-readability-function-size`.
It is nice, allows to limit line count, total number of statements,
number of branches, number of function parameters (not counting
implicit `this`), nesting level.
However, those are simple generic metrics. It is still trivially possible
to write a function, which does not violate any of these metrics,
yet is still rather unreadable.
Thus, some additional, slightly more complicated metric is needed.
There is a well-known [[ https://en.wikipedia.org/wiki/Cyclomatic_complexity | Cyclomatic complexity]], but certainly has its downsides.
And there is a [[ https://www.sonarsource.com/docs/CognitiveComplexity.pdf | COGNITIVE COMPLEXITY by SonarSource ]], which is available for opensource on https://sonarcloud.io/.
This check checks function Cognitive Complexity metric, and flags
the functions with Cognitive Complexity exceeding the configured limit.
The default limit is `25`, same as in 'upstream'.
The metric is implemented as per [[ https://www.sonarsource.com/docs/CognitiveComplexity.pdf | COGNITIVE COMPLEXITY by SonarSource ]] specification version 1.2 (19 April 2017), with two notable exceptions:
* `preprocessor conditionals` (`#ifdef`, `#if`, `#elif`, `#else`,
`#endif`) are not accounted for.
Could be done. Currently, upstream does not account for them either.
* `each method in a recursion cycle` is not accounted for.
It can't be fully implemented, because cross-translational-unit
analysis would be needed, which is not possible in clang-tidy.
Thus, at least right now, i completely avoided implementing it.
There are some further possible improvements:
* Are GNU statement expressions (`BinaryConditionalOperator`) really free?
They should probably cause nesting level increase,
and complexity level increase when they are nested within eachother.
* Microsoft SEH support
* ???
Reviewed By: aaron.ballman, JonasToth, lattner
Differential Revision: https://reviews.llvm.org/D36836
Petr Hosek [Tue, 22 Sep 2020 08:01:16 +0000 (01:01 -0700)]
[Driver] Move detectLibcxxIncludePath to ToolChain
This helper method is useful even outside of Gnu toolchains, so move
it to ToolChain so it can be reused in other toolchains such as Fuchsia.
Differential Revision: https://reviews.llvm.org/D88452
Louis Dionne [Fri, 2 Oct 2020 20:44:43 +0000 (16:44 -0400)]
[libc++] Allow retries on some slightly flaky mutex tests
Krzysztof Parzyszek [Thu, 1 Oct 2020 16:01:07 +0000 (11:01 -0500)]
[Hexagon] Move selection of HVX multiply from lowering to patterns
Also, change i32*i32 to V6_vmpyieoh + V6_vmpyiewuh_acc, which works
on V60 as well.
Alexey Lapshin [Sat, 19 Sep 2020 15:53:44 +0000 (18:53 +0300)]
[llvm-objcopy][NFC] refactor error handling. part 3.
Remove usages of special error reporting functions(error(),
reportError()). Errors are reported as Expected<>/Error returning
values. This part is for ELF subfolder of llvm-objcopy.
Testing: check-all.
Differential Revision: https://reviews.llvm.org/D87987
Jianzhou Zhao [Thu, 1 Oct 2020 18:05:34 +0000 (18:05 +0000)]
Release the shadow memory used by the mmap range at munmap
When an application does a lot of pairs of mmap and munmap, if we did
not release shadoe memory used by mmap addresses, this would increase
memory usage.
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D88686
Tim Keith [Fri, 2 Oct 2020 20:08:49 +0000 (13:08 -0700)]
[flang][NFC] Fix mis-matched struct/class declarations
The template `ListDirectedStatementState` was declared as a struct and then as a class.
Fix it so they match.
Differential Revision: https://reviews.llvm.org/D88711
Jonas Devlieghere [Fri, 2 Oct 2020 19:56:38 +0000 (12:56 -0700)]
[lldb] Add a "design" section to the documentation.
Create a "Design" section for the LLDB documentation. The goal is to
have design documents that describe how the LLDB internals work.
Currently similar pages are mixed together under the "Development". The
existing pages describing the architecture, the reproducers, the
structured data plugins, and the SB API could be housed here. I hope
we'd see more pages being added here in the future.
Differential revision: https://reviews.llvm.org/D88516
Nikita Popov [Fri, 2 Oct 2020 18:42:22 +0000 (20:42 +0200)]
[MemCpyOpt] Add helper to erase instructions (NFC)
Next to erasing the instruction, we also always want to remove
it from MSSA and MD. Use a common function to do so.
This is a refactoring split out from D26739.
Nikita Popov [Fri, 2 Oct 2020 19:47:03 +0000 (21:47 +0200)]
[MemCpyOpt] Avoid double invalidation (NFCI)
The removal of the cpy instruction is left to the caller of
performCallSlotOptzn(), including the invalidation of MD. Both
call-sites already do this.
Also handle incrementation of NumMemCpyInstr consistently at the
call-site. One of the call-site was already doing this, which
ended up incrementing the statistic twice.
This fix was part of D26739.
Douglas Yung [Fri, 2 Oct 2020 19:13:51 +0000 (12:13 -0700)]
Relax newly added opcode alias check to check only for a number instead of a specific opcode.
ergawy [Fri, 2 Oct 2020 18:56:17 +0000 (14:56 -0400)]
[MLIR][SPIRV] Add initial support for OpSpecConstantComposite.
This commit adds support to SPIR-V's composite specialization constants.
These are specialization constants which are composed of other spec
constants (whehter scalar or composite), regular constatns, or undef
values.
This commit adds support for parsing, printing, verification, and
(De)serialization.
A few TODOs are still in order:
- Supporting more types of constituents; currently, only scalar spec constatns are supported.
- Extending `spv._reference_of` to support composite spec constatns.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D88568
Louis Dionne [Fri, 2 Oct 2020 19:07:40 +0000 (15:07 -0400)]
[libc++] NFCI: Remove the _LIBCPP_DEBUG_MODE helper macro
It was used inconsistently and the name was pretty confusing, so we might
as well use `#if _LIBCPP_DEBUG_LEVEL == 2` consistently everywhere.
Louis Dionne [Fri, 2 Oct 2020 19:02:52 +0000 (15:02 -0400)]
[libc++] NFCI: Simplify macro definitions for the debug mode
The debug mode always had three possibilities:
- _LIBCPP_DEBUG is undefined => no assertions
- _LIBCPP_DEBUG == 0 => some assertions
- _LIBCPP_DEBUG == 1 => some assertions + iterator checks
This was documented that way, however the code did not make this clear
at all. The discrepancy between _LIBCPP_DEBUG and _LIBCPP_DEBUG_LEVEL
was especially confusing. I reworked how the various macros are defined
without changing anything else to make the code clearer.
Evgenii Stepanov [Tue, 15 Sep 2020 19:49:18 +0000 (12:49 -0700)]
[docs] Update ControlFlowIntegrity.rst.
Expand the list of targets that support cfi-icall.
Add ThinLTO everywhere LTO is mentioned. AFAIK all CFI features are
supported with ThinLTO.
Differential Revision: https://reviews.llvm.org/D87717
Fangrui Song [Fri, 2 Oct 2020 18:43:17 +0000 (11:43 -0700)]
[llc] Initialize TargetOptions after Triple is available
Some targets have different defaults. This patch defers initialization of `TargetOptions` so that a future patch can pass `TargetOptions` to `InitTargetOptionsFromCodeGenFlags`
Reviewed By: jasonliu
Differential Revision: https://reviews.llvm.org/D88748
Amara Emerson [Fri, 2 Oct 2020 18:26:22 +0000 (11:26 -0700)]
Update legalizer-info-validation.mir test to test all opcodes.
The test doesn't fail if we add opcodes to the end of the opcodes definition
list, so we were missing some.
Louis Dionne [Fri, 2 Oct 2020 18:29:48 +0000 (14:29 -0400)]
[libc++] NFCI: Remove _LIBCPP_EXTERN_TEMPLATE2
This seems to have been added a long time ago as a temporary help
for debugging some <regex> issue, but it's really the same as
_LIBCPP_EXTERN_TEMPLATE.
Nikita Popov [Fri, 2 Oct 2020 17:16:37 +0000 (19:16 +0200)]
[MemCpyOpt] Add tests from D40802 (NFC)
Even though that patch didn't stick, we should retain the test
coverage.
Arthur Eubanks [Wed, 30 Sep 2020 05:29:26 +0000 (22:29 -0700)]
[DAE] MarkLive in MarkValue(MaybeLive) if any use is live
While looping through all args or all return values, we may mark a use
of a later iteration as live. Previously when we got to that later value
it would ignore that and continue adding to Uses instead of marking it
live. For example, when looping through arg#0 and arg#1,
MarkValue(arg#0, Live) may cause some use of arg#1 to be live, but
MarkValue(arg#1, MaybeLive) will not notice that and continue adding
into Uses.
Now MarkValue(RA, MaybeLive) will MarkLive(RA) if any use is live.
Fixes PR47444.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D88529
Peter Collingbourne [Fri, 2 Oct 2020 17:20:31 +0000 (10:20 -0700)]
scudo: Simplify AtomicOptions::setFillContentsMode. NFCI.
Differential Revision: https://reviews.llvm.org/D88747
Arthur Eubanks [Fri, 25 Sep 2020 17:59:20 +0000 (10:59 -0700)]
Reland [AlwaysInliner] Update BFI when inlining
Reviewed By: davidxl
Differential Revision: https://reviews.llvm.org/D88324
Arthur Eubanks [Fri, 2 Oct 2020 17:31:56 +0000 (10:31 -0700)]
[gn build] Don't define CINDEX_EXPORTS
This causes
../../clang/include\clang-c/Platform.h(23,11): warning: 'CINDEX_EXPORTS' macro redefined [-Wmacro-redefined]
#define CINDEX_EXPORTS
Arthur Eubanks [Fri, 2 Oct 2020 17:34:51 +0000 (10:34 -0700)]
Revert "[AlwaysInliner] Update BFI when inlining"
This reverts commit
b1bf24667fc3ec5dc4b541148d0d722ffa28a6df.
Arthur Eubanks [Fri, 25 Sep 2020 17:59:20 +0000 (10:59 -0700)]
[AlwaysInliner] Update BFI when inlining
Reviewed By: davidxl
Differential Revision: https://reviews.llvm.org/D88324
Simon Pilgrim [Fri, 2 Oct 2020 17:16:55 +0000 (18:16 +0100)]
Revert rG3d14a1e982ad27 - "[InstCombine] recognizeBSwapOrBitReverseIdiom - support for 'partial' bswap patterns (PR47191)"
This reverts commit
3d14a1e982ad27111346471564d575ad5efc6419.
This is breaking on some 2stage clang buildbots
Thomas Raoux [Fri, 2 Oct 2020 17:11:22 +0000 (10:11 -0700)]
[mlir][vector] Add canonicalization patterns for extractMap/insertMap
Add basic canonicalization patterns for the extractMap/insertMap to allow them
to be folded into Transfer ops.
Also mark transferRead as memory read so that it can be removed by dead code.
Differential Revision: https://reviews.llvm.org/D88622
Simon Pilgrim [Fri, 2 Oct 2020 17:04:56 +0000 (18:04 +0100)]
[InstCombine] Add trunc(bswap(trunc/zext(x))) vector tests
Louis Dionne [Mon, 21 Sep 2020 21:08:53 +0000 (17:08 -0400)]
[libc++] Remove unnecessary usage of <iostream> in the test suite
Tests should strive to be as minimal as possible, since it makes them
relevant on platforms where <iostream> does not work.
Jonas Devlieghere [Fri, 2 Oct 2020 16:53:30 +0000 (09:53 -0700)]
[lldb] Fix bug in fallback logic for finding the resource directory.
Both of the if-clauses modify the raw_path variable and only one of them
was resetting the variable for the fallback. Avoid future bugs like that
by always resetting the variable.
Differential revision: https://reviews.llvm.org/D88704
Florian Hahn [Fri, 2 Oct 2020 16:36:22 +0000 (17:36 +0100)]
[VPlan] Use isa<> instead of directly checking VPRecipeID (NFC).
getVPRecipeID is intended to be only used in `classof` helpers. Instead
of checking it directly, use isa<> with the correct recipe type.
Nikita Popov [Thu, 1 Oct 2020 20:42:14 +0000 (22:42 +0200)]
[MemCpyOpt] Regnerate test checks (NFC)
zhanghb97 [Wed, 30 Sep 2020 06:11:46 +0000 (14:11 +0800)]
[mlir] Add Float Attribute, Integer Attribute and Bool Attribute subclasses to python bindings.
Based on PyAttribute and PyConcreteAttribute classes, this patch implements the bindings of Float Attribute, Integer Attribute and Bool Attribute subclasses.
This patch also defines the `mlirFloatAttrDoubleGetChecked` C API which is bound with the `FloatAttr.get_typed` python method.
Differential Revision: https://reviews.llvm.org/D88531