Commit Graph

407633 Commits

Author SHA1 Message Date
Tue Ly a2b3e6bed8 [libc] Add documentation about how to add a math function to LLVM-libc.
Add documentation about how to add a math function to LLVM-libc.

Differential Revision: https://reviews.llvm.org/D115608
2021-12-16 12:12:21 -05:00
Arthur O'Dwyer 2a04decc4a [libc++] [test] Simplify sentinel_wrapper and sized_sentinel.
Remove `s.base()`; every test that wants to get the base of a "test sentinel"
should use the ADL `base(s)` from now on.

Differential Revision: https://reviews.llvm.org/D115766
2021-12-16 12:02:58 -05:00
Michał Górny 209ec8e2ee [lldb] Silence CMake warnings about missing FindFBSDVMCore
Pass QUIET to find_package() in order to quiet the warning about missing
FindFBSDVMCore.cmake.  FBSDVMCore always provides native CMake config
files, therefore providing a fallback module serves no purpose.

Differential Revision: https://reviews.llvm.org/D115882
2021-12-16 18:01:51 +01:00
Craig Topper 66bbefeb13 [RISCV] Revert Zfhmin related changes that aren't tested and depend on f16 being a legal type.
Our Zfhmin support is only MC layer, but these are CodeGen layer
interfaces. If f16 isn't a Legal type for CodeGen with Zfhmin, then
these interfaces should keep their non-Zfh behavior.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D115822
2021-12-16 08:55:28 -08:00
Simon Pilgrim a640f16ca2 [X86] combineAnd - don't demand operand vector elements if the other operand element is zero
If either operand has a zero element, then we don't need the equivalent element from the other operand, as no bits will be set.
2021-12-16 16:54:27 +00:00
Ella Ma 333d66b094 [analyzer][ctu] Fix wrong 'multiple definitions' errors caused by space characters in lookup names when parsing the ctu index file
This error was found when analyzing MySQL with CTU enabled.

When there are space characters in the lookup name, the current
delimiter searching strategy will make the file path wrongly parsed.
And when two lookup names have the same prefix before their first space
characters, a 'multiple definitions' error will be wrongly reported.

e.g. The lookup names for the two lambda exprs in the test case are
`c:@S@G@F@G#@Sa@F@operator int (*)(char)#1` and
`c:@S@G@F@G#@Sa@F@operator bool (*)(char)#1` respectively. And their
prefixes are both `c:@S@G@F@G#@Sa@F@operator` when using the first space
character as the delimiter.

Solving the problem by adding a length for the lookup name, making the
index items in the format of `USR-Length:USR File-Path`.

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D102669
2021-12-16 17:47:59 +01:00
Julian Lettner 3a1eb1cf2a [TSan] Make test fail more predictably
This test would hang when the system ran out of resources and we fail to
create all 300 threads.

Differential Revision: https://reviews.llvm.org/D115845
2021-12-16 08:33:32 -08:00
Mike Rice 2d0bf14397 [clang] Cleanup unneeded Function nullptr checks [NFC]
Add an assert and avoid unneeded checks of Fn in
CodeGenFunction::GenerateCode.

Differential Revision: https://reviews.llvm.org/D115817
2021-12-16 08:28:10 -08:00
Matt Arsenault 4132dc917e AMDGPU: Return result from indicatePessimisticFixpoint
I don't think this fixes anything.
2021-12-16 11:26:30 -05:00
Simon Pilgrim 3267de7215 [X86] combineAnd - pull out repeated getOperand() and SDLoc() calls. NFCI. 2021-12-16 16:22:39 +00:00
Simon Pilgrim 4712a71415 [X86] Rename LowerScalarImmediateShift/LowerScalarVariableShift helpers. NFC.
Rename them to LowerShiftByScalarImmediate/LowerShiftByScalarVariable to make it easier to find them wrt LowerShift()
2021-12-16 16:01:14 +00:00
Jamie Schmeiser 864ca42483 Revert "A new hidden option exec-on-ir-change=exe that calls exe each time IR changes"
This reverts commit dff0e8b4ff.

Failing build:  https://lab.llvm.org/buildbot/#/builders/42/builds/2800
2021-12-16 10:54:11 -05:00
Tor Arne Vestbø 427f6e11e6 [lldb][docs] Update instructions for building libc++
Reviewed By: sylvestre.ledru

Differential Revision: https://reviews.llvm.org/D115877
2021-12-16 16:50:42 +01:00
Nikita Popov 2d89382b5a [CodeGen] Avoid more pointer element type accesses
This is enough to build sqlite3 with opaque pointers.
2021-12-16 16:34:09 +01:00
David Spickett 2dbe5898d7 [llvm][docs] Describe how to work with patch series on Phabricator
Reviewed By: awarzynski, jhenderson

Differential Revision: https://reviews.llvm.org/D115519
2021-12-16 15:32:26 +00:00
Hans Wennborg bbc690c572 Define __STDC_NO_THREADS__ when targeting windows-msvc (PR48704)
MSVC's libc doesn't provide thread.h, so we should set the macro to
indicate that.

We could just set it in C mode, but I noticed that Darwin sets it
unconditionally, so perhaps we should do the same here.

Differential revision: https://reviews.llvm.org/D112081
2021-12-16 16:30:06 +01:00
Nikita Popov 8285522014 [CodeGen] Always update map entry after adding initializer
With opaque pointers the pointer cast may be a no-op, such that
var and castedAddr are the same. However, we still need to update
the map entry as the underlying global changed. We could explicitly
check whether the global was replaced, but we may as well just
always update the entry.
2021-12-16 16:29:35 +01:00
Daniel Kiss 2b4e6052b3 [lld] Add cet-report and bti-report flags
Implement cet-report as supported in binutils.
bti-report has the same behaviour for AArch64-BTI.

Fixes https://github.com/llvm/llvm-project/issues/44828

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D113901
2021-12-16 16:26:26 +01:00
Nathan Sidwell dd073e08ae Avoid by-value copies of referenced objects
These were detected by the new -Wauto-by-value-copy (D114989) warning, these by-value
constant copies need only be references.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D114990
2021-12-16 07:22:46 -08:00
Nathan Sidwell 5fbe21a774 [clang] p2085 out-of-class comparison operator defaulting
This implements p2085, allowing out-of-class defaulting of comparison
operators, primarily so they need not be inline, IIUC intent. this was
mostly straigh forward, but required reimplementing
Sema::CheckExplicitlyDefaultedComparison, as now there's a case where
we have no a priori clue as to what class a defaulted comparison may
be for. We have to inspect the parameter types to find out. Eg:

class X { ... };
bool operator==(X, X) = default;

Thus reimplemented the parameter type checking, and added 'is this a
friend' functionality for the above case.

Reviewed By: mizvekov

Differential Revision: https://reviews.llvm.org/D104478
2021-12-16 07:22:46 -08:00
Stuart Brady 5aefb1dc1e Revert "[OpenCL] Add pure attribute to vload builtins"
This reverts commit 1a376bc285.

This broke clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
2021-12-16 15:16:41 +00:00
Valentin Clement 3ab67c3d62
[fir] Move Factory.h to flang/Optimizer/Builder
Move the Factory.h header file to flang/Optimizer/Builder.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D115801
2021-12-16 16:08:34 +01:00
Stuart Brady 1a376bc285 [OpenCL] Add pure attribute to vload builtins
Use the "pure" attribute (or "readonly") for the vload, vload_half and
vloada_half builtins.

Reviewed By: svenvh

Differential Revision: https://reviews.llvm.org/D110742
2021-12-16 14:55:31 +00:00
Alexander Belyaev 88df30c8d8 [mlir] Add canonicalization for extract(tensor.from_elements) in 0d case.
Differential Revision: https://reviews.llvm.org/D115875
2021-12-16 15:46:57 +01:00
Lei Zhang 223be5f630 [mlir][spirv] Perform partial conversion in VectorToSPIRVPass
This allows the pass to participate in progressive lowering
and it also allows us to write tests better.

Along the way, cleaned up the tests.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D115756
2021-12-16 09:35:56 -05:00
Nikita Popov a0cf066eac [CodeGen] Store element type in ParamValue
ParamValue is basically a union between an Address and a Value*.
To be able to reconstruct the Address, we now need to store the
pointer element type.
2021-12-16 15:31:55 +01:00
Florian Hahn 3b35113ff0
[VPlan] Add VPBlockBase::successors() returning an iterator_range (NFC).
This will also be helpful for D115793.
2021-12-16 14:28:50 +00:00
Nikita Popov 58c8c53263 [CodeGen] Avoid more pointer element type accesses 2021-12-16 15:26:21 +01:00
Sanjay Patel 8c7f2a4f87 [CodeGen] use saturating FP casts when compiling with "no-strict-float-cast-overflow"
We got an unintended consequence of the optimizer getting smarter when
compiling in a non-standard mode, and there's no good way to inhibit
those optimizations at a later stage. The test is based on an example
linked from D92270.

We allow the "no-strict-float-cast-overflow" exception to normal C
cast rules to preserve legacy code that does not expect overflowing
casts from FP to int to produce UB. See D46236 for details.

Differential Revision: https://reviews.llvm.org/D115804
2021-12-16 09:10:12 -05:00
Neumann Hon 9a35844990 [z/OS] Implement prologue and epilogue generation for z/OS target.
This patch adds support for prologue and epilogue generation for the z/OS target under the XPLINK64 ABI for functions with a stack size of less than 1048576 bytes (huge stack frames).

Reviewed By: uweigand

Differential Revision: https://reviews.llvm.org/D114457
2021-12-16 09:04:05 -05:00
Jamie Schmeiser dff0e8b4ff A new hidden option exec-on-ir-change=exe that calls exe each time IR changes
Summary:
A new option exec-on-ir-changed is defined that allows one to specify an
exe that is called after each pass in the opt pipeline that changes the IR.
The exec-on-ir-change=exe option saves the IR in a temporary file and calls exe
with the name of the file and the name of the pass that just changed it after
each pass alters the IR. exe is also called with the initial IR. This
can be used, for example, to determine which pass corrupts the IR by having
exe as a script that calls llc and runs a test to see after which pass the
results change. The print-changed filtering options are respected.  Note that
this is only supported with the new pass manager.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: aeubanks (Arthur Eubanks)
Differential Revision: https://reviews.llvm.org/D110776
2021-12-16 09:01:49 -05:00
Alexander Belyaev f77e9f8768 [mlir] Extend `tensor.from_elements` to support N-D case.
RFC: https://llvm.discourse.group/t/rfc-extend-tensor-fromelementsop-to-n-d/4715

Differential Revision: https://reviews.llvm.org/D115821
2021-12-16 14:52:41 +01:00
Kiran Chandramohan 80b1d472d6 [Flang][NFC] Add test with shape for allocmem and freemem
Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D115797
2021-12-16 13:48:35 +00:00
OCHyams 18ee898cfa [Dexter] Remove the Windows dependency on lld from CMake
Currently, lld is marked as a dependency on Windows in
cross-project-tests/CMakeLists.txt which means CMake will fail if lld isn't
enabled. The idea of the cross-project-tests is that tests that don't have
their dependencies met should just be unsupported.

Remove the depenency from the CMake step and check whether Dexter's
platform-specific dependencies have been met in
cross-project-tests/lit.cfg.py. If the dependencies are met then add 'dexter'
to the available_features, otherwise don't and the dexter tests will be
"UNSUPPORTED".

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D115872
2021-12-16 13:43:04 +00:00
Yitzhak Mandelbaum 8561e15c5b [clang][dataflow] Fix unused-variable warning. 2021-12-16 13:37:17 +00:00
Nikolas Klauser 148ef80f89 [libc++] Add GCC workaround in std::char_traits<char>::length()
GCC currently does not allow `__builtin_strlen()` during constant evaluation. This PR adds a workaround in `std::char_traits<char>::length()`

Reviewed By: Quuxplusone, ldionne, #libc, Mordante

Spies: Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D115795
2021-12-16 14:27:51 +01:00
Paul Altin 9198d04c06 Allow disabling integer to floating-point narrowing conversions for cppcoreguidelines-narrowing-conversions
This change adds an option to disable warnings from the
cppcoreguidelines-narrowing-conversions check on integer to floating-
point conversions which may be narrowing.

An example of a case where this might be useful:
```
std::vector<double> v = {1, 2, 3, 4};
double mean = std::accumulate(v.cbegin(), v.cend(), 0.0) / v.size();
```
The conversion from std::size_t to double is technically narrowing on
64-bit systems, but v almost certainly does not have enough elements
for this to be a problem.

This option would allow the cppcoreguidelines-narrowing-conversions
check to be enabled on codebases which might otherwise turn it off
because of cases like the above.
2021-12-16 08:24:09 -05:00
Aaron Ballman a1879e52e3 Fix crash on invalid code involving late parsed inline methods
When parsing the following construct, we parse it as an erroneous
deduction guide declaration and correctly diagnose the issues with it.

template<class> struct B;
struct A { B() noexcept(false); };

However, we then go on to finish late parsing the declaration and this
expects that what we've parsed is a CXXMethodDecl. A
CXXDeductionGuideDecl is not a CXXMethodDecl (it's a FunctionDecl), and
so we assert on the cast.

This fixes the crash by switching from cast<> to dyn_cast<> and not
setting up a "this" scope when the declaration is not a CXXMethodDecl.

This fixes PR49735.
2021-12-16 07:58:51 -05:00
Pavel Labath 9d5e37ed8c [lldb] (Semi-automatically) format .swig files
I've found my recent ventures into the swig land painful because
of the strange way they are formatted. This patch attempts to alleviate
future headaches by formatting these files into something resembling the
normal llvm style.

Unfortunately, completely formatting these files automatically does not
work because clang format gets confused by swigs % syntax, so I have
employed a hybrid approach where I formatted blocks of c++ code with
clang-format and then manually massaged the code until it looked
reasonable (and compiled).

I don't expect these files to remain perfectly formatted (although, if
one's editor is configured to configure the current line/block on
request, one can get pretty good results by using it judiciously), but
at least it will prevent the (mangled form of the) old lldb style being
proliferated endlessly.

Differential Revision: https://reviews.llvm.org/D115736
2021-12-16 13:58:37 +01:00
Sjoerd Meijer 5b139a583d Revert "[FuncSpec] Decouple cost/benefit analysis, allowing sorting of candidates."
This reverts commit 20b03d6536.

This shows some failed tests on a bot with expensive checks enabled that I need
to look at.
2021-12-16 12:56:11 +00:00
Diego Caballero e0514fc200 [mlir] Fix Bazel build after 32fe1a8a25
Adding missing dependences.
2021-12-16 12:13:56 +00:00
Sjoerd Meijer 20b03d6536 [FuncSpec] Decouple cost/benefit analysis, allowing sorting of candidates.
This mostly is the same code that is refactored to decouple the cost and
benefit analysis. The biggest change is top-level function specializeFunctions
that now drives the transformation more like this:

  specializeFunctions() {
    Cost = getSpecializationCost(F);
    calculateGains(F, Cost);
    specializeFunction(F);
  }

while this is just a restructuring, it helps the functional change in
calculateGains. I.e., we now sort the candidates based on the expected
specialisation gain, which we didn't do before. For this, a book keeping struct
ArgInfo was introduced. If we have a list of N candidates, but we only want
specialise less than N as set by option -func-specialization-max-constants, we
sort the list and discard the candidates that give the least benefit.

Given a formal argument, this change results in selecting the best actual
argument(s). This is NFC'ish in that this shouldn't change the current output
(hence no test change here), but in follow ups starting with D115509, it
should and I want to go one step further and compare all functions and all
arguments, which will mostly build on top of this refactoring and change.

Differential Revision: https://reviews.llvm.org/D115458
2021-12-16 11:55:37 +00:00
Diego Caballero 32fe1a8a25 [mlir][GPU] Extend GPU kernel outlining to generate DL specification
This patch extends the GPU kernel outlining pass so that it can take in
an optional data layout specification that will be attached to the GPU
module operation generated. If the data layout specification is not provided
the default data layout is used instead.

Reviewed By: herhut, mehdi_amini

Differential Revision: https://reviews.llvm.org/D115722
2021-12-16 11:35:53 +00:00
Florian Hahn 59a85a7a52
[PPC] Update test after f5f421e0ee. 2021-12-16 11:28:54 +00:00
Nikita Popov 34eb715f61 [CodeGen] Avoid more pointer element type accesses 2021-12-16 12:03:11 +01:00
Florian Hahn f5f421e0ee
[SCEV] Apply loop guards in reverse order.
This patch updates applyLoopGuards to first collect all conditions and
then applies them in reverse order. This ensures the SCEVs with the
shortest dependency chains are constructed first, limiting the required
stack size.

This fixes a crash reported in D113578.

Note that the order conditions are applied can impact the accuracy of
the result, mostly due to missing min/max simplifications when
constructing SCEVs.

The changed test highlights the impact of the evaluation order. I will
follow up with a SCEV patch to improve min/max simplifications to get
the same results for both orders.
2021-12-16 10:52:37 +00:00
Nikita Popov 9fa15e0073 [CodeGen] Remove an unused MakeAddrLValue() overload (NFC)
This is unused and we should prefer the overloads accepting Address.
2021-12-16 11:49:20 +01:00
Paulo Matos c92d45913c [WebAssembly] Fix typechecking for else MCInst
When hitting an else clause the type Stack should be reset to as it was at the start of the if, without taking into account the Type inserted into the Stack during the then branch of the if.

Reviewed By: aardappel

Differential Revision: https://reviews.llvm.org/D115748
2021-12-16 11:18:01 +01:00
eopXD 6734be290b Revert "[LoopVersioning] Allow versionLoop to create plain branch inst when no runtime check is specified"
This reverts commit fbf6c8ac15.
2021-12-16 02:06:11 -08:00
Hsiangkai Wang 78415b5044 [RISCV] Precommit a test for vector copy conversion under implicit-def. 2021-12-16 18:04:38 +08:00