Aleksandr Platonov [Mon, 27 Jul 2020 11:39:31 +0000 (14:39 +0300)]
[clangd] Collect references for externally visible main-file symbols
Summary:
Without this patch clangd does not collect references for main-file symbols if there is no public declaration in preamble.
Example:
`test1.c`
```
void f1() {}
```
`test2.c`
```
extern void f1();
void f2() {
f^1();
}
```
`Find all references` does not show definition of f1() in the result, but GTD works OK.
Reviewers: sammccall, kadircet
Reviewed By: kadircet
Subscribers: ilya-golovenko, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84513
Raphael Isemann [Mon, 27 Jul 2020 12:05:23 +0000 (14:05 +0200)]
[lldb] Modernize away some snprintf calls
Reviewers: #lldb, JDevlieghere
Reviewed By: #lldb, JDevlieghere
Subscribers: JDevlieghere
Differential Revision: https://reviews.llvm.org/D84530
Sanjay Patel [Sun, 26 Jul 2020 19:19:09 +0000 (15:19 -0400)]
[InstSimplify] add tests for min/max intrinsics; NFC
Kirill Bobyrev [Mon, 27 Jul 2020 12:15:59 +0000 (14:15 +0200)]
[clangd] Add marshalling code for all request types
Summary:
Only FuzzyFindRequest is implemented via Marshaller even though other requests
also follow a similar pattern. Unify them under the marshalling umbrella and
make the server requests even more uniform to complement D84499.
Reviewers: kadircet
Reviewed By: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits, sammccall
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84525
Hans Wennborg [Mon, 27 Jul 2020 12:11:29 +0000 (14:11 +0200)]
Fix another #ifdef CLANGD_ENABLE_REMOTE
Hans Wennborg [Mon, 27 Jul 2020 12:03:55 +0000 (14:03 +0200)]
[gn] Set CLANGD_ENABLE_REMOTE=0
To fix the build after
37ac559fccd4.
Hans Wennborg [Mon, 27 Jul 2020 12:03:28 +0000 (14:03 +0200)]
ClangdMain.cpp: this #ifdef should be an #if
CLANGD_ENABLE_REMOTE is always defined; to 0 or 1.
Tim Northover [Wed, 22 Jul 2020 13:53:26 +0000 (14:53 +0100)]
AArch64: diagnose out of range relocation addends on MachO.
MachO only has 24-bit addends for most relocations, small enough that it can
overflow in semi-reasonable functions and cause insidious bugs if compiled
without assertions enabled. Switch it to an actual error instead.
The condition isn't quite identical because ld64 treats the addend as a signed
number.
Nathan James [Mon, 27 Jul 2020 11:48:53 +0000 (12:48 +0100)]
[clang-tidy] Refactor IncludeInserter
Simplified how `IncludeInserter` is used in Checks by abstracting away the SourceManager and PPCallbacks inside the method `registerPreprocessor`.
Changed checks that use `IncludeInserter` to no longer use a `std::unique_ptr`, instead the IncludeInserter is just a member of the class thats initialized with an `IncludeStyle`.
Saving an unnecessary allocation.
This results in the removal of the field `IncludeSorter::IncludeStyle` from the checks, as its wrapped in the `IncludeInserter`.
No longer need to create an instance of the `IncludeInserter` in the registerPPCallbacks, now that method only needs to contain:
```
Inserter.registerPreprocessor(PP);
```
Also added a helper method to `IncludeInserter` called `createMainFileInclusionInsertion`, purely sugar but does better express intentions.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D83680
Hans Wennborg [Mon, 27 Jul 2020 11:39:54 +0000 (13:39 +0200)]
Speculative build fix for clangd/Features.inc.in
Hans Wennborg [Mon, 27 Jul 2020 11:35:35 +0000 (13:35 +0200)]
Speculative build fix for scudo/standalone/tests/combined_test.cpp
Alex Zinenko [Wed, 22 Jul 2020 11:03:24 +0000 (13:03 +0200)]
[mlir] Support for mutable types
Introduce support for mutable storage in the StorageUniquer infrastructure.
This makes MLIR have key-value storage instead of just uniqued key storage. A
storage instance now contains a unique immutable key and a mutable value, both
stored in the arena allocator that belongs to the context. This is a
preconditio for supporting recursive types that require delayed initialization,
in particular LLVM structure types. The functionality is exercised in the test
pass with trivial self-recursive type. So far, recursive types can only be
printed in parsed in a closed type system. Removing this restriction is left
for future work.
Differential Revision: https://reviews.llvm.org/D84171
Pavel Labath [Tue, 7 Jul 2020 13:28:24 +0000 (15:28 +0200)]
[lldb/DWARF] Don't treat class declarations with children as definitions
Summary:
This effectively reverts r188124, which added code to handle
(DW_AT_)declarations of structures with some kinds of children as
definitions. The commit message claims this is a workaround for some
kind of debug info produced by gcc. However, it does not go into
specifics, so it's hard to reproduce or verify that this is indeed still a
problem.
Having this code is definitely a problem though, because it mistakenly
declares incomplete dwarf declarations to be complete. Both clang (with
-flimit-debug-info) and gcc (by default) generate DW_AT_declarations of
structs with children. This happens when full debug info for a class is
not emitted in a given compile unit (e.g. because of vtable homing), but
the class has inline methods which are used in the given compile unit.
In that case, the compilers emit a DW_AT_declaration of a class, but
add a DW_TAG_subprogram child to it to describe the inlined instance of
the method.
Even though the class tag has some children, it definitely does not
contain enough information to construct a full class definition (most
notably, it lacks any members). Keeping the class as incomplete allows
us to search for a real definition in other modules, helping the
-flimit-debug-info flow. And in case the definition is not found we can
display a error message saying that, instead of just showing an empty
struct.
Reviewers: clayborg, aprantl, JDevlieghere, shafik
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D83302
Juneyoung Lee [Mon, 27 Jul 2020 10:08:45 +0000 (19:08 +0900)]
[JumpThreading] Add a test case that has a phi with undef; NFC
Juneyoung Lee [Mon, 27 Jul 2020 10:04:50 +0000 (19:04 +0900)]
[JumpThreading] Add a test that threads jumps with frozen branch conditions
Pavel Labath [Mon, 27 Jul 2020 09:46:51 +0000 (11:46 +0200)]
[lldb] Fix
e89414f406 for msvc
MSVC finds the APInt construction ambiguous. Use a case to help it
choose the right constructor.
Kirill Bobyrev [Mon, 27 Jul 2020 09:21:55 +0000 (11:21 +0200)]
[clangd] Add option to use remote index as static index
Reviewers: hokein
Reviewed By: hokein
Subscribers: usaxena95, mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83817
Afanasyev Ivan [Mon, 27 Jul 2020 09:19:55 +0000 (10:19 +0100)]
[Docs] remove unused arguments in documentation examples on vectorization passes
Reviewers: nadav, tyler.nowicki
Reviewed By: nadav
Differential Revision: https://reviews.llvm.org/D83851
Isaac Richter [Mon, 27 Jul 2020 08:49:24 +0000 (11:49 +0300)]
[lld][ELF] Add LOG2CEIL builtin ldscript function
This patch adds support for the LOG2CEIL builtin function in linker scripts: https://sourceware.org/binutils/docs/ld/Builtin-Functions.html#index-LOG2CEIL_0028exp_0029
As documented for LD, and to keep compatibility, LOG2CEIL(0) returns 0 (not -inf).
The test vectors are somewhat arbitrary. We check minimum values (0-4); middle values (2^32, and 2^32+1); and the maximum value (2^64-1).
The checks for LOG2CEIL explicitly use full 64-bit values (16 hex digits). This is needed to properly verify that -inf and other interesting results aren't returned. (For some reason, all other tests in operators.test use only 14 digits.)
Differential revision: https://reviews.llvm.org/D84054
Alex Richardson [Mon, 27 Jul 2020 09:15:17 +0000 (10:15 +0100)]
[libcxx][lit] Fix running testsuite with python2.7 after
9020d28688492c437abb648b6ab69baeba523219
Python 2.7 fails with TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
if you pass None as the prefix argument to NamedTemporaryFile.
Reviewed By: ldionne, bjope, #libc
Differential Revision: https://reviews.llvm.org/D84595
Kirill Bobyrev [Mon, 27 Jul 2020 08:43:38 +0000 (10:43 +0200)]
[clangd] Switch from EXPECT_TRUE to ASSERT_TRUE in remote marshalling tests
Summary:
When dereferencing Optional's it makes sense to use ASSERT_TRUE for better
test failures readability. Switch from EXPECT_TRUE to ASSERT_TRUE where
it is appropriate.
Reviewers: kadircet
Reviewed By: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84535
Signed-off-by: Kirill Bobyrev <kbobyrev@google.com>
Guillaume Chatelet [Mon, 27 Jul 2020 08:16:28 +0000 (08:16 +0000)]
[Alignment][NFC] Update Bitcodewriter to use Align
Differential Revision: https://reviews.llvm.org/D83533
Juneyoung Lee [Mon, 27 Jul 2020 08:07:27 +0000 (17:07 +0900)]
[InstCombine] Fold freeze into phi if one operand is not undef
This patch adds folding freeze into phi if it has only one operand to target.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D84601
Pavel Labath [Mon, 20 Jul 2020 14:42:01 +0000 (16:42 +0200)]
[lldb/Utility] Clean up Scalar constructors
- move initialization to initializer lists
- make desctructor non-virtual (nothing else is)
- fix long double constructor so that it actually works
Pavel Labath [Fri, 24 Jul 2020 12:49:17 +0000 (14:49 +0200)]
[lldb/Utility] Fix a bug in RangeMap::CombineConsecutiveRanges
The function didn't combine a large entry which overlapped several other
entries, if those other entries were not overlapping among each other.
E.g., (0,20),(5,6),(10,11) produced (0,20),(10,11)
Now it just produced (0,20).
George Mitenkov [Mon, 27 Jul 2020 07:19:48 +0000 (10:19 +0300)]
[MLIR][LLVMDialect] Added volatile and nontemporal attributes to load/store
This patch introduces 2 new optional attributes to `llvm.load`
and `llvm.store` ops: `volatile` and `nontemporal`. These attributes
are translated into proper LLVM as a `volatile` marker and a metadata node
respectively. They are also helpful with SPIR-V to LLVM dialect conversion
since they are the mappings for `Volatile` and `NonTemporal` Memory Operands.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D84396
Piotr Sobczak [Thu, 23 Jul 2020 17:26:49 +0000 (19:26 +0200)]
[AMDGPU] Make generating cache invalidating instructions optional
Summary:
D78800 skipped generating cache invalidating instrucions altogether
on AMDPAL. However, this is sometimes too restrictive - we want a
more flexible option to be able to toggle this behaviour on and off
while we work towards developing a correct implementation of the
alternative memory model.
Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, dexonsmith, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84448
David Sherwood [Tue, 14 Jul 2020 15:20:00 +0000 (16:20 +0100)]
[SVE] Don't use LocalStackAllocation for SVE objects
I have introduced a new TargetFrameLowering query function:
isStackIdSafeForLocalArea
that queries whether or not it is safe for objects of a given stack
id to be bundled into the local area. The default behaviour is to
always bundle regardless of the stack id, however for AArch64 this is
overriden so that it's only safe for fixed-size stack objects.
There is future work here to extend this algorithm for multiple local
areas so that SVE stack objects can be bundled together and accessed
from their own virtual base-pointer.
Differential Revision: https://reviews.llvm.org/D83859
Roman Lebedev [Mon, 27 Jul 2020 07:15:44 +0000 (10:15 +0300)]
[XRay] Account: recursion detection
Summary:
Recursion detection can be non-trivial. Currently, the state-of-the-art for LLVM,
as far as i'm concerned, is D72362 `[clang-tidy] misc-no-recursion: a new check`.
However, it is quite limited:
* It does very basic call-graph based analysis, in the sense it will report even dynamically-unreachable recursion.
* It is inherently limited to a single TU
* It is hard to gauge how problematic each recursion is in practice.
Some of that can be addressed by adding clang analyzer-based check,
then it would at least support multiple TU's.
However, we can approach this problem from another angle - dynamic run-time analysis.
We already have means to capture a run-time callgraph (XRay, duh),
and there are already means to reconstruct it within `llvm-xray` tool.
This proposes to add a `-recursive-calls-only` switch to the `account` tool.
When the switch is on, when re-constructing callgraph for latency reconstruction,
each time we enter/leave some function, we increment/decrement an entry for the function
in a "recursion depth" map. If, when we leave the function, said entry was at `1`,
then that means the function didn't call itself, however if it is at `2` or more,
then that means the function (possibly indirectly) called itself.
If the depth is 1, we don't account the time spent there,
unless within this call stack the function already recursed into itself.
Note that we don't pay for recursion depth tracking when `recursive-calls-only` is not on,
and the perf impact is insignificant (+0.3% regression)
The overhead of the option is actually negative, around -5.26% user time on a medium-sized (3.5G) XRay log.
As a practical example, that 3.5G log is a capture of the entire middle-end opt pipeline
at `-O3` for RawSpeed unity build. There are total of `5500` functions in the log,
however `-recursive-calls-only` says that `269`, or 5%, are recursive.
Having this functionality could be helpful for recursion eradication.
Reviewers: dberris, mboerger
Reviewed By: dberris
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84582
Yuanfang Chen [Mon, 27 Jul 2020 05:32:24 +0000 (22:32 -0700)]
[NewPM] NFC. remove obsolete TODO comment
The deleted TODO was implemented in D82344.
biplmish [Mon, 27 Jul 2020 04:56:19 +0000 (23:56 -0500)]
[PowerPC] Add Vector Extract Double Instruction Definitions and MC tests.
This patch adds the td definitions and asm/disasm tests for the following instructions:
Vector Extract Double Left Index - vextdubvlx, vextduhvlx, vextduwvlx, vextddvlx
Vector Extract Double Right Index - vextdubvrx, vextduhvrx, vextduwvrx, vextddvrx
Differential Revision: https://reviews.llvm.org/D84384
Mehdi Amini [Mon, 27 Jul 2020 04:50:08 +0000 (04:50 +0000)]
Remove declaration of constexpr member kDynamicSize in MemRefType
This member is already publicly declared on the base class. The
redundant declaration is mangled differently though and in some
unoptimized build it requires a definition to also exist. However we
have a definition for the base ShapedType class, removing the
declaration here will redirect every use to the base class member
instead.
Differential Revision: https://reviews.llvm.org/D84615
Fangrui Song [Mon, 27 Jul 2020 04:14:20 +0000 (21:14 -0700)]
[gcov] Simplify/speed up CFG hash calculation
Matt Arsenault [Mon, 27 Jul 2020 03:01:28 +0000 (23:01 -0400)]
AMDGPU/GlobalISel: Don't assert in LegalizerInfo constructor
We don't really need these asserts. The LegalizerInfo is also
overly-aggressivly constructed, even when not in use. It needs to not
assert on dummy targets that have manually specified, unrelated
features.
biplmish [Mon, 27 Jul 2020 02:23:00 +0000 (21:23 -0500)]
[PowerPC] Cleanup p10vector clang test
Remove the duplicate LE test, correct the labels and remove common tests for vec_splat builtin.
Differential Revision: https://reviews.llvm.org/D84382
QingShan Zhang [Mon, 27 Jul 2020 02:02:40 +0000 (02:02 +0000)]
[Scheduling] Improve group algorithm for store cluster
Store Addr and Store Addr+8 are clusterable pair. They have memory(ctrl) dependency on different loads.
Current implementation will put these two stores into different group and miss to cluster them.
Reviewed By: evandro
Differential Revision: https://reviews.llvm.org/D84139
Juneyoung Lee [Mon, 27 Jul 2020 00:43:00 +0000 (09:43 +0900)]
[InstCombine] Add more tests to freeze-phi.ll; NFC
Lang Hames [Mon, 27 Jul 2020 00:33:07 +0000 (17:33 -0700)]
[ORC] Remove a redundant call to getTargetMemory.
Valentin Clement [Mon, 27 Jul 2020 00:00:49 +0000 (20:00 -0400)]
[flang][openacc] Basic name resolution infrastructure for OpenACC construct
Reviewed By: tskeith, klausler, ichoyjx
Differential Revision: https://reviews.llvm.org/D83998
Martin Storsjö [Sat, 25 Jul 2020 12:01:48 +0000 (15:01 +0300)]
[LLD] [COFF] Fix test to properly test all aspects of
c3b1d730d6. NFC.
Previously, the test could pass with one part of
c3b1d730d6 removed.
Jez Ng [Sun, 26 Jul 2020 19:46:46 +0000 (12:46 -0700)]
[lld-macho] Support lookup of dylibs in frameworks
Needed for testing Objective-C programs (since e.g. Core
Foundation is a framework)
Reviewed By: #lld-macho, compnerd
Differential Revision: https://reviews.llvm.org/D83925
Craig Topper [Sun, 26 Jul 2020 17:57:59 +0000 (10:57 -0700)]
[X86] Turn X86DAGToDAGISel::tryVPTERNLOG into a fully custom instruction selector that can handle bitcasts between logic ops
Previously we just matched the logic ops and replaced with an
X86ISD::VPTERNLOG node that we would send through the normal
pattern match. But that approach couldn't handle a bitcast
between the logic ops. Extending that approach would require us
to peek through the bitcasts and emit new bitcasts to match
the types. Those new bitcasts would then have to be properly
topologically sorted.
This patch instead switches to directly emitting the
MachineSDNode and skips the normal tablegen pattern matching.
We do have to handle load folding and broadcast load folding
ourselves now. Which also means commuting the immediate control.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D83630
Tim Keith [Sun, 26 Jul 2020 19:13:36 +0000 (12:13 -0700)]
[flang] Fix implicit declarations in statement functions
If a symbol (that is not a dummy argument) is implicitly declared inside
a statement function, don't create it in the statement function's scope.
Instead, treat statement functions like blocks when finding the inclusive
scope and create the symbol there.
Add a new flag, StmtFunction, to symbols that represent statement functions.
Differential Revision: https://reviews.llvm.org/D84588
Hannes Käufler [Sun, 26 Jul 2020 17:59:45 +0000 (13:59 -0400)]
Replace comment by private method; NFC.
Craig Topper [Sun, 26 Jul 2020 17:38:34 +0000 (10:38 -0700)]
[X86] Move getGatherOverhead/getScatterOverhead into X86TargetTransformInfo.
These cost methods don't make much sense in X86Subtarget. Make
them methods in X86's TTI and move the feature checks from the
X86Subtarget constructor into these methods.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D84594
Juneyoung Lee [Sun, 26 Jul 2020 17:23:51 +0000 (02:23 +0900)]
[InstCombine] Add a test for folding freeze into phi; NFC
Bruno Ricci [Sun, 26 Jul 2020 16:24:43 +0000 (17:24 +0100)]
[clang][NFC] Add a test for __attribute__((flag_enum)) with an unnamed enumeration.
Bruno Ricci [Sun, 26 Jul 2020 16:20:56 +0000 (17:20 +0100)]
[clang][NFC] Add tests for the use of NamedDecl::getDeclName in the unused/unneeded diagnostics.
Bruno Ricci [Sun, 26 Jul 2020 16:10:59 +0000 (17:10 +0100)]
[clang][NFC] Remove spurious +x flag on SemaConcept.cpp
Simon Pilgrim [Sun, 26 Jul 2020 15:03:53 +0000 (16:03 +0100)]
[X86][SSE] lowerV2I64Shuffle - use undef elements in PSHUFD mask widening
If we lower a v2i64 shuffle to PSHUFD, we currently clamp undef elements to 0, (elements 0,1 of the v4i32) which can result in the shuffle referencing more elements of the source vector than expected, affecting later shuffle combines and KnownBits/SimplifyDemanded calls.
By ensuring we widen the undef mask element we allow getV4X86ShuffleImm8 to use inline elements as the default, which are more likely to fold.
Vincent Zhao [Sun, 26 Jul 2020 14:40:07 +0000 (20:10 +0530)]
[MLIR][Affine] Add test for non-hyperrectangular loop tiling
This diff provides a concrete test case for the error that will be raised when the iteration space is non hyper-rectangular.
The corresponding emission method for this error message has been changed as well.
Differential Revision: https://reviews.llvm.org/D84531
Matt Arsenault [Sat, 25 Jul 2020 15:56:33 +0000 (11:56 -0400)]
AMDGPU/GlobalISel: Fix not constraining ds_append/consume operands
Matt Arsenault [Sat, 25 Jul 2020 15:00:35 +0000 (11:00 -0400)]
GlobalISel: Handle G_PTR_ADD in narrowScalar
Matt Arsenault [Sat, 25 Jul 2020 14:47:33 +0000 (10:47 -0400)]
GlobalISel: Handle fewerElementsVector for G_PTR_ADD
Matt Arsenault [Sat, 25 Jul 2020 15:14:27 +0000 (11:14 -0400)]
AMDGPU/GlobalISel: Reorder G_CONSTANT legality rules
The legal cases should be the first rules.
Matt Arsenault [Sat, 25 Jul 2020 21:22:22 +0000 (17:22 -0400)]
AMDGPU/GlobalISel: Make sure <2 x s1> phis are scalarized
Matt Arsenault [Sat, 25 Jul 2020 19:41:58 +0000 (15:41 -0400)]
AMDGPU/GlobalISel: Legalize GDS atomics
I noticed these don't use the _gfx9, non-m0 reading variants but not
sure if that's a bug or not. It's the same in the DAG.
Matt Arsenault [Sat, 18 Jul 2020 19:30:59 +0000 (15:30 -0400)]
AMDGPU/GlobalISel: Pack constant G_BUILD_VECTOR_TRUNCs when selecting
Sanjay Patel [Sun, 26 Jul 2020 13:33:13 +0000 (09:33 -0400)]
[InstSimplify] fold integer min/max intrinsics with limit constant
Matt Arsenault [Sun, 26 Jul 2020 13:26:48 +0000 (09:26 -0400)]
GlobalISel: Handle 'n' inline asm constraint
Matt Arsenault [Sat, 25 Jul 2020 18:37:29 +0000 (14:37 -0400)]
AMDGPU/GlobalISel: Sign extend integer constants
This matches the DAG behavior and fixes immediate folding
Matt Arsenault [Sat, 25 Jul 2020 17:21:31 +0000 (13:21 -0400)]
AMDGPU/GlobalISel: Replace selection tests for G_CONSTANT/G_FCONSTANT
Split into separate tests and make more consistent with the others.
Xing GUO [Sun, 26 Jul 2020 08:01:22 +0000 (16:01 +0800)]
[DWARFYAML] Rename getUsedSectionNames() to getNonEmptySectionNames().
This patch renames getUsedSectionNames() to getNonEmptySectionNames.
NFC.
Sanjay Patel [Sat, 25 Jul 2020 20:40:14 +0000 (16:40 -0400)]
[InstSimplify] add tests for min/max intrinsics; NFC
Sanjay Patel [Fri, 24 Jul 2020 19:11:02 +0000 (15:11 -0400)]
[InstSimplify] fold fcmp using isKnownNeverInfinity + isKnownNeverNaN
Follow-up to D84035 / rG7393d7574c09.
This sidesteps a question of FMF/poison on fcmp raised in PR46077:
http://bugs.llvm.org/PR46077
https://alive2.llvm.org/ce/z/TCsyzD
define i1 @src(float %x) {
%0:
%x42 = fadd nnan ninf float %x, 42.000000
%r = fcmp ueq float %x42, inf
ret i1 %r
}
=>
define i1 @tgt(float %x) {
%0:
ret i1 0
}
Transformation seems to be correct!
https://alive2.llvm.org/ce/z/FQaH7a
define i1 @src(i8 %x) {
%0:
%cast = uitofp i8 %x to float
%r = fcmp one float inf, %cast
ret i1 %r
}
=>
define i1 @tgt(i8 %x) {
%0:
ret i1 1
}
Transformation seems to be correct!
Sanjay Patel [Fri, 24 Jul 2020 18:45:50 +0000 (14:45 -0400)]
[InstSimplify] add tests for fcmp with infinity constant; NFC
Juneyoung Lee [Sun, 26 Jul 2020 13:00:01 +0000 (22:00 +0900)]
[JumpThreading] Add a test for D84598; NFC
Juneyoung Lee [Sun, 26 Jul 2020 12:54:44 +0000 (21:54 +0900)]
[ConstantFolding] Fold freeze if it is never undef or poison
This is a simple patch that adds constant folding for freeze
instruction.
IIUC, it isn't needed to update ConstantFold.cpp because there is no freeze
constexpr.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D84597
Juneyoung Lee [Sun, 26 Jul 2020 12:48:51 +0000 (21:48 +0900)]
[ValueTracking] Instruction::isBinaryOp should be used for constexprs
This is a simple patch that makes canCreateUndefOrPoison use
Instruction::isBinaryOp because BinaryOperator inherits Instruction.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D84596
Juneyoung Lee [Sun, 26 Jul 2020 12:02:31 +0000 (21:02 +0900)]
NFC; add a test for freeze's constprop
Juneyoung Lee [Sun, 26 Jul 2020 11:47:19 +0000 (20:47 +0900)]
NFC; add an example that subtracts pointers to two global vars
Roman Lebedev [Sun, 26 Jul 2020 11:05:00 +0000 (14:05 +0300)]
[NFC][XRay] Account: migrate to DenseMap + SmallVector, -16% faster on large (3.8G) input
DenseMap is a single allocation underneath, so this is has pretty expected
performance impact on large-ish (3.8G) xray log processing time.
Roman Lebedev [Sun, 26 Jul 2020 11:00:15 +0000 (14:00 +0300)]
[NFC][XRay] Account: decouple getStats() interface from underlying data structure
It doesn't really need to know where Timings are stored, it just needs
to be able to sort them, so MutableArrayRef is enough.
That uncovers an interesting quirk that it relied on
implicit double->int conversion for calculating percentiles.
Alex Richardson [Sun, 26 Jul 2020 10:39:22 +0000 (11:39 +0100)]
[lit] Don't include tests skipped due to sharding in reports
When running multiple shards, don't include skipped tests in the xunit
output since merging the files will result in duplicates.
In our CHERI Jenkins CI, I configured the libc++ tests to run using sharding
(since we are testing using a single-CPU QEMU). We then merge the generated
XUnit xml files to produce a final result, but if the individual XMLs
report tests excluded due to sharding each test is included N times in the
final result. This also makes it difficult to find the tests that were
skipped due to missing REQUIRES: etc.
Reviewed By: yln
Differential Revision: https://reviews.llvm.org/D84235
Alex Richardson [Sun, 26 Jul 2020 10:37:47 +0000 (11:37 +0100)]
[asan] Mark the strstr test as UNSUPPORTED on FreeBSD
Like Android, FreeBSDs libc calls memchr which causes this test to fail.
Reviewed By: emaste
Differential Revision: https://reviews.llvm.org/D84541
Amara Emerson [Sun, 26 Jul 2020 07:46:29 +0000 (00:46 -0700)]
[AArch64][GlobalISel] Make <8 x s16> and <16 x s8> legal types for G_SHUFFLE_VECTOR and G_IMPLICIT_DEF.
Trivial change, we're still missing support for rev matching for these types
in the combiner.
Craig Topper [Sun, 26 Jul 2020 05:05:46 +0000 (22:05 -0700)]
[X86] Merge X86MCInstLowering's maxLongNopLength into emitNop and remove check for FeatureNOPL.
The switch in emitNop uses 64-bit registers for nops exceeding
2 bytes. This isn't valid outside 64-bit mode. We could fix this
easily enough, but there are no users that ask for more than 2
bytes outside 64-bit mode.
Inlining the method to make the coupling between the two methods
more explicit.
Craig Topper [Sun, 26 Jul 2020 03:48:46 +0000 (20:48 -0700)]
[X86] Remove getProcFamily() method from X86Subtarget. NFC
This isn't used and we've decided in the past that a CPU enum
for tuning is not a good idea.
Jacques Pienaar [Sun, 26 Jul 2020 04:37:15 +0000 (21:37 -0700)]
[mlir][shape] Further operand and result type generalization
Previous changes generalized some of the operands and results. Complete
a larger group of those to simplify progressive lowering. Also update
some of the declarative asm form due to generalization. Tried to keep it
mostly mechanical.
Changpeng Fang [Sun, 26 Jul 2020 04:20:59 +0000 (21:20 -0700)]
DADCombiner: Don't simplify the token factor if the node's number of operands already exceeds TokenFactorInlineLimit
Summary:
In parallelizeChainedStores, a TokenFactor was created with the size greater than 3000.
We found that DAGCombiner::visitTokenFactor will consume a huge amount of time on
such nodes. Since the number of operands already exceeds TokenFactorInlineLimit, we propose
to give up simplification with the consideration of compile time.
Reviewers:
@spatel, @arsenm
Differential Revision:
https://reviews.llvm.org/D84204
Craig Topper [Sun, 26 Jul 2020 03:46:42 +0000 (20:46 -0700)]
[X86] Replace a use of ProcIntelSLM with FeatureFast7ByteNOP.
Eric Christopher [Sun, 26 Jul 2020 01:42:04 +0000 (18:42 -0700)]
Temporarily Revert "Unify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish)"
as it's causing numerous (176) test failures on linux.
This reverts commit
1d9b860fb6a85df33fd52fcacc6a5efb421621bd.
Eric Christopher [Sun, 26 Jul 2020 01:34:02 +0000 (18:34 -0700)]
Fold StatepointBB into checks as it's only used from an NDEBUG or ASSERT
context fixing an unused variable warning.
Nemanja Ivanovic [Sun, 26 Jul 2020 00:28:52 +0000 (20:28 -0400)]
[PowerPC][NFC] Fix an assert that cannot trip from
7d076e19e31a
I mixed up the precedence of operators in the assert and thought I
had it right since there was no compiler warning. This just
adds the parentheses in the expression as needed.
Philip Reames [Sat, 25 Jul 2020 23:40:06 +0000 (16:40 -0700)]
[Statepoints] Style cleanup after
3da1a963 [NFC]
Just fixing a few minor stylistic issues.
Craig Topper [Sat, 25 Jul 2020 23:36:33 +0000 (16:36 -0700)]
[X86] Add masked versions of the VPTERNLOG test cases added for D83630. NFC
We don't handle these yet and D83630 won't improve that, but
at least we'll have the tests.
Roman Lebedev [Sat, 25 Jul 2020 21:56:36 +0000 (00:56 +0300)]
[Reduce] Argument reduction: do deal with function declarations
We can happily turn function definitions into declarations,
thus obscuring their argument from being elided by this pass.
I don't believe there is a good reason to just ignore declarations.
likely even proper llvm intrinsics ones,
at worst the input becomes uninteresting.
The other question here is that all these transforms are all-or-nothing.
In some cases, should we be treating each use separately?
The main blocker here seemed to be that llvm::CloneFunctionInto()
does `&OldFunc->front()`, which inserts a nullptr into a densemap,
which is not happy about it and asserts.
Roman Lebedev [Sat, 25 Jul 2020 20:24:13 +0000 (23:24 +0300)]
[Reduce] Argument reduction: do properly handle invoke insts (PR46819)
replaceFunctionCalls() is very non-exhaustive, it only handles
CallInst's. Which means, by the time we drop old function,
there may still be uses of it lurking around.
Let's instead whack-a-mole them by all by replacing with undef.
I'm not sure this is the best handling, especially for calls, but IMO
poorly reduced input is much better than crashing reduction tool.
A (previously-crashing!) test added.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46819
Roman Lebedev [Sat, 25 Jul 2020 19:31:05 +0000 (22:31 +0300)]
[Reduce] Basic block reduction: do properly handle invoke insts (PR46818)
Terminator may have returned value, so we need to replace uses,
and in general handle invoke as a branch inst.
I'm not sure this is the best handling, but IMO poorly reduced
input is much better than crashing reduction tool.
A (previously-crashing!) test added.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46818
Lang Hames [Sat, 25 Jul 2020 21:18:52 +0000 (14:18 -0700)]
[ORC] Rename TargetProcessControl DynamicLibraryHandle and loadLibrary.
The new names, DylibHandle and loadDylib, are more concise and make
clear that these utilities are for loading dynamic libraries, not static
ones.
Lang Hames [Sat, 25 Jul 2020 04:17:37 +0000 (21:17 -0700)]
[ORC] Don't require PageSize or Triple during TargetProcessControl construction
Subclasses will commonly gather that information from a remote during
construction, in which case they won't have meaningful values to pass to
TargetProcessControl's constructor.
Frederik Gossen [Sat, 25 Jul 2020 22:01:21 +0000 (15:01 -0700)]
[MLIR][Shape] Allow `num_elements` to operate on extent tensors
Re-landing with dependent change landed and error condition relaxed.
Beyond the change to error condition exactly https://reviews.llvm.org/D84445.
Jacques Pienaar [Sat, 25 Jul 2020 21:55:19 +0000 (14:55 -0700)]
[MLIR][Shape] Refactor verification
Based on https://reviews.llvm.org/D84439 but less restrictive, else we
don't allow shape_of to be able to produce a ranked output and doesn't
allow for iterative refinement here. We can consider making it more
restrictive later.
Jacques Pienaar [Sat, 25 Jul 2020 21:47:57 +0000 (14:47 -0700)]
Revert "[MLIR][Shape] Allow `num_elements` to operate on extent tensors"
This reverts commit
55ced04d6bc13fd0f9396a0cfc393b44378d8784.
Forgot to submit depend change first.
Frederik Gossen [Sat, 25 Jul 2020 21:39:18 +0000 (14:39 -0700)]
[MLIR][Shape] Allow `num_elements` to operate on extent tensors
Differential Revision: https://reviews.llvm.org/D84445
Philip Reames [Sat, 11 Jul 2020 17:50:34 +0000 (10:50 -0700)]
[Statepoints] Support lowering gc relocations to virtual registers
(Disabled under flag for the moment)
This is part of a larger project wherein we are finally integrating lowering of gc live operands with the register allocator. Today, we force spill all operands in SelectionDAG. The code to do so is distinctly non-optimal. The approach this patch is working towards is to instead lower the relocations directly into the MI form, and let the register allocator pick which ones get spilled and which stack slots they get spilled to. In terms of performance, the later part is actually more important as it avoids redundant shuffling of values between stack slots.
This particular change adds ISEL support to produce the variadic def STATEPOINT form required by the above. In particular, the first N are lowered to variadic tied def/use pairs. So new statepoint looks like this:
reloc1,reloc2,... = STATEPOINT ..., base1, derived1<tied-def0>, base2, derived2<tied-def1>, ...
N is limited by the maximal number of tied registers machine instruction can have (15 at the moment).
The current patch is restricted to handling relocations within a single basic block. Cross block relocations (e.g. invokes) are handled via the legacy mechanism. This restriction will be relaxed in future patches.
Patch By: dantrushin
Differential Revision: https://reviews.llvm.org/D81648
Craig Topper [Sat, 25 Jul 2020 20:24:58 +0000 (13:24 -0700)]
[X86] Add llvm.roundeven test cases. Add f80 tests cases for constrained intrinsics that lower to libcalls. NFC
Craig Topper [Sat, 25 Jul 2020 19:12:16 +0000 (12:12 -0700)]
[X86] Fix intrinsic names in strict fp80 tests to use f80 in their names instead of x86_fp80.
The type is called x86_fp80, but when it is printed in the intrinsic
name it should be f80. The parser doesn't seem to care that the
name was wrong.
Fangrui Song [Sat, 25 Jul 2020 19:33:18 +0000 (12:33 -0700)]
[Driver] Define LinkOption and fix forwarded options to GCC for linking
Many driver options are neither 'DriverOption' nor 'LinkerInput'. When gcc is
used for linking, these options get forwarded even if they don't have anything
to do with linking. Among these options, clang-specific ones can cause gcc to
error.
Just use 'OPT_Link_Group' and a new flag 'LinkOption' for options which already
have a group.
gfortran support apparently bit rots (which does not seem to make much sense). XFAIL the test.
LLVM GN Syncbot [Sat, 25 Jul 2020 18:51:58 +0000 (18:51 +0000)]
[gn build] Port
136c8f50e96