Roman Lebedev [Mon, 7 Dec 2020 12:15:33 +0000 (15:15 +0300)]
[NFC][LoopIdiom] Reshuffle left-shift-until-bittest test coverage (D91038)
Kerry McLaughlin [Mon, 7 Dec 2020 10:39:04 +0000 (10:39 +0000)]
[SVE][CodeGen] Lower scalable masked gathers
Lowers the llvm.masked.gather intrinsics (scalar plus vector addressing mode only)
Changes in this patch:
- Add custom lowering for MGATHER, using getGatherVecOpcode() to choose the appropriate
gather load opcode to use.
- Improve codegen with refineIndexType/refineUniformBase, added in D90942
- Tests added for gather loads with 32 & 64-bit scaled & unscaled offsets.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D91092
Nathan James [Mon, 7 Dec 2020 12:13:56 +0000 (12:13 +0000)]
[clang-tidy][docs] Update check options with boolean values instead of non-zero/0/1
Using bools instead of integers better conveys the expected value of the option.
Reviewed By: Eugene.Zelenko, aaron.ballman
Differential Revision: https://reviews.llvm.org/D92652
Sam McCall [Fri, 4 Dec 2020 08:58:50 +0000 (09:58 +0100)]
Add ability to load a FixedCompilationDatabase from a buffer.
Previously, loading one from a file meant allowing the library to do the IO.
Clangd would prefer to do such IO itself (e.g. to allow caching).
Differential Revision: https://reviews.llvm.org/D92640
Georgii Rymar [Tue, 1 Dec 2020 14:00:03 +0000 (17:00 +0300)]
[llvm-readobj/elf] - Refine the implementation of "printFunctionStackSize".
This rewrites the logic to get rid of "ELFSymbolRef" API where possible.
This allowed to handle possible errors better, improve warnings reported and add new ones.
Also 'reportWarning' was replaced with 'reportUniqueWarning'
Differential revision: https://reviews.llvm.org/D92545
Sam McCall [Mon, 7 Dec 2020 11:54:38 +0000 (12:54 +0100)]
[clangd] Fix windows slashes in project config diagnostics
Sam McCall [Mon, 7 Dec 2020 11:33:34 +0000 (12:33 +0100)]
[clangd] Temporarily test that uncovered broken behavior on windows
Max Kazantsev [Mon, 7 Dec 2020 11:33:07 +0000 (18:33 +0700)]
[Test] Auto-update test checks
Kazushi (Jam) Marukawa [Fri, 4 Dec 2020 11:33:02 +0000 (20:33 +0900)]
[VE] Add vrcp, vrsqrt, vcvt, vmrg, and vshf intrinsic instructions
Add vrcp, vrsqrt, vcvt, vmrg, and vshf intrinsic instructions and
regression tests.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92750
Pedro Tammela [Sun, 6 Dec 2020 14:30:57 +0000 (14:30 +0000)]
[LLDB] fix error message for one-line breakpoint scripts
LLDB is ignoring compilation errors for one-line breakpoint scripts.
This patch fixes the issues and now the error message of the
ScriptInterpreter is shown to the user.
I had to remove a new-line character for the Lua interpreter since it
was duplicated.
Differential Revision: https://reviews.llvm.org/D92729
Cullen Rhodes [Mon, 30 Nov 2020 11:35:46 +0000 (11:35 +0000)]
[IR] Bail out for scalable vectors in ShuffleVectorInst::isConcat
Shuffle mask for concat can't be expressed for scalable vectors, so we
should bail out. A test has been added that previously crashed, also
tested isIdentityWithPadding and isIdentityWithExtract where we already
bail out.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D92475
Cullen Rhodes [Mon, 30 Nov 2020 11:35:46 +0000 (11:35 +0000)]
[IR] Support scalable vectors in ShuffleVectorInst::increasesLength
Since the length of the llvm::SmallVector shufflemask is related to the
minimum number of elements in a scalable vector, it is fine to just get
the Min field of the ElementCount. This is already done for the similar
function changesLength, tests have been added for both.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D92472
Qiu Chaofan [Mon, 7 Dec 2020 10:31:00 +0000 (18:31 +0800)]
[PowerPC] [Clang] Enable float128 feature on P9 by default
As Power9 introduced hardware support for IEEE quad-precision FP type,
the feature should be enabled by default on Power9 or newer targets.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D90213
Kazushi (Jam) Marukawa [Fri, 4 Dec 2020 11:26:44 +0000 (20:26 +0900)]
[VE] Add vfmad, vfmsb, vfnmad, and vfnmsb intrinsic instructions
Add vfmad, vfmsb, vfnmad, and vfnmsb intrinsic instructions and
regression tests.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92697
Michał Górny [Mon, 7 Dec 2020 10:20:58 +0000 (11:20 +0100)]
[lldb] [test] Remove duplicate xfail for Testtypedef
The @expectedFailureAll(compiler="clang") decorator works correctly
on FreeBSD these days, so it is sufficient.
Sam McCall [Fri, 4 Dec 2020 23:39:21 +0000 (00:39 +0100)]
[clangd] Publish config file errors over LSP
We don't act as a language server for these files (e.g. don't get open/close
notifications for them), but just blindly publish diagnostics for them.
This works reasonably well in coc.nvim and vscode: they show up in the
workspace diagnostic list and when you open the file.
The only update after the file is reparsed, not as you type which is a bit
janky, but seems a lot better than nothing.
Fixes https://github.com/clangd/clangd/issues/614
Differential Revision: https://reviews.llvm.org/D92704
Haojian Wu [Mon, 7 Dec 2020 09:52:04 +0000 (10:52 +0100)]
[clangd] Add language metrics for recovery AST usage.
Differential Revision: https://reviews.llvm.org/D92157
Hafiz Abid Qadeer [Mon, 7 Dec 2020 09:09:59 +0000 (09:09 +0000)]
Provide default location of sysroot for Baremetal toolchain.
Currently, Baremetal toolchain requires user to pass a sysroot location
using a --sysroot flag. This is not very convenient for the user. It also
creates problem for toolchain vendors who don't have a fixed location to
put the sysroot bits.
Clang does provide 'DEFAULT_SYSROOT' which can be used by the toolchain
builder to provide the default location. But it does not work if toolchain
is targeting multiple targets e.g. arm-none-eabi/riscv64-unknown-elf which
clang is capable of doing.
This patch tries to solve this problem by providing a default location of
the toolchain if user does not explicitly provides --sysroot. The exact
location and name can be different but it should fulfill these conditions:
1. The sysroot path should have a target triple element so that multi-target
toolchain problem (as I described above) could be addressed.
2. The location should not be $TOP/$Triple as this is used by gcc generally
and will be a problem for installing both gcc and clang based toolchain at
the same location.
Reviewed By: jroelofs
Differential Revision: https://reviews.llvm.org/D92677
Oliver Stannard [Mon, 7 Dec 2020 09:04:26 +0000 (09:04 +0000)]
[Lit] Fix flaky test on heavily loaded bots
On some of the slow or heavily-loaded bots, this test was failing
intermittently because the infinite_loop.py script might not emit
anything to stdout before the 1 second timeout, so the "Command Output"
line isn't present in the output. That output isn't really important to
this test, we just care that the process is killed, so we can just rmove
that check line from the test.
Differential revision: https://reviews.llvm.org/D92563
Michał Górny [Mon, 7 Dec 2020 08:31:35 +0000 (09:31 +0100)]
[lldb] [test] Fix continue_to_breakpoint() args in TestThreadStepOut
The test is skipped/xfailing on all platforms, so it seems that the API
got out of sync. Fix that so it returns to a 'proper' failure
on FreeBSD.
Differential Revision: https://reviews.llvm.org/D92746
Michał Górny [Mon, 30 Nov 2020 12:07:25 +0000 (13:07 +0100)]
[lldb] [Process/FreeBSDRemote] Implement GetLoadedModuleFileSpec() and GetFileLoadAddress()
Copy the Linux implementation of GetLoadedModuleFileSpec()
and GetFileLoadAddress() into NativeProcessFreeBSD. This does not seem
to change anything at the moment but reducing the differences between
the plugins should help us in the long term.
Differential Revision: https://reviews.llvm.org/D92314
Michał Górny [Fri, 4 Dec 2020 17:56:46 +0000 (18:56 +0100)]
[lldb] [POSIX-DYLD] Add libraries from initial eTakeSnapshot action
Explicitly consider the libraries reported on the initial eTakeSnapshot
action added, through adding them to the added soentry list
in DYLDRendezvous::SaveSOEntriesFromRemote(). This is necessary
on FreeBSD since the dynamic loader issues only a single 'consistent'
state rendezvous breakpoint hit for all the libraries present
in DT_NEEDED (while Linux issues an added-consistent event pair).
Reenable memory maps on FreeBSD since this fixed the issue triggered
by them.
Differential Revision: https://reviews.llvm.org/D92187
Michał Górny [Fri, 4 Dec 2020 16:10:55 +0000 (17:10 +0100)]
[lldb] [Platform/POSIX] Use gdb-remote plugin when attaching
Force gdb-remote plugin when attaching using the derivatives
of PlatformPOSIX class. This is consistent with the behavior
for launching processes (via DebugProcess() method) and guarantees
consistent plugin choice on FreeBSD.
Differential Revision: https://reviews.llvm.org/D92667
Michał Górny [Fri, 27 Nov 2020 13:10:10 +0000 (14:10 +0100)]
[lldb] [test] Link FreeBSD test failures to bugs
Differential Revision: https://reviews.llvm.org/D92740
Evgeny Leviant [Mon, 7 Dec 2020 08:53:33 +0000 (11:53 +0300)]
[TableGen][SchedModels] Simplify the code. NFC
Differential revision: https://reviews.llvm.org/D92304
Kazushi (Jam) Marukawa [Fri, 4 Dec 2020 23:13:04 +0000 (08:13 +0900)]
[VE][compiler-rt] Support VE in clear_cache.c
Support SX Aurora VE by __clear_cache() function. This modification
allows VE to run written data, e.g. clear_cache_test.c under compiler-rt
test. We still have code alignment problem in enable_execute_stack_test.c,
though.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92703
Pavel Labath [Fri, 4 Dec 2020 16:45:58 +0000 (17:45 +0100)]
[lldb/test] Refactor socket_packet_pump
Now that the class does not use a thread, the name is no longer
appropriate. Rename the class to "Server" and make it a long-lived
object (instead of recreating it for every expect_gdbremote_sequence
call). The idea is to make this class a wrapper for all communication
with debug/lldb-server. This will enable some additional cleanups as we
had some duplication between socket_pump non-pump code paths.
Also squeeze in some small improvements:
- use python-level timeouts on sockets instead of the manual select
calls
- use byte arrays instead of strings when working with raw packets
Pavel Labath [Sun, 6 Dec 2020 19:39:38 +0000 (20:39 +0100)]
[lldb/test] Simplify TestLldbGdbServer.py
Reuse existing code to start server+inferior.
Pavel Labath [Sun, 6 Dec 2020 19:37:55 +0000 (20:37 +0100)]
[lldb/test] Simplify TestGdbRemoteExitCode.py
Reuse the existing code to launch a debug server + inferior.
Martin Storsjö [Sun, 6 Dec 2020 20:28:33 +0000 (22:28 +0200)]
[CodeGen] Restore accessing __stack_chk_guard via a .refptr stub on mingw after
2518433f861fcb87
Add tests for this particular detail for x86 and arm (similar tests
already existed for x86_64 and aarch64).
The libssp implementation may be located in a separate DLL, and in
those cases, the references need to be in a .refptr stub, to avoid
needing to touch up code in the text section at runtime (which is
supported but inefficient for x86, and unsupported for arm).
Differential Revision: https://reviews.llvm.org/D92738
Mike Edwards [Mon, 7 Dec 2020 06:16:36 +0000 (22:16 -0800)]
[PATCH] github actions: Pepare main branch for being read/write
Patch provided by Tom Stellard <tstellar@redhat.com>
Esme-Yi [Mon, 7 Dec 2020 05:19:06 +0000 (05:19 +0000)]
[PowerPC] Add support for intrinsics dcbfps and dcbstps in P10.
Summary: This patch added support for the intrinsics llvm.ppc.dcbfps and llvm.ppc.dcbstps.
dcbfps and dcbstps are actually extended mnemonics of dcbf.
dcbfps RA,RB ---> dcbf RA,RB,4
dcbstps RA,RB ---> dcbf RA,RB,6
Reviewed By: amyk, steven.zhang
Differential Revision: https://reviews.llvm.org/D91323
Sourabh Singh Tomar [Tue, 20 Oct 2020 08:53:00 +0000 (14:23 +0530)]
[MLIR,OpenMP] Added support for lowering MasterOp to LLVMIR
Some Ops in OMP dialect have regions associated with them i.e
`ParallelOp` `MasterOp`. Lowering of these regions involves interfacing
with `OMPIRBuilder` using callbacks, yet there still exist opportunities
for sharing common code in between.
This patch factors out common code into a separate function and adds
support for lowering `MasterOp` using that. Lowering of `ParallelOp` is
also modified appropriately.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D87247
Fangrui Song [Mon, 7 Dec 2020 04:39:01 +0000 (20:39 -0800)]
Sema.h: delete unused variables/functions/type aliases
Fangrui Song [Mon, 7 Dec 2020 04:16:00 +0000 (20:16 -0800)]
[Sema] Delete unused declarations
Notes about some declarations:
* clang::Sema::endsWithnarrowing: deleted by rC148381
* clang::Sema::ConvertIntegerToTypeWarnOnOverflow: deleted by rC214678
* clang::Sema::FreePackedContext: deleted by rC268085
* clang::Sema::ComputeDefaulted*: deleted by rC296067
Zi Xuan Wu [Mon, 7 Dec 2020 03:06:43 +0000 (11:06 +0800)]
[CSKY 2/n] Add basic tablegen infra for CSKY
This introduce basic tablegen infra such as CSKY{InstrFormats,InstrInfo,RegisterInfo,}.td.
For now, only add instruction definitions for basic CSKY ISA operations, and the instruction format and register info are almost complete.
Our initial target is a working MC layer rather than codegen, so appropriate SelectionDAG patterns will come later.
Differential Revision: https://reviews.llvm.org/D89180
Qiu Chaofan [Mon, 7 Dec 2020 02:38:56 +0000 (10:38 +0800)]
[PowerPC] Fix chain for i1-to-fp operation
A simple SELECT is used for converting i1 to floating types on ppc32,
but in constrained cases, the chain is not handled properly. This patch
will fix that.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D92365
Jun Ma [Wed, 2 Dec 2020 06:45:15 +0000 (14:45 +0800)]
[Coroutines] Add DW_OP_deref for transformed dbg.value intrinsic.
Differential Revision: https://reviews.llvm.org/D92462
Bing1 Yu [Mon, 7 Dec 2020 00:35:45 +0000 (08:35 +0800)]
[CodeGen] Modify the refineIndexType(...)'s code to fix a bug in D90942.
In previous code, when refineIndexType(...) is called and Index is undef, Index.getOperand(0) will raise a assertion fail.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D92548
Pavel Iliin [Sat, 5 Dec 2020 20:45:22 +0000 (20:45 +0000)]
[compiler-rt][AArch64] Put outline atomic helpers into dedicated dir.
Differential Revision: https://reviews.llvm.org/D92724
Fangrui Song [Sun, 6 Dec 2020 23:54:17 +0000 (15:54 -0800)]
[llvm-readobj] Delete unused declaration
Fangrui Song [Sun, 6 Dec 2020 23:36:39 +0000 (15:36 -0800)]
[MC] Delete unused declarations
Notes:
* llvm::createAsmStreamer: it has been moved to TargetRegistry.h
* (anon ns)::WasmObjectWriter::updateCustomSectionRelocations: remnant of D46335
* COFFAsmParser::ParseSEHRegisterNumber: remnant of D66625
* llvm::CodeViewContext::isValidCVFileNumber: accidentally added by r279847
Fangrui Song [Sun, 6 Dec 2020 23:26:37 +0000 (15:26 -0800)]
[lld] Delete unused declarations
Notes:
* runMSVCLinker: remnant of r338615
* wasm markSymbol: remnant of r374275
* wasm addDataAddressGlobal: accidentally added by r372779
* MachO Writer::createSymtabContents: accidentally added by D76839
Craig Topper [Sun, 6 Dec 2020 19:44:22 +0000 (11:44 -0800)]
[LoopIdiomRecognize] Merge a conditional operator with an earlier if and remove an extra temporary variable. NFC
The CountPrev variable was only used to forward a value from
the if statement to the conditional operator under the same
condition.
While there move some variable declarations to their first
assignment.
Fangrui Song [Sun, 6 Dec 2020 23:18:25 +0000 (15:18 -0800)]
[llvm-c] Delete unimplemented llvm-c/LinkTimeOptimizer.h
The file was added in 2007 but the functions have never been implemented.
Having the file can only cause confusion to existing C API (llvm-c/lto.h) users.
Fangrui Song [Sun, 6 Dec 2020 23:13:39 +0000 (15:13 -0800)]
[X86] Delete 3 unused declarations
Fangrui Song [Sun, 6 Dec 2020 23:02:18 +0000 (15:02 -0800)]
[CodeGen] Delete 4 unused declarations
Fangrui Song [Sun, 6 Dec 2020 22:55:04 +0000 (14:55 -0800)]
[CodeGen] Delete 15 unused declarations
Notes about a few declarations:
* LiveVariables::RegisterDefIsDead: deleted by r47927
* createForwardControlFlowIntegrityPass, createJumpInstrTablesPass: deleted by r230780
* RegScavenger::setLiveInsUsed: deleted by r292543
* ScheduleDAGInstrs::{toggleKillFlag,startBlockForKills}: deleted by r304055
* Localizer::shouldLocalize: remnant of D75207
* DwarfDebug::addSectionLabel: deleted by r373273
Fangrui Song [Sun, 6 Dec 2020 21:21:07 +0000 (13:21 -0800)]
[TableGen] Delete 11 unused declarations
Fangrui Song [Sun, 6 Dec 2020 21:04:01 +0000 (13:04 -0800)]
[Transforms] Delete unused declarations from NewGVN/CoroSplit/ValueMapper
Florian Hahn [Sun, 6 Dec 2020 19:58:33 +0000 (19:58 +0000)]
[ConstraintElimination] Bail out if system gets too big.
For some inputs, the constraint system can grow quite large during
solving, because it replaces complex constraints with one or more
simpler constraints. This adds a cut-off to avoid compile-time explosion
on problematic inputs.
LLVM GN Syncbot [Sun, 6 Dec 2020 20:12:22 +0000 (20:12 +0000)]
[gn build] Port
6b989a17107
Wenlei He [Tue, 24 Mar 2020 06:50:41 +0000 (23:50 -0700)]
[CSSPGO] Infrastructure for context-sensitive Sample PGO and Inlining
This change adds the context-senstive sample PGO infracture described in CSSPGO RFC (https://groups.google.com/g/llvm-dev/c/1p1rdYbL93s). It introduced an abstraction between input profile and profile loader that queries input profile for functions. Specifically, there's now the notion of base profile and context profile, and they are managed by the new SampleContextTracker for adjusting and merging profiles based on inline decisions. It works with top-down profiled guided inliner in profile loader (https://reviews.llvm.org/D70655) for better inlining with specialization and better post-inline profile fidelity. In the future, we can also expose this infrastructure to CGSCC inliner in order for it to take advantage of context-sensitive profile. This change is the consumption part of context-sensitive profile (The generation part is in this stack: https://reviews.llvm.org/D89707). We've seen good results internally in conjunction with Pseudo-probe (https://reviews.llvm.org/D86193). Pacthes for integration with Pseudo-probe coming up soon.
Currently the new infrastructure kick in when input profile contains the new context-sensitive profile; otherwise it's no-op and does not affect existing AutoFDO.
**Interface**
There're two sets of interfaces for query and tracking respectively exposed from SampleContextTracker. For query, now instead of simply getting a profile from input for a function, we can explicitly query base profile or context profile for given call path of a function. For tracking, there're separate APIs for marking context profile as inlined, or promoting and merging not inlined context profile.
- Query base profile (`getBaseSamplesFor`)
Base profile is the merged synthetic profile for function's CFG profile from any outstanding (not inlined) context. We can query base profile by function.
- Query context profile (`getContextSamplesFor`)
Context profile is a function's CFG profile for a given calling context. We can query context profile by context string.
- Track inlined context profile (`markContextSamplesInlined`)
When a function is inlined for given calling context, we need to mark the context profile for that context as inlined. This is to make sure we don't include inlined context profile when synthesizing base profile for that inlined function.
- Track not-inlined context profile (`promoteMergeContextSamplesTree`)
When a function is not inlined for given calling context, we need to promote the context profile tree so the not inlined context becomes top-level context. This preserve the sub-context under that function so later inline decision for that not inlined function will still have context profile for its call tree. Note that profile will be merged if needed when promoting a context profile tree if any of the node already exists at its promoted destination.
**Implementation**
Implementation-wise, `SampleContext` is created as abstraction for context. Currently it's a string for call path, and we can later optimize it to something more efficient, e.g. context id. Each `SampleContext` also has a `ContextState` indicating whether it's raw context profile from input, whether it's inlined or merged, whether it's synthetic profile created by compiler. Each `FunctionSamples` now has a `SampleContext` that tells whether it's base profile or context profile, and for context profile what is the context and state.
On top of the above context representation, a custom trie tree is implemented to track and manager context profiles. Specifically, `SampleContextTracker` is implemented that encapsulates a trie tree with `ContextTireNode` as node. Each node of the trie tree represents a frame in calling context, thus the path from root to a node represents a valid calling context. We also track `FunctionSamples` for each node, so this trie tree can serve efficient query for context profile. Accordingly, context profile tree promotion now becomes moving a subtree to be under the root of entire tree, and merge nodes for subtree if this move encounters existing nodes.
**Integration**
`SampleContextTracker` is now also integrated with AutoFDO, `SampleProfileReader` and `SampleProfileLoader`. When we detected input profile contains context-sensitive profile, `SampleContextTracker` will be used to track profiles, and all profile query will go to `SampleContextTracker` instead of `SampleProfileReader` automatically. Tracking APIs are called automatically for each inline decision from `SampleProfileLoader`.
Differential Revision: https://reviews.llvm.org/D90125
Fangrui Song [Sun, 6 Dec 2020 19:11:15 +0000 (11:11 -0800)]
[test] Fix asan/TestCases/Linux/globals-gc-sections-lld.cpp with -fsanitize-address-globals-dead-stripping
r302591 dropped -fsanitize-address-globals-dead-stripping for ELF platforms
(to work around a gold<2.27 bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19002)
Upgrade REQUIRES: from lto (COMPILER_RT_TEST_USE_LLD (set by Android, but rarely used elsewhere)) to lto-available.
Fangrui Song [Sun, 6 Dec 2020 18:31:40 +0000 (10:31 -0800)]
[test] Fix asan/TestCases/Posix/lto-constmerge-odr.cpp when 'binutils_lto' is avaiable
If COMPILER_RT_TEST_USE_LLD is not set, config.use_lld will be False.
However, if feature 'binutils_lto' is available, lto_supported can still be True,
but config.target_cflags will not get -fuse-ld=lld from config.lto_flags
As a result, we may use clang -flto with system 'ld' which may not support the bitcode file, e.g.
ld: error: /tmp/lto-constmerge-odr-44a1ee.o: Unknown attribute kind (70) (Producer: 'LLVM12.0.0git' Reader: 'LLVM 12.0.0git')
// The system ld+LLVMgold.so do not support ATTR_KIND_MUSTPROGRESS (70).
Just require lld-available and add -fuse-ld=lld.
Kazu Hirata [Sun, 6 Dec 2020 18:24:08 +0000 (10:24 -0800)]
[InstCombine] Remove replacePointer (NFC)
The declaration was introduced on Feb 10, 2017 in commit
ba01ed00fef32c48d8e2787a6feaf33568a80bfe without a corresponding
definition.
Kazu Hirata [Sun, 6 Dec 2020 18:12:55 +0000 (10:12 -0800)]
[Mips] Use llvm::is_contained (NFC)
Simon Pilgrim [Sun, 6 Dec 2020 17:56:41 +0000 (17:56 +0000)]
[X86] Fold MOVMSK(ICMP_SGT(X,-1)) -> NOT(MOVMSK(X)))
Noticed while triaging PR37506
Simon Pilgrim [Sun, 6 Dec 2020 17:48:15 +0000 (17:48 +0000)]
[X86] Add tests for missing MOVMSK(ICMP_SGT(X,-1)) -> NOT(MOVMSK(X))) fold
Noticed while triaging PR37506
Layton Kifer [Sun, 6 Dec 2020 16:50:42 +0000 (11:50 -0500)]
[DAGCombiner] Fold (sext (not i1 x)) -> (add (zext i1 x), -1)
Move fold of (sext (not i1 x)) -> (add (zext i1 x), -1) from X86 to DAGCombiner to improve codegen on other targets.
Differential Revision: https://reviews.llvm.org/D91589
Paul C. Anagnostopoulos [Sat, 5 Dec 2020 15:22:31 +0000 (10:22 -0500)]
[TableGen] [CodeGenTarget] Cache the target's instruction namespace.
Differential Revision: https://reviews.llvm.org/D92722
Marek Kurdej [Sun, 6 Dec 2020 14:36:18 +0000 (15:36 +0100)]
[libc++] [docs] Mark P1865 as complete since 11.0 as it was implemented together with P1135. Fix synopses in <barrier> and <latch>.
It was implemented in commit
54fa9ecd3088508b05b0c5b5cb52da8a3c188655 ([libc++] Implementation of C++20's P1135R6 for libcxx).
Sanjay Patel [Sat, 5 Dec 2020 16:24:19 +0000 (11:24 -0500)]
[InstCombine] avoid crash on phi with unreachable incoming block (PR48369)
Marek Kurdej [Sun, 6 Dec 2020 14:23:46 +0000 (15:23 +0100)]
[libc++] [LWG3374] Mark `to_address(const Ptr& p)` overload `constexpr`.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D92659
Simon Pilgrim [Sun, 6 Dec 2020 14:08:15 +0000 (14:08 +0000)]
[CostModel][X86] getGatherScatterOpCost - use default implementation for alt costkinds
Noticed while looking at D92701 - we only really handle TCK_RecipThroughput gather/scatter costs - for now drop back to the default implementation for non-legal gathers/scatters.
Jon Chesterfield [Sun, 6 Dec 2020 12:13:56 +0000 (12:13 +0000)]
[libomptarget][amdgpu] Skip device_State allocation when using bss global
Nikita Popov [Sat, 5 Dec 2020 16:26:33 +0000 (17:26 +0100)]
[BasicAA] Migrate "same base pointer" logic to decomposed GEPs
BasicAA has some special bit of logic for "same base pointer" GEPs
that performs a structural comparison: It only looks at two GEPs
with the same base (as opposed to two GEP chains with a MustAlias
base) and compares their indexes in a limited way. I generalized
part of this code in D91027, and this patch merges the remainder
into the normal decomposed GEP logic.
What this code ultimately wants to do is to determine that
gep %base, %idx1 and gep %base, %idx2 don't alias if %idx1 != %idx2,
and the access size fits within the stride.
We can express this in terms of a decomposed GEP expression with
two indexes scale*%idx1 + -scale*%idx2 where %idx1 != %idx2, and
some appropriate checks for sizes and offsets.
This makes the reasoning slightly more powerful, and more
importantly brings all the GEP logic under a common umbrella.
Differential Revision: https://reviews.llvm.org/D92723
Fangrui Song [Sun, 6 Dec 2020 08:33:11 +0000 (00:33 -0800)]
[TargetMachine] Delete asan workaround
687b83ceabafe81970cd4639e7f0c89036402081 has fixed the X86FastISel bug.
We can revert the workaround now. Actually, the commit introduced a
bug that ppc64 should be excluded.
Fangrui Song [Sun, 6 Dec 2020 07:13:28 +0000 (23:13 -0800)]
[X86FastISel] Fix MO_GOTPCREL GlobalValue reference in static relocation model
This fixes the bug referenced by
5582a7987662a92eda5d883b88fc4586e755acf5
which was exposed by
961f31d8ad14c66829991522d73e14b5a96ff6d4.
With this change, `movq src@GOTPCREL, %rcx` => `movq src@GOTPCREL(%rip), %rcx`
Fangrui Song [Sun, 6 Dec 2020 05:39:02 +0000 (21:39 -0800)]
[TargetMachine] Don't imply dso_local for memprof in static relocation model
The workaround is no longer needed with my previous commit to MemProfiler.cpp
Fangrui Song [Sun, 6 Dec 2020 05:36:31 +0000 (21:36 -0800)]
[MemProf] Make __memprof_shadow_memory_dynamic_address dso_local in static relocation model
The x86-64 backend currently has a bug which uses a wrong register when for the GOTPCREL reference.
The program will crash without the dso_local specifier.
Vitaly Buka [Sat, 5 Dec 2020 05:32:11 +0000 (21:32 -0800)]
[NFC][CodeGen] Simplify SanitizeDtorMembers::Emit
Vitaly Buka [Sun, 6 Dec 2020 04:42:16 +0000 (20:42 -0800)]
[TargetMachine] Set dso_local for memprof
Similar to
5582a7987662a92eda5d883b88fc4586e755acf5
Lang Hames [Sun, 6 Dec 2020 04:41:53 +0000 (15:41 +1100)]
[ORC] Fix missing forward of Allow filter in TPCDynamicLibrarySearchGenerator.
Craig Topper [Sun, 6 Dec 2020 04:10:25 +0000 (20:10 -0800)]
[RISCV] Replace a custom SDTypeProfile with SDTIntBinOp which should be sufficient here.
On the surface this would be slightly less optimal for the isel
table, but due to a tablegen issue with HW mode this ends up
generating a smaller isel table.
Fangrui Song [Sun, 6 Dec 2020 03:30:41 +0000 (19:30 -0800)]
[asan][test] Fix odr-vtable.cpp
Fangrui Song [Sun, 6 Dec 2020 01:51:10 +0000 (17:51 -0800)]
[TargetMachine] Set dso_local if asan is detected
AddressSanitizer instrumentation does not set dso_local on non-thread-local
global variables in -fno-pic and it seems to rely on implied dso_local to work.
Add a hack until we have fixed AddressSanitizer to call setDSOLocal() as
appropriate.
Thanks to Vitaly Buka for reporting the issue and suggesting the way to detect asan.
Jonas Devlieghere [Sun, 6 Dec 2020 01:35:32 +0000 (17:35 -0800)]
[debugserver] Call posix_spawnattr_setarchpref_np throught the fn ptr.
Fourth time is the charm? Of course all of these issues don't show up
when the function is available...
Vitaly Buka [Sat, 5 Dec 2020 08:54:14 +0000 (00:54 -0800)]
[NFC][CodeGen] Add sanitize-dtor-zero-size-field test
The test demonstrates invalid behaviour which will be fixed soon.
Kazu Hirata [Sun, 6 Dec 2020 00:22:12 +0000 (16:22 -0800)]
[ConstantHoisting] Remove unused declaration optimizeConstants (NFC)
The function was renamed to runImpl on Jul 2, 2016 in commit
071d8306b0d9d1345c1da84ae3e1c1b231ffd29d, but the old declaration has
remained since.
Philip Reames [Sat, 5 Dec 2020 23:57:09 +0000 (15:57 -0800)]
Add recursive decomposition reasoning to isKnownNonEqual
The basic idea is that by looking through operand instructions which don't change the equality result that we can push the existing known bits comparison down past instructions which would obscure them.
We have analogous handling in InstSimplify for most - though weirdly not all - of these cases starting from an icmp root. It's a bit unfortunate to duplicate logic, but since my actual goal is to extend BasicAA, the icmp logic doesn't help. (And just makes it hard to test here.) The BasicAA change will be posted separately for review.
Differential Revision: https://reviews.llvm.org/D92698
Fangrui Song [Sat, 5 Dec 2020 23:52:33 +0000 (15:52 -0800)]
[TargetMachine] Drop implied dso_local for an edge case (extern_weak + non-pic + hidden)
This does not deserve special handling. The code should be added to Clang
instead if deemed useful. With this simplification, we can additionally delete
the PIC extern_weak special case.
Kazu Hirata [Sat, 5 Dec 2020 23:44:40 +0000 (15:44 -0800)]
[CodeGen] llvm::erase_if (NFC)
Aditya Kumar [Sat, 5 Dec 2020 19:43:45 +0000 (11:43 -0800)]
Remove memory allocation with string
Differential Revision: https://reviews.llvm.org/D92506
Fangrui Song [Sat, 5 Dec 2020 23:13:41 +0000 (15:13 -0800)]
[TargetMachine] Clean up TargetMachine::shouldAssumeDSOLocal after x86-32 specific hack is moved to X86Subtarget
With my previous commit, X86Subtarget::classifyGlobalReference has learned to
use MO_NO_FLAG for 32-bit ELF -fno-pic code, the x86-32 special case in
TargetMachine::shouldAssumeDSOLocal can be removed. Since we no longer imply
dso_local for function declarations, we can drop the ppc64 special case as well.
This is NFC in terms of Clang emitted assembly.
Fangrui Song [Sat, 5 Dec 2020 22:54:37 +0000 (14:54 -0800)]
[TargetMachine] Don't imply dso_local on function declarations in Reloc::Static model for ELF/wasm
clang/lib/CodeGen/CodeGenModule sets dso_local on applicable function declarations,
we don't need to duplicate the work in TargetMachine:shouldAssumeDSOLocal.
(Actually the long-term goal (started by r324535) is to drop TargetMachine::shouldAssumeDSOLocal.)
By not implying dso_local, we will respect dso_local/dso_preemptable specifiers
set by the frontend. This allows the proposed -fno-direct-access-external-data
option to work with -fno-pic and prevent a canonical PLT entry (SHN_UNDEF with non-zero st_value)
when taking the address of a function symbol.
This patch should be NFC in terms of the Clang emitted assembly because the case
we don't set dso_local is a case Clang sets dso_local. However, some tests don't
set dso_local on some function declarations and expose some differences. Most
tests have been fixed to be more robust in the previous commit.
Fangrui Song [Sat, 5 Dec 2020 21:55:48 +0000 (13:55 -0800)]
[test] Add explicit dso_local to function declarations in static relocation model tests
They are currently implicit because TargetMachine::shouldAssumeDSOLocal implies
dso_local.
For such function declarations, clang -fno-pic emits the dso_local specifier.
Adding explicit dso_local makes these tests align with the clang behavior and
helps implementing an option to use GOT indirection when taking the address of a
function symbol in -fno-pic (to avoid a canonical PLT entry (SHN_UNDEF with
non-zero st_value)).
Philip Reames [Sat, 5 Dec 2020 22:05:48 +0000 (14:05 -0800)]
[BasicAA] Fix a bug with relational reasoning across iterations
Due to the recursion through phis basicaa does, the code needs to be extremely careful not to reason about equality between values which might represent distinct iterations. I'm generally skeptical of the correctness of the whole scheme, but this particular patch fixes one particular instance which is demonstrateable incorrect.
Interestingly, this appears to be the second attempted fix for the same issue. The former fix is incomplete and doesn't address the actual issue.
Differential Revision: https://reviews.llvm.org/D92694
Jonas Devlieghere [Sat, 5 Dec 2020 22:05:54 +0000 (14:05 -0800)]
[debugserver] Use dlsym for posix_spawnattr_setarchpref_np
The @available check did not work as I thought it did. Use good old
dlsym instead.
Fangrui Song [Sat, 5 Dec 2020 21:17:47 +0000 (13:17 -0800)]
[X86] Emit @PLT for x86-64 and keep unadorned symbols for x86-32
This essentially reverts the x86-64 side effect of r327198.
For x86-32, @PLT (R_386_PLT32) is not suitable in -fno-pic mode so the
code forces MO_NO_FLAG (like a forced dso_local) (https://bugs.llvm.org//show_bug.cgi?id=36674#c6).
For x86-64, both `call/jmp foo` and `call/jmp foo@PLT` emit R_X86_64_PLT32
(https://sourceware.org/bugzilla/show_bug.cgi?id=22791) so there is no
difference using @PLT. Using @PLT is actually favorable because this drops
a difference with -fpie/-fpic code and makes it possible to avoid a canonical
PLT entry when taking the address of an undefined function symbol.
Chris Sears [Sat, 5 Dec 2020 20:59:06 +0000 (21:59 +0100)]
[llvmbuildectomy] removed vestigial LLVMBuild.txt files
LLVMBuild has been removed from the build system. However, three LLVMBuild.txt
files remain in the tree. This patch simply removes them.
llvm/lib/ExecutionEngine/Orc/TargetProcess/LLVMBuild.txt
llvm/tools/llvm-jitlink/llvm-jitlink-executor/LLVMBuild.txt
llvm/tools/llvm-profgen/LLVMBuild.txt
Differential Revision: https://reviews.llvm.org/D92693
Fangrui Song [Sat, 5 Dec 2020 20:32:50 +0000 (12:32 -0800)]
[TargetMachine] Move X86 specific shouldAssumeDSOLocal logic to X86Subtarget::classifyGlobalFunctionReference
Nikita Popov [Sat, 5 Dec 2020 20:21:01 +0000 (21:21 +0100)]
[BasicAA] Add more tests for non-equal index (NFC)
Fangrui Song [Sat, 5 Dec 2020 19:40:18 +0000 (11:40 -0800)]
[TargetMachine] Simplify shouldAssumeDSOLocal by processing ExternalSymbolSDNode early
The function accrues many `GV` nullness checks. Process `!GV`
(ExternalSymbolSDNode) early to simplify code.
Also improve a comment added in r327198 (intrinsics is a subset of
ExternalSymbolSDNode).
Intended to be NFC.
Jonas Devlieghere [Sat, 5 Dec 2020 18:17:48 +0000 (10:17 -0800)]
[debugserver] Remove bridgeos availability
I didn't realize that the 'bridgeos' is not part of the public SDK.
Benjamin Kramer [Sat, 5 Dec 2020 18:07:09 +0000 (19:07 +0100)]
[X86] Autodetect znver3
Joachim Protze [Thu, 26 Nov 2020 10:55:56 +0000 (11:55 +0100)]
[OpenMP][OMPT] Fix OMPT return address guard for gomp interface
D91692 missed various locations in kmp_gsupport, where the scope for
OMPT_STORE_RETURN_ADDRESS is too narrow, i.e. the scope ends before the OMPT
callback is called in some nested function.
This patch fixes the scoping issue, so that all OMPT tests pass, when the
tests are built with gcc.
Differential Revision: https://reviews.llvm.org/D92121
Zbigniew Sarbinowski [Sat, 5 Dec 2020 00:13:23 +0000 (00:13 +0000)]
[SystemZ][ZOS] Fix the usage of pthread_t within libc++
This is the the minimal change introduced in [[ https://reviews.llvm.org/D88599 | D88599 ]] to unblock the controversial change and discussion of proper separation between thread from thread id which will continue in D88599.
This patch will address the differences of definition of pthread_t on z/OS vs. Linux and other OS. Main trick to make the code work on z/OS relies on redefining libcpp_thread_id type and _LIBCPP_NULL_THREAD macro. This is necessary to separate initialization of libcxx_thread_id from the one of __libcxx_thread_t;
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D91875
mydeveloperday [Sat, 5 Dec 2020 16:32:37 +0000 (16:32 +0000)]
[clang-format] Add option for case sensitive regexes for sorted includes
I think the title says everything.
Reviewed By: MyDeveloperDay
Patch By: HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D91507
Mark de Wever [Sat, 5 Dec 2020 15:36:19 +0000 (16:36 +0100)]
[NFC][libc++] Update C++20 issues status.
Properly mark LWG1203 as completed and move the version number to the
version column.