Shoaib Meenai [Fri, 21 Aug 2020 19:54:31 +0000 (12:54 -0700)]
[compiler-rt] Disable ranlib when using libtool
libtool already produces a table of contents, and ranlib just gives
spurious errors because it doesn't understand universal binaries.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D86365
Shoaib Meenai [Fri, 21 Aug 2020 17:49:59 +0000 (10:49 -0700)]
[llvm-libtool-darwin] Add support for -V option
The -V option in cctools' libtool prints out the version number and
performs any specified operation. Add this option to LLVM's version.
cctools is more forgiving of invalid command lines when -V is specified,
but I think it's better to give errors instead of silently producing no
output.
Unfortunately, when -V is present, options that would otherwise be
required aren't anymore, so we need to perform some manual argument
validation.
Reviewed By: alexshap
Differential Revision: https://reviews.llvm.org/D86359
Dimitry Andric [Mon, 24 Aug 2020 20:45:02 +0000 (22:45 +0200)]
Add <stdarg.h> include to kmp_os.h, to get the va_list type, required
after
cde8f4c164a2. Sort system includes, while here.
Dimitry Andric [Sat, 22 Aug 2020 13:25:18 +0000 (15:25 +0200)]
Move special va_list handling to kmp_os.h
Instead of copying and pasting the same `#ifdef` expressions in multiple
places, define a type and a pair of macros in `kmp_os.h`, to handle
whether `va_list` is pointer-like or not:
* `kmp_va_list` is the type to use for `__kmp_fork_call()`
* `kmp_va_deref()` dereferences a `va_list`, if necessary
* `kmp_va_addr_of()` takes the address of a `va_list`, if necessary
Also add FreeBSD to the list of OSes that has a non pointer-like
va_list. This can now be easily extended to other OSes too.
Reviewed By: AndreyChurbanov
Differential Revision: https://reviews.llvm.org/D86397
Bjorn Pettersson [Mon, 24 Aug 2020 17:15:34 +0000 (19:15 +0200)]
[Scalarizer] Avoid updating the name of globals
The "takeName" logic at the end of ScalarizerVisitor::finish
could end up renaming global variables when having simplified
and extractelement instruction to simply pick a single vector
element. If the input vector to the extractelement instruction
held pointers to global variables we ended up renaming the global
variable.
The patch make sure we only take the name of the replaced Op when
we have added new instructions that might need a useful name.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D86472
Tim Keith [Mon, 24 Aug 2020 19:53:44 +0000 (12:53 -0700)]
[flang] Fix bug accessing implicit variable in specification expression
A specification expression can reference an implicitly declared variable
in the host procedure. Because we have to process specification parts
before execution parts, this may be the first time we encounter the
variable. We were assuming the variable was implicitly declared in the
scope where it was encountered, leading to an error because local
variables may not be referenced in specification expressions.
The fix is to tentatively create the implicit variable in the host
procedure because that is the only way the specification expression can
be valid. We mark it with the flag `ImplicitOrError` to indicate that
either it must be implicitly defined in the host (by being mentioned in
the execution part) or else its use turned out to be an error.
We need to apply the implicit type rules of the host, which requires
some changes to implicit typing.
Variables in common blocks are allowed to appear in specification expressions
(because they are not locals) but the common block definition may not appear
until after their use. To handle this we create common block symbols and object
entities for each common block object during the `PreSpecificationConstruct`
pass. This allows us to remove the corresponding code in the main visitor and
`commonBlockInfo_.curr`. The change in order of processing causes some
different error messages to be emitted.
Some cleanup is included with this change:
- In `ExpressionAnalyzer`, if an unresolved name is encountered but
no error has been reported, emit an internal error.
- Change `ImplicitRulesVisitor` to hide the `ImplicitRules` object
that implements it. Change the interface to pass in names rather
than having to get the first character of the name.
- Change `DeclareObjectEntity` to have the `attrs` argument default
to an empty set; that is the typical case.
- In `Pre(parser::SpecificationPart)` use "structured bindings" to
give names to the pieces that make up a specification-part.
- Enhance `parser::Unwrap` to unwrap `Statement` and `UnlabeledStatement`
and make use of that in PreSpecificationConstruct.
Differential Revision: https://reviews.llvm.org/D86322
Roman Lebedev [Mon, 24 Aug 2020 19:39:03 +0000 (22:39 +0300)]
[NFC][InstCombine] Multi-level aggregate test for phi-of-insertvalue pattern
See https://reviews.llvm.org/D86306
Roman Lebedev [Mon, 24 Aug 2020 19:33:58 +0000 (22:33 +0300)]
[NFC][InstCombine] Adjust naming for some methods to match coding standards
Requested as preparatory cleanup in https://reviews.llvm.org/D86306#inline-799065
Roland Froese [Mon, 24 Aug 2020 19:30:04 +0000 (15:30 -0400)]
[PowerPC] Extend custom lower of vector truncate to handle wider input
Current custom lowering of truncate vector handles a source of up to 128 bits, but that only uses one of the two shuffle vector operands. Extend it to use both operands to handle 256 bit sources.
Differential Revision: https://reviews.llvm.org/D68035
zhanghb97 [Mon, 24 Aug 2020 18:54:38 +0000 (18:54 +0000)]
[mlir] Add Index Type, Floating Point Type and None Type subclasses to python bindings.
Based on the PyType and PyConcreteType classes, this patch implements the bindings of Index Type, Floating Point Type and None Type subclasses.
These three subclasses share the same binding strategy:
- The function pointer `isaFunction` points to `mlirTypeIsA***`.
- The `mlir***TypeGet` C API is bound with the `***Type` constructor in the python side.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D86466
Greg Clayton [Mon, 10 Aug 2020 22:07:47 +0000 (15:07 -0700)]
Add hashing of the .text section to ProcessMinidump.
Breakpad will always have a UUID for binaries when it creates minidump files. If an ELF files has a GNU build ID, it will use that. If it doesn't, it will create one by hashing up to the first 4096 bytes of the .text section. LLDB was not able to load these binaries even when we had the right binary because the UUID didn't match. LLDB will use the GNU build ID first as the main UUID for a binary and fallback onto a 8 byte CRC if a binary doesn't have one. With this fix, we will check for the Breakpad hash or the Facebook hash (a modified version of the breakpad hash that collides a bit less) and accept binaries when these hashes match.
Differential Revision: https://reviews.llvm.org/D86261
Fangrui Song [Mon, 24 Aug 2020 18:37:18 +0000 (11:37 -0700)]
Revert D85812 "[coroutine] should disable inline before calling coro split"
This reverts commit
2e43acfed89b1903de473f682c65878bdebc395a.
LLVMCoroutines (the library which contains Coroutines.h) depends on LLVMipo (the
library which contains SampleProfile.cpp). It is inappropriate for
SampleProfile.cpp to depent on Coroutines.h (circular dependency).
The test inverted dependencies as well:
llvm/test/Transforms/Coroutines/coro-inline.ll uses -sample-profile.
Matt Arsenault [Fri, 31 Jul 2020 18:50:39 +0000 (14:50 -0400)]
AMDGPU: Add flag to disable promotion of uniform i16 ops
This interferes with GlobalISel's much better handling of the
situation.
This should really be disable for GlobalISel. However, the fallback
only re-runs the selection passes, and doesn't go back and rerun any
codegen IR passes. I haven't come up with a good solution to this
problem.
Julian Lettner [Mon, 24 Aug 2020 18:30:58 +0000 (11:30 -0700)]
[TSan][Darwin] Handle NULL argument in interceptor
Handle NULL address argument in the `mach_vm_[de]allocate()`
interceptors and fix test: `Assignment 2` is not valid if we weren't
able to re-allocate memory.
rdar://
67680613
vnalamot [Mon, 24 Aug 2020 18:25:34 +0000 (23:55 +0530)]
[AMDGPU, docs] Fix typos
Reviewed By: t-tye, Flakebi
Differential Revision: https://reviews.llvm.org/D86340
Valentin Clement [Mon, 24 Aug 2020 18:22:34 +0000 (14:22 -0400)]
[flang][openacc] Fix reduction operator parsing/unparsing
Update the way reduction operator are defined for the OpenACC parser.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D86296
Gongyu Deng [Mon, 24 Aug 2020 16:58:17 +0000 (18:58 +0200)]
[lldb] type category name common completion
1. Added a new common completion TypeCategoryNames to provide a list of category names for completion;
2. Applied the completion to these commands: type category delete/enable/disable/list/define;
3. Added a related test case;
4. Bound the completion to the arguments of the type 'eArgTypeName'.
Reviewed By: teemperor, JDevlieghere
Differential Revision: https://reviews.llvm.org/D84124
Matt Arsenault [Sun, 2 Aug 2020 18:52:20 +0000 (14:52 -0400)]
TableGen/GlobalISel: Allow inst matcher to check multiple opcodes
This is to initially handleg immAllOnesV, which should match
G_BUILD_VECTOR or G_BUILD_VECTOR_TRUNC. In the future, it could be
used for other patterns cases that map to multiple G_* instructions,
such as G_ADD and G_PTR_ADD.
Craig Topper [Mon, 24 Aug 2020 17:06:07 +0000 (10:06 -0700)]
[LegalizeTypes][X86] Add ROTL/ROTR to WidenVectorResult.
We can widen these just like any other binary operation.
Added test cases for v2i32 for X86 for coverage.
Fixes failures seen after D77152.
Jay Foad [Mon, 24 Aug 2020 09:52:38 +0000 (10:52 +0100)]
[SDAG] Convert FSHL <--> FSHR if the target only supports one of them
D77152 tried to do this but got it wrong in the shift-by-zero case.
D86430 reverted the wrong code. Reimplement the optimization with
different code depending on whether the shift amount is known to be
non-zero (modulo bitwidth).
This improves code quality for fshl tests on AMDGPU, which only has an
fshr instruction.
Differential Revision: https://reviews.llvm.org/D86438
Sameeran joshi [Mon, 24 Aug 2020 14:21:45 +0000 (19:51 +0530)]
[FLANG] Pick `.md` files when building sphinx documentation.
Need to build sphinx using below flags to Cmake
`-DLLVM_ENABLE_SPHINX=ON -DSPHINX_WARNINGS_AS_ERRORS=OFF`.
Generate html docs using cmake target
`docs-flang-html`
Generated html files should be at `build/tools/flang/docs/html`.
Patch in series from the dicussion on review
https://reviews.llvm.org/D85828
After this patch the markdown docmentation must be written using guide in-
`llvm/docs/MarkdownQuickstartTemplate.md`
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D86131
Gongyu Deng [Mon, 24 Aug 2020 15:34:32 +0000 (17:34 +0200)]
[lldb] Remote disk file/directory completion for platform commands
1. Extended the gdb-remote communication related classes with disk file/directory
completion functions;
2. Added two common completion functions RemoteDiskFiles and
RemoteDiskDirectories based on the functions above;
3. Added completion for these commands:
A. platform get-file <remote-file> <local-file>;
B. platform put-file <local-file> <remote-file>;
C. platform get-size <remote-file>;
D. platform settings -w <remote-dir>;
E. platform open file <remote-file>.
4. Added related tests for client and server;
5. Updated docs/lldb-platform-packets.txt.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D85284
Gongyu Deng [Mon, 24 Aug 2020 12:23:23 +0000 (14:23 +0200)]
[lldb] common completion for process pids and process names
1. Added two common completions: `ProcessIDs` and `ProcessNames`, which are
refactored from their original dedicated option completions;
2. Removed the dedicated option completion functions of `process attach` and
`platform process attach`, so that they can use arg-type-bound common
completions instead;
3. Bound `eArgTypePid` to the pid completion, `eArgTypeProcessName` to the
process name completion in `CommandObject.cpp`;
4. Added a related test case.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D80700
Florian Hahn [Tue, 18 Aug 2020 10:12:31 +0000 (11:12 +0100)]
[DSE,MemorySSA] Do not use callCapturesBefore in isReadClobber.
Using callCapturesBefore potentially improves the precision and the
number of stores we can remove. But in practice, it seems to have very
little impact in terms of stores removed. For example, for
SPEC2000/SPEC2006/MultiSource with -O3 -flto, ~50 more stores are
removed (out of ~26900 stores removed). But in terms of compile-time, it
is very expensive and the patch gives substantial compile-time
improvements: Geomean O3 -0.24%, ReleaseThinLTO -0.47%, ReleaseLTO-g
-0.39%.
http://llvm-compile-time-tracker.com/compare.php?from=
612a0bff88ed906c83b82f079d4c49e5fecfb9d0&to=
e6c86b96d20d97dd88e903a409bd8d39b6114312&stat=instructions
Raphael Isemann [Mon, 24 Aug 2020 15:07:56 +0000 (17:07 +0200)]
[clang][NFC] Fix a GCC warning in ASTImporterTest.cpp
Apparently only overriding one of the two CompleteType overloads causes
GCC to emit a warning with -Woverloaded-virtual .
Matt Arsenault [Wed, 19 Aug 2020 20:26:22 +0000 (16:26 -0400)]
AMDGPU/GlobalISel: Use unmerge instead of extract in addrspace queries
This is a bit more consistent with regular operation legalization.
AndreyChurbanov [Mon, 24 Aug 2020 14:50:38 +0000 (17:50 +0300)]
[OpenMP] Check if _MSC_VER is defined before using it
Patch by mati865@gmail.com
Differential Revision: https://reviews.llvm.org/D86448
Dokyung Song [Fri, 21 Aug 2020 22:40:26 +0000 (22:40 +0000)]
[libFuzzer] Make msan.test:SimpleCmpTest succeed with less trials.
Currently SimpleCmpTest passes after 9,831,994 trials on x86_64/Linux
when the number of given trials is 10,000,000, just a little bigger than
that. This patch modifies SimpleCmpTest.cpp so that the test passes with less
trials, reducing its chances of future failures as libFuzzer evolves. More
specifically, this patch changes a 32-bit equality check to a 8-bit equality
check, making this test pass at 4,635,303 trials.
Differential Revision: https://reviews.llvm.org/D86382
Thomas Preud'homme [Wed, 19 Aug 2020 14:47:42 +0000 (15:47 +0100)]
Test all CHECK-NOT in a block even if one fails
This commit makes FileCheck print all CHECK-NOT directive failure in a
CHECK-NOT block even if one fails. Prior to that, it would stop trying
to match CHECK-NOT directive as soon as one in the block fails.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D86315
Baptiste Saleil [Mon, 24 Aug 2020 14:14:16 +0000 (09:14 -0500)]
[PowerPC] Add clang options to control MMA support
This patch adds frontend and backend options to enable and disable
the PowerPC MMA operations added in ISA 3.1. Instructions using these
options will be added in subsequent patches.
Differential Revision: https://reviews.llvm.org/D81442
Eduardo Caldas [Mon, 24 Aug 2020 14:11:52 +0000 (14:11 +0000)]
[SyntaxTree] Split `DynamicExceptionSpecification` test
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.