Matt Arsenault [Tue, 7 Jan 2020 21:24:42 +0000 (16:24 -0500)]
AMDGPU/GlobalISel: Fix scalar G_SELECT for arbitrary pointers
4e85ca9562a588eba491e44bcbf73cb2f419780f missed updating the legal
condition type set for pointers with any unrecognized address space.
Matt Arsenault [Tue, 7 Jan 2020 21:04:43 +0000 (16:04 -0500)]
AMDGPU/GlobalISel: Add some missing G_SELECT testcases
Matt Arsenault [Tue, 7 Jan 2020 20:31:03 +0000 (15:31 -0500)]
AMDGPU/GlobalISel: Fix missing test for s16 icmp
Matt Arsenault [Tue, 7 Jan 2020 18:32:03 +0000 (13:32 -0500)]
AMDGPU: Apply i16 add->sub pattern with zext to i32
This was only applying the deeper nested zext pattern, and missing the
special case code size fold.
Mitchell Balan [Tue, 7 Jan 2020 18:49:55 +0000 (13:49 -0500)]
[clang-tidy] modernize-use-using uses AST and now supports struct defintions and multiple types in a typedef
Summary:
It now handles `typedef`s that include comma-separated multiple types, and handles embedded struct definitions, which previously could not be automatically converted.
For example, with this patch `modernize-use-using` now can convert:
typedef struct { int a; } R_t, *R_p;
to:
using R_t = struct { int a; };
using R_p = R_t*;
`-ast-dump` showed that the `CXXRecordDecl` definitions and multiple `TypedefDecl`s come consecutively in the tree, so `check()` stores information between calls to determine when it is receiving a second or additional `TypedefDecl` within a single `typedef`, or when the current `TypedefDecl` refers to an embedded `CXXRecordDecl` like a `struct`.
Reviewers: alexfh, aaron.ballman
Patch by: poelmanc
Subscribers: riccibruno, sammccall, cfe-commits, aaron.ballman
Tags: clang-tools-extra, clang
Differential Revision: https://reviews.llvm.org/D70270
Eric Fiselier [Tue, 7 Jan 2020 21:31:06 +0000 (16:31 -0500)]
[libc++] Add additional benchmark functions to libcxx/benchmarks/string.bench
This change adds the following benchmarks:
- StringAssignStr
Assign a const basic::string& value
- StringAssignAsciiz
Assign a const char* asciiz value
StringAssignAsciizMix
Assign mixed long/short const char* asciiz values
- StringResizeDefaultInit
Resize default init benchmark
Patch by Martijn Vels (mvels@google.com)
Reviewed as D72343
Craig Topper [Tue, 7 Jan 2020 21:25:29 +0000 (13:25 -0800)]
[X86] Enable v2i64->v2f32 uint_to_fp code in ReplaceNodeResults on SSE4.1 target
Now that we generate decent code for (v2i64 (setlt zero, X)) on pre-sse4.2 targets I think we can use this now.
Differential Revision: https://reviews.llvm.org/D72354
Jonas Devlieghere [Tue, 7 Jan 2020 21:21:47 +0000 (13:21 -0800)]
[lldb/Test] Remove old binary created by TestConvenienceVariables
On a dirty build directory the new mkdir fails because the file already
exists and is not a directory.
Jonas Devlieghere [Tue, 7 Jan 2020 21:05:39 +0000 (13:05 -0800)]
[lldb/Test] Make TestConvenienceVariables more strict
This test was passing even when the output of lldb.target was empty.
I've made the test more strict by checking explicitly for the target
name and by using CHECK-NEXT lines.
Daniel Sanders [Sat, 4 Jan 2020 00:51:28 +0000 (16:51 -0800)]
[gicombiner] Correct
64f1bb5cd2c to account for MSVC's %p format
Bill Wendling [Tue, 7 Jan 2020 20:48:17 +0000 (12:48 -0800)]
Remove extraneous semicolon.
Sanjay Patel [Tue, 7 Jan 2020 20:48:21 +0000 (15:48 -0500)]
[x86] add tests for extract-of-concat; NFC
Jonas Devlieghere [Tue, 7 Jan 2020 20:46:01 +0000 (12:46 -0800)]
Revert "[lldb/Lua] Add string conversion operator for SBTarget."
This reverts commit
640d0ba8760051afc002c672121c6989517fc94e.
Christopher Tetreault [Tue, 7 Jan 2020 20:15:07 +0000 (14:15 -0600)]
[cmake] Use source-groups in Polly.
Configure CMake to setup source-groups for Polly. Source groups
describe how source files should be organized in IDEs. By default, all
headers are dumped into one folder under PollyCore and all source files
into another. On disk, these files are organized into folders, but this
isn't reflected in the IDE. This change uses CMake source groups to have
the IDE reflect the on disk layout. This will make it easier to visualize
the project structure for users of Visual Studio and XCode
Patch by Christopher Tetreault <ctetreau@quicinc.com>
Reviewed By: Meinersbur, grosser
Differential Revision: https://reviews.llvm.org/D72117
Matt Arsenault [Tue, 7 Jan 2020 18:18:51 +0000 (13:18 -0500)]
AMDGPU: Add baseline test for missing pattern
The optimization to turn an add into a sub isn't triggering when the
pattern to use the zeroed high bits is used.
Matt Arsenault [Tue, 7 Jan 2020 17:02:11 +0000 (12:02 -0500)]
AMDGPU: Remove VOP3Mods0Clamp0OMod
Now that overridable default operands work, there's no reason to use
complex patterns to just produce 0s.
Matt Arsenault [Tue, 7 Jan 2020 18:12:12 +0000 (13:12 -0500)]
AMDGPU: Fix misleading, misplaced end block comments
Matt Arsenault [Tue, 7 Jan 2020 17:32:08 +0000 (12:32 -0500)]
AMDGPU: Use ImmLeaf
Matt Arsenault [Mon, 30 Sep 2019 17:39:33 +0000 (13:39 -0400)]
AMDGPU: Fix not using v_cvt_f16_[iu]16
We weren't treating i16->f16 casts as legal on targets with these
instructions, and always using a pair of casts through i32.
Jonas Devlieghere [Tue, 7 Jan 2020 19:11:38 +0000 (11:11 -0800)]
[lldb/Lua] Add string conversion operator for SBTarget.
Extend the SBTarget class with a string conversion operator and reuse
the same code between Python and Lua. This should happen for all the SB
classes, but I'm doing just this one as an example and for use in a test
case.
Michael Kruse [Tue, 7 Jan 2020 17:41:14 +0000 (11:41 -0600)]
[cmake] Use relative cmake binary dir for processing pass plugins.
https://reviews.llvm.org/D61446 introduced a new function to process
pass plugins that used CMAKE_BINARY_DIR. This is problematic when LLVM
is a subproject. Instead use LLVM_BINARY_DIR to get the right relative
directory for cmake.
Patch by Alan Baker <alanbaker@google.com>
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D72109
Fangrui Song [Tue, 7 Jan 2020 17:54:10 +0000 (09:54 -0800)]
[PowerPC][Triple] Use elfv2 on freebsd>=13 and linux-musl
Summary:
Every powerpc64le platform uses elfv2.
For powerpc64, the environments "elfv1" and "elfv2" were added for
FreeBSD ELFv1->ELFv2 migration in D61950. FreeBSD developers have
decided to use OS versions to select ABI, and no one is relying on the
environments.
Also use elfv2 on powerpc64-linux-musl.
Users can always use -mabi=elfv1 and -mabi=elfv2 to override the default
ABI.
Reviewed By: adalava
Differential Revision: https://reviews.llvm.org/D72352
Fangrui Song [Tue, 7 Jan 2020 18:41:13 +0000 (10:41 -0800)]
[test] Move ppc64 tests from test/Preprocessor/init.c to init-ppc64.c
Alexey Bataev [Tue, 7 Jan 2020 19:11:45 +0000 (14:11 -0500)]
[OPENMP]Reduce calls for the mangled names.
Use canonical decls instead of mangled names in the set of already
emitted decls. This allows to reduce the number of function calls for
getting declarations mangled names and speedup the compilation.
Jessica Paquette [Tue, 7 Jan 2020 19:12:32 +0000 (11:12 -0800)]
[MachineOutliner][AArch64] Save + restore LR in noreturn functions
Conservatively always save + restore LR in noreturn functions.
These functions do not end in a RET, and so they aren't guaranteed to have an
instruction which uses LR in any way. So, as a result, you can end up in
unfortunate situations where you can't backtrace out of these functions in a
debugger.
Remove the old noreturn test, and add a new one which is more descriptive.
Remove the restriction that we can't outline from noreturn functions as well
since we now do the right thing.
Craig Topper [Tue, 7 Jan 2020 19:09:33 +0000 (11:09 -0800)]
[X86] Improve lowering of (v2i64 (setgt X, -1)) on pre-SSE2 targets. Enable v2i64 in foldVectorXorShiftIntoCmp.
Similar to D72302 but for the canonical form for the opposite case. I've changed foldVectorXorShiftIntoCmp to form a target independent setcc node instead of PCMPGT now and enabled its for v2i64 on pre-SSE4.2 targets. The setcc should eventually get lowered to PCMPGT or the new v2i64 sequence.
Differential Revision: https://reviews.llvm.org/D72318
Craig Topper [Tue, 7 Jan 2020 19:08:45 +0000 (11:08 -0800)]
[X86] Improve lowering of v2i64 sign bit tests on pre-sse4.2 targets
Without sse4.2 a v2i64 setlt needs to expand into a pcmpgtd, pcmpeqd, 3 shuffles, and 2 logic ops. But if we're only interested in the sign bit of the i64 elements, we can just use one pcmpgtd and shuffle the odd elements to the even elements.
Differential Revision: https://reviews.llvm.org/D72302
LLVM GN Syncbot [Tue, 7 Jan 2020 19:13:41 +0000 (19:13 +0000)]
[gn build] Port
1d94fb21118
Daniel Sanders [Tue, 7 Jan 2020 18:27:53 +0000 (10:27 -0800)]
[gicombiner] Add GIMatchTree and use it for the code generation
Summary:
GIMatchTree's job is to build a decision tree by zipping all the
GIMatchDag's together.
Each DAG is added to the tree builder as a leaf and partitioners are used
to subdivide each node until there are no more partitioners to apply. At
this point, the code generator is responsible for testing any untested
predicates and following any unvisited traversals (there shouldn't be any
of the latter as the getVRegDef partitioner handles them all).
Note that the leaves don't always fit into partitions cleanly and the
partitions may overlap as a result. This is resolved by cloning the leaf
into every partition it belongs to. One example of this is a rule that can
match one of N opcodes. The leaf for this rule would end up in N partitions
when processed by the opcode partitioner. A similar example is the
getVRegDef partitioner where having rules (add $a, $b), and (add ($a, $b), $c)
will result in the former being in the partition for successfully
following the vreg-def and failing to do so as it doesn't care which
happens.
Depends on D69151
Fixed the issues with the windows bots which were caused by stdout/stderr
interleaving.
Reviewers: bogner, volkan
Reviewed By: volkan
Subscribers: lkail, mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69152
Alexandre Ganea [Tue, 7 Jan 2020 18:58:17 +0000 (13:58 -0500)]
Fix issues reported by -Wrange-loop-analysis when building with latest Clang (trunk). NFC.
Fixes warning: loop variable 'E' of type 'const llvm::StringRef' creates a copy from type 'const llvm::StringRef' [-Wrange-loop-analysis]
Alexey Bataev [Tue, 7 Jan 2020 18:39:18 +0000 (13:39 -0500)]
[OPENMP]Allow using of members in standalone declaration pragmas.
If standalone OpenMP declaration pragma, like declare mapper or declare
reduction, is declared in the class context, it may reference a member
(data or function) in its internal expressions/statements. So, the
parsing of such pragmas must be dalayed just like the parsing of the
member initializers/definitions before the completion of the class
declaration.
Nathan Ridge [Mon, 16 Dec 2019 01:42:25 +0000 (20:42 -0500)]
[clangd] Heuristically resolve dependent call through smart pointer type
Summary: Fixes https://github.com/clangd/clangd/issues/227
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71644
Nathan Ridge [Thu, 2 Jan 2020 06:08:05 +0000 (01:08 -0500)]
[clangd] Assert that the testcases in LocateSymbol.All have no diagnostics
Summary: Also fix some bugs in the testcases which this exposed.
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72066
Pavel Labath [Tue, 7 Jan 2020 17:01:59 +0000 (18:01 +0100)]
[lldb] Initialize some bitfields in FuncUnwinders.cpp
This got flagged by msan.
Simon Pilgrim [Tue, 7 Jan 2020 16:50:55 +0000 (16:50 +0000)]
[ARM] Regenerate bfi.ll test cases
Simon Pilgrim [Tue, 7 Jan 2020 15:52:15 +0000 (15:52 +0000)]
[X86] Pull out repeated SrcVT.getVectorNumElements() call. NFCI.
Gabor Horvath [Tue, 7 Jan 2020 16:37:49 +0000 (08:37 -0800)]
[analyzer] Update help text to reflect sarif support
Differential Revision: https://reviews.llvm.org/D72289
Gabor Horvath [Thu, 2 Jan 2020 19:57:42 +0000 (11:57 -0800)]
[LifetimeAnalysis] Do not forbid void deref type in gsl::Pointer/gsl::Owner annotations
It turns out it is useful to be able to define the deref type as void.
In case we have a type erased owner, we want to express that the pointee
can be basically any type. It should not be unnatural to have a void
deref type as we already familiar with "pointers to void".
Differential Revision: https://reviews.llvm.org/D72097
diggerlin [Tue, 7 Jan 2020 16:20:51 +0000 (11:20 -0500)]
[AIX][XCOFF]Implement mergeable const
SUMMARY:
In this patch, we map mergeable const objects to the read-only section in the same manner as const objects that are not mergeable.
Reviewers: hubert.reinterpretcast,jasonliu
Subscribers: wuzish, nemanjai, hiraditya
Differential Revision: https://reviews.llvm.org/D71551
Yaxun (Sam) Liu [Mon, 9 Dec 2019 19:55:34 +0000 (14:55 -0500)]
[HIP] Add option --gpu-max-threads-per-block=n
Add this option to change the default launch bounds.
Differential Revision: https://reviews.llvm.org/D71221
Sjoerd Meijer [Tue, 7 Jan 2020 15:57:19 +0000 (15:57 +0000)]
[ARM][MVE] Renamed VPT Block tests and files to something more informative. NFC
Matt Arsenault [Tue, 7 Jan 2020 16:01:16 +0000 (11:01 -0500)]
AMDGPU/GlobalISel: Fix readfirstlane pattern import
The imm folding optimization pattern failed to import. The instruction
pattern was already working, but failing to fail on SGPR inputs.
Med Ismail Bennani [Tue, 7 Jan 2020 15:43:56 +0000 (16:43 +0100)]
Remove extraneous spaces
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Sanjay Patel [Tue, 7 Jan 2020 15:41:17 +0000 (10:41 -0500)]
[InstCombine] try to pull 'not' of select into compare operands
not (select ?, (cmp TPred, ?, ?), (cmp FPred, ?, ?) -->
select ?, (cmp TPred', ?, ?), (cmp FPred', ?, ?)
If both sides of the select are cmps, we can remove an instruction.
The case where only side is a cmp is deferred to a possible
follow-on patch.
We have a more general 'isFreeToInvert' analysis, but I'm not seeing
a way to use that more widely without inducing infinite looping
(opposing transforms).
Here, we flip the compare predicates directly, so we should not have
any danger by creating extra intermediate 'not' ops.
Alive proofs:
https://rise4fun.com/Alive/jKa
Name: both select values are compares - invert predicates
%tcmp = icmp sle i32 %x, %y
%fcmp = icmp ugt i32 %z, %w
%sel = select i1 %cond, i1 %tcmp, i1 %fcmp
%not = xor i1 %sel, true
=>
%tcmp_not = icmp sgt i32 %x, %y
%fcmp_not = icmp ule i32 %z, %w
%not = select i1 %cond, i1 %tcmp_not, i1 %fcmp_not
Name: false val is compare - invert/not
%fcmp = icmp ugt i32 %z, %w
%sel = select i1 %cond, i1 %tcmp, i1 %fcmp
%not = xor i1 %sel, true
=>
%tcmp_not = xor i1 %tcmp, -1
%fcmp_not = icmp ule i32 %z, %w
%not = select i1 %cond, i1 %tcmp_not, i1 %fcmp_not
Differential Revision: https://reviews.llvm.org/D72007
Matt Arsenault [Tue, 7 Jan 2020 15:22:06 +0000 (10:22 -0500)]
AMDGPU/GlobalISel: Fix import of s_abs_i32 pattern
Matt Arsenault [Mon, 16 Sep 2019 04:53:31 +0000 (00:53 -0400)]
AMDGPU/GlobalISel: Select llvm.amdgcn.wqm.vote
Tim Northover [Tue, 7 Jan 2020 10:03:31 +0000 (10:03 +0000)]
OpaquePtr: print byval types containing anonymous types correctly.
Attribute::getAsString doesn't have enough information to print anonymous
Module-level types correctly, so they come back as "%type 0xabcd". This results
in broken IR when printing as text.
Instead, print type-attributes (currently just byval) using the TypePrinting
infrastructure available in AsmWriter. This only applies to function argument
attributes.
Matt Arsenault [Mon, 9 Dec 2019 11:37:14 +0000 (17:07 +0530)]
llc: Change behavior of -mcpu with existing attribute
Don't overwrite existing target-cpu attributes.
I've often found the replacement behavior annoying, and this is
inconsistent with how the fast math command line flags interact with
the function attributes.
Does not yet change target-features, since I think that should behave
as a concatenation.
Matt Arsenault [Sun, 15 Sep 2019 16:50:17 +0000 (12:50 -0400)]
AMDGPU/GlobalISel: Partially fix llvm.amdgcn.kill pattern import
Tests deferred since the existing DAG test depends on some other
operations, but isn't far from working as-is.
Hans Wennborg [Tue, 7 Jan 2020 15:06:14 +0000 (16:06 +0100)]
[docs] NFC: Fix typos in documents
"the the" -> "the"
"an" -> "a"
Patch by Kazuaki Ishizaki <ishizaki@jp.ibm.com>!
Differential revision: https://reviews.llvm.org/D72091
Sam Parker [Tue, 7 Jan 2020 14:50:26 +0000 (14:50 +0000)]
[TypePromotion] Use SetVectors instead of PtrSets
Remove the chance of non-deterministic insertion of zexts of the
sources by using a SetVector instead of SmallPtrSet. Do the same for
sinks for consistency and to negate the small issue from possibly
happening. The SafeWrap instructions are now also stored in a
SmallVector. The IRPromoter members of these structures have been
changed to references.
Differential Revision: https://reviews.llvm.org/D72322
Sanjay Patel [Tue, 7 Jan 2020 14:47:50 +0000 (09:47 -0500)]
[DAGCombiner] reduce shuffle of concat of same vector
This is possibly a small part towards solving PR42024:
https://bugs.llvm.org/show_bug.cgi?id=42024
The vectorizer is creating shuffles of concat like this:
%63 = shufflevector <4 x i64> %x, <4 x i64> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
%64 = shufflevector <8 x i64> %63, <8 x i64> undef, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
That might be fixable in the vectorizers, but we're not allowed to fold that into a single shuffle in instcombine,
so we should have a backend backstop to convert that into the likely simpler form:
%64 = shufflevector <4 x i64> %x, <4 x i64> undef, <8 x i32> <i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3>
Differential Revision: https://reviews.llvm.org/D72300
Alexey Bataev [Tue, 7 Jan 2020 14:26:10 +0000 (09:26 -0500)]
[OPENMP]Do not diagnose references to non-integral types for ref in
declare simd.
According to the standard, a list-item that appears in a linear clause without the ref modifier must be of integral or pointer type, or must be a reference to an integral or pointer type. Added check that this restriction is applied only to non-ref items.
Kadir Cetinkaya [Thu, 12 Dec 2019 14:25:45 +0000 (15:25 +0100)]
[clangd] Introduce bulletlists
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71422
Sjoerd Meijer [Tue, 7 Jan 2020 13:54:47 +0000 (13:54 +0000)]
[ARM][MVE] VPT Blocks: findVCMPToFoldIntoVPS
This is a recommit of D71330, but with a few things fixed and changed:
1) ReachingDefAnalysis: this was not running with optnone as it was checking
skipFunction(), which other analysis passes don't do. I guess this is a
copy-paste from a codegen pass.
2) VPTBlockPass: here I've added skipFunction(), because like most/all
optimisations, we don't want to run this with optnone.
This fixes the issues with the initial/previous commit: the VPTBlockPass was
running with optnone, but ReachingDefAnalysis wasn't, and so VPTBlockPass was
crashing querying ReachingDefAnalysis.
I've added test case mve-vpt-block-optnone.mir to check that we don't run
VPTBlock with optnone.
Differential Revision: https://reviews.llvm.org/D71470
Simon Pilgrim [Tue, 7 Jan 2020 13:41:38 +0000 (13:41 +0000)]
[X86] Standardize shuffle match/lowering function names. NFC.
We mainly use lowerShuffle*/matchShuffle* - replace the (few) lowerVectorShuffle*/matchVectorShuffle* cases to be consistent.
Simon Pilgrim [Tue, 7 Jan 2020 13:37:48 +0000 (13:37 +0000)]
Fix "pointer is null" static analyzer warning. NFCI.
Victor Campos [Thu, 2 Jan 2020 11:00:14 +0000 (11:00 +0000)]
[ARM] Improve codegen of volatile load/store of i64
Summary:
Instead of generating two i32 instructions for each load or store of a volatile
i64 value (two LDRs or STRs), now emit LDRD/STRD.
These improvements cover architectures implementing ARMv5TE or Thumb-2.
Reviewers: dmgreen, efriedma, john.brawn, nickdesaulniers
Reviewed By: efriedma, nickdesaulniers
Subscribers: nickdesaulniers, vvereschaka, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70072
Simon Pilgrim [Tue, 7 Jan 2020 12:05:40 +0000 (12:05 +0000)]
Fix "use of uninitialized variable" static analyzer warning. NFCI.
Raphael Isemann [Tue, 7 Jan 2020 11:13:03 +0000 (12:13 +0100)]
[lldb][NFC] Use static_cast instead of reinterpret_cast where possible
Summary: There are a few places in LLDB where we do a `reinterpret_cast` for conversions that we could also do with `static_cast`. This patch moves all this code to `static_cast`.
Reviewers: shafik, JDevlieghere, labath
Reviewed By: labath
Subscribers: arphaman, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D72161
Ulrich Weigand [Tue, 7 Jan 2020 11:43:33 +0000 (12:43 +0100)]
[SystemZ] Extend fp-strict-alias test case
Explicitly add test for fpexcept.maytrap intrinsics.
LLVM GN Syncbot [Tue, 7 Jan 2020 11:41:46 +0000 (11:41 +0000)]
[gn build] Port
c69ae835d0e
Sam McCall [Tue, 7 Jan 2020 10:28:05 +0000 (11:28 +0100)]
[clangd] Add path mappings functionality
Summary: Add path mappings to clangd which translate file URIs on inbound and outbound LSP messages. This mapping allows clangd to run in a remote environment (e.g. docker), where the source files and dependencies may be at different locations than the host. See http://lists.llvm.org/pipermail/clangd-dev/2019-January/000231.htm for more.
Patch by William Wagner!
Reviewers: sammccall, ilya-biryukov
Reviewed By: sammccall
Subscribers: usaxena95, ormris, mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64305
Luís Marques [Tue, 7 Jan 2020 11:06:44 +0000 (11:06 +0000)]
[RISCV][Docs] Add RISC-V asm template argument modifiers
Adds the RISC-V asm template argument modifiers currently supported by LLVM.
Additional ones supported by GCC will be added to the documentation when we
start supporting them.
Simon Pilgrim [Tue, 7 Jan 2020 10:52:08 +0000 (10:52 +0000)]
Fix Wdocumentation warnings. NFCI.
Simon Pilgrim [Mon, 6 Jan 2020 18:24:53 +0000 (18:24 +0000)]
Fix "use of uninitialized variable" static analyzer warnings. NFCI.
Simon Pilgrim [Mon, 6 Jan 2020 16:53:18 +0000 (16:53 +0000)]
Fix "use of uninitialized variable" static analyzer warnings. NFCI.
James Henderson [Tue, 7 Jan 2020 10:21:20 +0000 (10:21 +0000)]
[DebugInfo] Fix infinite loop caused by reading past debug_line end
If the claimed unit length of a debug line program is such that the line
table would finish past the end of the .debug_line section, an infinite
loop occurs because the data extractor will continue to "read" zeroes
without changing the offset. This previously didn't hit an error because
the line table program handles a series of zeroes as a bad extended
opcode.
This patch fixes the inifinite loop and adds a warning if the program
doesn't fit in the available data.
Reviewed by: JDevlieghere
Differential Revision: https://reviews.llvm.org/D72279
Peter Smith [Mon, 6 Jan 2020 14:16:05 +0000 (14:16 +0000)]
[LLD][ELF][AArch64] Do not use thunk for undefined weak symbol.
In AArch64 a branch to an undefined weak symbol that does not have a PLT
entry should resolve to the next instruction. The thunk generation code
can prevent this from happening as a range extension thunk can be generated
if the branch is sufficiently far away from 0, the value of an undefined
weak symbol.
The fix is taken from the Arm implementation of needsThunk(), we prevent a
thunk from being generated to an undefined weak symbol.
fixes pr44451
Differential Revision: https://reviews.llvm.org/D72267
Raphael Isemann [Tue, 7 Jan 2020 09:37:57 +0000 (10:37 +0100)]
[lldb][NFC] Take a llvm::Triple in ClangASTContext constructor
This constructor is supposed to take a string representing an llvm::Triple.
We might as well take a llvm::Triple here which saves us all the string
conversions in the call sites and we make this more type safe.
Jim Lin [Tue, 7 Jan 2020 09:32:39 +0000 (17:32 +0800)]
[NFC] Use isX86() instead of getArch()
Summary: This is a clean up for https://reviews.llvm.org/D72247.
Reviewers: MaskRay, craig.topper, jhenderson
Reviewed By: MaskRay
Subscribers: hiraditya, rupprecht, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D72320
Ulrich Weigand [Tue, 7 Jan 2020 09:24:26 +0000 (10:24 +0100)]
[SystemZ] Fix python failure in test case
With recent Python the Large/spill-02.py test failed with an error:
TypeError: can't multiply sequence by non-int of type 'float'
Ehud Katz [Tue, 7 Jan 2020 09:24:11 +0000 (11:24 +0200)]
[APFloat] Fix out of scope usage of a pointer to local variable
serge-sans-paille [Tue, 7 Jan 2020 08:27:08 +0000 (09:27 +0100)]
Fix compiler extension example cmake integration
- Do not add it to the Export file
- Update install target
Differential Revision: https://reviews.llvm.org/D72255
Raphael Isemann [Tue, 7 Jan 2020 07:30:45 +0000 (08:30 +0100)]
[lldb] Fix LLDB build after API change to printInst (D72172)
It seems in D72172 we always pass a 0 as the new default argument so let's
do the same in LLDB to get the build bot running.
Ehud Katz [Tue, 7 Jan 2020 06:45:18 +0000 (08:45 +0200)]
[APFloat] Fix fusedMultiplyAdd when `this` equals to `Addend`
Up until now, the arguments to `fusedMultiplyAdd` are passed by
reference. We must save the `Addend` value on the beginning of the
function, before we modify `this`, as they may be the same reference.
To fix this, we now pass the `addend` parameter of `multiplySignificand`
by value (instead of by-ref), and have a default value of zero.
Fix PR44051.
Differential Revision: https://reviews.llvm.org/D70422
Siva Chandra Reddy [Mon, 6 Jan 2020 18:38:45 +0000 (10:38 -0800)]
[libc] Move implementations of strcat and strcpy to the string directory.
Summary:
Now that tests live in separate top-level directory, keeping the
implementations of individual functions in a directory of their own is
not meaningful. Hence, this change moves them into the higher level
string directory.
NFC intended.
Reviewers: MaskRay
Subscribers: mgorny, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D72295
Kazuaki Ishizaki [Tue, 7 Jan 2020 06:03:31 +0000 (14:03 +0800)]
[OpenMP] NFC: Fix trivial typos in comments
Reviewers: jdoerfert, Jim
Reviewed By: Jim
Subscribers: Jim, mgorny, guansong, jfb, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D72285
Siva Chandra Reddy [Thu, 2 Jan 2020 19:09:18 +0000 (11:09 -0800)]
[libc] Add __attribute__((always_inline)) to x86_64 syscall functions.
Summary:
Some syscalls like SYS_clone do not tolerate a return instruction after
the syscall instruction. Marking the syscall functions with the
`always_inline` attribute accommodates such syscalls as inlining
eliminates the return instruction.
Reviewers: abrachet, phosek
Subscribers: MaskRay, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D72102
Juneyoung Lee [Tue, 7 Jan 2020 05:04:32 +0000 (14:04 +0900)]
Let PassBuilder Expose PassInstrumentationCallbacks
Summary:
This is an effort to allowing external libraries register their own pass instrumentation during their llvmGetPassPluginInfo() calls.
By exposing this through the added getPIC(), now a pass writer can do something like this:
```
extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
llvmGetPassPluginInfo() {
return {
..,
[](llvm::PassBuilder &PB) {
PB.getPIC()->registerAfterPassCallback(move(f));
}
};
}
```
Reviewers: chandlerc, philip.pfaffe, fedor.sergeev
Reviewed By: fedor.sergeev
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71086
Fangrui Song [Fri, 3 Jan 2020 20:02:46 +0000 (12:02 -0800)]
[MC] Add parameter `Address` to MCInstrPrinter::printInstruction
Follow-up of D72172.
Reviewed By: jhenderson, rnk
Differential Revision: https://reviews.llvm.org/D72180
Fangrui Song [Fri, 3 Jan 2020 18:55:30 +0000 (10:55 -0800)]
[MC] Add parameter `Address` to MCInstPrinter::printInst
printInst prints a branch/call instruction as `b offset` (there are many
variants on various targets) instead of `b address`.
It is a convention to use address instead of offset in most external
symbolizers/disassemblers. This difference makes `llvm-objdump -d`
output unsatisfactory.
Add `uint64_t Address` to printInst(), so that it can pass the argument to
printInstruction(). `raw_ostream &OS` is moved to the last to be
consistent with other print* methods.
The next step is to pass `Address` to printInstruction() (generated by
tablegen from the instruction set description). We can gradually migrate
targets to print addresses instead of offsets.
In any case, downstream projects which don't know `Address` can pass 0 as
the argument.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D72172
Matt Arsenault [Tue, 7 Jan 2020 03:31:33 +0000 (22:31 -0500)]
AMDGPU/GlobalISel: Fix unused variable warning in release
Nicolas Vasilache [Tue, 7 Jan 2020 03:14:14 +0000 (22:14 -0500)]
[mlir][Linalg] Add a linalg.reshape op
Summary:
This diff adds a new operation to linalg to allow reshaping of an
existing view into a new view in the same buffer at the same offset.
More specifically:
The `linalg.reshape` op produces a new view whose sizes are a reassociation
of the original `view`. Depending on whether or not the reassociated
MemRefType is contiguous, the resulting memref may require explicit alloc
and copies.
A reassociation is defined as a continous grouping of dimensions and is
represented with a affine map array attribute. In the future, non-continous
groupings may be allowed (i.e. permutations, reindexings etc).
For now, it is assumed that either:
1. a reassociation produces and consumes contiguous MemRefType or,
2. the reshape op will be folded into its consumers (by changing the shape
of the computations).
All other cases are undefined behavior and a reshape op may not lower to
LLVM if it cannot be proven statically that it does not require alloc+copy.
A reshape may either collapse or expand dimensions, depending on the
relationship between source and target memref ranks. The verification rule
is that the reassociation maps are applied to the memref with the larger
rank to obtain the memref with the smaller rank. In the case of a dimension
expansion, the reassociation maps can be interpreted as inverse maps.
Examples:
```mlir
// Dimension collapse (i, j) -> i' and k -> k'
%1 = linalg.reshape %0 [(i, j, k) -> (i, j),
(i, j, k) -> (k)] :
memref<?x?x?xf32, stride_spec> into memref<?x?xf32, stride_spec_2>
```
```mlir
// Dimension expansion i -> (i', j') and (k) -> (k')
%1 = linalg.reshape %0 [(i, j, k) -> (i, j),
(i, j, k) -> (k)] :
memref<?x?xf32, stride_spec> into memref<?x?x?xf32, stride_spec_2>
```
The relevant invalid and roundtripping tests are added.
Reviewers: AlexEichenberger, ftynse, rriddle, asaadaldien, yangjunpro
Subscribers: kiszk, merge_guards_bot, mehdi_amini, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72168
QingShan Zhang [Tue, 7 Jan 2020 03:13:39 +0000 (03:13 +0000)]
[NFC][Test] Add a test to verify the DAGCombine of fma
Matt Arsenault [Tue, 7 Jan 2020 02:01:16 +0000 (21:01 -0500)]
AMDGPU: Add run line to int_to_fp tests
This wasn't catching a regression on targets with legal i16 triggered
in a future commit.
Matt Arsenault [Mon, 21 Oct 2019 20:39:17 +0000 (13:39 -0700)]
AMDGPU: Select llvm.amdgcn.interp.p2.f16 directly
This will enable automatic GlobalISel support in a future commit.
Richard Smith [Tue, 7 Jan 2020 01:16:29 +0000 (17:16 -0800)]
Always deduce the lengths of contained parameter packs when deducing a
pack expansion.
Previously, if all parameter / argument pairs for a pack expansion
deduction were non-deduced contexts, we would not deduce the arity of
the pack, and could end up deducing a different arity (leading to
failures during substitution) or defaulting to an arity of 0 (leading to
bad diagnostics about passing the wrong number of arguments to a
variadic function). Instead, we now always deduce the arity for all
involved packs any time we deduce a pack expansion.
This will result in less substitution happening in some cases, which
could avoid non-SFINAEable errors, and should generally improve the
quality of diagnostics when passing initializer lists to variadic
functions.
Matt Arsenault [Sat, 7 Sep 2019 22:42:27 +0000 (18:42 -0400)]
AMDGPU: Use default operands for clamp/omod
We have a lot of complex pattern variants that just set the source
modifiers that are really handled, and then set the output modifiers
to 0. We're unlikely to ever match output modifiers from the use
instruction side, and we already match clamp/omod in a separate pass.
Heejin Ahn [Tue, 7 Jan 2020 00:15:53 +0000 (16:15 -0800)]
[WebAssembly] Fix landingpad-only case in Emscripten EH
Summary:
Previously we didn't set `Changed` to true when there are only landing
pads but not invokes. This fixes it and we set `Changed` to true
whenever we have landing pads. (There can't be invokes without landing
pads, so that case is covered too)
The test case for this has to be a separate file because this pass is a
`ModulePass` and `Changed` is computed based on the whole module.
Reviewers: tlively
Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72308
Matt Arsenault [Sat, 4 Jan 2020 17:50:18 +0000 (12:50 -0500)]
AMDGPU/GlobalISel: Legalize G_READCYCLECOUNTER
Akira Hatanaka [Sat, 4 Jan 2020 16:32:49 +0000 (08:32 -0800)]
[CodeGen][ObjC] Push the properties of a protocol before pushing the
properties of the protocol it inherits
This fixes a bug where the type string for a @dynamic property of an
@implementation didn't have 'D' in it when the protocol it conforms to
redeclares the property declared in the base protocol.
rdar://problem/
45503561
Evgenii Stepanov [Tue, 7 Jan 2020 00:12:52 +0000 (16:12 -0800)]
[msan] Fix underflow in qsort interceptor.
Mark de Wever [Mon, 6 Jan 2020 23:49:41 +0000 (00:49 +0100)]
[NFC] Fixes -Wrange-loop-analysis warnings
This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.
Fangrui Song [Mon, 6 Jan 2020 18:16:28 +0000 (10:16 -0800)]
Add Triple::isX86()
Reviewed By: craig.topper, skan
Differential Revision: https://reviews.llvm.org/D72247
Akira Hatanaka [Mon, 6 Jan 2020 23:45:27 +0000 (15:45 -0800)]
Use FileCheck instead of grep
Matt Arsenault [Wed, 25 Dec 2019 14:06:05 +0000 (09:06 -0500)]
AMDGPU/GlobalISel: Select G_UADDE/G_USUBE
Matt Arsenault [Sat, 2 Nov 2019 16:30:59 +0000 (09:30 -0700)]
AMDGPU/GlobalISel: Replace handling of boolean values
This solves selection failures with generated selection patterns,
which would fail due to inferring the SGPR reg bank for virtual
registers with a set register class instead of VCC bank. Use
instruction selection would constrain the virtual register to a
specific class, so when the def was selected later the bank no longer
was set to VCC.
Remove the SCC reg bank. SCC isn't directly addressable, so it
requires copying from SCC to an allocatable 32-bit register during
selection, so these might as well be treated as 32-bit SGPR values.
Now any scalar boolean value that will produce an outupt in SCC should
be widened during RegBankSelect to s32. Any s1 value should be a
vector boolean during selection. This makes the vcc register bank
unambiguous with a normal SGPR during selection.
Summary of how this should now work:
- G_TRUNC is always a no-op, and never should use a vcc bank result.
- SALU boolean operations should be promoted to s32 in RegBankSelect
apply mapping
- An s1 value means vcc bank at selection. The exception is for
legalization artifacts that use s1, which are never VCC. All other
contexts should infer the VCC register classes for s1 typed
registers. The LLT for the register is now needed to infer the
correct register class. Extensions with vcc sources should be
legalized to a select of constants during RegBankSelect.
- Copy from non-vcc to vcc ensures high bits of the input value are
cleared during selection.
- SALU boolean inputs should ensure the inputs are 0/1. This includes
select, conditional branches, and carry-ins.
There are a few somewhat dirty details. One is that G_TRUNC/G_*EXT
selection ignores the usual register-bank from register class
functions, and can't handle truncates with VCC result banks. I think
this is OK, since the artifacts are specially treated anyway. This
does require some care to avoid producing cases with vcc. There will
also be no 100% reliable way to verify this rule is followed in
selection in case of register classes, and violations manifests
themselves as invalid copy instructions much later.
Standard phi handling also only considers the bank of the result
register, and doesn't insert copies to make the source banks
match. This doesn't work for vcc, so we have to manually correct phi
inputs in this case. We should add a verifier check to make sure there
are no phis with mixed vcc and non-vcc register bank inputs.
There's also some duplication with the LegalizerHelper, and some code
which should live in the helper. I don't see a good way to share
special knowledge about what types to use for intermediate operations
depending on the bank for example. Using the helper to replace
extensions with selects also seems somewhat awkward to me.
Another issue is there are some contexts calling
getRegBankFromRegClass that apparently don't have the LLT type for the
register, but I haven't yet run into a real issue from this.
This also introduces new unnecessary instructions in most cases, since
we don't yet try to optimize out the zext when the source is known to
come from a compare.
Matt Arsenault [Tue, 22 Oct 2019 04:39:42 +0000 (21:39 -0700)]
TableGen/GlobalISel: Handle default operands that are used
Copy the logic from the existing handling in the DAG matcher emittter.
This will enable some AMDGPU pattern cleanups without breaking
GlobalISel tests, and eventually handle importing more patterns.
The test is a bit annoying since the sections seem to randomly sort
themselves if anything else is added in the future.
Matt Arsenault [Tue, 24 Dec 2019 19:49:31 +0000 (14:49 -0500)]
GlobalISel: Implement lower for G_INTRINSIC_ROUND
Mostly copied from AMDGPU lowering implementation, except used
G_SITOFP instead of directly creating a select on -1.0, 0.0.