Eduardo Caldas [Mon, 24 Aug 2020 13:57:20 +0000 (13:57 +0000)]
[SyntaxTree] Split `ParametersAndQualifiers` tests
Differential Revision: https://reviews.llvm.org/D86459
Eduardo Caldas [Mon, 24 Aug 2020 10:30:09 +0000 (10:30 +0000)]
[SyntaxTree] Group tests related to `using`
Differential Revision: https://reviews.llvm.org/D86443
Eduardo Caldas [Mon, 24 Aug 2020 10:19:19 +0000 (10:19 +0000)]
[SyntaxTree] Split ExplicitTemplateInstantiation test
Differential Revision: https://reviews.llvm.org/D86441
Eduardo Caldas [Mon, 24 Aug 2020 10:07:27 +0000 (10:07 +0000)]
[SyntaxTree] Split FreeStandingClass tests
Differential Revision: https://reviews.llvm.org/D86440
Eduardo Caldas [Mon, 24 Aug 2020 09:54:58 +0000 (09:54 +0000)]
[SyntaxTree] Use annotations to reduce noise on member function tests
Differential Revision: https://reviews.llvm.org/D86439
Eduardo Caldas [Mon, 24 Aug 2020 09:50:03 +0000 (09:50 +0000)]
[SyntaxTree] Split array declarator tests
Differential Revision: https://reviews.llvm.org/D86437
dongAxis [Mon, 24 Aug 2020 14:22:08 +0000 (22:22 +0800)]
[coroutine] should disable inline before calling coro split
summary:
When callee coroutine function is inlined into caller coroutine
function before coro-split pass, llvm will emits "coroutine should
have exactly one defining @llvm.coro.begin". It seems that coro-early
pass can not handle this quiet well.
So we believe that unsplited coroutine function should not be inlined.
This patch fix such issue by not inlining function if it has attribute
"coroutine.presplit" (it means the function has not been splited) to
fix this issue
TestPlan: check-llvm
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D85812
Matt Arsenault [Sun, 23 Aug 2020 19:02:50 +0000 (15:02 -0400)]
GlobalISel: Improve dead instruction debug printing
This was printing the "Is dead" on a separate line from the
instruction, which was harder to follow.
Matt Arsenault [Thu, 16 Jul 2020 23:37:31 +0000 (19:37 -0400)]
AMDGPU/GlobalISel: Use different technique for sample v3s16 values
Avoid relying on implicit_def values, and odd sized G_INSERT/G_EXTRACT
Matt Arsenault [Wed, 19 Aug 2020 22:13:23 +0000 (18:13 -0400)]
AMDGPU/GlobalISel: Add baseline, failing unmerge tests
Alexey Bataev [Wed, 19 Aug 2020 19:23:00 +0000 (15:23 -0400)]
[OPENMP]Fix PR47158, case 3: allow devic_typein nested declare target region.
OpenMP 5.0 supports nested declare target regions. So, in general,it is
allow to mark a declarationas declare target with different device_type
or link type. Patch adds support for such kind of nesting.
Differential Revision: https://reviews.llvm.org/D86239
Francesco Petrogalli [Fri, 7 Aug 2020 22:03:24 +0000 (22:03 +0000)]
[llvm][LV] Replace `unsigned VF` with `ElementCount VF` [NFCI]
Changes:
* Change `ToVectorTy` to deal directly with `ElementCount` instances.
* `VF == 1` replaced with `VF.isScalar()`.
* `VF > 1` and `VF >=2` replaced with `VF.isVector()`.
* `VF <=1` is replaced with `VF.isZero() || VF.isScalar()`.
* Replaced the uses of `llvm::SmallSet<ElementCount, ...>` with
`llvm::SmallSetVector<ElementCount, ...>`. This avoids the need of an
ordering function for the `ElementCount` class.
* Bits and pieces around printing the `ElementCount` to string streams.
To guarantee that this change is a NFC, `VF.Min` and asserts are used
in the following places:
1. When it doesn't make sense to deal with the scalable property, for
example:
a. When computing unrolling factors.
b. When shuffle masks are built for fixed width vector types
In this cases, an
assert(!VF.Scalable && "<mgs>") has been added to make sure we don't
enter coepaths that don't make sense for scalable vectors.
2. When there is a conscious decision to use `FixedVectorType`. These
uses of `FixedVectorType` will likely be removed in favour of
`VectorType` once the vectorizer is generic enough to deal with both
fixed vector types and scalable vector types.
3. When dealing with building constants out of the value of VF, for
example when computing the vectorization `step`, or building vectors
of indices. These operation _make sense_ for scalable vectors too,
but changing the code in these places to be generic and make it work
for scalable vectors is to be submitted in a separate patch, as it is
a functional change.
4. When building the potential VFs in VPlan. Making the VPlan generic
enough to handle scalable vectorization factors is a functional change
that needs a separate patch. See for example `void
LoopVectorizationPlanner::buildVPlans(unsigned MinVF, unsigned
MaxVF)`.
5. The class `IntrinsicCostAttribute`: this class still uses `unsigned
VF` as updating the field to use `ElementCount` woudl require changes
that could result in changing the behavior of the compiler. Will be done
in a separate patch.
7. When dealing with user input for forcing the vectorization
factor. In this case, adding support for scalable vectorization is a
functional change that migh require changes at command line.
Note that in some places the idiom
```
unsigned VF = ...
auto VTy = FixedVectorType::get(ScalarTy, VF)
```
has been replaced with
```
ElementCount VF = ...
assert(!VF.Scalable && ...);
auto VTy = VectorType::get(ScalarTy, VF)
```
The assertion guarantees that the new code is (at least in debug mode)
functionally equivalent to the old version. Notice that this change had been
possible because none of the methods that are specific to `FixedVectorType`
were used after the instantiation of `VTy`.
Reviewed By: rengolin, ctetreau
Differential Revision: https://reviews.llvm.org/D85794
Matt Arsenault [Sun, 16 Aug 2020 17:42:55 +0000 (13:42 -0400)]
AMDGPU/GlobalISel: Start implementing computeKnownBitsForTargetInstr
Handle workitem intrinsics. There isn't really away to adequately test
this right now, since none of the known bits users are fine grained
enough to test the edge conditions. This triggers a number of
instances of the new 64-bit to 32-bit shift combine in the existing
tests.
Francesco Petrogalli [Mon, 24 Aug 2020 13:49:27 +0000 (13:49 +0000)]
Revert "[llvm][LV] Replace `unsigned VF` with `ElementCount VF` [NFCI]"
Reverting because the commit message doesn't reflect the one agreed on
phabricator at https://reviews.llvm.org/D85794.
This reverts commit
c8d2b065b98fa91139cc7bb1fd1407f032ef252e.
Matt Arsenault [Sat, 15 Aug 2020 17:38:29 +0000 (13:38 -0400)]
GlobalISel: Reduce G_SHL width if source is extension
shl ([sza]ext x, y) => zext (shl x, y).
Turns expensive 64 bit shifts into 32 bit if it does not overflow the
source type:
This is a port of an AMDGPU DAG combine added in
5fa289f0d8ff85b9e14d2f814a90761378ab54ae. InstCombine does this
already, but we need to do it again here to apply it to shifts
introduced for lowered getelementptrs. This will help matching
addressing modes that use 32-bit offsets in a future patch.
TableGen annoyingly assumes only a single match data operand, so
introduce a reusable struct. However, this still requires defining a
separate GIMatchData for every combine which is still annoying.
Adds a morally equivalent function to the existing
getShiftAmountTy. Without this, we would have to do try to repeatedly
query the legalizer info and guess at what type to use for the shift.
Francesco Petrogalli [Fri, 7 Aug 2020 22:03:24 +0000 (22:03 +0000)]
[llvm][LV] Replace `unsigned VF` with `ElementCount VF` [NFCI]
Changes:
* Change `ToVectorTy` to deal directly with `ElementCount` instances.
* `VF == 1` replaced with `VF.isScalar()`.
* `VF > 1` and `VF >=2` replaced with `VF.isVector()`.
* `VF <=1` is replaced with `VF.isZero() || VF.isScalar()`.
* Add `<` operator to `ElementCount` to be able to use
`llvm::SmallSetVector<ElementCount, ...>`.
* Bits and pieces around printing the ElementCount to string streams.
* Added a static method to `ElementCount` to represent a scalar.
To guarantee that this change is a NFC, `VF.Min` and asserts are used
in the following places:
1. When it doesn't make sense to deal with the scalable property, for
example:
a. When computing unrolling factors.
b. When shuffle masks are built for fixed width vector types
In this cases, an
assert(!VF.Scalable && "<mgs>") has been added to make sure we don't
enter coepaths that don't make sense for scalable vectors.
2. When there is a conscious decision to use `FixedVectorType`. These
uses of `FixedVectorType` will likely be removed in favour of
`VectorType` once the vectorizer is generic enough to deal with both
fixed vector types and scalable vector types.
3. When dealing with building constants out of the value of VF, for
example when computing the vectorization `step`, or building vectors
of indices. These operation _make sense_ for scalable vectors too,
but changing the code in these places to be generic and make it work
for scalable vectors is to be submitted in a separate patch, as it is
a functional change.
4. When building the potential VFs in VPlan. Making the VPlan generic
enough to handle scalable vectorization factors is a functional change
that needs a separate patch. See for example `void
LoopVectorizationPlanner::buildVPlans(unsigned MinVF, unsigned
MaxVF)`.
5. The class `IntrinsicCostAttribute`: this class still uses `unsigned
VF` as updating the field to use `ElementCount` woudl require changes
that could result in changing the behavior of the compiler. Will be done
in a separate patch.
7. When dealing with user input for forcing the vectorization
factor. In this case, adding support for scalable vectorization is a
functional change that migh require changes at command line.
Differential Revision: https://reviews.llvm.org/D85794
Valeriy Savchenko [Thu, 16 Jul 2020 10:28:29 +0000 (13:28 +0300)]
[analyzer][tests] Add a notion of project sizes
Summary:
Whith the number of projects growing, it is important to be able to
filter them in a more convenient way than by names. It is especially
important for benchmarks, when it is not viable to analyze big
projects 20 or 50 times in a row.
Because of this reason, this commit adds a notion of sizes and a
filtering interface that puts a limit on a maximum size of the project
to analyze or benchmark.
Sizes assigned to the projects in this commit, do not directly
correspond to the number of lines or files in the project. The key
factor that is important for the developers of the analyzer is the
time it takes to analyze the project. And for this very reason,
"size" basically helps to cluster projects based on their analysis
time.
Differential Revision: https://reviews.llvm.org/D83942
Florian Hahn [Fri, 21 Aug 2020 17:17:00 +0000 (18:17 +0100)]
[DSE,MemorySSA] Delay PointerMayBeCaptured calls until actually needed.
Avoid computing InvisibleToCallerBefore/AfterRet up front. In most
cases, this information is not really needed. Instead, introduce helper
functions to compute and cache the result on demand.
Notably, this also does not use PointerMayBeCapturedBefore for
isInvisibleToCallerBeforeRet, as it requires the killing MemoryDef as
starting instruction, making the caching ineffective. But it appears the
use of PointerMayBeCapturedBefore has very limited benefits in practice
(e.g. on SPEC2000/SPEC2006/MultiSource there are no binary changes with
-O3 -flto). Refrain from using it for now, to limit-compile-time.
This gives some nice compile-time improvements:
http://llvm-compile-time-tracker.com/compare.php?from=
db9345f6810f379a36752dc52caf5230585d0ebd&to=
b4d091047e1b8a3d377d200137b79d03aca65663&stat=instructions
Anna Welker [Mon, 24 Aug 2020 11:04:57 +0000 (12:04 +0100)]
[ARM][MVE] Allow tail predication for strides !=1 with gather/scatters
If gather/scatters are enabled, ARMTargetTransformInfo now allows
tail predication for loops with a much wider range of strides, up
to anything that is loop invariant.
Differential Revision: https://reviews.llvm.org/D85410
Raphael Isemann [Fri, 21 Aug 2020 12:21:21 +0000 (14:21 +0200)]
Reland "Correctly emit dwoIDs after ASTFileSignature refactoring (D81347)"
The orignal patch with the missing 'REQUIRES: asserts' as there is a debug-only
flag used in the test.
Original summary:
D81347 changes the ASTFileSignature to be an array of 20 uint8_t instead of 5
uint32_t. However, it didn't update the code in ObjectFilePCHContainerOperations
that creates the dwoID in the module from the ASTFileSignature
(`Buffer->Signature` being the array subclass that is now `std::array<uint8_t,
20>` instead of `std::array<uint32_t, 5>`).
```
uint64_t Signature = [..] (uint64_t)Buffer->Signature[1] << 32 | Buffer->Signature[0]
```
This code works with the old ASTFileSignature (where two uint32_t are enough to
fill the uint64_t), but after the patch this only took two bytes from the
ASTFileSignature and only partly filled the Signature uint64_t.
This caused that the dwoID in the module ref and the dwoID in the actual module
no longer match (which in turns causes that LLDB keeps warning about the dwoID's
not matching when debugging -gmodules-compiled binaries).
This patch just unifies the logic for turning the ASTFileSignature into an
uint64_t which makes the dwoID match again (and should prevent issues like that
in the future).
Reviewed By: aprantl, dang
Differential Revision: https://reviews.llvm.org/D84013
Bevin Hansson [Fri, 21 Aug 2020 08:26:52 +0000 (10:26 +0200)]
[Fixed Point] Add codegen for fixed-point shifts.
This patch adds codegen to Clang for fixed-point shift
operations.
Reviewed By: leonardchan
Differential Revision: https://reviews.llvm.org/D83294
Bevin Hansson [Thu, 20 Aug 2020 12:36:35 +0000 (14:36 +0200)]
[Fixed Point] Use FixedPointBuilder to codegen fixed-point IR.
This changes the methods in CGExprScalar to use
FixedPointBuilder to generate IR for fixed-point
conversions and operations.
Since FixedPointBuilder emits padded operations slightly
differently than the original code, some tests change.
Reviewed By: leonardchan
Differential Revision: https://reviews.llvm.org/D86282
Haojian Wu [Mon, 24 Aug 2020 12:20:36 +0000 (14:20 +0200)]
[AST][RecoveryAST] Preserve the type by default for recovery expression.
Differential Revision: https://reviews.llvm.org/D82657
Florian Hahn [Mon, 24 Aug 2020 12:24:44 +0000 (13:24 +0100)]
[DSE,MemorySSA] Regnerate some check lines.
The check lines where generated before align was added for all
instructions. Re-generate them, to reduce diff noise for actual
functional changes.
Jonas Paulsson [Mon, 24 Aug 2020 12:07:30 +0000 (14:07 +0200)]
[SystemZ] Preserve the MachineMemOperand in emitCondStore() in all cases.
Review: Ulrich Weigand
Florian Hahn [Sat, 22 Aug 2020 09:08:59 +0000 (10:08 +0100)]
[DSE,MemorySSA] Limit elimination at end of function to single UO.
Limit elimination of stores at the end of a function to MemoryDefs with
a single underlying object, to save compile time.
In practice, the case with multiple underlying objects seems not very
important in practice. For -O3 -flto on MultiSource/SPEC2000/SPEC2006
this results in a total of 2 more stores being eliminated.
We can always re-visit that in the future.
Sanjay Patel [Sun, 23 Aug 2020 18:58:29 +0000 (14:58 -0400)]
[InstCombine] fold abs of select with negated op (PR39474)
Similar to the existing transform - peek through a select
to match a value and its negation.
https://alive2.llvm.org/ce/z/MXi5KG
define i8 @src(i1 %b, i8 %x) {
%0:
%neg = sub i8 0, %x
%sel = select i1 %b, i8 %x, i8 %neg
%abs = abs i8 %sel, 1
ret i8 %abs
}
=>
define i8 @tgt(i1 %b, i8 %x) {
%0:
%abs = abs i8 %x, 1
ret i8 %abs
}
Transformation seems to be correct!
Sanjay Patel [Sun, 23 Aug 2020 18:49:03 +0000 (14:49 -0400)]
[InstCombine] add tests for abs of select with negated op; NFC (PR39474)
Raphael Isemann [Mon, 24 Aug 2020 10:54:25 +0000 (12:54 +0200)]
Revert "Reland "Correctly emit dwoIDs after ASTFileSignature refactoring (D81347)""
This reverts commit
ada2e8ea67393aa8c44fe8e9d46be62df6d1c702. Still breaking
on Fuchsia (and also Fedora) with exit code 1, so back to investigating.
Sam Parker [Mon, 24 Aug 2020 10:23:46 +0000 (11:23 +0100)]
[SCEV] Still (again) trying to fix buildbots
Raphael Isemann [Mon, 24 Aug 2020 09:20:57 +0000 (11:20 +0200)]
Reland "Correctly emit dwoIDs after ASTFileSignature refactoring (D81347)"
This relands D84013 but with a test that relies on less shell features to
hopefully make the test pass on Fuchsia (where the test from the previous patch
version strangely failed with a plain "Exit code 1").
Original summary:
D81347 changes the ASTFileSignature to be an array of 20 uint8_t instead of 5 uint32_t.
However, it didn't update the code in ObjectFilePCHContainerOperations that creates
the dwoID in the module from the ASTFileSignature (`Buffer->Signature` being the
array subclass that is now `std::array<uint8_t, 20>` instead of `std::array<uint32_t, 5>`).
```
uint64_t Signature = [..] (uint64_t)Buffer->Signature[1] << 32 | Buffer->Signature[0]
```
This code works with the old ASTFileSignature (where two uint32_t are enough to
fill the uint64_t), but after the patch this only took two bytes from the ASTFileSignature
and only partly filled the Signature uint64_t.
This caused that the dwoID in the module ref and the dwoID in the actual module no
longer match (which in turns causes that LLDB keeps warning about the dwoID's not
matching when debugging -gmodules-compiled binaries).
This patch just unifies the logic for turning the ASTFileSignature into an uint64_t which
makes the dwoID match again (and should prevent issues like that in the future).
Reviewed By: aprantl, dang
Differential Revision: https://reviews.llvm.org/D84013
Pavel Labath [Mon, 24 Aug 2020 09:44:28 +0000 (11:44 +0200)]
[lld] s/dyn_cast/isa in InputSection.cpp
Avoids a -Wunused-variable with gcc.
Pavel Labath [Thu, 20 Aug 2020 07:20:55 +0000 (09:20 +0200)]
[lldb/Utility] Remove some Scalar type accessors
Now that the number of Scalar "types" has been reduced, these don't make
sense anymore.
Sam Parker [Mon, 24 Aug 2020 09:26:48 +0000 (10:26 +0100)]
[SCEV] Still trying to fix windows buildbots
Julien Etienne [Mon, 24 Aug 2020 08:24:14 +0000 (20:24 +1200)]
Add support for AVR attiny441 and attiny841
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D85589
Patch by Julien Etienne
Sam Parker [Mon, 24 Aug 2020 08:13:08 +0000 (09:13 +0100)]
[NFCI][SimplifyCFG] Combine select costs and checks
Combine the cost modelling and validity checks for the phi to select
conversion in SpeculativelyExecuteBB, extracting the logic out into
a function.
Bjorn Pettersson [Sat, 22 Aug 2020 17:06:06 +0000 (19:06 +0200)]
[SelectionDAG] Fix miscompile bug in expandFunnelShift
This is a fixup of commit
0819a6416fd217 (D77152) which could
result in miscompiles. The miscompile could only happen for targets
where isOperationLegalOrCustom could return different values for
FSHL and FSHR.
The commit mentioned above added logic in expandFunnelShift to
convert between FSHL and FSHR by swapping direction of the
funnel shift. However, that transform is only legal if we know
that the shift count (modulo bitwidth) isn't zero.
Basically, since fshr(-1,0,0)==0 and fshl(-1,0,0)==-1 then doing a
rewrite such as fshr(X,Y,Z) => fshl(X,Y,0-Z) would be incorrect if
Z modulo bitwidth, could be zero.
```
$ ./alive-tv /tmp/test.ll
----------------------------------------
define i32 @src(i32 %x, i32 %y, i32 %z) {
%0:
%t0 = fshl i32 %x, i32 %y, i32 %z
ret i32 %t0
}
=>
define i32 @tgt(i32 %x, i32 %y, i32 %z) {
%0:
%t0 = sub i32 32, %z
%t1 = fshr i32 %x, i32 %y, i32 %t0
ret i32 %t1
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
i32 %x = #x00000000 (0)
i32 %y = #x00000400 (1024)
i32 %z = #x00000000 (0)
Source:
i32 %t0 = #x00000000 (0)
Target:
i32 %t0 = #x00000020 (32)
i32 %t1 = #x00000400 (1024)
Source value: #x00000000 (0)
Target value: #x00000400 (1024)
```
It could be possible to add back the transform, given that logic
is added to check that (Z % BW) can't be zero. Since there were
no test cases proving that such a transform actually would be useful
I decided to simply remove the faulty code in this patch.
Reviewed By: foad, lebedev.ri
Differential Revision: https://reviews.llvm.org/D86430
Sam Parker [Mon, 24 Aug 2020 07:29:04 +0000 (08:29 +0100)]
[SCEV] Attempt to fix windows buildbots
Mehdi Amini [Mon, 24 Aug 2020 05:03:59 +0000 (05:03 +0000)]
Add an assertion to protect against missing Dialect registration in a pass pipeline (NFC)
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D86327
Sam Parker [Tue, 18 Aug 2020 08:59:41 +0000 (09:59 +0100)]
[SCEV] Add operand methods to Cast and UDiv
Add methods to access operands in a similar manner to NAryExpr.
Differential Revision: https://reviews.llvm.org/D86083
Fangrui Song [Mon, 24 Aug 2020 05:53:23 +0000 (22:53 -0700)]
[LiveDebugVariables] Internalize class DbgVariableValue. NFC
Stella Laurenzo [Wed, 19 Aug 2020 22:33:02 +0000 (15:33 -0700)]
Add initial python bindings for attributes.
* Generic mlir.ir.Attribute class.
* First standard attribute (mlir.ir.StringAttr), following the same pattern as generic vs standard types.
* NamedAttribute class.
Differential Revision: https://reviews.llvm.org/D86250
Qiu Chaofan [Mon, 24 Aug 2020 03:18:16 +0000 (11:18 +0800)]
[PowerPC] Support lowering int-to-fp on ppc_fp128
D70867 introduced support for expanding most ppc_fp128 operations. But
sitofp/uitofp is missing. This patch adds that after D81669.
Reviewed By: uweigand
Differntial Revision: https://reviews.llvm.org/D81918
Qiu Chaofan [Mon, 24 Aug 2020 03:09:58 +0000 (11:09 +0800)]
[PowerPC] Allow constrained FP intrinsics in mightUseCTR
We may meet Invalid CTR loop crash when there's constrained ops inside.
This patch adds constrained FP intrinsics to the list so that CTR loop
verification doesn't complain about it.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D81924
QingShan Zhang [Mon, 24 Aug 2020 02:50:58 +0000 (02:50 +0000)]
[DAGCombine] Remove dead node when it is created by getNegatedExpression
We hit the compiling time reported by https://bugs.llvm.org/show_bug.cgi?id=46877
and the reason is the same as D77319. So we need to remove the dead node we created
to avoid increase the problem size of DAGCombiner.
Reviewed By: Spatel
Differential Revision: https://reviews.llvm.org/D86183
Qiu Chaofan [Mon, 24 Aug 2020 02:10:27 +0000 (10:10 +0800)]
[PowerPC] Support constrained vector fp/int conversion
This patch makes these operations legal, and add necessary codegen
patterns.
There's still some issue similar to D77033 for conversion from v1i128
type. But normal type tests synced in vector-constrained-fp-intrinsic
are passed successfully.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D83654
Shilei Tian [Mon, 24 Aug 2020 01:21:06 +0000 (01:21 +0000)]
[NFC][OpenMP] Remove outdated comments about potential issues
The issue mentioned has been fixed in D84996
Brad Smith [Mon, 24 Aug 2020 00:44:29 +0000 (20:44 -0400)]
[clang][Driver] Implement addLibCxxIncludePaths and getCompilerRT for the OpenBSD clang driver.
Brad Smith [Mon, 24 Aug 2020 00:01:38 +0000 (20:01 -0400)]
[clang][Driver] Implement AddClangSystemIncludeArgs and HasNativeLLVMSupport for the OpenBSD clang driver.
If not overridden, AddClangSystemIncludeArgs's implementation is empty, so by
default, no system include args are added to the Clang driver. This means that
invoking Clang without the frontend must include a manual -I/usr/include flag,
which is inconsistent behavior. Therefore, override and implement this method
to match. Some boilerplate is also borrowed for handling of the other driver
flags.
While we are here, also override and enable HasNativeLLVMSupport.
Patch by:
3405691582 (dana koch)
Differential Revision: https://reviews.llvm.org/D86412
Valentin Clement [Mon, 24 Aug 2020 00:01:10 +0000 (20:01 -0400)]
[flang][openacc] Fix wait-argument for wait clause + add tests
This patch fix the usage of the wait-argument in a clause and add several tests and fix the unparsing of
the wait-argument.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D86325
Mehdi Amini [Sun, 23 Aug 2020 21:20:49 +0000 (21:20 +0000)]
Update FIR registration to not rely on the global MLIR dialect registry (NFC)
MLIR is removing "soon" the global dialect registry, this patch is
transitionning FIR to not rely on it anymore.
Roman Lebedev [Sun, 23 Aug 2020 19:53:05 +0000 (22:53 +0300)]
[InstCombine] Negator: freeze is freely negatible if it's operand is negatible
Roman Lebedev [Sun, 23 Aug 2020 19:48:16 +0000 (22:48 +0300)]
[NFC][InstCombine] Add tests for negation of freeze
Florian Hahn [Sun, 23 Aug 2020 15:13:43 +0000 (16:13 +0100)]
[llvm-reduce] Skip terminators when reducing instructions.
Removing terminators will result in invalid IR, making further
reductions pointless. I do not think there is any valid use case where
we actually want to create invalid IR as part of a reduction.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D86210
Fangrui Song [Sun, 23 Aug 2020 15:35:59 +0000 (08:35 -0700)]
[X86][FastISel] Support materializing floating-point constants for large code model & PIC
The following program miscompiles because rL216012 added static
relocation model support but not for PIC.
```
// clang -fpic -mcmodel=large -O0 a.cc
double foo() { return 42.0; }
```
This patch adds PIC support.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D86024
Simon Pilgrim [Sun, 23 Aug 2020 15:11:39 +0000 (16:11 +0100)]
[X86] Enable constexpr on ROTL/ROTR intrinsics (PR31446)
This enables constexpr rotate intrinsics defined in ia32intrin.h, including the MS specific builtins.
Florian Hahn [Sun, 23 Aug 2020 14:55:48 +0000 (15:55 +0100)]
[DSE,MemorySSA] Keep single DL instance in DSEState (NFC).
Small cleanup, also removes one instance of getting DataLayout without
using it later.
Sanjay Patel [Sun, 23 Aug 2020 12:36:46 +0000 (08:36 -0400)]
[DAGCombiner] restrict store merge of truncs to early combining
The pattern matching does not account for truncating stores,
so it is unlikely to work at later stages. So we are likely
wasting compile-time with no hope of improvement by running
this later.
Nithin Vadukkumchery Rajendrakumar [Sun, 23 Aug 2020 12:50:26 +0000 (14:50 +0200)]
[analyzer] Add modeling for unque_ptr::get()
Summary: Implemented modeling for get() method in SmartPtrModeling
Reviewers: NoQ, Szelethus, vsavchenko, xazax.hun
Reviewed By: NoQ, xazax.hun
Subscribers: martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D86029
Stefan Gränitz [Fri, 14 Aug 2020 15:03:26 +0000 (17:03 +0200)]
[ORC] Add a LLJITWithThinLTOSummaries example in OrcV2Examples
The example demonstrates how to use a module summary index file produced for ThinLTO to:
* find the module that defines the main entry point
* find all extra modules that are required for the build
A LIT test runs the example as part of the LLVM test suite [1] and shows how to create a module summary index file.
The code also provides two Error types that can be useful when working with ThinLTO summaries.
[1] if LLVM_BUILD_EXAMPLES=ON and platform is not Windows
Differential Revision: https://reviews.llvm.org/D85974
Simon Pilgrim [Sun, 23 Aug 2020 09:55:14 +0000 (10:55 +0100)]
[docs] Add an initial (non-exhaustive) list of intrinsics that can be used in constant expressions
As suggested by @rsmith on D86398 - we should try to document the intrinsics that can be used in constexpr
Simon Pilgrim [Sun, 23 Aug 2020 09:27:46 +0000 (10:27 +0100)]
[X86] Enable constexpr on _cast fp<-> uint intrinsics (PR31446)
As suggested by @rsmith on PR47267, by replacing the builtin_memcpy bitcast pattern with builtin_bit_cast we can use _castf32_u32, _castu32_f32, _castf64_u64 and _castu64_f64 inside constant expresssions (constexpr). Although __builtin_bit_cast was added for c++20 it works on all clang c/c++ modes.
Differential Revision: https://reviews.llvm.org/D86398
Mehdi Amini [Sun, 23 Aug 2020 04:35:58 +0000 (04:35 +0000)]
Reword the documentation for the `mlirTranslateMain` API (NFC)
Address post-commit review in https://reviews.llvm.org/D86408
António Afonso [Sat, 22 Aug 2020 18:53:08 +0000 (11:53 -0700)]
Create ${swig_target}-scripts target instead of lldb-python-scripts
This addresses the issue raised here https://reviews.llvm.org/rG02bf5632a94da6c3570df002804f8d3f79c11bfc
The `finish_swig_python` function might be called more than once so we need to create the distribution
component target based on the swig target.
Differential Revision: https://reviews.llvm.org/D86402
Mehdi Amini [Sun, 23 Aug 2020 00:57:47 +0000 (00:57 +0000)]
Add a `dialect_registration` callback for "translations" registered with mlir-translate
This will allow out-of-tree translation to register the dialects they expect
to see in their input, on the model of getDependentDialects() for passes.
Differential Revision: https://reviews.llvm.org/D86409
Mehdi Amini [Sun, 23 Aug 2020 00:57:39 +0000 (00:57 +0000)]
Refactor `mlir-translate` to extract the `main()` logic in a helper on the model of `MlirOptMain()` (NFC)
Differential Revision: https://reviews.llvm.org/D86408
Mehdi Amini [Sun, 23 Aug 2020 00:40:16 +0000 (00:40 +0000)]
Use TranslateFromMLIRRegistration for SPIRV roundtrip (NFC)
This is aligning it with the other "translation" which operates on a MLIR input.
Ryan Prichard [Sun, 23 Aug 2020 00:12:52 +0000 (17:12 -0700)]
[libunwind] Make findUnwindSectionsByPhdr static
Currently, this function is present in the dynsym table of
libunwind.so (on ELF targets). Make the function static instead.
In the previous release (LLVM 10.x), this function was instead a lambda
function inside LocalAddressSpace::findUnwindSections, and because
LocalAddressSpace was marked with _LIBUNWIND_HIDDEN, the lambda
function was also a hidden symbol.
Differential Revision: https://reviews.llvm.org/D86372
Craig Topper [Sat, 22 Aug 2020 23:05:01 +0000 (16:05 -0700)]
[X86] Allow 32-bit mode only CPUs with -mtune on 64-bit targets
gcc errors on this, but I'm nervous that since -mtune has been
ignored by clang for so long that there may be code bases out
there that pass 32-bit cpus to clang.
Fangrui Song [Sat, 22 Aug 2020 21:09:19 +0000 (14:09 -0700)]
[DebugInfo][test] Fix dwarf-callsite-related-attrs.ll after llvm-dwarfdump --statistics change
Fangrui Song [Fri, 21 Aug 2020 16:32:20 +0000 (09:32 -0700)]
[llvm-dwarfdump] --statistics: break lines and indent by 2
so that the user does not have to pipe the output to `jq` or `python -m json.tool`.
This change makes testing more convenient because `-NEXT` patterns can be used.
The "prettify by default" is a good tradeoff to make. The output size increases a bit.
Differential Revision: https://reviews.llvm.org/D86318
Sanjay Patel [Sat, 22 Aug 2020 20:21:10 +0000 (16:21 -0400)]
[DAGCombiner] add early exit for store merging of truncs
This should be NFC in terms of output because the endian
check further down would bail out too, but we are wasting
time by waiting to that point to give up. If we generalize
that function to deal with more than i8 types, we should
not have to deal with the degenerate case.
Michael Kruse [Sat, 22 Aug 2020 20:07:45 +0000 (15:07 -0500)]
Revert "[Polly] Ensure consistent Scop::InstStmtMap. NFC."
This reverts commit
8e06bf6b3a2e8d25e56cd52dca0cf3ff1b37b5d1.
It broke the polly-x86_64-linux-test-suite and
aosp-O3-polly-before-vectorizer-unprofitable buildbots.
Bas Zalmstra [Sat, 22 Aug 2020 20:04:22 +0000 (23:04 +0300)]
[LLD][COFF] Reset outputSections for successive runs
The global variable outputSections in the COFF writer was not
cleared between runs which caused successive calls to lld::coff::link
to generate invalid binaries. These binaries when loaded would result
in "invalid win32 applications" and/or "bad image" errors.
Differential Revision: https://reviews.llvm.org/D86401
Michael Kruse [Sat, 22 Aug 2020 17:24:52 +0000 (12:24 -0500)]
[flang][msvc] Split class declaration and constexpr variable definition. NFC.
Msvc has trouble defining a struct/class and defining a constexpr symbol in the same declarator. It reports the following error:
```
basic-parsers.h(809): error C2131: expression did not evaluate to a constant
basic-parsers.h(809): note: failure was caused by call of undefined function or one not declared 'constexpr'
basic-parsers.h(809): note: see usage of 'Fortran::parser::OkParser::OkParser'
```
Fix the msvc compilation by splitting the two definitions into two separate declarators.
This patch is part of the series to [[ http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html | make flang compilable with MS Visual Studio ]].
Reviewed By: DavidTruby, klausler
Differential Revision: https://reviews.llvm.org/D85937
Martin Storsjö [Mon, 17 Aug 2020 19:41:58 +0000 (22:41 +0300)]
[libunwind] Ensure enough alignment for unw_cursor_t for SEH build configurations
When built in SEH mode, UnwindCursor contains a CONTEXT struct,
which is aligned to 16 bytes in most configurations, causing the
whole UnwindCursor object to have 16 byte alignment.
This fixes backtraces using _Unwind_Backtrace on x86_64 mingw,
where an unw_cursor_t allocated on the stack was misaligned before.
This is an ABI break for this struct for this configuration, but very
few callers call libunwind directly (and even fewer directly allocate
an unw_cursor_t anyway).
Differential Revision: https://reviews.llvm.org/D86102
Sanjay Patel [Sat, 22 Aug 2020 18:38:08 +0000 (14:38 -0400)]
[AArch64] add tests for store merge of truncs; NFC
Jeremy Morse [Sat, 22 Aug 2020 18:05:25 +0000 (19:05 +0100)]
Follow-up build fix for rGae6f78824031
One of the bots objects to brace-initializing a tuple:
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/43595/steps/build%20stage%201/logs/stdio
As the tuple constructor is apparently explicit. Fall back to the (not
as pretty) explicit construction of a tuple. I'd thought this was
permitted behaviour; will investigate why this fails later.
Fangrui Song [Sat, 22 Aug 2020 17:55:28 +0000 (10:55 -0700)]
[LiveDebugValues] Delete unneeded copy constructor after D83047
It will suppress the implicitly-declared copy assignment operator in C++20.
António Afonso [Sat, 22 Aug 2020 17:43:02 +0000 (10:43 -0700)]
Move Py_buffer_RAII to .h file so SWIG 2 doesnt have to parse it
`struct Py_buffer_RAII` definition uses explicit deleted functions which are not supported by SWIG 2 (only 3).
To get around this I moved this struct to an .h file that is included to avoid being parsed by swig.
Reviewed By: lawrence_danna
Differential Revision: https://reviews.llvm.org/D86381
LLVM GN Syncbot [Sat, 22 Aug 2020 17:32:25 +0000 (17:32 +0000)]
[gn build] Port
ae6f7882403
Jeremy Morse [Sat, 22 Aug 2020 15:07:39 +0000 (16:07 +0100)]
[LiveDebugValues] Add instruction-referencing LDV implementation
This patch imports the instruction-referencing implementation of
LiveDebugValues proposed here:
http://lists.llvm.org/pipermail/llvm-dev/2020-June/142368.html
The new implementation is unreachable in this patch, it's the next patch
that enables it behind a command line switch. Briefly, rather than
tracking variable locations by just their location as the 'VarLoc'
implementation does, this implementation does it by value:
* Each value defined in a function is numbered, and propagated through
dataflow,
* Each DBG_VALUE reads a machine value number from a machine location,
* Variable _values_ are propagated through dataflow,
* Variable values are translated back into locations, DBG_VALUEs
inserted to specify where those locations are.
The ultimate aim of this is to enable referring to variable values
throughout post-isel code, rather than locations. Those patches will
build on top of this new LiveDebugValues implementation in later patches
-- it can't be done with the VarLoc implementation as we don't have
value information, only locations.
Differential Revision: https://reviews.llvm.org/D83047
Tyker [Sat, 22 Aug 2020 17:04:20 +0000 (19:04 +0200)]
[llvm-reduce] make llvm-reduce save the best reduction it has when it crashes
This helps with both debugging llvm-reduce and sometimes getting usefull result even if llvm-reduce crashes
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D85996
Michael Kruse [Sat, 22 Aug 2020 17:05:17 +0000 (12:05 -0500)]
[flang][msvc] Disambiguate injected class name.
The identifier `Expr` within the scope of the Expr class (including its temple specializations) refers to the current template/instantiation (see https://en.cppreference.com/w/cpp/language/injected-class-name for details). The `MapTemplate` template expect a non-instantiated template as the first template argument, not the concrete instantiation of `Expr`.
At least msvc interprets `Expr` as the injected class name, whereas gcc and clang use the global `flang::evaluate::Expr` template. Disambiguate by explicitly using the namespace.
This patch is part of the series to [[ http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html | make flang compilable with MS Visual Studio ]].
Reviewed By: DavidTruby
Differential Revision: https://reviews.llvm.org/D85646
Tim Keith [Sat, 22 Aug 2020 17:11:36 +0000 (10:11 -0700)]
[flang] Fix assert on bad character kind
When we report an error for a bad character kind, don't keep it in the
`DeclTypeSpec`. Otherwise there could be further problems. In this case,
`ComputeOffsets()` got an assertion error because we didn't recognize
`CHARACTER(*,8)` as needing a descriptor because of the bad kind.
Fixes https://bugs.llvm.org/show_bug.cgi?id=47173
Differential Revision: https://reviews.llvm.org/D86357
Jonas Devlieghere [Sat, 22 Aug 2020 07:36:32 +0000 (00:36 -0700)]
[lldb] Extract reproducer providers & co into their own header.
Extract all the provider related logic from Reproducer.h and move it
into its own header ReproducerProvider.h. These classes are seeing most
of the development these days and this reorganization reduces
incremental compilation from ~520 to ~110 files when making changes to
the new header.
Michael Kruse [Sat, 22 Aug 2020 15:14:20 +0000 (10:14 -0500)]
[Polly] Ensure consistent Scop::InstStmtMap. NFC.
InstStmtMap became inconsistent with ScopStmt::getInstructions() after
the statement's instructions is modified, e.g. by being considered
unused by the Simplify pass or being moved by ForwardOpTree.
Change ScopStmt::setInstructions() to also update its parent's
InstStmtMap. Also add assertions checking the consistency.
Michael Kruse [Sat, 22 Aug 2020 14:47:10 +0000 (09:47 -0500)]
[Polly] Fix use-after-free.
VirtualUse of type UseKind::Inter expects the definition of a
llvm::Value to be represented in another statement. In the bug report
that statement has been removed due to its domain being empty.
Scop::InstStmtMap for the llvm::Value's defintion still pointed to the
removed statement, which resulted in the use-after-free.
The defintion statement was removed by Simplify because it was
considered to not be reachable by other uses; trivially because it is
never executed due to its empty domain. However, no such thing happend
to the using statement using the value altough its domain is also empty.
Fix by always removing statements with empty domains in Simplify since
these are not properly analyzable. A UseKind::Inter should always have a
statement with its defintion due to LLVM's SSA form.
Scop::removeStmtNotInDomainMap() also removes statements with empty
domains but does so without considering the context as used by
Simplify's analyzes.
In another angle, InstStmtMap pointing to removed statements should not
happen either and ForwardOpTree would have bailed out if the llvm::Value
definition was not represented by a statement. This will be corrected in
a followup-commit.
This fixes llvm.org/PR47098
Matt Arsenault [Mon, 3 Aug 2020 22:37:29 +0000 (18:37 -0400)]
GlobalISel: Merge FewerElements for G_BUILD_VECTOR/G_CONCAT_VECTORS
This switches from using G_EXTRACT in odd cases to widen with undef
and unmerge.
Simon Pilgrim [Sat, 22 Aug 2020 14:09:44 +0000 (15:09 +0100)]
[X86] ia32intrin.h - pull out common attributes used in cast helpers into define. NFCI.
Jeremy Morse [Sat, 22 Aug 2020 14:18:52 +0000 (15:18 +0100)]
Fix some builds after
20bb9fe565a
-Wsuggest-override indicates this VarLocBasedLDV method needs the
override keyword.
LLVM GN Syncbot [Sat, 22 Aug 2020 13:52:08 +0000 (13:52 +0000)]
[gn build] Port
20bb9fe565a
Jeremy Morse [Sat, 22 Aug 2020 13:10:16 +0000 (14:10 +0100)]
[LiveDebugValues] Install an implementation-picking LiveDebugValues pass
This patch renames the current LiveDebugValues class to "VarLocBasedLDV"
and removes the pass-registration code from it. It creates a separate
LiveDebugValues class that deals with pass registration and management,
that calls through to VarLocBasedLDV::ExtendRanges when
runOnMachineFunction is called. This is done through the "LDVImpl"
abstract class, so that a future patch can install the new
instruction-referencing LiveDebugValues implementation and have it
picked at runtime.
No functional change is intended, just shuffling responsibilities.
Differential Revision: https://reviews.llvm.org/D83046
Simon Pilgrim [Sat, 22 Aug 2020 13:41:40 +0000 (14:41 +0100)]
Enable constexpr on BITREVERSE builtin intrinsics (PR47249)
This enables us to use the __builtin_bitreverse 8/16/32/64 intrinsics inside constexpr code.
Differential Revision: https://reviews.llvm.org/D86339
Simon Pilgrim [Sat, 22 Aug 2020 13:34:08 +0000 (14:34 +0100)]
Enable constexpr on ROTATELEFT/ROTATERIGHT builtin intrinsics (PR47249)
This enables us to use the __builtin_rotateleft / __builtin_rotateright 8/16/32/64 intrinsics inside constexpr code.
Differential Revision: https://reviews.llvm.org/D86342
Sanjay Patel [Sat, 22 Aug 2020 13:38:13 +0000 (09:38 -0400)]
[InstCombine] canonicalize 'not' ops before logical shifts
This reverses the existing transform that would uniformly canonicalize any 'xor' after any shift. In the case of logical shifts, that turns a 'not' into an arbitrary 'xor' with constant, and that's probably not as good for analysis, SCEV, or codegen.
The SCEV motivating case is discussed in:
http://bugs.llvm.org/PR47136
There's an analysis motivating case at:
http://bugs.llvm.org/PR38781
I did draft a patch that would do the same for 'ashr' but that's questionable because it's just swapping the position of a 'not' and uncovers at least 2 missing folds that we would probably need to deal with as preliminary steps.
Alive proofs:
https://rise4fun.com/Alive/BBV
Name: shift right of 'not'
Pre: C2 == (-1 u>> C1)
%a = lshr i8 %x, C1
%r = xor i8 %a, C2
=>
%n = xor i8 %x, -1
%r = lshr i8 %n, C1
Name: shift left of 'not'
Pre: C2 == (-1 << C1)
%a = shl i8 %x, C1
%r = xor i8 %a, C2
=>
%n = xor i8 %x, -1
%r = shl i8 %n, C1
Name: ashr of 'not'
%a = ashr i8 %x, C1
%r = xor i8 %a, -1
=>
%n = xor i8 %x, -1
%r = ashr i8 %n, C1
Differential Revision: https://reviews.llvm.org/D86243
Sanjay Patel [Fri, 21 Aug 2020 21:30:57 +0000 (17:30 -0400)]
[DAGCombiner] clean up merge of truncated stores; NFC
This code handles the special-case of i8 stores,
but it could be generalized to deal with other types.
Simon Pilgrim [Sat, 22 Aug 2020 13:12:05 +0000 (14:12 +0100)]
[docs] Replace "constexpr expressions" with "constant expressions".
Based off comment from @rsmith on D86339
Nathan James [Sat, 22 Aug 2020 12:57:34 +0000 (13:57 +0100)]
[clang-tidy] readability-simplify-boolean-expr detects negated literals
Adds support for detecting cases like `if (!true) ...`.
Addresses [[ https://bugs.llvm.org/show_bug.cgi?id=47166 | readability-simplify-boolean-expr not detected for negated boolean literals. ]]
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D86176
LLVM GN Syncbot [Sat, 22 Aug 2020 12:40:06 +0000 (12:40 +0000)]
[gn build] Port
fba06e3c85a