Vitaly Buka [Fri, 19 Jun 2020 07:49:23 +0000 (00:49 -0700)]
[SafeStack,NFC] Print liveness for all instrunctions
Vitaly Buka [Fri, 19 Jun 2020 01:17:59 +0000 (18:17 -0700)]
[StackSafety,NFC] Replace map with vector
We don't need to lookup InstructionNumbering by number, so
we can use vector with index as assigned number.
Vitaly Buka [Fri, 19 Jun 2020 01:08:37 +0000 (18:08 -0700)]
[StackSafety,NFC] Don't test terminators
Code does not track terminators and do not expose them through interface.
State there is just a state of the last instruction or entry.
So this information is just redundant and doesn't need to be tested.
Florian Hahn [Fri, 19 Jun 2020 08:27:52 +0000 (09:27 +0100)]
[SCCP] Turn sext into zext for non-negative ranges.
This patch updates SCCP/IPSCCP to use the computed range info to turn
sexts into zexts, if the value is known to be non-negative. We already
to a similar transform in CorrelatedValuePropagation, but it seems like
we can catch a lot of additional cases by doing it in SCCP/IPSCCP as
well.
The transform is limited to ranges that are known to not include undef.
Currently constant ranges from conditions are treated as potentially
containing undef, due to PR46144. Once we flip this, the transform will
be more effective in practice.
Reviewers: efriedma, davide
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D81756
Jay Foad [Thu, 18 Jun 2020 17:20:58 +0000 (18:20 +0100)]
[LiveIntervals] Fix early-clobber handling in handleMoveUp
Without this fix, handleMoveUp can create an invalid live range like
this:
[98904e,98908r:0)[98908e,227504r:1)
where the two segments overlap, but only because we have lost the "e"
(early-clobber) on the end point of the first segment.
Differential Revision: https://reviews.llvm.org/D82110
Raul Tambre [Fri, 19 Jun 2020 07:13:33 +0000 (12:43 +0530)]
[libc++] Implement <numbers>
Summary: Constants have 33 significant decimal digits for IEEE 754 128-bit floating-point numbers.
Reviewers: ldionne, #libc, EricWF, zoecarver, curdeius
Reviewed By: ldionne, #libc, curdeius
Differential Revision: https://reviews.llvm.org/D77505
Daniel Grumberg [Fri, 19 Jun 2020 08:07:42 +0000 (09:07 +0100)]
[NFC] Make AST_BLOCK_HASH test more robust with downstream changes
Tyker [Fri, 19 Jun 2020 08:32:09 +0000 (10:32 +0200)]
[AssumeBundles] add cannonicalisation to the assume builder
Summary:
this reduces significantly the number of assumes generated without aftecting too much
the information that is preserved. this improves the compile-time cost
of enable-knowledge-retention significantly.
Reviewers: jdoerfert, sstefan1
Reviewed By: jdoerfert
Subscribers: hiraditya, asbirlea, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79650
Alex Zinenko [Thu, 18 Jun 2020 20:55:53 +0000 (22:55 +0200)]
[mlir] Remove EDSC NestedBuilder
All class derived from `edsc::NestedBuilder` in core MLIR have been replaced
with alternatives based on OpBuilder+callbacks. The *Builder EDSC
infrastructure has been deprecated. Remove edsc::NestedBuilder.
This completes the "structured builders" refactoring.
Differential Revision: https://reviews.llvm.org/D82128
Alex Zinenko [Thu, 18 Jun 2020 20:55:46 +0000 (22:55 +0200)]
[mlir] Remove EDSC BlockBuilder, BlockHandle and related functionality
Callback-based constructions of blocks where the body is populated in the same
function as the block creation is a natural extension of callback-based loop
construction. They provide more concise and simple APIs than EDSC BlockBuilder
at less than 20% infrastructural code cost, and are compatible with
ScopedContext. BlockBuilder, Blockhandle and related functionality has been
deprecated, remove them.
Differential Revision: https://reviews.llvm.org/D82015
Alex Zinenko [Thu, 18 Jun 2020 20:55:40 +0000 (22:55 +0200)]
[mlir] Remove EDSC LoopBuilder, derived classes and related functionality
Callback-based loop construction, with loop bodies being constructed during the
construction of the parent op using a function, is now fully supported by the
core infrastructure. This provides almost the same level of brevity as EDSC
LoopBuilder at less than 30% infrastructural code cost. Functional equivalents
compatible with EDSC ScopedContext are implemented on top of the main builders.
LoopBuilder and related functionality has been deprecated, remove it.
Differential Revision: https://reviews.llvm.org/D81874
David Sherwood [Tue, 26 May 2020 06:46:01 +0000 (07:46 +0100)]
[CodeGen] Fix SimplifyDemandedBits for scalable vectors
For now I have changed SimplifyDemandedBits and it's various callers
to assume we know nothing for scalable vectors and to ignore the
demanded bits completely. I have also done something similar for
SimplifyDemandedVectorElts. These changes fix up lots of warnings
due to calls to EVT::getVectorNumElements() for types with scalable
vectors. These functions are all used for optimisations, rather than
functional requirements. In future we can revisit this code if
there is a need to improve code quality for SVE.
Differential Revision: https://reviews.llvm.org/D80537
David Sherwood [Wed, 3 Jun 2020 14:02:44 +0000 (15:02 +0100)]
[CodeGen] Fix ComputeNumSignBits for scalable vectors
When trying to calculate the number of sign bits for scalable vectors
we should just bail out for now and pretend we know nothing.
Differential Revision: https://reviews.llvm.org/D81093
Haojian Wu [Tue, 16 Jun 2020 07:08:02 +0000 (09:08 +0200)]
[AST] Dump containsErrors bit for the Type.
Reviewers: sammccall
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81912
Mehdi Amini [Fri, 19 Jun 2020 03:21:36 +0000 (03:21 +0000)]
Fix `check-mlir` target when the host target isn't configured
This patch adds the `default_triple` feature to MLIR test suite.
This feature was added to LLVM in
d178f4fc8 in order to be able to
run the LLVM tests without having the host targets configured in.
With this change, `ninja check-mlir` passes without the host
target, i.e. this config:
cmake ../llvm -DLLVM_TARGETS_TO_BUILD="" -DLLVM_DEFAULT_TARGET_TRIPLE="" -DLLVM_ENABLE_PROJECTS=mlir -GNinja
Differential Revision: https://reviews.llvm.org/D82142
Mehdi Amini [Fri, 19 Jun 2020 04:41:24 +0000 (04:41 +0000)]
Mark some LLVM tests which require a default_triple (NFC)
These tests involve a JIT, and like other tests should have the
REQUIRE: default_triple present.
This allow to run `ninja check` without the host target configured
in.
Kristof Beyls [Mon, 25 May 2020 14:48:22 +0000 (15:48 +0100)]
[AArch64] Add clang command line support for -mharden-sls=
The accepted options to -mharden-sls= are:
* all: enable all mitigations against Straight Line Speculation that are
implemented.
* none: disable all mitigations against Straight Line Speculation.
* retbr: enable the mitigation against Straight Line Speculation for RET
and BR instructions.
* blr: enable the mitigation against Straight Line Speculation for BLR
instructions.
Differential Revision: https://reviews.llvm.org/D81404
Max Kazantsev [Fri, 19 Jun 2020 05:56:26 +0000 (12:56 +0700)]
[Test] Add more tests on select->phi transform
Dylan McKay [Fri, 19 Jun 2020 05:34:59 +0000 (17:34 +1200)]
[AVR] Remove duplicate specification of lib directory
Reviewers: dylanmckay
Reviewed By: dylanmckay
Subscribers: Jim, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77334
This was originally committed in
03b0831144a9fe25aac81498b0a1dec82f4ec5df but I missed the commit
attribution.
Patch by Dennis van der Schagt.
Dylan McKay [Fri, 19 Jun 2020 05:35:43 +0000 (17:35 +1200)]
Revert "[AVR] Remove duplicate specification of lib directory"
This reverts commit
03b0831144a9fe25aac81498b0a1dec82f4ec5df.
I forgot to attribute the commit originally so I am recommitting in a
subsequent patch.
Dylan McKay [Fri, 19 Jun 2020 05:34:59 +0000 (17:34 +1200)]
[AVR] Remove duplicate specification of lib directory
Reviewers: dylanmckay
Reviewed By: dylanmckay
Subscribers: Jim, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77334
Kristof Beyls [Fri, 22 May 2020 20:00:46 +0000 (21:00 +0100)]
[AArch64] Avoid incompatibility between SLSBLR mitigation and BTI codegen.
A "BTI c" instruction only allows jumping/calling to using a BLR* instruction.
However, the SLSBLR mitigation changes a BLR to a BR to implement the
function call. Therefore, a "BTI c" check that passed before could
trigger after the BLR->BL change done by the SLSBLR mitigation.
However, if the register used in BR is X16 or X17, this trigger will not
fire (see ArmARM for further details).
Therefore, this patch simply changes the function stubs for the SLSBLR
mitigation from
__llvm_slsblr_thunk_x<N>:
br x<N>
SpeculationBarrier
to
__llvm_slsblr_thunk_x<N>:
mov x16, x<N>
br x16
SpeculationBarrier
Differential Revision: https://reviews.llvm.org/D81405
Anthony Steinhauser [Fri, 19 Jun 2020 04:54:30 +0000 (21:54 -0700)]
[libc] Migrate the libc benchmark instruction to ninja.
Reviewers: sivachandra
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D82143
Ronak Chauhan [Wed, 17 Jun 2020 19:52:08 +0000 (01:22 +0530)]
[MC] Pass the symbol rather than its name to onSymbolStart()
Summary: This allows targets to also consider the symbol's type and/or address if needed.
Reviewers: scott.linder, jhenderson, MaskRay, aardappel
Reviewed By: scott.linder, MaskRay
Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, aheejin, rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82090
Francesco Petrogalli [Fri, 19 Jun 2020 03:31:01 +0000 (03:31 +0000)]
[llvm][SVE] Reg + reg addressing mode for LD1RO.
Reviewers: efriedma, sdesmalen
Reviewed By: efriedma
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80741
Nemanja Ivanovic [Fri, 19 Jun 2020 02:53:50 +0000 (21:53 -0500)]
[PowerPC] Canonicalize shuffles to match more single-instruction masks on LE
We currently miss a number of opportunities to emit single-instruction
VMRG[LH][BHW] instructions for shuffles on little endian subtargets. Although
this in itself is not a huge performance opportunity since loading the permute
vector for a VPERM can always be pulled out of loops, producing such merge
instructions is useful to downstream optimizations.
Since VPERM is essentially opaque to all subsequent optimizations, we want to
avoid it as much as possible. Other permute instructions have semantics that can
be reasoned about much more easily in later optimizations.
This patch does the following:
- Canonicalize shuffles so that the first element comes from the first vector
(since that's what most of the mask matching functions want)
- Switch the elements that come from splat vectors so that they match the
corresponding elements from the other vector (to allow for merges)
- Adds debugging messages for when a shuffle is matched to a VPERM so that
anyone interested in improving this further can get the info for their code
Differential revision: https://reviews.llvm.org/D77448
Carl Ritson [Fri, 19 Jun 2020 01:29:47 +0000 (10:29 +0900)]
AMDGPU/GlobalISel: Remove selection of MAD/MAC when not available
Add code to respect mad-mac-f32-insts target feature.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D81990
LLVM GN Syncbot [Fri, 19 Jun 2020 01:17:54 +0000 (01:17 +0000)]
[gn build] Port
9ca50e887db
Richard Smith [Fri, 19 Jun 2020 01:16:53 +0000 (18:16 -0700)]
Yitzhak Mandelbaum [Mon, 15 Jun 2020 19:23:57 +0000 (15:23 -0400)]
[libTooling] Add parser for string representation of `RangeSelector`.
This patch adds a parser for a `RangeSelector` written as a string. The format
is closely based on the way one would right the selector in C++. This should
enable use of `RangeSelector`s from tools like clang-query and web UIs.
Richard Smith [Fri, 19 Jun 2020 00:45:55 +0000 (17:45 -0700)]
The type of a reference to a non-type template parameter pack should
not be a pack expansion type.
Using a pack expansion type for a pack declaration makes sense, but
general expressions should never have pack expansion types. If we have a
pack `T *...V`, then the type of `V` is the type `T *`, which contains
an unexpanded pack, and is a pointer type.
This allows us to better diagnose issues where a template is invalid due
to some non-dependent portion of a dependent type of a non-type template
parameter pack.
Ties Stuij [Thu, 18 Jun 2020 22:57:32 +0000 (23:57 +0100)]
[BFloat] Move LLVMBFloatTypeKind to the end of the enum
Summary: so it doesn't change the C ABI
Reviewers: deadalnix
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82135
peter klausler [Thu, 18 Jun 2020 21:37:59 +0000 (14:37 -0700)]
[flang] DATA statement processing (part 2/4): Initial images
Summary:
Defines a representation for the initialized memory image of
a variable. This image is populated by DATA statement
processing as designator elements are put into correspondence
with values, then converted into an initializer in the symbol
table so that lowering can pass the initial image to the
code generator.
Reviewers: tskeith, PeteSteinfeld, sscalpone, jdoerfert, DavidTruby
Reviewed By: tskeith
Subscribers: mgorny, llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D82131
Brad Smith [Fri, 19 Jun 2020 00:05:39 +0000 (20:05 -0400)]
Revert "Hook up OpenBSD 64-bit PowerPC support"
Derek Schuff [Thu, 18 Jun 2020 20:06:51 +0000 (13:06 -0700)]
Set appropriate host defines for building under emscripten
Emscripten has emulations for several headers found on Linux,
including spwan.h and endian.h
Differential Revision: https://reviews.llvm.org/D82121
Vitaly Buka [Thu, 18 Jun 2020 23:55:12 +0000 (16:55 -0700)]
[sanitizer] Update global_symbols.txt
Vitaly Buka [Thu, 18 Jun 2020 09:24:00 +0000 (02:24 -0700)]
[StackSafety] Add "Must Live" logic
Summary:
Extend StackLifetime with option to calculate liveliness
where alloca is only considered alive on basic block entry
if all non-dead predecessors had it alive at terminators.
Depends on D82043.
Reviewers: eugenis
Reviewed By: eugenis
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82124
Nathan James [Thu, 18 Jun 2020 23:40:00 +0000 (00:40 +0100)]
[NFC] Refactor Registry loops to range for
Vitaly Buka [Wed, 17 Jun 2020 11:09:58 +0000 (04:09 -0700)]
[StackSafety] Add pass for StackLifetime testing
Summary: lifetime.ll is a copy of SafeStack/X86/coloring2.ll
Reviewers: eugenis
Reviewed By: eugenis
Subscribers: hiraditya, mgrang, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82043
Brad Smith [Thu, 18 Jun 2020 23:19:45 +0000 (19:19 -0400)]
Hook up OpenBSD 64-bit PowerPC support
River Riddle [Thu, 18 Jun 2020 22:45:43 +0000 (15:45 -0700)]
[mlir][DialectConversion] Refactor how block argument types get converted
This revision removes the TypeConverter parameter passed to the apply* methods, and instead moves the responsibility of region type conversion to patterns. The types of a region can be converted using the 'convertRegionTypes' method, which acts similarly to the existing 'applySignatureConversion'. This method ensures that all blocks within, and including those moved into, a region will have the block argument types converted using the provided converter.
This has the benefit of making more of the legalization logic controlled by patterns, instead of being handled explicitly by the driver. It also opens up the possibility to support multiple type conversions at some point in the future.
This revision also adds a new utility class `FailureOr<T>` that provides a LogicalResult friendly facility for returning a failure or a valid result value.
Differential Revision: https://reviews.llvm.org/D81681
Xiangling Liao [Tue, 16 Jun 2020 20:27:04 +0000 (16:27 -0400)]
[NFC] Cleanup of EmitCXXGlobalInitFunc() and EmitCXXGlobalDtorFunc()
Tidy up some code of EmitCXXGlobalInitFunc() and EmitCXXGlobalDtorFunc() as the
pre-work of D74166 patch.
Differential Revision: https://reviews.llvm.org/D81972
peter klausler [Thu, 18 Jun 2020 20:28:43 +0000 (13:28 -0700)]
[flang] DATA stmt processing (part 1/4): designator folding
Summary:
Add code to resolve constant Designators at compilation time
into a base Symbol, byte offset, and field size. This is used in
later DATA statement processing to identify the static storage being
initialized by each object in a DATA statement. Also implement
the reverse mapping so that Designators can be reconstructed for
use in error messages about (e.g.) duplicate initializers.
Reviewers: tskeith, PeteSteinfeld, sscalpone, jdoerfert, DavidTruby
Reviewed By: PeteSteinfeld
Subscribers: mgorny, llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D82125
Fangrui Song [Thu, 18 Jun 2020 21:52:39 +0000 (14:52 -0700)]
[docs] Regenerate clang/docs/ClangCommandLineReference.rst
Matt Arsenault [Thu, 18 Jun 2020 13:37:33 +0000 (09:37 -0400)]
ARC: Enforce function alignment at code emission time
Don't do this in the MachineFunctionInfo constructor. Also, ensure the
alignment rather than overwriting it outright. I vaguely remember
there was another place to enforce the target minimum alignment, but I
couldn't find it (it's there for instructions).
Matt Arsenault [Fri, 5 Jun 2020 19:29:18 +0000 (15:29 -0400)]
AMDGPU/GlobalISel: Implement computeKnownAlignForTargetInstr
We probably need to move where intrinsics are lowered to copies to
make this useful.
Matt Arsenault [Thu, 18 Jun 2020 21:24:12 +0000 (17:24 -0400)]
AMDGPU: Update private null pointer value in documentation
Private pointers used to workaround IR semantics by artifically
reserving an object at offset 0 so no user object would be allocated
there. Since alloca now uses a non-0 address space, that workaround is
unnecssary and 0 can be treated as a valid pointer.
Matt Arsenault [Thu, 11 Jun 2020 00:47:52 +0000 (20:47 -0400)]
BypassSlowDivision: Fix dropping debug info
I don't know anything about debug info, but this seems like more work
should be necessary. This constructs a new IRBuilder and reconstructs
the original divides rather than moving the original.
One problem this has is if a div/rem pair are handled, both end up
with the same debugloc. I'm not sure how to fix this, since this uses
a cache when it sees the same input operands again, which will have
the first instance's location attached.
peter klausler [Thu, 18 Jun 2020 19:19:49 +0000 (12:19 -0700)]
[flang] Roll up small fixes to runtime bugs found in testing
Summary:
Fix several bugs in the Fortran runtime found in initial
testing.
Reviewers: tskeith, PeteSteinfeld, sscalpone, jdoerfert, DavidTruby
Reviewed By: tskeith, PeteSteinfeld
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D82116
Amy Kwan [Thu, 18 Jun 2020 18:11:09 +0000 (13:11 -0500)]
[PowerPC][Power10] Implement Parallel Bits Deposit/Extract Builtins in LLVM/Clang
This patch implements builtins for the following prototypes:
vector unsigned long long vec_pdep(vector unsigned long long, vector unsigned long long);
vector unsigned long long vec_pext(vector unsigned long long, vector unsigned long long __b);
unsigned long long __builtin_pdepd (unsigned long long, unsigned long long);
unsigned long long __builtin_pextd (unsigned long long, unsigned long long);
Revision Depends on D80758
Differential Revision: https://reviews.llvm.org/D80935
Matt Arsenault [Tue, 16 Jun 2020 18:20:34 +0000 (14:20 -0400)]
GlobalISel: Fix some artifact combiner worklist inconsistencies
In one case, UpdateDefs was not getting set and a dead SmallVector
constructed. In another, it was adding new vreg defs to the updated
set which should be unnecessary. This also wasn't considering the
multiple defs of G_UNMERGE_VALUES.
Also increase the small vector sizes for merge/unmerge operands to the
usual semi-arbitrary 8. While debugging these, I'm usually seeing
merges and unmerges with at least 4 uses/defs.
I haven't run into an actual problem from any of these though.
Matt Arsenault [Tue, 9 Jun 2020 21:02:12 +0000 (17:02 -0400)]
GlobalISel: Pass LegalizerHelper to custom legalize callbacks
This was passing in all the parameters needed to construct a
LegalizerHelper in the custom legalization, when it's simpler to just
pass in the existing helper.
This is slightly more annoying to use in the common case where you
don't need the legalizer helper, but we could add back the common
parameters back in addition to the helper.
I didn't propagate this to all the internal target changes that this
logically implies, but did update a sample one for
legalizeMinNumMaxNum.
This is in preparation for moving AMDGPU load/store legalization
entirely into custom lowering. The current set of legalization actions
is really constraining and not really capable of expressing all the
actions needed to legalize loads/stores. In particular there's no way
to express when the memory access itself needs to change size vs. the
result type. There's also a lot of redundancy since the same
split/widen actions need to be applied in both vector and scalar
cases. All of the sub-cases logically belong as steps in the legalizer
helper, but it will be easier to consider everything at once in custom
lowering.
Vedant Kumar [Thu, 4 Jun 2020 21:33:17 +0000 (14:33 -0700)]
[docs] Specify rules for updating debug locations
Summary:
Restructure HowToUpdateDebugInfo.rst to specify rules for when
transformations should preserve, merge, or drop debug locations.
The goal is to have clear, well-justified rules that come with a few
examples and counter-examples, so that pass authors can pick the best
strategy for managing debug locations depending on the specific task at
hand.
I've tried to set down sensible rules here that mostly align with what
we already do in llvm today, and that take a diverse set of use cases
into account (interactive debugging, crash triage, SamplePGO).
Please *do* try to pick these rules apart and suggest clarifications or
improvements :).
Side note: Prior to
24660ea1, this document was structured as a long
list of very specific code transformations -- the idea being that we
would fill in what to do in each specific case. I chose to reorganize
the document as a list of actions to take because it drastically cuts
down on the amount of redundant exposition/explanation needed. I hope
that's fine...
Reviewers: jmorse, aprantl, dblaikie
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81198
Jonas Devlieghere [Thu, 18 Jun 2020 21:04:34 +0000 (14:04 -0700)]
[Sphinx] Adjust for source_parsers deprecation in Sphinx 3.0
Update the Sphinx configuration for the removal of source_parsers in
Sphinx 3.0. The variable has been deprecated since version 1.8.
> Version 1.8 deprecates and version 3.0 removes the source_parsers
> configuration variable that was used by older recommonmark versions.
https://www.sphinx-doc.org/en/master/usage/markdown.html
Differential revision: https://reviews.llvm.org/D75284
Alex Zinenko [Thu, 18 Jun 2020 15:53:59 +0000 (17:53 +0200)]
[mlir] Update Toy tutorial to use callback-based loop constructors
We recently introduced support for building loops or loop nests using callbacks
that populate the body. Use these in the tutorial instead of setInsertionPoint
manipulations.
Differential Revision: https://reviews.llvm.org/D82104
Alex Zinenko [Thu, 18 Jun 2020 15:53:50 +0000 (17:53 +0200)]
[mlir] Refactor affine loop nest builders
Existing implementation of affine loop nest builders relies on EDSC
ScopedContext, which is not used pervasively. Provide a common OpBuilder-based
helper function to construct a perfect nest of affine loops with the body of
the innermost loop populated by a callback. Use this function to implement the
EDSC version.
Affine "for" loops differ from SCF "for" loops by (1) not allowing to yield
values and (2) supporting short-hand form for constant bounds, which justifies
a separate implementation of the loop nest builder for the same of simplicity.
Differential Revision: https://reviews.llvm.org/D81955
River Riddle [Thu, 18 Jun 2020 20:58:25 +0000 (13:58 -0700)]
[mlir] Allow for patterns to match any root kind.
Traditionally patterns have always had the root operation kind hardcoded to a specific operation name. This has worked well for quite some time, but it has certain limitations that make it undesirable. For example, some lowering have the same implementation for many different operations types with a few lowering entire dialects using the same pattern implementation. This problem has led to several "solutions":
a) Provide a template implementation to the user so that they can instantiate it for each operation combination, generally requiring the inclusion of the auto-generated operation definition file.
b) Use a non-templated pattern that allows for providing the name of the operation to match
- No one ever does this, because enumerating operation names can be cumbersome and so this quickly devolves into solution a.
This revision removes the restriction that patterns have a hardcoded root type, and allows for a class patterns that could match "any" operation type. The major downside of root-agnostic patterns is that they make certain pattern analyses more difficult, so it is still very highly encouraged that an operation specific pattern be used whenever possible.
Differential Revision: https://reviews.llvm.org/D82066
River Riddle [Thu, 18 Jun 2020 20:58:17 +0000 (13:58 -0700)]
[mlir] Refactor RewritePatternMatcher into a new PatternApplicator class.
This class enables for abstracting more of the details for the rewrite process, and will allow for clients to apply specific cost models to the pattern list. This allows for DialectConversion and the GreedyPatternRewriter to share the same underlying matcher implementation. This also simplifies the plumbing necessary to support dynamic patterns.
Differential Revision: https://reviews.llvm.org/D81985
Shuhong Liu [Thu, 18 Jun 2020 20:51:53 +0000 (16:51 -0400)]
[AIX] Split lit test shtest-format into two separate tests and add AIX as UNSUPPORTED for shtest-format-argv0
Summary: lit test `shtest-format.py` fails on AIX because one of the subtest of shtest-format requires the tool `[` to be installed under the system PATH. For AIX, `[` is only available as a shell builtin and does not present as an executable file under PATH. Hence, split the original shtest-format into two separate test files and added AIX as UNSUPPORTED for the test using `[` .
Reviewers: daltenty, hubert.reinterpretcast
Reviewed By: hubert.reinterpretcast
Subscribers: delcypher, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82100
aartbik [Thu, 18 Jun 2020 19:55:54 +0000 (12:55 -0700)]
[mlir] [integration-test] [LLVMIR] Add reduction intrinsic tests
Reviewers: ftynse, nicolasvasilache, reidtatge
Reviewed By: nicolasvasilache
Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, Kayjukh, jurahul, msifontes
Tags: #mlir
Differential Revision: https://reviews.llvm.org/D82117
Christopher Tetreault [Thu, 18 Jun 2020 19:57:08 +0000 (12:57 -0700)]
[SVE] Remove calls to VectorType::getNumElements from Transforms/Utils
Reviewers: efriedma, c-rhodes, david-arm, Tyker, asbirlea
Reviewed By: david-arm
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82057
Yaxun (Sam) Liu [Tue, 16 Jun 2020 18:52:03 +0000 (14:52 -0400)]
[HIP] Enable -amdgpu-internalize-symbols
Enable -amdgpu-internalize-symbols to eliminate unused functions and global variables
for whole program to speed up compilation and improve performance.
For -fno-gpu-rdc, -amdgpu-internalize-symbols is passed to clang -cc1.
For -fgpu-rdc, -amdgpu-internalize-symbols is passed to lld.
Differential Revision: https://reviews.llvm.org/D81959
Thomas Raoux [Thu, 18 Jun 2020 20:24:51 +0000 (13:24 -0700)]
[mlir][vulkan-runner] add support for memref of i8, i16 types in vulkan runner
This extends the types supported as kernel arguments when using vulkan runner.
Differential Revision: https://reviews.llvm.org/D82068
Alexandre Ganea [Thu, 18 Jun 2020 20:17:05 +0000 (16:17 -0400)]
[CodeView] Revert
8374bf43634725dc02a262a77b5f940fca25938c and
403f9537924b8910ed4f741ed96c61f5e657915b
This reverts:
8374bf43634725dc02a262a77b5f940fca25938c [CodeView] Fix generated command-line expansion in LF_BUILDINFO. Fix the 'pdb' entry which was previously a null reference, now an empty string.
403f9537924b8910ed4f741ed96c61f5e657915b [CodeView] Add full repro to LF_BUILDINFO record
This is causing the lld/test/COFF/pdb-relative-source-lines.test to fail: http://lab.llvm.org:8011/builders/lld-x86_64-win/builds/1096/steps/test-check-all/logs/FAIL%3A%20lld%3A%3Apdb-relative-source-lines.test
And clang/test/CodeGen/debug-info-codeview-buildinfo.c fails as well: http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/33346/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Adebug-info-codeview-buildinfo.c
Sam Clegg [Tue, 16 Jun 2020 19:23:25 +0000 (12:23 -0700)]
[lld][WebAssembly] Allow ctors functions that return values
Some projects use the constructor attribute on functions that also
return values. In this case we just ignore them.
The error was reported in the libgpg-error project that marks
gpg_err_init with the `__constructor__` attribute.
Differential Revision: https://reviews.llvm.org/D81962
Thomas Raoux [Thu, 18 Jun 2020 20:05:09 +0000 (13:05 -0700)]
[mlir][spirv] Allow mixed type cooperative matrix muladd
muladd can have differenti types for lhs/rhs and acc/destination. Change
verifier and update the test to use supported example.
Differential Revision: https://reviews.llvm.org/D82042
Jacques Pienaar [Thu, 18 Jun 2020 19:51:51 +0000 (12:51 -0700)]
[mlir][ods] Look through OpVariable for type constraint
If one uses an OpVariable (such as via Res) then the result type constraint
should be returned.
Differential Revision: https://reviews.llvm.org/D82119
Kirill Naumov [Sat, 6 Jun 2020 00:06:09 +0000 (00:06 +0000)]
[BasicBlock] Added AnnotationWriter functionality to BasicBlock class
This functionality is very similar to Function compatibility with
AnnotationWriter. This change allows us to use AnnotationWriter with
BasicBlock through BB.print() method.
Reviewed-By: apilipenko
Differntial Revision: https://reviews.llvm.org/D81321
Sanjay Patel [Thu, 18 Jun 2020 19:44:02 +0000 (15:44 -0400)]
[IRBuilder] add/use wrapper to create a generic compare based on predicate type; NFC
The predicate can always be used to distinguish between icmp and fcmp,
so we don't need to keep repeating this check in the callers.
Eric Christopher [Thu, 18 Jun 2020 19:36:34 +0000 (12:36 -0700)]
Add SveBFloat16 to type switch.
Matt Arsenault [Thu, 28 May 2020 15:33:15 +0000 (11:33 -0400)]
AMDGPU: Add IntrWillReturn to intrinsic definitions
This should probably be implied for all the speculatable ones. I think
the only ones where this plausibly doesn't apply is s_sendmsghalt and
maybe kill.
Davide Italiano [Thu, 18 Jun 2020 19:33:02 +0000 (12:33 -0700)]
[SimplifyCFG] Update debug location when folding branch to common destination
Sometimes a dead block gets folded and the debug information is still
retained. This manifests as jumpy stepping in lldb, see the bugzilla PR
for an end-to-end C testcase.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46008
Differential Revision: https://reviews.llvm.org/D82062
Eduardo Caldas [Thu, 18 Jun 2020 18:41:43 +0000 (20:41 +0200)]
Add support for DeclRefExpr in SyntaxTree, by generating IdExpressions
Reviewers: gribozavr2
Reviewed By: gribozavr2
Subscribers: hlopko, gribozavr2, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81168
Christopher Ferris [Thu, 18 Jun 2020 18:18:16 +0000 (11:18 -0700)]
[scudo][standalone] Allow Primary allocations to fail up multiple times.
Summary:
When enabling some malloc debug features on Android, multiple 32 bit
regions become exhausted, and the allocations fail. Allow allocations
to keep trying each bigger class in the Primary until it finds a fit.
In addition, some Android tests running on 32 bit fail sometimes due
to a running out of space in two regions, and then fail the allocation.
Reviewers: cryptoad
Reviewed By: cryptoad
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D82070
Michael Liao [Tue, 9 Jun 2020 19:07:08 +0000 (15:07 -0400)]
[TTI] Expose isNoopAddrSpaceCast in TTI.
Reviewers: arsenm
Subscribers: wdng, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82025
Louis Dionne [Thu, 18 Jun 2020 18:04:01 +0000 (14:04 -0400)]
[libc++] Add a dummy CMake file to include runtime subprojects
Add a simple CMakeLists.txt to build the runtimes in lockstep without
building all of LLVM. See [1] for details.
[1]: http://lists.llvm.org/pipermail/llvm-dev/2020-June/142384.html
peter klausler [Wed, 17 Jun 2020 23:56:28 +0000 (16:56 -0700)]
[flang] Fix build problems on osx
Summary:
Fix build problems encountered on osx in two files.
The one in character.cpp fixes a legitimate bug that
elicited a valid warning.
Reviewers: tskeith, PeteSteinfeld, sscalpone, jdoerfert, DavidTruby
Reviewed By: tskeith, PeteSteinfeld
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D82107
serge-sans-paille [Thu, 4 Jun 2020 21:35:25 +0000 (23:35 +0200)]
Fix return status of LoopDistribute
Move code that may update the IR after precondition, so that if precondition
fail, the IR isn't modified.
Differential Revision: https://reviews.llvm.org/D81225
Matt Arsenault [Thu, 28 May 2020 04:11:26 +0000 (00:11 -0400)]
AMDGPU: Remove mayLoad/mayStore from some side effecting intrinsics
These don't really modify any memory, and should not expect memory
operands.
Siva Chandra Reddy [Mon, 8 Jun 2020 18:11:49 +0000 (11:11 -0700)]
[libc] Add implementations long double fabsl and truncl functions.
Current implementations of single precision and double precision
floating point operations operate on bits of the integer type of
same size. The code made use of magic masks which were listed as
literal integer values. This is not possible in the case of long
double type as the mantissa of quad-precision long double type used
on non-x86 architectures is wider that the widest integer type for
which we can list literal values. So, in this patch, to avoid
using magic masks specified with literal values, we use packed
bit-field struct types and let the compiler generate the masks.
This new scheme allows us to implement long double flavors of the
various floating point operations. To keep the size of the patch
small, only the implementations of fabs and trunc have been
switched to the new scheme. In following patches, all exisiting
implementations will be switched to the new scheme.
Reviewers: asteinhauser
Differential Revision: https://reviews.llvm.org/D82036
aartbik [Thu, 18 Jun 2020 17:48:56 +0000 (10:48 -0700)]
[mlir] [VectorOps] remove print_i1 from runtime support library
Summary:
The "i1" (viz. bool) type does not have a proper equivalent on the "C"
size. So, to avoid any ABIs issues, we simply use print_i32 on an i32
value of one or zero for true and false. This has the added advantage
that one less function needs to be implemented when porting the runtime
support library.
Reviewers: ftynse, bkramer, nicolasvasilache
Reviewed By: ftynse
Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes
Tags: #mlir
Differential Revision: https://reviews.llvm.org/D82048
Martijn Vels [Thu, 18 Jun 2020 17:14:02 +0000 (13:14 -0400)]
Optimize 'construct at end' loops in vector
Summary:
This change adds local 'end' and 'pos' variables for the main loop inmstead of using the ConstructTransaction variables directly.
We observed that not all vector initialization and resize operations got properly vectorized, i.e., (partially) unrolled into XMM stores for floats.
For example, `vector<int32_t> v(n, 1)` gets vectorized, but `vector<float> v(n, 1)`. It looks like the compiler assumes the state is leaked / aliased in the latter case (unclear how/why for float, but not for int32), and because of this fails to see vectorization optimization?
See https://gcc.godbolt.org/z/UWhiie
By using a local `__new_end_` (fixed), and local `__pos` (copied into __tx.__pos_ per iteration), we offer the compiler a clean loop for unrolling.
A demonstration can be seen in the isolated logic in https://gcc.godbolt.org/z/KoCNWv
The com
Reviewers: EricWF, #libc!
Subscribers: libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D82111
Hanhan Wang [Mon, 15 Jun 2020 17:26:32 +0000 (10:26 -0700)]
[mlir] Add support for lowering tanh to LLVMIR.
Summary:
Fixed build of D81618
Add a pattern for expanding tanh op into exp form.
A `tanh` is expanded into:
1) 1-exp^{-2x} / 1+exp^{-2x}, if x => 0
2) exp^{2x}-1 / exp^{2x}+1 , if x < 0.
Differential Revision: https://reviews.llvm.org/D82040
Daniel Grumberg [Thu, 18 Jun 2020 17:10:08 +0000 (18:10 +0100)]
[NFC][TableGen] Fix some clang-tidy warnings
Alexey Bataev [Thu, 18 Jun 2020 17:29:33 +0000 (13:29 -0400)]
[OPENMP][DOCS]Update status of supported constructs, NFC.
Ties Stuij [Tue, 16 Jun 2020 16:45:57 +0000 (17:45 +0100)]
[ARM][bfloat] Do not coerce bfloat arguments and returns to integers
Summary:
As part of moving the argument lowering handling for bfloat arguments and
returns to the backend, this patch removes the code that was responsible for
handling the coercion of those arguments in Clang's Codegen.
Subscribers: kristof.beyls, danielkiss, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81837
Alexey Bataev [Wed, 17 Jun 2020 15:02:49 +0000 (11:02 -0400)]
[OPENMP]Fix PR46357: Do not allow types declarations in pragmas.
Summary:
Compiler may erroneously treat current context in OpenMP pragmas as the
context where new type declaration/definition is allowed. But the
declartation/definition of the new types in OpenMP pragmas should not be
allowed.
Reviewers: jdoerfert
Subscribers: yaxunl, guansong, sstefan1, cfe-commits, caomhin
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82019
Hiroshi Yamauchi [Wed, 17 Jun 2020 19:35:33 +0000 (12:35 -0700)]
[HIP] Improve check patterns to avoid test failures in case string "opt",
etc. happens to be in the InstallDir path in the -### output.
Differential Revision: https://reviews.llvm.org/D82046
Stanislav Mekhanoshin [Tue, 16 Jun 2020 22:15:15 +0000 (15:15 -0700)]
[AMDGPU] Added new encoding to getMCOpcodeGen
Nothing breaks yet, but all encodings shall be in the map.
Differential Revision: https://reviews.llvm.org/D81974
Alex Richardson [Thu, 18 Jun 2020 16:07:49 +0000 (17:07 +0100)]
[libc++] Don't override LIBCXX_CXX_ABI_INCLUDE_PATHS for libcxxrt
When testing libc++ for our cross-compiled CheriBSD target we specify an
explicit LIBCXX_CXX_ABI_INCLUDE_PATHS for libcxxrt. The hardcoded path
/usr/include/c++/v1 was introduced in
61e89737c5daf7b65341936f88f68efb680cdcd4
and overrides any value passed on the CMake command line. Fix this by using
it as a fallback rather than a fixed default value.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D82095
Alex Richardson [Thu, 18 Jun 2020 14:11:08 +0000 (15:11 +0100)]
[update_cc_test_checks.py] Handle C++ methods
Previously the script only handled C input, this change extends the JSON
parsing to to also include C++ function types such as methods, constructors
and destructors.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D80914
Alex Richardson [Thu, 18 Jun 2020 14:10:54 +0000 (15:10 +0100)]
[update_cc_test_checks.py] Correctly skip function definitions
Function declarations can in fact have an 'inner' node that lists the
ParmVarDecls. It seems like either the JSON output has changed or that I
tested the original JSON parsing change with test files that only have
function definitions without arguments.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D80913
Cullen Rhodes [Thu, 18 Jun 2020 16:42:22 +0000 (16:42 +0000)]
vim: add `bfloat` keyword
Highlight the `bfloat` type introduced in D78190.
Arthur Eubanks [Mon, 1 Jun 2020 20:32:15 +0000 (13:32 -0700)]
[GlobalOpt] Remove preallocated calls when possible
When possible (e.g. internal linkage), strip preallocated attribute off
parameters/arguments.
This requires removing the "preallocated" operand bundle from the call
site, replacing @llvm.call.preallocated.arg() with an alloca and a
bitcast to i8*, and removing the @llvm.call.preallocated.setup(). Since
@llvm.call.preallocated.arg() can be called multiple times with the same
arg index, we create an alloca per arg index.
We add a @llvm.stacksave() where the @llvm.call.preallocated.setup() was
and a @llvm.stackrestore() after the preallocated call to prevent the
stack from blowing up. This is valid because the argument would normally
not exist on the stack after the call before the transformation.
This does not currently handle all possible preallocated calls. We will
need to figure out where to put @llvm.stackrestore() in the cases where
there is no obvious place to put it, for example conditional
preallocated calls, invokes.
This sort of transformation may need to be moved to somewhere more
accessible to accomodate similar transformations (like inlining) in the
future.
Reviewers: efriedma, hans
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80951
Francesco Petrogalli [Mon, 15 Jun 2020 20:48:13 +0000 (20:48 +0000)]
[llvm][SveEmitter] Emit the bfloat version of `svld1ro`.
Summary:
The new SVE builtin type __SVBFloat16_t` is used to represent scalable
vectors of bfloat elements.
Reviewers: sdesmalen, efriedma, stuij, ctetreau, shafik, rengolin
Subscribers: tschuett, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81304
Roman Lebedev [Thu, 18 Jun 2020 16:29:23 +0000 (19:29 +0300)]
[NFC][IndVarSimplify] Test: replacing IV user with unsafe loop-invariant (PR45360)
https://bugs.llvm.org/show_bug.cgi?id=45360
This is reduced from the (runnable) test provided in the bug report.
The remainder operation is originally guarded, it never divides by zero.
Indvars should not make it execute unconditionally.
This is not a great test, running whole -O2 is fragile,
but i really don't understand why running -indvars on the IR before
that tranform happens doesn't work.
Alexey Bataev [Wed, 17 Jun 2020 16:52:37 +0000 (12:52 -0400)]
[OPENMP50]Allow nonmonotonic modifier for all schedule kinds.
Summary:
According to OpenMP 5.0, nonmonotonic modifier can be used with all
schedule kinds, not only dynamic and guided as in OpenMP 4.5.
Reviewers: jdoerfert
Subscribers: yaxunl, guansong, sstefan1, cfe-commits, caomhin
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82026
Tobias Bosch [Fri, 5 Jun 2020 23:19:23 +0000 (16:19 -0700)]
[Dexter] Add --source-dir-root flag
Summary:
This allows to run dexter tests with separately compiled
binaries that are specified via --binary if the source file
location changed between compilation and dexter test run.
Reviewers: TWeaver, jmorse, probinson, #debug-info
Reviewed By: jmorse
Subscribers: #debug-info, cmtice, llvm-commits
Tags: #llvm, #debug-info
Differential Revision: https://reviews.llvm.org/D81319
Alexandros Lamprineas [Thu, 18 Jun 2020 14:40:23 +0000 (15:40 +0100)]
[ARM] Basic bfloat support
This patch adds basic support for BFloat in the Arm backend.
For now the code generation relies on fullfp16 being present.
Briefly:
* adds the bfloat scalar and vector types in the necessary register classes,
* adjusts the calling convention to cope with bfloat argument passing and return,
* adds codegen patterns for moves, loads and stores.
It's tested mostly by the intrinsic patches that depend on it (load/store, convert/copy).
The following people contributed to this patch:
* Alexandros Lamprineas
* Ties Stuij
Differential Revision: https://reviews.llvm.org/D81373
Amara Emerson [Wed, 17 Jun 2020 18:13:22 +0000 (11:13 -0700)]
[docs] Clarify semantics of ordered fadd/fmul reductions.
Differential Revision: https://reviews.llvm.org/D82034