Sanjay Patel [Thu, 6 Aug 2020 16:54:55 +0000 (12:54 -0400)]
[VectorCombine] add tests for load+insert; NFC
Adrian Prantl [Wed, 5 Aug 2020 20:57:14 +0000 (13:57 -0700)]
Correctly detect legacy iOS simulator Mach-O objectfiles
The code in ObjectFileMachO didn't disambiguate between ios and
ios-simulator object files for Mach-O objects using the legacy
ambiguous LC_VERSION_MIN load commands. This used to not matter before
taught ArchSpec that ios and ios-simulator are no longer compatible.
rdar://problem/
66545307
Differential Revision: https://reviews.llvm.org/D85358
cgyurgyik [Thu, 6 Aug 2020 19:21:07 +0000 (15:21 -0400)]
[libc] Add tolower, toupper implementation.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D85326
Anton Afanasyev [Tue, 14 Jul 2020 15:04:25 +0000 (18:04 +0300)]
[SLP] Fix order of `insertelement`/`insertvalue` seed operands
Summary:
This patch takes the indices operands of `insertelement`/`insertvalue`
into account while generation of seed elements for `findBuildAggregate()`.
This function has kept the original order of `insert`s before.
Also this patch optimizes `findBuildAggregate()` preventing it from
redundant temporary vector allocations and its multiple reversing.
Fixes llvm.org/pr44067
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83779
Evgenii Stepanov [Thu, 6 Aug 2020 18:32:33 +0000 (11:32 -0700)]
Fix CFI issues in <future>
This change fixes errors reported by Control Flow Integrity (CFI) checking when using `std::packaged_task`. The errors mostly stem from casting the underlying storage (`__buf_`) to `__base*`, even if it is uninitialized. The solution is to wrap `__base*` access to `__buf_` behind a getter marked with _LIBCPP_NO_CFI.
Differential Revision: https://reviews.llvm.org/D82627
Matt Arsenault [Thu, 6 Aug 2020 18:57:11 +0000 (14:57 -0400)]
Add freeze keyword to IR emacs mode
MaheshRavishankar [Thu, 6 Aug 2020 18:48:49 +0000 (11:48 -0700)]
[mlir][SPIR-V] Fix wrongly placed Rationale section.
Differential Revision: https://reviews.llvm.org/D85461
Jonas Devlieghere [Thu, 6 Aug 2020 18:45:12 +0000 (11:45 -0700)]
[lldb] Use target.GetLaunchInfo() instead of creating an empty one.
Update tests that were creating an empty LaunchInfo instead of using the
one coming from the target. This ensures target properties are honored.
Aleksandr Platonov [Thu, 6 Aug 2020 18:44:08 +0000 (21:44 +0300)]
[clangd] Fix crash in bugprone-bad-signal-to-kill-thread clang-tidy check.
Inside clangd, clang-tidy checks don't see preprocessor events in the preamble.
This leads to `Token::PtrData == nullptr` for tokens that the macro is defined to.
E.g. `#define SIGTERM 15`:
- Token::Kind == tok::numeric_constant (Token::isLiteral() == true)
- Token::UintData == 2
- Token::PtrData == nullptr
As the result of this, bugprone-bad-signal-to-kill-thread check crashes at null-dereference inside clangd.
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D85417
dfukalov [Fri, 31 Jul 2020 00:56:54 +0000 (03:56 +0300)]
[AMDGPU][CostModel] Add f16, f64 and contract cases to fused costs estimation.
Add cases of fused fmul+fadd/fsub with f16 and f64 operands to cost model.
Also added operations with contract attribute.
Fixed line endings in test.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D84995
Matt Arsenault [Mon, 27 Jul 2020 13:58:17 +0000 (09:58 -0400)]
GlobalISel: Implement fewerElementsVector for G_EXTRACT_VECTOR_ELT
Use the same basic strategy as LegalizeVectorTypes. Try to index into
smaller pieces if there's a constant index, and otherwise fall back to
a stack temporary.
Arthur Eubanks [Wed, 5 Aug 2020 20:49:00 +0000 (13:49 -0700)]
[NewPM][LoopUnswitch] Pin loop-unswitch to legacy PM or use simple-loop-unswitch
As mentioned in
http://lists.llvm.org/pipermail/llvm-dev/2020-July/143395.html,
loop-unswitch has not been ported to the NPM. Instead people are using
simple-loop-unswitch.
Pin all tests in Transforms/LoopUnswitch to legacy PM and replace all
other uses of loop-unswitch with simple-loop-unswitch.
One test that didn't fit into the above was
2014-06-21-congruent-constant.ll which seems to only pass with
loop-unswitch. That is also pinned to legacy PM.
Now all tests containing "-loop-unswitch" anywhere in the test succeed with
NPM turned on by default.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D85360
Aaron En Ye Shi [Wed, 5 Aug 2020 19:53:30 +0000 (19:53 +0000)]
[HIP] Ignore invalid ar linker options
Instead of accepting the same arguments as regular linker,
the static linker will only accept input files.
Reviewed By: yaxunl
Differential Revision: https://reviews.llvm.org/D85442
Fred Riss [Thu, 6 Aug 2020 17:38:06 +0000 (10:38 -0700)]
[lldb/testsuite] Change get_debugserver_exe to support Rosetta
In order to be able to run the debugserver tests against the Rosetta
debugserver, detect the Rosetta run configuration and return the
system Rosetta debugserver.
Arthur Eubanks [Thu, 6 Aug 2020 04:32:26 +0000 (21:32 -0700)]
[NewPM] Pin -assumption-cache-tracker tests to legacy PM
All tests have corresponding NPM RUN lines.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D85395
Matt Arsenault [Tue, 4 Aug 2020 21:42:47 +0000 (17:42 -0400)]
AMDGPU: Define raw/struct variants of buffer atomic fadd
Somehow the new FP atomic buffer intrinsics ended up using the legacy
style for buffer intrinsics.
Sterling Augustine [Thu, 6 Aug 2020 17:16:23 +0000 (10:16 -0700)]
Remove unused variable "saved_opts".
wattr_get is a macro, and the documentation states:
"The parameter opts is reserved for future use,
applications must supply a null pointer."
In practice, passing a variable there is harmless, except
that it is unused inside the macro, which causes unused
variable warnings.
The various places where
Matt Arsenault [Thu, 6 Aug 2020 17:10:08 +0000 (13:10 -0400)]
AArch64/GlobalISel: Fix verifier error after selecting returnaddress
This was caching the wrong register to re-use later.
Simon Pilgrim [Thu, 6 Aug 2020 17:00:06 +0000 (18:00 +0100)]
[SLP][X86] Regenerate sdiv test noticed in D83779. NFC.
Mircea Trofin [Thu, 6 Aug 2020 16:21:14 +0000 (09:21 -0700)]
[NFC]{MLInliner] Point out the tests' model dependencies
Matt Arsenault [Fri, 31 Jul 2020 23:31:07 +0000 (19:31 -0400)]
AMDGPU: Fix spilling of 96-bit AGPRs
Matt Arsenault [Thu, 2 Jul 2020 02:34:16 +0000 (22:34 -0400)]
AMDGPU/GlobalISel: Start trying to handle AGPR bank
Try to use AGPR banks for the various merge/unmerge type
operations. Previously these would introduce copies to VGPR.
Matt Arsenault [Thu, 16 Jul 2020 21:18:43 +0000 (17:18 -0400)]
GlobalISel: Define InvalidRegBankID enum value
Alexey Bataev [Thu, 6 Aug 2020 16:36:52 +0000 (12:36 -0400)]
[OPENMP]Fix for Windows buildbots, NFC.
Alexey Bataev [Fri, 26 Jun 2020 21:42:31 +0000 (17:42 -0400)]
[OPENMP]Redesign of OMPExecutableDirective/OMPDeclarativeDirective representation.
Summary:
Introduced OMPChildren class to handle all associated clauses, statement
and child expressions/statements. It allows to represent some directives
more correctly (like flush, depobj etc. with pseudo clauses, ordered
depend directives, which are standalone, and target data directives).
Also, it will make easier to avoid using of CapturedStmt in directives,
if required (atomic, tile etc. directives).
Also, it simplifies serialization/deserialization of the
executable/declarative directives.
Reduces number of allocation operations for mapper declarations.
Reviewers: jdoerfert
Subscribers: yaxunl, guansong, jfb, cfe-commits, sstefan1, aaron.ballman, caomhin
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83261
Simon Pilgrim [Thu, 6 Aug 2020 16:13:13 +0000 (17:13 +0100)]
[InstCombine] Add tests for mul(add(x,c),negpow2) -> mul(sub(-c,x),pow2) fold
Also fix some undef vector elements in the similar vector tests that I missed.
Mircea Trofin [Thu, 6 Aug 2020 16:04:15 +0000 (09:04 -0700)]
[llvm][MLInliner] Don't log 'mandatory' events
We don't want mandatory events in the training log. We do want to handle
them, to keep the native size accounting accurate, but that's all.
Fixed the code, also expanded the test to capture this.
Differential Revision: https://reviews.llvm.org/D85373
Joel E. Denny [Thu, 6 Aug 2020 15:36:27 +0000 (11:36 -0400)]
[OpenMP] Fix ref count dec for implicit map of partial data
D85342 broke this case. The new test case presents an example.
Reviewed By: grokos
Differential Revision: https://reviews.llvm.org/D85369
Raphael Isemann [Tue, 4 Aug 2020 12:18:41 +0000 (14:18 +0200)]
[lldb][NFC] Document and encapsulate OriginMap in ASTContextMetadata
Just adds the respective accessor functions to ASTContextMetadata instead
of directly exposing the OriginMap to the whole world.
Simon Pilgrim [Thu, 6 Aug 2020 15:31:40 +0000 (16:31 +0100)]
[InstCombine] Add tests for mul(sub(x,y),negpow2) -> mul(sub(y,x),pow2) fold
Add full vector coverage (that currently are not folded).
Simon Pilgrim [Thu, 6 Aug 2020 15:13:50 +0000 (16:13 +0100)]
PDBExtras.h - remove unnecessary raw_ostream forward declaration. NFCI.
We already need to include raw_ostream.h, also add missing StringRef.h implicit dependency.
Fangrui Song [Thu, 6 Aug 2020 15:26:43 +0000 (08:26 -0700)]
[ELF] Allow sections after a non-SHF_ALLOC section to be covered by PT_LOAD
GNU ld allows sections after a non-SHF_ALLOC section to be covered by PT_LOAD
(PR37607) and assigns addresses to non-SHF_ALLOC output sections (similar to
SHF_ALLOC NOBITS sections. The location counter is not advanced).
This patch tries to fix PR37607 (remove a special case in
`Writer<ELFT>::createPhdrs`). To make the created PT_LOAD meaningful, we cannot
reset dot to 0 for a middle non-SHF_ALLOC output section. This results in
removal of two special cases in LinkerScript::assignOffsets. Non-SHF_ALLOC
non-orphan sections can have non-zero addresses like in GNU ld.
The zero address rule for non-SHF_ALLOC sections is weakened to apply to orphan
only. This results in a special case in createSection and findOrphanPos, respectively.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D85100
Matt Arsenault [Sun, 26 Jul 2020 15:46:23 +0000 (11:46 -0400)]
AMDGPU/GlobalISel: Handle llvm.amdgcn.ds.{fadd|fmin|fmax}
These intrinsics are missing mangling for both the pointer and data
type.
Matt Arsenault [Wed, 15 Jul 2020 17:49:03 +0000 (13:49 -0400)]
AMDGPU/GlobalISel: Try to promote to use packed saturating add/sub
This produces worse results right now for i8 vectors, but that should
be addressed when we actually try to optimize packed vectors.
Sanjay Patel [Thu, 6 Aug 2020 14:49:26 +0000 (10:49 -0400)]
[PatternMatch] allow intrinsic form of min/max with existing matchers
I skimmed the existing users of these matchers and don't see any problems
(eg, the caller assumes the matched value was a select instruction without checking).
So I think we can generalize the matching to allow the new intrinsics or the cmp+select idioms.
I did not find any unit tests for the matchers, so added some basics there. The instsimplify
tests are adapted from existing tests for the cmp+select pattern and cover the folds in
simplifyICmpWithMinMax().
Differential Revision: https://reviews.llvm.org/D85230
Matt Arsenault [Fri, 31 Jul 2020 20:01:38 +0000 (16:01 -0400)]
AMDGPU/GlobalISel: Move frame index selection to patterns
Doesn't really save any code until global value is handled too.
Matt Arsenault [Sun, 26 Jul 2020 15:30:44 +0000 (11:30 -0400)]
AMDGPU: Fix code duplication between the selectors
Not sure this is the right place for this helper.
jasonliu [Thu, 6 Aug 2020 13:19:59 +0000 (13:19 +0000)]
[XCOFF][AIX] Put each jump table in an independent section if -ffunction-sections is specified
If a function is in a unique section, putting all jump tables in
.rodata will prevent functions that have a jump table to get
garbage collect by the linker.
Therefore, we need to put jump table into a unique section as well.
Reviewed By: Xiangling_L
Differential Revision: https://reviews.llvm.org/D84761
Matt Arsenault [Sat, 25 Jul 2020 20:26:33 +0000 (16:26 -0400)]
AMDGPU/GlobalISel: Implement expansion for rsq.clamp
Not sure why we handle this removed instruction on newer subtargets
for this one and no others, but maintain compatibility with the DAG.
Matt Arsenault [Sat, 18 Jul 2020 16:35:28 +0000 (12:35 -0400)]
AMDGPU/GlobalISel: Fix trying to widen <3 x s1> boolean ops
Matt Arsenault [Fri, 10 Jul 2020 20:12:35 +0000 (16:12 -0400)]
AMDGPU/GlobalISel: Stop using G_EXTRACT in argument lowering
We really need to put this undef padding stuff into a helper
somewhere, but leave that for when this is moved to generic code.
Matt Arsenault [Fri, 31 Jul 2020 15:04:13 +0000 (11:04 -0400)]
AMDGPU/GlobalISel: Implement LLT version of allowsMisalignedMemoryAccesses
Tim Keith [Thu, 6 Aug 2020 13:47:59 +0000 (06:47 -0700)]
[flang] Add options to control IMPLICIT NONE
Add `-fimplicit-none-type-always` to treat each specification-part
like it has `IMPLICIT NONE`. This is helpful for enforcing good Fortran
programming practices. We might consider something similar for
`IMPLICIT NONE(EXTERNAL)` as well.
Add `-fimplicit-none-type-never` to ignore occurrences of `IMPLICIT NONE`
and `IMPLICIT NONE(TYPE)`. This is to handle cases like the one below,
which violates the standard but it accepted by some compilers:
```
subroutine s(a, n)
implicit none
real :: a(n)
integer :: n
end
```
Differential Revision: https://reviews.llvm.org/D85363
Matt Arsenault [Thu, 30 Jul 2020 02:34:11 +0000 (22:34 -0400)]
AMDGPU/GlobalISel: Make s16 phi legal
If we were to have an operation with an s16 def that needs to be
executed in a waterfall loop, not having s16 legal would place an
avoidable burden on RegBankSelect to widen it.
Matt Arsenault [Wed, 22 Jul 2020 03:24:02 +0000 (23:24 -0400)]
AMDGPU/GlobalISel: Fix assert on copy to vcc
This was trying to constrain a physical register. By the verifier's
understanding, it's impossible to have a 1-bit copy to vcc/vcc_lo so
don't try to handle physregs.
Raphael Isemann [Thu, 6 Aug 2020 13:15:36 +0000 (15:15 +0200)]
Revert "PDBExtras.h - remove unnecessary raw_ostream forward declaration. NFCI."
This reverts commit
87c5437afd273e909e0fed3389de7531d5452ea5.
The commit includes several headers in the middle of a function, which
breaks pretty much everything.
Nicolas Vasilache [Thu, 6 Aug 2020 13:01:57 +0000 (09:01 -0400)]
[mlir][Vector] NFC - Use matchAndRewrite in ContractionOp lowering patterns
Replace the use of separate match and rewrite which unnecessarily duplicates logic.
Differential Revision: https://reviews.llvm.org/D85421
Peter Smith [Wed, 5 Aug 2020 11:47:54 +0000 (12:47 +0100)]
[DOCS] Add more detail to stack protector documentation
The Clang -fstack-protector documentation mentions what functions are considered
vulnerable but does not mention the details of the implementation such as the use
of a global variable for the guard value. This brings the documentation more in
line with the GCC documentation at:
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
and gives someone using the option more idea about what is protected.
This partly addresses https://bugs.llvm.org/show_bug.cgi?id=42764
Differential Revision: https://reviews.llvm.org/D85239
Xing GUO [Thu, 6 Aug 2020 12:41:12 +0000 (20:41 +0800)]
[DWARFYAML][debug_info] Make the 'Values' field optional.
This patch makes the 'Values' field optional. This is useful when we
handcraft the terminating entry of DIEs.
```
debug_info:
- Version: 4
...
Entries:
- AbbrCode: 1
Values:
- Value: 0x1234
- AbbrCode: 0 ## Termination
```
Reviewed By: jhenderson, grimar
Differential Revision: https://reviews.llvm.org/D85397
Xing GUO [Thu, 6 Aug 2020 12:39:34 +0000 (20:39 +0800)]
[obj2yaml] Test dumping an empty .debug_aranges section.
This patch adds one test case that tests dumping an empty .debug_aranges
section.
Reviewed By: jhenderson, grimar
Differential Revision: https://reviews.llvm.org/D85405
David Spickett [Mon, 3 Aug 2020 14:09:48 +0000 (15:09 +0100)]
[lldb][AArch64] Correct compile options for Neon corefile
SVE is not required, it has its own test. Note that
there is no "+neon" so "+simd" is used instead.
Also rename the file to match the name of the corefile
it produces.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D85134
Muhammad Omair Javaid [Thu, 6 Aug 2020 12:33:26 +0000 (17:33 +0500)]
[LLDB] Skip test_launch_simple from TestTargetAPI.py on Arm/AArch64 Linux
Recently added TestTargetAPI.py test "test_launch_simple" is failing on
Arm/AArch64 Linux targets. Putting them to skip until fixed.
Differential Revision: https://reviews.llvm.org/D85235
Petar Avramovic [Thu, 6 Aug 2020 12:26:10 +0000 (14:26 +0200)]
[GlobalISel][InlineAsm] Fix matching input constraint to physreg
Add given input and mark it as tied.
Doesn't create additional copy compared to
matching input constraint to virtual register.
Differential Revision: https://reviews.llvm.org/D85122
Anatoly Trosinenko [Thu, 6 Aug 2020 11:34:10 +0000 (14:34 +0300)]
[ABI][NFC] Fix the confusion of ByVal and ByRef argument names
The second argument of getNaturalAlignIndirect() was `bool ByRef`, but
the implementation was just delegating to getIndirect() with `ByRef`
passed unchanged to `bool ByVal` parameter of getIndirect().
Fix a couple of /*ByRef=*/ comments as well.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D85113
Simon Pilgrim [Thu, 6 Aug 2020 12:17:36 +0000 (13:17 +0100)]
BitstreamRemarkParser.h - remove unnecessary includes. NFCI.
Remove unused includes, moving to the lib header or cpp file as necessary.
Muhammad Omair Javaid [Thu, 6 Aug 2020 11:30:05 +0000 (16:30 +0500)]
Revert "[ELF] Allow sections after a non-SHF_ALLOC section to be covered by PT_LOAD"
This reverts commit
030ddc0a0bb9e2b25319eb681d520a9cee32b761.
This breaks http://lab.llvm.org:8011/builders/lldb-arm-ubuntu
and http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu
Differential Revision: https://reviews.llvm.org/D85100
Simon Pilgrim [Thu, 6 Aug 2020 10:46:53 +0000 (11:46 +0100)]
Fix include sorting order. NFC
Simon Pilgrim [Thu, 6 Aug 2020 10:46:19 +0000 (11:46 +0100)]
[X86] getX86MaskVec - replace mask limit from NumElts < 8 with NumElts <= 4
As noted on PR46885, the number of mask elements should always be a power of 2, so to fix the static analyzer warning we are better off replacing the condition to <= 4, and I've added a pow2 assertion as well.
Simon Pilgrim [Thu, 6 Aug 2020 10:28:29 +0000 (11:28 +0100)]
PDBExtras.h - remove unnecessary raw_ostream forward declaration. NFCI.
We already need to include raw_ostream.h, also add missing StringRef.h and cstdint implicit dependencies.
Remove unnecessary includes from PDBExtras.cpp
Simon Pilgrim [Wed, 5 Aug 2020 19:14:48 +0000 (20:14 +0100)]
[X86][SSE] Expose all memory offsets in expand load tests
Since we're messing with individual element loads we need to expose this to show whats going on.
Part of the work to fix the masked_expandload.ll regressions in D66004
Paul Walker [Wed, 5 Aug 2020 16:19:54 +0000 (17:19 +0100)]
[SVE] Lower scalable vector mul operations.
This allows us to remove extra patterns from AArch64SVEInstrInfo.td
because we can reuse those required for fixed length vectors.
Differential Revision: https://reviews.llvm.org/D85328
Nicolas Vasilache [Thu, 6 Aug 2020 09:13:33 +0000 (05:13 -0400)]
[mlir][Linalg] Introduce canonicalization to remove dead LinalgOps
When any of the memrefs in a structured linalg op has a zero dimension, it becomes dead.
This is consistent with the fact that linalg ops deduce their loop bounds from their operands.
Note however that this is not the case for the `tensor<0xelt_type>` which is a special convention
that must be lowered away into either `memref<elt_type>` or just `elt_type` before this
canonicalization can kick in.
Differential Revision: https://reviews.llvm.org/D85413
Paul Walker [Thu, 6 Aug 2020 10:01:39 +0000 (11:01 +0100)]
[SVE] Implement lowering for fixed length vector multiplication.
NOTE: Also uses SVE code generation for NEON size vectors, instead
of expanding i64 based vector multiplications.
Differential Revision: https://reviews.llvm.org/D85327
Christian Sigg [Sat, 1 Aug 2020 13:06:25 +0000 (15:06 +0200)]
[MLIR] Change GpuLaunchFuncToGpuRuntimeCallsPass to wrap a RewritePattern with the same functionality.
The RewritePattern will become one of several, and will be part of the LLVM conversion pass (instead of a separate pass following LLVM conversion).
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D84946
Valeriy Savchenko [Wed, 5 Aug 2020 14:32:24 +0000 (17:32 +0300)]
[analyzer][tests] Understand when diagnostics change between builds
Before the patch `SATest compare`, produced quite obscure results
when something about the diagnostic have changed (i.e. its description
or the name of the corresponding checker) because it was simply two
lists of warnings, ADDED and REMOVED. It was up to the developer
to match those warnings, understand that they are essentially the
same, and figure out what caused the difference.
This patch introduces another category of results: MODIFIED.
It tries to match new warnings against the old ones and prints out
clues on what is different between two builds.
Differential Revision: https://reviews.llvm.org/D85311
Alexey Lapshin [Tue, 4 Aug 2020 16:46:33 +0000 (19:46 +0300)]
[dsymutil] Disable dsymutil/X86/reproducer.test on windows.
The dsymutil/X86/reproducer.test test could create paths
longer than MAX_PATH:
C:\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win
\build\test\tools\dsymutil\X86\Output\reproducer.test.tmp.repro
\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win\build
\test\tools\dsymutil\X86\Output\reproducer.test.tmp\Inputs\
basic1.macho.x86_64.o
Disable this test on windows.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D85294
Alexander Belyaev [Thu, 6 Aug 2020 08:33:48 +0000 (10:33 +0200)]
[mlir] Lower DimOp to LLVM for unranked memrefs.
Differential Revision: https://reviews.llvm.org/D85361
Irina Dobrescu [Wed, 5 Aug 2020 14:58:13 +0000 (15:58 +0100)]
[flang] Add parser support for OpenMP allocate clause
Differential Revision: https://reviews.llvm.org/D85212
Juneyoung Lee [Thu, 30 Jul 2020 14:15:26 +0000 (23:15 +0900)]
[InstCombine] Fold freeze(undef) into a proper constant
This is a simple patch that folds freeze(undef) into a proper constant after inspecting its uses.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D84948
Juneyoung Lee [Thu, 6 Aug 2020 05:32:42 +0000 (14:32 +0900)]
[InstCombine] Add tests for D84948; NFC
David Green [Thu, 6 Aug 2020 09:10:50 +0000 (10:10 +0100)]
[LoopVectorizer] Inloop vector reductions
Arm MVE has multiple instructions such as VMLAVA.s8, which (in this
case) can take two 128bit vectors, sign extend the inputs to i32,
multiplying them together and sum the result into a 32bit general
purpose register. So taking 16 i8's as inputs, they can multiply and
accumulate the result into a single i32 without any rounding/truncating
along the way. There are also reduction instructions for plain integer
add and min/max, and operations that sum into a pair of 32bit registers
together treated as a 64bit integer (even though MVE does not have a
plain 64bit addition instruction). So giving the vectorizer the ability
to use these instructions both enables us to vectorize at higher
bitwidths, and to vectorize things we previously could not.
In order to do that we need a way to represent that the reduction
operation, specified with a llvm.experimental.vector.reduce when
vectorizing for Arm, occurs inside the loop not after it like most
reductions. This patch attempts to do that, teaching the vectorizer
about in-loop reductions. It does this through a vplan recipe
representing the reductions that the original chain of reduction
operations is replaced by. Cost modelling is currently just done through
a prefersInloopReduction TTI hook (which follows in a later patch).
Differential Revision: https://reviews.llvm.org/D75069
Alex Zinenko [Wed, 5 Aug 2020 22:52:20 +0000 (00:52 +0200)]
[mlir] take MLIRContext instead of LLVMDialect in getters of LLVMType's
Historical modeling of the LLVM dialect types had been wrapping LLVM IR types
and therefore needed access to the instance of LLVMContext stored in the
LLVMDialect. The new modeling does not rely on that and only needs the
MLIRContext that is used for uniquing, similarly to other MLIR types. Change
LLVMType::get<Kind>Ty functions to take `MLIRContext *` instead of
`LLVMDialect *` as first argument. This brings the code base closer to
completely removing the dependence on LLVMContext from the LLVMDialect,
together with additional support for thread-safety of its use.
Depends On D85371
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D85372
Alex Zinenko [Wed, 5 Aug 2020 22:52:10 +0000 (00:52 +0200)]
[mlir] Remove most uses of LLVMDialect::getModule
This prepares for the removal of llvm::Module and LLVMContext from the
mlir::LLVMDialect.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D85371
Raphael Isemann [Thu, 6 Aug 2020 08:51:37 +0000 (10:51 +0200)]
[lldb] Fix LLDB compilation with ncurses 6.2 due to wattr_set/get being a macro
My ncurses 6.2 arch defines those two functions as macros, so the scope operator
doesn't work here.
Roman Lebedev [Thu, 6 Aug 2020 08:34:03 +0000 (11:34 +0300)]
[NFC][InstCombine] Refactor '(-NSW x) pred x' fold
Roman Lebedev [Thu, 6 Aug 2020 08:28:54 +0000 (11:28 +0300)]
[InstCombine] (-NSW x) u<= x --> x s<=0 (PR39480)
Name: (-x) u<= x --> x s<= 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp ule i8 %neg_x, %x
=>
%r = icmp sle i8 %x, 0
https://rise4fun.com/Alive/V22
https://bugs.llvm.org/show_bug.cgi?id=39480
Roman Lebedev [Thu, 6 Aug 2020 08:26:48 +0000 (11:26 +0300)]
[InstCombine] (-NSW x) u< x --> x s< 0 (PR39480)
Name: (-x) u< x --> x s< 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp ult i8 %neg_x, %x
=>
%r = icmp slt i8 %x, 0
https://rise4fun.com/Alive/zSuf
https://bugs.llvm.org/show_bug.cgi?id=39480
Roman Lebedev [Thu, 6 Aug 2020 08:23:59 +0000 (11:23 +0300)]
[InstCombine] (-NSW x) u>= x --> x s>= 0 (PR39480)
Name: (-x) u>= x --> x s>= 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp uge i8 %neg_x, %x
=>
%r = icmp sge i8 %x, 0
https://rise4fun.com/Alive/LLHd
https://bugs.llvm.org/show_bug.cgi?id=39480
Roman Lebedev [Thu, 6 Aug 2020 08:20:04 +0000 (11:20 +0300)]
[InstCombine] (-NSW x) u> x --> x s> 0 (PR39480)
Name: (-x) u> x --> x s> 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp ugt i8 %neg_x, %x
=>
%r = icmp sgt i8 %x, 0
https://rise4fun.com/Alive/Raea
https://bugs.llvm.org/show_bug.cgi?id=39480
Roman Lebedev [Thu, 6 Aug 2020 08:14:28 +0000 (11:14 +0300)]
[InstCombine] (-NSW x) s<= x --> x s>= 0 (PR39480)
Name: (-x) s<= x --> x >= 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp sle i8 %neg_x, %x
=>
%r = icmp sge i8 %x, 0
https://rise4fun.com/Alive/91k
https://bugs.llvm.org/show_bug.cgi?id=39480
Roman Lebedev [Thu, 6 Aug 2020 08:10:38 +0000 (11:10 +0300)]
[InstCombine] (-NSW x) s< x --> x s> 0 (PR39480)
Name: (-x) s< x --> x > 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp slt i8 %neg_x, %x
=>
%r = icmp sgt i8 %x, 0
https://rise4fun.com/Alive/3IXb
https://bugs.llvm.org/show_bug.cgi?id=39480
Roman Lebedev [Thu, 6 Aug 2020 08:07:17 +0000 (11:07 +0300)]
[InstCombine] (-NSW x) s>= x --> x s<= 0 (PR39480)
Name: (-x) s>= x --> x s<= 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp sge i8 %neg_x, %x
=>
%r = icmp sle i8 %x, 0
https://rise4fun.com/Alive/Hdip
https://bugs.llvm.org/show_bug.cgi?id=39480
Roman Lebedev [Thu, 6 Aug 2020 08:02:29 +0000 (11:02 +0300)]
[InstCombine] (-NSW x) ==/!= x --> x ==/!= 0 (PR39480)
Name: (-x) == x --> x == 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp eq i8 %neg_x, %x
=>
%r = icmp eq i8 %x, 0
Name: (-x) != x --> x != 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp ne i8 %neg_x, %x
=>
%r = icmp ne i8 %x, 0
https://rise4fun.com/Alive/4slH
https://bugs.llvm.org/show_bug.cgi?id=39480
Roman Lebedev [Thu, 6 Aug 2020 07:45:32 +0000 (10:45 +0300)]
[InstCombine] (-NSW x) s> x --> x s< 0 (PR39480)
Name: (-x) s> x --> x s< 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp sgt i8 %neg_x, %x
=>
%r = icmp slt i8 %x, 0
https://rise4fun.com/Alive/ZslD
https://bugs.llvm.org/show_bug.cgi?id=39480
Roman Lebedev [Thu, 6 Aug 2020 07:27:03 +0000 (10:27 +0300)]
[NFC][InstCombine] Add tests for comparisons between x and negation of x (PR39480)
Rainer Orth [Thu, 6 Aug 2020 08:47:16 +0000 (10:47 +0200)]
[clang][Driver] Don't hardcode --as-needed/--no-as-needed on Illumos
`ninja check-all` currently fails on Illumos:
[84/716] Generating default/Asan-i386-inline-Test
FAILED: projects/compiler-rt/lib/asan/tests/default/Asan-i386-inline-Test
cd /var/llvm/dist-amd64-release/projects/compiler-rt/lib/asan/tests && /var/llvm/dist-amd64-release/./bin/clang ASAN_INST_TEST_OBJECTS.gtest-all.cc.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_globals_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_interface_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_internal_interface_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_oob_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_mem_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_str_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_test_main.cpp.i386-inline.o -o /var/llvm/dist-amd64-release/projects/compiler-rt/lib/asan/tests/default/./Asan-i386-inline-Test -g --driver-mode=g++ -fsanitize=address -m32
ld: fatal: unrecognized option '--no-as-needed'
ld: fatal: use the -z help option for usage information
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
`clang` unconditionally passes `--as-needed`/`--no-as-needed` to the
linker. This works on Solaris 11.[34] which added a couple of option
aliases to the native linker to improve compatibility with GNU `ld`.
Illumos `ld` didn't do this, so one needs to use the corresponding
native options `-z ignore`/`-z record` instead.
Because this works on both Solaris and Illumos, the current patch always
passes the native options on Solaris. This isn't fully correct, however:
when using GNU `ld` on Solaris (not yet supported; I'm working on that),
one still needs `--as-needed` instead.
I'm hardcoding this decision because a generic detection via a `cmake` test
is hard: many systems have their own implementation of `getDefaultLinker`
and `cmake` would have to duplicate the information encoded there.
Besides, it would still break when `-fuse-ld` is used.
Tested on `amd64-pc-solaris2.11` (Solaris 11.4 and OpenIndiana 2020.04),
`sparcv9-sun-solaris2.11`, and `x86_64-pc-linux-gnu`.
Differential Revision: https://reviews.llvm.org/D84412
Xing GUO [Thu, 6 Aug 2020 08:37:52 +0000 (16:37 +0800)]
[DWARFYAML][debug_info] Pull out dwarf::FormParams from DWARFYAML::Unit.
Unit.Format, Unit.Version and Unit.AddrSize are replaced with
dwarf::FormParams in D84496 to get rid of unnecessary functions
getOffsetSize() and getRefSize(). However, that change makes it
difficult to make AddrSize optional (Optional<uint8_t>). This change
pulls out dwarf::FormParams from DWARFYAML::Unit and use it as a helper
struct in DWARFYAML::emitDebugInfo().
Reviewed By: jhenderson, MaskRay
Differential Revision: https://reviews.llvm.org/D85296
Alex Richardson [Thu, 6 Aug 2020 07:56:46 +0000 (08:56 +0100)]
[compiler-rt] Fix build of Sanitizer-Test_Nolibc after D80648
Running ninja check-sanitizer fails for after that patch (commit
058f5f6fd813d1ee1480497394d6fd44e65ec62b) with the following error:
libRTSanitizerCommon.test.nolibc.x86_64.a(sanitizer_posix.cpp.o): In
function `__sanitizer::GetNamedMappingFd(char const*, unsigned long,
int*)':
..../llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp:358:
undefined reference to `fcntl'
clang-12: error: linker command failed with exit code 1 (use -v to see
invocation)
This patch works around the problem by only calling fcntl if O_CLOEXEC
is not defined.
Reviewed By: plopresti
Differential Revision: https://reviews.llvm.org/D85114
Alex Richardson [Thu, 6 Aug 2020 07:53:47 +0000 (08:53 +0100)]
[lit] Remove ANSI control characters from xunit output
Failing test output sometimes contains control characters like \x1b (e.g.
if there was some -fcolor-diagnostics output) which are not allowed inside
XML files. This causes problems with CI systems: for example, the Jenkins
JUnit XML will throw an exception when ecountering those characters and
similar problems also occur with GitLab CI.
Reviewed By: yln, jdenny
Differential Revision: https://reviews.llvm.org/D84233
Alex Richardson [Thu, 6 Aug 2020 07:53:04 +0000 (08:53 +0100)]
Fix qsort() interceptor for FreeBSD
When the FreeBSD qsort() implementation recurses, it does so using an
interposable function call, so we end up calling the interceptor again
and set the saved comparator to wrapped_qsort_compar. This results in an
infinite loop and a eventually a stack overflow since wrapped_qsort_compar
ends up calling itself. This means that ASAN is completely broken on
FreeBSD for programs that call qsort(). I found this while running
check-all on a FreeBSD system a ASAN-instrumented LLVM.
Fix this by checking whether we are recursing inside qsort before writing
to qsort_compar. The same bug exists in the qsort_r interceptor, so use the
same approach there. I did not test the latter since the qsort_r function
signature does not match and therefore it's not intercepted on FreeBSD/macOS.
Fixes https://llvm.org/PR46832
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D84509
Alex Richardson [Thu, 6 Aug 2020 07:25:10 +0000 (08:25 +0100)]
[update_cc_test_checks.py] Add test for D84511
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D85115
Aleksandr Platonov [Thu, 6 Aug 2020 07:30:43 +0000 (10:30 +0300)]
[clang-tidy] Fix bugprone-bad-signal-to-kill-thread crash when `SIGTERM` is not a literal.
If `SIGTERM` is not a literal (e.g. `#define SIGTERM ((unsigned)15)`) bugprone-bad-signal-to-kill-thread check crashes.
Stack dump:
```
#0 0x000000000217d15a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/llvm-project/build/bin/clang-tidy+0x217d15a)
#1 0x000000000217b17c llvm::sys::RunSignalHandlers() (/llvm-project/build/bin/clang-tidy+0x217b17c)
#2 0x000000000217b2e3 SignalHandler(int) (/llvm-project/build/bin/clang-tidy+0x217b2e3)
#3 0x00007f6a7efb1390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x000000000212ac9b llvm::StringRef::getAsInteger(unsigned int, llvm::APInt&) const (/llvm-project/build/bin/clang-tidy+0x212ac9b)
#5 0x0000000000593501 clang::tidy::bugprone::BadSignalToKillThreadCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/llvm-project/build/bin/clang-tidy+0x593501)
```
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D85398
Aleksandr Platonov [Thu, 6 Aug 2020 07:27:38 +0000 (10:27 +0300)]
[clang-tidy] Fix bugprone-bad-signal-to-kill-thread crash when `SIGTERM` was undefined after definition.
`PP->getMacroInfo()` returns nullptr for undefined macro, which leads to null-dereference at `MI->tockens().back()`.
Stack dump:
```
#0 0x000000000217d15a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/llvm-project/build/bin/clang-tidy+0x217d15a)
#1 0x000000000217b17c llvm::sys::RunSignalHandlers() (/llvm-project/build/bin/clang-tidy+0x217b17c)
#2 0x000000000217b2e3 SignalHandler(int) (/llvm-project/build/bin/clang-tidy+0x217b2e3)
#3 0x00007f39be5b1390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x0000000000593532 clang::tidy::bugprone::BadSignalToKillThreadCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/llvm-project/build/bin/clang-tidy+0x593532)
```
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D85401
Craig Topper [Thu, 6 Aug 2020 07:13:40 +0000 (00:13 -0700)]
[X86] Rename X86::getImpliedFeatures to X86::updateImpliedFeatures and pass clang's StringMap directly to it.
No point in building a vector of StringRefs for clang to apply to the
StringMap. Just pass the StringMap and modify it directly.
Luboš Luňák [Wed, 5 Aug 2020 08:57:02 +0000 (10:57 +0200)]
[lldb][gui] use names for color pairs, instead of magic numbers
Differential Revision: https://reviews.llvm.org/D85286
Luboš Luňák [Tue, 4 Aug 2020 09:58:51 +0000 (11:58 +0200)]
[lldb][gui] use syntax highlighting also in gui mode
Use the same functionality as the non-gui mode, the colors just
need translating to curses colors.
Differential Revision: https://reviews.llvm.org/D85145
Luboš Luňák [Mon, 3 Aug 2020 11:44:47 +0000 (13:44 +0200)]
[lldb][gui] truncate long lines/names if needed
Without this, sources with long lines or variable names may overwrite
panel frames, or even overrun to the following line. There's currently
no way to scroll left/right in the views, so that should be added
to handle these cases.
This commit includes fixing constness of some Window functions,
and also makes PutCStringTruncated() consistent with the added
printf-like variant to take the padding as the first argument (can't
add it after the format to the printf-like function).
Differential Revision: https://reviews.llvm.org/D85123
Martin Storsjö [Tue, 4 Aug 2020 11:41:48 +0000 (14:41 +0300)]
[AArch64] [Windows] Error out on unsupported symbol locations
These might occur in seemingly generic assembly. Previously when
targeting COFF, they were silently ignored, which certainly won't
give the right result. Instead clearly error out, to make it clear
that the assembly needs to be adjusted for this target.
Also change a preexisting report_fatal_error into a proper error
message, pointing out the offending source instruction. This isn't
strictly an internal error, as it can be triggered by user input.
Differential Revision: https://reviews.llvm.org/D85242
Martin Storsjö [Tue, 4 Aug 2020 11:26:16 +0000 (14:26 +0300)]
[ARM, AArch64] Fix a comment typo. NFC.
Chuanqi Xu [Thu, 6 Aug 2020 06:21:55 +0000 (14:21 +0800)]
[Coroutines] Use to collect lifetime marker of in CoroFrame Differential Revision: https://reviews.llvm.org/D85279