Louis Dionne [Tue, 17 Mar 2020 21:29:59 +0000 (17:29 -0400)]
Add some libc++ revisions to .git-blame-ignore-revs
Simon Pilgrim [Tue, 17 Mar 2020 21:20:57 +0000 (21:20 +0000)]
[TargetLowering] Only demand a rotation's modulo amount bits
ISD::ROTL/ROTR rotation values are guaranteed to act as a modulo amount, so for power-of-2 bitwidths we only need the lowest bits.
Differential Revision: https://reviews.llvm.org/D76201
Jon Chesterfield [Tue, 17 Mar 2020 21:22:04 +0000 (21:22 +0000)]
[Clang] Undef attribute for global variables
Summary:
[Clang] Attribute to allow defining undef global variables
Initializing global variables is very cheap on hosted implementations. The
C semantics of zero initializing globals work very well there. It is not
necessarily cheap on freestanding implementations. Where there is no loader
available, code must be emitted near the start point to write the appropriate
values into memory.
At present, external variables can be declared in C++ and definitions provided
in assembly (or IR) to achive this effect. This patch provides an attribute in
order to remove this reason for writing assembly for performance sensitive
freestanding implementations.
A close analogue in tree is LDS memory for amdgcn, where the kernel is
responsible for initializing the memory after it starts executing on the gpu.
Uninitalized variables in LDS are observably cheaper than zero initialized.
Patch is loosely based on the cuda __shared__ and opencl __local variable
implementation which also produces undef global variables.
Reviewers: kcc, rjmccall, rsmith, glider, vitalybuka, pcc, eugenis, vlad.tsyrklevich, jdoerfert, gregrodgers, jfb, aaron.ballman
Reviewed By: rjmccall, aaron.ballman
Subscribers: Anastasia, aaron.ballman, davidb, Quuxplusone, dexonsmith, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74361
Louis Dionne [Tue, 17 Mar 2020 20:49:56 +0000 (16:49 -0400)]
[lit] NFC: Fix typo in log statement
Aaron Ballman [Tue, 17 Mar 2020 20:32:43 +0000 (16:32 -0400)]
Don't call anyone lazy in the documentation.
Mikhail Dvorskiy [Tue, 17 Mar 2020 20:03:02 +0000 (16:03 -0400)]
[pstl] A hot fix for exclusive_scan (+ lost enable_if in declaration)
It fixes an ambiguity issue in case of a user has a custom policy and
calls a version of exclusive_scan with binary operation.
Differential Revision: https://reviews.llvm.org/D62719
Richard Smith [Tue, 17 Mar 2020 20:15:39 +0000 (13:15 -0700)]
PR45207: Fix crash if constrained-type-specifier annotation forms a
template_id annotation when parsing a type.
Florian Hahn [Tue, 17 Mar 2020 20:01:09 +0000 (20:01 +0000)]
[SCCP] Split up callsite handling, only propagate result on change (NFC)
Functions include their arguments in the use-list. Changed function
values mean that the result of the function changed. We only need
to update the call sites with the new function result and do not
have to propagate the call arguments.
To do so, this patch splits up the visitCallSite into handleCallResult
and handleCallArguments and updates markUsersAsChanged to only update
call results for functions.
Reviewers: efriedma, davide
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D75846
Paula Toth [Tue, 17 Mar 2020 19:59:21 +0000 (12:59 -0700)]
[libc] Resolve race condition in sub-process test runner.
Summary:
There seems to be a race condition between the pipe closing and the child process death. Likely these two events are not atomic on some versions of linux.
With the removal of `WNOHANG` we eliminate the race condition, however if the child closes the pipe intentionally then it could result in the test runner hanging. I find this situation less likely, where as I experience failures locally with this race condition rather consistently.
Reviewers: sivachandra, abrachet
Reviewed By: sivachandra, abrachet
Subscribers: MaskRay, jfb, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D76267
Fangrui Song [Tue, 17 Mar 2020 19:51:21 +0000 (12:51 -0700)]
[ELF][test] Delete unneeded --no-threads
Atmn Patel [Tue, 17 Mar 2020 19:52:36 +0000 (15:52 -0400)]
[libc++] Bugfix to std::binomial_distribution<int>
The current implementation of binomial_distribution is not guaranteed to
converge for certain extreme configurations of the engine and distribution.
This is due to a mistake in the implementation of the algorithm from the
given reference paper. The algorithm in the paper is guaranteed to
terminate but has redundant statements. The current implementation
simplified away the redundancy into a while loop, but it excludes the
return condition of the case where a good sample cannot be returned for
the particular sample being used from the uniform distribution, which is
what causes the infinite loop. This change guarantees termination by
recognizing that a good sample cannot be returned and returning 0 after
breaking the loop. This is also in contrast to the paper because the
return value as specified in the paper violates basic checks in at least
a subset of the extreme cases where the current implementation fails to
terminate. This default return value of 0 is satisfactory for the
extreme case known so far.
Since this is only meant to affect extreme cases where the algorithm
does not terminate anyways, the behavior is expected to remain exactly
the same for all non-extreme cases that have been terminating so far.
Fixes https://llvm.org/PR44847
Differential Revision: https://reviews.llvm.org/D74997
Vedant Kumar [Tue, 17 Mar 2020 01:11:36 +0000 (18:11 -0700)]
[DwarfDebug] Fix an assertion error when emitting call site info that combines two DW_OP_stack_values
When compiling
```
struct S {
float w;
};
void f(long w, long b);
void g(struct S s) {
int w = s.w;
f(w, w*4);
}
```
I get Assertion failed: ((!CombinedExpr || CombinedExpr->isValid()) && "Combined debug expression is invalid").
That's because we combine two epxressions that both end in DW_OP_stack_value:
```
(lldb) p Expr->dump()
!DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)
(lldb) p Param.Expr->dump()
!DIExpression(DW_OP_constu, 4, DW_OP_mul, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)
(lldb) p CombinedExpr->isValid()
(bool) $0 = false
(lldb) p CombinedExpr->dump()
!DIExpression(4097, 32, 5, 4097, 64, 5, 16, 4, 30, 4097, 32, 5, 4097, 64, 5, 159, 159)
```
I believe that in this particular case combining two stack values is
safe, but I didn't want to sink the special handling into
DIExpression::append() because I do want everyone to think about what
they are doing.
Patch by Adrian Prantl.
Fixes PR45181.
rdar://problem/
60383095
Differential Revision: https://reviews.llvm.org/D76164
LLVM GN Syncbot [Tue, 17 Mar 2020 19:45:39 +0000 (19:45 +0000)]
[gn build] Port
080dd10f7df
Scott Constable [Tue, 17 Mar 2020 18:45:11 +0000 (11:45 -0700)]
Move RDF from Hexagon to Codegen
RDF is designed to be target agnostic. Therefore it would be useful to have it available for other targets, such as X86.
Based on a previous patch by Krzysztof Parzyszek
Differential Revision: https://reviews.llvm.org/D75932
Louis Dionne [Tue, 17 Mar 2020 19:40:31 +0000 (15:40 -0400)]
[libc++] Use env to set the tool's environment on Darwin
Siva Chandra Reddy [Tue, 17 Mar 2020 06:40:57 +0000 (23:40 -0700)]
[libc] Add a new rule `add_object`.
This rule can help add targets to generate special object files like the
crt1.o on linux. Also, it can be used to add specially compiled object
stubs which are to be linked into the entrypoint objects.
Reviewers: abrachet
Differential Revision: https://reviews.llvm.org/D76271
Erich Keane [Tue, 17 Mar 2020 15:23:45 +0000 (08:23 -0700)]
[NFC][Attr TableGen] Emit Spelling Enum for Attr types if there >1
Discovered in a downstream, it is often useful to have slightly
different semantics for an attribute based on its namespace, however our
spelling infrastructure doesn't consider namespace when deciding to
elide the enum list. The result is that the solution for a case where
an attribute has slightly different semantics based on a namespace
requires checking against the integer value, which is fragile.
This patch makes us always emit the spelling enum if there is more than
1 and we're generating the header.
Differential Revision: https://reviews.llvm.org/D76289
Sanjay Patel [Tue, 17 Mar 2020 19:06:39 +0000 (15:06 -0400)]
[InstCombine] reduce demand-limited bool math to logic, part 2
Follow-on suggested in:
D75961
Sanjay Patel [Tue, 17 Mar 2020 19:03:13 +0000 (15:03 -0400)]
[InstCombine] add tests for bool math; NFC
River Riddle [Tue, 17 Mar 2020 19:09:14 +0000 (12:09 -0700)]
[mlir] Add a hook to PatternRewriter to allow for patterns to notify why a match failed.
Summary:
This revision adds a new hook, `notifyMatchFailure`, that allows for notifying the rewriter that a match failure is coming with the provided reason. This hook takes as a parameter a callback that fills a `Diagnostic` instance with the reason why the match failed. This allows for the rewriter to decide how this information can be displayed to the end-user, and may completely ignore it if desired(opt mode). For now, DialectConversion is updated to include this information in the debug output.
Differential Revision: https://reviews.llvm.org/D76203
Huihui Zhang [Tue, 17 Mar 2020 18:31:19 +0000 (11:31 -0700)]
[ValueTracking][SVE] Fix isGEPKnownNonNull for scalable vector.
Summary:
DataLayout::getTypeAllocSize() return TypeSize. For cases where the
scalable property doesn't matter, we should explicitly call getKnownMinSize()
to avoid implicit type conversion to uint64_t, which is not valid for scalable
vector type.
Reviewers: sdesmalen, efriedma, apazos, reames
Reviewed By: efriedma
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76260
Alexey Bataev [Tue, 17 Mar 2020 16:10:51 +0000 (12:10 -0400)]
[OPENMP50]Mark expression in detach clause as firstprivate.
According to the standard, The event-handle will be considered as if it was specified on a firstprivate clause.
Craig Topper [Tue, 17 Mar 2020 18:02:25 +0000 (11:02 -0700)]
[SelectionDAGBuilder] Don't set MachinePointerInfo for gather when we find a uniform base
I believe we were previously calculating a pointer info with the scalar base and an offset of 0. But that's not really where the gather is pointing. The offset is a function of the indices of the GEP we looked through.
Also set the size of the MachineMemOperand to UnknownSize
Differential Revision: https://reviews.llvm.org/D76157
shafik [Tue, 17 Mar 2020 17:55:53 +0000 (10:55 -0700)]
[lldb] Remove template parameters from FunctionTemplateDecl names
Fix to get the AST we generate for function templates closer to what clang generates and expects.
We fix which FuntionDecl we are passing to CreateFunctionTemplateSpecializationInfo and we strip
template parameters from the name when creating the FunctionDecl and FunctionTemplateDecl.
These two fixes together fix asserts and ambiguous lookup issues for several cases which are added to the already existing small function template test.
This fixes issues with overloads, overloads and ADL, variadic function templates and templated operator overloads.
Differential Revision: https://reviews.llvm.org/D75761
Dimitry Andric [Fri, 13 Mar 2020 18:36:26 +0000 (19:36 +0100)]
Fix -Wdeprecated-copy-dtor and -Wdeprecated-dynamic-exception-spec warnings.
Summary:
The former are like:
libcxx/include/typeinfo:322:11: warning: definition of implicit copy constructor for 'bad_cast' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor]
virtual ~bad_cast() _NOEXCEPT;
^
libcxx/include/typeinfo:344:11: note: in implicit copy constructor for 'std::bad_cast' first required here
throw bad_cast();
^
Fix these by adding an explicitly defaulted copy constructor.
The latter are like:
libcxx/include/codecvt:105:37: warning: dynamic exception specifications are deprecated [-Wdeprecated-dynamic-exception-spec]
virtual int do_encoding() const throw();
^~~~~~~
Fix these by using the _NOEXCEPT macro instead.
Reviewers: EricWF, mclow.lists, ldionne, #libc
Reviewed By: EricWF, #libc
Subscribers: dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D76150
Nick Desaulniers [Tue, 17 Mar 2020 17:51:21 +0000 (10:51 -0700)]
[clang][AArch64] readd support for 'p' inline asm constraint
Summary:
Was accidentally removed by commit
af64948e2a05 when it overrode
TargetInfo::convertConstraint.
Fixes: pr/45225
Reviewers: eli.friedman, sdesmalen
Reviewed By: sdesmalen
Subscribers: echristo, sdesmalen, kristof.beyls, cfe-commits, kmclaughlin, srhines
Tags: #clang
Differential Revision: https://reviews.llvm.org/D76297
Jin Lin [Tue, 17 Mar 2020 17:03:27 +0000 (10:03 -0700)]
Revert "Support repeated machine outlining"
This reverts commit
1f93b162fc6bed2e7763ac6c35cf51741014400e.
Sagar Jain [Tue, 17 Mar 2020 16:43:21 +0000 (17:43 +0100)]
[MLIR] Added llvm.fence
This patch adds llvm.fence. I tried not to change the syntax much.
syntax:
LLVM IR
`fence [syncscope("<target-scope>")] <ordering>`
MLIR LLVM Dialect
`llvm.fence [syncscope("<target-scope>")] <ordering>`
example:
LLVM IR: `fence syncscope("agent") seq_cst`
MLIR: `llvm.fence syncscope("agent") seq_cst`
Differential Revision: https://reviews.llvm.org/D75645
Sebastian Neubauer [Mon, 16 Mar 2020 13:33:32 +0000 (14:33 +0100)]
[AMDGPU] Fix whole wavefront mode
We cannot move wwm over exec copies because the exec register needs an exact exec mask.
Differential Revision: https://reviews.llvm.org/D76232
Jin Lin [Tue, 17 Mar 2020 04:26:32 +0000 (21:26 -0700)]
Support repeated machine outlining
Summary: The following change is to allow the machine outlining can be applied for Nth times, where N is specified by the compiler option. By default the value of N is 1. The motivation is that the repeated machine outlining can further reduce code size. Please refer to the presentation "Improving Swift Binary Size via Link Time Optimization" in LLVM Developers' Meeting in 2019.
Reviewers: aschwaighofer, tellenbach, paquette
Reviewed By: paquette
Subscribers: tellenbach, hiraditya, llvm-commits, jinlin
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71027
Yaxun (Sam) Liu [Tue, 17 Mar 2020 00:39:07 +0000 (20:39 -0400)]
[NFC] Add UsedDeclVisitor
Differential Revision: https://reviews.llvm.org/D76262
Sam McCall [Thu, 5 Mar 2020 16:44:28 +0000 (17:44 +0100)]
[clangd] Only minimally escape text when rendering to markdown.
Summary:
Conservatively escaping everything is bad in coc.nvim which shows the markdown
to the user, and we have reports of it causing problems for other parsers.
Fixes https://github.com/clangd/clangd/issues/301
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75687
Simon Pilgrim [Tue, 17 Mar 2020 15:22:44 +0000 (15:22 +0000)]
[DAGCombiner] matchRotateSub - handle shift amount truncation
Under certain circumstances we'll end up in the position where the negated shift amount will get truncated to the type specified getScalarShiftAmountTy(), so we need to test for a truncated version of the shift amount as well.
This allows us to remove half of the remaining patterns tested for by X86ISelLowering's combineOrShiftToFunnelShift.
Simon Pilgrim [Tue, 17 Mar 2020 15:20:09 +0000 (15:20 +0000)]
[Verifier] Silence static analyzer null dereference warning (PR45118)
As discussed on PR45118, getInlinedAtScope() shouldn't ever return null. So we can simplify the logic to an assertion and remove all other null tests.
Kang Zhang [Tue, 17 Mar 2020 15:52:44 +0000 (15:52 +0000)]
[NFC][PowerPC] Add 2 test cases to early-ret.mir to test BLR and BCCLR
Sergej Jaskiewicz [Tue, 17 Mar 2020 15:43:22 +0000 (18:43 +0300)]
[docs] Remove outdated note about migration to Git
Reviewers: probinson, jyknight
Reviewed By: probinson
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76074
Yaxun (Sam) Liu [Thu, 12 Mar 2020 02:48:12 +0000 (22:48 -0400)]
[HIP] Let clang recognize .hip extension
Differential Revision: https://reviews.llvm.org/D76039
Matt Arsenault [Sat, 8 Feb 2020 00:10:02 +0000 (19:10 -0500)]
AMDGPU/GlobalISel: Fix asserting on gather4 intrinsics
Guillaume Chatelet [Tue, 17 Mar 2020 10:26:07 +0000 (11:26 +0100)]
[Alignment] Add alignTo with skew parameter
Summary: courbet
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76274
Tyker [Tue, 17 Mar 2020 10:28:10 +0000 (11:28 +0100)]
[AssumeBundles] Detection of Empty bundles
Summary: Prevent InstCombine from removing llvm.assume for which the arguement is true when they have operand bundles with usefull information.
Reviewers: jdoerfert, nikic, lebedev.ri
Reviewed By: jdoerfert
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76147
alex-t [Mon, 16 Mar 2020 12:29:29 +0000 (15:29 +0300)]
[AMDGPU] Enable SEXT divergence driven selection.
Summary: This change enable the divergence driven selection for the SEXT DAG opcode.
Reviewers: vpykhtin, rampitec
Reviewed By: vpykhtin
Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Differential Revision: https://reviews.llvm.org/D76230
Alex Zinenko [Tue, 17 Mar 2020 14:06:41 +0000 (15:06 +0100)]
[mlir] LLVM dialect: move ensureDistinctSuccessors out of std->LLVM conversion
MLIR supports terminators that have the same successor block with different
block operands, which cannot be expressed in the LLVM's phi-notation as the
block identifier is used to tell apart the predecessors. This limitation can be
worked around by branching to a new block instead, with this new block
unconditionally branching to the original successor and forwarding the
argument. Until now, this transformation was performed during the conversion
from the Standard to the LLVM dialect. This does not scale well to multiple
dialects targeting the LLVM dialect as all of them would have to be aware of
this limitation and perform the preparatory transformation. Instead, do it as a
separate pass and run it immediately before the translation.
Differential Revision: https://reviews.llvm.org/D75619
Florian Hahn [Tue, 17 Mar 2020 14:14:51 +0000 (14:14 +0000)]
[ValueLattice] Clarify that constant state can reached from undef.
As suggested as post-commit comment in D75845.
Simon Atanasyan [Tue, 17 Mar 2020 11:12:52 +0000 (14:12 +0300)]
[MIPS] Implement MIPS3D vector instructions
Patch by Michael Roe.
Differential Revision: https://reviews.llvm.org/D76247
Benjamin Kramer [Tue, 17 Mar 2020 14:16:44 +0000 (15:16 +0100)]
Purge unused diagnostics. NFC.
Matt Arsenault [Thu, 6 Feb 2020 14:52:08 +0000 (09:52 -0500)]
AMDGPU/GlobalISel: Fully handle 0 dmask case during legalize
For normal loads, fully eliminate the load. For the TFE case, adjust
the dmask value in the instruction so the selector doesn't need to
handle it. For the TFE special case, I guess it would be possible to
replace the loaded data register with undef, but as-is this will start
treating it as a well defined value.
Matt Arsenault [Tue, 28 Jan 2020 14:05:11 +0000 (09:05 -0500)]
AMDGPU/GlobalISel: Adjust image load register type based on dmask
Trim elements that won't be written. The equivalent still needs to be
done for writes. Also start widening 3 elements to 4
elements. Selection will get the count from the dmask.
Matt Arsenault [Mon, 27 Jan 2020 01:02:51 +0000 (20:02 -0500)]
AMDGPU/GlobalISel: Legalize non-a16 non-NSA images
Matt Arsenault [Sun, 26 Jan 2020 19:39:56 +0000 (14:39 -0500)]
AMDGPU/GlobalISel: Legalize a16 images
Pack the address registers in the legalizer. Avoid introducing a huge
family of new intermediate operations by filling dead operands with
noreg.
Alexey Bataev [Tue, 17 Mar 2020 13:17:42 +0000 (09:17 -0400)]
[OPENMP50]Initial support for detach clause in task directive.
Added parsing/sema/serialization support for detach clause.
Sven van Haastregt [Tue, 17 Mar 2020 13:15:32 +0000 (13:15 +0000)]
[OpenCL] Add pipe and kernel enqueuing builtins
This excludes some builtins that take argument types not yet handled
by the `-fdeclare-opencl-builtins` machinery, and also excludes
builtins that are already defined in `Builtins.def`.
Raphael Isemann [Tue, 17 Mar 2020 13:11:35 +0000 (14:11 +0100)]
[lldb] Tighten checks in TestStats.py
Just adding trailing newlines that "...: 1" doesn't match "...: 10".
LLVM GN Syncbot [Tue, 17 Mar 2020 13:01:49 +0000 (13:01 +0000)]
[gn build] Port
ac1d23ed7de
serge-sans-paille [Tue, 3 Mar 2020 23:47:43 +0000 (00:47 +0100)]
Replace MCTargetOptionsCommandFlags.inc and CommandFlags.inc by runtime registration
MCTargetOptionsCommandFlags.inc and CommandFlags.inc are headers which contain
cl::opt with static storage.
These headers are meant to be incuded by tools to make it easier to parametrize
codegen/mc.
However, these headers are also included in at least two libraries: lldCommon
and handle-llvm. As a result, when creating DYLIB, clang-cpp holds a reference
to the options, and lldCommon holds another reference. Linking the two in a
single executable, as zig does[0], results in a double registration.
This patch explores an other approach: the .inc files are moved to regular
files, and the registration happens on-demand through static declaration of
options in the constructor of a static object.
[0] https://bugzilla.redhat.com/show_bug.cgi?id=1756977#c5
Differential Revision: https://reviews.llvm.org/D75579
Richard Sandiford [Tue, 3 Mar 2020 11:20:57 +0000 (11:20 +0000)]
[Sema][SVE] Reject "delete" with sizeless types
Sizeless types can't be used with "new", so it doesn't make sense
to use them with "delete" either. The SVE ACLE therefore doesn't
allow that.
This is slightly stronger than for normal incomplete types, since:
struct S;
void f(S *s) { delete s; }
is (by necessity) just a default-on warning rather than an error.
Differential Revision: https://reviews.llvm.org/D76219
Gabor Marton [Tue, 17 Mar 2020 12:17:07 +0000 (13:17 +0100)]
[analyzer] StdLibraryFunctionsChecker refactor w/ inheritance
Summary:
Currently, ValueRange is very hard to extend with new kind of constraints.
For instance, it forcibly encapsulates relations between arguments and the
return value (ComparesToArgument) besides handling the regular value
ranges (OutOfRange, WithinRange).
ValueRange in this form is not suitable to add new constraints on
arguments like "not-null".
This refactor introduces a new base class ValueConstraint with an
abstract apply function. Descendants must override this. There are 2
descendants: RangeConstraint and ComparisonConstraint. In the following
patches I am planning to add the NotNullConstraint, and additional
virtual functions like `negate()` and `warning()`.
Reviewers: NoQ, Szelethus, balazske, gamesh411, baloghadamsoftware, steakhal
Subscribers: whisperity, xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, Charusso, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74973
Richard Sandiford [Tue, 3 Mar 2020 11:14:57 +0000 (11:14 +0000)]
[Sema][SVE] Reject "new" with sizeless types
new-expressions for a type T require sizeof(T) to be computable,
so the SVE ACLE does not allow them for sizeless types. At the moment:
auto f() { return new __SVInt8_t; }
creates a call to operator new with a zero size:
%call = call noalias nonnull i8* @_Znwm(i64 0)
This patch reports an appropriate error instead.
Differential Revision: https://reviews.llvm.org/D76218
Raphael Isemann [Tue, 17 Mar 2020 11:57:32 +0000 (12:57 +0100)]
[lldb] Ptrs->refs in CommandObjectExpression::EvaluateExpression parameters
The error_stream and result parameter were inconsistently checked for
being null, so we might as well make them references instead of crashing
in case someone passes a nullptr and hits one of the code paths that are
currently not doing a nullptr check on those parameters. Also change
output_stream for consistency.
Ayke van Laethem [Sat, 14 Mar 2020 17:55:13 +0000 (18:55 +0100)]
[AVR] Add support for the -mdouble=x flag
This flag is used by avr-gcc (starting with v10) to set the width of the
double type. The double type is by default interpreted as a 32-bit
floating point number in avr-gcc instead of a 64-bit floating point
number as is common on other architectures. Starting with GCC 10, a new
option has been added to control this behavior:
https://gcc.gnu.org/wiki/avr-gcc#Deviations_from_the_Standard
This commit keeps the default double at 32 bits but adds support for the
-mdouble flag (-mdouble=32 and -mdouble=64) to control this behavior.
Differential Revision: https://reviews.llvm.org/D76181
Ayke van Laethem [Fri, 7 Feb 2020 21:39:56 +0000 (22:39 +0100)]
[LLDB] Add support for AVR breakpoints
I believe the actual opcode does not matter because the AVR architecture
is a Harvard architecture that does not support writing to program
memory. Therefore, debuggers and emulators provide hardware breakpoints.
But for some reason, this opcode must be defined or else LLDB will crash
with an assertion error.
Differential Revision: https://reviews.llvm.org/D74255
Florian Hahn [Fri, 13 Mar 2020 21:30:28 +0000 (21:30 +0000)]
[SCCP] Explicitly mark values as overdefined (NFC).
This was part of D60582 but can be committed separately.
John Brawn [Thu, 5 Mar 2020 17:18:47 +0000 (17:18 +0000)]
[StackProtector] Catch direct out-of-bounds when checking address-takenness
With -fstack-protector-strong we check if a non-array variable has its address
taken in a way that could cause a potential out-of-bounds access. However what
we don't catch is when the address is directly used to create an out-of-bounds
memory access.
Fix this by examining the offsets of GEPs that are ultimately derived from
allocas and checking if the resulting address is out-of-bounds, and by checking
that any memory operations using such addresses are not over-large.
Fixes PR43478.
Differential revision: https://reviews.llvm.org/D75695
Richard Sandiford [Tue, 3 Mar 2020 11:06:58 +0000 (11:06 +0000)]
[Sema][SVE] Don't allow sizeless types to be caught
In the current SVE ACLE spec, the usual rules for throwing and
catching incomplete types also apply to sizeless types. However,
throwing pointers to sizeless types should not pose any real difficulty,
so as an extension, the clang implementation allows that.
This patch enforces these rules for catch statements.
Differential Revision: https://reviews.llvm.org/D76090
Denis Khalikov [Tue, 17 Mar 2020 11:49:00 +0000 (07:49 -0400)]
[mlir][vulkan-runner] Use C-compatible wrapper emission.
A memref argument is converted into a pointer-to-struct argument
of type `{T*, T*, i64, i64[N], i64[N]}*` in the wrapper function,
where T is the converted element type and N is the memref rank.
Differential Revision: https://reviews.llvm.org/D76059
Richard Sandiford [Tue, 3 Mar 2020 10:45:45 +0000 (10:45 +0000)]
[Sema][SVE] Don't allow sizeless objects to be thrown
Summary:
The same rules for throwing and catching incomplete types also apply
to sizeless types. This patch enforces that for throw statements.
It also make sure that we use "sizeless type" rather "incomplete type"
in the associated message. (Both are correct, but "sizeless type" is
more specific and hopefully more user-friendly.)
The SVE ACLE simply extends the rule for incomplete types to
sizeless types. However, throwing pointers to sizeless types
should not pose any real difficulty, so as an extension,
the clang implementation allows that.
Reviewers: sdesmalen, efriedma, rovka, rjmccall
Subscribers: tschuett, rkruppe, psnobl, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D76088
Raphael Isemann [Tue, 17 Mar 2020 11:45:22 +0000 (12:45 +0100)]
[lldb] Add test for importing ObjC modules in a non-ObjC target
This was previously crashing due to a missing nullptr check (see
e2d8aa6bf774ef29e134c40f886c55557bb5f970 ). This just adds a test that should
make sure this doesn't crash in case a user ends up in this strange setup.
Richard Sandiford [Tue, 3 Mar 2020 10:39:57 +0000 (10:39 +0000)]
[Sema][SVE] Reject sizeless types in exception specs
In the current SVE ACLE spec, the usual rules for throwing and
catching incomplete types also apply to sizeless types. However,
throwing pointers to sizeless types should not pose any real difficulty,
so as an extension, the clang implementation allows that.
This patch enforces these rules for explicit exception specs.
Differential Revision: https://reviews.llvm.org/D76087
Richard Sandiford [Thu, 27 Feb 2020 10:41:42 +0000 (10:41 +0000)]
[Sema][SVE] Reject arithmetic on pointers to sizeless types
This patch completes a trio of changes related to arrays of
sizeless types. It rejects various forms of arithmetic on
pointers to sizeless types, in the same way as for other
incomplete types.
Differential Revision: https://reviews.llvm.org/D76086
Richard Sandiford [Thu, 27 Feb 2020 11:01:02 +0000 (11:01 +0000)]
[Sema][SVE] Reject subscripts on pointers to sizeless types
clang currently accepts:
__SVInt8_t &foo1(__SVInt8_t *x) { return *x; }
__SVInt8_t &foo2(__SVInt8_t *x) { return x[1]; }
The first function is valid ACLE code and generates correct LLVM IR
(and assembly code). But the second function is invalid for the
same reason that arrays of sizeless types are. Trying to code-generate
the function leads to:
llvm/include/llvm/Support/TypeSize.h:126: uint64_t llvm::TypeSize::getFixedSize() const: Assertion `!IsScalable && "Request for a fixed size on a s
calable object"' failed.
Another problem is that:
template<typename T>
constexpr __SIZE_TYPE__ f(T *x) { return &x[1] - x; }
typedef int arr1[f((int *)0) - 1];
typedef int arr2[f((__SVInt8_t *)0) - 1];
produces:
a.cpp:2:48: warning: subtraction of pointers to type '__SVInt8_t' of zero size has undefined behavior [-Wpointer-arith]
constexpr __SIZE_TYPE__ f(T *x) { return &x[1] - x; }
~~~~~ ^ ~
a.cpp:4:18: note: in instantiation of function template specialization 'f<__SVInt8_t>' requested here
typedef int arr2[f((__SVInt8_t *)0) - 1];
This patch reports an appropriate diagnostic instead.
Differential Revision: https://reviews.llvm.org/D76084
Georgii Rymar [Tue, 3 Mar 2020 07:54:55 +0000 (10:54 +0300)]
[yaml2obj] - Add `ELFYAML::YAMLIntUInt` to fix how we parse a relocation `Addend` key.
This patch makes `Relocation::Addend` to be `ELFYAML::YAMLIntUInt` and not `int64_t`.
`ELFYAML::YAMLIntUInt` it is a new type and it has the following benefits/features:
1) For an 64-bit object any hex/decimal addends
in the range [INT64_MIN, UINT64_MAX] is accepted.
2) For an 32-bit object any hex/decimal addends
in range [INT32_MIN, UINT32_MAX] is accepted.
3) Negative hex numbers like -0xffffffff are not accepted.
4) It is printed as decimal. I.e. obj2yaml will print
something like "Addend: 125", this matches the current behavior.
This fixes all FIXMEs in `relocation-addend.yaml`.
Differential revision: https://reviews.llvm.org/D75527
Kerry McLaughlin [Tue, 17 Mar 2020 10:27:29 +0000 (10:27 +0000)]
[SVE][Inline-Asm] Add constraints for SVE ACLE types
Summary:
Adds the constraints described below to ensure that we
can tie variables of SVE ACLE types to operands in inline-asm:
- y: SVE registers Z0-Z7
- Upl: One of the low eight SVE predicate registers (P0-P7)
- Upa: Full range of SVE predicate registers (P0-P15)
Reviewers: sdesmalen, huntergr, rovka, cameron.mcinally, efriedma, rengolin
Reviewed By: efriedma
Subscribers: miyuki, tschuett, rkruppe, psnobl, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75690
Michał Górny [Tue, 17 Mar 2020 10:41:33 +0000 (11:41 +0100)]
[lldb] [Host/NetBSD] Rename Host.cpp to HostNetBSD.cpp
Rename NetBSD-specific Host.cpp to HostNetBSD.cpp to avoid basename
conflict with common/Host.cpp.
Kazushi (Jam) Marukawa [Tue, 17 Mar 2020 10:32:33 +0000 (11:32 +0100)]
[VE] Move VEInstPrinter.cpp and VEInstPrinter.h into MCTargetDesc
Summary:
Move them into MCTargetDesc to follow other architectures (a263aa2).
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D76270
Georgii Rymar [Mon, 16 Mar 2020 12:12:33 +0000 (15:12 +0300)]
[yaml2obj][test] - Ensure that dynamic section has sh_entsize correctly set.
This updates the existent test because it lacks coverage.
Differential revision: https://reviews.llvm.org/D76226
Adrian Kuegel [Tue, 17 Mar 2020 09:30:15 +0000 (10:30 +0100)]
Fix memtag test.
Summary: Matching %x makes the test fail.
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D76272
QingShan Zhang [Tue, 17 Mar 2020 10:02:23 +0000 (10:02 +0000)]
[PowerPC] Fix a typo of the condition of checking the fusion candidate
Georgii Rymar [Mon, 16 Mar 2020 09:14:05 +0000 (12:14 +0300)]
[obj2yaml][test] - Remove excessive missing_symtab.test test.
This test uses a precompiled object and duplicates
the functionality of a modern elf-no-symtab.yaml test that
uses yaml2obj for producing inputs.
Differential revision: https://reviews.llvm.org/D76217
Georgii Rymar [Sun, 15 Mar 2020 13:26:56 +0000 (16:26 +0300)]
[llvm-readobj][test] - Remove unused Offset key from reloc-types-*.test tests
This is a follow-up for D75608.
The `Offset` property is unused and can be removed to reduce tests.
This patch does nothing with `reloc-types-elf-i386.test` which has a different
structure and kind of tests the `Offset`. I think we might want to split it probably.
Differential revision: https://reviews.llvm.org/D76195
Haojian Wu [Tue, 17 Mar 2020 08:48:35 +0000 (09:48 +0100)]
Fix the buildbot error.
LLVM GN Syncbot [Tue, 17 Mar 2020 08:24:39 +0000 (08:24 +0000)]
[gn build] Port
876bb86e26c
Haojian Wu [Tue, 17 Mar 2020 07:33:37 +0000 (08:33 +0100)]
[AST] Move dependence computations into a separate file
To group the code in one place, simplify it and make it easier to add
the containsErrors bit and find existing bugs.
Reviewers: sammccall
Reviewed By: sammccall
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73638
Roman Lebedev [Thu, 12 Mar 2020 19:45:11 +0000 (22:45 +0300)]
[NFC] LoopRotate: do issue debug message when not rotating due to instr count
It is somewhat problematic to notice this issue otherwise.
Vitaly Buka [Tue, 17 Mar 2020 05:51:48 +0000 (22:51 -0700)]
[lld] Fix "loop variable creates a copy" warning
Jason Molenda [Tue, 17 Mar 2020 04:54:15 +0000 (21:54 -0700)]
Remove the old SecTaskAccess entry from debugserver's plist
<rdar://problem/
60230324>
Stefanos Baziotis [Tue, 17 Mar 2020 04:34:02 +0000 (06:34 +0200)]
[LoopTerminology] Minor fixes in loop rotation
QingShan Zhang [Tue, 17 Mar 2020 03:47:39 +0000 (03:47 +0000)]
[NFC][PowerPC] Simplify the logic in lower select_cc
The logic in select_cc is messy and hard to follow. This is a NFC patch to simplify the logic.
Differential Revision: https://reviews.llvm.org/D75834
Serguei Katkov [Mon, 16 Mar 2020 07:15:28 +0000 (14:15 +0700)]
[InstCombine] Transform to undef incorrect atomic unordered mem intrinsics
According to LangRef:
If len is not a positive integer multiple of element_size, then the behaviour of the intrinsic is undefined.
Add InstCombine rule to transform intrinsic to undef operation.
This is a follow-up for D76116.
Reviewers: reames
Reviewed By: reames
Subscribers: hiraditya, jfb, dantrushin, llvm-commits
Differential Revision: https://reviews.llvm.org/D76215
Chen Zheng [Tue, 17 Mar 2020 02:58:55 +0000 (22:58 -0400)]
[PowerPC] add test cases for target hook isProfitableToHoist - NFC
Uday Bondhugula [Mon, 10 Feb 2020 03:22:11 +0000 (08:52 +0530)]
Affine expr simplification for add of const multiple of same expression
- Detect "c_1 * expr + c_2 * expr" as (c_1 + c_2) * expr
- subsumes things like 'expr - expr' and "expr * -1 + expr" as 0.
- change AffineConstantExpr ctor to allow default null init
Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D76233
Vitaly Buka [Tue, 17 Mar 2020 02:45:36 +0000 (19:45 -0700)]
Fix unused function warning
Vitaly Buka [Tue, 17 Mar 2020 02:11:56 +0000 (19:11 -0700)]
[sanitizer] Fix warning on windows
Return value is not used anyway as PTHREAD_JOIN is not implemented.
Michael Liao [Tue, 17 Mar 2020 02:04:08 +0000 (22:04 -0400)]
Fix `-Wpedantic` warning. NFC.
Shengchen Kan [Fri, 13 Mar 2020 03:58:00 +0000 (11:58 +0800)]
[X86] Disable nop padding before instruction following hardcode
Reviewers: reames, MaskRay, craig.topper, LuoYuanke, jyknight
Reviewed By: LuoYuanke
Subscribers: annita.zhang, llvm-commits, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76176
River Riddle [Tue, 17 Mar 2020 01:31:58 +0000 (18:31 -0700)]
[mlir] Add support for the attribute verifiers in the dialect declaration generator.
Summary: This adds bitfields that map to the dialect attribute verifier hooks. This also moves over the Test dialect to have its declaration generated.
Differential Revision: https://reviews.llvm.org/D76254
Douglas Gliner [Tue, 17 Mar 2020 01:20:58 +0000 (18:20 -0700)]
[Support] Change isatty to is_displayed
Currently, when building with the Unix support library and `isatty` does
not exist for the target platform (i.e. `HAVE_ISATTY` is false),
compilation of the file `raw_ostream.cpp` will fail due to direct use of
`isatty` in the function `raw_fd_ostream::preferred_buffer_size()`.
Use is_displayed() to fix the problem.
Reviewed By: probinson, MaskRay
Differential Revision: https://reviews.llvm.org/D75278
Craig Topper [Tue, 17 Mar 2020 00:58:19 +0000 (17:58 -0700)]
[X86] Disable fast-isel call lowering for functions with vXi1 arguments on avx512.
This fails an assert because the type is marked in the calling
convention td file as needing promotion, but the code doesn't know
how to do it.
It also much more complicated because we try to pass these in
xmm/ymm/zmm registers. As of a few weeks ago we do this promotion
from getRegisterTypeForCallingConv before the td file generated
code gets involved.
Adrian Prantl [Thu, 5 Mar 2020 23:46:28 +0000 (15:46 -0800)]
Switch to TypeSystemClang over to CreateDeserialized() (NFC)
which is the more appropriate API for its use-case.
Differential Revision: https://reviews.llvm.org/D75715
Sriraman Tallam [Tue, 17 Mar 2020 01:03:23 +0000 (18:03 -0700)]
Add target to test basicblock-sections-mir-parse.mir
This test fails on ppc which was unintended.
Revision: D73674.
River Riddle [Tue, 17 Mar 2020 00:55:32 +0000 (17:55 -0700)]
[mlir] Remove the PatternState class and simplify PatternMatchResult.
Summary: PatternState was a mechanism to pass state between the match and rewrite calls of a RewritePattern. With the rise of matchAndRewrite, this class is unused and unnecessary. This revision removes PatternState and simplifies PatternMatchResult to just be a LogicalResult. A future revision will replace all usages of PatternMatchResult/matchSuccess/matchFailure with LogicalResult equivalents.
Differential Revision: https://reviews.llvm.org/D76202
Uday Bondhugula [Mon, 16 Mar 2020 03:28:44 +0000 (08:58 +0530)]
[MLIR][NFC] update/clean up affine PDT, related utils, its test case
- rename vars that had inst suffixes (due to ops earlier being
known as insts); other renames for better readability
- drop unnecessary matches in test cases
- iterate without block terminator
- comment/doc updates
- instBodySkew -> affineForOpBodySkew
Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D76214